query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
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": "747e091b7b079550c1b687c8e2cc8d65", "score": "0.0", "text": "func (s CreateClusterOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "01aa6964793db8db3a8d2bb1e94f5a82", "score": "0.6356525", "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": "4ef987fe3192563c6dca972fb1a50812", "score": "0.632477", "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": "8a5a12466c6811f56a7bcda917f55a4a", "score": "0.62939554", "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": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.6221709", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ea98e45b6b5627266bea3540df3580ff", "score": "0.60869354", "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": "a98344e2ba45867a1c7a2aba22eb9436", "score": "0.60719275", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, strings.Join(i.allArgs(), \" \"))\n}", "title": "" }, { "docid": "242e82a0a19dcbc9b6c9d9c9435dd219", "score": "0.60465735", "text": "func (p Param) String() string {\n\treturn p.name\n}", "title": "" }, { "docid": "a38e5940fa335dd8c89de4e6f6fe0c13", "score": "0.6028343", "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": "d4b2d1752651c430f389fb8fdb8d0625", "score": "0.6015625", "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": "620a6c171cfa90973b9d5890650785a1", "score": "0.5991852", "text": "func (p Provider) String() string {\n\tres := fmt.Sprintf(`Deployment\n\tOwner: %s\n\tHostURI: %s\n\tAttributes: %v\n\t`, p.Owner, p.HostURI, p.Attributes)\n\n\tif !p.Info.IsEmpty() {\n\t\tres += fmt.Sprintf(\"Info: %v\\n\", p.Info)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "3818edbf94c07e4b9093a385052a9d8e", "score": "0.598662", "text": "func (s KeyUsagePropertyFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.59862894", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2719e5463c4a14b720950dc7b5311de5", "score": "0.59843946", "text": "func (c SandstormApi) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "da6270b609c9eb834149433d1f7b9d17", "score": "0.59138227", "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": "3622035dd78be1c999194c94b8e448bc", "score": "0.59028393", "text": "func (o VserverPeerGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7176b5fbd92b92fb6d7692b988128610", "score": "0.58938545", "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": "9bb275c943c0beef4334eec2d071bab3", "score": "0.5887272", "text": "func (s ServiceMemberAffiliation) String() string {\n\treturn string(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5879558", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9fabcb7f46be5a3190d0f03070d02857", "score": "0.5855688", "text": "func (s TeradataParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cca945207fb00f0f36c707031770f15c", "score": "0.5826843", "text": "func (s FindMatchesParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "612662a0b4743ca8d4d9be2102cb5d6b", "score": "0.58260447", "text": "func (o SnapmirrorInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4dbcf4e917e2636916cf8b979f3d6134", "score": "0.5804753", "text": "func (s AuthInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "107d9ae25b5bb5f0efc1b21eb657e2e8", "score": "0.5804044", "text": "func (s ServiceNowParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.58016926", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e53d73a1f0b48ee97950cf87755a5aa4", "score": "0.5793561", "text": "func (p MemberPhase) String() string {\n\treturn string(p)\n}", "title": "" }, { "docid": "2f7820e821041f9829c4fdd36133b3ae", "score": "0.5789496", "text": "func (s SnowflakeParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "688c90c02e605d9d4d7bd3536d8860ce", "score": "0.5789354", "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": "e988010bbe0a9e1db934209b8b5bcc6f", "score": "0.5769897", "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": "b0831d56d78eb25a6bd124b5253a8818", "score": "0.57688123", "text": "func (s AthenaParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1b758e5865c8ab1a46d5df02c34efbf", "score": "0.5765056", "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": "2bf29bb7788b0325d56f79f403b0399c", "score": "0.57391894", "text": "func (s GroupConfigurationParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7636368760d495cf80bff6d187b32e57", "score": "0.57287806", "text": "func (s KeyUsageFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1050fda86d17f688f12ea9cf1ca474f4", "score": "0.5724164", "text": "func (s StringParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fdcb7c512f5a3219c5207b118956b76b", "score": "0.5718389", "text": "func (s AccessLevelFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6889ace6d51031a4769b7becf1b14236", "score": "0.57108724", "text": "func (p *Properties) String() string {\n\ts := p.Wire\n\ts += \",\" + strconv.Itoa(p.Tag)\n\tif p.Required {\n\t\ts += \",req\"\n\t}\n\tif p.Optional {\n\t\ts += \",opt\"\n\t}\n\tif p.Repeated {\n\t\ts += \",rep\"\n\t}\n\tif p.Packed {\n\t\ts += \",packed\"\n\t}\n\ts += \",name=\" + p.OrigName\n\tif p.JSONName != \"\" {\n\t\ts += \",json=\" + p.JSONName\n\t}\n\tif p.Proto3 {\n\t\ts += \",proto3\"\n\t}\n\tif p.Oneof {\n\t\ts += \",oneof\"\n\t}\n\tif len(p.Enum) > 0 {\n\t\ts += \",enum=\" + p.Enum\n\t}\n\tif p.HasDefault {\n\t\ts += \",def=\" + p.Default\n\t}\n\treturn s\n}", "title": "" }, { "docid": "f51931e441557ea0755a24c5d17f8d8a", "score": "0.5696171", "text": "func (s FolderMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b82daa42075d9552a51df39c0b827bc3", "score": "0.56866294", "text": "func (s ActionParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a102628683574cfd3b9b626c5ef060f3", "score": "0.56800455", "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": "cf2556e7d19d4db94ba897ec78eb8ce8", "score": "0.567775", "text": "func (s BackendAPIAuthType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f22d9114d24746c8de07c97a5a480a3f", "score": "0.56754774", "text": "func (s MariaDbParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b0e9eb03ac1acff7d77526fa4a7c9763", "score": "0.5671267", "text": "func (s *SecurityGroup) String() string {\n\treturn fmt.Sprintf(\"id=%s/name=%s\", s.ID, s.Name)\n}", "title": "" }, { "docid": "b94dc708cf884aaff1358adbf52dc726", "score": "0.5666804", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s %v Protocol %s %s\", Name, Version,\n\t\tprotocol.ProtocolCompat, Additional)\n}", "title": "" }, { "docid": "4e772796cd7453f647e1840c6cc8255e", "score": "0.5664236", "text": "func (s ExasolParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14bb225a5bc3c710e0542334cfbc5d8b", "score": "0.5655295", "text": "func (msg MsgUpdateAttributeRequest) String() string {\n\tout, _ := yaml.Marshal(msg)\n\treturn string(out)\n}", "title": "" }, { "docid": "2537643a4d071d1910ad417707ce36dd", "score": "0.5647358", "text": "func (s DecimalParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6c28c8aaca1d6e615b02ba1a0fe23fa4", "score": "0.56461304", "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": "c516a84d056f26c8399e10d8c425f8d5", "score": "0.5634129", "text": "func (m *memberlist) String() string {\n\tm.members.RLock()\n\tstr, _ := json.Marshal(m.members.list) // will never return error (presumably)\n\tm.members.RUnlock()\n\treturn string(str)\n}", "title": "" }, { "docid": "ddaa7f3ca980afdb1a3b765eed303f19", "score": "0.5633173", "text": "func (this *AuthenticationInfo) String() string {\n\treturn this.headerName + core.SIPSeparatorNames_COLON +\n\t\tcore.SIPSeparatorNames_SP + this.EncodeBody() + core.SIPSeparatorNames_NEWLINE\n}", "title": "" }, { "docid": "6e4534d097926bf78e30faa03a4dbfa2", "score": "0.56273043", "text": "func (s EncryptionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6e4534d097926bf78e30faa03a4dbfa2", "score": "0.56273043", "text": "func (s EncryptionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6e4534d097926bf78e30faa03a4dbfa2", "score": "0.56273043", "text": "func (s EncryptionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "769287ffe8292f890bc58a173ae91995", "score": "0.5624597", "text": "func (d Definition) String() string {\n\treturn fmt.Sprintf(\"%s contains %v\", d.Name, d.PropertyMap)\n}", "title": "" }, { "docid": "da7fc379fb913b44067ba8bb174f7762", "score": "0.5623248", "text": "func (p *MigProfileInfo) String() string {\n\tvar suffix string\n\tif len(p.Attributes) > 0 {\n\t\tsuffix = \"+\" + strings.Join(p.Attributes, \",\")\n\t}\n\tif p.C == p.G {\n\t\treturn fmt.Sprintf(\"%dg.%dgb%s\", p.G, p.GB, suffix)\n\t}\n\treturn fmt.Sprintf(\"%dc.%dg.%dgb%s\", p.C, p.G, p.GB, suffix)\n}", "title": "" }, { "docid": "a2809403ae1c50b54893bb2151e19ccb", "score": "0.56203955", "text": "func (s UserInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2809403ae1c50b54893bb2151e19ccb", "score": "0.56203955", "text": "func (s UserInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27cdd9d7c54d5bf70d65a87059a69fe5", "score": "0.5618536", "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": "b560884a756c48de74c88e5daae702b6", "score": "0.5615099", "text": "func (s Parameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "43654c6e33398016c8cddf8e27e2eee5", "score": "0.5612322", "text": "func (v *AddSearchAttributeRequest) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.SearchAttribute != nil {\n\t\tfields[i] = fmt.Sprintf(\"SearchAttribute: %v\", v.SearchAttribute)\n\t\ti++\n\t}\n\tif v.SecurityToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"SecurityToken: %v\", *(v.SecurityToken))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"AddSearchAttributeRequest{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "37f061fd711936c7a11d7a95bdf4fbde", "score": "0.560506", "text": "func (s UpdateProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c4e6f78ab9efc3d2adc595555cbc1742", "score": "0.5602268", "text": "func (s TwitterParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fafd22c80468fed6306bc8c7bd78b444", "score": "0.559974", "text": "func (s PassThroughSettings) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5370a3268852f6091878ea71d78f9260", "score": "0.55984175", "text": "func (o LunUnmapRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "34f1f867fecec19b72af28de6ea47689", "score": "0.55888695", "text": "func (*cmdParams) String() string { return \"\\\"key=value\\\"\" }", "title": "" }, { "docid": "1cccefeaaf2eb268fb451df170f924c4", "score": "0.5588759", "text": "func (a activation) String() string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(a.Name)\n\tif a.version != nil {\n\t\tbuf.WriteRune(space)\n\t\tbuf.WriteString(a.version.String())\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "f03e58b3a35627fc881a91f47d0bca1c", "score": "0.55766326", "text": "func (s NiftyModifyCustomerGatewayAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "e70264b5141f287728d8cca08f161d9f", "score": "0.55766064", "text": "func (o NvmeInterfaceInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7ce1504713b7bab365ea146e3b0f29dd", "score": "0.55743015", "text": "func (s PermissionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7ce1504713b7bab365ea146e3b0f29dd", "score": "0.55743015", "text": "func (s PermissionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.5570066", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.5570066", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4de885385fadb3f25df3d3b83ac9c3ef", "score": "0.55638504", "text": "func (v Value) String() string {\n\treturn v.Format(OutFormatDebug)\n}", "title": "" }, { "docid": "c99526bf724daf27e2198e49fd1436a9", "score": "0.55637306", "text": "func (s AuroraParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.5563396", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.5563396", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "53cc1b0266be65c6a21d9942a3735ea5", "score": "0.5561115", "text": "func (s PublicAccess) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f82b31feba9aa1633ba7aad26b9e0814", "score": "0.55602384", "text": "func (s TransformParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1883279ec3e9d93f5fea5336ba153769", "score": "0.5559879", "text": "func (s CreateGroupMembershipOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "369dc076ba7b7d7cd192a56ffcf1333e", "score": "0.55596125", "text": "func (a *Attribute) String() string {\n\treturn fmt.Sprintf(\"%s:%v\", a.Name, a.Values)\n}", "title": "" }, { "docid": "82a715c0bf7bed9a15de98a6d323a0ab", "score": "0.5556334", "text": "func (s UpdateSAMLProviderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c3bbd5dae6f605d5554fa7ae6f1b15bc", "score": "0.5553289", "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": "d51664023c49fb40ffedd877f58adc82", "score": "0.5552208", "text": "func (cp *ChanPrivs) String() string {\n\tif cp == nil {\n\t\treturn \"No modes set\"\n\t}\n\tstr := \"+\"\n\tv := reflect.Indirect(reflect.ValueOf(cp))\n\tt := v.Type()\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tswitch f := v.Field(i); f.Kind() {\n\t\t// only bools here at the mo too!\n\t\tcase reflect.Bool:\n\t\t\tif f.Bool() {\n\t\t\t\tstr += ChanPrivToString[t.Field(i).Name]\n\t\t\t}\n\t\t}\n\t}\n\tif str == \"+\" {\n\t\tstr = \"No modes set\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "76891d2ef105ca81babcca9ea7376bca", "score": "0.55520326", "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": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.55510265", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "fc75b70ad02a634b15de40bd08893745", "score": "0.5550994", "text": "func (s SkewedInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9a42dd995b640336b501f132bc80850", "score": "0.55445915", "text": "func (s IdentityUsage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e727fa0658f75ea852d6b58e960ddaa3", "score": "0.5542092", "text": "func (o AggrCheckAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "00c1163767d3abb1b5bb0ff4add08f28", "score": "0.5538751", "text": "func (s InstanceInformationFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bee1fb6bd8a93238c04f815d04cc864e", "score": "0.5537851", "text": "func (f *Field) String() string {\n\treturn `{\"name\":\"` + f.name + `\",\"type\":` + f.typ.String() + `}`\n}", "title": "" }, { "docid": "f1562905de983ed2b0459de7a2f88a77", "score": "0.5534473", "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": "6e642bb0d7426f5c3dbbe95b6314e9a5", "score": "0.5533958", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Oracle Params:\n VotePeriod: %d\n VoteThreshold: %s\n\tRewardBand: %s\n\tRewardDistributionWindow: %d\n\tWhitelist %s\n\tSlashFraction %s\n\tSlashWindow %d\n\tMinValidPerWindow %s\n\t`, params.VotePeriod, params.VoteThreshold, params.RewardBand,\n\t\tparams.RewardDistributionWindow, params.Whitelist,\n\t\tparams.SlashFraction, params.SlashWindow, params.MinValidPerWindow)\n}", "title": "" }, { "docid": "50f66dd3c5ee3d58d139540cb5aeebf8", "score": "0.55299824", "text": "func (v *AdminService_AddSearchAttribute_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tif v.Request != nil {\n\t\tfields[i] = fmt.Sprintf(\"Request: %v\", v.Request)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"AdminService_AddSearchAttribute_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "760628dc9ce8e728fea11124a7582dc6", "score": "0.5529811", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Treasury Params:\n\tBasePool:\t\t %d\n\tPoolRecoveryPeriod: %d\n\tMinSpread: \t\t\t%s\n\tTobinTax: %s\n\t`, params.BasePool, params.PoolRecoveryPeriod, params.MinSpread, params.TobinTax)\n}", "title": "" }, { "docid": "84f5ec75482b37ba0bf144c02525a129", "score": "0.55214643", "text": "func (sk *PrivKey) String(name string) string {\n\treturn name + \"{-}\"\n}", "title": "" }, { "docid": "1faad40b091e6e266beeec4c155da274", "score": "0.5519218", "text": "func (msg MsgAddAttributeRequest) String() string {\n\tout, _ := yaml.Marshal(msg)\n\treturn string(out)\n}", "title": "" }, { "docid": "96e11bbfa1fd1ea8d6633d02461c51f3", "score": "0.55161285", "text": "func (o *Trustmembercreate) String() string {\n \n o.RoleIds = []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": "9ef5e2dda42ffa38cd7f17febde080e3", "score": "0.5512784", "text": "func (s ModifyCacheParameterGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5114245045380264003690e12b8813f9", "score": "0.5509848", "text": "func (wfn WellFormedName) String() string {\n\ts := \"wfn:[\"\n\tfor _, attr := range attributes {\n\t\ts += fmt.Sprintf(\"%s=\", attr)\n\t\to := wfn.Get(attr)\n\t\tif lv, ok := o.(LogicalValue); ok {\n\t\t\ts += fmt.Sprintf(\"%s, \", lv)\n\t\t} else {\n\t\t\ts += fmt.Sprintf(\"\\\"%s\\\", \", o)\n\t\t}\n\t}\n\ts = strings.TrimSpace(s)\n\ts = strings.TrimRight(s, \",\")\n\ts += \"]\"\n\treturn s\n}", "title": "" }, { "docid": "6c2079aa9a43306556dcdb122c5d7a36", "score": "0.55000013", "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": "cb53a1c9095f78a429dfd14395096199", "score": "0.54989487", "text": "func (s KeyUsageProperty) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e8f533f723673421e9235d139ac42475", "score": "0.54969835", "text": "func (s VpcSecurityGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e8f533f723673421e9235d139ac42475", "score": "0.54969835", "text": "func (s VpcSecurityGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
9050c3404be3e13667bcecef91d7677b
GetProcessDuration returns the process duration
[ { "docid": "6c38d1bec5d909e2b6d1d9d7b379bba8", "score": "0.7956108", "text": "func GetProcessDuration() int64 {\n\tpid := os.Getpid()\n\tp, err := process.NewProcess(int32(pid))\n\tif err == nil {\n\t\tprocCreateTime, err := p.CreateTime()\n\t\tif err == nil {\n\t\t\treturn time.Now().UnixNano()/int64(time.Millisecond) - procCreateTime\n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" } ]
[ { "docid": "112126846f68bec5607e3c2fbebecdac", "score": "0.62979245", "text": "func GetDuration(filename utils.FileName) time.Duration {\n\tdurationRaw, err := utils.SimpleExec(\"ffprobe\", \"-i\", string(filename), \"-show_entries\", \"format=duration\", \"-v\", \"quiet\", \"-of\", \"csv\")\n\tutils.Check(err)\n\tdurationString := strings.TrimSuffix(strings.Split(durationRaw, \",\")[1], \"\\n\") + \"s\"\n\tduration, err := time.ParseDuration(durationString)\n\tutils.Check(err)\n\treturn duration\n}", "title": "" }, { "docid": "21666708df8e097ab564de3937b1b8bb", "score": "0.6212109", "text": "func execDuration(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := flag.Duration(args[0].(string), time.Duration(args[1].(int64)), args[2].(string))\n\tp.Ret(3, ret)\n}", "title": "" }, { "docid": "199135ad122643c6ddf6486448fb4845", "score": "0.61324537", "text": "func ExampleGetDuration() {\n\t// Set some test variables\n\t_ = os.Setenv(\"DURATION_NAP\", \"20m\")\n\t_ = os.Setenv(\"DURATION_EGG\", \"5m\")\n\t_ = os.Setenv(\"DURATION_BIG_EGG\", \"\")\n\t_ = os.Setenv(\"DURATION_MATCH\", \"1.5h\")\n\n\t// returns time.Duration\n\tfmt.Println(GetDuration(\"DURATION_NAP\"))\n\tfmt.Println(GetDuration(\"DURATION_EGG\") * 2)\n\t// fallback with unset variable\n\tfmt.Println(GetDuration(\"DURATION_POWERNAP\", time.Minute*45))\n\t// or an empty one\n\tfmt.Println(GetDuration(\"DURATION_BIG_EGG\", time.Minute*10))\n\tfmt.Println(GetDuration(\"DURATION_MATCH\").Minutes())\n\n\t// Output:\n\t// 20m0s\n\t// 10m0s\n\t// 45m0s\n\t// 10m0s\n\t// 90\n\n\tos.Clearenv()\n}", "title": "" }, { "docid": "982582b13f3ee3b0491f83b09a6e42b5", "score": "0.6127538", "text": "func (f *FFMpeg) Duration(filePath string) (*time.Duration, error) {\n\tcmd := exec.Command(f.path, \"-i\", filePath, \"-f\", \"null\", \"-\")\n\n\tvar stderr bytes.Buffer\n\tcmd.Stderr = &stderr\n\tcmd.Start()\n\tcmd.Wait()\n\toutput := string(stderr.Bytes())\n\n\tre := regexp.MustCompile(`time=([0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]+)`)\n\tvar h, m int64\n\tvar s float64\n\n\tresults := re.FindAllString(output, -1)\n\tif len(results) < 1 {\n\t\treturn nil, ErrUnknownDuration\n\t}\n\tresult := results[len(results)-1]\n\n\tif _, err := fmt.Sscanf(result, `time=%d:%d:%f`, &h, &m, &s); err != nil {\n\t\treturn nil, ErrUnknownDuration\n\t}\n\td := time.Duration(h)*time.Hour + time.Duration(m)*time.Minute + time.Duration(s*1000000000)\n\treturn &d, nil\n}", "title": "" }, { "docid": "aad4eb442ebbebb55a0886f581107fc8", "score": "0.6076512", "text": "func GetDurationP(key string) time.Duration {\n\tv, err := GetDurationE(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1157b08279cd4149f5ca95fd08ec673a", "score": "0.6021644", "text": "func (c *EvalContext) GetDurationMs() float64 {\n\treturn float64(c.EndTime.Nanosecond()-c.StartTime.Nanosecond()) / float64(1000000)\n}", "title": "" }, { "docid": "2def71ba35c7a2862dce09d4b96a6dac", "score": "0.59455323", "text": "func (s *Stopwatch) Duration() time.Duration {\n\td := s.duration\n\n\tif true == s.running {\n\t\tnow := DepGetTime()\n\t\td += now.Sub(s.start)\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "d0f49763a1200d002ce16ccada563089", "score": "0.5882317", "text": "func (e Env) Duration() (*time.Duration, error) {\n\tkey := string(e)\n\tif env.Env().Has(key) {\n\t\tvalue, err := env.Env().Duration(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &value, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "4b95fc64390ad148c1ce5391317d8b4a", "score": "0.58595985", "text": "func GetDuration(path string) (string, error) {\n ctx, cancelFn := context.WithTimeout(context.Background(), 5 * time.Second)\n defer cancelFn()\n\n data, err := ffprobe.ProbeURL(ctx, path)\n if err != nil {\n return \"\", err\n }\n\n duration := fmt.Sprintf(\"%f\", data.Format.Duration().Seconds())\n parts := strings.Split(duration, \".\")\n\n return parts[0], nil\n}", "title": "" }, { "docid": "3b47ac2455d6f1725631365239a2e357", "score": "0.5858351", "text": "func elapsed() time.Duration {\n\t// Time.Sub() uses monotonic time.\n\treturn time.Now().Sub(processStart)\n}", "title": "" }, { "docid": "bef1a672fa97eb43f6374cf791d4d90a", "score": "0.5806988", "text": "func (s *Step) Duration() time.Duration {\n\tvar ret time.Duration\n\tswitch s.State {\n\tcase StateInProgress:\n\t\tret = time.Since(*s.StartedAt)\n\tcase StateDone:\n\t\tret = s.DoneAt.Sub(*s.StartedAt)\n\tcase StateNotStarted:\n\t\t// noop\n\tdefault:\n\t\t// noop\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "7b8ac48f9f159d4b64970ce23bb23b39", "score": "0.5753953", "text": "func Duration(name string, logic_name string, value time.Duration, required bool, usage string) *time.Duration {\n\treturn CommandLine.Duration(name, logic_name, value, required, usage)\n}", "title": "" }, { "docid": "9874d5f7c7016a6bc07b93c47fa678fb", "score": "0.5749265", "text": "func GetProcessStartTime(pid uint) (int, error) {\n\tstat, err := os.ReadFile(fmt.Sprintf(\"/proc/%d/stat\", pid))\n\tif err != nil {\n\t\treturn 0, errfmt.WrapError(err)\n\t}\n\t// see https://man7.org/linux/man-pages/man5/proc.5.html for how to read /proc/pid/stat\n\tstartTimeOffset := 22 // Offset start at 1\n\tcommOffset := 2\n\t// We want to remove the comm from the string, because it can contain a space which will change the offsets after split\n\tsplitByComm := bytes.SplitN(stat, []byte{')', ' '}, 2)\n\tif len(splitByComm) != 2 {\n\t\treturn 0, errfmt.Errorf(\"error in parsing /proc/<pid>/stat format - comm name is not surrounded by parentheses as expected\")\n\t}\n\tnewStartTimeOffset := startTimeOffset - commOffset\n\tsplitStat := bytes.SplitN(splitByComm[1], []byte{' '}, newStartTimeOffset+1)\n\tif len(splitStat) != newStartTimeOffset+1 {\n\t\treturn 0, errfmt.Errorf(\"error in parsing /proc/<pid>/stat format - only %d values found inside\", len(splitStat))\n\t}\n\tstartTime, err := strconv.Atoi(string(splitStat[newStartTimeOffset-1]))\n\tif err != nil {\n\t\treturn 0, errfmt.WrapError(err)\n\t}\n\n\treturn startTime, nil\n}", "title": "" }, { "docid": "87fdb2ad4f448a00a4b2c9a857aeea2b", "score": "0.5746024", "text": "func (s *Server) Duration() float64 {\n\ts.lock.RLock()\n\ts.lock.RUnlock()\n\treturn s.scrapeDone.Sub(s.scrapeBegin).Seconds()\n}", "title": "" }, { "docid": "26c75670b40e4c8f53405cb894c926eb", "score": "0.57390165", "text": "func (t *TaskLog) RunDuration() time.Duration {\n\treturn t.EndTime.Sub(t.StartTime)\n}", "title": "" }, { "docid": "9922f196ef72418ea228b09072eb55df", "score": "0.573576", "text": "func (_MicroPaySystem *MicroPaySystemCaller) Duration(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MicroPaySystem.contract.Call(opts, out, \"Duration\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1708f789bfc63f45685595413c61af9a", "score": "0.5720888", "text": "func GetDuration(r *http.Request) float64 {\n\tv := r.Context().Value(timerContextKey)\n\tif v == nil {\n\t\treturn -1\n\t}\n\tt := v.(*Timer)\n\treturn t.Duration()\n}", "title": "" }, { "docid": "2445423cf19388e33a6b3458f6a5bd83", "score": "0.5720043", "text": "func (ch *Base) GetTimeoutDuration() time.Duration {\n\treturn time.Duration(ch.Timeout) * time.Second\n}", "title": "" }, { "docid": "e2b6a2d5139fff10d28712f62049d143", "score": "0.5706285", "text": "func (o AppProjectSpecSyncWindowsOutput) Duration() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AppProjectSpecSyncWindows) *string { return v.Duration }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8ca5f9c85d322315166338ed1e8a1231", "score": "0.57056504", "text": "func (mj *MPIJob) Duration() time.Duration {\n\tmpijob := mj.mpijob\n\n\tif mpijob.CreationTimestamp.IsZero() {\n\t\treturn 0\n\t}\n\n\tif len(mj.chiefjob.Name) != 0 && mj.chiefjob.Status.CompletionTime != nil {\n\t\treturn mj.chiefjob.Status.CompletionTime.Time.Sub(mpijob.CreationTimestamp.Time)\n\t}\n\n\tif mj.isFailed() {\n\t\tcond := getPodLatestCondition(mj.chiefPod)\n\t\tif !cond.LastTransitionTime.IsZero() {\n\t\t\treturn cond.LastTransitionTime.Time.Sub(mpijob.CreationTimestamp.Time)\n\t\t} else {\n\t\t\tlog.Debugf(\"the latest condition's time is zero of pod %s\", mj.chiefPod.Name)\n\t\t}\n\t}\n\n\treturn metav1.Now().Sub(mpijob.CreationTimestamp.Time)\n}", "title": "" }, { "docid": "59bb346605ba9a4bb813b36de5c0f4e9", "score": "0.5693803", "text": "func GetDuration(duration string) (seconds int) {\n\tduration = strings.TrimSpace(duration)\n\tif duration == \"\" {\n\t\treturn 0\n\t}\n\n\t// Count hour.\n\tr := regexp.MustCompile(`\\d+ hr.`)\n\tmatch := r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\th := GetValueFromSplit(match[0], \" \", 0)\n\t\tseconds += StrToNum(h) * 3600\n\t}\n\n\t// Count minute.\n\tr = regexp.MustCompile(`\\d+ min.`)\n\tmatch = r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\tm := GetValueFromSplit(match[0], \" \", 0)\n\t\tseconds += StrToNum(m) * 60\n\t}\n\n\t// Count minute.\n\tr = regexp.MustCompile(`\\d+ sec.`)\n\tmatch = r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\ts := GetValueFromSplit(match[0], \" \", 0)\n\t\tseconds += StrToNum(s)\n\t}\n\n\treturn seconds\n}", "title": "" }, { "docid": "2b7be994a4b2a9ecf1d82c19fb1ba7ca", "score": "0.56822443", "text": "func (t *TaskLog) Duration() time.Duration {\n\treturn t.EndTime.Sub(t.AcceptTime)\n}", "title": "" }, { "docid": "512a6f78c35f0d7d79f39cede5d7216d", "score": "0.56676865", "text": "func (o *RemoteProcessGroupDTO) GetYieldDuration() string {\n\tif o == nil || o.YieldDuration == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.YieldDuration\n}", "title": "" }, { "docid": "e3c8be5af4e5002fb36486bf39d24e75", "score": "0.5649385", "text": "func (o *SilentPolicy) GetDuration() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Duration\n}", "title": "" }, { "docid": "fcc5859ad4a184a708aa54e3d9921533", "score": "0.56414765", "text": "func (p Period) Duration() time.Duration {\n\treturn time.Duration(p.Length) * time.Second\n}", "title": "" }, { "docid": "8f02f957973ddd19919f5e1d2922b753", "score": "0.56355083", "text": "func getDuration(tsPath, ffmpegNameStr string) (int, error) {\r\n\tvar errBuffer bytes.Buffer\r\n\targs := []string{\"-hide_banner\", \"-i\", tsPath}\r\n\tcmd := exec.Command(ffmpegNameStr, args...)\r\n\tcmd.Stderr = &errBuffer\r\n\t// Return code's always 1 as we're not providing any output files.\r\n\terr := cmd.Run()\r\n\tif err.Error() != \"exit status 1\" {\r\n\t\treturn 0, err\r\n\t}\r\n\terrStr := errBuffer.String()\r\n\tok := strings.HasSuffix(\r\n\t\tstrings.TrimSpace(errStr), \"At least one output file must be specified\")\r\n\tif !ok {\r\n\t\terrString := fmt.Sprintf(\"%s\\n%s\", err, errStr)\r\n\t\treturn 0, errors.New(errString)\r\n\t}\r\n\tdur := extractDuration(errStr)\r\n\tif dur == \"\" {\r\n\t\treturn 0, errors.New(\"No regex match.\")\r\n\t}\r\n\tdurSecs, err := parseDuration(dur)\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\treturn durSecs, nil\r\n}", "title": "" }, { "docid": "44527afde361ae756a3b502ec580d05b", "score": "0.5608461", "text": "func (m *ActivityStatistics) GetDuration()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration) {\n val, err := m.GetBackingStore().Get(\"duration\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)\n }\n return nil\n}", "title": "" }, { "docid": "f34ad7337b036bbf956e843db189e858", "score": "0.5587248", "text": "func (o *AllocationSplitRequest) GetDuration() int32 {\n\tif o == nil || o.Duration == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Duration\n}", "title": "" }, { "docid": "b8066fe90d4af47353bdc06a76b46e6d", "score": "0.557499", "text": "func (f *FlagSet) GetDuration(name string) (time.Duration, error) {\n\treturn f.fs.GetDuration(name)\n}", "title": "" }, { "docid": "653074c7de86d39a7810800d5d3d7b81", "score": "0.5561007", "text": "func (p *Poll) GetDuration() time.Duration {\n\treturn time.Duration(p.durationInSeconds) * time.Second\n}", "title": "" }, { "docid": "1a10ff522afa8b00b24381c63cc3f3cd", "score": "0.5560358", "text": "func GetFlagDuration(cmd *cobra.Command, name string) (v time.Duration) {\n\tv, err := cmd.Flags().GetDuration(name)\n\tif err != nil {\n\t\tfmt.Printf(\"error accessing flag %s for command %s: %s\", name, cmd.Name(), err)\n\t\tos.Exit(1)\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "09627f053957c87a190f6eaa10b97a57", "score": "0.5556795", "text": "func (o NrqlAlertConditionCriticalOutput) Duration() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v NrqlAlertConditionCritical) *int { return v.Duration }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "778eadec833d0078cbcf774cdcba106e", "score": "0.55523294", "text": "func (pd *Duration) Duration() time.Duration {\n\tif pd == nil {\n\t\treturn 0\n\t}\n\treturn pd.D\n}", "title": "" }, { "docid": "1049e0f197fab4fb550a87c2b2d4e154", "score": "0.55438566", "text": "func (o GetConfigurationWindowOutput) Duration() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetConfigurationWindow) string { return v.Duration }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0c555db1bdef397182fbc3b0816f31b8", "score": "0.5540307", "text": "func (e Event) Duration() time.Duration {\n\treturn bcd(e[7], e[8], e[9])\n}", "title": "" }, { "docid": "fae0bb93f020fcbf6d7d5d0b510c74ad", "score": "0.55352896", "text": "func Duration(name string, value time.Duration, usage string) *time.Duration {\n\treturn CommandLine.Duration(name, value, usage)\n}", "title": "" }, { "docid": "b1f86d13b4f222968abff019e99fef8b", "score": "0.5533825", "text": "func getProcessCPUTime() float64 {\n\treturn 0\n}", "title": "" }, { "docid": "8b0746735868e796033dfd718cac1db2", "score": "0.5530111", "text": "func GetDuration(key string) time.Duration {\n\treturn viper.GetDuration(key)\n}", "title": "" }, { "docid": "cf84e4db76355373d6a24aa93ec47f15", "score": "0.552837", "text": "func GetDuration(key string, defaultValue time.Duration) (value time.Duration) {\n\n\tenvVal := GetEnv(TransformKey(key), \"\")\n\tif envVal != \"\" {\n\t\treturn cast.ToDuration(envVal)\n\t}\n\n\tif !viper.IsSet(key) {\n\t\treturn defaultValue\n\t}\n\treturn viper.GetDuration(key)\n}", "title": "" }, { "docid": "fe562da419af5826bf70164a6b3102c7", "score": "0.55248046", "text": "func GetDuration(key string, defVal time.Duration) time.Duration {\n\traw := os.Getenv(key)\n\tif raw == \"\" {\n\t\treturn defVal\n\t}\n\tduration, err := time.ParseDuration(raw)\n\tif err != nil {\n\t\treturn defVal\n\t}\n\treturn duration\n}", "title": "" }, { "docid": "733ca53d55273957089b629eab7a3c85", "score": "0.55114144", "text": "func (o *SyntheticsBrowserTestResultData) 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": "d35565f2b55756ab27c667ecaf228692", "score": "0.5478975", "text": "func Duration(names []string, value time.Duration, usage string) *time.Duration {\n\treturn CommandLine.Duration(names, value, usage)\n}", "title": "" }, { "docid": "b4f8d3c01abb3c09edae59eb72e82e3b", "score": "0.54778194", "text": "func (testTimer *TestTimer) Duration() time.Duration {\n\tendTime := testTimer.EndTime\n\tif !testTimer.IsEnded() {\n\t\tendTime = time.Now()\n\t}\n\treturn endTime.Sub(testTimer.StartTime)\n}", "title": "" }, { "docid": "8346e068fdf4892b93f99eaca7cbcd81", "score": "0.54719603", "text": "func (e *ExecutorTimeMeasurement) Duration() time.Duration {\n\treturn e.duration\n}", "title": "" }, { "docid": "3d7bbf71d9be0cc8af00d036a5c04e40", "score": "0.54709405", "text": "func GetDuration(key string) time.Duration {\n\tv, err := GetDurationE(key)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f95777157af4a098a783bfffb48d2bf4", "score": "0.5460631", "text": "func (o ConfigurationWindowOutput) Duration() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ConfigurationWindow) *string { return v.Duration }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "26c1ba98027b279816e45c14b566497b", "score": "0.5456295", "text": "func (t Timing) Duration() time.Duration {\n\treturn now().Sub(t.start)\n}", "title": "" }, { "docid": "5aaef7d8565b3daac93b1e9c475311c9", "score": "0.54496115", "text": "func (c *clipImp) Duration() float64 {\n\treturn c.Get(\"duration\").Float()\n}", "title": "" }, { "docid": "579f4785b0b51ead5de36d8b78367085", "score": "0.5448306", "text": "func (c *LiveConfig) GetDuration(ns, key string) (time.Duration, error) {\n\treturn viper.GetDuration(nskey(ns, key)), nil\n}", "title": "" }, { "docid": "801d9d2669e84b16097f6a5a0605bcd9", "score": "0.5447086", "text": "func (e *Entry) Duration() (time.Duration, bool) {\n\tisRunning := e.End == nil\n\tif isRunning {\n\t\treturn time.Now().Sub(e.Start), true\n\t} else {\n\t\treturn e.End.Sub(e.Start), false\n\t}\n}", "title": "" }, { "docid": "d56b593206e86fbf917d050b7266bfec", "score": "0.5440183", "text": "func GetCPUTimes(process *psproc.Process) (*pscpu.TimesStat, error) {\n\treturn process.Times()\n}", "title": "" }, { "docid": "692340acf73289b42a699e9e6be9b2f3", "score": "0.5432436", "text": "func (_Governance *GovernanceCaller) GetExecutionStageDuration(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Governance.contract.Call(opts, out, \"getExecutionStageDuration\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a62a2aa68b6ea8f7985305af1ed33b80", "score": "0.54263157", "text": "func (p *Process) ElapsedTime() (time.Duration, error) {\n\tstartTime, err := p.StartTime()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn time.Since(startTime), nil\n}", "title": "" }, { "docid": "5d26d70fe20d1c983228b39a83f8a4bf", "score": "0.5414213", "text": "func (o *LogItem) GetExecutionDuration() int64 {\n\tif o == nil || o.ExecutionDuration == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ExecutionDuration\n}", "title": "" }, { "docid": "c8763a14ac92df2f6c89879dc30564f5", "score": "0.5400892", "text": "func (b *BuildInfo) GetDurationMillis() int {\n\tif b == nil || b.DurationMillis == nil {\n\t\treturn 0\n\t}\n\treturn *b.DurationMillis\n}", "title": "" }, { "docid": "d537f5ab66cef70fdc056558353c6fbd", "score": "0.539593", "text": "func getEnvAsDur(key string, def time.Duration) time.Duration {\n\tval := os.Getenv(key)\n\tdur, err := time.ParseDuration(val)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn dur\n}", "title": "" }, { "docid": "0a384278651215250d910da447f89839", "score": "0.5392786", "text": "func (c *Context) Duration(name string) time.Duration {\n\tif fs := lookupFlagSet(name, c); fs != nil {\n\t\treturn lookupDuration(name, fs)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "5c93f4003105e04a0f66e9e0893db7fc", "score": "0.53904164", "text": "func (dc *common) GetDuration(key string) (d time.Duration) {\n\tv := dc.Context.Value(key)\n\tif v != nil {\n\t\td, _ = v.(time.Duration)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8e7ee49eb74a7c3a627b80d04d78e922", "score": "0.5388444", "text": "func (o AppGroupOrderOutput) Duration() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v AppGroupOrder) *int { return v.Duration }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "905507dda8a0ac56c4b5d662b7e4fbb0", "score": "0.53838307", "text": "func Duration() (time.Duration, error) {\n\t_i, _err := Int64()\n\treturn time.Duration(_i), _err\n}", "title": "" }, { "docid": "15b801168db7e17d607be1813711b042", "score": "0.5380086", "text": "func (b *Build) RunDuration() (duration time.Duration, ok bool) {\n\tif b.StartTime.IsZero() || b.CompletionTime.IsZero() {\n\t\treturn 0, false\n\t}\n\treturn b.CompletionTime.Sub(b.StartTime), true\n}", "title": "" }, { "docid": "d86ebdb4c0593870b351992d81ed9e6e", "score": "0.5376176", "text": "func (c *Cancelable) Duration() time.Duration {\n\tif c.canceled {\n\t\treturn 0\n\t}\n\treturn c.t.Duration()\n}", "title": "" }, { "docid": "c40113f964a8a5b383c30e4ea059979e", "score": "0.5373834", "text": "func (mi *ManagerInstance) GetDuration(key string) (time.Duration, error) {\n\tvar val *Value\n\tvar err error\n\tvar i int\n\n\tif val, err = mi.Get(key); err != nil {\n\t\treturn 0, err\n\t}\n\n\tif i, err = strconv.Atoi(val.Value()); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn time.Duration(i), nil\n}", "title": "" }, { "docid": "f983cbe4c5ec8a02540863841ae6975c", "score": "0.5369301", "text": "func GetDuration(name string, fallback time.Duration) (time.Duration, error) {\n\ts := os.Getenv(name)\n\tif s == \"\" {\n\t\treturn fallback, nil\n\t}\n\tv, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn fallback, fmt.Errorf(\"get duration %s: %w\", name, err)\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "1642157d254f1a3364cfcacfe7226f7a", "score": "0.53655976", "text": "func ExampleConfig_GetDuration() {\n\t// Set some test variables\n\t_ = os.Setenv(\"DURATION_NAP\", \"20m\")\n\t_ = os.Setenv(\"DURATION_EGG\", \"5m\")\n\t_ = os.Setenv(\"DURATION_BIG_EGG\", \"\")\n\t_ = os.Setenv(\"DURATION_MATCH\", \"1.5h\")\n\n\t// New Config from environment\n\tcfg := NewConfig()\n\n\t// returns time.Duration\n\tfmt.Println(cfg.GetDuration(\"DURATION_NAP\"))\n\tfmt.Println(cfg.GetDuration(\"DURATION_EGG\") * 2)\n\t// fallback with unset variable\n\tfmt.Println(cfg.GetDuration(\"DURATION_POWERNAP\", time.Minute*45))\n\t// or an empty one\n\tfmt.Println(cfg.GetDuration(\"DURATION_BIG_EGG\", time.Minute*10))\n\tfmt.Println(cfg.GetDuration(\"DURATION_MATCH\").Minutes())\n\n\t// Output:\n\t// 20m0s\n\t// 10m0s\n\t// 45m0s\n\t// 10m0s\n\t// 90\n\n\tunsetEnv(\n\t\t\"DURATION_NAP\",\n\t\t\"DURATION_EGG\",\n\t\t\"DURATION_BIG_EGG\",\n\t\t\"DURATION_MATCH\",\n\t)\n}", "title": "" }, { "docid": "1642157d254f1a3364cfcacfe7226f7a", "score": "0.53655976", "text": "func ExampleConfig_GetDuration() {\n\t// Set some test variables\n\t_ = os.Setenv(\"DURATION_NAP\", \"20m\")\n\t_ = os.Setenv(\"DURATION_EGG\", \"5m\")\n\t_ = os.Setenv(\"DURATION_BIG_EGG\", \"\")\n\t_ = os.Setenv(\"DURATION_MATCH\", \"1.5h\")\n\n\t// New Config from environment\n\tcfg := NewConfig()\n\n\t// returns time.Duration\n\tfmt.Println(cfg.GetDuration(\"DURATION_NAP\"))\n\tfmt.Println(cfg.GetDuration(\"DURATION_EGG\") * 2)\n\t// fallback with unset variable\n\tfmt.Println(cfg.GetDuration(\"DURATION_POWERNAP\", time.Minute*45))\n\t// or an empty one\n\tfmt.Println(cfg.GetDuration(\"DURATION_BIG_EGG\", time.Minute*10))\n\tfmt.Println(cfg.GetDuration(\"DURATION_MATCH\").Minutes())\n\n\t// Output:\n\t// 20m0s\n\t// 10m0s\n\t// 45m0s\n\t// 10m0s\n\t// 90\n\n\tunsetEnv(\n\t\t\"DURATION_NAP\",\n\t\t\"DURATION_EGG\",\n\t\t\"DURATION_BIG_EGG\",\n\t\t\"DURATION_MATCH\",\n\t)\n}", "title": "" }, { "docid": "1a319892ab1fec79777aad2421396c7d", "score": "0.53602654", "text": "func (o ConfigurationWindowPtrOutput) Duration() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ConfigurationWindow) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Duration\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3cc0373b2a83798301cf9d92985c666c", "score": "0.53590703", "text": "func Duration(cmp *mcmp.Component, name string, opts ...ParamOption) *mtime.Duration {\n\tvar d mtime.Duration\n\tAddParam(cmp, Param{Name: name, IsString: true, Into: &d}, opts...)\n\treturn &d\n}", "title": "" }, { "docid": "799429fdbbaacb2cbaa5aa7735c9cf18", "score": "0.53582865", "text": "func envDuration(key string, defaultValue time.Duration) time.Duration {\n\tv := os.Getenv(key)\n\tif v == \"\" {\n\t\treturn defaultValue\n\t}\n\td, err := strconv.Atoi(v)\n\tif err != nil {\n\t\tglobal.Error(err, \"parse duration\", \"environment variable\", key, \"value\", v)\n\t\treturn defaultValue\n\t}\n\tif d <= 0 {\n\t\tglobal.Error(errNonPositiveDuration, \"non-positive duration\", \"environment variable\", key, \"value\", v)\n\t\treturn defaultValue\n\t}\n\treturn time.Duration(d) * time.Millisecond\n}", "title": "" }, { "docid": "e92c64f76f230aa333ceadd60b97b0dd", "score": "0.5354472", "text": "func (c *cfg) GetDuration(key string) time.Duration {\n\treturn c.v.GetDuration(key)\n}", "title": "" }, { "docid": "f191f3305cad07b3c54ad6f11c3eee71", "score": "0.53493184", "text": "func (q *QueryInstance) Duration() float64 {\n\treturn q.scrapeDone.Sub(q.scrapeBegin).Seconds()\n}", "title": "" }, { "docid": "ffb16f4be2cf0e7a796dfec86c0b2a04", "score": "0.5347233", "text": "func (b *Benchmark) Duration() time.Duration {\n\treturn b.duration\n}", "title": "" }, { "docid": "ffb16f4be2cf0e7a796dfec86c0b2a04", "score": "0.5347233", "text": "func (b *Benchmark) Duration() time.Duration {\n\treturn b.duration\n}", "title": "" }, { "docid": "4262038abb0002abf72867859b50e8c2", "score": "0.53446895", "text": "func (t *Timer) Duration() float64 {\n\treturn t.duration.Seconds()\n}", "title": "" }, { "docid": "15039f65985083cbb439f758fece706d", "score": "0.5343656", "text": "func (_MicroPaySystem *MicroPaySystemSession) Duration() (*big.Int, error) {\n\treturn _MicroPaySystem.Contract.Duration(&_MicroPaySystem.CallOpts)\n}", "title": "" }, { "docid": "6ec1baea8e8587e70681cf82a1f0c6d0", "score": "0.53399247", "text": "func (timing *Timing) Duration() time.Duration {\n\treturn now().Sub(timing.start)\n}", "title": "" }, { "docid": "a1f4e6af0776e46c3c880694e2bbd420", "score": "0.5339391", "text": "func GetExecutionTimeoutDuration() (int64, error) {\n\tv := os.Getenv(CustomResourceDefinitionExecutionTimeout)\n\tif v != \"\" {\n\t\tif i, err := strconv.Atoi(v); err != nil {\n\t\t\treturn int64(i), err\n\t\t} else {\n\t\t\treturn DefaultExecutionDuration, nil\n\t\t}\n\t}\n\tklog.Infof(\"No env variable getting from '%s' in the container, use default value: %d\", CustomResourceDefinitionExecutionTimeout, DefaultExecutionDuration)\n\treturn DefaultExecutionDuration, nil\n}", "title": "" }, { "docid": "4a19954ecec69b9116045cc6e6210e4f", "score": "0.5339126", "text": "func (t Track) GetDuration() time.Duration {\n\treturn t.Duration\n}", "title": "" }, { "docid": "41aa7d44973ee717947ca6a1cb5efaaf", "score": "0.5338764", "text": "func (p *Properties) GetDuration(key string, def time.Duration) time.Duration {\n\tv, err := p.getInt64(key)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn time.Duration(v)\n}", "title": "" }, { "docid": "7ba59eb1bfaf430d63f5270da58fba84", "score": "0.533858", "text": "func (o *UpdateJob) GetDuration() int64 {\n\tif o == nil || o.Duration == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Duration\n}", "title": "" }, { "docid": "44dfd1990a9547ffa67adaebbdaa23f7", "score": "0.53384787", "text": "func (t ntpTime) Duration() time.Duration {\n\tsec := (t >> 32) * nanoPerSec\n\tfrac := (t & 0xffffffff) * nanoPerSec >> 32\n\treturn time.Duration(sec + frac)\n}", "title": "" }, { "docid": "af95948d600a4c04fc77aac175a1623e", "score": "0.53361326", "text": "func (a *AppConfig) GetDurationTimeout() time.Duration {\n\n\t//fmt.Println(a.SessionTimeout)\n\t//retVal, err := time.ParseDuration(a.SessionTimeout + \"s\")\n\tval, err := strconv.ParseUint(a.SessionTimeout, 10, 64)\n\tretVal := time.Duration(val)\n\tif err != nil {\n\t\tfmt.Printf(\"error parsing timout duration: %s\\n\", err)\n\t\treturn 86400 * time.Second\n\t}\n\n\t//fmt.Println(retVal)\n\treturn retVal * time.Second\n}", "title": "" }, { "docid": "e6058ea52897dfd93401466fc6dd5d9d", "score": "0.5332898", "text": "func (i *InputMessageVideo) GetDuration() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Duration\n}", "title": "" }, { "docid": "fef92b8131b4a5d6a1ebf4dfd4c75f79", "score": "0.5331495", "text": "func (e entry) Duration() time.Duration {\n\treturn e.end.Sub(e.start)\n}", "title": "" }, { "docid": "80b6612e1f0c82f43edcd2375623b1b0", "score": "0.5329377", "text": "func (_this *MediaSource) Duration() float64 {\n\tvar ret float64\n\tvalue := _this.Value_JS.Get(\"duration\")\n\tret = (value).Float()\n\treturn ret\n}", "title": "" }, { "docid": "16b6d3fda25c4255ba6861684224a052", "score": "0.5319345", "text": "func (o NrqlAlertConditionCriticalPtrOutput) Duration() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *NrqlAlertConditionCritical) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Duration\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "d9e94076fb81029c85a3a84269b5189e", "score": "0.53080183", "text": "func (_this *HTMLMediaElement) Duration() float64 {\n\tvar ret float64\n\tvalue := _this.Value_JS.Get(\"duration\")\n\tret = (value).Float()\n\treturn ret\n}", "title": "" }, { "docid": "d8d4dd707d033e50e7999786379b3176", "score": "0.529939", "text": "func (this *Media) Duration() int64 {\n\tif this.ptr == nil {\n\t\treturn 0\n\t}\n\treturn int64(C.libvlc_media_get_duration(this.ptr))\n}", "title": "" }, { "docid": "756486e11757e74c88b1a6c3e68c6ee6", "score": "0.52966434", "text": "func duration(start time.Time) (duration time.Duration) {\n\tduration = time.Since(start)\n\treturn duration\n}", "title": "" }, { "docid": "d11c27a59f7f1c95e1abf31603e1e799", "score": "0.5289857", "text": "func (f Frame) Duration() (time.Duration, error) {\n\tif f.PathTrace() != true {\n\t\treturn 0, fmt.Errorf(\"Timestamps not available\")\n\t}\n\n\treturn f.Trace.Path[f.Trace.PathLength-1].RxTimestamp.Sub(f.Trace.Path[0].TxTimestamp), nil\n}", "title": "" }, { "docid": "16ddc919e1d3cb3e3ad1261be2632a01", "score": "0.52881664", "text": "func (s *Subcommand) Duration(name string, value time.Duration, usage string) *time.Duration {\n\tp := new(time.Duration)\n\ts.flagSet.DurationVar(p, name, value, usage)\n\treturn p\n}", "title": "" }, { "docid": "699afc17f78955f68b221aea05a1f73b", "score": "0.5284166", "text": "func (i *InputStoryContentVideo) GetDuration() (value float64) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Duration\n}", "title": "" }, { "docid": "85ecc6b2f54d088a1d5fa0797bc83bc2", "score": "0.528349", "text": "func (n *Node) Duration() time.Duration {\n\tif n == nil {\n\t\treturn 0\n\t}\n\tif n.ended {\n\t\treturn n.duration\n\t}\n\treturn time.Now().Sub(n.startTime)\n}", "title": "" }, { "docid": "43569d60f7e8d5d9c322408d9bd4328c", "score": "0.5280575", "text": "func (o *TelemetryDruidDurationGranularity) GetDuration() int64 {\n\tif o == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\n\treturn o.Duration\n}", "title": "" }, { "docid": "cd50e679bfd6b5aacbf63122b897a954", "score": "0.5278605", "text": "func (s *Snapshot) GetDuration() int {\n\tif s.DurationMillis > 0 {\n\t\treturn s.DurationMillis\n\t}\n\t// This will avoid returning incorrect values like \"-1554114611822\"\n\treturn int(time.Since(s.StartTime) / time.Millisecond)\n\n}", "title": "" }, { "docid": "dd98c48d4193344574b68412832e8840", "score": "0.52693874", "text": "func KeyPressDuration(key ebiten.Key) int {\n\ttheInputState.m.RLock()\n\ts := theInputState.keyDurations[key]\n\ttheInputState.m.RUnlock()\n\treturn s\n}", "title": "" }, { "docid": "5a8bfe08eeb98feb827a95bb2cc51753", "score": "0.5266916", "text": "func execmFlagSetDuration(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := args[0].(*flag.FlagSet).Duration(args[1].(string), time.Duration(args[2].(int64)), args[3].(string))\n\tp.Ret(4, ret)\n}", "title": "" }, { "docid": "979c5d431bd84c6f75a13ef891e4e64b", "score": "0.52656955", "text": "func (o DailyMaintenanceWindowResponseOutput) Duration() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DailyMaintenanceWindowResponse) string { return v.Duration }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b41a3b2a27e5f9e7bbdb3e0a1460212a", "score": "0.5263025", "text": "func (d duration) Duration() time.Duration {\n\treturn time.Duration(d)\n}", "title": "" }, { "docid": "700affea0bd6d40ad8b41f0b85b6b04a", "score": "0.5259493", "text": "func (p *Process) Uptime() string {\n\ts := p.cmd.ProcessState\n\tif s != nil && s.Exited() {\n\t\treturn \"exited\"\n\t}\n\n\tduration := time.Since(p.startTime)\n\treturn duration.String()\n}", "title": "" } ]
58fd6087d6e6af1816056814adf6c007
EmailPasswordChange method for Auth0Client takes the desired email and password of a user and returns a success bool upon requesting a password reset for the user
[ { "docid": "415d65e4eab3f7ef7909fa143aeee4a5", "score": "0.8301148", "text": "func (ac *Auth0Client) EmailPasswordChange(Email string) (bool, error) {\n\tdmn := fmt.Sprintf(\"%s://%s/%s%s\", //Generate a URL from saved URL values\n\t\tac.Domain.Scheme,\n\t\tac.Domain.Host,\n\t\tac.Domain.Path,\n\t\t\"dbconnections/change_password\")\n\n\tstr := Auth0Payload{ClientID: ac.ClientID, //Generate the payload from domain and username/password\n\t\tDomain: dmn,\n\t\tEmail: Email, //The email entered will receive a Password Reset Email\n\t\tConnection: \"Username-Password-Authentication\"}\n\n\tjsn, err := json.Marshal(str) //Encode Payload as JSON\n\n\treq, err := http.NewRequest(\"POST\", dmn, bytes.NewBuffer(jsn)) //Define http Request\n\treq.Header.Set(\"Content-Type\", \"application/json\") //Set http header as content type: json\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req) //Perform get request\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch { //Switch should be moved to a helper\n\tcase resp.StatusCode == 200: //value returned successfully\n\t\treturn true, nil\n\tcase resp.StatusCode > 400 && resp.StatusCode < 500: //Request failed\n\t\treturn false, fmt.Errorf(\"Invalid Request: %d\", resp.StatusCode)\n\t}\n\treturn false, fmt.Errorf(\"Change Password Email: %v\", resp.StatusCode)\n}", "title": "" } ]
[ { "docid": "af2fc5cc991ca09afd56987d090779ad", "score": "0.6958564", "text": "func (*userService) ChangeForgotPassword(body domains.ChangePasswordRequest) (*domains.PublicUser, rest_errors.RestErr) {\n\t// return token\n\treturn nil, nil\n}", "title": "" }, { "docid": "e5c2b46c74a4f88c35266d9f02c36f21", "score": "0.69062287", "text": "func ResetPassword(ctx iris.Context) {\n\tinfo := &ResetPasswordRequestData{}\n\n\ter := ctx.ReadJSON(info)\n\terr.CheckErrWithCallback(er, response.GenCallbackBadRequest(ctx, er))\n\n\t// Check whether the email is valid.\n\tuser, has, er := model.GetUserByEmail(info.Email)\n\terr.CheckErrWithPanic(er)\n\tif !has {\n\t\tresponse.Forbidden(ctx, iris.Map{})\n\t\treturn\n\t}\n\n\t// Check whether the code is stored in the database.\n\tauthCode, has, er := model.GetAuthCodeByUserAndCode(user.ID, info.AuthCode)\n\terr.CheckErrWithPanic(er)\n\tif !has {\n\t\tresponse.Forbidden(ctx, iris.Map{})\n\t\treturn\n\t}\n\n\tyes, er := isBefore(args.AuthCodeLifeTime, authCode.UpdateTime)\n\terr.CheckErrWithPanic(er)\n\n\t// now - AuthCodeLifeTime(minutes) is not before codeUpdateTime\n\tif !yes {\n\t\t// Destroy the authCode if outdated.\n\t\t_, er := model.DeleteAuthCode(authCode.ID)\n\t\terr.CheckErrWithPanic(er)\n\n\t\tresponse.Forbidden(ctx, iris.Map{})\n\t\treturn\n\t}\n\n\ter = model.ChangePassword(user.ID, encodePassword(info.NewPassword))\n\terr.CheckErrWithPanic(er)\n\n\t// Destroy the authCode if the password is successfully changed.\n\t_, er = model.DeleteAuthCode(authCode.ID)\n\terr.CheckErrWithPanic(er)\n\n\tresponse.OK(ctx, iris.Map{})\n}", "title": "" }, { "docid": "ed28918a21ef239ad37b418ab2e1166c", "score": "0.6883417", "text": "func (h *Handler) HandleUpdatePasswordForEmail(email string, c client.Client, d message.UpdatePasswordData) {\n i, ok := h.db.GetIdentityFromEmail(email)\n if !ok {\n c.Send(message.NewNotifyUpdatePassword(false))\n }\n h.handleUpdatePasswordForIdentity(i, c, d)\n}", "title": "" }, { "docid": "6f3c11ee4834f8a235425410f7e5f47f", "score": "0.67214066", "text": "func ResetPassword(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\temail := params[\"email\"]\n\t//todo: valid if it's a email\n\tuser, _ := query.Fetch(r.Context(), \"user\", db.Cond(\"email\", email))\n\tif user == nil {\n\t\tHandleError(errors.New(\"User not found.\"), w)\n\t\treturn\n\t}\n\n\tdisabled := user.Value(\"disabled\")\n\tif disabled != nil {\n\t\tif disabled.(int) == 1 {\n\t\t\tlog.Info(\"User is disabled\")\n\t\t\tHandleError(errors.New(\"User not found.\"), w)\n\t\t\treturn\n\t\t}\n\t}\n\n\t//create hash\n\tactivation := Activiation{}\n\tactivation.Hash = util.GenerateUID()\n\tfmt.Println(activation.Hash)\n\tactivation.Ref = strconv.Itoa(user.GetCID())\n\tactivation.Created = int(time.Now().Unix())\n\tactivation.Type = \"resetpassword\"\n\tdata, _ := json.Marshal(activation)\n\tvar dbMap map[string]interface{}\n\tjson.Unmarshal(data, &dbMap)\n\t_, err := db.Insert(r.Context(), \"dm_activation\", dbMap)\n\tif err == nil {\n\t\t//send password\n\t\turl := \"http://xxxx.com/api/user/resetpassword-confirm/\" + activation.Hash\n\t\tutil.SendMail(\n\t\t\t[]string{email},\n\t\t\t\"reset password\",\n\t\t\t\"Click to reset password: <a href=\"+url+\">url</a>\")\n\t\t//todo: rollback\n\t\tw.Write([]byte(\"1\"))\n\t}\n\n}", "title": "" }, { "docid": "cb1bff44b839410adca36e686ef393e5", "score": "0.6622024", "text": "func (p *UserAPI) ModifyEmail(pwd, oldEmail, newEmail string) (err error) {\n\tparams := url.Values{}\n\tparams.Set(\"login_token\", p.loginToken)\n\tparams.Set(\"format\", \"json\")\n\n\tparams.Set(\"password\", pwd)\n\tparams.Set(\"old_email\", oldEmail)\n\tparams.Set(\"new_email\", newEmail)\n\n\tres, err := simpleHTTP(p.client, \"POST\", \"https://dnsapi.cn/Useremail.Modify\", params)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar jsonRes struct {\n\t\tStatus Status `json:\"status\"`\n\t}\n\tif err = json.Unmarshal(res, &jsonRes); err != nil {\n\t\treturn\n\t}\n\tif jsonRes.Status.Code != 1 {\n\t\treturn errors.New(jsonRes.Status.Message)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4dfed41e3b2036eb4c20d59dca223b38", "score": "0.65430987", "text": "func hapiUserForgotPassword(w http.ResponseWriter, r *http.Request) {\n\tvar email string\n\tif err := json.NewDecoder(r.Body).Decode(&email); err != nil {\n\t\twriteErrorBadRequest(w, err)\n\t\treturn\n\t}\n\tvar name sql.NullString\n\tq := `SELECT name FROM users WHERE email=$1`\n\terr := db.Get(&name, q, email)\n\tif err == sql.ErrNoRows {\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tcode, err := generateToken(36)\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tq = `INSERT INTO passwordresets (email, code) VALUES ($1, $2)\n\t ON CONFLICT (email) DO\n\t\tUPDATE SET code=$2, createdat=CURRENT_TIMESTAMP`\n\t_, err = db.Exec(q, email, code)\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tif !name.Valid {\n\t\tname.String = \"\"\n\t}\n\tsendPasswordResetEmail(email, name.String, code)\n}", "title": "" }, { "docid": "ebf0ad418f54c50a480bcfd73cd6d47e", "score": "0.65413415", "text": "func (u *userHandler) ResetPassword(c *fiber.Ctx) error {\n\n\temail := c.Params(\"user_email\")\n\tif err := validation.Validate(email,\n\t\tis.Email,\n\t); err != nil {\n\t\tapiErr := rest_err.NewBadRequestError(err.Error())\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\tdata := dto.UserChangePasswordRequest{\n\t\tEmail: email,\n\t\tNewPassword: \"Password\",\n\t}\n\n\tapiErr := u.service.ResetPassword(data)\n\tif apiErr != nil {\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\treturn c.JSON(fiber.Map{\"msg\": fmt.Sprintf(\"Password user %s berhasil di reset!\", c.Params(\"user_email\"))})\n}", "title": "" }, { "docid": "39f1d9c0e75b3a23129e9dac8ae7dde4", "score": "0.648932", "text": "func (uc UserController) PasswordReset(c *gin.Context) {\n\tinput := entity.UserPlainPassword{}\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tquery := entity.OneTimeQuery{}\n\tif err := c.ShouldBindUri(&query); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tu, o, err := uc.os.FindUserByQueryString(query.UUID)\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusNotFound, err)\n\t}\n\n\tif err := uc.os.Delete(o); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err := uc.us.UpdatePassword(u.ID, input.PlainPassword); err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t\treturn\n\t}\n\tc.Status(http.StatusOK)\n\n\tgo api.GmailContent{\n\t\tEmail: u.Email,\n\t\tSubject: template.RESETPASSWORDTITLE,\n\t\tBody: template.RESETPASSWORDBODY,\n\t}.Send()\n}", "title": "" }, { "docid": "96fd1d81d60a52afbcfd832dc9706d30", "score": "0.6443144", "text": "func ChangePassword(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\n\t\tvar user entities.ResetPassword\n\t\t_ = json.NewDecoder(r.Body).Decode(&user)\n\n\t\t//Check if there's data in POST\n\t\tif len(user.Password) > 0 && len(user.ConfirmPassword) > 0 {\n\n\t\t\thashedPass, err := bcrypt.GenerateFromPassword([]byte(user.Password), 8)\n\t\t\tconfPass := user.ConfirmPassword\n\n\t\t\tif err != nil {\n\t\t\t\thashErr := entities.Message{\n\t\t\t\t\tMessage: \"Error hashing password.\",\n\t\t\t\t}\n\n\t\t\t\tjson.NewEncoder(w).Encode(hashErr)\n\n\t\t\t} else {\n\n\t\t\t\t//Grab token from URL\n\t\t\t\tkeys := r.URL.Query()[\"token\"]\n\n\t\t\t\t//Decodeb base64\n\t\t\t\tdecodedToken, decodeErr := base64.StdEncoding.DecodeString(keys[0])\n\n\t\t\t\tif decodeErr != nil {\n\t\t\t\t\tfmt.Println(\"Error decoding base64.\")\n\t\t\t\t} else {\n\n\t\t\t\t\t//Decode JWT token\n\t\t\t\t\ttoken, error := jwt.Parse(string(decodedToken), func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"Error occurred\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn []byte(\"secret\"), nil\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tif error != nil {\n\t\t\t\t\t\ttokenDecodeErr := entities.Message{\n\t\t\t\t\t\t\tMessage: \"Error deconding JWT token.\",\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tjson.NewEncoder(w).Encode(tokenDecodeErr)\n\t\t\t\t\t}\n\n\t\t\t\t\t//Extracting JWT payload\n\t\t\t\t\tnewFormatToken, newErr := ExtractClaims(string(decodedToken))\n\t\t\t\t\tif token.Valid {\n\t\t\t\t\t\tif newErr != true {\n\t\t\t\t\t\t\textractPayloadErr := entities.Message{\n\t\t\t\t\t\t\t\tMessage: \"Error extracting JWT payload.\",\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tjson.NewEncoder(w).Encode(extractPayloadErr)\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tdb, dbErr := config.GetDB()\n\n\t\t\t\t\t\t\t//Grab user email\n\t\t\t\t\t\t\tuserEmail := newFormatToken[\"email\"]\n\n\t\t\t\t\t\t\tif dbErr != nil {\n\t\t\t\t\t\t\t\tfmt.Println(\"Error\")\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tuserModel := models.UserModel{\n\t\t\t\t\t\t\t\t\tDb: db,\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t//Comparing newly entered passwords\n\t\t\t\t\t\t\t\tpasswordNoMatch := bcrypt.CompareHashAndPassword(hashedPass, []byte(confPass))\n\n\t\t\t\t\t\t\t\tif passwordNoMatch != nil && passwordNoMatch == bcrypt.ErrMismatchedHashAndPassword {\n\t\t\t\t\t\t\t\t\tpassMatchErr := entities.Message{\n\t\t\t\t\t\t\t\t\t\tMessage: \"Passwords do not match.\",\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tjson.NewEncoder(w).Encode(passMatchErr)\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t//Update old password with new one\n\t\t\t\t\t\t\t\t\tupdatePass := userModel.UpdatePassword(string(hashedPass), userEmail.(string))\n\n\t\t\t\t\t\t\t\t\tmsg := entities.Message{\n\t\t\t\t\t\t\t\t\t\tMessage: updatePass,\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tjson.NewEncoder(w).Encode(msg)\n\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}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\t//Incorrect / empty data in POST\n\t\t\tjson.NewEncoder(w).Encode(entities.Message{Message: \"Invalid credentials provided\"})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9281b9764445d4878024ea29165ac364", "score": "0.6369949", "text": "func (uc UserController) PasswordChange(c *gin.Context) {\n\tid := entity.UserID{}\n\tif err := c.ShouldBindUri(&id); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tpasswords := entity.UserNewOldPasswords{}\n\tif err := c.ShouldBindJSON(&passwords); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tu, err := uc.us.FindByID(id.ID)\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusNotFound, err)\n\t\treturn\n\t}\n\n\tif err := bcrypt.CompareHashAndPassword(u.Password, []byte(passwords.OldPassword)); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err := uc.us.UpdatePassword(id.ID, passwords.NewPassword); err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t\treturn\n\t}\n\tc.Status(http.StatusOK)\n\n\tgo api.GmailContent{\n\t\tEmail: u.Email,\n\t\tSubject: template.CHANGEPASSWORDTITLE,\n\t\tBody: template.CHANGEPASSWORDBODY,\n\t}.Send()\n}", "title": "" }, { "docid": "43f8395d6143dc45cea1d9d06fc32cae", "score": "0.6360218", "text": "func (m *Manager) ResetPassword(ctx context.Context, codeB64, newPassword, baseURL string) error {\n\t// Validate input\n\tif codeB64 == \"\" {\n\t\treturn fmt.Errorf(\"%w: %s\", hub.ErrInvalidInput, \"code not provided\")\n\t}\n\tif newPassword == \"\" {\n\t\treturn fmt.Errorf(\"%w: %s\", hub.ErrInvalidInput, \"new password not provided\")\n\t}\n\tif err := pwvalidator.Validate(newPassword, PasswordMinEntropyBits); err != nil {\n\t\treturn fmt.Errorf(\"%w: %s\", hub.ErrInvalidInput, err.Error())\n\t}\n\tif m.es != nil {\n\t\tu, err := url.Parse(baseURL)\n\t\tif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n\t\t\treturn fmt.Errorf(\"%w: %s\", hub.ErrInvalidInput, \"invalid base url\")\n\t\t}\n\t}\n\n\t// Hash new password\n\tnewHashed, err := bcrypt.GenerateFromPassword([]byte(newPassword), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Reset user password in database\n\tcode, err := base64.URLEncoding.DecodeString(codeB64)\n\tif err != nil {\n\t\treturn ErrInvalidPasswordResetCode\n\t}\n\tvar userEmail string\n\terr = m.db.QueryRow(ctx, resetUserPasswordDBQ, code, string(newHashed)).Scan(&userEmail)\n\tif err != nil {\n\t\tif err.Error() == errInvalidPasswordResetCodeDB.Error() {\n\t\t\treturn ErrInvalidPasswordResetCode\n\t\t}\n\t\treturn err\n\t}\n\n\t// Send password reset success email\n\tif m.es != nil {\n\t\ttemplateData := map[string]string{\n\t\t\t\"baseURL\": baseURL,\n\t\t}\n\t\tvar emailBody bytes.Buffer\n\t\tif err := passwordResetSuccessTmpl.Execute(&emailBody, templateData); err != nil {\n\t\t\treturn err\n\t\t}\n\t\temailData := &email.Data{\n\t\t\tTo: userEmail,\n\t\t\tSubject: \"Your password has been reset\",\n\t\t\tBody: emailBody.Bytes(),\n\t\t}\n\t\tif err := m.es.SendEmail(emailData); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4abf10391be905b1933f4acfdac8660f", "score": "0.63140905", "text": "func (_obj *Apiaccount) Account_resendPasswordEmail(params *TLaccount_resendPasswordEmail, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.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\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"account_resendPasswordEmail\", _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 = ret.ReadBlock(_is, 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": "ab7f90e7a1056939315820df4c3be345", "score": "0.6282473", "text": "func (u *userHandler) ChangePassword(c *fiber.Ctx) error {\n\n\tclaims := c.Locals(mjwt.CLAIMS).(*mjwt.CustomClaim)\n\n\tvar user dto.UserChangePasswordRequest\n\tif err := c.BodyParser(&user); err != nil {\n\t\tapiErr := rest_err.NewBadRequestError(err.Error())\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\tif err := user.Validate(); err != nil {\n\t\tapiErr := rest_err.NewBadRequestError(err.Error())\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\t//mengganti user email dengan user aktif\n\tuser.Email = claims.Identity\n\n\tapiErr := u.service.ChangePassword(user)\n\tif apiErr != nil {\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\treturn c.JSON(fiber.Map{\"msg\": \"Password berhasil diubah!\"})\n}", "title": "" }, { "docid": "57092399d5dd8aa0821abc33f59560bc", "score": "0.62467206", "text": "func hapiUserResetPassword(w http.ResponseWriter, r *http.Request) {\n\tvar req struct {\n\t\tCode string\n\t\tEmail string\n\t\tPassword string\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\twriteErrorBadRequest(w, err)\n\t\treturn\n\t}\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tq := `DELETE FROM passwordresets WHERE code=$1 AND email=$2`\n\tres, err := tx.Exec(q, req.Code, req.Email)\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\trows, err := res.RowsAffected()\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tif rows == 0 {\n\t\twriteErrorBadRequest(w, errors.New(\"That code has expired. Please request a new password reset.\"))\n\t\treturn\n\t}\n\tpass, err := bcrypt.GenerateFromPassword([]byte(req.Password), 10)\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tq = `UPDATE users SET password=$1 WHERE email=$2`\n\t_, err = tx.Exec(q, pass, req.Email)\n\tif err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tif err = tx.Commit(); err != nil {\n\t\twriteErrorInternal(w, err)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "f27fcdcf919f96f656da47a400068928", "score": "0.6238502", "text": "func (uc UserController) EmailChange(c *gin.Context) {\n\tid := entity.UserID{}\n\tif err := c.ShouldBindUri(&id); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tinput := entity.UserEmail{}\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err := uc.us.UpdateEmailByID(id.ID, input.Email); err != nil {\n\t\tc.AbortWithError(http.StatusNotFound, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, entity.UserEmail{\n\t\tEmail: input.Email,\n\t})\n\n\tgo api.GmailContent{\n\t\tEmail: input.Email,\n\t\tSubject: template.CHANGEEMAILTITLE,\n\t\tBody: template.CHANGEEMAILBODY,\n\t}.Send()\n}", "title": "" }, { "docid": "a68272d004366c1f34467e250b0915e4", "score": "0.6228441", "text": "func (_obj *Apiaccount) Account_confirmPasswordEmail(params *TLaccount_confirmPasswordEmail, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.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\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"account_confirmPasswordEmail\", _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 = ret.ReadBlock(_is, 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": "589ebf1caff5f66687e4e5892d7d11a3", "score": "0.6206983", "text": "func (o *Account) ChangePassword() (*restapi.BoolResponse, error) {\n\tif o.ID == \"\" {\n\t\terrormsg := fmt.Sprintf(\"Missing ID for %s\", GetVarType(0))\n\t\tlogger.Errorf(errormsg)\n\t\treturn nil, fmt.Errorf(errormsg)\n\t}\n\tvar queryArg = make(map[string]interface{})\n\t// Mandatory attributes\n\tqueryArg[\"ID\"] = o.ID\n\tqueryArg[\"Password\"] = o.Password\n\n\tresp, err := o.client.CallBoolAPI(o.apiUpdatePassword, queryArg)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\treturn nil, err\n\t}\n\n\tif !resp.Success {\n\t\terrmsg := fmt.Sprintf(\"%s %s\", resp.Message, resp.Exception)\n\t\tlogger.Errorf(errmsg)\n\t\treturn nil, fmt.Errorf(errmsg)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "aa2c1f3699cb7da8ae3be696acbd05cc", "score": "0.62066835", "text": "func ChangePassword(userEmail, oldPassword, password string) error {\n\tvar user, err = identity.GetUserByEmail(userEmail)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !hashutil.MatchHashString(user.Password, oldPassword) {\n\t\treturn ErrPasswordMismatch\n\t}\n\n\treturn changeUserPassword(user, password)\n}", "title": "" }, { "docid": "ccf9e9b8e2245562640a44aa34171ae8", "score": "0.61577296", "text": "func ResetUserPassword(req *http.Request, params martini.Params, res render.Render, db *gorm.DB, user User) {\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(400, map[string]interface{}{\"error\": \"User ID could not be parsed from request URL.\"})\n\t\treturn\n\t}\n\tuser.ID = int64(id)\n\tentry, err := user.Get(db)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tif err.Error() == \"not found\" {\n\t\t\tres.JSON(404, map[string]interface{}{\"error\": \"User with that ID does not exist.\"})\n\t\t\treturn\n\t\t}\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\t// this ensures that accounts won't be compromised by posting recovery string as empty,\n\t// which would otherwise result in succesful password reset\n\tUUID := uuid.Parse(params[\"recovery\"])\n\tif UUID == nil {\n\t\tlog.Println(\"there was a problem trying to verify password reset UUID for\", entry.Email)\n\t\tres.JSON(400, map[string]interface{}{\"error\": \"Could not parse UUID from the request.\"})\n\t\treturn\n\t}\n\tif entry.Recovery == params[\"recovery\"] {\n\t\tentry.Password = user.Password\n\t\tdigest, err := GenerateHash(entry.Password)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\tentry.Digest = digest\n\t\tentry.Recovery = \" \"\n\t\t_, err = user.Update(db, entry)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\tswitch root(req) {\n\t\tcase \"api\":\n\t\t\tres.JSON(200, map[string]interface{}{\"success\": \"Password was updated successfully.\"})\n\t\t\treturn\n\t\tcase \"user\":\n\t\t\tres.Redirect(\"/user/login\", 302)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c4829001a633f111c4427f2dfb751120", "score": "0.61488014", "text": "func RecoveryPassword(emailPassword string) (err error) {\n\tsession := models.GetSession()\n\terr = bcrypt.CompareHashAndPassword([]byte(session.EmailPasswordHash), []byte(emailPassword))\n\tif err != nil {\n\t\terr = errors.New(\"SesionControl: emailPassword does not match msg error: \" + err.Error())\n\t\treturn\n\t}\n\n\tsmtpServer := gomail.SMTP[session.EmailSMTPServer]\n\tif smtpServer == nil {\n\t\terr = errors.New(\"SesionControl: smtp server not found\")\n\t\treturn\n\t}\n\n\tnewPassword := tools.RandHash(10)\n\n\tsender, err := gomail.NewSender(session.EmailLogin, emailPassword, smtpServer.Host, smtpServer.Port)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treceiver := []string{session.EmailLogin}\n\tsubject := \"HomeComtrol: password recovery!\"\n\tmessage := \"Your new password: \" + newPassword\n\tbodyMessage := sender.WriteHTMLEmail(receiver, subject, message)\n\n\terr = sender.SendMail(receiver, subject, bodyMessage)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tnewPasswordHash, err := bcrypt.GenerateFromPassword([]byte(newPassword), bcrypt.DefaultCost)\n\tif err != nil {\n\t\terr = errors.New(\"SesionControl: Error bcrypt.GenerateFromPassword() msg error: \" + err.Error())\n\t\treturn\n\t}\n\terr = models.SetPasswordHash(string(newPasswordHash))\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5c27d8efe982c773ae15956c4dc0775a", "score": "0.6145449", "text": "func SendResetPasswordEmail(username string, userEmail string, code string) error {\n\temail := hermes.Email{\n\t\tBody: hermes.Body{\n\t\t\tName: username,\n\t\t\tIntros: []string{\n\t\t\t\t\"You have received this email because a password reset request for your esportsdrafts account was received.\",\n\t\t\t},\n\t\t\tActions: []hermes.Action{\n\t\t\t\t{\n\t\t\t\t\tInstructions: \"To reset your password, please click here:\",\n\t\t\t\t\tButton: hermes.Button{\n\t\t\t\t\t\tColor: \"#DC4D2F\", // Optional action button color\n\t\t\t\t\t\tText: \"Reset your password\",\n\t\t\t\t\t\tLink: fmt.Sprintf(\"https://%s/reset_password?user=%s&token=%s\", baseURL, username, code),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tOutros: []string{\n\t\t\t\t\"If you did not make this request, please ignore this message.\",\n\t\t\t\t\"Need help, or have questions? Just reply to this email, we'd love to help.\",\n\t\t\t},\n\t\t\tSignature: \"Thanks\",\n\t\t},\n\t}\n\n\t// Generate an HTML email with the provided contents (for modern clients)\n\temailBody, err := h.GenerateHTML(email)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Local dev environment cannot send emails anywhere so dump to fake inbox\n\t// aka a file in a folder\n\tif env == \"local\" {\n\t\treturn writeLocalEmail(\"reset_password\", username, emailBody)\n\t}\n\n\t// TODO: Call email API to actually send out the email\n\temailText, err := h.GeneratePlainText(email)\n\tif err != nil {\n\t\tpanic(err) // Tip: Handle error with something else than a panic ;)\n\t}\n\n\tprint(emailText)\n\n\treturn nil\n}", "title": "" }, { "docid": "60791f62e8c2f25741218eaec8d2706c", "score": "0.61405045", "text": "func ChangePassword(changePassword *models.ChangePassword) error {\n\tif valid, errMap := models.ValidStruct(changePassword); !valid {\n\t\treturn errMap\n\t}\n\tchangePasswordJSON, _ := json.Marshal(changePassword)\n\tvar appError ierrors.AppError\n\treturn client.CallRequest(\"POST\", \"/users/change_password\", bytes.NewReader(changePasswordJSON)).Solve(utils.MapExec{\n\t\thttp.StatusOK: utils.InfoExec{\n\t\t\tnil,\n\t\t\tfunc(resp *http.Response) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\thttp.StatusConflict: utils.InfoExec{\n\t\t\t&appError,\n\t\t\tfunc(resp *http.Response) error {\n\t\t\t\treturn appError\n\t\t\t},\n\t\t},\n\t\tutils.Default: utils.InfoExec{\n\t\t\tnil,\n\t\t\tfunc(resp *http.Response) error {\n\t\t\t\treturn ErrWithCredentials\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "ae7422ff4c0306d92f8efd1032765d66", "score": "0.61115855", "text": "func (n *Notifier) PasswordChanged(em string, err error) error {\n\tlogger.Log(\"event\", em, \"password changed\", err)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn n.mailer.Send(schema.Person{Email: em}, \"password-changed.txt\", nil)\n}", "title": "" }, { "docid": "48353f5f90543908a0bed47200e2e08e", "score": "0.61032045", "text": "func (f *Firebase) ChangePassword(log *log.Logger, w http.ResponseWriter, r *http.Request, params httprouter.Params) error {\n\tvar updatePws firebase.UpdatePassword\n\n\tif err := web.Unmarshal(r.Body, &updatePws); err != nil {\n\t\treturn err\n\t}\n\t// r.Context().Value(\"token\")\n\n\tdefer r.Body.Close()\n\tupdateJson, err := json.Marshal(updatePws)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", f.ChangePasswordURL, bytes.NewReader(updateJson))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := http.DefaultClient.Do(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar firebaseResp interface{}\n\terr = json.NewDecoder(res.Body).Decode(&firebaseResp)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tweb.Respond(log, w, firebaseResp, res.StatusCode)\n\treturn nil\n}", "title": "" }, { "docid": "e8a8dd33782de83fa2d46e949e71d970", "score": "0.6092705", "text": "func ChangePassword(httpresponsewriter http.ResponseWriter, req *http.Request, redisclient *redis.Client, sysid string) {\n\n\tdefer req.Body.Close()\n\tbodybyte, _ := ioutil.ReadAll(req.Body)\n\n\tret := ApplyNewPassword(sysid, redisclient, bodybyte)\n\n\tif ret.ErrorDescription == \"Code has expired.\" {\n\t\tobj := ret\n\t\tbresp, _ := json.Marshal(obj)\n\n\t\tfmt.Fprintf(httpresponsewriter, string(bresp)) // write data to response\n\t} else {\n\n\t\tobj := ret\n\t\tbresp, _ := json.Marshal(obj)\n\n\t\tfmt.Fprintf(httpresponsewriter, string(bresp)) // write data to response\n\t}\n}", "title": "" }, { "docid": "ae937207859dff302f098c948f7432de", "score": "0.6082075", "text": "func (u *User) ResetPassword(c *gin.Context) {\n\tvar req resetPasswordRequest\n\tif err := c.ShouldBindJSON(&req); err != nil {\n\t\tErrValidateResponse(c, err, req)\n\t\treturn\n\t}\n\tuser, err := models.DecodeSignUrl(\"reset\", req.Sign)\n\tif err != nil {\n\t\tErrResponse(c, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tif user.Email != req.Email {\n\t\tErrResponse(c, http.StatusBadRequest, errors.New(\"链接错误\"))\n\t\treturn\n\t}\n\tuser.Password = helper.Md5(req.Password)\n\tif err = user.Save(); err != nil {\n\t\tErrResponse(c, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tSuccessResponse(c)\n}", "title": "" }, { "docid": "97ef40289052af5585232f82a23d8189", "score": "0.6007469", "text": "func (s *AccountAuth) ResetAccountUserPassword(ctx context.Context, req *pb.ResetAccountUserPasswordRequest) (*pb.ResetAccountUserPasswordResponse, error) {\n\n\tstart := time.Now().UnixNano()\n\tresp := &pb.ResetAccountUserPasswordResponse{}\n\tresp.ErrorCode = 401\n\tresp.ErrorMessage = \"not authorized\"\n\n\tvar ok bool\n\n\tclaims, err := s.GetJwtFromContext(ctx)\n\tif err == nil {\n\n\t\tacctmgt := GetStringFromClaims(claims, \"acctmgt\")\n\t\taid := GetInt64FromClaims(claims, \"aid\")\n\n\t\tif acctmgt == \"super\" {\n\t\t\tok = true\n\t\t}\n\t\tif acctmgt == \"admin\" {\n\t\t\taccountId, err := s.HelperAccountIdFromUserid(req.GetUserId())\n\t\t\tif (err == nil) && (aid == accountId) {\n\t\t\t\tok = true\n\t\t\t}\n\t\t}\n\n\t\tif ok {\n\t\t\tresp, err = s.acctService.ResetAccountUserPassword(ctx, req)\n\t\t}\n\t} else {\n\t\tif err.Error() == tokenExpiredMatch {\n\t\t\tresp.ErrorCode = 498\n\t\t\tresp.ErrorMessage = tokenExpiredMessage\n\t\t}\n\n\t\terr = nil\n\t}\n\n\tduration := time.Now().UnixNano() - start\n\tlevel.Info(s.logger).Log(\"endpoint\", \"ResetAccountUserPassword\",\n\t\t\"userid\", req.GetUserId(),\n\t\t\"errcode\", resp.GetErrorCode(), \"duration\", duration)\n\n\treturn resp, err\n\n}", "title": "" }, { "docid": "d46ed4a3bc807925ecf4646765b9baf3", "score": "0.60047305", "text": "func ChangePasswordPasswordAuthBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.PasswordAuthController, payload *app.ChangePasswordParams) (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// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/change-password\"),\n\t}\n\treq, _err := http.NewRequest(\"POST\", u.String(), nil)\n\tif _err != nil {\n\t\tpanic(\"invalid test \" + _err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"PasswordAuthTest\"), rw, req, prms)\n\tchangePasswordCtx, __err := app.NewChangePasswordPasswordAuthContext(goaCtx, req, service)\n\tif __err != nil {\n\t\t_e, _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\tchangePasswordCtx.Payload = payload\n\n\t// Perform action\n\t__err = ctrl.ChangePassword(changePasswordCtx)\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": "132bd445062f7b74622e9a5a4eb4d6b2", "score": "0.5995187", "text": "func (srv *Account) UpdateEmail(Email string, Password string) (map[string]interface{}, error) {\n\tpath := \"/account/email\"\n\n\tparams := map[string]interface{}{\n\t\t\"email\": Email,\n\t\t\"password\": Password,\n\t}\n\n\treturn srv.client.Call(\"PATCH\", path, nil, params)\n}", "title": "" }, { "docid": "2138ca713eb8f32aa8b2d455f2e9eba3", "score": "0.5991404", "text": "func ChangePassword(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\tvar req changePasswordRequest\n\tif err := decoder.Decode(&req); err != nil {\n\t\terrors.NewErrorWithStatusCode(http.StatusBadRequest).WriteTo(w)\n\t\treturn\n\t}\n\n\tuserID := r.Context().Value(\"user_id\").(int)\n\n\tvar user models.User\n\tif err := models.Dbm.SelectOne(&user, \"select * from users where id=?\", userID); err != nil {\n\t\terrors.NewErrorWithStatusCode(http.StatusInternalServerError).WriteTo(w)\n\t\treturn\n\t}\n\n\tif err := user.VerifyPassword(req.OldPassword); err != nil {\n\t\terrors.NewError(\"incorrect password\", http.StatusInternalServerError).WriteTo(w)\n\t\treturn\n\t}\n\n\tuser.HashPassword(req.NewPassword)\n\n\tif _, err := models.Dbm.Update(&user); err != nil {\n\t\terrors.NewError(\"can't change password\", http.StatusInternalServerError).WriteTo(w)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(map[string]string{\n\t\t\"message\": \"password updated\",\n\t})\n}", "title": "" }, { "docid": "64f62ba6b7f03cf997f709deaaadfebc", "score": "0.598908", "text": "func (controller *MainController) PasswordResetPost(c web.C, r *http.Request) (string, int) {\n\temail := r.FormValue(\"email\")\n\tsession := controller.GetSession(c)\n\tdbMap := controller.GetDbMap(c)\n\n\tre := recaptcha.R{\n\t\tSecret: controller.recaptchaSecret,\n\t}\n\n\tisValid := re.Verify(*r)\n\tif !isValid {\n\t\tlog.Errorf(\"Recaptcha error %v\", re.LastError())\n\t\tsession.AddFlash(\"Recaptcha error\", \"passwordresetError\")\n\t\treturn controller.PasswordReset(c, r)\n\t}\n\n\tremoteIP := getClientIP(r, controller.realIPHeader)\n\tuser, err := helpers.EmailExists(dbMap, email)\n\tif err == nil {\n\t\tlog.Infof(\"PasswordReset POST from %v, email %v\", remoteIP,\n\t\t\tuser.Email)\n\n\t\tt := time.Now()\n\t\texpires := t.Add(time.Hour * 1)\n\n\t\ttoken := randToken()\n\t\tpassReset := &models.PasswordReset{\n\t\t\tUserId: user.Id,\n\t\t\tToken: token,\n\t\t\tCreated: t.Unix(),\n\t\t\tExpires: expires.Unix(),\n\t\t}\n\n\t\tif err := models.InsertPasswordReset(dbMap, passReset); err != nil {\n\t\t\tsession.AddFlash(\"Unable to add reset token to database\", \"passwordresetError\")\n\t\t\tlog.Errorf(\"Unable to add reset token to database: %v\", err)\n\t\t\treturn controller.PasswordReset(c, r)\n\t\t}\n\n\t\tbody := \"A request to reset your password was made from IP address: \" +\n\t\t\tremoteIP + \"\\r\\n\\n\" +\n\t\t\t\"If you made this request, follow the link below:\\r\\n\\n\" +\n\t\t\tcontroller.baseURL + \"/passwordupdate?t=\" + token + \"\\r\\n\\n\" +\n\t\t\t\"The above link expires an hour after this email was sent.\\r\\n\\n\" +\n\t\t\t\"If you did not make this request, you may safely ignore this \" +\n\t\t\t\"email.\\r\\n\" + \"However, you may want to look into how this \" +\n\t\t\t\"happened.\\r\\n\"\n\t\terr := controller.SendMail(user.Email, \"Stake pool password reset\", body)\n\t\tif err != nil {\n\t\t\tsession.AddFlash(\"Unable to send password reset email\", \"passwordresetError\")\n\t\t\tlog.Errorf(\"error sending password reset email %v\", err)\n\t\t\treturn controller.PasswordReset(c, r)\n\t\t}\n\t} else {\n\t\tlog.Infof(\"request to reset non-existent account %v from IP %v\",\n\t\t\temail, remoteIP)\n\t}\n\n\tsession.AddFlash(\"An email containing password reset instructions has \"+\n\t\t\"been sent to \"+email+\" if it was a registered account here.\",\n\t\t\"passwordresetSuccess\")\n\n\treturn controller.PasswordReset(c, r)\n}", "title": "" }, { "docid": "233775d82e7e4f29b9c74be5313f1ea4", "score": "0.59854937", "text": "func (s *Server) Reset(ctx context.Context, req *proto.PasswordResetRequest) (*proto.PasswordResetResponse, error) {\n\tif err := s.RstSrv.Reset(ctx, req.Email); err != nil {\n\t\tswitch err := errors.Cause(err); err {\n\t\tcase reset.ErrNotFound:\n\t\t\treturn nil, status.Error(codes.NotFound, err.Error())\n\t\tdefault:\n\t\t\treturn nil, status.Error(codes.Internal, internalErrMsg)\n\t\t}\n\t}\n\n\tvar r proto.PasswordResetResponse\n\treturn &r, nil\n}", "title": "" }, { "docid": "89ab4f8b27702937d616bb8dcfb7617f", "score": "0.59466434", "text": "func ChangePassword() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdec := json.NewDecoder(r.Body)\n\t\tdec.DisallowUnknownFields()\n\n\t\tvar passwordset Passwords\n\t\tif err := dec.Decode(&passwordset); err != nil {\n\t\t\tlog.Error(errors.New(err.Error() + errors.New(\" ChangePassword: accounthandler\").Error()))\n\t\t\tutil.Respond(w, &util.StandardResponse{Status: 422, Type: \"Unprocessable Entity\", Error: true, Message: \"received incorrect json body\"})\n\t\t}\n\t\tuserID, convErr := strconv.Atoi(r.Header.Get(\"UserID\"))\n\t\tif convErr != nil {\n\t\t\tlog.Error(errors.New(convErr.Error() + errors.New(\" ChangePassword: accounthandler\").Error()))\n\t\t\tutil.Respond(w, &util.StandardResponse{Status: 500, Type: \"Internal Server Error\", Error: true, Message: convErr.Error()})\n\t\t}\n\t\tif updateErr := UpdatePassword(userID, passwordset.NewPassword); updateErr != nil {\n\t\t\tlog.Error(errors.New(updateErr.Error() + errors.New(\" ChangePassword: accounthandler\").Error()))\n\t\t\tutil.Respond(w, &util.StandardResponse{Status: 404, Type: \"Not Found\", Error: true, Message: updateErr.Error()})\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "6fbc6938d692bc61db12c64250f92457", "score": "0.5945053", "text": "func userPassword(w http.ResponseWriter, r *http.Request) {\n\tclaims := r.Context().Value(ctxClaims).(*account.Claims)\n\tvar req userPasswordReq\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\tErrInvalidInput.Send(w)\n\t\treturn\n\t}\n\tif err := validator.Validate(req); err != nil {\n\t\te := ErrInvalidInput\n\t\te.Details = err\n\t\te.Send(w)\n\t\treturn\n\t}\n\tid := uuid.FromStringOrNil(claims.Issuer)\n\tif err := account.ChangePassword(id, req.OldPassword, req.NewPassword); err != nil {\n\t\te := ErrUpdateResource\n\t\te.Message = \"Cannot update user password\"\n\t\te.Send(w)\n\t\treturn\n\t}\n\tvar s Success\n\ts.Message = \"User password changed\"\n\ts.Payload = map[string]string{\n\t\t\"userName\": claims.Subject,\n\t}\n\ts.Send(w)\n}", "title": "" }, { "docid": "493af71fc2e7f2c0dd60c8aa02e39d9a", "score": "0.5932834", "text": "func (a *Server) VerifyEmail(ctx context.Context, req *pb.VerifyEmailRequest) (*pb.VerifyEmailResponse, error) {\n\tcred, err := a.auth.GetCredentials(ctx, auth.NewOptions().WithOrgID(req.OrganizationId))\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unauthenticated, \"authentication failed : %s\", err.Error())\n\t}\n\n\tif !cred.IsOrgAdmin {\n\t\treturn nil, status.Errorf(codes.PermissionDenied, \"permission denied\")\n\t}\n\n\t// check whether email registered in shopify store\n\t_, err = a.getShopifyCustomerIDFromEmail(ctx, req.Email)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check whether external email already exist\n\textUser, err := a.store.GetExternalUserByUsername(ctx, auth.SHOPIFY, req.Email)\n\tif err == nil {\n\t\tif extUser.UserID != cred.UserID {\n\t\t\treturn nil, status.Errorf(codes.AlreadyExists, \"already bound to other supernode account\")\n\t\t}\n\t\tif extUser.Verification == \"\" {\n\t\t\treturn nil, status.Errorf(codes.AlreadyExists, \"already successfully bound\")\n\t\t}\n\t\t// email exists, but haven't confirmed, just need to resend security token\n\t\t// send token to given email address\n\t\tif err = a.mailer.SendVerifyEmailConfirmation(req.Email, req.Language, extUser.Verification); err != nil {\n\t\t\treturn nil, status.Errorf(codes.Unknown, err.Error())\n\t\t}\n\t\treturn &pb.VerifyEmailResponse{Status: fmt.Sprintf(\"verification token has been sent to %s\", req.Email)}, nil\n\t} else if err != errHandler.ErrDoesNotExist {\n\t\treturn nil, status.Errorf(codes.Internal, err.Error())\n\t}\n\n\t// check whether user already bound to one external email\n\t_, err = a.store.GetExternalUserByUserIDAndService(ctx, auth.SHOPIFY, cred.UserID)\n\tif err == nil {\n\t\treturn nil, status.Errorf(codes.AlreadyExists, \"only one email can be bound\")\n\t} else if err != errHandler.ErrDoesNotExist {\n\t\treturn nil, status.Errorf(codes.Internal, err.Error())\n\t}\n\n\ttoken := OTPgen()\n\tif err = a.store.AddExternalUserLogin(ctx, ExternalUser{\n\t\tUserID: cred.UserID,\n\t\tServiceName: auth.SHOPIFY,\n\t\tExternalUserID: \"\",\n\t\tExternalUsername: req.Email,\n\t\tVerification: token,\n\t}); err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, err.Error())\n\t}\n\t// send token to given email address\n\tif err = a.mailer.SendVerifyEmailConfirmation(req.Email, req.Language, token); err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, err.Error())\n\t}\n\n\treturn &pb.VerifyEmailResponse{Status: fmt.Sprintf(\"verification token has been sent to %s\", req.Email)}, nil\n}", "title": "" }, { "docid": "7d4aa57a0d79646ba1c0bc1cab8adaaf", "score": "0.59220415", "text": "func resetUserPassword(verbose bool, db *sql.DB, wnet wrpc.IWNetConnection, auth *samecommon.AuthInfo, username string) ([]byte, error) {\n\tif verbose {\n\t\tfmt.Println(\"Resetting user password for:\", username)\n\t}\n\tcmd := \"SELECT userid FROM user WHERE (username = ?);\"\n\tstmtSel, err := db.Prepare(cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows, err := stmtSel.Query(username)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar userid int64\n\tuserid = 0\n\tfor rows.Next() {\n\t\terr = rows.Scan(&userid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif auth.UserId == 0 {\n\t\treturn nil, errors.New(\"ResetUserPassword: User \" + `\"` + username + `\"` + \" not found.\")\n\t}\n\tif verbose {\n\t\tfmt.Println(\" User ID is:\", userid)\n\t}\n\tif auth.UserId == 0 {\n\t\treturn nil, errors.New(\"ResetUserPassword: Not logged in.\")\n\t}\n\tif (auth.UserId & samecommon.RoleAdmin) == 0 {\n\t\t// not admin -- is user resetting their own password?\n\t\tif auth.UserId != userid {\n\t\t\treturn nil, errors.New(\"ResetUserPassword: Permission denied.\")\n\t\t}\n\t}\n\t// Ok, if we got here, we are going to proceed with the password reset\n\tpasswordStore, passwordCR, pwsalt, pwhash, challengeresponsekey, err := generateUserPasswordSet()\n\tif err != nil {\n\t\treturn nil, errors.New(\"ResetUserPassword: \" + err.Error())\n\t}\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmd = \"UPDATE user SET pwsalt = ?, pwhash = ?, challengeresponsekey = ? WHERE userid = ?;\"\n\tstmtUpd, err := tx.Prepare(cmd)\n\t_, err = stmtUpd.Exec(pwsalt, pwhash, challengeresponsekey, userid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = tx.Commit()\n\tpassword := passwordPiecesToPassword(passwordStore, passwordCR)\n\tif verbose {\n\t\tfmt.Println(\" Password reset to:\", password)\n\t}\n\treturn password, err\n}", "title": "" }, { "docid": "0153eb8ad51f122315b1975e0bee14e3", "score": "0.5911357", "text": "func (a *Client) PostMeChangePassword(params *PostMeChangePasswordParams, authInfo runtime.ClientAuthInfoWriter) (*PostMeChangePasswordOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostMeChangePasswordParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostMeChangePassword\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/me/changePassword\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostMeChangePasswordReader{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.(*PostMeChangePasswordOK), nil\n\n}", "title": "" }, { "docid": "0d09e64bac03162f71f733595594cac7", "score": "0.5886152", "text": "func (au *AuthHandler) RequestResetPasswordCode(w http.ResponseWriter, r *http.Request){\n\temail := struct {Email\tstring\t`json:\"email\" validate:\"email,required\"`}{}\n\n\tif err := utils.ParseJsonFromRequest(r, &email); err != nil {\n\t\tutils.GetError(err, http.StatusUnprocessableEntity, w)\n\t\treturn\n\t}\n\n\tif err := validate.Struct(email); err != nil {\n\t\tutils.GetError(err, http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\tuser, err := FetchUserByEmail(bson.M{\"email\": strings.ToLower(email.Email)})\n\tif err != nil {\n\t\tutils.GetError(UserNotFound, http.StatusBadRequest, w)\n\t\treturn\n\t}\n\t// Update user collection with UserPasswordReset - WIP\n\n\tdata := &service.MailData{ \n\t\tUsername: user.FirstName, \n\t\tCode: \"xxxxx\",\n\t}\n\tmsger := au.mailService.NewMail([]string{user.Email}, \"Reset Password Code\", service.PasswordReset, data)\n\t\n\tif err := au.mailService.SendMail(msger); err != nil {\n\t\tfmt.Print(err.Error())\n\t}\n}", "title": "" }, { "docid": "db4983d5eb292336d053d6eb983fba88", "score": "0.58469886", "text": "func (_obj *Apiaccount) Account_cancelPasswordEmail(params *TLaccount_cancelPasswordEmail, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.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\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"account_cancelPasswordEmail\", _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 = ret.ReadBlock(_is, 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": "546bf6992f122b3ec3d15c5bbd89fbe1", "score": "0.5841448", "text": "func (s *UserStorageService) ModifyEmail(ID string, newEmail string) (bool, error) {\n\t//Check if exits a record with that email\n\tif err := s.db.Where(\"email = ?\", newEmail).First(&models.Profile{}).Error; err != nil {\n\t\t//If not exits update the username\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\t//Update DB\n\t\t\tUserChange := &models.Profile{Email: newEmail, UpdatedAt: time.Now()}\n\n\t\t\terr = s.db.Model(&models.Profile{}).Where(\"user_id = ?\", ID).Updates(&UserChange).Error\n\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\tprofile, _ := s.GetProfileCache(ID)\n\n\t\t\tif profile != nil {\n\t\t\t\tsuccess, err := grpc.UpdateAuthCache(\"\", \"\", profile.Email, newEmail)\n\t\t\t\tif !success || err != nil {\n\t\t\t\t\tlog.Println(\"Error in Set the Auth cache \" + err.Error())\n\t\t\t\t}\n\t\t\t\tprofile = nil\n\t\t\t} else {\n\t\t\t\tprofileDB, err := s.GetProfileUser(ID)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\n\t\t\t\tsuccess, err := grpc.UpdateAuthCache(\"\", \"\", profileDB.Email, newEmail)\n\n\t\t\t\tif !success || err != nil {\n\t\t\t\t\tlog.Println(\"Error in Set the Auth cache \" + err.Error())\n\t\t\t\t}\n\t\t\t\tprofileDB = nil\n\t\t\t}\n\n\t\t\t//Set in Cache\n\t\t\tgo s.UpdateUserCache(ID)\n\n\t\t\t//Create Movement\n\t\t\tsucces, err := grpc.CreateMovement(\"Profile\", \"Modify Email\", \"User Service\")\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error in Create a movement: \" + err.Error())\n\t\t\t}\n\n\t\t\tif succes == false {\n\t\t\t\tlog.Println(\"Error in Create a movement\")\n\t\t\t}\n\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\t//Not Error so record found and email exits\n\treturn false, errors.New(\"Email already exists\")\n}", "title": "" }, { "docid": "37ee350514db9e86a37900c71a71c8a0", "score": "0.583952", "text": "func ResetPasswordDone(w http.ResponseWriter, r *http.Request) {\n\t//expire time\n\t// hours := 24\n\tparams := mux.Vars(r)\n\thash := params[\"hash\"]\n\tactivation := Activiation{}\n\tdb.BindEntity(r.Context(), &activation, \"dm_activation\", db.Cond(\"hash\", hash).Cond(\"type\", \"resetpassword\"))\n\tif activation.ID == 0 {\n\t\tHandleError(errors.New(\"Wrong hash?\"), w)\n\t\treturn\n\t} else {\n\t\tnow := time.Now()\n\t\tif time.Unix(int64(activation.Created), 0).Add(time.Hour * 24).Before(now) {\n\t\t\tHandleError(errors.New(\"Token expired.\"), w)\n\t\t\treturn\n\t\t}\n\n\t\tinputs := map[string]interface{}{}\n\t\tdecorder := json.NewDecoder(r.Body)\n\t\terr := decorder.Decode(&inputs)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif password, ok := inputs[\"password\"]; ok {\n\t\t\tref, _ := strconv.Atoi(activation.Ref)\n\t\t\tuser, _ := query.FetchByCID(r.Context(), \"user\", ref)\n\t\t\tif user == nil {\n\t\t\t\tHandleError(errors.New(\"No user found\"), w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif password == \"\" {\n\t\t\t\tHandleError(errors.New(\"Password is empty\"), w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsuccess, validateResult, err := handler.Update(r.Context(), user, handler.InputMap{\"password\": password}, 1)\n\t\t\tif !success {\n\t\t\t\tif !validateResult.Passed() {\n\t\t\t\t\tHandleError(errors.New(validateResult.Fields[\"password\"]), w)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tHandleError(err, w)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdb.Delete(r.Context(), \"dm_activation\", db.Cond(\"id\", activation.ID))\n\n\t\t\tw.Write([]byte(\"1\"))\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "0d861439dfc052f7819f27e91d8e1bfb", "score": "0.5830003", "text": "func (s *Server) Change(ctx context.Context, req *proto.PasswordChangeRequest) (*proto.UserResponse, error) {\n\tvar u user.User\n\tform := change.Form{\n\t\tPassword: req.Password,\n\t\tPasswordConfirmation: req.PasswordConfirmation,\n\t}\n\n\tif err := s.ChgSrv.Change(ctx, req.Token, &form, &u); err != nil {\n\t\tswitch v := errors.Cause(err).(type) {\n\t\tcase validation.Errors:\n\t\t\treturn nil, status.Error(codes.InvalidArgument, v.Error())\n\t\tdefault:\n\t\t\tswitch err := errors.Cause(err); err {\n\t\t\tcase change.ErrNotFound:\n\t\t\t\treturn nil, status.Error(codes.NotFound, err.Error())\n\t\t\tcase change.ErrTokenExpired:\n\t\t\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t\t\tdefault:\n\t\t\t\treturn nil, status.Error(codes.Internal, internalErrMsg)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar r proto.UserResponse\n\tsetResp(&r, &u)\n\treturn &r, nil\n}", "title": "" }, { "docid": "6a694be2dcd87fa51fb6d9ade52b8b76", "score": "0.5821848", "text": "func ChangePassword(ctx iris.Context) {\n\tuserID := middlewares.GetUserID(ctx)\n\n\tchangePasswordRequest := &ChangePasswordRequestData{UserID: userID}\n\n\ter := ctx.ReadJSON(changePasswordRequest)\n\terr.CheckErrWithCallback(er, response.GenCallbackBadRequest(ctx, er))\n\n\toldPassword := encodePassword(changePasswordRequest.OldPassword)\n\tnewPassword := encodePassword(changePasswordRequest.NewPassword)\n\n\t_, has, er := model.GetUserByIDAndPassword(userID, oldPassword)\n\tif er != nil || !has {\n\t\tresponse.Forbidden(ctx, iris.Map{})\n\t\treturn\n\t}\n\n\ter = model.ChangePassword(userID, newPassword)\n\terr.CheckErrWithPanic(er)\n\n\t// response.OK(ctx, iris.Map{})\n\t// redirect to log out route\n\tapp := ctx.Application()\n\tctx.Redirect(app.GetRouteReadOnly(\"UserLogout\").ResolvePath(), 303) // 301 for post method\n}", "title": "" }, { "docid": "e947b5fe5c85b9624612b639547eddaa", "score": "0.58147556", "text": "func ResetPasswordAuthOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.PasswordAuthController, email string, redirectURL string) 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\tquery := url.Values{}\n\t{\n\t\tsliceVal := []string{email}\n\t\tquery[\"email\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{redirectURL}\n\t\tquery[\"redirect-url\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/reset-password\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := []string{email}\n\t\tprms[\"email\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{redirectURL}\n\t\tprms[\"redirect-url\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"PasswordAuthTest\"), rw, req, prms)\n\tresetCtx, _err := app.NewResetPasswordAuthContext(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.Reset(resetCtx)\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 != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "5d82a9ab263091acfd948de4d30b55fc", "score": "0.57998854", "text": "func (a *Client) PostMeChangeEmail(params *PostMeChangeEmailParams, authInfo runtime.ClientAuthInfoWriter) (*PostMeChangeEmailOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostMeChangeEmailParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostMeChangeEmail\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/me/changeEmail\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostMeChangeEmailReader{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.(*PostMeChangeEmailOK), nil\n\n}", "title": "" }, { "docid": "3f1024a08771ddaf9af390b6d750a0e2", "score": "0.57983804", "text": "func HandleChangeUserPasswordSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/users/9fe1d3/password\", 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, ChangePasswordRequest)\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t})\n}", "title": "" }, { "docid": "fa76eab931c95fa02dc202ac61b8bcb0", "score": "0.5784339", "text": "func TestUserPasswordChange(t *testing.T) {\n\tdb.InitDB()\n\tvar router *gin.Engine = routes.SetupRouter()\n\n\tvar user models.UserCreate = utils.CreateUser(\"foo\", \"qwerty1234\", t, router)\n\tuser.Token = utils.ConnectUser(\"foo\", \"qwerty1234\", t, router)\n\n\tvar passwordJSONStr = []byte(`{\"password\": \"1234qwerty\"}`)\n\tvar url string = \"/v1/user/\" + strconv.Itoa(user.ID) + \"/password\"\n\tvar bearer = \"Bearer \" + user.Token\n\trecord := httptest.NewRecorder()\n\trequest, _ := http.NewRequest(\"PUT\", url, bytes.NewBuffer(passwordJSONStr))\n\trequest.Header.Add(\"Content-Type\", \"application/json\")\n\trequest.Header.Add(\"Authorization\", bearer)\n\trouter.ServeHTTP(record, request)\n\n\tassert.Equal(t, record.Code, 200)\n\n\t// A user has to reconnect after a password change\n\tuser.Token = utils.ConnectUser(\"foo\", \"1234qwerty\", t, router)\n\n\tutils.CleanUser(user.ID, user.Token, t, router)\n\tdb.CloseDB()\n}", "title": "" }, { "docid": "1c1e848e280543bdb39284e8c15309b3", "score": "0.57752895", "text": "func (svc auth) SendPasswordResetToken(email string) (err error) {\n\tvar (\n\t\tu *types.User\n\n\t\taam = &authActionProps{\n\t\t\tuser: u,\n\t\t\temail: email,\n\t\t}\n\t)\n\n\terr = func() error {\n\t\tif !svc.settings.Auth.Internal.Enabled || !svc.settings.Auth.Internal.PasswordReset.Enabled {\n\t\t\treturn AuthErrPasswordResetDisabledByConfig(aam)\n\t\t}\n\n\t\tif u, err = svc.users.FindByEmail(email); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsvc.ctx = internalAuth.SetIdentityToContext(svc.ctx, u)\n\n\t\tif err = svc.sendPasswordResetToken(u); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}()\n\n\treturn svc.recordAction(svc.ctx, aam, AuthActionSendPasswordResetToken, err)\n}", "title": "" }, { "docid": "ec2cb49bfd65a3f9d17248b954d565cd", "score": "0.5768525", "text": "func VerifyEmail(w http.ResponseWriter, r *http.Request) {\n\tc := flight.Context(w, r)\n\n\t// Any flash messages can only be shown on some page, reliably redirecting there.\n\tdefer http.Redirect(w, r, \"/login\", http.StatusFound)\n\n\t// Code must contains something and correspond to an existing user.\n\tinvCodeErr := errors.New(\"Invalid verification code\")\n\tcode := strings.TrimSpace(r.URL.Query().Get(\"code\"))\n\tif code == \"\" {\n\t\tc.FlashError(invCodeErr)\n\t\treturn\n\t}\n\tu, noRows, err := user.ByCode(c.DB, code)\n\tif err != nil {\n\t\tif noRows {\n\t\t\tc.FlashError(invCodeErr)\n\t\t} else {\n\t\t\tc.FlashErrorGeneric(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// Verifying a surely existing user.\n\tif _, err = user.Verify(c.DB, u.ID); err != nil {\n\t\tc.FlashErrorGeneric(err)\n\t\treturn\n\t}\n\tc.FlashSuccess(\"Your email has successfully been verified. You can login now.\")\n}", "title": "" }, { "docid": "774680bde0adcaf17bf357ed90163c07", "score": "0.57584804", "text": "func ChangePassword(w rest.ResponseWriter, r *rest.Request) {\n\tdbConn, err := util.GetConnection(CLUSTERADMIN_DB)\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\trest.Error(w, err.Error(), 400)\n\t\treturn\n\n\t}\n\tdefer dbConn.Close()\n\n\t//logit.Info.Println(\"ChangePassword: in ChangePassword\")\n\tchangePass := ChgPassword{}\n\terr = r.DecodeJsonPayload(&changePass)\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\terr = secimpl.Authorize(dbConn, changePass.Token, \"perm-read\")\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\trest.Error(w, err.Error(), http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tvar sameUser bool\n\tsameUser, err = secimpl.CompareUserToToken(dbConn, changePass.Username, changePass.Token)\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\trest.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t//enforce perm-user if the username is not the same as the token's\n\t//username (e.g. bob tries to change larry's password)\n\tif !sameUser {\n\t\terr = secimpl.Authorize(dbConn, changePass.Token, \"perm-user\")\n\t\tif err != nil {\n\t\t\tlogit.Error.Println(err.Error())\n\t\t\trest.Error(w, err.Error(), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t}\n\n\terr = secimpl.ChangePassword(dbConn, changePass.Username, changePass.Password)\n\tif err != nil {\n\t\tlogit.Error.Println(err.Error())\n\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tstatus := types.SimpleStatus{}\n\tstatus.Status = \"OK\"\n\tw.WriteJson(&status)\n}", "title": "" }, { "docid": "c735391e783ef617748131c860242f0c", "score": "0.5758248", "text": "func UpdatePasswordForgotten(httpresponsewriter http.ResponseWriter, req *http.Request, redisclient *redis.Client, sysid string) {\n\n\ttype ControllerInfo struct {\n\t\tName string\n\t\tMessage string\n\t\tEmailAddress string\n\t}\n\ttype DisplayTemplate struct {\n\t\tInfo ControllerInfo\n\t}\n\n\titems := DisplayTemplate{}\n\titems.Info.Name = \"Forgot Password\"\n\n\tapplicationid := \"FestaJunina\" // antes \"restaurante\"\n\n\tusernamemix := req.FormValue(\"username\") // email address\n\titems.Info.EmailAddress = \"test@email.com\"\n\n\trequestcode := req.FormValue(\"requestcode\")\n\tpassword := req.FormValue(\"password\")\n\tpasswordvalidate := req.FormValue(\"passwordvalidate\")\n\n\tlog.Println(usernamemix + \" > Code: 123456\")\n\n\tusername := strings.ToUpper(usernamemix)\n\n\tif username == \"\" {\n\t\tt, _ := template.ParseFiles(\"templates/security/forgotpasswordheader.html\", \"templates/security/forgotpassworddetail.html\")\n\t\titems.Info.Message = \"Please_enter_Name.\"\n\t\tt.Execute(httpresponsewriter, items)\n\t\treturn\n\t}\n\n\tif requestcode == \"\" {\n\t\tt, _ := template.ParseFiles(\"templates/security/forgotpasswordheader.html\", \"templates/security/forgotpassworddetail.html\")\n\t\titems.Info.Message = \"Code not supplied.\"\n\t\tt.Execute(httpresponsewriter, items)\n\t\treturn\n\t}\n\n\tif password == \"\" {\n\t\tt, _ := template.ParseFiles(\"templates/security/forgotpasswordheader.html\", \"templates/security/forgotpassworddetail.html\")\n\t\titems.Info.Message = \"Password_Is_Empty.\"\n\t\tt.Execute(httpresponsewriter, items)\n\t\treturn\n\t}\n\n\tif passwordvalidate == \"\" {\n\t\tt, _ := template.ParseFiles(\"templates/security/forgotpasswordheader.html\", \"templates/security/forgotpassworddetail.html\")\n\t\titems.Info.Message = \"Password_Validate_is_Empty.\"\n\t\tt.Execute(httpresponsewriter, items)\n\t\treturn\n\t}\n\n\tif password == passwordvalidate {\n\n\t\t// Call API to check if user exists and create\n\t\tvar resultado = ResetPassword(sysid, redisclient, username, requestcode, password, passwordvalidate, applicationid)\n\t\tif resultado.ErrorCode == \"200 OK\" {\n\n\t\t} else {\n\t\t\tt, _ := template.ParseFiles(\"templates/security/forgotpasswordheader.html\", \"templates/security/forgotpassworddetail.html\")\n\t\t\titems.Info.Message = \"Passwords_mismatch.\"\n\t\t\tt.Execute(httpresponsewriter, items)\n\t\t\treturn\n\t\t}\n\n\t\thttp.Redirect(httpresponsewriter, req, \"/\", 303)\n\t} else {\n\t\tt, _ := template.ParseFiles(\"templates/security/forgotpasswordheader.html\", \"templates/security/forgotpassworddetail.html\")\n\t\titems.Info.Message = \"Passwords_mismatch.\"\n\t\tt.Execute(httpresponsewriter, items)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "e0aadaec8b50fac05c93ae9fe99059a4", "score": "0.57577115", "text": "func ResetPassword(context register.HandleContext) (err error) {\n\tif !context.GetUser().HasPermission() {\n\t\tcontext.Forbidden()\n\t}\n\n\targs := new(ResetPasswordRequest)\n\tres := new(ResetPasswordResponse)\n\tcontext.RequestArgs(args)\n\n\tres.Password = random.RandStringBytesMaskImprSrcUnsafe(10)\n\n\tu := user.GetUserByID(args.ID)\n\tif u != nil {\n\t\tu.ChangePassword(res.Password)\n\t}\n\n\tcontext.ReturnJSON(res)\n\treturn\n}", "title": "" }, { "docid": "ffa3d979b727576d48d5ee9e87237825", "score": "0.5752371", "text": "func ChangePassword(name, oldPassword, newPassword string) (PamResult, error) {\n\t// Check that we can get the Account Info for this user,\n\tFlags, _ := getUserAccountFlags(name, true)\n\n\tswitch Flags {\n\tcase PamSuccess, PamNewAuthTokReqd, PamAcctExpired:\n\t\tbreak\n\tcase PamUserUnknown, PamAuthInfoUnavail:\n\t\treturn PamAuthERR, Flags\n\tdefault:\n\t\treturn PamSystemERR, errUnknownFlag\n\t}\n\n\t// Continue to Change Password\n\tstatus, err := changeToken(name, oldPassword, newPassword, false)\n\tif err != nil {\n\t\treturn PamSystemERR, err\n\t}\n\n\tswitch status {\n\tcase PamSuccess:\n\t\treturn PamSuccess, nil\n\tcase PamAuthERR, PamAuthTokERR:\n\t\treturn status, status\n\t}\n\n\treturn PamSystemERR, errUnknownFlag\n}", "title": "" }, { "docid": "6a54f92936cca471abd4f5f130868616", "score": "0.57497936", "text": "func ChangePass(request *messageService.Message) (bool, error) {\n\tuserName := request.Header.UserName\n\tif userName == \"\" {\n\t\terr := errors.New(\"User name value is empty\")\n\t\tloger.Log.Errorf(\"Error has occurred: \", err)\n\t\treturn false, err\n\t}\n\tnewPass, err := UnmarshalChangePassRequestBody(request)\n\tif err != nil {\n\t\tloger.Log.Errorf(\"Error has occurred: \", err)\n\t\treturn false, err\n\t}\n\tdb, err := database.GetStorage() // common gorm-connection from database package\n\tif err != nil {\n\t\tloger.Log.Errorf(\"DB error has occurred: \", err)\n\t\treturn false, err\n\t}\n\tvar result AuthResult //variable for storing result of querying into AuthResult struct\n\t// SELECT user_name, nick_name, password, birthday, about_user FROM users\n\t// WHERE main_user = \"mainUser value from request body\"\n\t// AND contact_user = \"contactUser value from request body\"\n\tdb.Table(\"users\").\n\t\tSelect(\"user_name, nick_name, password\").\n\t\tWhere(\"user_name = ?\", userName).\n\t\tScan(&result)\n\toldPass := result.Password\n\tif newPass == oldPass {\n\t\tloger.Log.Warnf(\" Password is the same as old\")\n\t\treturn false, nil\n\t}\n\t// UPDATE users SET password = \"newPass value from request body\"\n\t// WHERE user_name = \"userName value from request header\"\n\t//db.Model(&User).Where(\"user_name = ?\", userName).Update(\"password\", newPass)\n\tif db.Error != nil {\n\t\tloger.Log.Errorf(\"Error has occurred: \", err)\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "e8eae8c752face26d39ebd582d76ce14", "score": "0.5746563", "text": "func (u *User) ChangePasswordFromForget(forgetPasswordToken, password string) error {\n\tif u.ForgetPasswordToken == forgetPasswordToken {\n\t\terr := u.setPassword(password)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\treturn ErrForgetPasswordTokenInvalid\n}", "title": "" }, { "docid": "30a8e0ec1bf59c94c333c8cef8a97a29", "score": "0.57285607", "text": "func (c *Client) ChangePassword(req services.ChangePasswordReq) error {\n\t_, err := c.PutJSON(c.Endpoint(\"users\", req.User, \"web\", \"password\"), req)\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "27833039541589e25ebcbb6cc172cf0d", "score": "0.5724088", "text": "func (c *Client) ChangePassword(httpClient *http.Client, newPassword string) (bool, error) {\n\tc.debugln(\"ChangePassword(): Building change password URL\")\n\turl := fmt.Sprintf(\"https://%s:%s/session/chpasswd\", c.ip, c.port)\n\n\tnewPasswordJSON := []byte(fmt.Sprintf(`{\"password\":\"%s\"}`, newPassword))\n\n\tstatusCode, body, err := c.putWithJSON(httpClient, url, []byte(newPasswordJSON))\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tswitch statusCode {\n\tcase 200:\n\t\tc.debugln(\"ChangePassword(): Successfully changed password.\")\n\t\treturn true, nil\n\tdefault:\n\t\tvar err ErrorResponse\n\t\tunmarErr := json.Unmarshal(body, &err)\n\t\tif unmarErr != nil {\n\t\t\treturn false, unmarErr\n\t\t}\n\t\tc.debugln(\"ChangePassword(): Password could not be changed.\")\n\t\treturn false, fmt.Errorf(\"%s\", err.Error)\n\t}\n}", "title": "" }, { "docid": "9f4a50fd8a182d069840d267d70f2fd9", "score": "0.57199436", "text": "func ResetPasswordPostHandler(ctx *middleware.AppContext, w http.ResponseWriter, r *http.Request) *middleware.Template {\n\thash := getVar(r, \"hash\")\n\tpassword := r.FormValue(\"password\")\n\tpassword2 := r.FormValue(\"password_repeat\")\n\n\tt, err := ctx.TokenService.Get(hash, models.PasswordReset, time.Duration(1)*time.Hour)\n\n\tif err != nil {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminResetPassword,\n\t\t\tErr: err,\n\t\t}\n\t}\n\n\tu, err := ctx.UserService.GetByID(t.Author.ID)\n\n\tif err != nil {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminResetPassword,\n\t\t\tErr: err,\n\t\t}\n\t}\n\n\tif password != password2 {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminResetPassword,\n\t\t\tErr: httperror.New(http.StatusUnprocessableEntity, \"The passwords entered do not match.\", errors.New(\"the password entered did not match\")),\n\t\t}\n\t}\n\n\tu.PlainPassword = []byte(password)\n\n\terr = ctx.UserService.Update(u, true)\n\n\tif err != nil {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminResetPassword,\n\t\t\tErr: err,\n\t\t}\n\t}\n\n\terr = ctx.TokenService.Remove(hash, models.PasswordReset)\n\n\tif err != nil {\n\t\tlogger.Log.Errorf(\"could not remove token %s error %v\", hash, err)\n\t}\n\n\tctx.Mailer.SendPasswordChangeConfirmation(u)\n\n\tif !u.Active {\n\t\tlogger.Log.Warnf(\"password reset for user '%s' was successful, but user is deactivated\", u.Email)\n\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminResetPassword,\n\t\t\tWarnMsg: \"Your password reset was successful, but your account is deactivated.\",\n\t\t}\n\t}\n\n\treturn &middleware.Template{\n\t\tRedirectPath: \"admin\",\n\t\tSuccessMsg: \"Your password reset was successful.\",\n\t}\n}", "title": "" }, { "docid": "27f14e0e225984fce0aa95a0568f8e49", "score": "0.57025415", "text": "func (user *UserController) PasswordResetSubmit(c *gin.Context) {\n\tvar data forms.PasswordSubmitCommand\n\n\ttoken := c.Query(\"token\")\n\n\temail, msg, _ := services.DecodeToken(token)\n\n\tif msg == \"Token is invalid\" {\n\t\tc.JSON(403, gin.H{\"message\": msg})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tif msg == \"Error decoding token\" {\n\t\tc.JSON(400, gin.H{\"message\": \"Token expired, resend email\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tif msg == \"Token is Invalid\" {\n\t\tc.JSON(403, gin.H{\"message\": msg})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tdoc, _ := blacklistModel.FindToken(token)\n\n\tif doc.Token != \"\" {\n\t\tc.JSON(400, gin.H{\"message\": \"Token has expired, request a new one\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tfindUser, _ := userModel.GetUserByEmail(email)\n\n\tif findUser.Email == \"\" {\n\t\tc.JSON(404, gin.H{\"message\": \"Account not found\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Bind request body to define data struct\n\tif c.BindJSON(&data) != nil {\n\t\tc.JSON(406, gin.H{\"message\": \"Provide passwords\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Blacklist the token\n\terr := blacklistModel.Add(token)\n\n\tif err != nil {\n\t\tc.JSON(403, gin.H{\"message\": \"Error blacklisting session\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Check if passwords match\n\tif data.Password != data.Confirm {\n\t\tc.JSON(400, gin.H{\"message\": \"Passwords do not match\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Generate hash for password\n\thashedPassword := helpers.GeneratePasswordHash([]byte(data.Password))\n\n\t// Update user password\n\t_, err2 := userModel.PasswordUpdate(email, hashedPassword)\n\n\t// Check if we encounter an error updating an account\n\tif err2 != nil {\n\t\tc.JSON(404, gin.H{\"message\": \"Account does not exist\"})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(201, gin.H{\"message\": \"Password update successfully\"})\n}", "title": "" }, { "docid": "dc797d45c2d58ee5dd438c27dc4c6add", "score": "0.5700494", "text": "func (rcv *controller) updatePassword() error {\n\n\tif err := maccount.ChangePassword(rcv.loggedUser.Email, rcv.formUser.OldPw, rcv.formUser.NewPw, rcv.Local); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "82e9e55012aa552b5b29c134699f3cdc", "score": "0.56963307", "text": "func (ar *Router) RequestResetPassword() http.HandlerFunc {\n\ttype resetRequestEmail struct {\n\t\tEmail string `json:\"email,omitempty\"`\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\td := resetRequestEmail{}\n\t\tif ar.MustParseJSON(w, r, &d) != nil {\n\t\t\treturn\n\t\t}\n\t\tif !model.EmailRegexp.MatchString(d.Email) {\n\t\t\tar.Error(w, ErrorAPIRequestBodyInvalid, http.StatusBadRequest, \"\", \"RequestResetPassword.emailRegexp_MatchString\")\n\t\t\treturn\n\t\t}\n\n\t\tif userExists := ar.userStorage.UserExists(d.Email); !userExists {\n\t\t\tar.Error(w, ErrorAPIUserNotFound, http.StatusBadRequest, \"User with this email does not exist\", \"RequestResetPassword.UserExists\")\n\t\t\treturn\n\t\t}\n\n\t\tid, err := ar.userStorage.IDByName(d.Email)\n\t\tif err != nil {\n\t\t\tar.Error(w, ErrorAPIUserNotFound, http.StatusBadRequest, err.Error(), \"RequestResetPassword.IDByName\")\n\t\t\treturn\n\t\t}\n\n\t\tresetToken, err := ar.tokenService.NewResetToken(id)\n\t\tif err != nil {\n\t\t\tar.Error(w, ErrorAPIAppResetTokenNotCreated, http.StatusInternalServerError, err.Error(), \"RequestResetPassword.NewResetToken\")\n\t\t\treturn\n\t\t}\n\n\t\tresetTokenString, err := ar.tokenService.String(resetToken)\n\t\tif err != nil {\n\t\t\tar.Error(w, ErrorAPIAppResetTokenNotCreated, http.StatusInternalServerError, err.Error(), \"RequestResetPassword.tokenService_String\")\n\t\t\treturn\n\t\t}\n\n\t\tquery := fmt.Sprintf(\"token=%s\", resetTokenString)\n\n\t\thost, err := url.Parse(ar.Host)\n\t\tif err != nil {\n\t\t\tar.Error(w, ErrorAPIInternalServerError, http.StatusInternalServerError, err.Error(), \"RequestResetPassword.URL_parse\")\n\t\t\treturn\n\t\t}\n\n\t\tu := &url.URL{\n\t\t\tScheme: host.Scheme,\n\t\t\tHost: host.Host,\n\t\t\tPath: path.Join(ar.WebRouterPrefix, \"password/reset\"),\n\t\t\tRawQuery: query,\n\t\t}\n\n\t\tif err = ar.emailService.SendResetEmail(\"Reset Password\", d.Email, u.String()); err != nil {\n\t\t\tar.Error(w, ErrorAPIEmailNotSent, http.StatusInternalServerError, \"Email sending error: \"+err.Error(), \"RequestResetPassword.SendResetEmail\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := map[string]string{\"result\": \"ok\"}\n\t\tar.ServeJSON(w, http.StatusOK, result)\n\t}\n}", "title": "" }, { "docid": "1b8ad77b8b53d3651a93d675b0207a6d", "score": "0.5690588", "text": "func (controller *MainController) EmailUpdate(c web.C, r *http.Request) (string, int) {\n\tt := controller.GetTemplate(c)\n\tsession := controller.GetSession(c)\n\tdbMap := controller.GetDbMap(c)\n\n\t// validate that the token is set, valid, and not expired.\n\ttoken := r.URL.Query().Get(\"t\")\n\n\tif token != \"\" {\n\t\tfailed := false\n\t\temailChange, err := helpers.EmailChangeTokenExists(dbMap, token)\n\t\tif err != nil {\n\t\t\tsession.AddFlash(\"Email verification token not valid\",\n\t\t\t\t\"emailupdateError\")\n\t\t\tfailed = true\n\t\t}\n\n\t\tif !failed {\n\t\t\tif emailChange.Expires-time.Now().Unix() <= 0 {\n\t\t\t\tsession.AddFlash(\"Email change token has expired\",\n\t\t\t\t\t\"emailupdateError\")\n\t\t\t\tfailed = true\n\t\t\t}\n\t\t}\n\n\t\t// possible that someone signed up with this email in the time between\n\t\t// when the token was generated and now.\n\t\tif !failed {\n\t\t\tuserExists := models.GetUserByEmail(dbMap, emailChange.NewEmail)\n\t\t\tif userExists != nil {\n\t\t\t\tsession.AddFlash(\"Email address is in use\", \"emailupdateError\")\n\t\t\t\tfailed = true\n\t\t\t}\n\t\t}\n\n\t\tif !failed {\n\t\t\terr := helpers.EmailChangeComplete(dbMap, token)\n\t\t\tif err != nil {\n\t\t\t\tsession.AddFlash(\"Error occurred while changing email address\",\n\t\t\t\t\t\"emailupdateError\")\n\t\t\t\tlog.Errorf(\"EmailChangeComplete failed %v\", err)\n\t\t\t} else {\n\t\t\t\t// Logout the user to force them to sign in with their new\n\t\t\t\t// email address\n\t\t\t\tsession.Values[\"UserId\"] = nil\n\t\t\t\tsession.AddFlash(\"Email successfully updated\",\n\t\t\t\t\t\"emailupdateSuccess\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tsession.AddFlash(\"No email verification token present\",\n\t\t\t\"emailupdateError\")\n\t}\n\n\tc.Env[\"FlashError\"] = session.Flashes(\"emailupdateError\")\n\tc.Env[\"FlashSuccess\"] = session.Flashes(\"emailupdateSuccess\")\n\n\twidgets := controller.Parse(t, \"emailupdate\", c.Env)\n\tc.Env[\"IsEmailUpdate\"] = true\n\tc.Env[\"Title\"] = \"EXCCoin Stake Pool - Email Update\"\n\tc.Env[\"Content\"] = template.HTML(widgets)\n\n\treturn controller.Parse(t, \"main\", c.Env), http.StatusOK\n}", "title": "" }, { "docid": "c61978cb0f601e032e95c2d81956b534", "score": "0.5686867", "text": "func (u *User) ChangePassword(email, password string, db *gorm.DB) (*User, error) {\n\tvar err error\n\tuser := User{}\n\tuser.Password = password\n\n\t// To hash the password\n\terr = u.BeforeSave()\n\tif err != nil {\n\t\terrors.New(\"Sorry, An Error occured\")\n\t}\n\n\tdb = db.Debug().Where(\"email = ?\", email).Take(&user).Update(\"password\", user.Password)\n\n\tif db.Error != nil {\n\t\treturn &User{}, db.Error\n\t}\n\n\treturn &user, err\n}", "title": "" }, { "docid": "d8502cb9c954bd2ca6ffbd8d4b4a35fb", "score": "0.5685649", "text": "func (a *AuthHandler) ResetPassword(c *gin.Context) {\n\t// Request validation\n\tvar req RequestResetPassword\n\terr := c.ShouldBind(&req)\n\tif err != nil {\n\t\tvar errValidation []response.Error\n\t\tfor _, fieldErr := range err.(validator.ValidationErrors) {\n\t\t\te := fieldErr.Translate(a.Validator.Translation)\n\t\t\terror := response.Error{fieldErr.Field(), e}\n\t\t\terrValidation = append(errValidation, error)\n\t\t}\n\t\tresponse.RespondErrorJSON(c.Writer, errValidation)\n\t\treturn\n\t}\n\n\t// Processing\n\ta.AuthUsecase.ResetPassword(req.PasswordNew, req.PasswordKey)\n\n\t// Response\n\tmsg := \"Password baru anda telah diatur ulang\"\n\tres := struct{}{}\n\tresponse.RespondSuccessJSON(c.Writer, res, msg)\n}", "title": "" }, { "docid": "b2258e8ece27bb2967b848a24af665da", "score": "0.56751394", "text": "func (s NativeScheme) ResetPassword(ctx context.Context, user *auth.User, resetToken string) error {\n\tif resetToken == \"\" {\n\t\treturn auth.ErrInvalidToken\n\t}\n\tconn, err := db.Conn()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\tpassToken, err := getPasswordToken(resetToken)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif passToken.UserEmail != user.Email {\n\t\treturn auth.ErrInvalidToken\n\t}\n\tpassword := generatePassword(12)\n\tuser.Password = password\n\thashPassword(user)\n\tgo sendNewPassword(user, password)\n\tpassToken.Used = true\n\tconn.PasswordTokens().UpdateId(passToken.Token, passToken)\n\treturn user.Update()\n}", "title": "" }, { "docid": "11ca8a4dcf6c700fcb599380416fe713", "score": "0.567183", "text": "func UpdatePassword(c *gin.Context) {\n\tpasswordUpdate := &types.PasswordUpdate{}\n\tif err := c.ShouldBind(passwordUpdate); err != nil {\n\t\tc.AbortWithStatusJSON(400, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tclaims := middlewares.ExtractClaims(c)\n\tif claims == nil {\n\t\tutils.SendServerErrorResponse(c, errors.New(\"Failed to extract JWT claims\"))\n\t\treturn\n\t}\n\tuser, err := mongo.FetchSingleUser(claims.GetEmail())\n\tif err != nil {\n\t\tutils.SendServerErrorResponse(c, err)\n\t\treturn\n\t}\n\tif !utils.CompareHashWithPassword(user.GetPassword(), passwordUpdate.GetOldPassword()) {\n\t\tc.AbortWithStatusJSON(401, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"error\": \"old password is invalid\",\n\t\t})\n\t\treturn\n\t}\n\thashedPass, err := utils.HashPassword(passwordUpdate.GetNewPassword())\n\tif err != nil {\n\t\tutils.SendServerErrorResponse(c, err)\n\t\treturn\n\t}\n\terr = mongo.UpdateUser(\n\t\ttypes.M{mongo.EmailKey: user.GetEmail()},\n\t\ttypes.M{mongo.PasswordKey: hashedPass},\n\t)\n\tif err != nil {\n\t\tutils.SendServerErrorResponse(c, err)\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"success\": true,\n\t\t\"message\": \"password updated\",\n\t})\n}", "title": "" }, { "docid": "b5881b10f5e19c287cd320fb4cdc2a57", "score": "0.56700486", "text": "func VerifyEmailUser(user *User, token string) error {\n\tif err := config.DB.Model(&user).Where(&User{VerifyCode: token}).Updates(map[string]interface{}{\"email_verified\": true, \"verify_code\": \"\"}).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5d90fccb298ae0dbd5a6a958604193e", "score": "0.5666725", "text": "func (h *UserHandler) ChangePassword(c echo.Context) error {\n\ttype data struct {\n\t\tCurrentPassword string `json:\"currentPassword\" form:\"currentPassword\" query:\"currentPassword\"`\n\t\tNewPassword string `json:\"newPassword\" form:\"newPassword\" query:\"newPassword\"`\n\t\tConfirmNewPassword string `json:\"confirmNewPassword\" form:\"confirmNewPassword\" query:\"confirmNewPassword\"`\n\t}\n\n\t// Récupération des variables transmises\n\t// -------------------------------------\n\tinput := new(data)\n\tif err := c.Bind(input); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\n\t\t\t\"message\": \"Invalid parameters\",\n\t\t})\n\t}\n\n\t// Récupération du claims\n\t// ----------------------\n\tu := c.Get(\"user\").(*jwt.Token)\n\tclaims := u.Claims.(*JwtClaims)\n\tnewPassword := fmt.Sprintf(\"%x\", sha512.Sum512([]byte(input.NewPassword)))\n\n\t// Récupération de l'utilisateur en base\n\t// -------------------------------------\n\tvar user models.User\n\tdatabase.Orm.First(&user, claims.ID)\n\n\tif user.ID == 0 {\n\t\treturn c.JSON(http.StatusNotFound, map[string]string{\n\t\t\t\"message\": \"User not found\",\n\t\t})\n\t}\n\n\t// Tests validité des paramètres\n\t// -----------------------------\n\tif user.Password == newPassword {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\n\t\t\t\"message\": \"New password must be different from old password\",\n\t\t})\n\t} else if len(input.NewPassword) < 8 {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\n\t\t\t\"message\": \"New password must contain at least 8 caracters\",\n\t\t})\n\t} else if input.NewPassword != input.ConfirmNewPassword {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\n\t\t\t\"message\": \"Confirm password must be the same as new password\",\n\t\t})\n\t}\n\n\t// Modification en base\n\t// --------------------\n\tok := h.repository.ChangePassword(&user, newPassword)\n\tif !ok {\n\t\treturn c.JSON(http.StatusInternalServerError, map[string]string{\n\t\t\t\"message\": \"An error has occurred\",\n\t\t})\n\t}\n\n\treturn c.JSON(http.StatusOK, map[string]string{\n\t\t\"message\": \"Password changes with success\",\n\t})\n}", "title": "" }, { "docid": "3b189b2796051deafb52cbfa77182e3a", "score": "0.5662879", "text": "func (c *MockClient) ResetPassword(username, passwordHash string) error {\n\targs := c.Called(username, passwordHash)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "a7c3bd7c68112659a625c17418067044", "score": "0.5657966", "text": "func VerifyEmail(w http.ResponseWriter, r *http.Request) {\n\trepo_builder.Account.VerifyEmail(w, r)\n}", "title": "" }, { "docid": "1624cf5f45edf8395578b19b2e433d8d", "score": "0.5635328", "text": "func (svc auth) ChangePassword(userID uint64, oldPassword, AuthActionPassword string) (err error) {\n\tvar (\n\t\tu *types.User\n\t\tcc types.CredentialsSet\n\n\t\taam = &authActionProps{\n\t\t\tuser: u,\n\t\t\tcredentials: &types.Credentials{Kind: credentialsTypePassword},\n\t\t}\n\t)\n\n\terr = svc.db.Transaction(func() error {\n\t\tif !svc.settings.Auth.Internal.Enabled {\n\t\t\treturn AuthErrInteralLoginDisabledByConfig(aam)\n\t\t}\n\n\t\tif len(oldPassword) == 0 {\n\t\t\treturn AuthErrPasswordNotSecure(aam)\n\t\t}\n\n\t\tif !svc.checkPasswordStrength(AuthActionPassword) {\n\t\t\treturn AuthErrPasswordNotSecure(aam)\n\t\t}\n\n\t\tu, err = svc.users.FindByID(userID)\n\t\tif repository.ErrUserNotFound.Eq(err) {\n\t\t\treturn AuthErrPasswordChangeFailedForUnknownUser(aam)\n\t\t}\n\n\t\tcc, err = svc.credentials.FindByKind(userID, credentialsTypePassword)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !svc.checkPassword(oldPassword, cc) {\n\t\t\treturn AuthErrPasswodResetFailedOldPasswordCheckFailed(aam)\n\t\t}\n\n\t\tif err != svc.changePassword(userID, AuthActionPassword) {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn svc.recordAction(svc.ctx, aam, AuthActionChangePassword, err)\n}", "title": "" }, { "docid": "ee5cc1cb37d4cd8ec3b8fe851d2843d7", "score": "0.5631884", "text": "func (cmd *UserPasswordResetCmd) Execute(args []string) error {\n\tusername := cmd.Args.Username\n\temail := cmd.Args.Email\n\tnewPassword := cmd.Args.NewPassword\n\n\t// Get password requirements\n\tpr, err := client.Policy()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate new password\n\tif uint(len(newPassword)) < pr.MinPasswordLength {\n\t\treturn fmt.Errorf(\"password must be %v characters long\",\n\t\t\tpr.MinPasswordLength)\n\t}\n\n\t// Reset password\n\trp := &www.ResetPassword{\n\t\tUsername: username,\n\t\tEmail: email,\n\t}\n\n\terr = PrintJSON(rp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trpr, err := client.ResetPassword(rp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = PrintJSON(rpr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The verification token will only be present in the\n\t// reply if the politeiawww email server has been\n\t// disabled. If the verification token is not in the\n\t// reply then there is nothing more that we can do.\n\tif rpr.VerificationToken == \"\" {\n\t\treturn nil\n\t}\n\n\t// Verify reset password\n\tvrp := www.VerifyResetPassword{\n\t\tUsername: username,\n\t\tVerificationToken: rpr.VerificationToken,\n\t\tNewPassword: DigestSHA3(newPassword),\n\t}\n\n\terr = PrintJSON(vrp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvrpr, err := client.VerifyResetPassword(vrp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn PrintJSON(vrpr)\n}", "title": "" }, { "docid": "356bd4fb300ea2bfdd8e6e4ab572da41", "score": "0.56318736", "text": "func (m *UserOaInfoMutation) ResetEmailPwd() {\n\tm.email_pwd = nil\n}", "title": "" }, { "docid": "99b747495c7c9ba0cd7c0bdaeec3b6a9", "score": "0.56194353", "text": "func VerifyEmailHandler(w http.ResponseWriter, r *http.Request) {\n\tsession, err := store.Get(r, \"session\")\n\tif err != nil {\n\t\tlog.Printf(\"Verify handler - Unable to get session: %v\\n\", err)\n\t\tSendError(w, SERVER_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif r.Method == \"GET\" {\n\t\tvar token string = r.URL.Query().Get(\"token\")\n\n\t\tif token == \"\" {\n\t\t\tSendError(w, `{\"error\": \"No token provided.\"}`, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Get user from database\n\t\tvar userID int64\n\t\tif err := db.QueryRow(\"SELECT user_id FROM verification_emails WHERE token = $1\", token).Scan(&userID); err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\tlog.Printf(\"Verify GET - Attempted to verify account with invalid token: %v\\n\", token)\n\t\t\t\tSendError(w, `{\"error\": \"There was a problem verifying your account. Please try again.\"}`, http.StatusNotFound)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Verify GET - Unable to get verification record from database: %v\\n\", err)\n\t\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Check if the correct user is logged in\n\t\tif userID != session.Values[\"user_id\"] {\n\t\t\tlog.Printf(\"Verify GET - User %d logged in to verify account for %d.\\n\", session.Values[\"user_id\"], userID)\n\t\t\tSendError(w, `{\"error\": \"There was a problem verifying your account. Please try again.\"}`, http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t\t// Start db transaction\n\t\ttx, err := db.Begin()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Verify GET - Unable to begin database transaction: %v\\n\", err)\n\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t}\n\n\t\t// Update the user in the database\n\t\tif _, err = tx.Exec(\"UPDATE users SET verified = CURRENT_TIMESTAMP, status = 'VERIFY_IDENTITY' WHERE user_id = $1\", userID); err != nil {\n\t\t\tlog.Printf(\"Verify GET - Unable to update user record in database: %v\\n\", err)\n\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Delete the invite\n\t\tif _, err = tx.Exec(\"DELETE FROM verification_emails WHERE token = $1\", token); err != nil {\n\t\t\tlog.Printf(\"Verify GET - Unable to delete verification email record from database: %v\\n\", err)\n\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Save changes\n\t\tif err = tx.Commit(); err != nil {\n\t\t\tlog.Printf(\"Verify GET - Unable to commit database transaction: %v\\n\", err)\n\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t}\n\n\t\t// Update session\n\t\tlog.Printf(\"Verify GET - Verifying user %d's session.\", session.Values[\"user_id\"])\n\t\tsession.Values[\"verified\"] = true\n\t\tif err = session.Save(r, w); err != nil {\n\t\t\tlog.Printf(\"Verify GET - Unable to save session state: %v\\n\", err)\n\t\t\tSendError(w, SERVER_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tlog.Printf(\"Verify GET - User %d verified.\\n\", userID)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t} else if r.Method == \"POST\" {\n\t\tvar user User\n\t\tvar userID int64 = session.Values[\"user_id\"].(int64)\n\t\tlog.Printf(\"Verify POST - Sending verification email for user %d\\n\", userID)\n\t\t// Check for the user in the database\n\t\tif err := db.QueryRow(\"SELECT email FROM users WHERE user_id = $1\", userID).Scan(&user.Email); err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\tlog.Printf(\"Verify POST - Verification email requested for non-existent user %v\\n\", userID)\n\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Verify POST - Unable to retrieve user from database: %v\\n\", err)\n\t\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Create new verification email record in database\n\t\ttoken := uniuri.NewLen(64)\n\t\tif _, err := db.Exec(\"INSERT INTO verification_emails (user_id, token) VALUES ($1, $2) ON CONFLICT (user_id) DO UPDATE SET user_id = $1, token = $2, expires = CURRENT_TIMESTAMP + interval '24 hours'\", userID, token); err != nil {\n\t\t\tlog.Printf(\"Verify POST - Unable to insert verification email record into database: %v\\n\", err)\n\t\t\tSendError(w, DATABASE_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Create email template\n\t\thtmlTemplate := template.Must(template.New(\"verification_email.html\").ParseFiles(\"email_templates/verification_email.html\", \"html_fragments/site_name\"))\n\t\ttextTemplate := template.Must(template.New(\"verification_email.txt\").ParseFiles(\"email_templates/verification_email.txt\", \"html_fragments/site_name\"))\n\n\t\tvar htmlBuffer, textBuffer bytes.Buffer\n\t\turl := \"https://\" + os.Getenv(\"HOST\") + \"/verify.html?token=\" + token\n\t\tdata := struct {\n\t\t\tHref string\n\t\t}{url}\n\n\t\tif err := htmlTemplate.Execute(&htmlBuffer, data); err != nil {\n\t\t\tlog.Printf(\"Verify POST - Unable to execute html template: %v\\n\", err)\n\t\t\tSendError(w, SERVER_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif err := textTemplate.Execute(&textBuffer, data); err != nil {\n\t\t\tlog.Printf(\"Verify POST - Unable to execute text template: %v\\n\", err)\n\t\t\tSendError(w, SERVER_ERROR_MESSAGE, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t// Send email\n\t\tif err := SendEmail(user.Email, user.Email, \"Email Verification\", htmlBuffer.String(), textBuffer.String()); err != nil {\n\t\t\tlog.Printf(\"Verify POST - Failed to send verification email: %v\\n\", err)\n\t\t\tSendError(w, `{\"error\": \"Unable to send verification email.\"}`, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n}", "title": "" }, { "docid": "ac42a8c3e12d681e0a426c28299c5f6e", "score": "0.56118715", "text": "func (m *MetaClient) ChangePassword(ctx context.Context, name, passwd string) error {\n\treturn m.CreateUpdateUser(ctx, \"change-password\", name, passwd)\n}", "title": "" }, { "docid": "a57888b589f2a1346135a1e94c8d84cf", "score": "0.56071866", "text": "func UnmarshalChangeUserPasswordResponse(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ChangeUserPasswordResponse)\n\terr = core.UnmarshalModel(m, \"task\", &obj.Task, UnmarshalTask)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "61c7b33d2fbdab12496da4beda9351a6", "score": "0.5601572", "text": "func (a *UserApiService) ForgotPassword(ctx _context.Context, forgotPasswordDto ForgotPasswordDto) (ForgotPasswordResult, *_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 ForgotPasswordResult\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Users/ForgotPassword\"\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\", \"text/json\", \"application/_*+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\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 = &forgotPasswordDto\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-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\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": "4f94d0e0776c780fadff734cef3ecdf3", "score": "0.5585102", "text": "func (controller *MainController) PasswordUpdatePost(c web.C, r *http.Request) (string, int) {\n\tsession := controller.GetSession(c)\n\tdbMap := controller.GetDbMap(c)\n\tremoteIP := getClientIP(r, controller.realIPHeader)\n\n\t// validate that the token is set and not expired.\n\ttoken := r.URL.Query().Get(\"t\")\n\n\tif token == \"\" {\n\t\tsession.AddFlash(\"No password update token present\", \"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\tpasswordReset, err := helpers.PasswordResetTokenExists(dbMap, token)\n\tif err != nil {\n\t\tlog.Errorf(\"error updating password %v\", err)\n\t\tsession.AddFlash(\"Password update token not valid\",\n\t\t\t\"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\tif passwordReset.Expires-time.Now().Unix() <= 0 {\n\t\tsession.AddFlash(\"Password update token has expired\",\n\t\t\t\"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\tpassword, passwordRepeat := r.FormValue(\"password\"),\n\t\tr.FormValue(\"passwordrepeat\")\n\tif password == \"\" {\n\t\tsession.AddFlash(\"Password cannot be empty\", \"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\tif password != passwordRepeat {\n\t\tsession.AddFlash(\"Passwords do not match\", \"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\tuser, err := helpers.UserIDExists(dbMap, passwordReset.UserId)\n\tif err != nil {\n\t\tlog.Infof(\"UserIDExists failure %v, %v\", err, remoteIP)\n\t\tsession.AddFlash(\"Unable to find User ID\", \"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\tlog.Infof(\"PasswordUpdate POST from %v, email %v\", remoteIP,\n\t\tuser.Email)\n\n\tuser.HashPassword(password)\n\t_, err = helpers.UpdateUserPasswordById(dbMap, passwordReset.UserId,\n\t\tuser.Password)\n\tif err != nil {\n\t\tlog.Errorf(\"error updating password %v\", err)\n\t\tsession.AddFlash(\"Unable to update password\", \"passwordupdateError\")\n\t\treturn controller.PasswordUpdate(c, r)\n\t}\n\n\terr = helpers.PasswordResetTokenDelete(dbMap, token)\n\tif err != nil {\n\t\tlog.Errorf(\"error deleting token %v\", err)\n\t}\n\n\tsession.AddFlash(\"Password successfully updated\", \"passwordupdateSuccess\")\n\treturn controller.PasswordUpdate(c, r)\n}", "title": "" }, { "docid": "4fb598b25c05fbd4439aa68b7e94169b", "score": "0.5582002", "text": "func (cloudDatabases *CloudDatabasesV5) ChangeUserPassword(changeUserPasswordOptions *ChangeUserPasswordOptions) (result *ChangeUserPasswordResponse, response *core.DetailedResponse, err error) {\n\treturn cloudDatabases.ChangeUserPasswordWithContext(context.Background(), changeUserPasswordOptions)\n}", "title": "" }, { "docid": "2eca37292a4babf363f5022a89c661b7", "score": "0.5579223", "text": "func (repo *AccountRepository) SendForgotPasswordEmail(account *models.Account) (error) {\n\n\tuniqueHash := createUniqueHash(os.Getenv(\"JWT_SECRET\") + account.Email)\n\tbody := \"Click the link below to reset your password https://desolate-chamber-59976.herokuapp.com/resetpassword/\" + uniqueHash\n\n\ttoken := &models.PasswordResetToken{\n\t\tAccountId: account.ID, Hash: uniqueHash,\n\t}\n\n\tif err := repo.db.Create(token).Error; err != nil {\n\t\treturn err\n\t}\n\n\tmailRequest := &MailRequest{\n\t\tSubject: \"Password Reset Instruction\",\n\t\tTo: account.Email,\n\t\tBody: body,\n\t}\n\n\treturn SendEmail(mailRequest)\n}", "title": "" }, { "docid": "53b01a023e7e4921cd8d86556b9ee434", "score": "0.5569108", "text": "func (_obj *Apiaccount) Account_verifyEmail(params *TLaccount_verifyEmail, _opt ...map[string]string) (ret Bool, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.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\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"account_verifyEmail\", _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 = ret.ReadBlock(_is, 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": "4956cdd2cfc12377b898d5c1230de334", "score": "0.5566304", "text": "func (m *UserModel) ResetPassword(newPass, newPassConfirm, uuid string) error {\n\n\t//check that passwords match\n\tif newPass != newPassConfirm {\n\t\treturn errors.New(\"Passwords do not match\")\n\t}\n\n\t//validate new password\n\tvalid := m.ValidatePassword(newPass)\n\n\tif !valid {\n\t\treturn errors.New(\"Password must be at least 6 characters long\")\n\t}\n\n\t//hash new password for database update\n\tnewPassHash, err := bcrypt.GenerateFromPassword([]byte(newPass), 12)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//update password hash in database\n\tquery := \"UPDATE USERS SET hashed_password = ? WHERE uuid = ?\"\n\n\t_, err = m.DB.Exec(query, newPassHash, uuid)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "bc828dfd37e249b6c87a034567a347d4", "score": "0.55638856", "text": "func ConfirmResetPasswordAuthForbidden(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.PasswordAuthController, payload *app.ResetPasswordParams) (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// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/finalize-reset\"),\n\t}\n\treq, _err := http.NewRequest(\"POST\", u.String(), nil)\n\tif _err != nil {\n\t\tpanic(\"invalid test \" + _err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"PasswordAuthTest\"), rw, req, prms)\n\tconfirmResetCtx, __err := app.NewConfirmResetPasswordAuthContext(goaCtx, req, service)\n\tif __err != nil {\n\t\t_e, _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\tconfirmResetCtx.Payload = payload\n\n\t// Perform action\n\t__err = ctrl.ConfirmReset(confirmResetCtx)\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 != 403 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 403\", 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": "1a2268cf97e57fffbdcda331190736a9", "score": "0.5560596", "text": "func (u *UsersClient) VerifyEmail(ctx context.Context, verifyCode string) error {\n\tverify := apitypes.VerifyEmail{\n\t\tCode: verifyCode,\n\t}\n\treq, _, err := u.client.NewRequest(\"POST\", \"/users/verify\", nil, &verify, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = u.client.Do(ctx, req, nil, nil, nil)\n\treturn err\n}", "title": "" }, { "docid": "20d09c58967a8bfc1bbfbcc098a97804", "score": "0.55576366", "text": "func (srv *Service) UserSetPassword(r *http.Request, args *UserSetPasswordArgs, result *int64) error {\n\n\tme := utils.GetMe(r, srv.Field)\n\tif me == nil {\n\t\treturn &rpc.Error{Code: -32011, Message: \"Auth required\"}\n\t}\n\n\tif args.Password == \"\" {\n\t\treturn &rpc.Error{Code: -32013, Message: \"Empty password\"}\n\t} else if args.Password != args.Password2 {\n\t\treturn &rpc.Error{Code: -32013, Message: \"Passwords does not match\"}\n\t}\n\n\tp, err := utils.HashedPassword(args.Password)\n\tif err != nil {\n\t\tsrv.Log.Printf(\"error: User password hash error: %+v\", err)\n\t\treturn &rpc.Error{Code: -32013, Message: \"Method error\"}\n\t}\n\n\tip := utils.GetIP(r, srv.IPField)\n\n\tacc := account.Record{ID: me.ID}\n\thas, err := srv.DB.Engine.Get(&acc)\n\tif err != nil {\n\t\treturn &rpc.Error{Code: -32014, Message: \"Method error\"}\n\t} else if !has {\n\t\tsrv.Log.Printf(\"error: Unknown user (%+v) from ip %s\", acc, ip)\n\t\treturn &rpc.Error{Code: -32001, Message: \"Login error\"}\n\n\t\t// ToDo: } else if !acc.Enabled {\n\n\t}\n\tacc.Password = p\n\tif _, err = srv.DB.Engine.Id(me.ID).Cols(\"password\").Update(&acc); err != nil {\n\t\tsrv.Log.Printf(\"error: Password change error: %+v\", err)\n\t\treturn &rpc.Error{Code: -32014, Message: \"Method error\"}\n\t}\n\tsrv.Log.Printf(\"debug: Change password for user ID %d from ip %s (%s / %s))\", me.ID, ip, args.Password, p)\n\t*result = me.ID\n\treturn nil\n}", "title": "" }, { "docid": "826e23cf1cb7ae397e3a4f1e32482333", "score": "0.5548075", "text": "func changePassword(w http.ResponseWriter, r *http.Request) {\n\tvar postedJSON TwoWayStruct\n\terr := json.NewDecoder(r.Body).Decode(&postedJSON)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tfmt.Fprintf(w, \"Error in request\")\n\t\treturn\n\t}\n\n\ttoken := w.Header().Get(\"token\")\n\tusr := getUserByToken(token)\n\toldpass := postedJSON.One\n\tnewpass := postedJSON.Two\n\n\terr = bcrypt.CompareHashAndPassword([]byte(usr.Password), []byte(oldpass))\n\n\tif err != nil {\n\t\tJsonResponse(\"password is not true\", w)\n\t\treturn\n\t}\n\n\tgetById := bson.M{\"_id\": usr.Id}\n\n\thashedPassword, err := bcrypt.GenerateFromPassword([]byte(newpass), bcrypt.DefaultCost)\n\n\tcheckInternalServerError(err, w)\n\n\tchange := bson.M{\"$set\": bson.M{\"password\": hashedPassword}}\n\n\tsession := connect()\n\tdefer session.Close()\n\n\tcollection := session.DB(\"munhasir\").C(\"users\")\n\terr = collection.Update(getById, change)\n\n\tif err != nil {\n\t\tJsonResponse(\"everything is something happened\", w)\n\t} else {\n\t\tJsonResponse(\"success\", w)\n\t}\n\n}", "title": "" }, { "docid": "4b76a7a579c853aa84c0f3079324d126", "score": "0.5543224", "text": "func (r *Repository) ResetPatientPassword(hashedPassword []byte, email string, code string) error {\n\treturn nil\n}", "title": "" }, { "docid": "5930073dde526f3c02bd7c676c8a29db", "score": "0.55429864", "text": "func (mail *Mail) EmailPassword(password, url string) error {\n\tmail.subject = \"New Password\"\n\n\tdata := map[string]string{\n\t\t\"password\": password,\n\t\t\"url\": url,\n\t}\n\n\tmessage, err := mail.buildPasswordChangeMessage(data)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tsmtpServer := smtpServer{host: \"smtp.gmail.com\", port: \"465\"}\n\n\tauth := smtp.PlainAuth(\"\", os.Getenv(\"email\"), os.Getenv(\"email_password\"), smtpServer.host)\n\n\t// Gmail will reject connection if it's not secure\n\t// TLS config\n\ttlsconfig := &tls.Config{\n\t\tInsecureSkipVerify: true,\n\t\tServerName: smtpServer.host,\n\t}\n\n\tconn, err := tls.Dial(\"tcp\", smtpServer.serverName(), tlsconfig)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tclient, err := smtp.NewClient(conn, smtpServer.host)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t// step 1: Use Auth\n\tif err = client.Auth(auth); err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t// step 2: add all from and to\n\tif err = client.Mail(os.Getenv(\"email\")); err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tif err = client.Rcpt(mail.To); err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t// Data\n\tw, err := client.Data()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t_, err = w.Write([]byte(message))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\terr = w.Close()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tclient.Quit()\n\treturn nil\n\n}", "title": "" }, { "docid": "822350fb2159f80d249aec31bec3b6f4", "score": "0.55424684", "text": "func (controller *MainController) PasswordReset(c web.C, r *http.Request) (string, int) {\n\tt := controller.GetTemplate(c)\n\tsession := controller.GetSession(c)\n\tc.Env[\"FlashError\"] = session.Flashes(\"passwordresetError\")\n\tc.Env[\"FlashSuccess\"] = session.Flashes(\"passwordresetSuccess\")\n\tc.Env[\"IsPasswordReset\"] = true\n\tc.Env[\"RecaptchaSiteKey\"] = controller.recaptchaSiteKey\n\tif controller.smtpHost == \"\" {\n\t\tc.Env[\"SMTPDisabled\"] = true\n\t}\n\n\twidgets := controller.Parse(t, \"passwordreset\", c.Env)\n\tc.Env[\"Title\"] = \"EXCCoin Stake Pool - Password Reset\"\n\tc.Env[\"Content\"] = template.HTML(widgets)\n\n\treturn controller.Parse(t, \"main\", c.Env), http.StatusOK\n}", "title": "" }, { "docid": "8bca6c6b156b7c3bf4a23e5dab7db2a2", "score": "0.5538035", "text": "func (a *AuthHandler) ForgotPassword(c *gin.Context) {\n\t// Request validation\n\tvar req RequestForgotPassword\n\terr := c.ShouldBind(&req)\n\tif err != nil {\n\t\tvar errValidation []response.Error\n\t\tfor _, fieldErr := range err.(validator.ValidationErrors) {\n\t\t\te := fieldErr.Translate(a.Validator.Translation)\n\n\t\t\terror := response.Error{fieldErr.Field(), e}\n\t\t\terrValidation = append(errValidation, error)\n\t\t}\n\t\tresponse.RespondErrorJSON(c.Writer, errValidation)\n\t\treturn\n\t}\n\n\t// Processing\n\tphoneNormalize := phonenumber.Parse(req.Phone, \"ID\")\n\taffected, code := a.AuthUsecase.ForgotPassword(phoneNormalize)\n\tif affected > 0 {\n\t\tbody := \"Anda telah mengirim permintaan ubah kata sandi, masukkan code berikut \" + code\n\t\ta.AuthUsecase.SendVerificationCode(code, phoneNormalize, body)\n\t}\n\n\t// Response\n\tmsg := \"Kami telah mengirimkan kode untuk mengatur ulang password anda\"\n\tres := struct{}{}\n\t//res := ForgotPasswordResponseTemp{ConfirmationCode: code}\n\tresponse.RespondSuccessJSON(c.Writer, res, msg)\n}", "title": "" }, { "docid": "a8cbe3a775bd94b6e5ea3113bab4380c", "score": "0.5535319", "text": "func (s *Server) UserChangePassword(ctx context.Context, req *pb.AuthUserChangePasswordRequest) (*pb.AuthUserChangePasswordResponse, error) {\n\tresp, err := s.cache.Server.UserChangePassword(ctx, &etcdserverpb.AuthUserChangePasswordRequest{Name: req.Name, Password: req.Password})\n\tif err != nil {\n\t\treturn &pb.AuthUserChangePasswordResponse{}, err\n\t}\n\treturn &pb.AuthUserChangePasswordResponse{\n\t\tHeader: s.convertHeader(resp.Header),\n\t}, err\n}", "title": "" }, { "docid": "e9689e564cf8ccbb562b6ab76a56ddcc", "score": "0.55291533", "text": "func verifyEmailHandler(w http.ResponseWriter, r *http.Request) {\r\n\tfmt.Println(\"*****verifyEmailHandler running*****\")\r\n\tr.ParseForm()\r\n\t// check username criteria\r\n\temail := r.FormValue(\"email\")\r\n\tverCode := r.FormValue(\"vercode\")\r\n\ttx, err := db.Begin()\r\n\tif err != nil {\r\n\t\tfmt.Println(\"failed to begin transaction, err:\", err)\r\n\t\ttpl.ExecuteTemplate(w, \"verifyemail.html\", \"Sorry, there was an issue verifying email, please try again\")\r\n\t\treturn\r\n\t}\r\n\t// rollback will be ignored if the tx has been committed later in the function\r\n\tdefer tx.Rollback()\r\n\t// we need to check if the verCode supplied by user in form is same as in the database\r\n\tfmt.Println(\"email (from form):\", email)\r\n\tfmt.Println(\"verCode (from form):\", verCode)\r\n\tstmt := \"SELECT ver_code FROM email_ver WHERE email = ?\"\r\n\trow := tx.QueryRow(stmt, email)\r\n\tvar dbCode string\r\n\terr = row.Scan(&dbCode)\r\n\tif err != nil {\r\n\t\tfmt.Println(\"error scanning verCode err:\", err)\r\n\t\tvar m Message\r\n\t\tm.Email = email\r\n\t\tm.ErrMessage = \"Sorry there was an issue verifying email, please try again\"\r\n\t\ttpl.ExecuteTemplate(w, \"verifyemail.html\", m)\r\n\t\tif rollbackErr := tx.Rollback(); rollbackErr != nil {\r\n\t\t\tfmt.Println(\"there was an error rolling back changes, rollbackErr:\", rollbackErr)\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\tfmt.Println(\"dbCode:\", dbCode)\r\n\t// check verification code entered into form is same as in db\r\n\tif verCode == dbCode {\r\n\t\t// ver_code is a match, setting account is_active to 1 (true)\"\r\n\t\tstmt := \"UPDATE users SET is_active = 1 WHERE email = ?\"\r\n\t\tupdateIsActiveStmt, err := tx.Prepare(stmt)\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(\"error preparing updateIsActiveStmt err:\", err)\r\n\t\t\tvar m Message\r\n\t\t\tm.Email = email\r\n\t\t\tm.ErrMessage = \"Sorry, there was a problem verifying email, please try again\"\r\n\t\t\ttpl.ExecuteTemplate(w, \"verifyemail.html\", m)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdefer updateIsActiveStmt.Close()\r\n\t\tvar result sql.Result\r\n\t\tresult, err = updateIsActiveStmt.Exec(email)\r\n\t\trowsAff, _ := result.RowsAffected()\r\n\t\tlastIns, _ := result.LastInsertId()\r\n\t\tfmt.Println(\"rowsAff:\", rowsAff)\r\n\t\tfmt.Println(\"lastIns:\", lastIns)\r\n\t\t// check for successfull insert\r\n\t\tif err != nil || rowsAff != 1 {\r\n\t\t\tfmt.Println(\"error inserting new user, err:\", err)\r\n\t\t\tvar m Message\r\n\t\t\tm.Email = email\r\n\t\t\tfmt.Println(\"m.Email:\", m.Email)\r\n\t\t\tm.ErrMessage = \"There was an issue verifying email, please try again\"\r\n\t\t\ttpl.ExecuteTemplate(w, \"verifyemail.html\", m)\r\n\t\t\tif rollbackErr := tx.Rollback(); rollbackErr != nil {\r\n\t\t\t\tfmt.Println(\"there was an error rolling back changes, rollbackErr:\", rollbackErr)\r\n\t\t\t}\r\n\t\t\treturn\r\n\t\t}\r\n\t\ttpl.ExecuteTemplate(w, \"login.html\", \"email verified, go ahead and login\")\r\n\t\ttx.Commit()\r\n\t\treturn\r\n\t}\r\n\tvar m Message\r\n\tm.ErrMessage = \"There was an issue verifying email, please try again\"\r\n\tm.Email = email\r\n\tif rollbackErr := tx.Rollback(); rollbackErr != nil {\r\n\t\tfmt.Println(\"there was an error rolling back changes, rollbackErr:\", rollbackErr)\r\n\t}\r\n\ttpl.ExecuteTemplate(w, \"verifyemail.html\", m)\r\n}", "title": "" }, { "docid": "46a2e1663d8a96e1a7546278718054d8", "score": "0.5528405", "text": "func ChangePasswordPasswordAuthOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.PasswordAuthController, payload *app.ChangePasswordParams) 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// Validate payload\n\terr := payload.Validate()\n\tif err != nil {\n\t\te, ok := err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(err) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected payload validation error: %+v\", e)\n\t\treturn nil\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/auth/change-password\"),\n\t}\n\treq, _err := http.NewRequest(\"POST\", u.String(), nil)\n\tif _err != nil {\n\t\tpanic(\"invalid test \" + _err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"PasswordAuthTest\"), rw, req, prms)\n\tchangePasswordCtx, __err := app.NewChangePasswordPasswordAuthContext(goaCtx, req, service)\n\tif __err != nil {\n\t\t_e, _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\tchangePasswordCtx.Payload = payload\n\n\t// Perform action\n\t__err = ctrl.ChangePassword(changePasswordCtx)\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 != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "df84a742e919c40b3c8e7973b0bc4601", "score": "0.5528292", "text": "func (repo *PgUserRepository) UpdateEmail(userObj m.User) error {\n\tuser := &m.User{\n\t\tEmail: userObj.EmailForUpdate,\n\t\tEmailForUpdate: \"\",\n\t\tUpdateEmailCode: \"\",\n\t\tUpdateEmailCodeExpiredAt: time.Time{},\n\t\tGoogleID: \"\",\n\t}\n\n\t_, err := repo.DB.Model(user).\n\t\tColumn(\"email\", \"email_for_update\", \"update_email_code\",\n\t\t\t\"update_email_code_expired_at\", \"google_id\", \"updated_at\").\n\t\tWhere(\"id = ?\", userObj.ID).\n\t\tUpdate()\n\n\treturn err\n}", "title": "" }, { "docid": "e96beedbbc84d4f977eb1e5a1cc1c27c", "score": "0.5527261", "text": "func ForgotPasswordPostHandler(ctx *middleware.AppContext, w http.ResponseWriter, r *http.Request) *middleware.Template {\n\temail := r.FormValue(\"email\")\n\n\tu, err := ctx.UserService.GetByMail(email)\n\n\tif err != nil {\n\t\tvar e *httperror.Error\n\t\tif errors.As(err, &e) {\n\t\t\tif errors.Is(e.Err, sql.ErrNoRows) {\n\t\t\t\tlogger.Log.Error(err)\n\t\t\t\treturn &middleware.Template{\n\t\t\t\t\tName: tplAdminForgotPassword,\n\t\t\t\t\tSuccessMsg: fmt.Sprintf(\"An email to '%s' with password reset instructions is on the way.\", email),\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn &middleware.Template{\n\t\t\t\tName: tplAdminForgotPassword,\n\t\t\t\tErr: err,\n\t\t\t\tData: map[string]interface{}{\n\t\t\t\t\t\"user\": models.User{\n\t\t\t\t\t\tEmail: email,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\tt := &models.Token{\n\t\tAuthor: u,\n\t\tType: models.PasswordReset,\n\t}\n\n\tif err = ctx.TokenService.RateLimit(u.ID, models.PasswordReset); err != nil {\n\t\tlogger.Log.Error(err)\n\t}\n\n\tif err = ctx.TokenService.Create(t); err != nil {\n\t\treturn &middleware.Template{\n\t\t\tName: tplAdminForgotPassword,\n\t\t\tErr: err,\n\t\t}\n\t}\n\n\tctx.Mailer.SendPasswordResetLink(u, t)\n\n\treturn &middleware.Template{\n\t\tName: tplAdminForgotPassword,\n\t\tSuccessMsg: fmt.Sprintf(\"An email to '%s' with password reset instructions is on the way.\", email),\n\t}\n}", "title": "" }, { "docid": "bf943dc9b6f2c8e1543958d7549266a4", "score": "0.5505865", "text": "func handleResetPassword(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"GET\" {\n\t\tf, _ := template.ParseFiles(\"views/resetpassword.htm\")\n\t\tmsgMap := r.URL.Query()\n\n\t\tif len(msgMap) > 0 {\n\t\t\tif val, ok := msgMap[\"code\"]; ok { // Check if code exist\n\t\t\t\t// Check if code exist\n\t\t\t\tif p := checkIfCodeExist(val[0]); p { //Show reset view\n\t\t\t\t\tResetID = msgMap[\"id\"][0]\n\t\t\t\t\tf.Execute(w, nil)\n\t\t\t\t} else {\n\t\t\t\t\thttp.Redirect(w, r, \"/login?msg=Reset password link no longer valid.\", http.StatusSeeOther)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thttp.Redirect(w, r, \"/login?msg=Reset password link no longer valid.\", http.StatusSeeOther)\n\t\t\t}\n\t\t} else {\n\t\t\thttp.Redirect(w, r, \"/login?msg=Reset password link no longer valid.\", http.StatusSeeOther)\n\t\t}\n\t} else if r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\tif updatePassword(ResetID, r.FormValue(\"password\")) { // Login if true\n\t\t\thttp.Redirect(w, r, \"/login?msg=Password reset successful\", http.StatusSeeOther)\n\t\t} else {\n\t\t\thttp.Redirect(w, r, \"/login?msg=Unable to reset password\", http.StatusSeeOther)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ff28cefda84246094f693d9be6af4092", "score": "0.55053", "text": "func RequestResetPassword(emailAddress string) (string, error) {\n\tvar user, err = identity.GetUserByEmail(emailAddress)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttoken, err := util.GenerateUUID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tuser.ResetPasswordToken = token\n\tuser.ResetPasswordTokenExpireDate = dateutil.NextDateFromNow(passwordResetTokenExpireTime)\n\n\terr = identity.UpdateUser(user)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar passwordResetLink = createLinkWithToken(config.PasswordResetEndpoint, token)\n\tgo sendPasswordResetEmail(emailAddress, passwordResetLink)\n\n\treturn passwordResetLink, nil\n}", "title": "" }, { "docid": "f63c5537c0b793846a2f916f9f48f241", "score": "0.5473376", "text": "func (a *UserApiService) UpdateUserEasyPassword(ctx _context.Context, userId string, localVarOptionals *UpdateUserEasyPasswordOpts) (*_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\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Users/{userId}/EasyPassword\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"userId\"+\"}\", _neturl.QueryEscape(parameterToString(userId, \"\")) , -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\", \"text/json\", \"application/_*+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\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\tif localVarOptionals != nil && localVarOptionals.UpdateUserEasyPassword.IsSet() {\n\t\tlocalVarOptionalUpdateUserEasyPassword, localVarOptionalUpdateUserEasyPasswordok := localVarOptionals.UpdateUserEasyPassword.Value().(UpdateUserEasyPassword)\n\t\tif !localVarOptionalUpdateUserEasyPasswordok {\n\t\t\treturn nil, reportError(\"updateUserEasyPassword should be UpdateUserEasyPassword\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalUpdateUserEasyPassword\n\t}\n\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-Emby-Authorization\"] = key\n\t\t}\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 == 403 {\n\t\t\tvar v ProblemDetails\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 ProblemDetails\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}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "cf170520021a5678251a2275588b230c", "score": "0.5462578", "text": "func passwordResetHandler(w http.ResponseWriter, r *http.Request) {\n\ttype passwordResetData struct {\n\t\tPasswordReset bool\n\t\tError string\n\t}\n\tpasswordReset := false\n\tvar errorString string\n\n\tif r.Method == \"POST\" {\n\t\tuser, err := passwordResetFormParser(r)\n\t\tif err != nil {\n\t\t\terrorString = err.Error()\n\t\t} else {\n\t\t\tnewPassword, err := generatePassword()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\thttp.Error(w, \"Internal server error\", 500)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Send a mail to the user with the password, before attempting to update it\n\t\t\terr = user.sendMail(\"Password reset\", \"Hi \"+user.Username+\". Someone (hopefully you) requested \"+\n\t\t\t\t\"a new password for you on Moss Tier. Here's your new one: \"+newPassword)\n\t\t\tif err != nil {\n\t\t\t\terrorString += \"Could not send you an email with your new password.\"\n\t\t\t\tlog.Println(err)\n\t\t\t} else {\n\t\t\t\terr = user.updatePassword(newPassword)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorString += \"Could not update your password due to an unexpected error. \"\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t} else {\n\t\t\t\t\tpasswordReset = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\trenderContent(\"tmpl/passwordreset.html\", r, w, passwordResetData{passwordReset, errorString})\n}", "title": "" }, { "docid": "8ad581145ad3cc4e77e5cfb9bada230d", "score": "0.54623836", "text": "func TestResetPassword(t *testing.T) {\n\n\tt.Log(\"Given the need ensure a user can reset their password.\")\n\t{\n\t\tctx := tests.Context()\n\n\t\tnow := time.Date(2018, time.October, 1, 0, 0, 0, 0, time.UTC)\n\n\t\t// Create a new user for testing.\n\t\tinitPass := uuid.NewRandom().String()\n\t\tuser, err := repo.Create(ctx, auth.Claims{}, UserCreateRequest{\n\t\t\tFirstName: \"Lee\",\n\t\t\tLastName: \"Brown\",\n\t\t\tEmail: uuid.NewRandom().String() + \"@geeksinthewoods.com\",\n\t\t\tPassword: initPass,\n\t\t\tPasswordConfirm: initPass,\n\t\t}, now)\n\t\tif err != nil {\n\t\t\tt.Log(\"\\t\\tGot :\", err)\n\t\t\tt.Fatalf(\"\\t%s\\tCreate failed.\", tests.Failed)\n\t\t}\n\n\t\t// Create a new random account.\n\t\taccountId := uuid.NewRandom().String()\n\t\terr = mockAccount(accountId, user.CreatedAt)\n\t\tif err != nil {\n\t\t\tt.Log(\"\\t\\tGot :\", err)\n\t\t\tt.Fatalf(\"\\t%s\\tCreate account failed.\", tests.Failed)\n\t\t}\n\n\t\t// Associate new random account with user.\n\t\terr = mockUserAccount(user.ID, accountId, user.CreatedAt, auth.RoleUser)\n\t\tif err != nil {\n\t\t\tt.Log(\"\\t\\tGot :\", err)\n\t\t\tt.Fatalf(\"\\t%s\\tCreate user account failed.\", tests.Failed)\n\t\t}\n\n\t\t// Ensure validation is working by trying ResetPassword with an empty request.\n\t\t{\n\t\t\texpectedErr := errors.New(\"Key: 'UserResetPasswordRequest.email' Error:Field validation for 'email' failed on the 'required' tag\")\n\t\t\t_, err = repo.ResetPassword(ctx, UserResetPasswordRequest{}, now)\n\t\t\tif err == nil {\n\t\t\t\tt.Logf(\"\\t\\tWant: %+v\", expectedErr)\n\t\t\t\tt.Fatalf(\"\\t%s\\tResetPassword failed.\", tests.Failed)\n\t\t\t}\n\n\t\t\terrStr := strings.Replace(err.Error(), \"{{\", \"\", -1)\n\t\t\terrStr = strings.Replace(errStr, \"}}\", \"\", -1)\n\n\t\t\tif errStr != expectedErr.Error() {\n\t\t\t\tt.Logf(\"\\t\\tGot : %+v\", errStr)\n\t\t\t\tt.Logf(\"\\t\\tWant: %+v\", expectedErr)\n\t\t\t\tt.Fatalf(\"\\t%s\\tResetPassword Validation failed.\", tests.Failed)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tResetPassword Validation ok.\", tests.Success)\n\t\t}\n\n\t\tttl := time.Hour\n\n\t\t// Make the reset password request.\n\t\tresetHash, err := repo.ResetPassword(ctx, UserResetPasswordRequest{\n\t\t\tEmail: user.Email,\n\t\t\tTTL: ttl,\n\t\t}, now)\n\t\tif err != nil {\n\t\t\tt.Log(\"\\t\\tGot :\", err)\n\t\t\tt.Fatalf(\"\\t%s\\tResetPassword failed.\", tests.Failed)\n\t\t}\n\t\tt.Logf(\"\\t%s\\tResetPassword ok.\", tests.Success)\n\n\t\t// Read the user to ensure the password_reset field was set.\n\t\tuser, err = repo.ReadByID(ctx, auth.Claims{}, user.ID)\n\t\tif err != nil {\n\t\t\tt.Log(\"\\t\\tGot :\", err)\n\t\t\tt.Fatalf(\"\\t%s\\tRead failed.\", tests.Failed)\n\t\t} else if user.PasswordReset == nil || user.PasswordReset.String == \"\" {\n\t\t\tt.Fatalf(\"\\t%s\\tUser field password_reset is empty.\", tests.Failed)\n\t\t}\n\n\t\t// Ensure validation is working by trying ResetConfirm with an empty request.\n\t\t{\n\t\t\texpectedErr := errors.New(\"Key: 'UserResetConfirmRequest.reset_hash' Error:Field validation for 'reset_hash' failed on the 'required' tag\\n\" +\n\t\t\t\t\"Key: 'UserResetConfirmRequest.password' Error:Field validation for 'password' failed on the 'required' tag\\n\" +\n\t\t\t\t\"Key: 'UserResetConfirmRequest.password_confirm' Error:Field validation for 'password_confirm' failed on the 'required' tag\")\n\t\t\t_, err = repo.ResetConfirm(ctx, UserResetConfirmRequest{}, now)\n\t\t\tif err == nil {\n\t\t\t\tt.Logf(\"\\t\\tWant: %+v\", expectedErr)\n\t\t\t\tt.Fatalf(\"\\t%s\\tResetConfirm failed.\", tests.Failed)\n\t\t\t}\n\n\t\t\terrStr := strings.Replace(err.Error(), \"{{\", \"\", -1)\n\t\t\terrStr = strings.Replace(errStr, \"}}\", \"\", -1)\n\n\t\t\tif errStr != expectedErr.Error() {\n\t\t\t\tt.Logf(\"\\t\\tGot : %+v\", errStr)\n\t\t\t\tt.Logf(\"\\t\\tWant: %+v\", expectedErr)\n\t\t\t\tt.Fatalf(\"\\t%s\\tResetConfirm Validation failed.\", tests.Failed)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tResetConfirm Validation ok.\", tests.Success)\n\t\t}\n\n\t\t// Ensure the TTL is enforced.\n\t\t{\n\t\t\tnewPass := uuid.NewRandom().String()\n\t\t\t_, err = repo.ResetConfirm(ctx, UserResetConfirmRequest{\n\t\t\t\tResetHash: resetHash,\n\t\t\t\tPassword: newPass,\n\t\t\t\tPasswordConfirm: newPass,\n\t\t\t}, now.UTC().Add(ttl*2))\n\t\t\tif errors.Cause(err) != ErrResetExpired {\n\t\t\t\tt.Logf(\"\\t\\tGot : %+v\", errors.Cause(err))\n\t\t\t\tt.Logf(\"\\t\\tWant: %+v\", ErrResetExpired)\n\t\t\t\tt.Fatalf(\"\\t%s\\tResetConfirm enforce TTL failed.\", tests.Failed)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tResetConfirm enforce TTL ok.\", tests.Success)\n\t\t}\n\n\t\t// Assuming we have received the email and clicked the link, we now can ensure confirm works.\n\t\tnewPass := uuid.NewRandom().String()\n\t\treset, err := repo.ResetConfirm(ctx, UserResetConfirmRequest{\n\t\t\tResetHash: resetHash,\n\t\t\tPassword: newPass,\n\t\t\tPasswordConfirm: newPass,\n\t\t}, now)\n\t\tif err != nil {\n\t\t\tt.Log(\"\\t\\tGot :\", err)\n\t\t\tt.Fatalf(\"\\t%s\\tResetConfirm failed.\", tests.Failed)\n\t\t} else if reset.ID != user.ID {\n\t\t\tt.Logf(\"\\t\\tGot : %+v\", reset.ID)\n\t\t\tt.Logf(\"\\t\\tWant: %+v\", user.ID)\n\t\t\tt.Fatalf(\"\\t%s\\tResetConfirm failed.\", tests.Failed)\n\t\t}\n\t\tt.Logf(\"\\t%s\\tResetConfirm ok.\", tests.Success)\n\n\t\t// Ensure the reset hash does not work after its used.\n\t\t{\n\t\t\tnewPass := uuid.NewRandom().String()\n\t\t\t_, err = repo.ResetConfirm(ctx, UserResetConfirmRequest{\n\t\t\t\tResetHash: resetHash,\n\t\t\t\tPassword: newPass,\n\t\t\t\tPasswordConfirm: newPass,\n\t\t\t}, now)\n\t\t\tif errors.Cause(err) != ErrNotFound {\n\t\t\t\tt.Logf(\"\\t\\tGot : %+v\", errors.Cause(err))\n\t\t\t\tt.Logf(\"\\t\\tWant: %+v\", ErrNotFound)\n\t\t\t\tt.Fatalf(\"\\t%s\\tResetConfirm enforce TTL failed.\", tests.Failed)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tResetConfirm reuse disabled ok.\", tests.Success)\n\t\t}\n\t}\n}", "title": "" } ]
441945afbabbd1aa4a3a0f1bc84b3d4d
UseTarget mocks base method
[ { "docid": "463c9b2ae6e1dfc6e5ffe3ab816d2e59", "score": "0.7640171", "text": "func (m *MockContainerServer) UseTarget(arg0 string) client.ContainerServer {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UseTarget\", arg0)\n\tret0, _ := ret[0].(client.ContainerServer)\n\treturn ret0\n}", "title": "" } ]
[ { "docid": "6100489fe135a3fe6a4659bdddb055da", "score": "0.6820165", "text": "func (m *MockJfs) BindTarget(arg0 context.Context, arg1, arg2 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BindTarget\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "110d18b444fd4c44e0e3f319c351b0d3", "score": "0.6418151", "text": "func (_m *MockEAdapter) SetTarget(_a0 ENotifier) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "8fb1bfe8fd0cdd43bfb9de22a01d86fe", "score": "0.6392428", "text": "func (m *MockAPI) Targets(arg0 context.Context) (v1.TargetsResult, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Targets\", arg0)\n\tret0, _ := ret[0].(v1.TargetsResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "09ec23341a0ee36fd1620c53f9e33efe", "score": "0.6139035", "text": "func (m *MockIOrm) Use(plugin gorm.Plugin) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Use\", plugin)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c81badb4a90bac70b1c5fee8323ce7c0", "score": "0.61124206", "text": "func (m *MockResource) Listen(target string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Listen\", target)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3bda3504d9fcf1faeea77a0db74eef10", "score": "0.61089474", "text": "func (m *MockInterface) CreateTarget(arg0 context.Context, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateTarget\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "160eb15ca6401630a8a77974ccbf7c0f", "score": "0.6091058", "text": "func (m *MockTargetWriter) WriteTarget(arg0 string, arg1 cmd.TargetInterface) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"WriteTarget\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "42d076adae9207acddbae5d252e35855", "score": "0.60228175", "text": "func (m *MockQueryer) ScaleTarget(arg0 context.Context, arg1 *v1.HorizontalPodAutoscaler) (map[string]interface{}, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ScaleTarget\", arg0, arg1)\n\tret0, _ := ret[0].(map[string]interface{})\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "62be51cf67610a4fb3af71386286f916", "score": "0.5967452", "text": "func (_m *MockClientConn) Target() 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": "69ca51ec5de4b34549194b6f751260c4", "score": "0.5892889", "text": "func (m *TargetsManagerMock) Proxy(ctx *gin.Context) {\n\tm.Called(ctx)\n}", "title": "" }, { "docid": "d27cb004c97931c77c711e3057124281", "score": "0.5751294", "text": "func (m *MockIOSession) Ref() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Ref\")\n}", "title": "" }, { "docid": "5acb84f88ff329938964602773864ee3", "score": "0.5750557", "text": "func (m *MockPlugin) Perform(arg0 *elastic.Client) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Perform\", arg0)\n}", "title": "" }, { "docid": "e46a81af00004738e2c57bb1f8c70782", "score": "0.56148916", "text": "func (_m *MockEAdapter) UnSetTarget(_a0 ENotifier) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "7d3f73e3c944c96b32368d393e0d7233", "score": "0.55987555", "text": "func CloudPubSubSourceWithTargetTestImpl(t *testing.T, assertMetrics bool) {\n\ttopicName, deleteTopic := lib.MakeTopicOrDie(t)\n\tdefer deleteTopic()\n\n\tpsName := helpers.AppendRandomString(topicName + \"-pubsub\")\n\ttargetName := helpers.AppendRandomString(topicName + \"-target\")\n\n\tclient := lib.Setup(t, true)\n\tif assertMetrics {\n\t\tclient.SetupStackDriverMetrics(t)\n\t}\n\tdefer lib.TearDown(client)\n\n\t// Create a target Job to receive the events.\n\tjob := resources.TargetJob(targetName, []v1.EnvVar{{\n\t\tName: \"TARGET\",\n\t\tValue: \"falldown\",\n\t}})\n\tclient.CreateJobOrFail(job, lib.WithServiceForJob(targetName))\n\n\t// Create the PubSub source.\n\teventsPubsub := kngcptesting.NewCloudPubSubSource(psName, client.Namespace,\n\t\tkngcptesting.WithCloudPubSubSourceSink(lib.ServiceGVK, targetName),\n\t\tkngcptesting.WithCloudPubSubSourceTopic(topicName))\n\tclient.CreatePubSubOrFail(eventsPubsub)\n\n\tclient.Core.WaitForResourceReadyOrFail(psName, lib.CloudPubSubSourceTypeMeta)\n\n\ttopic := lib.GetTopic(t, topicName)\n\n\tr := topic.Publish(context.TODO(), &pubsub.Message{\n\t\tAttributes: map[string]string{\n\t\t\t\"target\": \"falldown\",\n\t\t},\n\t\tData: []byte(`{\"foo\":bar}`),\n\t})\n\t_, err := r.Get(context.TODO())\n\tif err != nil {\n\t\tt.Logf(\"%s\", err)\n\t}\n\n\tmsg, err := client.WaitUntilJobDone(client.Namespace, targetName)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tt.Logf(\"Last term message => %s\", msg)\n\n\tif msg != \"\" {\n\t\tout := &lib.TargetOutput{}\n\t\tif err := json.Unmarshal([]byte(msg), out); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tif !out.Success {\n\t\t\t// Log the output pods.\n\t\t\tif logs, err := client.LogsFor(client.Namespace, psName, lib.CloudPubSubSourceTypeMeta); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t} else {\n\t\t\t\tt.Logf(\"pubsub: %+v\", logs)\n\t\t\t}\n\t\t\t// Log the output of the target job pods.\n\t\t\tif logs, err := client.LogsFor(client.Namespace, targetName, lib.JobTypeMeta); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t} else {\n\t\t\t\tt.Logf(\"job: %s\\n\", logs)\n\t\t\t}\n\t\t\tt.Fail()\n\t\t}\n\t}\n\n\t// Assert that we are actually sending event counts to StackDriver.\n\tif assertMetrics {\n\t\tsleepTime := 1 * time.Minute\n\t\tt.Logf(\"Sleeping %s to make sure metrics were pushed to stackdriver\", sleepTime.String())\n\t\ttime.Sleep(sleepTime)\n\n\t\t// If we reach this point, the projectID should have been set.\n\t\tprojectID := os.Getenv(lib.ProwProjectKey)\n\t\tf := map[string]interface{}{\n\t\t\t\"metric.type\": lib.EventCountMetricType,\n\t\t\t\"resource.type\": lib.GlobalMetricResourceType,\n\t\t\t\"metric.label.resource_group\": lib.PubsubResourceGroup,\n\t\t\t\"metric.label.event_type\": v1alpha1.CloudPubSubSourcePublish,\n\t\t\t\"metric.label.event_source\": v1alpha1.CloudPubSubSourceEventSource(projectID, topicName),\n\t\t\t\"metric.label.namespace_name\": client.Namespace,\n\t\t\t\"metric.label.name\": psName,\n\t\t\t// We exit the target image before sending a response, thus check for 500.\n\t\t\t\"metric.label.response_code\": http.StatusInternalServerError,\n\t\t\t\"metric.label.response_code_class\": pkgmetrics.ResponseCodeClass(http.StatusInternalServerError),\n\t\t}\n\n\t\tfilter := metrics.StringifyStackDriverFilter(f)\n\t\tt.Logf(\"Filter expression: %s\", filter)\n\n\t\tactualCount, err := client.StackDriverEventCountMetricFor(client.Namespace, projectID, filter)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"failed to get stackdriver event count metric: %v\", err)\n\t\t\tt.Fail()\n\t\t}\n\t\texpectedCount := int64(1)\n\t\tif *actualCount != expectedCount {\n\t\t\tt.Errorf(\"Actual count different than expected count, actual: %d, expected: %d\", actualCount, expectedCount)\n\t\t\tt.Fail()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5bb444863d790a696a31af5d52e35e02", "score": "0.5579297", "text": "func targetMutator(mctx abstr.TopDownMutatorContext) {\n\tvar build *Build\n\tvar tgt tgtType\n\n\tif def, ok := abstr.Module(mctx).(targetable); ok {\n\t\tbuild = def.build()\n\t\ttgt = def.getTarget()\n\t} else if gsc, ok := getGenerateCommon(abstr.Module(mctx)); ok {\n\t\tbuild = &gsc.Properties.FlagArgsBuild\n\t\ttgt = gsc.Properties.Target\n\t} else {\n\t\treturn\n\t}\n\n\t//print(mctx.ModuleName() + \" is targetable\\n\")\n\tvar src *TargetSpecific\n\tif tgt == tgtTypeHost {\n\t\tsrc = &build.Host\n\t} else if tgt == tgtTypeTarget {\n\t\tsrc = &build.Target\n\t} else {\n\t\t// This is fine - it can happen if the target is the default\n\t\treturn\n\t}\n\n\t// Copy the target-specific variables to the core set\n\terr := proptools.AppendMatchingProperties([]interface{}{&build.BuildProps}, &src.BuildProps, nil)\n\tif err != nil {\n\t\tif propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {\n\t\t\tmctx.PropertyErrorf(propertyErr.Property, \"%s\", propertyErr.Err.Error())\n\t\t} else {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "528eb98a033175c062330c8b22b952df", "score": "0.5566085", "text": "func (mock *ServiceMock) Run() {\n}", "title": "" }, { "docid": "d5f524c144d482410ee515fa0c604f5d", "score": "0.55271435", "text": "func (_m *MockEAdapter) GetTarget() ENotifier {\n\tret := _m.Called()\n\n\tvar r0 ENotifier\n\tif rf, ok := ret.Get(0).(func() ENotifier); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(ENotifier)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "ad4dfbc3c64a2c1156e0e466feb2b79a", "score": "0.5514667", "text": "func (m *Mockserver) Link(ctx context.Context, in *replica.LinkRequest, opts ...grpc.CallOption) (*replica.LinkResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Link\", varargs...)\n\tret0, _ := ret[0].(*replica.LinkResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "02f5703f4a348366c49269ecbcdb7759", "score": "0.54989713", "text": "func (m *MockAPI) TargetsMetadata(arg0 context.Context, arg1, arg2, arg3 string) ([]v1.MetricMetadata, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TargetsMetadata\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].([]v1.MetricMetadata)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9135b61b7938cf988f9d039d3f7e4553", "score": "0.54891795", "text": "func (r *Runner) Target(target string) *Runner {\n\tr.target = target\n\treturn r\n}", "title": "" }, { "docid": "5a2b5f57abd6f715100151e7a7e69fe6", "score": "0.5480211", "text": "func TestMyDriverWithCustomTargetPaths(t *testing.T) {\n\tvar createTargetDirCalls, createStagingDirCalls,\n\t\tremoveTargetDirCalls, removeStagingDirCalls int\n\n\twantCreateTargetCalls := 3\n\twantCreateStagingCalls := 3\n\twantRemoveTargetCalls := 3\n\twantRemoveStagingCalls := 3\n\n\t// tmpPath could be a CO specific directory under which all the target dirs\n\t// are created. For k8s, it could be /var/lib/kubelet/pods under which the\n\t// mount directories could be created.\n\ttmpPath := path.Join(os.TempDir(), \"csi\")\n\tconfig := sanity.NewTestConfig()\n\tconfig.TargetPath = \"foo/target/mount\"\n\tconfig.StagingPath = \"foo/staging/mount\"\n\tconfig.Address = \"/tmp/e2e-csi-sanity.sock\"\n\tconfig.CreateTargetDir = func(targetPath string) (string, error) {\n\t\tcreateTargetDirCalls++\n\t\ttargetPath = path.Join(tmpPath, targetPath)\n\t\treturn targetPath, createTargetDir(targetPath)\n\t}\n\tconfig.CreateStagingDir = func(targetPath string) (string, error) {\n\t\tcreateStagingDirCalls++\n\t\ttargetPath = path.Join(tmpPath, targetPath)\n\t\treturn targetPath, createTargetDir(targetPath)\n\t}\n\tconfig.RemoveTargetPath = func(targetPath string) error {\n\t\tremoveTargetDirCalls++\n\t\treturn os.RemoveAll(targetPath)\n\t}\n\tconfig.RemoveStagingPath = func(targetPath string) error {\n\t\tremoveStagingDirCalls++\n\t\treturn os.RemoveAll(targetPath)\n\t}\n\n\tsanity.Test(t, config)\n\n\tif createTargetDirCalls != wantCreateTargetCalls {\n\t\tt.Errorf(\"unexpected number of CreateTargetDir calls:\\n(WNT) %d\\n(GOT) %d\", wantCreateTargetCalls, createTargetDirCalls)\n\t}\n\n\tif createStagingDirCalls != wantCreateStagingCalls {\n\t\tt.Errorf(\"unexpected number of CreateStagingDir calls:\\n(WNT) %d\\n(GOT) %d\", wantCreateStagingCalls, createStagingDirCalls)\n\t}\n\n\tif removeTargetDirCalls != wantRemoveTargetCalls {\n\t\tt.Errorf(\"unexpected number of RemoveTargetDir calls:\\n(WNT) %d\\n(GOT) %d\", wantRemoveTargetCalls, removeTargetDirCalls)\n\t}\n\n\tif removeStagingDirCalls != wantRemoveStagingCalls {\n\t\tt.Errorf(\"unexpected number of RemoveStagingDir calls:\\n(WNT) %d\\n(GOT) %d\", wantRemoveStagingCalls, removeStagingDirCalls)\n\t}\n}", "title": "" }, { "docid": "9f376e055368c8c08438f02326934dd2", "score": "0.5458294", "text": "func (t *Target) Instance(env *TestEnvironment) (*TestGroup, []error) {\n\n\t// Create a TestGroup with the tests from all of the targets we're running.\n\tallTargets := []*Target{}\n\n\t// We don't permit metatargets to contain extra tests, so ignore it.\n\tif !t.IsMetaTarget {\n\t\tallTargets = append(allTargets, t)\n\t}\n\n\t// This will be populated for subtargets and metatargets\n\tif len(t.previousSubTargets) > 0 {\n\t\tallTargets = append(allTargets, t.previousSubTargets...)\n\t}\n\n\t// First, create a group config and convert it to a TestGroup.\n\tconfig := &GroupConfig{\n\t\tName: t.Name,\n\t\tUseDeps: true,\n\t\tEnv: env,\n\t\tTests: make([]string, 0),\n\t}\n\n\tdone := make(map[string]bool)\n\n\tfor _, target := range allTargets {\n\t\tfor _, tt := range target.Tests {\n\t\t\tif _, ok := done[tt.Id]; ok {\n\t\t\t\treturn nil, []error{\n\t\t\t\t\tfmt.Errorf(\"Duplicate test detected: '%v'. Duplicate tests are not allowed in targets.\", tt.Id),\n\t\t\t\t}\n\t\t\t}\n\t\t\tconfig.Tests = append(config.Tests, tt.Id)\n\t\t\tdone[tt.Id] = true\n\t\t}\n\t}\n\n\t// Create one combined TestGroup with dependencies for all targets we're running\n\tgroup, errs := GroupFromConfig(config)\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\n\t// We have a runnable group with dependencies. Next, we need\n\t// to assign points, scoring method, args, etc.\n\tfor _, target := range allTargets {\n\t\ttotal := uint(0)\n\t\tfor _, tt := range target.Tests {\n\t\t\ttest, ok := group.Tests[tt.Id]\n\n\t\t\tif !ok {\n\t\t\t\treturn nil, []error{errors.New(\"Cannot find \" + tt.Id + \" in the TestGroup\")}\n\t\t\t}\n\t\t\tif err := tt.applyTo(test); err != nil {\n\t\t\t\treturn nil, []error{err}\n\t\t\t}\n\t\t\t// This is used for scoring later\n\t\t\ttest.TargetName = target.Name\n\n\t\t\ttotal += tt.Points\n\t\t}\n\n\t\tif total != target.Points {\n\t\t\treturn nil, []error{fmt.Errorf(\"Target points (%v) do not match sum(test points) (%v)\", target.Points, total)}\n\t\t}\n\t}\n\n\tassignRequiredBy(group)\n\n\treturn group, nil\n}", "title": "" }, { "docid": "be10d1c3d0a83c2b2421a3de7ada0521", "score": "0.5437065", "text": "func (m *MockServiceHandler) Process(ctx context.Context) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Process\", ctx)\n}", "title": "" }, { "docid": "c73a7ef1a055e1ffc10564f4f639312a", "score": "0.5429099", "text": "func (m *MockVariable) Usage() string {\n\tret := m.ctrl.Call(m, \"Usage\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "dd32d1840357624746f940dfbfb6ba88", "score": "0.53894675", "text": "func (m *MockIOSession) UseConn(arg0 net.Conn) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"UseConn\", arg0)\n}", "title": "" }, { "docid": "40ad2281ead802b7cb322759a1003c24", "score": "0.538081", "text": "func targetMutator(ctx blueprint.TopDownMutatorContext) {\n\tif t, ok := ctx.Module().(targetSpecificLibrary); ok {\n\n\t\ttgt := t.getTarget()\n\n\t\tif tgt != toolchain.TgtTypeHost && tgt != toolchain.TgtTypeTarget {\n\t\t\t// This is fine if target is neither host or target,\n\t\t\t// it can happen if the target is the default\n\t\t\treturn\n\t\t}\n\n\t\tdst := t.targetableProperties()\n\t\tsrc := t.getTargetSpecific(tgt).getTargetSpecificProps()\n\n\t\t// Copy the target-specific variables to the core set\n\t\terr := AppendMatchingProperties(dst, src)\n\t\tif err != nil {\n\t\t\tif propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {\n\t\t\t\tctx.PropertyErrorf(propertyErr.Property, \"%s\", propertyErr.Err.Error())\n\t\t\t} else {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bab76d004cf64222665cccf8198c2d90", "score": "0.53661895", "text": "func (m *MockSubscriber) Process() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Process\")\n}", "title": "" }, { "docid": "869c521e76f7c6512a1866921eb21b3c", "score": "0.53530455", "text": "func (m *MockMetadata) Start() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Start\")\n}", "title": "" }, { "docid": "481dea7fe4247cb2b018e3d629592f7f", "score": "0.5344574", "text": "func (m *MockIRedis) Do(cmd string, args ...interface{}) interface{} {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{cmd}\n\tfor _, a := range args {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Do\", varargs...)\n\tret0, _ := ret[0].(interface{})\n\treturn ret0\n}", "title": "" }, { "docid": "dea67fa013cb10832b74ce3a3bfbace6", "score": "0.5343933", "text": "func (m *MockPin) Output() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Output\")\n}", "title": "" }, { "docid": "0f9b1ca80619430b6869aa79e6430f08", "score": "0.5321035", "text": "func (m *MockCondition) TargetType() TargetType {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TargetType\")\n\tret0, _ := ret[0].(TargetType)\n\treturn ret0\n}", "title": "" }, { "docid": "c090ad92808f716c06ffcb3931e668ec", "score": "0.53137594", "text": "func (_m *OneTimeTokenServiceInterface) Use(token string, obj interface{}) error {\n\tret := _m.Called(token, obj)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, interface{}) error); ok {\n\t\tr0 = rf(token, obj)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "3ff65696ff72f3a1c7ecda88f784cda9", "score": "0.53116167", "text": "func (m *MockmdServerLocal) FastForwardBackoff() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"FastForwardBackoff\")\n}", "title": "" }, { "docid": "4f74f2d427b724d0206ea2a4774277a5", "score": "0.5307682", "text": "func (m *MockProxyFromFlags) Ref(arg0 service.ZoneRef) service.ProxyRef {\n\tret := m.ctrl.Call(m, \"Ref\", arg0)\n\tret0, _ := ret[0].(service.ProxyRef)\n\treturn ret0\n}", "title": "" }, { "docid": "e0fa3d57b54200dfe6c078022f2afc23", "score": "0.52936316", "text": "func setupMockEndpoint(url string) http.RoundTripper {\n\ttransport := httpmock.NewMockTransport()\n\ttransport.RegisterResponder(\"POST\", url, randomlySlowResponder)\n\n\treturn transport\n}", "title": "" }, { "docid": "f807d9fc1f50e18174331abbf4a75cb5", "score": "0.5285282", "text": "func (m *MockDemand) Provide(arg0 context.Context, arg1 exchange.Impression, arg2 chan exchange.Advertise) {\n\tm.ctrl.Call(m, \"Provide\", arg0, arg1, arg2)\n}", "title": "" }, { "docid": "4220ee2be9cd76a34667dfa650243022", "score": "0.52824783", "text": "func (m *Mockrunner) Run(name string, args []string, options ...command.Option) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{name, args}\n\tfor _, a := range options {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Run\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "903af6e8f167620bb46fab12f553485f", "score": "0.52816707", "text": "func (_m *GrantRepo) Use(UUID string, version int) error {\n\tret := _m.Called(UUID, version)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, int) error); ok {\n\t\tr0 = rf(UUID, version)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "dce8497d6abff44c70163c56c69ce2b8", "score": "0.5276475", "text": "func (m *MockManipulator) Manipulate(arg0 string) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Manipulate\", arg0)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "2bd29a90c4e97cfaa13ba501076d9368", "score": "0.52744585", "text": "func (m *MockApplier) Run(arg0 context.Context, arg1 inventory.InventoryInfo, arg2 []*unstructured.Unstructured, arg3 apply.Options) <-chan event.Event {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Run\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(<-chan event.Event)\n\treturn ret0\n}", "title": "" }, { "docid": "0fcb885e2246c50dfae38d048bc0eaee", "score": "0.5273336", "text": "func (t *Target) initAsSubTarget(env *TestEnvironment) error {\n\tif len(t.MetaName) == 0 {\n\t\treturn nil\n\t}\n\n\tmetaTarget, ok := env.Targets[t.MetaName]\n\tif !ok {\n\t\treturn errors.New(\"Cannot find the metatarget '\" + t.MetaName + \"'.\")\n\t}\n\n\tfoundThis := false\n\tothers := make([]*Target, 0)\n\tfor _, name := range metaTarget.SubTargetNames {\n\t\tif name == t.Name {\n\t\t\tfoundThis = true\n\t\t\t// The subtargets must be in order, and since we've found\n\t\t\t// this one, we're done.\n\t\t\tbreak\n\t\t} else {\n\t\t\tif other, ok := env.Targets[name]; ok {\n\t\t\t\tothers = append(others, other)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Cannot find subtarget '%v' in metatarget '%v'\", name, metaTarget.Name)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !foundThis {\n\t\treturn fmt.Errorf(\"Cannot find main subtarget '%v' in metatarget '%v'\", t.Name, metaTarget.Name)\n\t}\n\n\t// Link this target to its metatarget and younger subtarget siblings.\n\tt.metaTarget = metaTarget\n\tt.previousSubTargets = others\n\n\treturn nil\n}", "title": "" }, { "docid": "651e37baf160dcdc306d1cd6b5520375", "score": "0.5262032", "text": "func (m *MockProcessor) AddTemplateTarget(templateName, targetPath string) {\n\tm.Called(templateName, targetPath)\n}", "title": "" }, { "docid": "a7a6e50444a58db4a60409f8f206c8b3", "score": "0.5258492", "text": "func (m *MockOverrideProvider) Overrides() (stevedore.Overrides, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Overrides\")\n\tret0, _ := ret[0].(stevedore.Overrides)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "03ab3b983de6b848d5fda87b3862b1b6", "score": "0.5247993", "text": "func (m *MockClient) Release() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Release\")\n}", "title": "" }, { "docid": "a80e6771c7e83069e53796e99ed8b768", "score": "0.5243076", "text": "func (m *MockScalableTarget) Max() uint32 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Max\")\n\tret0, _ := ret[0].(uint32)\n\treturn ret0\n}", "title": "" }, { "docid": "a7912e5119e4fc67292acb067059132b", "score": "0.52340823", "text": "func (m *mockListenerAdapter) inject(arg0 *v2.Listener) error {\n\tret := m.ctrl.Call(m, \"inject\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2ecf5748b98389b5005ef90b4359fcb2", "score": "0.52209246", "text": "func TestHookup(t *testing.T) { TestingT(t) }", "title": "" }, { "docid": "c228c38a974447d72adf9b71aadb3c61", "score": "0.52112764", "text": "func (mmSendTarget *mSenderMockSendTarget) Expect(ctx context.Context, msg *message.Message, target insolar.Reference) *mSenderMockSendTarget {\n\tif mmSendTarget.mock.funcSendTarget != nil {\n\t\tmmSendTarget.mock.t.Fatalf(\"SenderMock.SendTarget mock is already set by Set\")\n\t}\n\n\tif mmSendTarget.defaultExpectation == nil {\n\t\tmmSendTarget.defaultExpectation = &SenderMockSendTargetExpectation{}\n\t}\n\n\tmmSendTarget.defaultExpectation.params = &SenderMockSendTargetParams{ctx, msg, target}\n\tfor _, e := range mmSendTarget.expectations {\n\t\tif minimock.Equal(e.params, mmSendTarget.defaultExpectation.params) {\n\t\t\tmmSendTarget.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmSendTarget.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmSendTarget\n}", "title": "" }, { "docid": "d6d90380e0f30dae670797912f6cc89f", "score": "0.5185976", "text": "func (m *HaveMethodExecutedMatcher) UseDiffer(d matchers.Differ) {\n\tm.differ = d\n}", "title": "" }, { "docid": "3e1b7ff3329a660b8b6ac6d3931d5b98", "score": "0.5180531", "text": "func (m *MockHandler) ListenContainer() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"ListenContainer\")\n}", "title": "" }, { "docid": "6cf4256d2e8a3f74e82cf0b56ac2fd71", "score": "0.5179766", "text": "func (m *MockHandler) ListenService() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"ListenService\")\n}", "title": "" }, { "docid": "a1b51fa203182dc0056e1aeae9068ff0", "score": "0.5178621", "text": "func (m *MockNetWatcherI) run() {\n\tm.ctrl.Call(m, \"run\")\n}", "title": "" }, { "docid": "74172c0de95be146cf283a8b1040585c", "score": "0.5178115", "text": "func (m *MockStateModifier) Map(arg0 func(state.NonThreadSafeState) error) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Map\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "aa6a3af70c1ae47e00cf83c9114677e8", "score": "0.5178013", "text": "func (m *MockState) Map(arg0 func(state.NonThreadSafeState) error) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Map\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1af505ad8bdad5e04910fc90544f5a04", "score": "0.5174452", "text": "func (m *MockRateLimitingInterface) Add(arg0 interface{}) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Add\", arg0)\n}", "title": "" }, { "docid": "e3a7cba84db690d5ffc3a187fc8b4721", "score": "0.51652354", "text": "func (_m *Pipeline) Targets() map[string]common.Nozzle {\n\tret := _m.Called()\n\n\tvar r0 map[string]common.Nozzle\n\tif rf, ok := ret.Get(0).(func() map[string]common.Nozzle); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(map[string]common.Nozzle)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "c103cc4155a7f194938adf20ce2e3ecd", "score": "0.515377", "text": "func TestPlatformMock(t *testing.T) {\n\tvar p = &MockPlatform{\n\t\tAllServicesAnswer: []Service{Service{}},\n\t\tSomeServicesArgTest: func([]flux.ServiceID) error {\n\t\t\treturn errors.New(\"arg fail\")\n\t\t},\n\t\tApplyError: errors.New(\"fail apply\"),\n\t\tSyncError: errors.New(\"fail sync\"),\n\t}\n\tvar _ Platform = p\n\n\t// Just token tests so we're attempting _something_ here\n\tss, err := p.AllServices(\"\", flux.ServiceIDSet{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif len(ss) != 1 {\n\t\tt.Errorf(\"expected answer given in mock, but got %+v\", ss)\n\t}\n\n\tss, err = p.SomeServices([]flux.ServiceID{})\n\tif err == nil {\n\t\tt.Error(\"expected error from args test, got nil\")\n\t}\n\n\terr = p.Apply([]ServiceDefinition{})\n\tif err == nil {\n\t\tt.Error(\"expected error, got nil\")\n\t}\n\n\tp.ApplyError = nil\n\tp.ApplyArgTest = func([]ServiceDefinition) error {\n\t\treturn errors.New(\"apply args fail\")\n\t}\n\tif err = p.Apply([]ServiceDefinition{}); err == nil {\n\t\tt.Error(\"expected error from apply, got nil\")\n\t}\n\n\tif err = p.Sync(SyncDef{}); err == nil {\n\t\tt.Error(\"expected error from sync, got nil\")\n\t}\n\n\tp.SyncError = nil\n\tp.SyncArgTest = func(SyncDef) error {\n\t\treturn errors.New(\"sync args fail\")\n\t}\n\tif err = p.Sync(SyncDef{}); err == nil {\n\t\tt.Error(\"expected error from sync, got nil\")\n\t}\n}", "title": "" }, { "docid": "1ffdd01c0507a7cac821a4784fdd5cd4", "score": "0.5150212", "text": "func (mmUseProxy *mResolverMockUseProxy) Expect(m1 coordinates.Module) *mResolverMockUseProxy {\n\tif mmUseProxy.mock.funcUseProxy != nil {\n\t\tmmUseProxy.mock.t.Fatalf(\"ResolverMock.UseProxy mock is already set by Set\")\n\t}\n\n\tif mmUseProxy.defaultExpectation == nil {\n\t\tmmUseProxy.defaultExpectation = &ResolverMockUseProxyExpectation{}\n\t}\n\n\tmmUseProxy.defaultExpectation.params = &ResolverMockUseProxyParams{m1}\n\tfor _, e := range mmUseProxy.expectations {\n\t\tif minimock.Equal(e.params, mmUseProxy.defaultExpectation.params) {\n\t\t\tmmUseProxy.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmUseProxy.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmUseProxy\n}", "title": "" }, { "docid": "cafe86173db3f0d8593a51d7f9dd117b", "score": "0.51410913", "text": "func TestMockBatchControl(t *testing.T) {\n\ttestMockBatchControl(t)\n}", "title": "" }, { "docid": "e98ccbc05baccd355f64479806c2f3e3", "score": "0.5138647", "text": "func (a *Accesser) UseMockSyscall() *mockSyscall {\n\tmsc := &mockSyscall{}\n\ta.sys = msc\n\treturn msc\n}", "title": "" }, { "docid": "4fdc0eb8e7bb8f27df254ec4fa1a7e8c", "score": "0.5138443", "text": "func (m Mock) Arrange(start Container) {}", "title": "" }, { "docid": "7b0136ace5b4d2a1d6fd26b0e3a9d97f", "score": "0.5133262", "text": "func (m *MockINovaLogger) Start() {\n\tm.ctrl.Call(m, \"Start\")\n}", "title": "" }, { "docid": "0f15e407701b4ec4476d6a82e7e0d258", "score": "0.5133212", "text": "func (mr *MockContainerServerMockRecorder) UseTarget(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UseTarget\", reflect.TypeOf((*MockContainerServer)(nil).UseTarget), arg0)\n}", "title": "" }, { "docid": "bba944a9df61dc95abca633dda25680d", "score": "0.5131671", "text": "func (m *MockConfigBackend) Lookup(arg0 string) (interface{}, bool) {\r\n\tret := m.ctrl.Call(m, \"Lookup\", arg0)\r\n\tret0, _ := ret[0].(interface{})\r\n\tret1, _ := ret[1].(bool)\r\n\treturn ret0, ret1\r\n}", "title": "" }, { "docid": "ddcc952ed524fbf19d27fdde5adf648c", "score": "0.51288384", "text": "func (m *MockBreaker) Mark() {\n\tm.ctrl.Call(m, \"Mark\")\n}", "title": "" }, { "docid": "8383857302addcefc283a96ab72841fa", "score": "0.51206934", "text": "func UseMock() bool {\n\treturn useMock\n}", "title": "" }, { "docid": "90deef7e5ba052372b019d94f43e6b92", "score": "0.51123375", "text": "func (m *MockDemand) Win(arg0 context.Context, arg1 string, arg2 int64) {\n\tm.ctrl.Call(m, \"Win\", arg0, arg1, arg2)\n}", "title": "" }, { "docid": "c687aabc7534c3d7adb413e35c0f5dd5", "score": "0.5110989", "text": "func (m *MockMDServer) FastForwardBackoff() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"FastForwardBackoff\")\n}", "title": "" }, { "docid": "e7bd70643679fd1e1c7551ca40e39239", "score": "0.5110412", "text": "func (m *MockScalableTarget) Delay() time.Duration {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Delay\")\n\tret0, _ := ret[0].(time.Duration)\n\treturn ret0\n}", "title": "" }, { "docid": "6f255c61fd2ba9003c3a5e33e42c4946", "score": "0.51039106", "text": "func TestDefaultProjectCommandBuilder_BuildVersionCommand(t *testing.T) {\n\tRegisterMockTestingT(t)\n\ttmpDir := DirStructure(t, map[string]interface{}{\n\t\t\"workspace1\": map[string]interface{}{\n\t\t\t\"project1\": map[string]interface{}{\n\t\t\t\t\"main.tf\": nil,\n\t\t\t\t\"workspace.tfplan\": nil,\n\t\t\t},\n\t\t\t\"project2\": map[string]interface{}{\n\t\t\t\t\"main.tf\": nil,\n\t\t\t\t\"workspace.tfplan\": nil,\n\t\t\t},\n\t\t},\n\t\t\"workspace2\": map[string]interface{}{\n\t\t\t\"project1\": map[string]interface{}{\n\t\t\t\t\"main.tf\": nil,\n\t\t\t\t\"workspace.tfplan\": nil,\n\t\t\t},\n\t\t\t\"project2\": map[string]interface{}{\n\t\t\t\t\"main.tf\": nil,\n\t\t\t\t\"workspace.tfplan\": nil,\n\t\t\t},\n\t\t},\n\t})\n\t// Initialize git repos in each workspace so that the .tfplan files get\n\t// picked up.\n\trunCmd(t, filepath.Join(tmpDir, \"workspace1\"), \"git\", \"init\")\n\trunCmd(t, filepath.Join(tmpDir, \"workspace2\"), \"git\", \"init\")\n\n\tworkingDir := mocks.NewMockWorkingDir()\n\tWhen(workingDir.GetPullDir(\n\t\tAny[models.Repo](),\n\t\tAny[models.PullRequest]())).\n\t\tThenReturn(tmpDir, nil)\n\n\tlogger := logging.NewNoopLogger(t)\n\tscope, _, _ := metrics.NewLoggingScope(logger, \"atlantis\")\n\n\tglobalCfgArgs := valid.GlobalCfgArgs{\n\t\tAllowRepoCfg: false,\n\t\tMergeableReq: false,\n\t\tApprovedReq: false,\n\t\tUnDivergedReq: false,\n\t}\n\tterraformClient := terraform_mocks.NewMockClient()\n\tWhen(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil)\n\n\tbuilder := events.NewProjectCommandBuilder(\n\t\tfalse,\n\t\t&config.ParserValidator{},\n\t\t&events.DefaultProjectFinder{},\n\t\tnil,\n\t\tworkingDir,\n\t\tevents.NewDefaultWorkingDirLocker(),\n\t\tvalid.NewGlobalCfgFromArgs(globalCfgArgs),\n\t\t&events.DefaultPendingPlanFinder{},\n\t\t&events.CommentParser{ExecutableName: \"atlantis\"},\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\t\"\",\n\t\t\"**/*.tf,**/*.tfvars,**/*.tfvars.json,**/terragrunt.hcl,**/.terraform.lock.hcl\",\n\t\tfalse,\n\t\tfalse,\n\t\tscope,\n\t\tlogger,\n\t\tterraformClient,\n\t)\n\n\tctxs, err := builder.BuildVersionCommands(\n\t\t&command.Context{\n\t\t\tLog: logger,\n\t\t\tScope: scope,\n\t\t},\n\t\t&events.CommentCommand{\n\t\t\tRepoRelDir: \"\",\n\t\t\tFlags: nil,\n\t\t\tName: command.Version,\n\t\t\tVerbose: false,\n\t\t\tWorkspace: \"\",\n\t\t\tProjectName: \"\",\n\t\t})\n\tOk(t, err)\n\tEquals(t, 4, len(ctxs))\n\tEquals(t, \"project1\", ctxs[0].RepoRelDir)\n\tEquals(t, \"workspace1\", ctxs[0].Workspace)\n\tEquals(t, \"project2\", ctxs[1].RepoRelDir)\n\tEquals(t, \"workspace1\", ctxs[1].Workspace)\n\tEquals(t, \"project1\", ctxs[2].RepoRelDir)\n\tEquals(t, \"workspace2\", ctxs[2].Workspace)\n\tEquals(t, \"project2\", ctxs[3].RepoRelDir)\n\tEquals(t, \"workspace2\", ctxs[3].Workspace)\n}", "title": "" }, { "docid": "8454ac3c3f5382c434fe7ad7b0d7b330", "score": "0.5101172", "text": "func (m *MockHandler) Start() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Start\")\n}", "title": "" }, { "docid": "872c5053a6b56ae992c564cf22a1ffed", "score": "0.50997555", "text": "func (m *MockInstance) Apply(arg0 bool) error {\n\tret := m.ctrl.Call(m, \"Apply\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8454ac3c3f5382c434fe7ad7b0d7b330", "score": "0.50997543", "text": "func (m *MockHandler) Start() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Start\")\n}", "title": "" }, { "docid": "18726666e9624e306f8e8391967774c6", "score": "0.5097427", "text": "func (m *MockServerlessService) Stream(arg0 *exec.Cmd) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Stream\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b6df2b5313d4a5865bab5666195d5077", "score": "0.50933015", "text": "func (m *MockOrderMonitor) process() {\n\tm.ctrl.Call(m, \"process\")\n}", "title": "" }, { "docid": "f4384f140f8a8c271d368fb08d750fe7", "score": "0.5089178", "text": "func (m *MockUpdaterFromFlags) Make() (updater.Updater, error) {\n\tret := m.ctrl.Call(m, \"Make\")\n\tret0, _ := ret[0].(updater.Updater)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "df20d47f7a1e740eff3f93ed682b3ca3", "score": "0.50876015", "text": "func mockedGranter(kubeutil *kube.Kube, app *v1.RadixRegistration, namespace string, serviceAccount *corev1.ServiceAccount) error {\n\treturn nil\n}", "title": "" }, { "docid": "6c134312c1062ae96511bb9e94954221", "score": "0.50840765", "text": "func (m *MockMeshFinder) Generic(obj *v1.Deployment) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Generic\", obj)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3b6c89962308159e9d614ac1ef1d37c5", "score": "0.5081842", "text": "func (m *MockMetadata) Stop() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Stop\")\n}", "title": "" }, { "docid": "5b29eb5145d65c2ba301160d42bef5d9", "score": "0.50759345", "text": "func (m *MockStorageClient) RecordUsage(arg0 *metricsservice.GlobalUsage) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecordUsage\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "af60ec81482ccebbce62693b3aaeafb2", "score": "0.50724113", "text": "func (m *MockThumbupRPC) Like(c context.Context, arg *model.ArgLike) error {\n\tret := m.ctrl.Call(m, \"Like\", c, arg)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e1819154d6518e513e86b3ce04eb6393", "score": "0.5070089", "text": "func (m *MockNoSQLEngine) Lookup(arg0, arg1, arg2 string, arg3 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lookup\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ba94ab8513077afcf2341c43cdf33477", "score": "0.5067101", "text": "func (m *MockCondition) SetTargetType(t TargetType) Condition {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetTargetType\", t)\n\tret0, _ := ret[0].(Condition)\n\treturn ret0\n}", "title": "" }, { "docid": "dd64f3db163e459acf401d7a586ea9a8", "score": "0.5065805", "text": "func (m *MockKumaBot) Run(arg0 string) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Run\", arg0)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "65087e2b40ef97e93858547880d2f1fb", "score": "0.5064542", "text": "func (m *MockScalableTarget) Increment() uint32 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Increment\")\n\tret0, _ := ret[0].(uint32)\n\treturn ret0\n}", "title": "" }, { "docid": "3e6556bc6f736bf528e08b89da089803", "score": "0.5055722", "text": "func mockStartCmd(mgr manager.Manager)error{\n\tif mgr!=nil{\n\t\treturn nil\n\t}\n\treturn errors.New(\"manager cannot be empty\")\n}", "title": "" }, { "docid": "8f18f9e9411807894f5ebdbd9fdacbf5", "score": "0.505332", "text": "func (_TestTargetContract *TestTargetContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {\n\treturn _TestTargetContract.Contract.TestTargetContractCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "632f52af0428463d99858b7c252abee1", "score": "0.50519836", "text": "func (m *MockIHttp) Do(req *http.Request, option ...*phttp.Option) *http.Response {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{req}\n\tfor _, a := range option {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Do\", varargs...)\n\tret0, _ := ret[0].(*http.Response)\n\treturn ret0\n}", "title": "" }, { "docid": "0d096adae20626aa2fe1f5c95fd154c4", "score": "0.5051619", "text": "func (m *MockNetWatcherI) setup() {\n\tm.ctrl.Call(m, \"setup\")\n}", "title": "" }, { "docid": "4f9753651514b4b95a7517b81a5e5670", "score": "0.5045133", "text": "func (m *MockService) FollowTo(arg0 context.Context, arg1, arg2 string) (user.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"FollowTo\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(user.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "10e18732422cdcf5ca751093959b1ac5", "score": "0.50446826", "text": "func (m *MockUsageTrackerInterface) Subtract(arg0 *usage_metrics.UsageData) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Subtract\", arg0)\n}", "title": "" }, { "docid": "eb3c8ff1652927ec8ea585866ff789a7", "score": "0.5044331", "text": "func (m *MockScalableTarget) EXPECT() *MockScalableTargetMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "81e8d3ce11214df07d06f1c941f48e1a", "score": "0.5042278", "text": "func (m *MockEnsurer) Manager() manager.Manager {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Manager\")\n\tret0, _ := ret[0].(manager.Manager)\n\treturn ret0\n}", "title": "" }, { "docid": "69d8700c857fdcfc483fa17ae126ebbf", "score": "0.5038603", "text": "func (m *MockIpfsDHT) Provide(arg0 context.Context, arg1 cid.Cid, arg2 bool) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Provide\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9d267a1be16a666817ff47352ebd24c8", "score": "0.50339574", "text": "func (m *MockClient) Execute(arg0 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Execute\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2b004982b8c60555537532193cf681c7", "score": "0.50305116", "text": "func bindMockTargetContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(MockTargetContractABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "944c0d382b8155128911a29ffc4edb5a", "score": "0.5024985", "text": "func (m *MockScalableTarget) LastUpdated() time.Time {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LastUpdated\")\n\tret0, _ := ret[0].(time.Time)\n\treturn ret0\n}", "title": "" }, { "docid": "33daa7b78696fbfefef414c3c4491f29", "score": "0.50245297", "text": "func (m *MockLocalJob) Execute(pythonCommand, pythonFilePath string, envVars []string, log logrus.FieldLogger) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Execute\", pythonCommand, pythonFilePath, envVars, log)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "966852740e77aafe5474e9e7f46bd7d6", "score": "0.5021573", "text": "func mockRunCommand(t *testing.T, wantCmds []string, commandOut string, err error, exactMatch bool) func() {\n\toriginalRunCommand := runCommand\n\tactCmds := make([]string, 0)\n\trunCommand = func(cmd string) (string, error) {\n\t\tactCmds = append(actCmds, cmd)\n\t\treturn commandOut, err\n\t}\n\treturn func() {\n\t\trunCommand = originalRunCommand\n\t\tif wantCmds == nil {\n\t\t\tassert.Empty(t, actCmds)\n\t\t} else if exactMatch {\n\t\t\tassert.Equal(t, wantCmds, actCmds)\n\t\t} else {\n\t\t\tassert.Subset(t, actCmds, wantCmds)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d0e87ed433b7be243e30f0733be68412", "score": "0.5016149", "text": "func (m *MockContext) Unicast(ev model.BotEventType, payload interface{}, target *model.Bot) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Unicast\", ev, payload, target)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" } ]
958d443cfb3402698bf2998e4cb8da2e
GetThreadModuleKey returns a ModuleKey with the location of the module being processed by a current load(...) or exec(...) statement. It has no relation to the module that holds the toplevel stack frame. For example, if a currently loading module 'A' calls a function in module 'B' and this function calls GetThreadModuleKey, it will see module 'A' as the result, even though the call goes through code in module 'B'. Returns nil if the current thread is not executing any load(...) or exec(...), i.e. it has ThreadUnknown kind.
[ { "docid": "c1269a4182852a07788f9b27c8869e57", "score": "0.85465384", "text": "func GetThreadModuleKey(th *starlark.Thread) *ModuleKey {\n\tif modKey, ok := th.Local(threadModKey).(ModuleKey); ok {\n\t\treturn &modKey\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "3b67e9808fd0ef69575fb7ec2c9c6469", "score": "0.55600876", "text": "func GetThreadKind(th *starlark.Thread) ThreadKind {\n\tif k := th.Local(threadKindKey); k != nil {\n\t\treturn k.(ThreadKind)\n\t}\n\tpanic(\"not an Interpreter thread, no ThreadKind in its locals\")\n}", "title": "" }, { "docid": "cd5f805cf1432f5c6c8b56f1aa464be4", "score": "0.547202", "text": "func (win Win32) GetWindowThreadProcessID(hwnd HWND) (HANDLE, uint32) {\n\tvar processID uint32\n\tret, _, _ := syscall.Syscall(win.getWindowThreadProcessID, 2,\n\t\tuintptr(hwnd),\n\t\tuintptr(unsafe.Pointer(&processID)),\n\t\t0)\n\n\treturn HANDLE(ret), processID\n}", "title": "" }, { "docid": "68d24b953c564902e47ecc9ee657ed4b", "score": "0.5389405", "text": "func GetThreadInterpreter(th *starlark.Thread) *Interpreter {\n\tif intr := th.Local(threadIntrKey); intr != nil {\n\t\treturn intr.(*Interpreter)\n\t}\n\tpanic(\"not an Interpreter thread, no Interpreter in its locals\")\n}", "title": "" }, { "docid": "649ade9f8b752b64459afcabbcf8c4bc", "score": "0.52281815", "text": "func (self *Message) GetThreadId() string {\n\n\tif self.message == nil {\n\t\treturn \"\"\n\t}\n\tid := C.notmuch_message_get_thread_id(self.message)\n\t// we dont own id\n\t// defer C.free(unsafe.Pointer(id))\n\n\tif id == nil {\n\t\treturn \"\"\n\t}\n\n\treturn C.GoString(id)\n}", "title": "" }, { "docid": "12fcce97024aaebb9019928e7b344683", "score": "0.51510096", "text": "func (c *cell) GetThread() *uint32 {\n\tif len(c.fragmentedCoresList) > 0 {\n\t\tthread := c.fragmentedCoresList[0]\n\t\tc.fragmentedCoresList = c.fragmentedCoresList[1:]\n\t\treturn &thread\n\t} else if len(c.fullCoresList) > 0 {\n\t\tthread := c.fullCoresList[0][0]\n\t\tremaining := c.fullCoresList[0][1:]\n\t\tif len(remaining) >= c.threadsPerCore {\n\t\t\tc.fullCoresList[0] = remaining\n\t\t} else {\n\t\t\tc.fullCoresList = c.fullCoresList[1:]\n\t\t\tc.fragmentedCoresList = append(c.fragmentedCoresList, remaining...)\n\t\t}\n\t\treturn &thread\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b42b667f038e3442ab147f5afa7c7ca", "score": "0.51000714", "text": "func (dbp *nativeProcess) FindThread(threadID int) (proc.Thread, bool) {\n\tth, ok := dbp.threads[threadID]\n\treturn th, ok\n}", "title": "" }, { "docid": "b0c1ec70b32b02540fbb8e979804e5a8", "score": "0.49791366", "text": "func (win Win32) GetModuleHandle(name string) HINSTANCE {\n\tvar mod uintptr\n\tif name == \"\" {\n\t\tmod = 0\n\t} else {\n\t\tmod = uintptr(unsafe.Pointer(StringToUint(name)))\n\t}\n\tret, _, _ := syscall.Syscall(win.getModuleHandle, 1,\n\t\tuintptr(mod),\n\t\t0, 0)\n\treturn HINSTANCE(ret)\n}", "title": "" }, { "docid": "ba6831f2f74b63109349083c5d883330", "score": "0.49735764", "text": "func (o *EquipmentTransceiver) GetModuleId() int64 {\n\tif o == nil || o.ModuleId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ModuleId\n}", "title": "" }, { "docid": "1d376f34a8d4cff502f779dfbaad093f", "score": "0.4925242", "text": "func (config *Config) GetModuleFunction(functionKey string) ModuleFunction {\n\n\tconfig.RLock()\n\t\tfunction := config.ModuleRegistry[functionKey]\n\tconfig.RUnlock()\n\n\treturn function\n}", "title": "" }, { "docid": "b1b684f3c9ccd6984a68e4b8bd70d3ea", "score": "0.49038967", "text": "func x36__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "dade4f4ba661fb788f0a75802c9125d7", "score": "0.48986977", "text": "func (p *Process) GetThread(id int) (t *Thread, ok bool) {\n\tt, ok = p.threads[id]\n\treturn\n}", "title": "" }, { "docid": "b266d77ddccbaf60f825f984987ffa0d", "score": "0.48885578", "text": "func GetModuleLevel(module string) (*string, error) {\n\t// logging.GetLevel() returns the logging level for the module, if defined.\n\t// Otherwise, it returns the default logging level, as set by\n\t// `flogging/logging.go`.\n\t//level := zerolog.GetLevel(module).String()\n\t//return level\n\tif value, ok := modules[module]; ok {\n\t\treturn &value, nil\n\t} else {\n\t\treturn nil, errors.New(fmt.Sprintf(\"module not found: %s\", module))\n\t}\n\n}", "title": "" }, { "docid": "f8ce8301a355a9f82fcfadefccfa34f4", "score": "0.48687544", "text": "func x__pthread_getspecific(tls TLS, _k uint32) (r uintptr /* *void */) {\n\tvar _self uintptr // *S__pthread\n\n\t_self = x37__pthread_self(tls)\n\treturn *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_self + 152)) + 8*uintptr(_k)))\n}", "title": "" }, { "docid": "a17df2edd49f5f9590f3947cff436abe", "score": "0.4861569", "text": "func x27__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "ebd831139e00f199d250cac363e94fe1", "score": "0.4860213", "text": "func (intr *Interpreter) runModule(ctx context.Context, key ModuleKey, kind ThreadKind) (starlark.StringDict, error) {\n\t// Grab the source code.\n\tdict, src, err := intr.invokeLoader(key)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, err\n\tcase dict != nil:\n\t\t// This is a native module constructed in Go, no need to interpret it.\n\t\treturn dict, nil\n\t}\n\n\t// Otherwise make a thread for executing the code. We do not reuse threads\n\t// between modules. All global state is passed through intr.globals,\n\t// intr.modules and ctx.\n\tth := intr.Thread(ctx)\n\tth.Load = func(th *starlark.Thread, module string) (starlark.StringDict, error) {\n\t\tkey, err := MakeModuleKey(th, module)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdict, err := intr.LoadModule(ctx, key.Package, key.Path)\n\t\t// See comment in execBuiltin about why we extract EvalError backtrace into\n\t\t// new error.\n\t\tif evalErr, ok := err.(*starlark.EvalError); ok {\n\t\t\terr = fmt.Errorf(\"%s\", evalErr.Backtrace())\n\t\t}\n\t\treturn dict, err\n\t}\n\n\t// Let builtins know what this thread is doing. Some calls (most notably Exec\n\t// itself) are allowed only from exec'ing threads, not from load'ing ones.\n\tth.SetLocal(threadKindKey, kind)\n\t// Let builtins (and in particular MakeModuleKey and LoadSource) know the\n\t// package and the module that the thread executes.\n\tth.SetLocal(threadModKey, key)\n\n\tif kind == ThreadExecing {\n\t\tif intr.PreExec != nil {\n\t\t\tintr.PreExec(th, key)\n\t\t}\n\t\tif intr.PostExec != nil {\n\t\t\tdefer intr.PostExec(th, key)\n\t\t}\n\t}\n\n\t// Record we've been here.\n\tintr.visited = append(intr.visited, key)\n\n\t// Execute the module. It may 'load' or 'exec' other modules inside, which\n\t// will either call LoadModule or ExecModule.\n\t//\n\t// Use user-friendly module name (with omitted \"@__main__\") for error messages\n\t// and stack traces to avoid confusing the user.\n\treturn starlark.ExecFile(th, key.String(), src, intr.globals)\n}", "title": "" }, { "docid": "ad8c11a17b0e10537f68cb07d3097778", "score": "0.48500305", "text": "func x11__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "b136f79aeee5c1fbda24b446fefec090", "score": "0.4849662", "text": "func GetModuleName() (string, error) {\n\t// Stores the contents of `go.mod` file as a byte array\n\tgoModBytes, err := ioutil.ReadFile(\"go.mod\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Extracts module name from the passed `go.mod` file contents\n\tmodName := modfile.ModulePath(goModBytes)\n\n\treturn modName, nil\n}", "title": "" }, { "docid": "17c1fb1b003790cf26d81c8bb4d25138", "score": "0.48444927", "text": "func x26__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "4bb76b33f45dccf8026bfd5b63c1f173", "score": "0.4838577", "text": "func (m *pyenv) GetRootModule(path string) (*models.Module, error) {\n\tif m.rootModule == nil {\n\t\tmodule := m.fetchRootModule()\n\t\tm.rootModule = &module\n\t}\n\treturn m.rootModule, nil\n}", "title": "" }, { "docid": "5864ebf6995ff37be7eea6ddaf56d7c7", "score": "0.4829972", "text": "func x31__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "b15aa837beaddc321994332c61f4e449", "score": "0.48265404", "text": "func x7__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "4a0e636f9de3bfa8d3a924deae9805e6", "score": "0.48210618", "text": "func (e Messages) GetModule(module string) error {\n\treturn e.Get(fmt.Sprintf(\"%s.label\", module))\n}", "title": "" }, { "docid": "32eb4924d4aa4609a5b071667b2257b4", "score": "0.48186553", "text": "func CurrentThreadID() uint {\n\tret, _, _ := threadID.Call()\n\treturn uint(ret)\n}", "title": "" }, { "docid": "ed8211720c1b2e9174ba01d28c14007d", "score": "0.48186198", "text": "func (r *Run) GetRunKey() string {\n\t// The address of the pointer is a threadsafe unique identifier for the taskrun\n\treturn fmt.Sprintf(\"%s/%p\", \"Run\", r)\n}", "title": "" }, { "docid": "1087008576172eb86ca5e29bca64077f", "score": "0.48114076", "text": "func ThreadKeyring() (Keyring, error) {\n\treturn newKeyring(keySpecThreadKeyring)\n}", "title": "" }, { "docid": "5b7a9ea2c0d8d947b1b12ceaae10da1c", "score": "0.4811253", "text": "func (o *PortMacBinding) GetModulePortId() int64 {\n\tif o == nil || o.ModulePortId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ModulePortId\n}", "title": "" }, { "docid": "82d26b4ce480d33894bd8c9c8aa461fc", "score": "0.4798441", "text": "func FindModuleInModule(a string, m StateModule) *StateModule {\n\tfor _, v := range m.ChildModules {\n\t\tif v.Address == a {\n\t\t\treturn &v\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e01eaac159a5501b552f66b188d92aba", "score": "0.47910216", "text": "func x32__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "9d5575376fb09aef587574476b01d4e6", "score": "0.4774876", "text": "func (o *PortMacBinding) GetModuleSlot() int64 {\n\tif o == nil || o.ModuleSlot == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ModuleSlot\n}", "title": "" }, { "docid": "c41bcde24c51e7b2f013dd77161b9bd2", "score": "0.47728163", "text": "func x9__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "20dcdc81730fbf3b2975cce0d84ff0c5", "score": "0.47573495", "text": "func (ty *ImportType) Module() string {\n\tptr := C.wasm_importtype_module(ty.ptr())\n\tret := C.GoStringN(ptr.data, C.int(ptr.size))\n\truntime.KeepAlive(ty)\n\treturn ret\n}", "title": "" }, { "docid": "3802a9f0e585a28573344432fbbe073f", "score": "0.47348145", "text": "func (win Win32) GetCurrentThread() HANDLE {\n\tret, _, _ := syscall.Syscall(win.getCurrentThread, 0,\n\t\t0,\n\t\t0,\n\t\t0)\n\n\treturn HANDLE(ret)\n}", "title": "" }, { "docid": "de8a00e98b14388032856c3d2ca6c21d", "score": "0.4732969", "text": "func x37__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "8e4fcc3cd31187224af0a7f0e5a80792", "score": "0.47189492", "text": "func XGetModuleHandleW(t *TLS, lpModuleName uintptr) uintptr {\n\tr0, _, err := syscall.Syscall(procGetModuleHandleW.Addr(), 1, lpModuleName, 0, 0)\n\tif r0 == 0 {\n\t\tt.setErrno(err)\n\t}\n\treturn r0\n}", "title": "" }, { "docid": "8fadc0167ae9bb25c83cda48df990dba", "score": "0.47137693", "text": "func x10__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "329db29e4ac8a271ddbd16ba2c9a9acd", "score": "0.47061127", "text": "func x34__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "c6c288feee98038a63958fbd74cf75a9", "score": "0.46998575", "text": "func x29__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "3be3d0eba383b0ead87904ac1d92f84b", "score": "0.46854734", "text": "func x21__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "a1ade2d99c039b6e60d09d064bd6e88e", "score": "0.46853223", "text": "func x28__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "1d9f75605c2d21fbe18ebe208ec199a9", "score": "0.46852705", "text": "func x22__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "442204cbff1496e748cd03c356c1bf06", "score": "0.46851653", "text": "func x__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "d93414cd317dcf7db027cbdce10212e5", "score": "0.4682729", "text": "func (win Win32) GetKeyboardLayout(idThread uint32) HKL {\n\tret, _, err := syscall.Syscall(win.getKeyboardLayout, 1,\n\t\tuintptr(idThread),\n\t\t0,\n\t\t0)\n\n\tif err != 0 {\n\t\tutil.Catch(fmt.Errorf(\"error: %d\", err))\n\t}\n\treturn HKL(ret)\n}", "title": "" }, { "docid": "901832d802941056ad5155a672a4e2a5", "score": "0.4680878", "text": "func (c *ThreadCache) GetThread(threadKey model.ThreadKey) (*model.Thread, error) {\n\tcachedData, err := c.rc.get(redThreadKey, string(threadKey))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tthreadCache := &model.Thread{}\n\tjson.Unmarshal([]byte(cachedData), threadCache)\n\n\treturn threadCache, nil\n}", "title": "" }, { "docid": "e44c93fbb5f624fd8120f898655f8784", "score": "0.46778226", "text": "func x24__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "531c378cd12407d3368789c32db9f2f5", "score": "0.46778116", "text": "func x30__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "f670d338af466c16d3873ad8e616f361", "score": "0.46661088", "text": "func x46__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "5e1204d0baf22fdf757afb1d0d1ceac5", "score": "0.46574467", "text": "func x25__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "8cc74775917b3b4b25a85bad47675b79", "score": "0.4652329", "text": "func x2__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "76dd72105dd396a6919e21ffa75684d9", "score": "0.46460018", "text": "func getModuleName(m Module) string {\n n := reflect.ValueOf(m).Elem().String() // n = \"<simgo.MonitorModule Value>\"\n n = strings.Trim(n, \"><\") // n = \"simgo.MonitorModule Value\"\n n = strings.Split(n, \" \")[0] // n = \"simgo.MonitorModule\"\n return n\n}", "title": "" }, { "docid": "55fb5eff2a20ecbd82cd143c4ce738c4", "score": "0.4643922", "text": "func x16__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "bc915d1eb25638071829331e8ca1fd66", "score": "0.46420732", "text": "func x6__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "d80e685c63cec4217e25a399cc8c0eec", "score": "0.46318188", "text": "func x4__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "30dfa7b47e9b0d6588e017574354d9bc", "score": "0.46289703", "text": "func x3__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "95297424e103f9410979efe3bdd5a46c", "score": "0.4627309", "text": "func x40__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "646f20b2ac88bd27b93ef4060679c07a", "score": "0.46270272", "text": "func x8__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "0af270c6dc405e0463b84efd47c757ce", "score": "0.46268234", "text": "func x35__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "69d23c2d2262687405dd6dce5b6ab7fe", "score": "0.4613842", "text": "func x23__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "c676b5f206022906eddf958c758001c5", "score": "0.46111977", "text": "func (o *EquipmentExpanderModule) GetModuleId() int64 {\n\tif o == nil || o.ModuleId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ModuleId\n}", "title": "" }, { "docid": "72f017c11b16e29b6ab1009ce2f0fd27", "score": "0.46077266", "text": "func x39__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "4c6d4dfe7064fb99c7d729685d906646", "score": "0.46022135", "text": "func x47__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "b372520468239afce37c548a380c91c8", "score": "0.45956153", "text": "func x15__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "2042942ca932b4f4ff82db6afedde5c9", "score": "0.45926946", "text": "func x1__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "4f3713ff5a12c7e4ca22e4d40ca8ee42", "score": "0.4585797", "text": "func x19__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "78575751b735b8e392cd0029957602fe", "score": "0.45748743", "text": "func x20__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "a8e54d994ead7125557abf883bb55a40", "score": "0.4564161", "text": "func (c *ConnectorBase) GetModule() ConnectorModule {\n\treturn c.Module\n}", "title": "" }, { "docid": "22e0b316be439cc15a4da0adfb300196", "score": "0.45628327", "text": "func x49__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "c057bf41b1ce23de33f17c0e571c7a42", "score": "0.45571408", "text": "func (s *InmemStorage) GetModule(ctx context.Context, namespace, name, provider, version string) (Module, error) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\tmodule, ok := s.modules[s.moduleID(namespace, name, provider, version)]\n\tif !ok {\n\t\treturn Module{}, errors.Wrap(ErrNotFound, \"id\")\n\t}\n\n\treturn module, nil\n}", "title": "" }, { "docid": "2fad0fc6867efc206590ccb253b105ae", "score": "0.45527872", "text": "func (ms *Modules) GetModule(name string) (*Entry, []error) {\n\tif ms.Modules[name] == nil {\n\t\tif err := ms.Read(name); err != nil {\n\t\t\treturn nil, []error{err}\n\t\t}\n\t\tif ms.Modules[name] == nil {\n\t\t\treturn nil, []error{fmt.Errorf(\"module not found: %s\", name)}\n\t\t}\n\t}\n\t// Make sure that the modules have all been processed and have no\n\t// errors.\n\tif errs := ms.Process(); len(errs) != 0 {\n\t\treturn nil, errs\n\t}\n\treturn ToEntry(ms.Modules[name]), nil\n}", "title": "" }, { "docid": "ee0dc4b77137712e35726cfe6b35b640", "score": "0.45395055", "text": "func x13__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "c44045347f65de676594b27def72a139", "score": "0.45348087", "text": "func XGetExitCodeThread(t *TLS, hThread, lpExitCode uintptr) int32 {\n\tr0, _, _ := syscall.Syscall(procGetExitCodeThread.Addr(), 2, hThread, lpExitCode, 0)\n\treturn int32(r0)\n}", "title": "" }, { "docid": "e69902371d8e63611c0e76855b0f4988", "score": "0.4533607", "text": "func (s *MasterServerBase) GetModule(m interface{}) interface{} {\n\tret := s.GameServer.GetModule(m)\n\tif ret != nil {\n\t\treturn ret\n\t}\n\tswitch m.(type) {\n\tcase map[uuid.UUID]*sysinfo.SubServerInfo:\n\t\treturn s.SubServers\n\tcase map[uuid.UUID]*sysinfo.PlayerInfo:\n\t\treturn s.Players\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f00c64dfd1c1c438a66958399ef5e461", "score": "0.4529485", "text": "func x38__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "7e96d60d57e601aa4ce8f168e2c68642", "score": "0.45266488", "text": "func x48__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "45b97578085573b48e1d4e74e95f1823", "score": "0.4526185", "text": "func gpidToThreadHash(gpid *base.Gpid) int32 {\n\treturn gpid.Appid*7919 + gpid.PartitionIndex\n}", "title": "" }, { "docid": "884cc45cc535969948cb83c5cb95d673", "score": "0.45134306", "text": "func x14__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "a0d8072593ca6bc4e6b321e528e9d510", "score": "0.45113194", "text": "func (o *PkgTreeItemRepositories) GetModuleName() string {\n\tif o == nil || o.ModuleName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ModuleName\n}", "title": "" }, { "docid": "ab49d8339c6a22ff70b7da9c7bcffee9", "score": "0.45053172", "text": "func x50__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "32e95d48485c6b330178ea86c433f00b", "score": "0.45017034", "text": "func x42__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "352620906f37d9cf29618a032b2585ea", "score": "0.45003527", "text": "func x17__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "fc898d2313659803ada5a5019fd76c24", "score": "0.4500154", "text": "func (f *Function) GetModule() *Module {\n\treturn NewModule(f.ptr.module)\n}", "title": "" }, { "docid": "dcc33d7eaafee6128d759c04a46407bf", "score": "0.45001292", "text": "func x12__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "1f0c97105a093a175a1aea0dc1dd3565", "score": "0.4498667", "text": "func x33__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "2dd8a5502182f9ffaebcde23fb64ed77", "score": "0.4497097", "text": "func x18__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "d0986eea2e3e249c0d29d49c7991f2b7", "score": "0.44536576", "text": "func (t *Target) ModuleAddr() ModuleInstance {\n\tswitch addr := t.Subject.(type) {\n\tcase ModuleInstance:\n\t\treturn addr\n\tcase Module:\n\t\t// We assume that a module address is really\n\t\t// referring to a module path containing only\n\t\t// single-instance modules.\n\t\treturn addr.UnkeyedInstanceShim()\n\tcase AbsResourceInstance:\n\t\treturn addr.Module\n\tcase AbsResource:\n\t\treturn addr.Module\n\tdefault:\n\t\t// The above cases should be exhaustive for all\n\t\t// implementations of Targetable.\n\t\tpanic(fmt.Sprintf(\"unsupported target address type %T\", addr))\n\t}\n}", "title": "" }, { "docid": "ef6f41588556bb61b59de8047e551864", "score": "0.44514406", "text": "func GetFromThread(pid, tid int) (NsHandle, error) {\n\treturn vnetns.GetFromThread(pid, tid)\n}", "title": "" }, { "docid": "0345546069f4089f4fd92bd593bba8d7", "score": "0.4439783", "text": "func (o *PortMacBinding) GetModuleMode() int64 {\n\tif o == nil || o.ModuleMode == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ModuleMode\n}", "title": "" }, { "docid": "f98590f3cff0684e623063391be76dad", "score": "0.44332147", "text": "func Xpthread_getschedparam(tls TLS, _t uintptr /* Tpthread_t = *S__pthread */, _policy uintptr /* *int32 */, _param uintptr /* *Ssched_param */) (r int32) {\n\tvar _r int32\n\n\tX__lock(tls, _t+200)\n\tif !(*(*int32)(unsafe.Pointer(_t + 56)) == 0) {\n\t\tgoto _1\n\t}\n\n\t_r = int32(3)\n\tgoto _2\n\n_1:\n\t_r = int32(-x50__syscall2(tls, int64(143), int64(*(*int32)(unsafe.Pointer(_t + 56))), int64(_param)))\n\tif !(_r == 0) {\n\t\tgoto _3\n\t}\n\n\t*(*int32)(unsafe.Pointer(_policy)) = int32(x41__syscall1(tls, int64(145), int64(*(*int32)(unsafe.Pointer(_t + 56)))))\n_3:\n_2:\n\tX__unlock(tls, _t+200)\n\treturn _r\n}", "title": "" }, { "docid": "8119b15546b2178c15ac517b705c4446", "score": "0.44222653", "text": "func (cc *concurrentCache) GetToken(ctx context.Context, registry string, scheme Scheme, key string) (string, error) {\n\tentryValue, ok := cc.cache.Load(registry)\n\tif !ok {\n\t\treturn \"\", errdef.ErrNotFound\n\t}\n\tentry := entryValue.(*cacheEntry)\n\tif entry.scheme != scheme {\n\t\treturn \"\", errdef.ErrNotFound\n\t}\n\tif token, ok := entry.tokens.Load(key); ok {\n\t\treturn token.(string), nil\n\t}\n\treturn \"\", errdef.ErrNotFound\n}", "title": "" }, { "docid": "7b62c056d4c053abbb9d2fdd6cef939e", "score": "0.44144303", "text": "func x__pthread_self_internal(tls TLS) (r uintptr /* Tpthread_t = *S__pthread */) {\n\treturn x43__pthread_self(tls)\n}", "title": "" }, { "docid": "149140d4e9d86ce494a6f542b7af0331", "score": "0.4409695", "text": "func (_Ibchost *IbchostCallerSession) GetModuleOwner(name []byte) (common.Address, bool, error) {\n\treturn _Ibchost.Contract.GetModuleOwner(&_Ibchost.CallOpts, name)\n}", "title": "" }, { "docid": "6469d8f8827bcb691e46acd29a5977a8", "score": "0.4401177", "text": "func (k Keeper) GetModuleAddress(moduleName string) sdk.AccAddress {\n\treturn nil\n}", "title": "" }, { "docid": "192dcbe0a15ab9c05db6b0de5f3b9553", "score": "0.4399944", "text": "func x43__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "5aefe80ee10f1cafd5bfa050e9f325fd", "score": "0.4399798", "text": "func GetModule(name string) (Module, error) {\n\tdriver := GetDriver()\n\tif driver == nil {\n\t\treturn nil, errors.New(\"GetModule: Driver is not set\")\n\t}\n\n\tmodules := driver.GetModules()\n\treturn modules[name], nil\n}", "title": "" }, { "docid": "25273ab5d77c1dcd88938d9c79dc2df0", "score": "0.43989286", "text": "func (o *PortMacBinding) GetModuleSide() int64 {\n\tif o == nil || o.ModuleSide == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.ModuleSide\n}", "title": "" }, { "docid": "bb4ca44bb44c4673f5d390c0f4e814b2", "score": "0.43881685", "text": "func (_Ibchost *IbchostCaller) GetModuleOwner(opts *bind.CallOpts, name []byte) (common.Address, bool, error) {\n\tvar out []interface{}\n\terr := _Ibchost.contract.Call(opts, &out, \"getModuleOwner\", name)\n\n\tif err != nil {\n\t\treturn *new(common.Address), *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\tout1 := *abi.ConvertType(out[1], new(bool)).(*bool)\n\n\treturn out0, out1, err\n\n}", "title": "" }, { "docid": "70906db090295c390156e26c24e72c66", "score": "0.4387547", "text": "func x5__pthread_self(tls TLS) (r uintptr /* *S__pthread */) {\n\treturn uintptr(tls)\n\treturn r\n}", "title": "" }, { "docid": "f596b4752b99bfcb80a0dfadd3683013", "score": "0.43805647", "text": "func (ms *Modules) FindModule(n Node) *Module {\n\tname := n.NName()\n\trev := name\n\tvar m map[string]*Module\n\n\tswitch i := n.(type) {\n\tcase *Include:\n\t\tm = ms.SubModules\n\t\tif i.RevisionDate != nil {\n\t\t\trev = name + \"@\" + i.RevisionDate.Name\n\t\t}\n\t\t// TODO(borman): we should check the BelongsTo field below?\n\tcase *Import:\n\t\tm = ms.Modules\n\t\tif i.RevisionDate != nil {\n\t\t\trev = name + \"@\" + i.RevisionDate.Name\n\t\t}\n\tdefault:\n\t\treturn nil\n\t}\n\tif n := m[rev]; n != nil {\n\t\treturn n\n\t}\n\tif n := m[name]; n != nil {\n\t\treturn n\n\t}\n\n\t// Try to read first a module by revision\n\tif err := ms.Read(rev); err != nil {\n\t\t// if failed, try to read a module by its bare name\n\t\tif err := ms.Read(name); err != nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif n := m[rev]; n != nil {\n\t\treturn n\n\t}\n\treturn m[name]\n}", "title": "" }, { "docid": "8908c5637706d3329759020add1c514b", "score": "0.4373872", "text": "func modKey(mod *Module) string {\n\tif mod == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s@%s\", mod.Path, mod.Version)\n}", "title": "" }, { "docid": "a543036c3db10d8a51ee50d441a0b250", "score": "0.4365296", "text": "func (c *ConnectorBase) GetModuleName() string {\n\treturn c.ModuleName\n}", "title": "" }, { "docid": "aaeda6d3a8d119e80963f64420fbb85b", "score": "0.4364252", "text": "func moduleHash(modroot string, ismodcache bool) (cache.ActionID, error) {\n\t// We expect modules stored within the module cache to be checksummed and\n\t// immutable, and we expect released modules within GOROOT to change only\n\t// infrequently (when the Go version changes).\n\tif !ismodcache {\n\t\t// The contents of this module may change over time. We don't want to pay\n\t\t// the cost to detect changes and re-index whenever they occur, so just\n\t\t// don't index it at all.\n\t\t//\n\t\t// Note that this is true even for modules in GOROOT/src: non-release builds\n\t\t// of the Go toolchain may have arbitrary development changes on top of the\n\t\t// commit reported by runtime.Version, or could be completely artificial due\n\t\t// to lacking a `git` binary (like \"devel gomote.XXXXX\", as synthesized by\n\t\t// \"gomote push\" as of 2022-06-15). (Release builds shouldn't have\n\t\t// modifications, but we don't want to use a behavior for releases that we\n\t\t// haven't tested during development.)\n\t\treturn cache.ActionID{}, ErrNotIndexed\n\t}\n\n\th := cache.NewHash(\"moduleIndex\")\n\t// TODO(bcmills): Since modules in the index are checksummed, we could\n\t// probably improve the cache hit rate by keying off of the module\n\t// path@version (perhaps including the checksum?) instead of the module root\n\t// directory.\n\tfmt.Fprintf(h, \"module index %s %s %v\\n\", runtime.Version(), indexVersion, modroot)\n\treturn h.Sum(), nil\n}", "title": "" } ]
be5eca59da7086ab903b34a6daee02c9
ItemGetByID Gets item by Id only if there is exactly 1 matching host.
[ { "docid": "63772fb26a29348005b725afb789e304", "score": "0.6828331", "text": "func (api *API) ItemGetByID(id string) (res *Item, err error) {\n\titems, err := api.ItemsGet(Params{\"itemids\": id})\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif len(items) != 1 {\n\t\te := ExpectedOneResult(len(items))\n\t\terr = &e\n\t\treturn\n\t}\n\tres = &items[0]\n\treturn\n}", "title": "" } ]
[ { "docid": "f896616fce8d5627425dd9b9629ab251", "score": "0.7004873", "text": "func GetItemByID(id uint) (*Item, bool) {\n\titem := &Item{}\n\terr := GetDB().Table(\"Items\").Where(\"ID = ?\", id).First(item).Error\n\tif err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn nil, true\n\t\t}\n\t\treturn nil, false\n\t}\n\treturn item, true\n}", "title": "" }, { "docid": "ca04b2e72705abb1bd21d7b799bc39d3", "score": "0.66833335", "text": "func (h *HostResource) GetById(id string) (*Host, error) {\n\thosts, err := h.GetBy(\"id\", id)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\tif len(hosts) > 0 {\n\t\thost := hosts[0]\n\t\treturn host, nil\n\t}\n\n\treturn nil, errors.New(\"Resource doesn't exist\")\n}", "title": "" }, { "docid": "dcff321d37d04a887df63bee3d171d41", "score": "0.65355825", "text": "func (s *Stack) getItemByID(id uint64) (*Item, error) {\n\t// Check if empty or out of bounds.\n\tif s.Length() == 0 {\n\t\treturn nil, ErrEmpty\n\t} else if id <= s.tail || id > s.head {\n\t\treturn nil, ErrOutOfBounds\n\t}\n\n\t// Get item from database.\n\tvar err error\n\titem := &Item{ID: id, Key: idToKey(id)}\n\tif item.Value, err = s.db.Get(item.Key, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn item, nil\n}", "title": "" }, { "docid": "99e1ea2567e00394053d97f9c7dca401", "score": "0.6531423", "text": "func (c *Client) GetHostByID(symID string, hostID string) (*types.Host, error) {\n\tdefer c.TimeSpent(\"GetHostByID\", time.Now())\n\tif _, err := c.IsAllowedArray(symID); err != nil {\n\t\treturn nil, err\n\t}\n\tURL := c.urlPrefix() + SLOProvisioningX + SymmetrixX + symID + XHost + \"/\" + hostID\n\thost := &types.Host{}\n\tctx, cancel := GetTimeoutContext()\n\tdefer cancel()\n\terr := c.api.Get(ctx, URL, c.getDefaultHeaders(), host)\n\tif err != nil {\n\t\tlog.Error(\"GetHostByID failed: \" + err.Error())\n\t\treturn nil, err\n\t}\n\treturn host, nil\n}", "title": "" }, { "docid": "09d4fd58bf6245367acbe7b5e5a6861a", "score": "0.64547426", "text": "func (h *Host) GetByID(tx *sqlx.Tx, id int64) (*HostRow, error) {\n\thostRow := &HostRow{}\n\tquery := fmt.Sprintf(\"SELECT * FROM %v WHERE id=$1\", h.table)\n\terr := h.db.Get(hostRow, query, id)\n\n\treturn hostRow, err\n}", "title": "" }, { "docid": "c759d61847dc4ec4aba3a3af4e707b58", "score": "0.64417994", "text": "func ItemByID(db XODB, id int) (*Item, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, name, notes, cost_per_kilogram, fats_per_kilogram, carbs_per_kilogram, protein_per_kilogram ` +\n\t\t`FROM public.items ` +\n\t\t`WHERE id = $1`\n\n\t// run query\n\tXOLog(sqlstr, id)\n\ti := Item{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlstr, id).Scan(&i.ID, &i.Name, &i.Notes, &i.CostPerKilogram, &i.FatsPerKilogram, &i.CarbsPerKilogram, &i.ProteinPerKilogram)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &i, nil\n}", "title": "" }, { "docid": "a0f7c06c0eb05e14578a553bb191892c", "score": "0.63252586", "text": "func (c *Connection) GetItem(id int64) (models.Item, error) {\n\tvar item models.Item\n\t//create query for select\n\tsqlStatement := `SELECT * FROM items WHERE id=$1`\n\t//execute sql statement\n\trow := c.Pool.QueryRow(context.Background(), sqlStatement, id)\n\terr := row.Scan(&item.ID, &item.Description, &item.Status)\n\treturn item, err\n}", "title": "" }, { "docid": "358447999b718e8f6bdf35508c22c9a6", "score": "0.6305856", "text": "func (c *Client) GetItem(id int) Result {\n\tvar item Item\n\tdefer func(item Item, id int) { item.ID = id }(item, id)\n\tresp, err := http.Get(fmt.Sprintf(\"%s/item/%d.json\", apiBase, id))\n\tif err != nil {\n\t\treturn Result{item, err}\n\t}\n\tdefer resp.Body.Close()\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&item)\n\tif err != nil {\n\t\treturn Result{item, err}\n\t}\n\treturn Result{item, err}\n}", "title": "" }, { "docid": "7ea323cf0c5cb65b422bed1d8ffacb35", "score": "0.62285584", "text": "func (is Items) FindByID(id string) (Item, bool) {\n\treturn is.Find(ItemIDEquals(id))\n}", "title": "" }, { "docid": "657ef761be5443b08a2649aee4c0c78b", "score": "0.61986005", "text": "func getItem(id string) (item, error) {\n\tvar i item\n\terr := db.GetConn().Get(&i, \"SELECT * FROM item WHERE id = $1\", id)\n\tif err != nil {\n\t\t// return custom error when item is not found by id\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn item{}, errItemNotFound\n\t\t}\n\t\t// propagate error in other cases\n\t\treturn item{}, err\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "4113d5a6e3f0c04d6d7dfa58ac128f6f", "score": "0.6191885", "text": "func (gi *Product) GetByID(db *pg.DB) (Product, error) {\r\n\tlog.Printf(\">===>productItem.GetByID(ID=%d)\", gi.ID)\r\n\r\n\tgetErr := db.Model(gi).Where(\"id = ?0\", gi.ID).Select()\r\n\tif getErr != nil {\r\n\t\tlog.Printf(\"Error while selecting item, Reason %v\\n\", getErr)\r\n\t\treturn *gi, getErr\r\n\t}\r\n\tlog.Printf(\"Select by ID successful in productItem.GetById()\\n\")\r\n\tlog.Printf(\"product=%v\\n\", *gi)\r\n\treturn *gi, nil\r\n}", "title": "" }, { "docid": "8555e8e2b7382bc2543140a028976992", "score": "0.6163632", "text": "func (c *Client) GetItem(id string) (Item, error) {\n\titems, err := c.GetItems()\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\tfor _, item := range items {\n\t\tif item.ID == id {\n\t\t\treturn item, nil\n\t\t}\n\t}\n\treturn Item{}, api.ErrNotFound\n}", "title": "" }, { "docid": "0c6824f04c59dbf183c29b468afffd90", "score": "0.6145787", "text": "func (itemService *Service) FindItemByID(id int) (*domain.Item, error) {\n\treturn itemService.repository.GetByID(id)\n}", "title": "" }, { "docid": "5d1d622452b8609df59edb60d81a7688", "score": "0.61423385", "text": "func (r *Item) FindByID(id string) (*model.Item, error) {\n\trow := r.db.QueryRow(\"SELECT * FROM items WHERE id=?\", id)\n\tif row == nil {\n\t\treturn nil, errors.New(\"data not found\")\n\t}\n\tif row.Err() != nil {\n\t\treturn nil, row.Err()\n\t}\n\titem := model.Item{}\n\tif err := row.Scan(&item.ID, &item.Name); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &item, nil\n}", "title": "" }, { "docid": "870e6ca16cc1ff9b992688e55360c942", "score": "0.6140284", "text": "func (mw loggingMiddleware) GetItemById(id int) (output domain.Item, err *domain.ErrHandler) {\n defer func(begin time.Time) {\n mw.logger.Log(\n \"object\", \"item\",\n \"action\", \"get\",\n \"type\", \"id\",\n \"id\", id,\n \"result\", output,\n \"took\", time.Since(begin),\n )\n }(time.Now())\n output, err = mw.InventoryHandler.GetItemById(id)\n return output, err\n}", "title": "" }, { "docid": "136c6c7b78a57b264daac3e1ae894915", "score": "0.610507", "text": "func (i *Repository) GetItemByID(ids string) ([]models.Item, error) {\n\n\tresponse, err := i.client.Get(i.host + itemURL + \"?ids=\" + ids + \"&attributes=id,price\")\n\tif err != nil {\n\t\treturn []models.Item{}, err\n\t}\n\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\tbodyErr, err := ioutil.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\treturn []models.Item{}, errors.New(string(bodyErr))\n\t\t}\n\t}\n\n\tvar bodyItems []BodyItem\n\tbyteValue, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn []models.Item{}, err\n\t}\n\n\terr = json.Unmarshal(byteValue, &bodyItems)\n\tif err != nil {\n\t\treturn []models.Item{}, err\n\t}\n\n\tvar items []models.Item\n\tfor _, itemRes := range bodyItems {\n\t\titem := models.Item{\n\t\t\tID: itemRes.Body.ID,\n\t\t\tPrice: itemRes.Body.Price,\n\t\t}\n\t\titems = append(items, item)\n\t}\n\treturn items, nil\n}", "title": "" }, { "docid": "653da91b9ed5a2e90fd23def18b8adfe", "score": "0.60409784", "text": "func GetByID(domain string, id int, getContent bool) Info {\n\treturn find(domain, id, \"-\", getContent)\n}", "title": "" }, { "docid": "6614fb7d64833accafd035baaabc3dec", "score": "0.60007524", "text": "func (s *Service) GetByID(id string) (ContentResult, error) {\n\tdb := database.GetDB()\n\tvar contentResult ContentResult\n\tvar content Content\n\tvar foodType entity.FoodType\n\tvar foodGenre entity.FoodGenre\n\n\tif err := db.Where(\"id=?\", id).First(&content).Error; err != nil {\n\t\treturn contentResult, err\n\t}\n\tif err := db.Where(\"id=?\", content.FoodTypeID).First(&foodType).Error; err != nil {\n\t\treturn contentResult, err\n\t}\n\tif err := db.Where(\"id=?\", foodType.GenreID).First(&foodGenre).Error; err != nil {\n\t\treturn contentResult, err\n\t}\n\tcontentResult = ContentResult{\n\t\tID: content.ID,\n\t\tName: foodType.Name,\n\t\tExpirationDate: content.ExpirationDate.Format(\"2006/01/02\"),\n\t\tQuantity: content.Quantity,\n\t\tImage: foodType.Image,\n\t\tGenre: foodGenre,\n\t}\n\n\treturn contentResult, nil\n}", "title": "" }, { "docid": "0cb8a05c325b6e8dbe9574a5437e962d", "score": "0.5971503", "text": "func (t *Table) LookupByID(id string) *Host {\n\n\thost := lookup(t.id, func(h *Host) bool {\n\t\treturn h.ID >= id\n\t})\n\n\tif host == nil {\n\t\treturn nil\n\t}\n\n\t// Allow short ID\n\tif len(id) >= 8 && strings.HasPrefix(host.ID, id) {\n\t\tid = host.ID\n\t}\n\n\tif host.ID != id {\n\t\treturn nil\n\t}\n\n\treturn host\n}", "title": "" }, { "docid": "5eb2eb3cb039af7910504915bece6f90", "score": "0.5963729", "text": "func (s *SqliteStorage) GetByID(id int) (*lifting.Repetition, error) {\n\treps, err := s.getCollection(getByID, id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(reps) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(reps) > 1 {\n\t\treturn nil, fmt.Errorf(\"Multiple return values for SqliteStorage#GetByID, %v\", reps)\n\t}\n\n\treturn &reps[0], nil\n}", "title": "" }, { "docid": "ee3c5e7f0b5f761c763918b347a21097", "score": "0.59601843", "text": "func (s *inmemService) GetByID(ctx context.Context, id string) (Greeting, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif greeting, ok := s.m[id]; ok {\n\t\treturn greeting, nil\n\t}\n\n\treturn Greeting{}, ErrNotFound\n}", "title": "" }, { "docid": "1c6c59d87c12918603ab5ac55e2fb0b8", "score": "0.59127945", "text": "func (s *DbStore) Get(id uint) (*Item, error) {\n\tvar item Item\n\terr := s.db.QueryRow(\"SELECT * FROM items WHERE id = ?\", id).Scan(&item.ID, &item.Type, &item.ShowID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"query to get item with id %d failed: %w\", id, err)\n\t}\n\n\treturn &item, nil\n}", "title": "" }, { "docid": "f16d76ce3dbc1693081e503efc811820", "score": "0.5909767", "text": "func QueryByID(id string, unix int64, resolve QueryResolve, reject QueryReject) Query {\n\treturn queryFunc(func(db *DB) {\n\t\ti, ok := db.items[id]\n\t\tif ok && i.unix >= unix {\n\t\t\tresolve(i.Item)\n\t\t} else {\n\t\t\treject(ErrItemNotFound)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "f4afae7a75fc4bbc5be6183430a35673", "score": "0.5885432", "text": "func (sp *serviceProvider) GetByID(conn orm.Connection, id uint32) (*Ware, error) {\n\tware := &Ware{}\n\tdb := conn.(*gorm.DB).Exec(\"USE shop\")\n\terr := db.Table(\"ware\").Where(\"id = ?\", id).First(ware).Error\n\n\treturn ware, err\n}", "title": "" }, { "docid": "d46ddf9d90da66f1a71b476ddc31c701", "score": "0.58081037", "text": "func (b *Binary) GetByID(id int64) (bool, error) {\r\n\treturn isFound(DBConn.Where(\"id=?\", id).First(b))\r\n}", "title": "" }, { "docid": "1bfbbef33e6c4a4c1207532dc6d5c4b7", "score": "0.5801569", "text": "func (s *Store) GetByID(id string, ifname string) []net.IP {\n\tvar ips []net.IP\n\n\tmatch := strings.TrimSpace(id) + LineBreak + ifname\n\t// matchOld for backwards compatibility\n\tmatchOld := strings.TrimSpace(id)\n\n\t// walk through all ips in this network to get the ones which belong to a specific ID\n\t_ = filepath.Walk(s.dataDir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil || info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tdata, err := os.ReadFile(path)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\tif strings.TrimSpace(string(data)) == match || strings.TrimSpace(string(data)) == matchOld {\n\t\t\t_, ipString := filepath.Split(path)\n\t\t\tif ip := net.ParseIP(ipString); ip != nil {\n\t\t\t\tips = append(ips, ip)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn ips\n}", "title": "" }, { "docid": "5f81bfbc4afe9b1c8178041a69537de3", "score": "0.5771429", "text": "func (m *postgresDBRepo) GetHostById(id int) (models.Host, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\tstmt := `SELECT id, host_name, canonical_name, url, ip, ipv6, location, os, active,\n\t\t\tcreated_at, updated_at\n\t\t\tFROM hosts where id = $1`\n\trow := m.DB.QueryRowContext(ctx, stmt, id)\n\n\tvar h models.Host\n\n\terr := row.Scan(\n\t\t&h.ID,\n\t\t&h.HostName,\n\t\t&h.CanonicalName,\n\t\t&h.URL,\n\t\t&h.IP,\n\t\t&h.IPV6,\n\t\t&h.Location,\n\t\t&h.OS,\n\t\t&h.Active,\n\t\t&h.CreatedAt,\n\t\t&h.UpdatedAt,\n\t)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn h, err\n\t}\n\n\thostServices, err := m.getAllHostServicesForHost(ctx, h.ID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn h, err\n\t}\n\th.HostServices = hostServices\n\n\treturn h, nil\n}", "title": "" }, { "docid": "224d1b896152c58413a5dda99c629b92", "score": "0.5769342", "text": "func (s *Service) GetByID(id uint) (*domain.Appeal, error) {\n\tif id == 0 {\n\t\treturn nil, ErrAppealIDEmptyParam\n\t}\n\n\treturn s.repo.GetByID(id)\n}", "title": "" }, { "docid": "cbfea64e6887e9b8805308269d521659", "score": "0.575407", "text": "func GetItem(id int) (*Item, error) {\n\ti := Item{}\n\tbody, err := jsonBytes(fmt.Sprintf(\"%s/item/%d.json\", rootUrl, id))\n\tif err != nil {\n\t\treturn &i, err\n\t}\n\terr = json.Unmarshal(body, &i)\n\tif err != nil {\n\t\treturn &i, err\n\t}\n\treturn &i, nil\n}", "title": "" }, { "docid": "cdf8b8354327946b2b5de99a225e7712", "score": "0.5731747", "text": "func (db *Db) GetByID(strId, table string) (data map[string]interface{}, err error) {\n\tid, err := strconv.Atoi(strId)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"Invalid ID\")\n\t\treturn\n\t}\n\tquery := idQuery{Id: id}\n\tobjs, err := db.Get(query, \"\", table)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"Search error\")\n\t\treturn\n\t} else if objs == nil {\n\t\terr = errors.New(\"Failed to find object\")\n\t\treturn\n\t} else if len(objs) != 1 {\n\t\terr = errors.New(\"Found duplicate objects\")\n\t\treturn\n\t}\n\tdata = objs[0]\n\treturn\n}", "title": "" }, { "docid": "2f56ce6ae64e238de21a6dac222f4e13", "score": "0.5702511", "text": "func (s *TaskDAOPostgres) GetByID(ID string) (model.Task, error) {\n\n\t// TODO check ID is a valid UUID return ErrInvalidUUID if necessary\n\n\t// TODO use Query method to request the task with the given ID\n\n\t// TODO if result is OK, map the row to a Task object using the mapRows function\n\n\t// TODO if results length is 0, return a ErrNotFound\n\n\t// TODO if result length is > 0, return a new error \"too many results for UUID + ID\"\n\n\t// TODO finally if ok return the only result\n\n\treturn model.Task{}, nil\n}", "title": "" }, { "docid": "1f166b5dd684dc9e1c38e3c26299792a", "score": "0.5697877", "text": "func (tm *BasicTaskManager) GetByID(taskID common.TaskID) (common.Task, error) {\n\t_, ok := tm.taskMap[taskID]\n\tif !ok {\n\t\tfor _, i := range tm.taskList {\n\t\t\tif i.GetTaskID() == taskID {\n\t\t\t\tpanic(\"Task List Out of Sync\")\n\t\t\t}\n\t\t}\n\t}\n\treturn tm.taskMap[taskID], nil\n\n}", "title": "" }, { "docid": "f9e113cd67a17ca305cb045982b1655b", "score": "0.5691103", "text": "func (host *HostHandler) ListByID(request *restful.Request, response *restful.Response) {\n\tstarted := time.Now()\n\t//list host by host ip\n\tip := request.PathParameter(\"host\")\n\tnetRes := &types.NetResponse{\n\t\tType: types.ResponseType_HOST,\n\t}\n\thostInfo, err := host.netSvr.ListHostByKey(ip)\n\tif err != nil {\n\t\tblog.Errorf(\"HostHandler list host %s request err: %s\", ip, err.Error())\n\t\tnetRes.Code = 1\n\t\tnetRes.Message = err.Error()\n\t\tresponse.WriteEntity(netRes)\n\t\treportMetrics(\"listHostInfoFromIPPool\", \"5xx\", started)\n\t\treturn\n\t}\n\tnetRes.Code = 0\n\tnetRes.Message = SUCCESS\n\tnetRes.Host = append(netRes.Host, hostInfo)\n\tnetRes.Data = netRes.Host\n\tblog.Infof(\"Hosthandler client %s Get host %s success\", request.Request.RemoteAddr, ip)\n\tif err := response.WriteEntity(netRes); err != nil {\n\t\tblog.Errorf(\"HostHandler reply client GET/%s request Err: %v\", ip, err)\n\t}\n\treportMetrics(\"listHostInfoFromIPPool\", \"2xx\", started)\n}", "title": "" }, { "docid": "e61f41409549c65c3a0b6579e17fa51b", "score": "0.56703836", "text": "func (iinf *IinfBox) GetItemWithId(itemId uint32) (infe *InfeBox, err error) {\n\tinfe, found := iinf.itemsById[itemId]\n\tif found == false {\n\t\treturn nil, ErrNoItemsFound\n\t}\n\n\treturn infe, nil\n}", "title": "" }, { "docid": "6fd53df52ee34111d58d57555eacc974", "score": "0.5650827", "text": "func (r *repository) GetByID(foodID int) (Food, error) {\n\tfood := Food{}\n\n\terr := r.db.Where(\"id = ?\", foodID).Find(&food).Error\n\n\tif err != nil {\n\t\treturn food, err\n\t}\n\n\treturn food, nil\n}", "title": "" }, { "docid": "c82c6bcf07c44e1e26ae0774ce31938f", "score": "0.564022", "text": "func (collection Collection) GetItem(id string) (item Item, err error) {\n\titem, found := collection.Items.Find(id)\n\tif found {\n\t\treturn item, nil\n\t}\n\treturn Item{}, sdkerrors.Wrap(ErrUnknownItem,\n\t\tfmt.Sprintf(\"Item #%s doesn't exist in collection %s\", id, collection.Denom),\n\t)\n}", "title": "" }, { "docid": "0f39e747982d02452f4209001d6ad873", "score": "0.5637494", "text": "func (factory DataFactory) GetItem(id string) (interfaces.Item, error) {\n\titem, ok := factory.ItemsMap[id]\n\tif !ok {\n\t\treturn item, fmt.Errorf(\"Item with id %v not found\", id)\n\t}\n\treturn item, nil\n}", "title": "" }, { "docid": "ad2cb331b1cbbbfb8dc304e02b1c02f9", "score": "0.5622642", "text": "func (s BrandStorage) GetByID(ormer orm.Ormer, id int64) (result models.Brand, err error) {\n\terr = ormer.QueryTable(new(models.Brand)).Filter(\"id\", id).RelatedSel().One(&result)\n\treturn\n}", "title": "" }, { "docid": "9f98ad11530281542fe700bab4588611", "score": "0.55969363", "text": "func (h handler) item(r *http.Request) (data interface{}, status int) {\n\tparams := mux.Vars(r)\n\tid := strings.TrimSpace(params[\"id\"])\n\tvar resp itemResponse\n\tvar errMsg string\n\n\t// routing should prevent this, but might as well guard it\n\tif id == \"\" {\n\t\terrMsg = errMissingValue.Error()\n\t\tresp.Error = &errMsg\n\t\treturn resp, http.StatusBadRequest\n\t}\n\n\ti, err := strconv.ParseInt(id, 10, 64)\n\t// routing should prevent this, but might as well guard it\n\tif err != nil {\n\t\terrMsg = errNaN.Error()\n\t\tresp.Error = &errMsg\n\t\treturn resp, http.StatusBadRequest\n\t}\n\n\titem, err := h.storage.GetItem(i)\n\tif err != nil {\n\t\terrMsg = errInternal.Error()\n\t\tresp.Error = &errMsg\n\t\tlog.Println(err)\n\t\treturn resp, http.StatusInternalServerError\n\t}\n\n\tresp.Item = item\n\treturn resp, http.StatusOK\n}", "title": "" }, { "docid": "959a4e353414c683df11bd0e4d774a59", "score": "0.5587938", "text": "func (itemRepo *ItemGormRepo) Item(id uint) (*entity.Item, []error) {\n\titem := entity.Item{}\n\terrs := itemRepo.conn.First(&item, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &item, errs\n}", "title": "" }, { "docid": "3ea37c40d5d8e8f3f53b0a228a3d3235", "score": "0.55774784", "text": "func findMediaItemById(mediaItemId string) (*photoslibrary.MediaItem, bool) {\n\tfor _, a := range getFakeMediaItems(AvailableMediaItems) {\n\t\tif mediaItemId == a.Id {\n\t\t\treturn a, true\n\t\t}\n\t}\n\treturn &photoslibrary.MediaItem{}, false\n}", "title": "" }, { "docid": "0d21bca3641aea6037f9d9bd03db668e", "score": "0.55771065", "text": "func (t *Table) LookupByNameOrID(id string) *Host {\n\th := t.LookupByID(id)\n\tif h != nil {\n\t\treturn h\n\t}\n\treturn t.LookupByName(id)\n}", "title": "" }, { "docid": "ec7808d1ac510befde74329f22df39c0", "score": "0.5572262", "text": "func getArticleByID(id int) (*article, error) {\n\tfor _, a := range articleList {\n\t\tif a.ID == id {\n\t\t\treturn &a, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"Article not found\")\n}", "title": "" }, { "docid": "a4bfe4f2dc35bd34d8442376dfb59a0e", "score": "0.5559203", "text": "func (h *ArticleHandler) GetByID(c gin.Context) error {\n\tctxHandler := \"article_handler_get_by_id\"\n\tidParam := c.Param(\"id\")\n\tctx := context.Context()\n\tmultiError := shared.NewMultiError()\n\n\tif ok := shared.ValidateNumeric(idParam); !ok {\n\t\tmultiError.Append(\"error\", fmt.Errorf(\"id must be numeric\"))\n\t\tutils.Log(log.ErrorLevel, multiError.Error(), ctxHandler, \"validate_id\")\n\t\tresponse := shared.NewHTTPResponse(http.StatusBadRequest, \"validate id\", multiError)\n\t\treturn response.JSON(c.Response())\n\t}\n\n\tmultiError.Clear()\n\n\tid, _ := strconv.Atoi(idParam)\n\tres := <-h.ArticleUseCase.GetByID(ctx, id)\n\tif res.Error != nil {\n\t\tutils.Log(log.ErrorLevel, res.Error.Error(), ctxHandler, \"err_res_get_by_id\")\n\t\tresponse := shared.NewHTTPResponse(http.StatusBadRequest, res.Error.Error(), multiError)\n\t\treturn response.JSON(c.Response())\n\t}\n\n\tresult := res.Result.(model.Article)\n\tmeta := shared.CreateMeta(1, 1, 1)\n\tresponse := shared.NewHTTPResponse(http.StatusOK, \"Article Get By ID\", result, meta)\n\treturn response.JSON(c.Response())\n}", "title": "" }, { "docid": "da81b18e29e9772a8e04ab2bbb3ffa16", "score": "0.5556485", "text": "func GetByID(id string) []ToDoItem {\n\tvar result ToDoItem\n\tvar res []ToDoItem\n\t_ = c.Find(bson.M{\"id\": bson.ObjectIdHex(id)}).One(&result)\n\tres = append(res, result)\n\treturn res\n}", "title": "" }, { "docid": "c8bdb9ff412cb925d81eb603618a7e7b", "score": "0.55547726", "text": "func (ds *DoitServer) GetHost(d *dt.Domain, id int) (*dt.Host, error) {\n\th := &dt.Host{ID: id, Domain: d}\n\tgormErr := ds.Store.Conn.First(&h).Related(&h.Vars, \"Vars\")\n\tif gormErr.Error != nil {\n\t\treturn nil, gormErr.Error\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "8072ca8d959fad1ffff312c7338f18b4", "score": "0.5552845", "text": "func (i *inventory) GetHost(hostname string) (Host, bool) {\n\ti.mu.Lock()\n\tdefer i.mu.Unlock()\n\tif h, ok := i.Hosts[hostname]; ok {\n\t\treturn h, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "3d7778be7b09837b8513b4e17ae5a8ef", "score": "0.5547343", "text": "func (s *Stack) PeekByID(id uint64) (*Item, error) {\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\t// Check if stack is closed.\n\tif !s.isOpen {\n\t\treturn nil, ErrDBClosed\n\t}\n\n\treturn s.getItemByID(id)\n}", "title": "" }, { "docid": "e00c2a366006c3379e22f70b24f0c0df", "score": "0.5509223", "text": "func (cli *Service) GetObjectByID(ctx context.Context, db dal.RDB, objType string, fields []string, id int, result interface{}, sort string) error {\n\ttName := common.GetInstTableName(objType)\n\tcondition := make(map[string]interface{}, 1)\n\tcondition[common.GetInstIDField(objType)] = id\n\tif tName == common.BKTableNameBaseInst && objType != common.BKInnerObjIDObject {\n\t\tcondition[common.BKObjIDField] = objType\n\t}\n\terr := db.Table(tName).Find(condition).Fields(fields...).One(ctx, result)\n\treturn err\n}", "title": "" }, { "docid": "569bc9ab30ae6fd390946559d5d30992", "score": "0.5498132", "text": "func (uc *ExerciseType) GetByID(id int) (*model.ExerciseType, error) {\n\titem, err := uc.repo.GetByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn item, nil\n}", "title": "" }, { "docid": "16ba474affd38f6468d4e2b2d1fc6ee2", "score": "0.5487998", "text": "func (disks VirtualMachineDisks) GetByID(id string) *VirtualMachineDisk {\n\tfor index := range disks {\n\t\tif disks[index].ID == id {\n\t\t\treturn &disks[index]\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9159b909b217be609a622a450bc51cb3", "score": "0.5485951", "text": "func (db *LocationRepo) GetByID(id uint) (*models.LocationAdress, error) {\n\n\t//database access\n\treturn nil, nil\n}", "title": "" }, { "docid": "ec9de0d20afe9b19d1deb7cd33a8d9a1", "score": "0.5474566", "text": "func (icr *ItemCategoryRepository) GetByID(ID int) *ItemCategory {\n\titemCategory := &ItemCategory{}\n\n\ticr.DB.Model(&ItemCategory{}).Where(&ItemCategory{ID: ID}).First(&itemCategory)\n\n\treturn itemCategory\n}", "title": "" }, { "docid": "c0125eb4b9adb1e0c66c791809266235", "score": "0.54712147", "text": "func (h *HNClient) Item(id string) (interface{}, error) {\n\turl := hnObjURLString(\"item\", id)\n\tresp, err := h.httpClient.Get(url)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not make GET request for item\")\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.Wrap(err, \"non 200 response code\")\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not read response body\")\n\t}\n\n\tvar t msgWrapper\n\tif err := json.Unmarshal(body, &t); err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not unmarshal response body\")\n\t}\n\tvar res interface{}\n\tswitch t.Type {\n\tcase \"story\", \"job\", \"ask\":\n\t\ts := &Story{}\n\t\tif err := json.Unmarshal(body, s); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = s\n\tcase \"comment\":\n\t\tc := &Comment{}\n\t\tif err := json.Unmarshal(body, c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = c\n\tcase \"poll\":\n\t\tp := &Poll{}\n\t\tif err := json.Unmarshal(body, p); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = p\n\tcase \"pollopt\":\n\t\tp := &PollOpt{}\n\t\tif err := json.Unmarshal(body, p); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = p\n\tdefault:\n\t\treturn nil, errors.New(\"unknown item type, open a github issue\")\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "49d7df0577abfeba56866038bec20bca", "score": "0.54566926", "text": "func (c *SSHKeyClient) GetByID(ctx context.Context, id int) (*SSHKey, *Response, error) {\n\treq, err := c.client.NewRequest(ctx, \"GET\", fmt.Sprintf(\"/ssh_keys/%d\", id), nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar body schema.SSHKeyGetResponse\n\tresp, err := c.client.Do(req, &body)\n\tif err != nil {\n\t\tif IsError(err, ErrorCodeNotFound) {\n\t\t\treturn nil, resp, nil\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\treturn SSHKeyFromSchema(body.SSHKey), resp, nil\n}", "title": "" }, { "docid": "31fc6a02d306daa4c86ab93075afbfbb", "score": "0.5456674", "text": "func (c *Complaint) GetByID(ID string) (bool, error) {\n\tvar empty Complaint\n\n\tobjectID, _ := primitive.ObjectIDFromHex(ID)\n\terr := c.Collection().FindOne(context.Background(), bson.M{\"_id\": objectID}).Decode(c)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif *c == empty {\n\t\treturn false, nil\n\t}\n\n\tif c.IsRead == false {\n\t\tc.IsRead = true\n\t\tc.Update()\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "7624d2061f64bbe441e9cb290ff6e2da", "score": "0.5442013", "text": "func DeleteItemByID(id string, pathID string, port string) ([]byte, error) {\n\n\turlFlag := viper.GetBool(\"url\")\n\tverboseFlag := viper.GetBool(\"verbose\")\n\turl := buildURL(id, pathID, port)\n\n\tif urlFlag {\n\t\tfmt.Println(\"DELETE: \" + url)\n\t}\n\n\treq, err := http.NewRequest(\"DELETE\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Fetch Request\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, errBody := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If verbose is enabled, print Header and Body + errors if any\n\tif verboseFlag {\n\t\tfmt.Println(\"HEADER\")\n\t\tfor k, v := range resp.Header {\n\t\t\tfmt.Printf(\"%v : %v\\n\", k, v)\n\t\t}\n\n\t\tif errBody != nil {\n\t\t\tfmt.Println(errBody)\n\t\t} else {\n\t\t\tfmt.Println(\"BODY\")\n\t\t\tfmt.Println(string(body))\n\t\t}\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "23e9f426033146d698cf42dc08dc0244", "score": "0.5420728", "text": "func (mus *MemStore) GetByID(id UserID) (*User, error) {\n\tfor _, u := range mus.entries {\n\t\tif u.ID == id {\n\t\t\treturn u, nil\n\t\t}\n\t}\n\treturn nil, ErrUserNotFound\n}", "title": "" }, { "docid": "3c7fa3a98ab3eb04e13a3be8e6bd7c46", "score": "0.54194367", "text": "func (ser *UserEpisodeService) GetByID(id int, tx db.Tx) (*models.UserEpisode, error) {\n\tm, err := tx.Database().GetByID(id, ser, tx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tuep, err := ser.AssertType(m)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgModelAssertType, err)\n\t}\n\treturn uep, nil\n}", "title": "" }, { "docid": "40b46ae7953427b4c4503176ae89f6ce", "score": "0.5416348", "text": "func GetItem(ctx context.Context, id int) (Item, error) {\n\turl := fmt.Sprintf(\"https://hacker-news.firebaseio.com/v0/item/%d.json\", id)\n\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\n\treq = req.WithContext(ctx)\n\n\tclient := http.DefaultClient\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\n\tvar responseBody Item\n\n\tdefer res.Body.Close()\n\terr = json.NewDecoder(res.Body).Decode(&responseBody)\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\n\treturn responseBody, nil\n}", "title": "" }, { "docid": "15f4227c6c4c51c0f8364eeb9ac36762", "score": "0.54144573", "text": "func (c *itemsController) Get(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\titemID := strings.TrimSpace(vars[\"id\"])\n\n\titem, err := services.ItemsService.Get(itemID)\n\tif err != nil {\n\t\thttp_utils.ResponseError(w, err)\n\t\treturn\n\t}\n\n\thttp_utils.ResponseJSON(w, http.StatusOK, item)\n}", "title": "" }, { "docid": "1f3eeed9a50155fc52e7a0b51af641da", "score": "0.5411422", "text": "func (s *AbstractDAOMongo) GetByID(ID string) (interface{}, error) {\n\t// check ID\n\tif !bson.IsObjectIdHex(ID) {\n\t\treturn nil, errors.New(\"Invalid input to ObjectIdHex\")\n\t}\n\n\tsession := s.session.Copy()\n\tdefer session.Close()\n\n\tm := reflect.New(reflect.TypeOf(s.GetModel()))\n\tc := session.DB(\"\").C(s.collection)\n\terr := c.Find(bson.M{\"_id\": bson.ObjectIdHex(ID)}).One(m.Interface())\n\treturn m.Elem().Interface(), err\n}", "title": "" }, { "docid": "5937a0c03cc690a21c4c2cf88b0080aa", "score": "0.5411326", "text": "func TestGetByID(t *testing.T) {\n\ttests.ResetLog()\n\tdefer tests.DisplayLog()\n\n\tdb, err := db.NewMGO(tests.Context, tests.TestSession)\n\tif err != nil {\n\t\tt.Fatalf(\"\\t%s\\tShould be able to get a Mongo session : %v\", tests.Failed, err)\n\t}\n\tdefer db.CloseMGO(tests.Context)\n\n\tdefer func() {\n\t\tif err := itemfix.Remove(tests.Context, db, prefix); err != nil {\n\t\t\tt.Fatalf(\"\\t%s\\tShould be able to remove the items : %v\", tests.Failed, err)\n\t\t}\n\t\tt.Logf(\"\\t%s\\tShould be able to remove the items.\", tests.Success)\n\t}()\n\n\tt.Log(\"Given the need to get an item in the database by ID.\")\n\t{\n\t\tt.Log(\"\\tWhen starting from an empty items collection\")\n\t\t{\n\t\t\titems, err := itemfix.Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able retrieve item fixture : %s\", tests.Failed, err)\n\t\t\t}\n\n\t\t\tvar itemIDs []string\n\t\t\tfor _, it := range items {\n\t\t\t\tif err := item.Upsert(tests.Context, db, &it); err != nil {\n\t\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to upsert items : %s\", tests.Failed, err)\n\t\t\t\t}\n\t\t\t\titemIDs = append(itemIDs, it.ID)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to upsert items.\", tests.Success)\n\n\t\t\titmBack, err := item.GetByID(tests.Context, db, itemIDs[0])\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to get an item by ID : %s\", tests.Failed, err)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to get an item by ID.\", tests.Success)\n\n\t\t\t// Check equality for all immutable fields: ID, Version, Data. Timestamps will change on Upsert.\n\t\t\tif !reflect.DeepEqual(items[0].Data, itmBack.Data) || (items[0].ID != itmBack.ID) || (items[0].Version != itmBack.Version) {\n\t\t\t\tt.Logf(\"\\t%+v\", items[0])\n\t\t\t\tt.Logf(\"\\t%+v\", itmBack)\n\t\t\t\tt.Fatalf(\"\\t%s\\tShould be able to get back the same item.\", tests.Failed)\n\t\t\t}\n\t\t\tt.Logf(\"\\t%s\\tShould be able to get back the same item.\", tests.Success)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "be6a38eb09e0d0b4fa96dddf4e32e177", "score": "0.5410283", "text": "func (s *ClientRepository) GetByID(id string) (*Client, error) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tclient := s.clients[id]\n\tif client != nil && client.Obsolete(s.KeepLostClients) {\n\t\treturn nil, nil\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "7fd0c9d07964d7e4dcbe59a1d4778c39", "score": "0.5396887", "text": "func (h *ItemsHandler) GetItem(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\titemID, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tutils.RespondWithError(w, http.StatusBadRequest, \"Invalid id number\")\n\t\treturn\n\t}\n\tproduct, err := h.useCase.GetItem(r.Context(), itemID)\n\tif errors.Is(err, utils.ErrFetchError) {\n\t\th.logger.Info(\"Error occured while fetching the item\")\n\t\tutils.RespondWithError(w, http.StatusInternalServerError, \"Error occured while fetching the item\")\n\t\treturn\n\t}\n\tif errors.Is(err, utils.ErrItemNotFound) {\n\t\th.logger.Info(\"Item not found\")\n\t\tutils.RespondWithError(w, http.StatusNotFound, \"Item not found\")\n\t\treturn\n\t}\n\tutils.RespondWithJSON(w, http.StatusOK, product)\n}", "title": "" }, { "docid": "e549ca97b98c9458f529b8f603e8dc7f", "score": "0.5394108", "text": "func GetByID(c context.Context, id int64) (*service.Protocol, error) {\n\tc = setNamespace(c)\n\n\tp := []service.Protocol{}\n\tks, err := datastore.NewQuery(KIND).Filter(\"ID =\", id).GetAll(c, &p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"No Protocol with ID: %v found in datastore: %v\", id, err)\n\t}\n\n\tif len(p) > 0 && len(ks) > 0 {\n\t\treturn &p[0], nil\n\t}\n\n\treturn nil, fmt.Errorf(\"No Protocol found with ID: %v\", id)\n}", "title": "" }, { "docid": "78d772cce015f325fd82dfb136c27128", "score": "0.53939515", "text": "func (g *Getter) GetByID(ID string, activeOnly bool) (*model.Key, error) {\n\treturn g.Key, g.KeyError\n}", "title": "" }, { "docid": "8fa76ca83b87149a83621060013614bb", "score": "0.5389459", "text": "func getSpecificItem() {\n\tapiv1.GET(\"/viewParts/:id\", func(c *gin.Context) {\n\t\tid := c.Param(\"id\")\n\t\tfoundPart, err := model.GetPartByID(id)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"Message\": \"Error finding the specific part\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tlog.Println(foundPart)\n\t\t// search the id in the local array\n\t\tc.JSON(http.StatusOK, foundPart)\n\t})\n}", "title": "" }, { "docid": "4fa457f8a8b22027a40647c13eb30ece", "score": "0.5387356", "text": "func getProductByID(c *gin.Context) {\n\tid := c.Param(\"id\")\n\n\t// Loop through the list of products, looking for\n\t// an album whose ID value matches the parameter.\n\tfor _, a := range products {\n\t\tif a.ID == id {\n\t\t\tc.IndentedJSON(http.StatusOK, a)\n\t\t\treturn\n\t\t}\n\t}\n\tc.IndentedJSON(http.StatusNotFound, gin.H{\"message\": \"product not found\"})\n}", "title": "" }, { "docid": "40204f6435dddcaf5533d8b593d2d153", "score": "0.53869534", "text": "func (dm *DefaultModel) GetByID(c *gin.Context) {\n\tid := c.Param(\"id\")\n\tc.String(200, \"The ID = %s\", id)\n}", "title": "" }, { "docid": "df62e88246a01dbad43012792461ba47", "score": "0.5381315", "text": "func (s *RedisStore) Item(id ItemIdType) (*Item, error) {\n\treturn s.ItemByKey(ItemKey(id))\n}", "title": "" }, { "docid": "e4e2917f103a74dd0b3f869518d90728", "score": "0.5378964", "text": "func (b *Product) GetByID(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tpayload, err := b.repo.GetByID(r.Context(), int64(id))\n\tif err != nil {\n\t\trespondWithError(w, http.StatusNoContent, err.Error())\n\t\treturn\n\t}\n\n\trespondwithJSON(w, http.StatusOK, payload)\n}", "title": "" }, { "docid": "30671f63765e3d30e83bba489ba048c2", "score": "0.5377898", "text": "func GetByID(id int64, obj interface{}) error {\n\thas, err := orm.Id(id).Get(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !has {\n\t\treturn ErrNotExist\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2470048d3d2ae41331cefd1283f069a1", "score": "0.53756523", "text": "func (ps *productService) GetByID(productID int) (model.Product, error) {\n\tproduct, err := ps.productRepo.GetByID(productID)\n\tif err != nil {\n\t\treturn product, err\n\t}\n\treturn product, nil\n}", "title": "" }, { "docid": "9cc80c28ead900d1dadd2372c62d91e9", "score": "0.5371803", "text": "func (s *store) FindByID(ctx context.Context, transactionID core.ID) (*core.TransactionItem, error) {\n\tvar foundTransaction core.TransactionItem\n\n\t// Creating filter which find / create an item with the same meeting.ID\n\tfilter := bson.D{{\n\t\t\"id\",\n\t\tbson.D{{\n\t\t\t\"$eq\",\n\t\t\ttransactionID,\n\t\t}},\n\t}}\n\n\terr := s.Col.FindOne(context.Background(), filter).Decode(&foundTransaction)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &foundTransaction, nil\n}", "title": "" }, { "docid": "712696927a6d55a79cb6767dc2725f02", "score": "0.5369852", "text": "func (con *Connection) GetHost(id string) (*Host, error) {\n\tbody, err := con.GetLinkBody(\"hosts\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thost := con.NewHost()\n\terr = json.Unmarshal(body, host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn host, err\n}", "title": "" }, { "docid": "8c34cadcf8b0a9cf6516d7f32b12d052", "score": "0.5368637", "text": "func (c *Client) Host(id string) (*Host, error) {\n\thosts, err := c.Hosts()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, h := range hosts {\n\t\tif h.ID() == id {\n\t\t\treturn h, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"cluster: unknown host %q\", id)\n}", "title": "" }, { "docid": "f1c2bba96e9dd36719e638079a40e52c", "score": "0.5368227", "text": "func (s feedService) GetByID(id string) (IFeed, error) {\n\tif isEmpty(id) {\n\t\treturn nil, createInvalidParameterError(OperationGetByID, ParameterID)\n\t}\n\n\tpath := s.BasePath + \"/\" + id\n\tresp, err := apiGet(s.getClient(), new(FeedResource), path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp.(IFeed), nil\n}", "title": "" }, { "docid": "2a61abf18944ee7372f1b7385c939f19", "score": "0.53667396", "text": "func (r productRepository) GetByID(ctx context.Context, id string) (*models.Product, error) {\n\tvar product *models.Product\n\t// string to primitive.ObjectID\n\tproductId, _ := primitive.ObjectIDFromHex(id)\n\n\terr := r.db.FindOne(ctx, bson.M{\"_id\": productId}).Decode(&product)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn product, err\n}", "title": "" }, { "docid": "aa9159b43d025a5adeb5ce74fea90a55", "score": "0.53614455", "text": "func (p *Post) GetByID(w http.ResponseWriter, r *http.Request) {\n\tid, _ := strconv.Atoi(chi.URLParam(r, \"id\"))\n\tpayload, err := p.repo.GetByID(r.Context(), int64(id))\n\n\tif err != nil {\n\t\trespondWithError(w, http.StatusNoContent, \"Content not found\")\n\t}\n\n\trespondwithJSON(w, http.StatusOK, payload)\n}", "title": "" }, { "docid": "867830d8bde837f190cf2326e72287f1", "score": "0.5345548", "text": "func (s *service) GetByID(ctx context.Context, id string) (template.NotificationTemplate, error) {\n\ts.logger.Info(\"getbyID service\")\n\n\ttemplate, err := s.repository.GetNotificationTemplateByID(ctx, id)\n\tif err != nil {\n\t\ts.logger.WithFields(logrus.Fields{\"error\": err}).Error(\"get notification template byid return error\")\n\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn template, ErrNotificationNotFound\n\t\t}\n\t\treturn template, ErrQueryRepository\n\t}\n\treturn template, nil\n}", "title": "" }, { "docid": "0e4d2a43235b1cad01ede1dbb35ba69a", "score": "0.5342324", "text": "func (r *BaseRepository) GetByID(out interface{}, id string, relations ...string) error {\n\tq := r.DB\n\tfor _, relation := range relations {\n\t\tq = q.Preload(relation)\n\t}\n\treturn q.Find(out, \"id = ?\", id).Error\n}", "title": "" }, { "docid": "676c4fde123d1d1316cb35a52ba7cc83", "score": "0.5332864", "text": "func GetByID(c *fiber.Ctx) {\n\tvar company model.Company\n\tid := c.Params(\"id\")\n\tcompany.ID, _ = strconv.Atoi(id)\n\tcompany.CompanyName = \"\"\n\tcompany.Zipcode = \"\"\n\tfmt.Println(company)\n\tcomp := control.Index(company, true)\n\n\tc.Set(\"Content-Type\", \"application/json\")\n\n\tif comp == nil {\n\t\tc.Status(404)\n\t} else {\n\t\tif len(comp) > 0 {\n\t\t\tc.Status(200).JSON(map[string]interface{}{\n\t\t\t\t\"ID\": strconv.Itoa(comp[0].ID),\n\t\t\t\t\"CompanyName\": comp[0].CompanyName,\n\t\t\t\t\"Zipcode\": comp[0].Zipcode,\n\t\t\t\t\"Website\": comp[0].Website,\n\t\t\t})\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "b3a88e5318b6865e0a9a380e92f9ce11", "score": "0.5318147", "text": "func (r MockDeviceRegistry) GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) {\n\tif r.GetByIDFunc == nil {\n\t\treturn nil, errors.New(\"GetByID must not be called\")\n\t}\n\treturn r.GetByIDFunc(ctx, appID, devID, paths)\n}", "title": "" }, { "docid": "84a8ca2869dbb7f3e06ca0b26507fd1b", "score": "0.53178877", "text": "func (hp *indexedHeap) Get(id uint64) TopNItem {\n\tidx, ok := hp.index[id]\n\tif !ok {\n\t\treturn nil\n\t}\n\titem := hp.items[idx]\n\treturn item\n}", "title": "" }, { "docid": "dc5770dd512c3a068cecea0bc8da5498", "score": "0.531717", "text": "func (me *AccountRepository) GetByID(ctx context.Context, id string) (*account.Account, error) {\n\tfor _, accountRecord := range me.accounts {\n\t\tif accountRecord.ID == id {\n\t\t\treturn accountRecord, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "5642efd8611da0a35e8f9c8596923172", "score": "0.53161055", "text": "func GetHostGroupByID(ctx context.Context, id string) (*define.HostGroup, error) {\n\thostgroups, _, err := getHostGroups(ctx, id, \"\", 0, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(hostgroups) != 1 {\n\t\terr = define.ErrNotExist{Value: id}\n\t\treturn nil, err\n\t}\n\treturn &hostgroups[0], nil\n}", "title": "" }, { "docid": "f5e9ba9b1234c2763a65b8b9ce34e3a5", "score": "0.53157383", "text": "func GetMachineByID(machineCache capicontrollers.MachineCache, machineID, clusterNamespace, clusterName string) (bool, *capi.Machine, error) {\n\tmachines, err := machineCache.List(clusterNamespace, labels.SelectorFromSet(map[string]string{\n\t\tClusterNameLabel: clusterName,\n\t\tMachineIDLabel: machineID,\n\t}))\n\tif err != nil || len(machines) > 1 {\n\t\treturn false, nil, err\n\t}\n\tif len(machines) == 1 {\n\t\treturn true, machines[0], nil\n\t}\n\treturn true, nil, fmt.Errorf(\"unable to find machine by ID %s for cluster %s\", machineID, clusterName)\n}", "title": "" }, { "docid": "cfb9741f25718cb59bedf21d7b0bccd8", "score": "0.5305117", "text": "func (m *ItemDB) OneItem(ctx context.Context, id int, categoryID int, placeID int, userID int) (*app.Item, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"item\", \"oneitem\"}, time.Now())\n\n\tvar native Item\n\terr := m.Db.Scopes(ItemFilterByCategory(categoryID, m.Db), ItemFilterByPlace(placeID, m.Db), ItemFilterByUser(userID, m.Db)).Table(m.TableName()).Preload(\"Category\").Preload(\"Place\").Preload(\"User\").Where(\"id = ?\", id).Find(&native).Error\n\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\tgoa.LogError(ctx, \"error getting Item\", \"error\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tview := *native.ItemToItem()\n\treturn &view, err\n}", "title": "" }, { "docid": "d6e5bf5d9742c26eaa94b94d720f49d6", "score": "0.5303425", "text": "func GetUserByID(user *User, id string) (err error) {\n\tif err = app.DB.Where(\"id = ?\", id).First(user).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "faeb08d8b56e9cb86144db2725fd3421", "score": "0.53013456", "text": "func (storage *Storage) GetEventByID(ctx context.Context, id int) (entities.Event, error) {\n\tstorage.mu.Lock()\n\te, ok := storage.events[id]\n\tstorage.mu.Unlock()\n\tif !ok {\n\t\treturn entities.Event{}, errors.ErrNotFound\n\t}\n\treturn e, nil\n}", "title": "" }, { "docid": "4d0a8124010e8c0e23a049f0ccdef363", "score": "0.5294957", "text": "func (d *deviceCache) DeviceById(id string) *models.Device {\n\tname, ok := d.names[id]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tdev := d.devices[name]\n\treturn dev\n}", "title": "" }, { "docid": "b1338ea4b8818dcd049b6ccf97f8837e", "score": "0.5292527", "text": "func (inv *inventoryService) GetHostByName(name string) (model.Host, bool, error) {\n\treturn inv.repo.SelectHostByName(name)\n}", "title": "" }, { "docid": "f52cd83263d02a9036a97000b0519341", "score": "0.5292339", "text": "func (s *DeveloperAppStore) GetByID(developerAppID string) (*types.DeveloperApp, types.Error) {\n\n\tquery := \"SELECT \" + developerAppColumns + \" FROM developer_apps WHERE app_id = ? LIMIT 1\"\n\tdeveloperapps, err := s.runGetDeveloperAppQuery(query, developerAppID)\n\tif err != nil {\n\t\treturn nil, types.NewDatabaseError(err)\n\t}\n\n\tif len(developerapps) == 0 {\n\t\ts.db.metrics.QueryMiss(developerAppsMetricLabel)\n\t\treturn nil, types.NewItemNotFoundError(\n\t\t\tfmt.Errorf(\"Can not find developer app id '%s'\", developerAppID))\n\t}\n\n\ts.db.metrics.QueryHit(developerAppsMetricLabel)\n\treturn &developerapps[0], nil\n}", "title": "" }, { "docid": "93ce055c2f6d7383b5e44d27edee36ed", "score": "0.5284823", "text": "func GetItem(w http.ResponseWriter, r *http.Request) error {\n\titemId, err := parseID(r)\n\tif err != nil {\n\t\treturn badRequest{err}\n\t}\n\n\tc := appengine.NewContext(r)\n\titemKey := datastore.NewKey(c, \"Item\", \"\", itemId, nil)\n\n\tvar item Item\n\terr = datastore.Get(c, itemKey, &item)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.NewEncoder(w).Encode(item)\n}", "title": "" }, { "docid": "95cffc29fef9afb8d775538f8c034c24", "score": "0.52843094", "text": "func (c *ElasticacheClient) GetByID(id string) (*session.Session, error) {\n\tif id == \"\" {\n\t\treturn nil, ErrEmptySessionID\n\t}\n\n\tmsg, err := c.client.Get(id).Result()\n\tif err != nil {\n\t\tif err == redis.Nil {\n\t\t\treturn nil, ErrSessionNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tvar s *session.Session\n\n\terr = json.Unmarshal([]byte(msg), &s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Refresh TTL on access and update LastAccessed in session\n\ts.LastAccessed = time.Now()\n\terr = c.Expire(s.ID, c.ttl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.Expire(s.Email, c.ttl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "f038cfd1062c0c6b6e412adc613361fe", "score": "0.5280807", "text": "func (client CardsClient) GetByID(ctx context.Context, ID uuid.UUID) (result Card, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/CardsClient.GetByID\")\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.GetByIDPreparer(ctx, ID)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"scryfall.CardsClient\", \"GetByID\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.GetByIDSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"scryfall.CardsClient\", \"GetByID\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.GetByIDResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"scryfall.CardsClient\", \"GetByID\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "bb1211f5a87ac06c8becdad7949ad373", "score": "0.52807814", "text": "func GetUserByID(user *model.User, id string) (err error) {\n\tif err = config.Db.Where(\"id = ?\", id).First(user).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ebd85ab5e4c9dc560a0e54b0b6f4e8f1", "score": "0.5275961", "text": "func (p *mySQLProduct) GetByID(id uint) (*product.Model, error) {\n\tstmt, err := p.db.Prepare(mySQLGetProductByID)\n\tif err != nil {\n\t\treturn &product.Model{}, err\n\t}\n\tdefer stmt.Close()\n\n\treturn scanRowProduct(stmt.QueryRow(id))\n}", "title": "" }, { "docid": "b3805263e766bb6ecad547c3df1791eb", "score": "0.52710253", "text": "func (s *service) GetByID(ctx context.Context, id string) (billsvc.Bill, error) {\n\tlogger := log.With(s.logger, \"method\", \"GetByID\")\n\torder, err := s.repository.GetBillByID(ctx, id)\n\tif err != nil {\n\t\tlevel.Error(logger).Log(\"err\", err)\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn order, billsvc.ErrBillNotFound\n\t\t}\n\t\treturn order, billsvc.ErrQueryRepository\n\t}\n\treturn order, nil\n}", "title": "" } ]
cf96554f22beb7351e457d59eb5fff1c
Validate validates this get reasons groups o k body
[ { "docid": "d10842b3ed1f5631a4aa7166e2c98c26", "score": "0.680102", "text": "func (o *GetReasonsGroupsOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.Envelope\n\tif err := o.Envelope.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateData(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": "2335e6454159a196b4fbb4c0332ca77d", "score": "0.6639022", "text": "func (e ListGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "60dacb651374f835cfb43f3de88dbe18", "score": "0.65584767", "text": "func (e GroupValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "4c264965e2a2377b08175e75b2122533", "score": "0.65584624", "text": "func (e ListGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "dbb8412867d75b444932315641fde3a4", "score": "0.6503367", "text": "func (e ListGroupRequestValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "3c57a79e57b4cf5eb5403e76762bbed1", "score": "0.64388686", "text": "func (e GetGroupActivesRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "5b6d01fe2da1766a74c7e4b0d967cb7e", "score": "0.643682", "text": "func (e ListGroupsResponseValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "27a200aa3040dce5494f31bd80554362", "score": "0.64246285", "text": "func (e GetGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "a9206def43f52dd84370312f92325d70", "score": "0.6391703", "text": "func (e ReadGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "9548c8dae7c34041344fee4c7db85a87", "score": "0.6390378", "text": "func (e GetGroupActivesResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "7453cd2387f9af6091b7be5e9697ac2f", "score": "0.63735473", "text": "func (e GetGroupReqeustValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "b8174d12deccac6a554f6a076dc9d5f7", "score": "0.63133", "text": "func (e CreateGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "b8174d12deccac6a554f6a076dc9d5f7", "score": "0.63133", "text": "func (e CreateGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "02f6442055206c09095e972a001788a6", "score": "0.6301446", "text": "func (e ReadGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "a4b0f715da944b683e4a072ce2a29604", "score": "0.6300605", "text": "func (e CreateGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "c2ddc81fba026cf0befc61e9f18d665c", "score": "0.62859064", "text": "func (e ReadGroupRequestValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "bba7e6423b3ea6d1e8d2f385033bc098", "score": "0.62639576", "text": "func (e CreateGroupRequestValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "59b626a1e3567b14d3ea42d4c4a31e36", "score": "0.6215655", "text": "func (e GetGroupTeamsReqValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "9201eb39e1795ff6bc993841f3e1bada", "score": "0.6202263", "text": "func (e CreateGroupResponseValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "b84d73b4a7d7039ef979f317c6f4063f", "score": "0.6160182", "text": "func (e GroupValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "2ca68d1cad7bc314458a6f0991c2e551", "score": "0.615422", "text": "func (e CreateGroupReqeustValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "6acc13594d69c537f702764b5c0133c2", "score": "0.6146913", "text": "func (e CreateGroupTeamsReqValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "a4aa6faa7e3fb3d0d9a7ad6388e83c01", "score": "0.6129059", "text": "func (e ReadGroupResponseValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "2393bf302d3d85658cf136fbd0175ec9", "score": "0.6111987", "text": "func (e DeleteGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "2393bf302d3d85658cf136fbd0175ec9", "score": "0.6111987", "text": "func (e DeleteGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "db1c609ec783dbc2755a15670427b97a", "score": "0.60944664", "text": "func (e DeleteGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "db1c609ec783dbc2755a15670427b97a", "score": "0.60944664", "text": "func (e DeleteGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "0c8c719838bf8e93c2a0b6de5ce102c0", "score": "0.60683763", "text": "func (e CreateGroupTeamsRespValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "6a40b742968b1ee5bb20ff67d137fc64", "score": "0.6060311", "text": "func (e SearchGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "8c89095c9c6895c8b3b1053f8edba186", "score": "0.6054801", "text": "func (e GetGroupTeamsRespValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "426d764e2f4bed5d8d59cf3fde71341d", "score": "0.6021166", "text": "func (e DeleteGroupRequestValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "39699d68fc062e99a266f4c826f2f47c", "score": "0.6009187", "text": "func (o *GetReasonsGroupsOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.Envelope\n\tif err := o.Envelope.ContextValidate(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.contextValidateData(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": "5136b920d4c1c42e58dc104c7966e7c7", "score": "0.5996409", "text": "func (e UpdateGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "b58a912a8556b46686e1801e86110881", "score": "0.59931934", "text": "func (e SearchGroupReqeustValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "1bbf272f42043404d3872134f86743ce", "score": "0.5965455", "text": "func (e UpdateGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "ff215ecdee725d8b85509733af488ce4", "score": "0.59617895", "text": "func (e LeaveGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "e40f66495bf34db842a7f5678530f178", "score": "0.59612525", "text": "func (e UpdateGroupRequestValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "eaef280f3c1857eb672743419125af5f", "score": "0.5959605", "text": "func (e DeleteGroupResponseValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "140fb7a799978e24179011cbcd5da01c", "score": "0.5952201", "text": "func (e ListGroupsResponseValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "438262681b99ff1a8e10068d1590b65d", "score": "0.59374535", "text": "func (e ListGroupRequestValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "72b9e6ab3357b68dc4298c46158bf5ed", "score": "0.59335893", "text": "func (e LeaveGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "33e45ed78177eb2ed234fd84b5400287", "score": "0.59214705", "text": "func (e UpdateGroupInfoRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "30c9da4466779e87775dfe4b1f197d3d", "score": "0.58907014", "text": "func (e UpdateGroupInfoResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "2250285bfaa15165337b83a3fee7e731", "score": "0.5887512", "text": "func (e JoinGroupResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "40d913a5f48ad79127bbc3388cc8a268", "score": "0.5886885", "text": "func (e ListGroupResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "a70e1290f26a51a680f9d401bd56ad3b", "score": "0.5850496", "text": "func (e ZoneGroupValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "919294e7ec1ce9e252cf0ed9d71a3639", "score": "0.5847193", "text": "func (e UpdateGroupResponseValidationError) GetReason() string { return e.Reason }", "title": "" }, { "docid": "84e41d94a39356a7c936cc0908712c3b", "score": "0.58468217", "text": "func (e JoinGroupRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "a7514e45616bc9a119235fd9cdc42bce", "score": "0.5817953", "text": "func (e ReadGroupResponseValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "1da689720ef9b652809256648e83855d", "score": "0.5790371", "text": "func (e GetGroupResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "f837a6c85f25abbcfdc77d097d0b6b90", "score": "0.57785827", "text": "func (e ListGroupRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "1bfe8bb8263b9ecadbd6aaed1f9a979b", "score": "0.5743626", "text": "func (e ReadGroupRequestValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "791785c87ba68775e1484897ddcefb7f", "score": "0.57211274", "text": "func (e ReadGroupResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "51f15793ef539452896d2d91f685c16a", "score": "0.5712406", "text": "func (e MultiGetDoctorTestimonialsRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "5da62664c940594ad4df67018e81b10a", "score": "0.568693", "text": "func (e ReadGroupRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "74201f0477af4d787834c68ee0893b54", "score": "0.5667292", "text": "func (e ListEvidencesRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "ace17caf75378f11dc80515be2843122", "score": "0.5654392", "text": "func (e CreateGroupResponseValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "43f32a0eba72ce4521634afcd93621b1", "score": "0.56535935", "text": "func (e GetGroupActivesResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "9ff9c6bceca3550752b40f58be6a067a", "score": "0.5643939", "text": "func (o *PostDocumentgroupBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a64e45ffd90dcb70dbb4faa21db71c6f", "score": "0.5631231", "text": "func (e MultiGetDoctorTestimonialsResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "7ae01fc207db72b4e7f9529b8c97b335", "score": "0.5619276", "text": "func (e FetchGroupProjectsResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "76d09b020bd6d3d8bd19fc2ff7abfc42", "score": "0.56130695", "text": "func (e GroupValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "54812427d43cae925a053ec566a90bfe", "score": "0.5608196", "text": "func (e GetEmotePacksRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "3490620da3aaab64b4063a01917acad9", "score": "0.5585805", "text": "func (e ListEvidencesResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "e78b58fc2d598c4a3630c21a3b5280a9", "score": "0.558388", "text": "func (e ListTeamsReqValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "5147ff4ed5737242250521231ba14604", "score": "0.5582626", "text": "func (e DeleteGroupResponseValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "685eb1a60af19ba62fe619719cb6ff0f", "score": "0.55799836", "text": "func (e FetchGroupMembersRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "f42c40d7cb93fc4af24645109902b10f", "score": "0.5560912", "text": "func (e GetDoctorTestimonialByIdRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "8511817e227a2b543bc60c9750f3ee82", "score": "0.5545185", "text": "func (e LeaveGroupResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "a2bc5697332427c42edb7c7cb8deb885", "score": "0.55380183", "text": "func (m *GetGroupReqeust) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for GroupId\n\n\t// no validation rules for UserId\n\n\t// no validation rules for Name\n\n\treturn nil\n}", "title": "" }, { "docid": "a870eb7573ab38e95685094081d340bf", "score": "0.5537506", "text": "func (e GetGroupReqeustValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "f9d3e44cef2273f5c358c84bad197e1a", "score": "0.5537178", "text": "func (e GetGroupActivesRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "bfba5339668e18e10ff0fbe220ebfa2f", "score": "0.55371", "text": "func (e FetchGroupProjectsReqeustValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "a51f5ba3b2176295b7271b4f360688ac", "score": "0.5530997", "text": "func (e GetEmotePacksResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "419fd5daea8df8abdb3c059432616c8c", "score": "0.55282336", "text": "func (e FetchGroupMembersResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "835c1b31a02f20639acb13dadedae02e", "score": "0.55280226", "text": "func (e MultiGetDoctorsRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "13ab441e08cdef5bf69368294a033777", "score": "0.55273616", "text": "func (e GetObjectMaterialTextsRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "bbeb9ef6647cf0148538a23bf4cf3138", "score": "0.55225456", "text": "func (g *jsiiProxy_Group) Validate() *[]*string {\n\tvar returns *[]*string\n\n\t_jsii_.Invoke(\n\t\tg,\n\t\t\"validate\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9473855037fa837f6beae0fa0324ab4b", "score": "0.5520816", "text": "func (e CreateGroupResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "9473855037fa837f6beae0fa0324ab4b", "score": "0.5520816", "text": "func (e CreateGroupResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "e507b42c350712ee54cc3c35cf95fe58", "score": "0.5510656", "text": "func (m *APIRuleGroupModifyRequestV1) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateComment(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEnabled(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.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRulegroupVersion(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": "a1f53e22daa84087bab7710d1b11e78d", "score": "0.5494302", "text": "func (e GetDoctorTestimonialByIdResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "3ac03c05873f10f45132ea54c7ca2890", "score": "0.5472465", "text": "func (e GetObjectMaterialTextsResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "90e2c866c5435b98b81d935d97f1cefc", "score": "0.5465005", "text": "func (e GetTopicsByPageRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "ad17780e8201b7859f4be1219597edaf", "score": "0.5458009", "text": "func (m *SimpleGroupResponse) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a71bc9237ff8ef81625e6aa157395722", "score": "0.5452085", "text": "func (m *ConsistencyGroupResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateConsistencyGroupResponseInlineRecords(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": "6cbbc64205eb99abb56387453a2c0105", "score": "0.54442096", "text": "func (e GroupValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "31790c0fb3c075782ee62ab251430f93", "score": "0.54354334", "text": "func (e GetGroupTeamsRespValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "2f441031b77bd0edbb31448e513d5e2b", "score": "0.5426711", "text": "func (e CreateGroupRequestValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "fea888e8f9b5ca693c55cd12a0f4e999", "score": "0.54263824", "text": "func (e ListTeamsRespValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "0f0bfb805fa9d164789aab50ea371e2e", "score": "0.5412458", "text": "func (e ListRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "0f0bfb805fa9d164789aab50ea371e2e", "score": "0.5412458", "text": "func (e ListRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "4f332c9cc1c7cb7edf3efcc9935b3664", "score": "0.5408255", "text": "func (e AddTeamMembersRespValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "b995e2f96b1ce53cfcea93cf86fb12bb", "score": "0.54077435", "text": "func (e GetTestimonialsForDoctorsRequestValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "5934edda44631064e9a53cb9bf327392", "score": "0.5402229", "text": "func (m *Group) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetId()).(interface {\n\t\tValidate() error\n\t}); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn GroupValidationError{\n\t\t\t\tField: \"Id\",\n\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\tCause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\t// no validation rules for Name\n\n\t// no validation rules for Notes\n\n\tif v, ok := interface{}(m.GetProfileId()).(interface {\n\t\tValidate() error\n\t}); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn GroupValidationError{\n\t\t\t\tField: \"ProfileId\",\n\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\tCause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tfor idx, item := range m.GetContacts() {\n\t\t_, _ = idx, item\n\n\t\tif v, ok := interface{}(item).(interface {\n\t\t\tValidate() error\n\t\t}); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn GroupValidationError{\n\t\t\t\t\tField: fmt.Sprintf(\"Contacts[%v]\", idx),\n\t\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\t\tCause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca6e71423f058b0a0e2a70fc90a294dd", "score": "0.5401748", "text": "func (e CreateTeamReqValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "f75f405c2eeb7bfd5c38d4db7644845e", "score": "0.53919286", "text": "func (e AddTeamMembersReqValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "640ac5b2651fa30e0a9c84622ad93331", "score": "0.53856283", "text": "func (e GetGroupTeamsReqValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "01f032ee843d9de38c9d76cef361e91a", "score": "0.5385253", "text": "func (e DeleteGroupRequestValidationError) GetCause() error { return e.Cause }", "title": "" }, { "docid": "c8245787165acd3abf39e6e69a2bc3f3", "score": "0.53834516", "text": "func (e GetTeamReqValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "27cb8ff4aa8fd40204ea7a95d5a321b1", "score": "0.5382922", "text": "func (e ListChartReqValidationError) Reason() string { return e.reason }", "title": "" } ]
3d1357fb7541737440add5793069cdc2
A list of endpoints that are exposed on this network.
[ { "docid": "3c3be0ce385972d16ea2c7ec99d0ab53", "score": "0.0", "text": "func (o NetworkRefResponseOutput) EndpointRefs() EndpointRefResponseArrayOutput {\n\treturn o.ApplyT(func(v NetworkRefResponse) []EndpointRefResponse { return v.EndpointRefs }).(EndpointRefResponseArrayOutput)\n}", "title": "" } ]
[ { "docid": "dea6ac6fba6efeef0ee2180716fd2940", "score": "0.71928126", "text": "func Endpoints() []Endpoint {\n\tendpoints := []Endpoint{}\n\tfor _, endpoint := range registeredEndpoints {\n\t\tendpoints = append(endpoints, endpoint)\n\t}\n\treturn endpoints\n}", "title": "" }, { "docid": "ff793c877f686e00795273cdcb7644dc", "score": "0.71636003", "text": "func (a *api) PublicEndpoints() []Endpoint {\n\treturn a.publicEndpoints\n}", "title": "" }, { "docid": "41dca8b8abebfdac5169ddbb273d7962", "score": "0.7117373", "text": "func (listener *Listener) GetEndpoints() []string {\n\treturn listener.endpoints\n}", "title": "" }, { "docid": "b998664eef40b68f8a0fd190efd8fab7", "score": "0.7051081", "text": "func (r *MyRouter) GetEndpoints() map[string]map[string]string {\n\treturn r.v1endpoints\n}", "title": "" }, { "docid": "94cf8b5e61b07ce5fd1b32bba97a30db", "score": "0.6938806", "text": "func (s *Server) GetEndpoints() []string {\n\treturn s.client.Endpoints()\n}", "title": "" }, { "docid": "7826a7d27c675f1b33485be1ea38beac", "score": "0.69227594", "text": "func (eps Endpoints) GetAll() (all []Endpoint) {\n\tfor _, client := range eps.Clients {\n\t\tall = append(all, client.Endpoint)\n\t}\n\tfor _, dnsSrv := range eps.DNSServers {\n\t\tall = append(all, dnsSrv.Endpoint)\n\t}\n\tfor _, ntpSrv := range eps.NTPServers {\n\t\tall = append(all, ntpSrv.Endpoint)\n\t}\n\tfor _, httpSrv := range eps.HTTPServers {\n\t\tall = append(all, httpSrv.Endpoint)\n\t}\n\tfor _, exProxy := range eps.ExplicitProxies {\n\t\tall = append(all, exProxy.Endpoint)\n\t}\n\tfor _, tProxy := range eps.TransparentProxies {\n\t\tall = append(all, tProxy.Endpoint)\n\t}\n\tfor _, netBootSrv := range eps.NetbootServers {\n\t\tall = append(all, netBootSrv.Endpoint)\n\t}\n\treturn all\n}", "title": "" }, { "docid": "9da0661033452cb0a97ce5ce32022817", "score": "0.6872306", "text": "func (m *AppsodyApplicationMonitoring) GetEndpoints() []prometheusv1.Endpoint {\n\treturn m.Endpoints\n}", "title": "" }, { "docid": "4eb26c85f72773ac14ec9761c19f9bb3", "score": "0.6846465", "text": "func (c *Client) Endpoints() (eps []string) {\n\t// copy the slice; protect original endpoints from being changed\n\teps = make([]string, len(c.cfg.Endpoints))\n\tcopy(eps, c.cfg.Endpoints)\n\treturn\n}", "title": "" }, { "docid": "4479d4845af8d481958b82fd911ec5ef", "score": "0.67970526", "text": "func (m *ServicePrincipal) GetEndpoints()([]Endpointable) {\n val, err := m.GetBackingStore().Get(\"endpoints\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Endpointable)\n }\n return nil\n}", "title": "" }, { "docid": "b12de40e18ec9bb2070ec0818a650a9e", "score": "0.679067", "text": "func (service *Service) Endpoints() ([]model.Endpoint, error) {\n\tvar endpoints = make([]model.Endpoint, 0)\n\n\terr := service.db.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(BucketName))\n\n\t\tcursor := bucket.Cursor()\n\t\tfor k, v := cursor.First(); k != nil; k, v = cursor.Next() {\n\t\t\tvar endpoint model.Endpoint\n\t\t\terr := internal.UnmarshalObjectWithJsoniter(v, &endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tendpoints = append(endpoints, endpoint)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn endpoints, err\n}", "title": "" }, { "docid": "8879cee9481431d04e09b7c6202d38ae", "score": "0.6742145", "text": "func (a *client) Endpoints() []environment.DeployedAppEndpoint {\n\tout := make([]environment.DeployedAppEndpoint, len(a.endpoints))\n\tfor i, e := range a.endpoints {\n\t\tout[i] = e\n\t}\n\treturn out\n}", "title": "" }, { "docid": "40b57aa8a9355af43cc80ed2c1d52767", "score": "0.6713459", "text": "func (obj *PropertyF) Endpoints() []*endpoint.Endpoint {\n\treturn obj.servant.Endpoints()\n}", "title": "" }, { "docid": "d5389f660a5c1a01b1b0d9a95698ab07", "score": "0.67041206", "text": "func (obj *StatF) Endpoints() []*endpoint.Endpoint {\n\treturn obj.servant.Endpoints()\n}", "title": "" }, { "docid": "94e4a10fa11d1512ba46a2f54e7c4811", "score": "0.6681944", "text": "func (s *Site) GetEndpoints() (endpoints []string) {\n\tconst scriptTemplate = `\n\t\tvar urls = [];\n\t\tvar endpoints = window.reactor.evaluate(['site_current', 'endpoints']);\n\t\tif(!endpoints){\n\t\t\treturn urls;\n\t\t}\n\n\t\tendpoints = endpoints.toJS();\n\t\tfor( var i = 0; i < endpoints.length; i ++){\n\t\t\tvar addressess = endpoints[i].addresses || []\n\t\t\taddressess.forEach( a => urls.push(a))\n\t\t} \n\t\treturn urls; `\n\n\tExpect(s.page.RunScript(scriptTemplate, nil, &endpoints)).To(Succeed())\n\treturn endpoints\n}", "title": "" }, { "docid": "a3d71cbc7bf4b73d5b3c829f9e2a6d27", "score": "0.6667564", "text": "func (c *configStruct) Endpoints() []string {\n\tc.endpointsMutex.RLock()\n\tdefer c.endpointsMutex.RUnlock()\n\n\tvar endpoints []string\n\tfor k := range c.endpoints {\n\t\tendpoints = append(endpoints, k)\n\t}\n\n\treturn endpoints\n}", "title": "" }, { "docid": "5fb120b32982aa263c2eb7a71e07163a", "score": "0.6607256", "text": "func (a *api) APIEndpoints() []Endpoint {\n\treturn a.endpoints\n}", "title": "" }, { "docid": "5be81540a1f52b3d59173eacc7e40388", "score": "0.6606822", "text": "func (s *Subscriber) Endpoints() ([]endpoint.Endpoint, error) {\n\treturn s.cache.Endpoints(), nil\n}", "title": "" }, { "docid": "1c03ee13aa1c029359544a779181fc49", "score": "0.6582088", "text": "func (c *endpointClient) List(ctx context.Context) ([]regapi.TerminationEndpoint, error) {\n\treq := &regapi.ListTerminationsRequest{}\n\n\tresp, err := c.client.ListTerminations(ctx, req)\n\tif err != nil {\n\t\tstat, ok := status.FromError(err)\n\t\tif ok {\n\t\t\treturn nil, errors.FromStatus(stat)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn resp.Endpoints, nil\n}", "title": "" }, { "docid": "369b0fdd6b8a52198620db0dca7cc208", "score": "0.65767264", "text": "func (fs *FixedSet) Endpoints() []string {\n\tfs.lock.RLock()\n\tdefer fs.lock.RUnlock()\n\n\treturn fs.endpoints\n}", "title": "" }, { "docid": "6d69dc170c3382e8cb95847bd454de2a", "score": "0.65525055", "text": "func (ep *EndpointCache) ListEndpoints() (epList []*bcstypes.BcsEndpoint) {\n\tfor _, item := range ep.Store.List() {\n\t\tepList = append(epList, item.(*bcstypes.BcsEndpoint))\n\t}\n\treturn epList\n}", "title": "" }, { "docid": "ffb7863d1b6dba6a23c282f979b12499", "score": "0.6545294", "text": "func (r *Client) ListEndpoints(tenant string) (eps []*workload.Endpoint, err error) {\n\topts := api.ListWatchOptions{}\n\topts.Tenant = tenant\n\tfor _, restcl := range r.restcls {\n\t\teps, err = restcl.WorkloadV1().Endpoint().List(r.ctx, &opts)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn eps, err\n}", "title": "" }, { "docid": "36af709db9da149e1b90b57bab115118", "score": "0.6464107", "text": "func GetEndpoints() (endpoints []*vnet.Endpoint) {\n\tendpoints = []*vnet.Endpoint{\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: createUser,\n\t\t\tComment: \"Create an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.PUT,\n\t\t\tURL: \"uman/user\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: updateUser,\n\t\t\tComment: \"Update an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.DELETE,\n\t\t\tURL: \"uman/user/:userID\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: deleteUser,\n\t\t\tComment: \"Delete an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.GET,\n\t\t\tURL: \"uman/user/:userID\",\n\t\t\tAccess: vsec.Monitor,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: getUser,\n\t\t\tComment: \"Get info about an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.GET,\n\t\t\tURL: \"uman/user\",\n\t\t\tAccess: vsec.Monitor,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: getUsers,\n\t\t\tComment: \"Get list of user & their details\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user/password\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: setPassword,\n\t\t\tComment: \"Set password for an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.PUT,\n\t\t\tURL: \"uman/user/password\",\n\t\t\tAccess: vsec.Monitor,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: resetPassword,\n\t\t\tComment: \"Reset password\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user/self\",\n\t\t\tAccess: vsec.Public,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: registerUser,\n\t\t\tComment: \"Registration for new user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user/verify/:userID/:verID\",\n\t\t\tAccess: vsec.Public,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: verify,\n\t\t\tComment: \"Verify a registered account\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.PUT,\n\t\t\tURL: \"/uman/user/self\",\n\t\t\tAccess: vsec.Public,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: updateProfile,\n\t\t},\n\t}\n\treturn endpoints\n\n}", "title": "" }, { "docid": "eb4a64268d9da158575264e5d32a8b1c", "score": "0.64114195", "text": "func (a *Api) apiEndpoint() []endpoint {\n\treturn a.endpoints\n}", "title": "" }, { "docid": "d6b5308b30fbdff739ee943cbe790aee", "score": "0.63907784", "text": "func GetAllEndpoints(provider *gophercloud.ProviderClient) ([]types.Endpoint, error) {\n\tendpointList := []types.Endpoint{}\n\n\tclient := openstack.NewIdentityV3(provider)\n\n\topts := endpoints.ListOpts{}\n\tpager := endpoints.List(client, opts)\n\tpage, err := pager.AllPages()\n\tif err != nil {\n\t\treturn endpointList, err\n\t}\n\n\tendpts, err := endpoints.ExtractEndpoints(page)\n\tif err != nil {\n\t\treturn endpointList, err\n\t}\n\n\tfor _, endpt := range endpts {\n\t\tendpointList = append(endpointList, types.Endpoint{\n\t\t\tID: endpt.ID,\n\t\t\tServiceID: endpt.ServiceID,\n\t\t\tURL: endpt.URL,\n\t\t\tRegion: endpt.Region,\n\t\t\t//Availability: endpt.Availability,\n\t\t\tName: endpt.Name,\n\t\t})\n\t}\n\n\treturn endpointList, nil\n}", "title": "" }, { "docid": "4e8a43234718d2f53d26e5d100eae1ff", "score": "0.637892", "text": "func (rr *RoundRobinLoadBalancer) GetEndpoints() ([]string, []string) {\n\tvar healthy, unhealthy []string\n\trr.servers.Do(func(s interface{}) {\n\t\tloadBalancingEndpoint, ok := s.(*LoadBalancerEndpoint)\n\t\tif ok {\n\t\t\tif loadBalancingEndpoint.Up {\n\t\t\t\thealthy = append(healthy, loadBalancingEndpoint.Address)\n\t\t\t} else {\n\t\t\t\tunhealthy = append(unhealthy, loadBalancingEndpoint.Address)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Error(\"Something unexpected found in endpoint map\")\n\t\t}\n\t})\n\n\treturn healthy, unhealthy\n}", "title": "" }, { "docid": "3695b2a5714cf96394cdcf7b34eea096", "score": "0.6339721", "text": "func EndpointsAll() *Endpoints {\n\tif cachedData != nil {\n\t\treturn cachedData.endpoints\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c791d55a7f736bd952055fdd1da3fca", "score": "0.63222015", "text": "func (s *Service) Endpoints() map[string]Endpoint {\n\tes := map[string]Endpoint{}\n\tfor id := range s.p.Services[s.id].Endpoints {\n\t\tes[id] = Endpoint{\n\t\t\tid: id,\n\t\t\tserviceID: s.id,\n\t\t\tp: s.p,\n\t\t}\n\t}\n\n\treturn es\n}", "title": "" }, { "docid": "93f83c58e92a3fd09acf7ac7579a0c57", "score": "0.63031185", "text": "func (rsb RedisServiceBinder) Endpoints(ctx context.Context, instanceID string) ([]Endpoint, error) {\n\treleases := findResourceRefs(rsb.resources, \"Release\")\n\thaproxy, err := findRelease(ctx, rsb.cp, releases, helmHaProxyRelease)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thpr := NewHaProxyResource(haproxy, rsb.cp)\n\thc, err := hpr.GetCredentials(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tep, err := mapRedisEndpoints(hc.(*HaProxyCredentials))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := make([]Endpoint, 0)\n\tfor _, v := range ep {\n\t\td = append(d, v)\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "b3d608d9336a75a1a25f75ff90097031", "score": "0.62736875", "text": "func (s *awsVpcEndpointLister) List(selector labels.Selector) (ret []*v1.AwsVpcEndpoint, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.AwsVpcEndpoint))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "11eacc4019601a577fd734bb23cbc5d2", "score": "0.6264615", "text": "func (cfg *Config) GetEndPoints() string {\n\treturn fmt.Sprintf(\"%s:%s/%s\", cfg.Websocket, cfg.Port, cfg.RestURI)\n}", "title": "" }, { "docid": "610962780f6add75d294a3d4f72e58ff", "score": "0.6245183", "text": "func (o GlusterfsVolumeSourceOutput) Endpoints() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GlusterfsVolumeSource) string { return v.Endpoints }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eed1d5033ec952de59d3e933ce759281", "score": "0.62414914", "text": "func getEndpoints() []endpoint {\n\treturn []endpoint{\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/createuser\",\n\t\t\thandler: HandleCreateUser,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/login\",\n\t\t\thandler: HandleLogin,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/comment\",\n\t\t\thandler: HandleComment,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/subcomment\",\n\t\t\thandler: HandleCreateSubcomment,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/reaction\",\n\t\t\thandler: HandleCreateReaction,\n\t\t},\n\t\t{\n\t\t\tmethod: get,\n\t\t\tpath: \"/wall\",\n\t\t\thandler: HandleGetWall,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b1bdedba3086f75b1dfdb7fd850500d7", "score": "0.62342423", "text": "func Endpoints() []string {\n\treturn []string{\n\t\t\"ability-scores\",\n\t\t\"classes\",\n\t\t\"conditions\",\n\t\t\"damage-types\",\n\t\t\"equipment-categories\",\n\t\t\"equipment\",\n\t\t\"features\",\n\t\t\"languages\",\n\t\t\"magic-schools\",\n\t\t\"monsters\",\n\t\t\"proficiencies\",\n\t\t\"races\",\n\t\t\"skills\",\n\t\t\"spellcasting\",\n\t\t\"spells\",\n\t\t\"starting-equipment\",\n\t\t\"subclasses\",\n\t\t\"subraces\",\n\t\t\"traits\",\n\t\t\"weapon-properties\",\n\t}\n}", "title": "" }, { "docid": "bb92bb544e9f09d80c570ecbadbef401", "score": "0.6233589", "text": "func (a *AppService) GetEndpoints(canCopy bool) []*corev1.Endpoints {\n\tif canCopy {\n\t\treturn append(a.endpoints[:0:0], a.endpoints...)\n\t}\n\treturn a.endpoints\n}", "title": "" }, { "docid": "c6d1febe9d824ad7379ee8adeb01e6eb", "score": "0.62322164", "text": "func (c *Cluster) EndPoints() []string {\n\tvar list []string\n\tlist = append(list, fmt.Sprintf(\"%s-grpc.%s:50000\", c.Name, c.Namespace))\n\treturn list\n}", "title": "" }, { "docid": "d4894c7cdd7b9560e0607b4c91602f05", "score": "0.62090886", "text": "func (e *tarsEndpointManager) GetAllEndpoint() []*endpoint.Endpoint {\n\teps := e.activeEp[:]\n\tout := make([]*endpoint.Endpoint, len(eps))\n\tfor i := 0; i < len(eps); i++ {\n\t\tout[i] = &eps[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "b13f8cec1f8f2f268d9139792e18027e", "score": "0.6184774", "text": "func listEndpoints(w http.ResponseWriter, req *http.Request) error {\n\tjs, err := json.Marshal(routes)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to marshal url routes to json\")\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t_, err = w.Write(js)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to write output\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01cdd8b5ad794171fc4c114470034e70", "score": "0.6184414", "text": "func getEndpoints(pod string) []string {\n\tresp, _ := http.Get(\"http://10.1.1.2:8080/api/v1beta1/endpoints/\" + pod + \"?namespace=default\")\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tvar endpoints v1beta1.Endpoints\n\tjson.Unmarshal(body, &endpoints)\n\treturn (endpoints.Endpoints)\n}", "title": "" }, { "docid": "e6b2b24f99c25f06af3dfbe3e626ee92", "score": "0.6179787", "text": "func (o ConfigOutput) Endpoints() EndpointResponseArrayOutput {\n\treturn o.ApplyT(func(v *Config) EndpointResponseArrayOutput { return v.Endpoints }).(EndpointResponseArrayOutput)\n}", "title": "" }, { "docid": "4218be96861c0b80332f20746f125b8b", "score": "0.61627454", "text": "func (o EndpointGroupOutput) Endpoints() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *EndpointGroup) pulumi.StringArrayOutput { return v.Endpoints }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "27a4629331bd5fbbdc3116f13cca287d", "score": "0.6150292", "text": "func (c *Client) ListEndpoints(namespace string, opts *k8s.ListOptions) (*k8s.EndpointsList, error) {\n\tvar out k8s.EndpointsList\n\t_, err := c.do(\"GET\", endpointsGeneratePath(namespace, \"\")+\"?\"+listOptionsQuery(opts), nil, &out)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to list Endpointss\")\n\t}\n\treturn &out, nil\n}", "title": "" }, { "docid": "51dc01a493e2b6e2149f6df9d6c51e2d", "score": "0.61255646", "text": "func (p *DataProvider) EndpointIPs(name, namespace string) (out []string, err error) {\n\tnamespace = p.namespace(namespace)\n\n\teps, err := p.Endpoints(name, namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, ss := range eps.Subsets {\n\t\tfor _, addr := range ss.Addresses {\n\t\t\tout = append(out, addr.IP)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "81e3b7d531c6244f6afa0c8c3ef82f5b", "score": "0.6078092", "text": "func (p *Publisher) Endpoints() ([]endpoint.Endpoint, error) {\n\tselect {\n\tcase endpoints := <-p.endpoints:\n\t\treturn endpoints, nil\n\tcase <-p.quit:\n\t\treturn nil, loadbalancer.ErrPublisherStopped\n\t}\n}", "title": "" }, { "docid": "0ad6f90c7fb35e417b8b61243c86f81d", "score": "0.60661584", "text": "func (d *Defaulter) APIEndpoints() ([]string, error) {\n\treturn []string{DefaultAPIEndpoint}, nil\n}", "title": "" }, { "docid": "0a3e7753af3e3028797fe52f05562f85", "score": "0.605956", "text": "func GetEndpoints() string {\n\treturn string(MustAsset(\"builtin/endpoints.yaml\"))\n}", "title": "" }, { "docid": "3ebb2a3de9b9370b3e7e7571eb78e17e", "score": "0.60576904", "text": "func (b *BaseService) Endpoints() Endpoints {\n\tfor _, e := range b.endpoints {\n\t\tif b.mw != nil {\n\t\t\te.Handler = AdaptHandlerFunc(e.Handler, b.mw...)\n\t\t}\n\t}\n\treturn b.endpoints\n}", "title": "" }, { "docid": "86d52a0e22b71e8e86121e4be3bf2e17", "score": "0.6027069", "text": "func getEndpointIPs(endpoints *v1.Endpoints) []string {\n\tips := make([]string, 0)\n\tif endpoints == nil || len(endpoints.Subsets) == 0 {\n\t\treturn ips\n\t}\n\tfor _, subset := range endpoints.Subsets {\n\t\tfor _, address := range subset.Addresses {\n\t\t\tips = append(ips, address.IP)\n\t\t}\n\t}\n\treturn ips\n}", "title": "" }, { "docid": "1a1dfd1f935bd531ea58022c83ab74e1", "score": "0.6026794", "text": "func (s awsVpcEndpointNamespaceLister) List(selector labels.Selector) (ret []*v1.AwsVpcEndpoint, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.AwsVpcEndpoint))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "7f79b116c56a8cbaf8542e353696a3a5", "score": "0.6015878", "text": "func (sw *SdkWrapper) ListNetworkEndpoints(project, zone, name string) (*compute.NetworkEndpointGroupsListNetworkEndpoints, error) {\n\tblog.V(3).Infof(\"ListNetworkEndpoints input: project/%s, zone/%s, name/%s\", project, zone, name)\n\n\tstartTime := time.Now()\n\n\tmf := func(ret string) {\n\t\tmetrics.ReportLibRequestMetric(\n\t\t\tSystemNameInMetric,\n\t\t\tHandlerNameInMetricSDK,\n\t\t\t\"ListNetworkEndpoints\", ret, startTime)\n\t}\n\tsw.tryThrottle()\n\n\tendpoints, err := sw.computeService.NetworkEndpointGroups.ListNetworkEndpoints(project, zone, name, nil).Do()\n\tif err != nil {\n\t\tmf(metrics.LibCallStatusErr)\n\t\terrMsg := fmt.Sprintf(\"ListNetworkEndpoints failed, err %s\", err.Error())\n\t\tblog.Errorf(errMsg)\n\t\treturn nil, fmt.Errorf(errMsg)\n\t}\n\tblog.V(3).Infof(\"ListNetworkEndpoints response: %s\", common.ToJsonString(endpoints))\n\tmf(metrics.LibCallStatusOK)\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "7f79b116c56a8cbaf8542e353696a3a5", "score": "0.6015878", "text": "func (sw *SdkWrapper) ListNetworkEndpoints(project, zone, name string) (*compute.NetworkEndpointGroupsListNetworkEndpoints, error) {\n\tblog.V(3).Infof(\"ListNetworkEndpoints input: project/%s, zone/%s, name/%s\", project, zone, name)\n\n\tstartTime := time.Now()\n\n\tmf := func(ret string) {\n\t\tmetrics.ReportLibRequestMetric(\n\t\t\tSystemNameInMetric,\n\t\t\tHandlerNameInMetricSDK,\n\t\t\t\"ListNetworkEndpoints\", ret, startTime)\n\t}\n\tsw.tryThrottle()\n\n\tendpoints, err := sw.computeService.NetworkEndpointGroups.ListNetworkEndpoints(project, zone, name, nil).Do()\n\tif err != nil {\n\t\tmf(metrics.LibCallStatusErr)\n\t\terrMsg := fmt.Sprintf(\"ListNetworkEndpoints failed, err %s\", err.Error())\n\t\tblog.Errorf(errMsg)\n\t\treturn nil, fmt.Errorf(errMsg)\n\t}\n\tblog.V(3).Infof(\"ListNetworkEndpoints response: %s\", common.ToJsonString(endpoints))\n\tmf(metrics.LibCallStatusOK)\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "d9c0f653caa8a2e5686f63e11982e95b", "score": "0.6012535", "text": "func (sc *fakeSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) {\n\tendpoints := make([]*endpoint.Endpoint, 10)\n\n\tfor i := 0; i < 10; i++ {\n\t\tendpoints[i], _ = sc.generateEndpoint()\n\t}\n\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "58b6fc0a20afb707a477fccebc2255db", "score": "0.60120976", "text": "func (c *Client) List(ctx context.Context, p *ListPayload) (res *ListResult, err error) {\n\tvar ires interface{}\n\tires, err = c.ListEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*ListResult), nil\n}", "title": "" }, { "docid": "58b6fc0a20afb707a477fccebc2255db", "score": "0.60120976", "text": "func (c *Client) List(ctx context.Context, p *ListPayload) (res *ListResult, err error) {\n\tvar ires interface{}\n\tires, err = c.ListEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*ListResult), nil\n}", "title": "" }, { "docid": "081f8a8d6dfa21949d8dda67bb8a5e6c", "score": "0.60037774", "text": "func (e *EndpointManager) GetAllEndpoint() []*endpoint.Endpoint {\r\n\tes := make([]*endpoint.Endpoint, len(e.index))\r\n\te.mlock.Lock()\r\n\tdefer e.mlock.Unlock()\r\n\tfor i, v := range e.index {\r\n\t\te := v.(endpoint.Endpoint)\r\n\t\tes[i] = &e\r\n\t}\r\n\treturn es\r\n}", "title": "" }, { "docid": "2c8f8765ed116884f4fb43f3f80e216e", "score": "0.59756446", "text": "func (msb MariadbServiceBinder) Endpoints(ctx context.Context, instanceID string) ([]Endpoint, error) {\n\treturn []Endpoint{}, nil\n}", "title": "" }, { "docid": "9d4509858943f9bb5723fa90107a98d6", "score": "0.59721744", "text": "func (i *FileIndex) Endpoints() ([]string, error) {\n\ti.m.RLock()\n\tdefer i.m.RUnlock()\n\n\tendpoints := make([]string, len(i.idxmap))\n\tn := 0\n\tfor k := range i.idxmap {\n\t\tendpoints[n] = k\n\t\tn++\n\t}\n\n\tsort.Strings(endpoints)\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "30ffb0ed3ad7e5c957381052fd43aa94", "score": "0.5958958", "text": "func (oc *Controller) WatchEndpoints() {\n\toc.loadbalancerClusterCache = make(map[string]string)\n\n\toc.StartEndpointWatch(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tep := obj.(*kapi.Endpoints)\n\t\t\terr := oc.addEndpoints(ep)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"Error in adding load balancer: %v\", err)\n\t\t\t}\n\t\t},\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tepNew := new.(*kapi.Endpoints)\n\t\t\tepOld := old.(*kapi.Endpoints)\n\t\t\tif reflect.DeepEqual(epNew.Subsets, epOld.Subsets) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(epNew.Subsets) == 0 {\n\t\t\t\terr := oc.deleteEndpoints(epNew)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"Error in deleting endpoints - %v\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr := oc.addEndpoints(epNew)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"Error in modifying endpoints: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tep, ok := obj.(*kapi.Endpoints)\n\t\t\tif !ok {\n\t\t\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\t\t\tif !ok {\n\t\t\t\t\tlogrus.Errorf(\"couldn't get object from tombstone %+v\", obj)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tep, ok = tombstone.Obj.(*kapi.Endpoints)\n\t\t\t\tif !ok {\n\t\t\t\t\tlogrus.Errorf(\"tombstone contained object that is not a pod %#v\", obj)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\terr := oc.deleteEndpoints(ep)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"Error in deleting endpoints - %v\", err)\n\t\t\t}\n\t\t\treturn\n\t\t},\n\t})\n}", "title": "" }, { "docid": "fb926b687179e56338888c7f3dbc68c0", "score": "0.59550065", "text": "func endpointIPs(name, namespace string) (cmdOut []byte, err error) {\n\n\tkctl := os.Getenv(\"KUBECTL\")\n\n\tif kctl == \"\" {\n\t\tkctl = \"kubectl\"\n\t}\n\tcmdArgs := kctl + \" -n \" + name + \" get endpoints \" + namespace + \" -o jsonpath={.subsets[*].addresses[*].ip}\"\n\tif cmdOut, err = exec.Command(\"sh\", \"-c\", cmdArgs).Output(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn cmdOut, nil\n}", "title": "" }, { "docid": "03c0f1981d2e104b05c509cfbf0c65f3", "score": "0.59428287", "text": "func (o StandaloneSpecVolumesGlusterfsOutput) Endpoints() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StandaloneSpecVolumesGlusterfs) string { return v.Endpoints }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2fd9d4644bd2d1eac3cbd44b7b859569", "score": "0.59309113", "text": "func (p *DNSSRV) Endpoints(service string) (value.Endpoints, error) {\n\tclient := dns.Client{}\n\trequest := dns.Msg{}\n\trequest.SetQuestion(fmt.Sprintf(\"_%s._.service.consul.\", service), dns.TypeSRV)\n\n\t// log.Printf(\"request\\n%s\\n\", request.String())\n\n\tresponse, _, err := client.Exchange(&request, p.address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// log.Printf(\"response\\n%s\\n\", response)\n\n\thosts := make(map[string]string)\n\tfor _, rr := range response.Extra {\n\t\tswitch rr := rr.(type) {\n\t\tcase *dns.A:\n\t\t\thosts[rr.Hdr.Name] = rr.A.String()\n\t\tcase *dns.CNAME:\n\t\t\thosts[rr.Hdr.Name] = strings.TrimSuffix(rr.Target, \".\")\n\t\t}\n\t}\n\n\tendpoints := value.Endpoints{}\n\tfor _, rr := range response.Answer {\n\t\tswitch rr := rr.(type) {\n\t\tcase *dns.SRV:\n\t\t\thost, ok := hosts[rr.Target]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tendpoint := value.NewEndpoint(p.endpointNetwork, net.JoinHostPort(host, strconv.Itoa(int(rr.Port))))\n\t\t\tendpoints = append(endpoints, endpoint)\n\t\t}\n\t}\n\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "98791da4391066b7e591e2b72a8245c3", "score": "0.59231466", "text": "func (o GlusterfsPersistentVolumeSourceOutput) Endpoints() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GlusterfsPersistentVolumeSource) string { return v.Endpoints }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b3a3a0ea4f097e5ef727bd22ac108cd8", "score": "0.591385", "text": "func (o IndexerClusterSpecVolumesGlusterfsOutput) Endpoints() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IndexerClusterSpecVolumesGlusterfs) string { return v.Endpoints }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "402ecc82bbbdc0742b4938476abfe8f0", "score": "0.59118986", "text": "func (o EndpointSliceTypeOutput) Endpoints() EndpointArrayOutput {\n\treturn o.ApplyT(func(v EndpointSliceType) []Endpoint { return v.Endpoints }).(EndpointArrayOutput)\n}", "title": "" }, { "docid": "8c51a420055dcb49e1a18e60a59d05ae", "score": "0.5911591", "text": "func (c *dNSEndpoints) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DNSEndpointList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1.DNSEndpointList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"dnsendpoints\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "5a20cb0c06af47b1012e32ed242be277", "score": "0.5900925", "text": "func (h *httpServer) List(c echo.Context) error {\n\tports, err := h.impl.ListExposed(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(200, ports)\n}", "title": "" }, { "docid": "7f9e64f55737530774034a498516a49c", "score": "0.589886", "text": "func (cl *ConsulLookup) getEndpoints() []*Endpoint {\n\tcl.endpointsMu.Lock()\n\tdefer cl.endpointsMu.Unlock()\n\n\tresult := cl.endpoints\n\treturn result\n}", "title": "" }, { "docid": "7e87ba99fdc2ca5619bbdbb75bfb36d4", "score": "0.58963364", "text": "func (g *GCEBetaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *beta.NetworkEndpointGroupsListEndpointsRequest, fl *filter.F) ([]*beta.NetworkEndpointWithHealthStatus, error) {\n\tklog.V(5).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): called\", ctx, key)\n\n\tif !key.Valid() {\n\t\tklog.V(2).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): key is invalid (%#v)\", ctx, key, key)\n\t\treturn nil, fmt.Errorf(\"invalid GCE key (%+v)\", key)\n\t}\n\tprojectID := g.s.ProjectRouter.ProjectID(ctx, \"beta\", \"NetworkEndpointGroups\")\n\trk := &RateLimitKey{\n\t\tProjectID: projectID,\n\t\tOperation: \"ListNetworkEndpoints\",\n\t\tVersion: meta.Version(\"beta\"),\n\t\tService: \"NetworkEndpointGroups\",\n\t}\n\tklog.V(5).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, rk = %+v\", ctx, key, projectID, rk)\n\n\tif err := g.s.RateLimiter.Accept(ctx, rk); err != nil {\n\t\tklog.V(4).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v\", ctx, key, err)\n\t\treturn nil, err\n\t}\n\tcall := g.s.Beta.NetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Zone, key.Name, arg0)\n\tvar all []*beta.NetworkEndpointWithHealthStatus\n\tf := func(l *beta.NetworkEndpointGroupsListNetworkEndpoints) error {\n\t\tklog.V(5).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v\", ctx, key, l)\n\t\tall = append(all, l.Items...)\n\t\treturn nil\n\t}\n\tif err := call.Pages(ctx, f); err != nil {\n\t\tklog.V(4).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v\", ctx, key, nil, err)\n\t\treturn nil, err\n\t}\n\tif klog.V(4).Enabled() {\n\t\tklog.V(4).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v\", ctx, key, len(all), nil)\n\t} else if klog.V(5).Enabled() {\n\t\tvar asStr []string\n\t\tfor _, o := range all {\n\t\t\tasStr = append(asStr, fmt.Sprintf(\"%+v\", o))\n\t\t}\n\t\tklog.V(5).Infof(\"GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v\", ctx, key, asStr, nil)\n\t}\n\treturn all, nil\n}", "title": "" }, { "docid": "330d21e2ed1ddefee3f6b41be5cab48d", "score": "0.588866", "text": "func (o LicenseMasterSpecVolumesGlusterfsOutput) Endpoints() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LicenseMasterSpecVolumesGlusterfs) string { return v.Endpoints }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0141cce85f9ef7b25174773d749a83ba", "score": "0.58861345", "text": "func (wf *WatchFactory) GetEndpoints(namespace string) ([]*kapi.Endpoints, error) {\n\tendpointsLister := wf.informers[endpointsType].lister.(listers.EndpointsLister)\n\treturn endpointsLister.Endpoints(namespace).List(labels.Everything())\n}", "title": "" }, { "docid": "d7df2088b442559ba6d3084927192942", "score": "0.5877782", "text": "func (g *GCENetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *ga.NetworkEndpointGroupsListEndpointsRequest, fl *filter.F) ([]*ga.NetworkEndpointWithHealthStatus, error) {\n\tklog.V(5).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): called\", ctx, key)\n\n\tif !key.Valid() {\n\t\tklog.V(2).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): key is invalid (%#v)\", ctx, key, key)\n\t\treturn nil, fmt.Errorf(\"invalid GCE key (%+v)\", key)\n\t}\n\tprojectID := g.s.ProjectRouter.ProjectID(ctx, \"ga\", \"NetworkEndpointGroups\")\n\trk := &RateLimitKey{\n\t\tProjectID: projectID,\n\t\tOperation: \"ListNetworkEndpoints\",\n\t\tVersion: meta.Version(\"ga\"),\n\t\tService: \"NetworkEndpointGroups\",\n\t}\n\tklog.V(5).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, rk = %+v\", ctx, key, projectID, rk)\n\n\tif err := g.s.RateLimiter.Accept(ctx, rk); err != nil {\n\t\tklog.V(4).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v\", ctx, key, err)\n\t\treturn nil, err\n\t}\n\tcall := g.s.GA.NetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Zone, key.Name, arg0)\n\tvar all []*ga.NetworkEndpointWithHealthStatus\n\tf := func(l *ga.NetworkEndpointGroupsListNetworkEndpoints) error {\n\t\tklog.V(5).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v\", ctx, key, l)\n\t\tall = append(all, l.Items...)\n\t\treturn nil\n\t}\n\tif err := call.Pages(ctx, f); err != nil {\n\t\tklog.V(4).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v\", ctx, key, nil, err)\n\t\treturn nil, err\n\t}\n\tif klog.V(4).Enabled() {\n\t\tklog.V(4).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v\", ctx, key, len(all), nil)\n\t} else if klog.V(5).Enabled() {\n\t\tvar asStr []string\n\t\tfor _, o := range all {\n\t\t\tasStr = append(asStr, fmt.Sprintf(\"%+v\", o))\n\t\t}\n\t\tklog.V(5).Infof(\"GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v\", ctx, key, asStr, nil)\n\t}\n\treturn all, nil\n}", "title": "" }, { "docid": "a9f8cfe634fa2f50c58da20538b9949e", "score": "0.58554375", "text": "func (g *GCEAlphaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsListEndpointsRequest, fl *filter.F) ([]*alpha.NetworkEndpointWithHealthStatus, error) {\n\tklog.V(5).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): called\", ctx, key)\n\n\tif !key.Valid() {\n\t\tklog.V(2).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): key is invalid (%#v)\", ctx, key, key)\n\t\treturn nil, fmt.Errorf(\"invalid GCE key (%+v)\", key)\n\t}\n\tprojectID := g.s.ProjectRouter.ProjectID(ctx, \"alpha\", \"NetworkEndpointGroups\")\n\trk := &RateLimitKey{\n\t\tProjectID: projectID,\n\t\tOperation: \"ListNetworkEndpoints\",\n\t\tVersion: meta.Version(\"alpha\"),\n\t\tService: \"NetworkEndpointGroups\",\n\t}\n\tklog.V(5).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, rk = %+v\", ctx, key, projectID, rk)\n\n\tif err := g.s.RateLimiter.Accept(ctx, rk); err != nil {\n\t\tklog.V(4).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v\", ctx, key, err)\n\t\treturn nil, err\n\t}\n\tcall := g.s.Alpha.NetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Zone, key.Name, arg0)\n\tvar all []*alpha.NetworkEndpointWithHealthStatus\n\tf := func(l *alpha.NetworkEndpointGroupsListNetworkEndpoints) error {\n\t\tklog.V(5).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v\", ctx, key, l)\n\t\tall = append(all, l.Items...)\n\t\treturn nil\n\t}\n\tif err := call.Pages(ctx, f); err != nil {\n\t\tklog.V(4).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v\", ctx, key, nil, err)\n\t\treturn nil, err\n\t}\n\tif klog.V(4).Enabled() {\n\t\tklog.V(4).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v\", ctx, key, len(all), nil)\n\t} else if klog.V(5).Enabled() {\n\t\tvar asStr []string\n\t\tfor _, o := range all {\n\t\t\tasStr = append(asStr, fmt.Sprintf(\"%+v\", o))\n\t\t}\n\t\tklog.V(5).Infof(\"GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v\", ctx, key, asStr, nil)\n\t}\n\treturn all, nil\n}", "title": "" }, { "docid": "dc6c6aa339d35cea6244659f08cbb8fc", "score": "0.58542943", "text": "func (s *SimpleService) Endpoints() map[string]map[string]http.HandlerFunc {\n\treturn map[string]map[string]http.HandlerFunc{\n\t\t\"/most-popular/{resourceType}/{section}/{timeframe}\": map[string]http.HandlerFunc{\n\t\t\t\"GET\": server.JSONToHTTP(s.GetMostPopular).ServeHTTP,\n\t\t},\n\t\t\"/cats\": map[string]http.HandlerFunc{\n\t\t\t\"GET\": s.GetCats,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3a980e5918894f1d291c65d17800ced0", "score": "0.5815056", "text": "func (o GlusterfsVolumeSourcePatchOutput) Endpoints() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GlusterfsVolumeSourcePatch) *string { return v.Endpoints }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "13b994ee604ea044d700d8da3495ed05", "score": "0.5812749", "text": "func (api *FakeAPI) GetEndpoints() map[string]config.Endpoint {\n\targs := api.Called()\n\treturn args.Get(0).(map[string]config.Endpoint)\n}", "title": "" }, { "docid": "0b1284707fe48fa808047ac6dd5758d6", "score": "0.58038956", "text": "func (gs *glooSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) {\n\tendpoints := []*endpoint.Endpoint{}\n\n\tproxies, err := gs.dynamicKubeClient.Resource(proxyGVR).Namespace(gs.glooNamespace).List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, obj := range proxies.Items {\n\t\tproxy := proxy{}\n\t\tjsonString, err := obj.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = json.Unmarshal(jsonString, &proxy)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Debugf(\"Gloo: Find %s proxy\", proxy.Metadata.Name)\n\t\tproxyTargets, err := gs.proxyTargets(ctx, proxy.Metadata.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Debugf(\"Gloo[%s]: Find %d target(s) (%+v)\", proxy.Metadata.Name, len(proxyTargets), proxyTargets)\n\t\tproxyEndpoints, err := gs.generateEndpointsFromProxy(ctx, &proxy, proxyTargets)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Debugf(\"Gloo[%s]: Generate %d endpoint(s)\", proxy.Metadata.Name, len(proxyEndpoints))\n\t\tendpoints = append(endpoints, proxyEndpoints...)\n\t}\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "498578374a7626ab0de07f46138d13fc", "score": "0.5793481", "text": "func (k K8s) GetEndpoints(namespace, name string) (endpoints map[string]*PortEndpoints, err error) {\n\tns, nsOk := k.Namespaces[namespace]\n\tif !nsOk {\n\t\treturn nil, fmt.Errorf(\"service '%s/%s' does not exist, namespace not found\", namespace, name)\n\t}\n\tslices, ok := ns.Endpoints[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"endpoints for service '%s/%s', does not exist\", namespace, name)\n\t}\n\tendpoints = make(map[string]*PortEndpoints)\n\tfor sliceName := range slices {\n\t\tfor portName, portEndpoints := range slices[sliceName].Ports {\n\t\t\tendpoints[portName] = portEndpoints\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8aee0c0e2407d3e79019568fe6c57c58", "score": "0.57823306", "text": "func (o SearchHeadClusterSpecVolumesGlusterfsOutput) Endpoints() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SearchHeadClusterSpecVolumesGlusterfs) string { return v.Endpoints }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "faef73eb46a245bb37ce09cf63662132", "score": "0.5763248", "text": "func ListExpose(expose Expose, kubeClientset kubernetes.Interface) error {\n\tdeploy, hpa, err := listDeployments(expose, kubeClientset)\n\n\tservices, err2 := listServices(expose, kubeClientset)\n\tingress, err3 := listIngress(expose, kubeClientset)\n\tif err != nil {\n\t\tlog.Printf(\"WARNING: %v\\n\", err)\n\t\treturn err\n\t}\n\tif err2 != nil {\n\t\tlog.Printf(\"WARNING: %v\\n\", err2)\n\t\treturn err\n\t}\n\tif err3 != nil {\n\t\tlog.Printf(\"WARNING: %v\\n\", err3)\n\t\treturn err\n\t}\n\tfmt.Println(deploy, hpa, services, ingress)\n\treturn nil\n\n}", "title": "" }, { "docid": "d13e4f158751c8955b7a72f96c9b195c", "score": "0.57601666", "text": "func (s k8sStore) ListIngresses() []*extensions.Ingress {\n\t// filter ingress rules\n\tvar ingresses []*extensions.Ingress\n\tfor _, item := range s.listers.Ingress.List() {\n\t\ting := item.(*extensions.Ingress)\n\t\tif !class.IsValid(ing) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor ri, rule := range ing.Spec.Rules {\n\t\t\tif rule.HTTP == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor pi, path := range rule.HTTP.Paths {\n\t\t\t\tif path.Path == \"\" {\n\t\t\t\t\ting.Spec.Rules[ri].HTTP.Paths[pi].Path = \"/\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tingresses = append(ingresses, ing)\n\t}\n\n\treturn ingresses\n}", "title": "" }, { "docid": "94a1124341afbf6643a13f35d143d15e", "score": "0.5756001", "text": "func (a *apiServer) ListHTTPEndpoints(ctx context.Context, in *operatorv1pb.ListHTTPEndpointsRequest) (*operatorv1pb.ListHTTPEndpointsResponse, error) {\n\tresp := &operatorv1pb.ListHTTPEndpointsResponse{\n\t\tHttpEndpoints: [][]byte{},\n\t}\n\n\tvar endpoints httpendpointsapi.HTTPEndpointList\n\tif err := a.Client.List(ctx, &endpoints, &client.ListOptions{\n\t\tNamespace: in.Namespace,\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing http endpoints: %w\", err)\n\t}\n\n\tfor i, item := range endpoints.Items {\n\t\te := endpoints.Items[i]\n\t\terr := processHTTPEndpointSecrets(ctx, &e, item.Namespace, a.Client)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"error processing secrets for http endpoint '%s/%s': %s\", item.Namespace, item.Name, err)\n\t\t\treturn &operatorv1pb.ListHTTPEndpointsResponse{}, err\n\t\t}\n\n\t\tb, err := json.Marshal(e)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Error unmarshalling http endpoints: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tresp.HttpEndpoints = append(resp.HttpEndpoints, b)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "9488388a7e365c93aa7dbfb955c486a9", "score": "0.57526046", "text": "func (o ContainerCodePackagePropertiesOutput) Endpoints() EndpointPropertiesArrayOutput {\n\treturn o.ApplyT(func(v ContainerCodePackageProperties) []EndpointProperties { return v.Endpoints }).(EndpointPropertiesArrayOutput)\n}", "title": "" }, { "docid": "847c59e50253305482edddcac0170527", "score": "0.5740934", "text": "func (iClient *Client) List(ctx context.Context, namespace, labels string) ([]metav1.Object, error) {\n\tresult := []metav1.Object{}\n\tif iClient.isV1 {\n\t\tiList, err := iClient.c.NetworkingV1().Ingresses(namespace).List(ctx, metav1.ListOptions{LabelSelector: labels})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor i := range iList.Items {\n\t\t\tresult = append(result, iList.Items[i].GetObjectMeta())\n\t\t}\n\t\treturn result, nil\n\t}\n\n\tiList, err := iClient.c.NetworkingV1beta1().Ingresses(namespace).List(ctx, metav1.ListOptions{LabelSelector: labels})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i := range iList.Items {\n\t\tresult = append(result, iList.Items[i].GetObjectMeta())\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5651334aaf76258f316f747186bfe768", "score": "0.5724542", "text": "func (s *MixedService) Endpoints() map[string]map[string]http.HandlerFunc {\n\treturn map[string]map[string]http.HandlerFunc{\n\t\t\"/cats\": map[string]http.HandlerFunc{\n\t\t\t\"GET\": s.GetCats,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ac47ba4495734825a762be252a57429b", "score": "0.57237464", "text": "func (e *Endpoint) GetOperations() []models.EndpointOperation {\n\treturn e.Operations\n}", "title": "" }, { "docid": "da3f102cba373c9419fdd948fcd5bb56", "score": "0.57206637", "text": "func (o EndpointSlicePatchTypeOutput) Endpoints() EndpointPatchArrayOutput {\n\treturn o.ApplyT(func(v EndpointSlicePatchType) []EndpointPatch { return v.Endpoints }).(EndpointPatchArrayOutput)\n}", "title": "" }, { "docid": "d71819160e7b3a29f9038147890d57fd", "score": "0.5711401", "text": "func (o ImageBuilderOutput) AccessEndpoints() ImageBuilderAccessEndpointArrayOutput {\n\treturn o.ApplyT(func(v *ImageBuilder) ImageBuilderAccessEndpointArrayOutput { return v.AccessEndpoints }).(ImageBuilderAccessEndpointArrayOutput)\n}", "title": "" }, { "docid": "dfe6286643907b85ad5a42ab9c2bdf8d", "score": "0.57112837", "text": "func (m *Machine) GetEndpoints(namespace string, name string) (*corev1.Endpoints, error) {\n\tep, err := m.Clientset.CoreV1().Endpoints(namespace).Get(name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn ep, errors.Wrapf(err, \"failed to get endpoint '%s'\", ep)\n\t}\n\n\treturn ep, nil\n}", "title": "" }, { "docid": "a3b16df0b2871003c674c032d456f312", "score": "0.5708203", "text": "func (a *EndpointsApiService) EndpointList(ctx context.Context) (model.EndpointListResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue = make(model.EndpointListResponse, 0)\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/endpoints\"\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\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAccessToken).(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[\"Authorization\"] = key\n\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\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, \"application/json\")\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\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v model.GenericError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "bd9c019e1e1139072f142b881906aa38", "score": "0.5707352", "text": "func (o FallbackRouteOutput) EndpointNames() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FallbackRoute) pulumi.StringOutput { return v.EndpointNames }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e1d84586c0c9eb7ca2ab7adc7deea101", "score": "0.5703057", "text": "func (m *Machine) GetEndpoints(namespace string, name string) (*corev1.Endpoints, error) {\n\tep, err := m.Clientset.CoreV1().Endpoints(namespace).Get(context.Background(), name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn ep, errors.Wrapf(err, \"failed to get endpoint '%s'\", ep)\n\t}\n\n\treturn ep, nil\n}", "title": "" }, { "docid": "8e16b99fe9f8978fa00c03f169e50ebf", "score": "0.56966907", "text": "func (c *Client) ListEndpoints(ctx context.Context, params *ListEndpointsInput, optFns ...func(*Options)) (*ListEndpointsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListEndpointsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListEndpoints\", params, optFns, c.addOperationListEndpointsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListEndpointsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "c6554bd71744d44a0e27d364f31845aa", "score": "0.56958526", "text": "func GetEndpoints(ctx context.Context, namespace string) ([]v1.Endpoints, error) {\n\treturn client.GetEndpoints(ctx, namespace)\n}", "title": "" }, { "docid": "e5114f74b9f952d4811f3ce5793452b0", "score": "0.5691822", "text": "func (cs *crdSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) {\n\tendpoints := []*endpoint.Endpoint{}\n\n\tvar (\n\t\tresult *endpoint.DNSEndpointList\n\t\terr error\n\t)\n\n\tresult, err = cs.List(ctx, &metav1.ListOptions{LabelSelector: cs.labelSelector.String()})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err = cs.filterByAnnotations(result)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, dnsEndpoint := range result.Items {\n\t\t// Make sure that all endpoints have targets for A or CNAME type\n\t\tcrdEndpoints := []*endpoint.Endpoint{}\n\t\tfor _, ep := range dnsEndpoint.Spec.Endpoints {\n\t\t\tif (ep.RecordType == \"CNAME\" || ep.RecordType == \"A\" || ep.RecordType == \"AAAA\") && len(ep.Targets) < 1 {\n\t\t\t\tlog.Warnf(\"Endpoint %s with DNSName %s has an empty list of targets\", dnsEndpoint.ObjectMeta.Name, ep.DNSName)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tillegalTarget := false\n\t\t\tfor _, target := range ep.Targets {\n\t\t\t\tif strings.HasSuffix(target, \".\") {\n\t\t\t\t\tillegalTarget = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif illegalTarget {\n\t\t\t\tlog.Warnf(\"Endpoint %s with DNSName %s has an illegal target. The subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com')\", dnsEndpoint.ObjectMeta.Name, ep.DNSName)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif ep.Labels == nil {\n\t\t\t\tep.Labels = endpoint.NewLabels()\n\t\t\t}\n\n\t\t\tcrdEndpoints = append(crdEndpoints, ep)\n\t\t}\n\n\t\tcs.setResourceLabel(&dnsEndpoint, crdEndpoints)\n\t\tendpoints = append(endpoints, crdEndpoints...)\n\n\t\tif dnsEndpoint.Status.ObservedGeneration == dnsEndpoint.Generation {\n\t\t\tcontinue\n\t\t}\n\n\t\tdnsEndpoint.Status.ObservedGeneration = dnsEndpoint.Generation\n\t\t// Update the ObservedGeneration\n\t\t_, err = cs.UpdateStatus(ctx, &dnsEndpoint)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Could not update ObservedGeneration of the CRD: %v\", err)\n\t\t}\n\t}\n\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "0465305ca80bdd0edfc9766919337e47", "score": "0.5674942", "text": "func (a SimpleEndpointsAccessor) EndpointsByHostnameIP(_ string) ([]*api.Endpoints, error) {\n\treturn nil, errNotSupported\n}", "title": "" }, { "docid": "4c90417090c4b9fa1d1f4872e1f12d00", "score": "0.56716895", "text": "func List(ctx context.Context, namespace, labels string, c kubernetes.Interface) ([]networkingv1.Ingress, error) {\n\tiList, err := c.NetworkingV1().Ingresses(namespace).List(\n\t\tctx,\n\t\tmetav1.ListOptions{\n\t\t\tLabelSelector: labels,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn iList.Items, nil\n}", "title": "" }, { "docid": "e637b1aae428cf8e4e0ced10d7f2f956", "score": "0.56712574", "text": "func NewListEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\treturn s.List(ctx)\n\t}\n}", "title": "" }, { "docid": "176ec99b4777e6cf24c84cbe2e026f0e", "score": "0.56569266", "text": "func (o GlusterfsVolumeSourcePtrOutput) Endpoints() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GlusterfsVolumeSource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Endpoints\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dd39dc2302fbe70c7bfbd753929f72ed", "score": "0.5652262", "text": "func GetEndpoints(name string, managementClientParam toolbox.GRPCClientParam) ([]string, error) {\n\topts, err := toolbox.GetGRPCDialOpts(managementClientParam)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn, err := grpc.Dial(managementClientParam.ServerEndpoint, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := managepb.NewClusterManagementClient(conn)\n\n\t// TODO: use parameter for timeout. Maybe include in grpc client params. Defaults 1s\n\tctx, done := context.WithTimeout(context.Background(), 1*time.Second)\n\tdefer done()\n\tres, err := client.FindEndpoint(ctx, &managepb.EndpointRequest{\n\t\tEndpointName: name,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.Error != nil {\n\t\treturn nil, errors.New(res.Error.Message)\n\t}\n\n\tvar ret []string\n\tfor _, v := range res.Endpoints {\n\t\tret = append(ret, v.HostPort)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "647e1ee18574b5f9c5562c86f25b3e2a", "score": "0.56451476", "text": "func (e Endpoints) List(ctx context.Context, post model.Post) (response []*pb.Post, err error) {\n\trequest := ListRequest{Post: post}\n\tresponse0, err := e.ListEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response0.(ListResponse).Response, response0.(ListResponse).Err\n}", "title": "" }, { "docid": "0080363eefa8779fe2e6a21a6c35a8dc", "score": "0.5628497", "text": "func (o StandaloneSpecVolumesGlusterfsPtrOutput) Endpoints() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *StandaloneSpecVolumesGlusterfs) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Endpoints\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2fcde1408faf7b7d272aeb7ef52dff9a", "score": "0.56254363", "text": "func (m *module) GetEndpointPrefixes() []string {\n\tif !m.initialized {\n\t\treturn []string{}\n\t}\n\treturn []string{\"/sampleplugin\", \"/sampleplugin/status\"}\n}", "title": "" } ]
6c30fc7ba7047743d048c527c75ec770
Hub defines the current version (v1beta2) is the storage version so mark this as Hub
[ { "docid": "b8447802f9356c4676cb52c338ba3d40", "score": "0.63504744", "text": "func (bt *BackupTarget) Hub() {}", "title": "" } ]
[ { "docid": "d66cd3eb06ece157e1d622ba26f4bae1", "score": "0.641724", "text": "func (*HcloudVolumeList) Hub() {}", "title": "" }, { "docid": "0eafbef80745ac6840a2bf861eabecd4", "score": "0.6358766", "text": "func (*HcloudVolume) Hub() {}", "title": "" }, { "docid": "e11f9613d428c7f240617ff7e392e3d7", "score": "0.62229466", "text": "func (bi *BackingImage) Hub() {}", "title": "" }, { "docid": "46843aa0ff286ec5b131017681539dba", "score": "0.6021929", "text": "func (ei *EngineImage) Hub() {}", "title": "" }, { "docid": "c440d46a87f18666ec4b244ea60d90e9", "score": "0.59173924", "text": "func (o *SystemProfileAnsible) SetHubVersion(v string) {\n\to.HubVersion = &v\n}", "title": "" }, { "docid": "8e9c4aec099385a967cf028c884f735c", "score": "0.5812556", "text": "func (o *SystemProfileAnsible) GetHubVersion() string {\n\tif o == nil || o.HubVersion == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.HubVersion\n}", "title": "" }, { "docid": "5a291034ccea34e6b05ba0d11d3b2bee", "score": "0.57827586", "text": "func (workspace *Workspace) Hub() {}", "title": "" }, { "docid": "f7d87cd5bde7f227db0fe5d60f06c488", "score": "0.5703574", "text": "func (v *StorageClientHostNode) Version() interface{} { return v.version }", "title": "" }, { "docid": "a2b8be7b34c8fd69a9edde7838c835df", "score": "0.5642665", "text": "func (assessment *ServersVulnerabilityAssessment) Hub() {}", "title": "" }, { "docid": "4ee29e6c479962ce8c234f64139856ba", "score": "0.56270003", "text": "func (site *Site) Hub() {}", "title": "" }, { "docid": "78c76ff3fb703557390e3674eeacff50", "score": "0.560532", "text": "func (signalR *SignalR) Hub() {}", "title": "" }, { "docid": "e1c8f3f9570c116ea22bf6d40b51ce2f", "score": "0.5577467", "text": "func (gateway *VirtualNetworkGateway) Hub() {}", "title": "" }, { "docid": "e31abda49a85dd62ddb5f498e5e6672c", "score": "0.55711055", "text": "func Version(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"version\": splitio.Version})\n}", "title": "" }, { "docid": "7aad302cdbc754d8d11e15bc728ca252", "score": "0.5531936", "text": "func (base *BaseComponent) Hub() *ComponentHub {\n\treturn base.hub\n}", "title": "" }, { "docid": "963ebfb49c2e6a688cd050cfcd2c238a", "score": "0.54493046", "text": "func NewHub(id string) *Server {\n\treturn NewServer(VariantHub, id)\n}", "title": "" }, { "docid": "3423f31613813a773bbfc7d05e8f37f7", "score": "0.5442105", "text": "func (group *ServersFailoverGroup) Hub() {}", "title": "" }, { "docid": "6f0c98575aa3dc35a975542fb8522d49", "score": "0.53966194", "text": "func (o *SystemProfileAnsible) HasHubVersion() bool {\n\tif o != nil && o.HubVersion != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5d14fc1b4cca85da8c32c25c3a6d42cb", "score": "0.53301215", "text": "func newHub() *Hub {\n\treturn &Hub{\n\t\tBroadcast: make(chan *vote.Poll),\n\t\tclients: make(map[string][]*Client),\n\t\tregister: make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t}\n}", "title": "" }, { "docid": "9d64d99bd79a6733b3c85e447b2bf55e", "score": "0.5318406", "text": "func (b *Broker) Storage() Storage {\n\treturn b.stable\n}", "title": "" }, { "docid": "25b300d41d3a047a82fe07cbb082ec20", "score": "0.52705675", "text": "func (user *User) Hub() {}", "title": "" }, { "docid": "b869cd7f25aa4171d19fabd76247aee9", "score": "0.5248476", "text": "func (e ExampleResourceWithHandler) IsStorageVersion() bool {\n\treturn true\n}", "title": "" }, { "docid": "a7f1f6fd544b796382f3927384a66e16", "score": "0.52217525", "text": "func UseHub(hub HubInterface) func(*Server) error {\n\treturn func(s *Server) error {\n\t\ts.newHub = func() HubInterface { return hub }\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "300f90fd00c6929a0d4de49034e2ee24", "score": "0.52090687", "text": "func hubHandler(c *gin.Context) {\n\tws, err := upgrader.Upgrade(c.Writer, c.Request, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\t}\n\n\tclient := socket.CreateClient(ws)\n\tsocket.MusicHub.Register(client)\n\tgo client.ReadPump()\n\tclient.WritePump()\n}", "title": "" }, { "docid": "2d5a47290e43977bd3d2234b0c553081", "score": "0.515563", "text": "func hubHandler(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlogerror(err)\n\t\treturn\n\t}\n\n\tclient := CreateClient(ws)\n\tMusicHub.Register(client)\n\tgo client.ReadPump()\n\tclient.WritePump()\n}", "title": "" }, { "docid": "93969d97e9c0e046a3ef54e96eb9ddd0", "score": "0.51425856", "text": "func (component *Component) Hub() {}", "title": "" }, { "docid": "0ae37246bbca04c70fe360aa58b85839", "score": "0.5121433", "text": "func NewHub(path string) (*Hub, error) {\n\tc, err := cmd.New(\"hub\", \"-C\", path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Hub{\n\t\tCommand: c,\n\t\tbaseBranch: \"master\",\n\t}, nil\n}", "title": "" }, { "docid": "ffd75e6176c9f430c15cbac8d719ef49", "score": "0.5110948", "text": "func (collection *MongodbDatabaseCollection) Hub() {}", "title": "" }, { "docid": "7a5385d1a2de9622c415bfcd0b2048f0", "score": "0.50643563", "text": "func (h HubFunction) Name() string {\n\treturn \"Hub\"\n}", "title": "" }, { "docid": "7b0511dd88268a29295a83d2273dce0a", "score": "0.503847", "text": "func (o *SystemProfileAnsible) GetHubVersionOk() (*string, bool) {\n\tif o == nil || o.HubVersion == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HubVersion, true\n}", "title": "" }, { "docid": "1a4b86fc2b09279b7dd4216f300a2c87", "score": "0.50357205", "text": "func (p Plugin) ExecHub() error {\n\t// get the base url\n\tbaseurl := fmt.Sprintf(\"%s/v2/\", p.Registry)\n\t// initialize rest client\n\tr := rest.NewClient(p.Dump, p.Insecure)\n\t// get a token\n\tvar token hub.Token\n\terr := r.Post(fmt.Sprintf(\"%susers/login/\", baseurl), map[string]string{\"username\": p.Username, \"password\": p.Password}, &token)\n\tif err != nil {\n\t\tif p.Verbose {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\treturn fmt.Errorf(\"could not get token\")\n\t}\n\tif p.Verbose {\n\t\tfmt.Printf(\"authenticated with %s\\n\", p.Username)\n\t}\n\tr.Headers[\"Authorization\"] = fmt.Sprintf(\"Bearer %s\", token.Token)\n\t// get the tag list\n\tvar tags []hub.Tag\n\tre := regexp.MustCompile(p.Regex)\n\turl := fmt.Sprintf(\"%srepositories/%s/tags/?page_size=%d&page=%d\", baseurl, p.Repo, HubPageSize, 1)\n\tvar tagpage hub.Tags\n\t// loop trought the result pages\n\tfor len(url) > 0 {\n\t\ttagpage = hub.Tags{}\n\t\terr = r.Get(url, nil, &tagpage)\n\t\tif err != nil {\n\t\t\tif p.Verbose {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"cannot get tag page\")\n\t\t}\n\t\turl = tagpage.Next\n\t\tfor _, tag := range tagpage.Results {\n\t\t\tif !re.MatchString(tag.Name) || tag.Name == \"latest\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttags = append(tags, tag)\n\t\t}\n\t\tif p.Verbose {\n\t\t\tfmt.Printf(\"found %d tags/images\\n\", len(tags))\n\t\t}\n\t}\n\t// order tags per date (newer to older)\n\tsort.SliceStable(tags, func(i, j int) bool {\n\t\treturn tags[i].LastUpdated.After(tags[j].LastUpdated)\n\t})\n\t// parse the tags in reverse order to decice which to delete\n\ttreshold := time.Now().Add(-p.Max)\n\tvar wg sync.WaitGroup\n\tdeleted := 0\n\terrors := 0\n\tfor i := len(tags) - 1; i >= 0; i-- {\n\t\t// stop if reached the minimum limit\n\t\tif i <= p.Min-1 {\n\t\t\tbreak\n\t\t}\n\t\t// delete if older than treshold\n\t\tif tags[i].LastUpdated.Before(treshold) {\n\t\t\twg.Add(1)\n\t\t\t// update the deleting flag\n\t\t\t// send the delete request async\n\t\t\tgo func(tag hub.Tag) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tif p.DryRun {\n\t\t\t\t\tfmt.Printf(\"dryrun [%s] %s:%s\\n\", tag.LastUpdated.Format(time.RFC822), p.Repo, tag.Name)\n\t\t\t\t\terrors++\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr := r.Delete(fmt.Sprintf(\"%srepositories/%s/tags/%s/\", baseurl, p.Repo, tag.Name), nil, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif p.Verbose {\n\t\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"error [%s] %s:%s\\n\", tag.LastUpdated.Format(time.RFC822), p.Repo, tag.Name)\n\t\t\t\t\terrors++\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdeleted++\n\t\t\t\tfmt.Printf(\"deleted [%s] %s:%s\\n\", tag.LastUpdated.Format(time.RFC822), p.Repo, tag.Name)\n\t\t\t}(tags[i])\n\t\t}\n\t}\n\t// wait for the results\n\twg.Wait()\n\tif errors > 0 {\n\t\tfmt.Printf(\"issue deleting %d tags/images\\n\", errors)\n\t}\n\tfmt.Printf(\"successfully deleted %d tags/images\\n\", deleted)\n\treturn nil\n}", "title": "" }, { "docid": "521ca7bfb47a8d0a9a5ee33d2de8925f", "score": "0.50344175", "text": "func NewHub() *Hub {\n\treturn &Hub{}\n}", "title": "" }, { "docid": "c9f8502ffba3b06beb2313063de0d26f", "score": "0.5022437", "text": "func DefaultHub() *Hub {\n\treturn &Hub{\n\t\tJoinLimitRateBurst: DefaultJoinLimitRateBurst,\n\t\tJoinLimitRateInterval: DefaultJoinLimitRateInterval,\n\t\tJoinMaxQueueSize: DefaultJoinMaxQueueSize,\n\t}\n}", "title": "" }, { "docid": "8896499f275215adf8df584511e9b952", "score": "0.4981583", "text": "func SupportV1(strgObject storage.IStorage, cfg *types.Config) {\n strg = strgObject\n config = cfg\n}", "title": "" }, { "docid": "2f1baad24b41ec34467be4b2184764d4", "score": "0.4974107", "text": "func NewHub(server *shttp.Server, g *graph.Graph, cached *graph.CachedBackend, apiAuthBackend, clusterAuthBackend shttp.AuthenticationBackend, clusterAuthOptions *shttp.AuthenticationOpts, podEndpoint string, peers []common.ServiceAddress, opts Opts) (*Hub, error) {\n\tnewWSServer := func(endpoint string, authBackend shttp.AuthenticationBackend) *websocket.Server {\n\t\treturn websocket.NewServer(server, endpoint, authBackend, opts.ServerOpts)\n\t}\n\n\tpodWSServer := websocket.NewStructServer(newWSServer(podEndpoint, clusterAuthBackend))\n\t_, err := NewPodEndpoint(podWSServer, cached, g)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpublisherWSServer := websocket.NewStructServer(newWSServer(\"/ws/publisher\", apiAuthBackend))\n\t_, err = NewPublisherEndpoint(publisherWSServer, cached, g, opts.Validator)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treplicationWSServer := websocket.NewStructServer(newWSServer(\"/ws/replication\", clusterAuthBackend))\n\treplicationEndpoint, err := NewReplicationEndpoint(replicationWSServer, clusterAuthOptions, cached, g, peers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// declare all extension available through API and filtering\n\ttr := traversal.NewGremlinTraversalParser()\n\ttr.AddTraversalExtension(ge.NewDescendantsTraversalExtension())\n\n\tsubscriberWSServer := websocket.NewStructServer(newWSServer(\"/ws/subscriber\", apiAuthBackend))\n\tgc.NewSubscriberEndpoint(subscriberWSServer, g, tr)\n\n\treturn &Hub{\n\t\tserver: server,\n\t\tapiAuthBackend: apiAuthBackend,\n\t\tclusterAuthBackend: clusterAuthBackend,\n\t\tpodWSServer: podWSServer,\n\t\treplicationEndpoint: replicationEndpoint,\n\t\treplicationWSServer: replicationWSServer,\n\t\tpublisherWSServer: publisherWSServer,\n\t\tsubscriberWSServer: subscriberWSServer,\n\t}, nil\n}", "title": "" }, { "docid": "ab93cf4ea922d8dd165c5b4b62d5832b", "score": "0.49714103", "text": "func (ss storageService) ReleaseVersion() (version string, err error) {\n\tresp, err := ss.jolokiaClient.ReadString(storageServicePath + \"/ReleaseVersion\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn resp.Value, nil\n}", "title": "" }, { "docid": "beea7b7be1eb0f923f46cd52b5908a25", "score": "0.49576494", "text": "func main() {\n\t// Try to find hubs on the local network.\n\thubAddresses, err := hugo.FindHubAddresses()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif len(hubAddresses) == 0 {\n\t\tfmt.Println(\"No Hue hubs found.\")\n\t\treturn\n\t}\n\n\tvar selectedAddress hugo.HubAddress\n\n\t// Prompt the user to pick onen hub, if multiple are present.\n\tif len(hubAddresses) > 1 {\n\t\tfor {\n\t\t\tfmt.Println(\"\\nFound multiple hubs, pick one:\")\n\t\t\tfor i, hub := range hubAddresses {\n\t\t\t\tfmt.Printf(\"\\t(%d) %s - %s\\n\", i, hub.InternalIpAddress, hub.Id)\n\t\t\t}\n\n\t\t\tvar selection string\n\t\t\tfmt.Scanln(&selection)\n\t\t\ti, err := strconv.Atoi(selection)\n\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tcontinue\n\t\t\t} else if i < 0 || i >= len(hubAddresses) {\n\t\t\t\tfmt.Printf(\"%d is out of bounds, expected range: [0,%d].\\n\", i, len(hubAddresses)-1)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tselectedAddress = hubAddresses[i]\n\t\t\tbreak\n\t\t}\n\t} else {\n\t\tselectedAddress = hubAddresses[0]\n\t}\n\n\t// Construct a Hub struct.\n\tfmt.Println(\"Using hub with id: \" + selectedAddress.Id + \" ip: \" + selectedAddress.InternalIpAddress)\n\thub := hugo.CreateHubWithAddress(selectedAddress)\n\n\t// The Hue API requires a username to be generated, with a press of\n\t// a physical button on the Hue hub. After one is generated we'll store\n\t// it at ~/.hugo_username\n\tconfigPath := os.Getenv(\"HOME\") + \"/.hugo_username\"\n\n\tif _, err := os.Stat(configPath); os.IsNotExist(err) {\n\t\thostname, err := os.Hostname()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\tdeviceType := \"hugo_cli#\" + hostname\n\t\tfmt.Println(\"Authenticating new user...\")\n\t\tusername, err := hub.AuthenticateNewUser(deviceType, func() {\n\t\t\tfmt.Println(\"Press the hub button within 30 seconds, then press ENTER\")\n\t\t\tfmt.Scanln()\n\t\t})\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"New user authenticated: \" + username)\n\t\tfmt.Println(\"Saving username to: \" + configPath)\n\t\terr = ioutil.WriteFile(configPath, []byte(username), 0666)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tfmt.Println(\"Reading username from: \" + configPath)\n\t\tconfigContents, err := ioutil.ReadFile(configPath)\n\t\tfmt.Println(\"Username: \" + string(configContents))\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\terr = hub.AuthenticateExistingUser(string(configContents))\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// If we got this far without returning, then we've got a valid hub\n\t// address + username.\n\tfmt.Println(\"Authentication successful.\")\n\n\t// Toggle all reachable lights.\n\t// TODO(rileya): Actually make this an interactive interface-y thing.\n\tfor name, light := range hub.Lights {\n\t\tnewState := light.State\n\t\tif light.State.Reachable {\n\t\t\tnewState.On = !newState.On\n\t\t\thub.SetLightState(name, newState)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a4e1ebba62e0cf2eeede2cba26ee4ab9", "score": "0.49392062", "text": "func (this *BlockStore) SaveVersion(ver byte) error {\n\tkey := this.getVersionKey()\n\treturn this.store.Put(key, []byte{ver})\n}", "title": "" }, { "docid": "0d94b1f109d70d5676e2619770b38792", "score": "0.49380696", "text": "func (a Artifact) StorageBase() string {\n\tif len(a.OverrideStorageBase) > 0 {\n\t\treturn a.OverrideStorageBase\n\t}\n\tif len(a.Version) == 0 {\n\t\treturn fmt.Sprintf(\"%s.%s\", a.Name, a.Type)\n\t}\n\treturn fmt.Sprintf(\"%s-%s.%s\", a.Name, a.Version, a.Type)\n}", "title": "" }, { "docid": "536f8adb53e4a7adb1f97534c58fb158", "score": "0.4900958", "text": "func (*Hub) Descriptor() ([]byte, []int) {\n\treturn file_faceit_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "eecbc3875db4b463da51743690be747a", "score": "0.48859358", "text": "func Stable() *Versions { return zkBrokerOf(max280) }", "title": "" }, { "docid": "8d0d6abeb9aeb628ad3f36b98c8945cc", "score": "0.48681358", "text": "func (_SmartPool *SmartPoolCallerSession) Version() (string, error) {\n\treturn _SmartPool.Contract.Version(&_SmartPool.CallOpts)\n}", "title": "" }, { "docid": "f5e807fe3769502231ef9c0f96e3862a", "score": "0.48487347", "text": "func (*BGPPeer) Hub() {}", "title": "" }, { "docid": "ea031ea0ee57c39b3385d2b616d6150b", "score": "0.48475108", "text": "func newHub() *Hub {\n\treturn &Hub{\n\t\tbroadcast: make(chan *Udp_data),\n\t\tregister: make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t\tall_clients: make(map[*Client]bool),\n\t\tlive_clients: make(map[*Client]bool),\n\t\tdashboard_clients: make(map[*Client]bool),\n\t\thistory_clients: make(map[*Client]bool),\n\t\ttime_clients: make(map[*Client]bool),\n\t}\n\n}", "title": "" }, { "docid": "512e07746a1654ad1c09b04d80b629f6", "score": "0.48460457", "text": "func newHub() *Hub {\n\tlog.Printf(\"Socket/newHub: Retrieving Hub...\\n\")\n\n\tonce.Do(func() {\n\t\tlog.Printf(\"Socket/newHub: Creating new Hub...\\n\")\n\t\thubId := common.GenUlid()\n\n\t\th = &Hub{\n\t\t\tID: hubId,\n\t\t\tbroadcast: make(chan []byte),\n\t\t\tregister: make(chan *Client),\n\t\t\tunregister: make(chan *Client),\n\t\t\tclients: make(map[int32]*Client),\n\t\t}\n\t})\n\n\treturn h\n}", "title": "" }, { "docid": "750837b64a9cdd6924ef98bcb7313b81", "score": "0.48402622", "text": "func (base *BaseComponent) SetHub(hub *ComponentHub) {\n\tbase.hub = hub\n}", "title": "" }, { "docid": "fcdb49a00596e90ec6a2b27dac112123", "score": "0.48284316", "text": "func Root(cli app.CLI) *cobra.Command {\n\tapiURL := \"\"\n\thubType := \"\"\n\n\tcmd := &cobra.Command{\n\t\tUse: \"hub\",\n\t\tAnnotations: map[string]string{\n\t\t\t\"commandType\": \"main\",\n\t\t},\n\t\tShort: \"Interact with tekton hub\",\n\t\tLong: ``,\n\t\tSilenceUsage: true,\n\t\tPersistentPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif hubType != hub.ArtifactHubType && hubType != hub.TektonHubType {\n\t\t\t\treturn fmt.Errorf(\"invalid hub type: %s, expecting artifact or tekton\", hubType)\n\t\t\t}\n\t\t\tif err := cli.SetHub(hubType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn cli.Hub().SetURL(apiURL)\n\t\t},\n\t}\n\n\tcli.SetStream(cmd.OutOrStdout(), cmd.OutOrStderr())\n\n\tcmd.AddCommand(\n\t\tdowngrade.Command(cli),\n\t\tget.Command(cli),\n\t\tinfo.Command(cli),\n\t\tinstall.Command(cli),\n\t\treinstall.Command(cli),\n\t\tsearch.Command(cli),\n\t\tupgrade.Command(cli),\n\t\tcheck_upgrade.Command(cli),\n\t)\n\n\tcmd.PersistentFlags().StringVar(&apiURL, \"api-server\", \"\", \"Hub API Server URL (default 'https://api.hub.tekton.dev' for 'tekton' type; default 'https://artifacthub.io' for 'artifact' type).\\nURL can also be defined in a file '$HOME/.tekton/hub-config' with a variable 'TEKTON_HUB_API_SERVER'/'ARTIFACT_HUB_API_SERVER'.\")\n\tcmd.PersistentFlags().StringVar(&hubType, \"type\", \"tekton\", \"The type of Hub from where to pull the resource. Either 'artifact' or 'tekton'\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "b4003b3ac0a365523af5ed32fe7cc737", "score": "0.48280895", "text": "func (d *driver) StorageChanged(cr *imageregistryv1.Config) bool {\n\tif !reflect.DeepEqual(cr.Status.Storage.S3, cr.Spec.Storage.S3) {\n\t\tutil.UpdateCondition(cr, defaults.StorageExists, operatorapi.ConditionUnknown, \"S3 Configuration Changed\", \"S3 storage is in an unknown state\")\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4d3362314f72e099df87ce0215e8b028", "score": "0.48230797", "text": "func (s *Storage) DatabaseVersion() string {\n\tvar dbVersion string\n\terr := s.db.QueryRow(`SELECT current_setting('server_version')`).Scan(&dbVersion)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn dbVersion\n}", "title": "" }, { "docid": "d719f71dd350bfb27da0eb00a43dd111", "score": "0.48096758", "text": "func (zone *DnsZone) Hub() {}", "title": "" }, { "docid": "626c676a225c61127b13f7e056315873", "score": "0.47898716", "text": "func (ctrl *IndexController) Version(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"version\": provider.DI().Config().Server.Version,\n\t})\n}", "title": "" }, { "docid": "ad05671be246526ea8221c774c63ad0c", "score": "0.47855482", "text": "func (s *Storage) Push(backup *openapi.BackupRequest, filename string) error {\n\treturn nil\n}", "title": "" }, { "docid": "0106a13d91fea6248eb3431541dbd444", "score": "0.47821617", "text": "func init() {\n\tSchemeBuilder.Register(&HubDeploymentConfig{}, &HubDeploymentConfigList{})\n}", "title": "" }, { "docid": "917c2e76e11b6adf8f5a5e75a47111ad", "score": "0.47692105", "text": "func (b *backend) SaveVersion(runAs, appId string, version *types.Version) error {\n\n\tblog.Info(\"save version(%s.%s)\", runAs, appId)\n\tversions, err := b.store.ListVersions(runAs, appId)\n\tif err != nil {\n\t\tblog.Error(\"list versions(%s.%s) err:%s\", runAs, appId, err.Error())\n\t\treturn err\n\t}\n\n\tversionName := version.Name\n\tif len(versions) != 0 {\n\t\tsort.Strings(versions)\n\t\tnewestVersion, err := b.store.FetchVersion(runAs, appId, versions[len(versions)-1])\n\t\tif err != nil {\n\t\t\tblog.Error(\"fetch version(%s.%s), versionNo(%s) err:%s\", runAs, appId, versions[len(versions)-1], err.Error())\n\t\t\treturn err\n\t\t}\n\t\tversion.Name = newestVersion.Name\n\t\tif reflect.DeepEqual(version, newestVersion) {\n\t\t\tversion.Name = versionName\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tversion.Name = versionName\n\treturn b.store.SaveVersion(version)\n}", "title": "" }, { "docid": "d45d64ce2a46d601ad51a3f65bbc49db", "score": "0.47540915", "text": "func New(ctx context.Context, cfg *Config, opts ...Option) (*Hub, error) {\n\tdefaults := defaultHubOptions()\n\tfor _, o := range opts {\n\t\to(defaults)\n\t}\n\n\tif defaults.worker == nil {\n\t\treturn nil, errors.New(\"cannot build Hub without worker\")\n\t}\n\n\tif defaults.ethKey == nil {\n\t\treturn nil, errors.New(\"cannot build Hub instance without private key\")\n\t}\n\n\tif defaults.ctx == nil {\n\t\tdefaults.ctx = context.Background()\n\t}\n\n\tvar err error\n\tctx, cancel := context.WithCancel(defaults.ctx)\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t}\n\t}()\n\n\tif defaults.bcr == nil {\n\t\tdefaults.bcr, err = blockchain.NewAPI(nil, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tethWrapper, err := NewETH(ctx, defaults.ethKey, defaults.bcr, defaultDealWaitTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif defaults.locator == nil {\n\t\tconn, err := xgrpc.NewWalletAuthenticatedClient(ctx, defaults.creds, cfg.Locator.Endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdefaults.locator = pb.NewLocatorClient(conn)\n\t}\n\n\tif defaults.market == nil {\n\t\tconn, err := xgrpc.NewWalletAuthenticatedClient(ctx, defaults.creds, cfg.Market.Endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdefaults.market = pb.NewMarketClient(conn)\n\t}\n\n\tif defaults.cluster == nil {\n\t\tdefaults.cluster, err = NewCluster(ctx, &cfg.Cluster, defaults.creds)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif defaults.announcer == nil {\n\t\ta, err := newLocatorAnnouncer(\n\t\t\tdefaults.ethKey,\n\t\t\tdefaults.locator,\n\t\t\tcfg.Locator.UpdatePeriod,\n\t\t\tcfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefaults.announcer = a\n\t}\n\n\tif len(cfg.Whitelist.PrivilegedAddresses) == 0 {\n\t\tcfg.Whitelist.PrivilegedAddresses = append(cfg.Whitelist.PrivilegedAddresses, defaults.ethAddr.Hex())\n\t}\n\n\twl := NewWhitelist(ctx, &cfg.Whitelist)\n\n\tminerCtx, err := createMinerCtx(ctx, defaults.worker)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thubState, err := newState(ctx, ethWrapper, defaults.market, defaults.cluster, minerCtx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := &Hub{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\texternalGrpc: nil,\n\n\t\tethKey: defaults.ethKey,\n\t\tethAddr: defaults.ethAddr,\n\t\tversion: defaults.version,\n\n\t\teth: ethWrapper,\n\t\tmarket: defaults.market,\n\n\t\tcertRotator: defaults.rot,\n\t\tcreds: defaults.creds,\n\n\t\tannouncer: defaults.announcer,\n\t\tcluster: defaults.cluster,\n\n\t\twhitelist: wl,\n\n\t\tstate: hubState,\n\t\tworker: defaults.worker,\n\t}\n\n\tauthorization := auth.NewEventAuthorization(h.ctx,\n\t\tauth.WithLog(log.G(ctx)),\n\t\tauth.WithEventPrefix(hubAPIPrefix),\n\t\tauth.Allow(\"Handshake\", \"ProposeDeal\").With(auth.NewNilAuthorization()),\n\t\tauth.Allow(hubManagementMethods...).With(auth.NewTransportAuthorization(h.ethAddr)),\n\n\t\tauth.Allow(\"TaskStatus\").With(newMultiAuth(\n\t\t\tauth.NewTransportAuthorization(h.ethAddr),\n\t\t\tnewDealAuthorization(ctx, hubState, newFromTaskDealExtractor(hubState)),\n\t\t)),\n\t\tauth.Allow(\"StopTask\").With(newDealAuthorization(ctx, hubState, newFromTaskDealExtractor(hubState))),\n\t\tauth.Allow(\"JoinNetwork\").With(newDealAuthorization(ctx, hubState, newFromNamedTaskDealExtractor(hubState, \"TaskID\"))),\n\t\tauth.Allow(\"StartTask\").With(newDealAuthorization(ctx, hubState, newFieldDealExtractor())),\n\t\tauth.Allow(\"TaskLogs\").With(newDealAuthorization(ctx, hubState, newFromTaskDealExtractor(hubState))),\n\t\tauth.Allow(\"PushTask\").With(newDealAuthorization(ctx, hubState, newContextDealExtractor())),\n\t\tauth.Allow(\"PullTask\").With(newDealAuthorization(ctx, hubState, newRequestDealExtractor(func(request interface{}) (DealID, error) {\n\t\t\treturn DealID(request.(*pb.PullTaskRequest).DealId), nil\n\t\t}))),\n\t\tauth.Allow(\"GetDealInfo\").With(newDealAuthorization(ctx, hubState, newRequestDealExtractor(func(request interface{}) (DealID, error) {\n\t\t\treturn DealID(request.(*pb.ID).GetId()), nil\n\t\t}))),\n\t\tauth.Allow(\"ApproveDeal\").With(newOrderAuthorization(hubState, OrderExtractor(func(request interface{}) (OrderID, error) {\n\t\t\treturn OrderID(request.(*pb.ApproveDealRequest).BidID), nil\n\t\t}))),\n\t\tauth.WithFallback(auth.NewDenyAuthorization()),\n\t)\n\n\th.eventAuthorization = authorization\n\n\tlogger := log.GetLogger(h.ctx)\n\tgrpcServer := xgrpc.NewServer(logger,\n\t\txgrpc.Credentials(h.creds),\n\t\txgrpc.DefaultTraceInterceptor(),\n\t\txgrpc.AuthorizationInterceptor(authorization),\n\t\txgrpc.UnaryServerInterceptor(h.onRequest),\n\t)\n\th.externalGrpc = grpcServer\n\n\tpb.RegisterHubServer(grpcServer, h)\n\tgrpc_prometheus.Register(grpcServer)\n\n\treturn h, nil\n}", "title": "" }, { "docid": "213ce783a8d0e240b56925f364d7995e", "score": "0.47499102", "text": "func (s *Server) Version(ctx context.Context, req *v1alpha1.VersionRequest) (*v1alpha1.VersionResponse, error) {\n\treturn &v1alpha1.VersionResponse{\n\t\tVersion: \"v1alpha1\",\n\t\tRuntimeName: \"secrets-store-csi-driver-provider-gcp\",\n\t\tRuntimeVersion: s.RuntimeVersion,\n\t}, nil\n}", "title": "" }, { "docid": "1e5005938b703cbfaa65e7840eab4c33", "score": "0.4741601", "text": "func NewHub(log *log.Logger) *Hub {\n\treturn &Hub{\n\t\tlog: log,\n\t\tsubscribers: make(map[string][]*client.Client),\n\t}\n}", "title": "" }, { "docid": "66da5374561a1e01e6478d673becd976", "score": "0.4726678", "text": "func (_SmartPool *SmartPoolSession) Version() (string, error) {\n\treturn _SmartPool.Contract.Version(&_SmartPool.CallOpts)\n}", "title": "" }, { "docid": "773d2d740f8e98b3e6eeef413a45364f", "score": "0.4719289", "text": "func (d *DBAPI) CurrentBucketStorageIndex(po uint8) uint64 {\n\treturn d.db.CurrentBucketStorageIndex(po)\n}", "title": "" }, { "docid": "97d4c86d54888dd0726f9a3eafcfb052", "score": "0.47137678", "text": "func virtioBlkStorageHandler(_ context.Context, storage pb.Storage, s *sandbox) (string, error) {\n\n\t// If hot-plugged, get the device node path based on the PCI address else\n\t// use the virt path provided in Storage Source\n\tif strings.HasPrefix(storage.Source, \"/dev\") {\n\n\t\tFileInfo, err := os.Stat(storage.Source)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\n\t\t}\n\t\t// Make sure the virt path is valid\n\t\tif FileInfo.Mode()&os.ModeDevice == 0 {\n\t\t\treturn \"\", fmt.Errorf(\"invalid device %s\", storage.Source)\n\t\t}\n\n\t} else {\n\t\tdevPath, err := getPCIDeviceName(s, storage.Source)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tstorage.Source = devPath\n\t}\n\n\treturn commonStorageHandler(storage)\n}", "title": "" }, { "docid": "7747b0957c05e4ab06051fac04a0a95d", "score": "0.4711828", "text": "func (b *BasicRegistry) StoragePlugin() StoragePlugin {\n\treturn b.storagePlugin\n}", "title": "" }, { "docid": "f0a2ff30c52c462279a15af3048f7d1b", "score": "0.47033074", "text": "func (ep *EthereumPlugin) Version() string {\n\treturn \"0.0.3\"\n}", "title": "" }, { "docid": "699a6dbcd4ac4ca3ebe7372a6cafead0", "score": "0.46889544", "text": "func (server *AppServer) AddHub(hub *RouterHub) {\n\tserver.Handle(hub.BasePattern, hub, false)\n}", "title": "" }, { "docid": "0b710d3de07a048e7c20654dcb0048ef", "score": "0.46644711", "text": "func (r *runtime) Name() string {\n\treturn \"storage\"\n}", "title": "" }, { "docid": "c9ec830bc5ad088c7595d5ce2b89d64d", "score": "0.46547037", "text": "func DeployKvStorage(goSDK *sdk.GoSDK, auth sdk.AccountBase) (common.Hash, *KvStorage, error) {\n\n\tcc := sdk.ContractCreate{\n\t\tAccountBase: auth,\n\t\tCode: KvStorageBin,\n\t\tABI: KvStorageABI,\n\t\tParams: []interface{}{},\n\t}\n\tret, err := goSDK.ContractCreate(&cc)\n\tif err != nil {\n\t\treturn common.Hash{}, nil, err\n\t}\n\ttxHash := common.HexToHash(ret[\"tx\"].(string))\n\taddress := common.HexToAddress(ret[\"contract\"].(string))\n\treturn txHash, &KvStorage{address: address, cli: goSDK}, nil\n}", "title": "" }, { "docid": "7c8f8819e8cb332b864ebf9693dea4c5", "score": "0.46506292", "text": "func (h *Hart) Version() string {\n\treturn h.version\n}", "title": "" }, { "docid": "49051d0cd49fffb73ef19823fa82f466", "score": "0.46276316", "text": "func (v *StorageClientHostNode) SetVersion(version interface{}) { v.version = version }", "title": "" }, { "docid": "6e8d85b72c9f82d60b76dea11cb37d39", "score": "0.46238065", "text": "func NewHub() *Hub {\n\thub := &Hub{\n\t\t// Broadcast: make(chan []byte),\n\t\tClients: make(map[string]*Client),\n\t\tBroadcast: make(chan []byte),\n\t\tPrivate: make(chan *Private),\n\t\tRegister: make(chan *Client),\n\t\tUnregister: make(chan *Client),\n\t\tkill: make(chan string),\n\t}\n\n\tgo hub.run()\n\n\treturn hub\n}", "title": "" }, { "docid": "a58071403e631fcf1c57117c70873393", "score": "0.46207708", "text": "func (h *UHistogramStorage) Interface() HistogramInterface {\n\treturn h\n}", "title": "" }, { "docid": "b23591f66a6252b87a4b763385d991d8", "score": "0.46164903", "text": "func (r DockerHubAdapter) RegistryName() string {\n\treturn dockerhubName\n}", "title": "" }, { "docid": "04cd572802d886818c9c316373a116b4", "score": "0.46117142", "text": "func NewHub() *Hub {\n\treturn &Hub{\n\t\tclients: make(map[string]*Client),\n\t\tregister: make(chan *aggreg),\n\t\tunregister: make(chan *aggreg),\n\t}\n}", "title": "" }, { "docid": "6a40d811c273ecdf11fae0338422baff", "score": "0.45957565", "text": "func newSnapshotVersion() string {\n\t// When triggering watches after a cache snapshot is set, the go-control-plane\n\t// only sends resources which have a different version to Envoy.\n\t// `time.Now().UnixNano()` should always return a unique number.\n\treturn strconv.FormatInt(time.Now().UnixNano(), 10)\n}", "title": "" }, { "docid": "12ad3c852033b387e5d5815cc4e4f70d", "score": "0.45930997", "text": "func (c *controlService) BurninStorage(\n\treq *pb.BurninStorageReq,\n\tstream pb.MgmtCtl_BurninStorageServer) error {\n\n\treturn errors.New(\"BurninStorage not implemented\")\n\t//\tfor i := range c.config.Servers {\n\t//\t\tc.nvme.BurnIn(i, req.Nvme, resp)\n\t//\t\tc.scm.BurnIn(i, req.Scm, resp)\n\t//\t}\n\n\t//\tif err := stream.Send(resp); err != nil {\n\t//\t\treturn errors.WithMessagef(err, \"sending response (%+v)\", resp)\n\t//\t}\n\n\t//\treturn nil\n}", "title": "" }, { "docid": "cb33c2c0b8961379db98f711963c5da0", "score": "0.4580458", "text": "func NewHub(logger logr.Logger, ts *TailService, wg *sync.WaitGroup) *Hub {\n\treturn &Hub{\n\t\tlog: logger,\n\t\tworkers: ts,\n\t\twg: wg,\n\t\tclients: make(map[*Client]bool),\n\t\tsubscribers: make(map[string]subscribers),\n\t\tstats: make(map[string]uint64),\n\t\tbroadcast: make(chan *Message),\n\t\tregister: make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t\treceive: make(chan *TailMessage),\n\t\tindex: make(chan *IndexItemEvent),\n\t\tquit: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "5865ba5a175348d59b4d6d353059e8c7", "score": "0.45785072", "text": "func (d *Database) SaveLatestBlockNumberStorage(ctx context.Context, lastestblocknum int64) (err error) {\n\terr = d.latestBlockNumberStatement.updatLatestBlockNumber(ctx, lastestblocknum)\n\treturn\n}", "title": "" }, { "docid": "abea31fc0644357bc519871e7a4dcda0", "score": "0.4578111", "text": "func (s *EdgehubStorage) Update(objType string, key string, data []byte) error {\n\tif !s.RemoteEnable {\n\t\tif _, ok := s.Cache[objType]; !ok {\n\t\t\tklog.Errorf(\"local storage don't have type %s cache\", objType)\n\t\t} else {\n\t\t\tobj, err := util.GetObjectFromSerializeData(objType, data)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"failed to get obj from serialize data: %v\", err)\n\t\t\t} else if err := s.Cache[objType].Update(obj); err != nil {\n\t\t\t\tklog.Errorf(\"failed to update obj from local cache: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn s.LevelDB.Update(objType, key, data)\n}", "title": "" }, { "docid": "1bed88b2e52a2db5ec6274646ae38453", "score": "0.45759836", "text": "func (_SmartPool *SmartPoolCaller) Version(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _SmartPool.contract.Call(opts, out, \"version\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b2466cce81ec61645d01d13acad6fddd", "score": "0.457294", "text": "func (s *Storage) InitCurrentVersion(mt Memtable) {\n\ts.currentVersion.memtable = mt\n}", "title": "" }, { "docid": "7388cf106441b80464782fcf9e38ef75", "score": "0.45722252", "text": "func Version() string {\n\treturn relayVersion\n}", "title": "" }, { "docid": "8b236f4440ad22c48d3fbd8b20c3d6f5", "score": "0.45604965", "text": "func Version() string { return version }", "title": "" }, { "docid": "b99a53e49482303c53ea980e294fd812", "score": "0.4556021", "text": "func NewHub() *Hub {\n\treturn &Hub{\n\t\tclients: make([]*Client, 0),\n\t\tregister: make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t}\n\n}", "title": "" }, { "docid": "0d3e7586e8040c30b62417f1f0e9ce00", "score": "0.45542076", "text": "func NewHub() *Hub {\n\treturn &Hub{\n\t\tmessage: make(chan []byte),\n\t\tregister: make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t\tclients: make(map[*Client]bool),\n\t}\n}", "title": "" }, { "docid": "5dfc4c8a22563d9a388c740d6a060741", "score": "0.45477977", "text": "func newHub() *hub {\n\thub := &hub{\n\t\tregister: make(chan *client),\n\t\tunregister: make(chan *client),\n\t\tclients: make(map[*client]bool),\n\t\tplayers: make(map[uint64]*player),\n\t\tbroadcast: make(chan *Message),\n\t\tactions: make(chan *Message),\n\t}\n\n\tgo hub.run()\n\treturn hub\n}", "title": "" }, { "docid": "b981d20b0ca2ff8fdd27986f38353111", "score": "0.45446923", "text": "func Update() error {\n\treturn UpdateWithListRetriever(gitHubListRetriever{http.DefaultClient})\n}", "title": "" }, { "docid": "2bfc366ca810da6c4ba15b0a7ef3049d", "score": "0.4542287", "text": "func virtio9pStorageHandler(_ context.Context, storage pb.Storage, s *sandbox) (string, error) {\n\treturn commonStorageHandler(storage)\n}", "title": "" }, { "docid": "0fe259cbeb44d195722c04d71dad28f4", "score": "0.45315155", "text": "func NewHub(registerHandler func(*Client), unRegisterHandler func(*Client), messageHandler func(*Client, []byte)) *Hub {\n\treturn &Hub{\n\t\tregister: make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t\tclients: make(map[string]*Client),\n\t\tregisterHandler: registerHandler,\n\t\tmessageHandler: messageHandler,\n\t\tunRegisterHandler: unRegisterHandler,\n\t}\n}", "title": "" }, { "docid": "065c3ec86f0a59a14ac6f131953f6cc4", "score": "0.4527283", "text": "func (m *gitWebhook) Version() string {\n\treturn m.versionField\n}", "title": "" }, { "docid": "4736ee336a45030f3ecbc0a7d0250ca6", "score": "0.4521222", "text": "func (signalR *SignalR) AzureName() string {\n\treturn signalR.Spec.AzureName\n}", "title": "" }, { "docid": "833c518e1cce9a9c16ac1a57924d78fa", "score": "0.4520387", "text": "func StorageEncodeUint8(n uint8) (ret common.Hash) {\n\tret[len(ret)-1] = n\n\treturn\n}", "title": "" }, { "docid": "532670b69280af1f49b22810b19669d0", "score": "0.4516863", "text": "func (e *PubsubBucketNotification) StorageEvent() *StorageEvent {\n\tif e.Attributes == nil {\n\t\treturn nil\n\t}\n\treturn &StorageEvent{\n\t\tBucket: e.Attributes.BucketId,\n\t\tName: e.Attributes.ObjectId,\n\t}\n}", "title": "" }, { "docid": "c4c82f1e188a15e9becd1611d6d87b12", "score": "0.45154193", "text": "func (api *Api) Storage(store account.Storable) {\n\tapi.store = store\n\taccount.Storage(store)\n\tapi.auth = auth.NewAuth(store)\n}", "title": "" }, { "docid": "ee51cd563ec8f98f4ea22e705ebac212", "score": "0.4510748", "text": "func (vk VK) StorageSet(params map[string]string) (vkErr Error) {\n\t_, vkErr = vk.Request(\"storage.set\", params)\n\n\treturn\n}", "title": "" }, { "docid": "fc74fb19da4a5a7ccf51347d1b04c50a", "score": "0.45067888", "text": "func (signalR *SignalR) OriginalGVK() *schema.GroupVersionKind {\n\treturn &schema.GroupVersionKind{\n\t\tGroup: GroupVersion.Group,\n\t\tVersion: signalR.Spec.OriginalVersion,\n\t\tKind: \"SignalR\",\n\t}\n}", "title": "" }, { "docid": "c221b86ead939aac36613d3b75dcd7b1", "score": "0.44898748", "text": "func NewVirtualHub(ctx *pulumi.Context,\n\tname string, args *VirtualHubArgs, opts ...pulumi.ResourceOption) (*VirtualHub, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource VirtualHub\n\terr := ctx.RegisterResource(\"azure:network/virtualHub:VirtualHub\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "04218df5fff1825d922f68dd0005c501", "score": "0.4489476", "text": "func (signalR SignalR) GetAPIVersion() string {\n\treturn string(APIVersion_Value)\n}", "title": "" }, { "docid": "aee93a43f67076f9782f465ef35808b7", "score": "0.44878617", "text": "func DockerHubImage(name, version string) LazyImage {\n\treturn LazyImage{\n\t\tLibrary: \"registry.hub.docker.com\",\n\t\tName: name,\n\t\tVersion: version,\n\t}\n}", "title": "" }, { "docid": "df31e62e5f5ac96b3bb837d97bd30446", "score": "0.44868904", "text": "func flattenHub(c *Client, i interface{}, res *Hub) *Hub {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\tif len(m) == 0 {\n\t\treturn nil\n\t}\n\n\tresultRes := &Hub{}\n\tresultRes.Name = dcl.FlattenString(m[\"name\"])\n\tresultRes.CreateTime = dcl.FlattenString(m[\"createTime\"])\n\tresultRes.UpdateTime = dcl.FlattenString(m[\"updateTime\"])\n\tresultRes.Labels = dcl.FlattenKeyValuePairs(m[\"labels\"])\n\tresultRes.Description = dcl.FlattenString(m[\"description\"])\n\tresultRes.UniqueId = dcl.FlattenString(m[\"uniqueId\"])\n\tresultRes.State = flattenHubStateEnum(m[\"state\"])\n\tresultRes.Project = dcl.FlattenString(m[\"project\"])\n\tresultRes.RoutingVpcs = flattenHubRoutingVpcsSlice(c, m[\"routingVpcs\"], res)\n\n\treturn resultRes\n}", "title": "" }, { "docid": "37abe8b9d939b556c4511dc2a8f0e21e", "score": "0.4486852", "text": "func (_Store *StoreCallerSession) Version() (string, error) {\n\treturn _Store.Contract.Version(&_Store.CallOpts)\n}", "title": "" }, { "docid": "d026e26d115e20042794fbd1120d96ad", "score": "0.4485526", "text": "func (h HealthHandler) Version(w http.ResponseWriter, req *http.Request) {\n\t// Check for valid method\n\tif req.Method != http.MethodGet {\n\t\thelpers.MethodNotAllowed(w, req)\n\t\treturn\n\t}\n\n\t// Use helper response method\n\thelpers.OK(w, req, NewVersionResponse())\n}", "title": "" }, { "docid": "cdbd8d54c81111ecf308e34d1a3d998d", "score": "0.44846407", "text": "func (r *Fsck) Storage(namespace string) error {\n\tlogger := dcontext.GetLogger(r.Ctx)\n\tenumStorage := regstorage.Enumerator{Registry: r.Registry}\n\n\terr := enumStorage.Repositories(r.Ctx, func(repoName string) error {\n\t\tnamed, err := reference.WithName(repoName)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"failed to parse the repo name %s: %s\", repoName, err)\n\t\t\treturn nil\n\t\t}\n\n\t\tref, err := imageref.Parse(repoName)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"failed to parse the image reference %s: %s\", repoName, err)\n\t\t\treturn nil\n\t\t}\n\n\t\tif namespace != metav1.NamespaceAll && namespace != ref.Namespace {\n\t\t\treturn nil\n\t\t}\n\n\t\trepository, err := r.Registry.Repository(r.Ctx, named)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to open repository: %s: %s\", repoName, err)\n\t\t}\n\n\t\tmanifestService, err := repository.Manifests(r.Ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create manifest service: %s: %s\", repoName, err)\n\t\t}\n\n\t\tblobStore := repository.Blobs(r.Ctx)\n\n\t\timageStream := imagestream.New(r.Ctx, ref.Namespace, ref.Name, r.Client)\n\n\t\terr = enumStorage.Manifests(r.Ctx, repoName, func(dgst digest.Digest) error {\n\t\t\tif _, err := imageStream.ResolveImageID(r.Ctx, dgst); err == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmanifest, err := manifestService.Get(r.Ctx, dgst)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"unable to fetch a manifest %s in the %s repository: %s\", dgst, repoName, err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmh, err := manifesthandler.NewManifestHandler(r.ServerAddr, blobStore, manifest)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"bad manifest %s in the %s repository: %s\", dgst, repoName, err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif err := mh.Verify(r.Ctx, false); err != nil {\n\t\t\t\tlogger.Errorf(\"invalid manifest %s in the %s repository: %s\", dgst, repoName, err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tconfig, err := mh.Config(r.Ctx)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"unable to get a config for manifest %s in the %s repository: %s\", dgst, repoName, err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmediaType, payload, _, err := mh.Payload()\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"unable to get a payload of manifest %s in the %s repository: %s\", dgst, repoName, err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tlayerOrder, layers, err := mh.Layers(r.Ctx)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"unable to get a layers of manifest %s in the %s repository: %s\", dgst, repoName, err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\timage := &imageapiv1.Image{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: dgst.String(),\n\t\t\t\t\tAnnotations: map[string]string{\n\t\t\t\t\t\timageapiv1.ManagedByOpenShiftAnnotation: \"true\",\n\t\t\t\t\t\timageapiv1.ImageManifestBlobStoredAnnotation: \"true\",\n\t\t\t\t\t\timageapiv1.DockerImageLayersOrderAnnotation: layerOrder,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tDockerImageReference: fmt.Sprintf(\"%s/%s@%s\", r.ServerAddr, repoName, dgst.String()),\n\t\t\t\tDockerImageManifest: string(payload),\n\t\t\t\tDockerImageManifestMediaType: mediaType,\n\t\t\t\tDockerImageConfig: string(config),\n\t\t\t\tDockerImageLayers: layers,\n\t\t\t}\n\n\t\t\treturn r.Restore.ImageStreamTag(imageStream, image, \"lost-found-\"+dgst.Hex())\n\t\t})\n\t\tif _, ok := err.(driver.PathNotFoundError); ok {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn fmt.Errorf(\"failed to restore images in the image stream %s: %s\", repoName, err)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tswitch err := err.(type) {\n\t\tcase driver.PathNotFoundError:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unable to list repositories: %s\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6b7b46217f118d8940d7bcc96682458", "score": "0.44837642", "text": "func (c *Config) EnablePersonalizationHub() bool { return c.m.EnablePersonalizationHub }", "title": "" } ]
dade0f3db54d9df0b61b955db658c50a
Valid checks if a Pressure is valid
[ { "docid": "3da58903f656772a1a4402c7135dd1ff", "score": "0.80339706", "text": "func (p Pressure) Valid() bool {\n\treturn p.Timestamp > 0 && p.Diastolic > 0 && p.Systolic > 0\n}", "title": "" } ]
[ { "docid": "63cfdac92fe51b0ba99c0d79e4c8dd2c", "score": "0.5915976", "text": "func (p *Profile) CheckValid() error", "title": "" }, { "docid": "63cfdac92fe51b0ba99c0d79e4c8dd2c", "score": "0.5915976", "text": "func (p *Profile) CheckValid() error", "title": "" }, { "docid": "f0e2d208916c441167ad147a6b914b71", "score": "0.5853615", "text": "func (g GeoPoint) Valid() bool {\n\treturn -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180\n}", "title": "" }, { "docid": "699b1bcbea67f7a38ba770d9cb48b42c", "score": "0.5790037", "text": "func (p *Polygon) Valid() bool {\n\treturn len(p.Points) >= 3\n}", "title": "" }, { "docid": "5ca57b4e8bb9f9e4e52816ab3796f151", "score": "0.5713497", "text": "func (s PagerDuty) Valid() error {\n\tif err := s.Base.valid(); err != nil {\n\t\treturn err\n\t}\n\tif s.RoutingKey.Key != s.ID.String()+routingKeySuffix {\n\t\treturn &influxdb.Error{\n\t\t\tCode: influxdb.EInvalid,\n\t\t\tMsg: \"pagerduty routing key is invalid\",\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a0595b9885509843631a727d391e4301", "score": "0.567115", "text": "func (j *Plex) Valid() bool {\n\treturn j.Event != \"\"\n}", "title": "" }, { "docid": "2e1d01f571b168fb96024bbdc21431c3", "score": "0.5643761", "text": "func (p Period) Valid() bool {\n\tif p == day || p == rollingWindow {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "13c38c1fa23a475eaf26f2d3fbce8716", "score": "0.5631959", "text": "func (g Geo) Valid() bool {\n\treturn g.Units.Valid()\n}", "title": "" }, { "docid": "3ab33890636fe1b916efac974d43590f", "score": "0.55989444", "text": "func (t Tri) Valid() bool {\n\tif t.p1 == t.p2 {\n\t\treturn false\n\t}\n\tif t.p1 == t.p3 {\n\t\treturn false\n\t}\n\tif t.p2 == t.p3 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c9e6b651c2eabd748922fa1c000c468c", "score": "0.5510439", "text": "func (s PagerDuty) Valid() error {\n\tif err := s.Base.valid(); err != nil {\n\t\treturn err\n\t}\n\tif s.MessageTemplate == \"\" {\n\t\treturn &influxdb.Error{\n\t\t\tCode: influxdb.EInvalid,\n\t\t\tMsg: \"pagerduty invalid message template\",\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "05c394e63501defb6a22c184b76768ed", "score": "0.5506475", "text": "func (r rangeSpec) valid(f field) bool {\n\treturn f.min <= r.start && r.start <= r.end && r.end <= f.max\n}", "title": "" }, { "docid": "db2a403499158259aeaeaa14077a88a4", "score": "0.5485664", "text": "func (g *Geometry) Valid() bool {\n\t_, err := g.MarshalJSON()\n\treturn err == nil\n}", "title": "" }, { "docid": "3b5c764116e918b831cac138e505c387", "score": "0.54377645", "text": "func (s Surge) Validate() error {\n\tif s.d.Exponent() > surgePrecision {\n\t\treturn fmt.Errorf(\"surge precision should be less or equal to %d, given %d\", surgePrecision, s.d.Exponent())\n\t}\n\tif s.d.Cmp(minSurge) == -1 {\n\t\treturn fmt.Errorf(\"surge is less than %v: %v\", minSurge, s.d)\n\t}\n\tif s.d.Cmp(maxSurge) == 1 {\n\t\treturn fmt.Errorf(\"surge is more than %v: %v\", maxSurge, s.d)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "545931c5d600ad7dc6e953e8c170c2c9", "score": "0.5425467", "text": "func (s *Settings) IsValid() error {\n\n\t//Controllo le impostazioni grafiche\n\tif err := s.Graphics.IsValid(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "96fadc538dba27b741ce63b1cd82c7a5", "score": "0.53978026", "text": "func (ck *PingCheck) Valid() error {\n\tif ck.Name == \"\" {\n\t\treturn fmt.Errorf(\"Invalid value for `Name`. Must contain non-empty string\")\n\t}\n\n\tif ck.Hostname == \"\" {\n\t\treturn fmt.Errorf(\"Invalid value for `Hostname`. Must contain non-empty string\")\n\t}\n\n\tif ck.Resolution != 1 && ck.Resolution != 5 && ck.Resolution != 15 &&\n\t\tck.Resolution != 30 && ck.Resolution != 60 {\n\t\treturn fmt.Errorf(\"invalid value %v for `Resolution`, allowed values are [1,5,15,30,60]\", ck.Resolution)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b69e6543a1202d47a0bd7f279b8fa76", "score": "0.5367893", "text": "func PlatesValidator(param interface{}) (bool, string) {\n\tvar regexValidator = regexp.MustCompile(\"^[A-Za-z]{2}([A-Za-z]{1,2}0?|[0-9]{1,2})[0-9]{2}$\")\n\tif !isString(param) || !regexValidator.MatchString(param.(string)) {\n\t\treturn false, \"is not in the required format\"\n\t}\n\treturn true, \"\"\n}", "title": "" }, { "docid": "21e6efa82e2cfbb7bfcd0b293a8939ab", "score": "0.5352073", "text": "func (f Feature) Valid() bool {\n\tswitch f {\n\tcase\n\t\tFeaturePopular,\n\t\tFeatureHRated,\n\t\tFeatureUpcoming,\n\t\tFeatureEditors,\n\t\tFeatureFreshToday,\n\t\tFeatureFreshYesterday,\n\t\tFeatureFreshWeek:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5ef2dcccbe0c58d77dc421b26120aeaf", "score": "0.53491515", "text": "func (e TransitionType) Valid() bool {\n\treturn e >= 1 && e <= 12\n}", "title": "" }, { "docid": "5b1a001615489b1025a3238512fcc13d", "score": "0.5333388", "text": "func (td Range) Valid() error {\n\tif td.Min > td.Max {\n\t\treturn &influxdb.Error{\n\t\t\tCode: influxdb.EInvalid,\n\t\t\tMsg: \"range threshold min can't be larger than max\",\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd5a536f31f0387c65d2881003323919", "score": "0.533209", "text": "func (g *G2) isValidProjective() bool { return (g.x.IsZero() & g.y.IsZero() & g.z.IsZero()) != 1 }", "title": "" }, { "docid": "a5c4f0e4ed90892965e153c2a15139ba", "score": "0.5323447", "text": "func (q *Quilt) PassesValidation(x, y int, proposed GrannySquare) bool {\n\tif proposed == defaultSquare() {\n\t\treturn false\n\t}\n\tif q.UsedMoreThanNTimes(3, proposed) {\n\t\treturn false\n\t}\n\tif !q.NoSidesMatch(x, y, proposed) {\n\t\treturn false\n\t}\n\tif !q.NoSameMiddleAndInner(x, y, proposed) {\n\t\treturn false\n\t}\n\n\tif !q.NoInners(x, y, proposed) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a99adb8740a790cb38d6dac65e319cf2", "score": "0.5297717", "text": "func (game *Game) ValidPhase() (err error) {\n\t// fetch the Game\n\tif game.Phase < 1 {\n\t\treturn errors.New(\"The Game has not started yet\")\n\t}\n\tnow := time.Now()\n\ttimestamp, err := strconv.ParseInt(game.PhaseEnd, 10, 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttm := time.Unix(timestamp, 0)\n\tvalid := now.Before(tm)\n\tif !valid {\n\t\treturn errors.New(\"The phase has ended\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "26f4f1e2f023b0f794c6b483d3335638", "score": "0.5284659", "text": "func ValidMetric(sample UDPMetric) bool {\n\tret := true\n\tret = ret && sample.Name != \"\"\n\tret = ret && sample.Value != nil\n\treturn ret\n}", "title": "" }, { "docid": "2a2bd1ae59ce43172929c2555a947dc9", "score": "0.5276765", "text": "func (p *PTE) Valid() bool {\n\treturn atomic.LoadUintptr((*uintptr)(p))&present != 0\n}", "title": "" }, { "docid": "4476be5a4d4dc84d312f19aefc886b9b", "score": "0.52448606", "text": "func (u Units) Valid() bool {\n\tswitch u {\n\tcase UnitsMi,\n\t\tUnitsKm:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ed745704f99abd270180a50d968af760", "score": "0.5217859", "text": "func (f *frames) Pressure() string {\n\treturn f.stringizeThis(\"pconfig\", \"Pressure\", \"mbar\", []singlePlot{\n\t\tsinglePlot{\n\t\t\tFieldname: \"Pressure\",\n\t\t\tLabel: \"Pressure\",\n\t\t\tSolid: \"rgba(2153, 102, 255,1.0)\",\n\t\t\tOpaque: \"rgba(153, 102, 255,0.8)\",\n\t\t\tFrames: *f,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "cb8e98f25f1f54f5269997bd281fc6e8", "score": "0.5215893", "text": "func (x *fastReflection_EventTake) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "8fc736293d7cb485ceac4bd0e154fbae", "score": "0.52144593", "text": "func (r *Range) Valid(x float64) bool {\n\treturn r.ValidFloat(x)\n}", "title": "" }, { "docid": "846c92d8b35b7523ffeae63b44607e8e", "score": "0.5211846", "text": "func (pw ProvisionWatcher) Validate() (bool, error) {\n\tif !pw.isValidated {\n\t\tif pw.Name == \"\" {\n\t\t\treturn false, NewErrContractInvalid(\"provision watcher name is blank\")\n\t\t}\n\t\terr := validate(pw)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn true, nil\n\t}\n\treturn pw.isValidated, nil\n}", "title": "" }, { "docid": "59d6f2309695649c39dd8944d3029306", "score": "0.52087635", "text": "func (v DirectionType) Valid() bool {\n\tswitch v {\n\tcase DirectionUp:\n\t\treturn true\n\tcase DirectionDown:\n\t\treturn true\n\tcase DirectionLeft:\n\t\treturn true\n\tcase DirectionRight:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "6b88105aaf4e4ad50ae075fb45ac95e9", "score": "0.5195445", "text": "func (p Pos) IsValid() bool", "title": "" }, { "docid": "48d1a0aaa14dee7664467f57a63321b4", "score": "0.5183808", "text": "func (pnt TrackPoint) GetTimeDataValid() bool {\n\treturn pnt.TimeValid\n}", "title": "" }, { "docid": "e6b597cfb06fd69b3d4bc594b51394a5", "score": "0.5172713", "text": "func (m *PCL) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "0a3192bd0167003319d26071200ca505", "score": "0.5170189", "text": "func (d Direction) Valid() bool {\n\treturn d < 5 && d != 0\n}", "title": "" }, { "docid": "5fa5140574c19957920ad8e7e22bb420", "score": "0.5168064", "text": "func (p *StreamCriterias) Valid() bool {\n\treturn p.Feature.Valid()\n}", "title": "" }, { "docid": "855c66eaff9d215774d6af2f5826e256", "score": "0.5157481", "text": "func (e DialogType) Valid() bool {\n\treturn e >= 1 && e <= 4\n}", "title": "" }, { "docid": "14fbee4a35d4c818b7a89cdab8215e36", "score": "0.5136364", "text": "func (t Threshold) Valid() error {\n\tif err := t.Base.Valid(); err != nil {\n\t\treturn err\n\t}\n\tfor _, cc := range t.Thresholds {\n\t\tif err := cc.Valid(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "568c64c7c9470e33f0eedda09044cc41", "score": "0.5131997", "text": "func (q *Questionnaire) Valid() bool { return true }", "title": "" }, { "docid": "df43b514d6d24ec946ed690d11e8988a", "score": "0.51034075", "text": "func (pos *Position) IsValid() bool", "title": "" }, { "docid": "01b461a5af7331a4e32dab8c112ebb02", "score": "0.50998616", "text": "func (item *Item) Valid() bool {\n\t_, err := item.Price()\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c354a021a5b03c819f50950eb0d1a8b9", "score": "0.5092873", "text": "func (p *Project) Valid() bool {\n\tif p.Spec == nil {\n\t\tfmt.Println(\"no project spec\")\n\t\treturn false\n\t}\n\n\treturn p.Spec.Valid()\n}", "title": "" }, { "docid": "f7e08ac35ffbe9544c9ca2c71e86258a", "score": "0.50925565", "text": "func (i *info) validate() error {\n\tif len(i.PhaseNumber) != 1 {\n\t\treturn fmt.Errorf(\"Invalid Phase Number: %v\", i.PhaseNumber)\n\t}\n\n\tif len(i.VARating) <= 0 || len(i.VARating) > 6 {\n\t\treturn fmt.Errorf(\"Invalid VA Rating: %v\", i.VARating)\n\t}\n\n\tif len(i.FirmwareVersion) <= 0 || len(i.FirmwareVersion) > 10 {\n\t\treturn fmt.Errorf(\"Invalid Firmware Version: %v\", i.FirmwareVersion)\n\t}\n\n\tif len(i.ModelName) <= 0 || len(i.ModelName) > 16 {\n\t\treturn fmt.Errorf(\"Invalid Model Name: %v\", i.ModelName)\n\t}\n\n\tif len(i.Manufacturer) <= 0 || len(i.Manufacturer) > 16 {\n\t\treturn fmt.Errorf(\"Invalid Manufacturer: %v\", i.Manufacturer)\n\t}\n\n\tif len(i.SerialNumber) <= 0 || len(i.SerialNumber) > 16 {\n\t\treturn fmt.Errorf(\"Invalid Serial Number: %v\", i.SerialNumber)\n\t}\n\n\ts, err := numerics(i.NominalPV, 10)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(s) <= 0 || len(s) > 4 {\n\t\treturn fmt.Errorf(\"Invalid Nominal PV: %v\", i.NominalPV)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5de6cb3d4eedcf5169f46811a0a0532c", "score": "0.5084191", "text": "func (q TimeQuantum) Valid() bool {\n\tswitch q {\n\tcase \"Y\", \"YM\", \"YMD\", \"YMDH\",\n\t\t\"M\", \"MD\", \"MDH\",\n\t\t\"D\", \"DH\",\n\t\t\"H\",\n\t\t\"\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "1c6f3974c9ace5738d769016725c45a0", "score": "0.50792927", "text": "func (vt ValueType) IsValid() bool {\n\treturn vt < 4\n}", "title": "" }, { "docid": "6cbd12b0148a2bad99a28f2c91cab309", "score": "0.507489", "text": "func (s Size) Valid() bool {\n\tswitch s {\n\tcase\n\t\tSize70x70,\n\t\tSize140x140,\n\t\tSize280x280,\n\t\tSize900l:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f1bb273d120b44d49c11e210d986a31c", "score": "0.50633186", "text": "func (r *Release) IsValid() bool {\n\treturn r.IsDelta() || r.IsPackage()\n}", "title": "" }, { "docid": "84b553e50a6ae252d162cd2e4248943d", "score": "0.505774", "text": "func (r Resources) Valid() error {\n\tvar errs []string\n\tif r.CPU <= 0.0 {\n\t\terrs = append(errs, \"cpu (floating point fractional CPUs) not specified or zero\")\n\t}\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(strings.Join(errs, \"; \"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8ee627ad0cf7b9761926df14c8456a5", "score": "0.50532", "text": "func (p Pin) IsValid() bool {\n\treturn p.h != 0\n}", "title": "" }, { "docid": "0e1631be59c744ab5257478d748ec222", "score": "0.5045355", "text": "func (m *PRun) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "64402f3549762094e29a317750efe7f7", "score": "0.5015798", "text": "func (d Direction) Valid() error {\n\tswitch d {\n\tcase North:\n\tcase East:\n\tcase South:\n\tcase West:\n\tdefault:\n\t\treturn errUnknownDirection(d)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ccfb4f5012d3233b12276fd812801218", "score": "0.5012421", "text": "func (m *ReleaseGatesPhase) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with ReleaseDeployPhase\n\tif err := m.ReleaseDeployPhase.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIgnoredGates(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStabilizationCompletedOn(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSucceedingSince(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": "5b3dde162f5df269af8b3c13aec707cf", "score": "0.49937618", "text": "func (g *GetPushesPerDaytimesParameters) IsValid() (bool, string) {\n\treturn true, \"\"\n}", "title": "" }, { "docid": "1b6c605c0c3692878cb101c7ef1b76cf", "score": "0.49906886", "text": "func (gs *GraphicSettings) IsValid() error {\n\n\tfmt.Println(\"PRIMARY\", gs.Primary)\n\n\tif !kaoriUtils.CheckHash(gs.Background) {\n\t\tif gs.Background != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings background not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.OnBackground) {\n\t\tif gs.OnBackground != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings onBackground not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface1) {\n\t\tif gs.Surface1 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface1 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface2) {\n\t\tif gs.Surface2 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface2 not valid.\")\n\t\t}\n\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface3) {\n\t\tif gs.Surface3 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface3 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface4) {\n\t\tif gs.Surface4 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface4 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface6) {\n\t\tif gs.Surface6 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface6 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface8) {\n\t\tif gs.Surface8 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface8 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface12) {\n\t\tif gs.Surface12 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface12 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface16) {\n\t\tif gs.Surface16 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface16 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Surface24) {\n\t\tif gs.Surface24 != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings surface24 not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.OnSurface) {\n\t\tif gs.OnSurface != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings onSurface not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Primary) {\n\t\tif gs.Primary != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings primary not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.PrimaryDark) {\n\t\tif gs.PrimaryDark != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings primaryDark not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.OnPrimary) {\n\t\tif gs.OnPrimary != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings onPrimary not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Secondary) {\n\t\tif gs.Secondary != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings secondary not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.SecondaryDark) {\n\t\tif gs.SecondaryDark != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings secondaryDark not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.OnSecondary) {\n\t\tif gs.OnSecondary != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings onSecondary not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.Error) {\n\t\tif gs.Error != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings error not valid.\")\n\t\t}\n\t}\n\n\tif !kaoriUtils.CheckHash(gs.OnError) {\n\t\tif gs.OnError != \"\" {\n\t\t\treturn errors.New(\"Graphics Settings onError not valid.\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "61b1839b0f078efd859bfdea40171edc", "score": "0.49864262", "text": "func (p Priority) IsValid() bool {\n\treturn p > 1 && p <= 100\n}", "title": "" }, { "docid": "a470fe30894a25fddda5d144105d7e61", "score": "0.49825948", "text": "func (p Pos) IsValid() bool { return p != Pos{} }", "title": "" }, { "docid": "a4bc3d235ad37de905f8e2eea428f592", "score": "0.4978615", "text": "func (p *Project) Valid() bool {\n\tif p.Name == \"\" {\n\t\tfmt.Println(\"no project spec name\")\n\t\treturn false\n\t}\n\n\tfor _, r := range p.Resources {\n\t\tif !r.Valid() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9b7d2b0ca3ca64d20e6476219318c2f4", "score": "0.497302", "text": "func (pos *Position) IsValid() bool {}", "title": "" }, { "docid": "814e05dc7b98d1a65996ffb905403674", "score": "0.49683636", "text": "func (p *passport) isValid() bool {\n\treturn isValidYear(p.byr, 1920, 2002) &&\n\t\tisValidYear(p.iyr, 2010, 2020) &&\n\t\tisValidYear(p.eyr, 2020, 2030) &&\n\t\tisValidHeight(p.hgt) &&\n\t\thairColorRegexp.MatchString(p.hcl) &&\n\t\teyeColorRegexp.MatchString(p.ecl) &&\n\t\tpidRegexp.MatchString(p.pid)\n}", "title": "" }, { "docid": "80e1ad07799ae4ae800af46fd714b2b9", "score": "0.49612492", "text": "func (x *fastReflection_DVVTriplet) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "5e24101896cb540f96a87812e9c20cf9", "score": "0.49410284", "text": "func (p *PoolGProperty) Validate() *PoolGProperty {\n\tfor _, check := range p.checks {\n\t\tif !check(p) {\n\t\t\tp.err = errors.Wrapf(p.err, \"validation failed {%v}\", runtime.FuncForPC(reflect.ValueOf(check).Pointer()).Name())\n\t\t}\n\t}\n\treturn p\n}", "title": "" }, { "docid": "c945c115c945759a58d5d47c572cc360", "score": "0.49384698", "text": "func (en Env) Valid() bool {\n\n\tif en.Drop == \"0\" && en.Pay == \"1\" {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fe9b4670508e1e81498aaa244c13fa8d", "score": "0.4934651", "text": "func (a Aftertouch) Pressure() uint8 {\n\treturn a.pressure\n}", "title": "" }, { "docid": "c1318ded207411a02c471cac1747666b", "score": "0.49332324", "text": "func isValidTriangule(a, b, c float64) bool {\n\tif !isValidSide(a) || !isValidSide(b) || !isValidSide(c) {\n\t\treturn false\n\t} else if a+b < c || a+c < b || c+b < a {\n\t\treturn false\n\t} else {\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "16df869bb28208da195610c4908b57ff", "score": "0.49322188", "text": "func (l *Level) Valid() bool {\n\tswitch *l {\n\tcase LevelPrivileged, LevelBaseline, LevelRestricted:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "3b4e07152ceeeb939490d37e68b7c22e", "score": "0.4919928", "text": "func (d *Datapoint) Validate() (map[string]interface{}, bool) {\n\tif d.Timestamp <= 0 {\n\t\treturn utils.Message(false, \"Location is empty\"), false\n\t}\n\tif d.Location == \"\" {\n\t\treturn utils.Message(false, \"Location is empty\"), false\n\t}\n\n\tif d.Room == \"\" {\n\t\treturn utils.Message(false, \"Room is empty\"), false\n\t}\n\n\tif d.Name == \"\" {\n\t\treturn utils.Message(false, \"Name is empty\"), false\n\t}\n\n\tif d.Sensor == \"\" {\n\t\treturn utils.Message(false, \"Sensor is empty\"), false\n\t}\n\n\treturn utils.Message(true, \"success\"), true\n}", "title": "" }, { "docid": "31461c8cdf772f225df3c4035e787ea5", "score": "0.49170443", "text": "func (x *fastReflection_DVVTriplets) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "36cb4bd3d51b5472fda923481623a23c", "score": "0.49156994", "text": "func (pkt PacketType) Valid() bool {\n\treturn pkt > RESERVED && pkt < RESERVED2\n}", "title": "" }, { "docid": "6afa181e53d818f24cd96c17d5b70aa9", "score": "0.49105254", "text": "func (i Square) Valid() bool {\n\treturn i < 64\n}", "title": "" }, { "docid": "d3452737bc920f9b6ce82d408784c2ef", "score": "0.4904434", "text": "func (g Grace) Valid() error {\n\tvar errs []string\n\n\tif g.Startup.Duration < minStartupDuration || g.Startup.Duration > maxStartupDuration {\n\t\terrs = append(errs, fmt.Sprintf(\"startup (%s) must be between %s and %s\", g.Startup, minStartupDuration, maxStartupDuration))\n\t}\n\n\tif g.Shutdown.Duration < minShutdownDuration || g.Shutdown.Duration > maxShutdownDuration {\n\t\terrs = append(errs, fmt.Sprintf(\"shutdown (%s) must be between %s and %s\", g.Shutdown, minShutdownDuration, maxShutdownDuration))\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(strings.Join(errs, \"; \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "140015c0eb41a2c0a73cfa8338c8131b", "score": "0.48934737", "text": "func (s *Scale) IsValid() bool {\n\treturn s.Root.IsValid() && s.Type.IsValid()\n}", "title": "" }, { "docid": "6844ee8b1913945d94d76614253db2cd", "score": "0.4885185", "text": "func (s Plate) Check() error {\n\tswitch {\n\tcase s.Height <= 0:\n\t\treturn fmt.Errorf(\"Not correct height %v of plate\", s.Height)\n\tcase s.Thickness <= 0:\n\t\treturn fmt.Errorf(\"Not correct thk. %v of plate\", s.Thickness)\n\tcase s.Height < s.Thickness:\n\t\treturn fmt.Errorf(\"Strange ratio of plate(%v x %v)\", s.Height, s.Thickness)\n\tcase s.Height >= 0.600:\n\t\treturn fmt.Errorf(\"Height of plate is too height - %v. Please use unit - meter\", s.Height)\n\tcase s.Thickness >= 0.040:\n\t\treturn fmt.Errorf(\"Thk of plate is too big - %v. Please use unit - meter\", s.Thickness)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7339f73135ab201d9a66f650d2fa9273", "score": "0.488228", "text": "func (s Sign) Valid() bool {\n\treturn s.r.BitLen() != 0 && s.s.BitLen() != 0 && s.recid < 4\n}", "title": "" }, { "docid": "f005b4851caba2084b544257e2431fa4", "score": "0.48676246", "text": "func (p *Parameter) Validate() error {\n\tif p.Name == \"\" {\n\t\treturn fmt.Errorf(\"parameter name can't be empty\")\n\t}\n\n\tif p.In == nil {\n\t\treturn fmt.Errorf(\"parameter location can't be empty\")\n\t}\n\n\tif err := p.In.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "860b70077e691f9d59eceb60afd3e11c", "score": "0.48600107", "text": "func (o PrintFormat) IsValid() bool {\n\tswitch o {\n\tcase TableFormat, JSONFormat, YAMLFormat:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "23d79658975ce6d9799241ba728e0447", "score": "0.4851291", "text": "func validCoord(coord Coordinate, x int, y int) bool {\n\treturn coord.X >= 0 && coord.Y >= 0 && coord.X < x && coord.Y < y\n}", "title": "" }, { "docid": "06aa849ba8f3487cd5877c7e1146d2ed", "score": "0.4851107", "text": "func ValidPSub(key, token string, shared bool) bool {\n\tpv := psubValidityStruct{key, token, shared, make(chan bool)}\n\tpsubValidityChan <- pv\n\treturn <-pv.valid\n}", "title": "" }, { "docid": "ecb2fd96aa7d11d162011c7c4ed89d2c", "score": "0.484599", "text": "func (f expectedCostMax) valid(data interface{}) error {\n\tif _, ok := data.(float64); !ok {\n\t\treturn fmt.Errorf(\"%s: not a number\", filtersName[f])\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bf649bb80cce11b5cd4bb9abcda2451", "score": "0.48426807", "text": "func (s Schedule) Validate() error {\n\n\tstartTime := s.GetStartTime()\n\tendTime := s.GetEndTime()\n\tratio := s.GetRatio()\n\n\tif startTime < 0 {\n\t\treturn errors.New(\"vesting start-time cannot be negative\")\n\t}\n\n\tif endTime < startTime {\n\t\treturn errors.New(\"vesting start-time cannot be before end-time\")\n\t}\n\n\tif ratio.LTE(sdk.ZeroDec()) {\n\t\treturn errors.New(\"vesting ratio cannot be smaller than or equal with zero\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e9def890074ab1640fa9a83291c0cd77", "score": "0.48420838", "text": "func (chrome *Chromosome) IsValid() bool {\r\n\tif !chrome.IsValidForLinks() || !chrome.IsValidForNodes() || !chrome.IsValidForDice() {\r\n\t\treturn false\r\n\t}\r\n\treturn true\r\n}", "title": "" }, { "docid": "d821b0896a3e69ac167802c5a7d2fb33", "score": "0.4837833", "text": "func (ts *TimeSpan) IsValid() bool {\n\treturn ts.isValid\n}", "title": "" }, { "docid": "82988d98736685ed7dd7cc9b70d0ef97", "score": "0.48334506", "text": "func (p Params) Validate() error {\n\tif err := validateMinPrice(p.MinPrice); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c1346ddedc58026945e2eeb8d5cdf0e", "score": "0.48300508", "text": "func (p Params) Validate() error {\n\tif p.NewMappingFee.IsNegative() {\n\t\treturn fmt.Errorf(\"NewMappingFee cannot be negative\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9c8547a58c2306c80cfe86772e66809", "score": "0.48235524", "text": "func (m *ReleaseRelease) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateChart(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateConfig(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInfo(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": "acf6a0236bc9fc095aea6cf707b02f48", "score": "0.48205534", "text": "func (v DestinationGaebType) IsValid() bool {\n\tfor _, existing := range AllowedDestinationGaebTypeEnumValues {\n\t\tif existing == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0cfbbb8cce0300dead5e2ec4b61a8f6f", "score": "0.48200354", "text": "func (p *ProjectSpec) Valid() bool {\n\tif p.Name == \"\" {\n\t\tfmt.Println(\"no project spec name\")\n\t\treturn false\n\t}\n\n\tfor _, r := range p.Resources {\n\t\tif !r.Valid() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "263f0d5541a23c9dadc4f281b3210a26", "score": "0.4809564", "text": "func (r ReportInterval) IsValid() bool {\n\tswitch r {\n\tcase ReportInterval5Min, ReportIntervalHourly, ReportIntervalDaily, ReportIntervalArchive:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "f3a1611e9fe973f997cfc8ea5777566f", "score": "0.48027194", "text": "func (p *Parquet) Valid() (bool, error) {\n\theader, err := p.readMagicAt(0)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// The last f\n\tfooter, err := p.readMagicAt(p.size - 4)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn bytes.Equal(magic, header) && bytes.Equal(magic, footer), nil\n}", "title": "" }, { "docid": "6994d171ec35ffa8c35088cb99970730", "score": "0.47998336", "text": "func (cmd *TeamPlan) Valid() error {\n\tif cmd.Provider == \"\" {\n\t\treturn errors.New(\"empty value for -p flag\")\n\t}\n\tif cmd.StackTemplateID == \"\" {\n\t\treturn errors.New(\"empty value for -tid flag\")\n\t}\n\tif cmd.Team == \"\" {\n\t\treturn errors.New(\"empty value for -team flag\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f478a2d4070103eabc4b7492256c9ea", "score": "0.47976843", "text": "func (m *TemperatureProbe) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateEnabled(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLabel(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLimits(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": "38b410bcbfe4707b26b6c3a91c90edec", "score": "0.47891024", "text": "func (f Flag) Valid() bool {\n\treturn f.Template != \"\" && f.Data != \"\"\n}", "title": "" }, { "docid": "63014317d33bb9d2e8ec94dea69e41a8", "score": "0.47822577", "text": "func IsValidTimeSlot(timeSlot , trainName string) bool {\n\tfor _, slot := range AvailableSlots[trainName] {\n\t\tif slot == timeSlot {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "fc102f37d057e9f17cc1c2784332d019", "score": "0.478163", "text": "func (c *Charge) IsValid() (valid bool) {\n\tswitch {\n\tcase c == nil:\n\t\treturn false\n\tcase c.Amount == \"\":\n\t\treturn false\n\tcase c.Currency == \"\":\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "88946a27b96230f71b9e3d93a2d8a32f", "score": "0.477978", "text": "func (ck *TCPCheck) Valid() error {\n\tif ck.Name == \"\" {\n\t\treturn fmt.Errorf(\"invalid value for `Name`, must contain non-empty string\")\n\t}\n\n\tif ck.Hostname == \"\" {\n\t\treturn fmt.Errorf(\"invalid value for `Hostname`, must contain non-empty string\")\n\t}\n\n\tif ck.Resolution != 1 && ck.Resolution != 5 && ck.Resolution != 15 &&\n\t\tck.Resolution != 30 && ck.Resolution != 60 {\n\t\treturn fmt.Errorf(\"invalid value %v for `Resolution`, allowed values are [1,5,15,30,60]\", ck.Resolution)\n\t}\n\n\tif ck.Port < 1 {\n\t\treturn fmt.Errorf(\"Invalid value for `Port`. Must contain an integer >= 1\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e3d89c995a695818ace9c0e6f6b13877", "score": "0.47755805", "text": "func (p Patch) Valid() bool {\n\treturn p.Empty() || p.Full()\n}", "title": "" }, { "docid": "290ba33cb916cf7143b59af73fc6f663", "score": "0.47705185", "text": "func (sl *Slot) IsValid() bool {\n\treturn sl.Number >= SlotNumberLowerLimit\n}", "title": "" }, { "docid": "b4e8b08a82e0dae86fcb4997a286d703", "score": "0.47681272", "text": "func (self *Volume) IsValid() error {\n\t// Check if a type is specified.\n\tif self.Spec.SparseLoopDevice == nil &&\n\t\tself.Spec.RawBlockDevice == nil &&\n\t\tself.Spec.LVMLogicalVolume == nil {\n\t\treturn errors.New(\"volume type not found in Volume Spec\")\n\t}\n\t// Check if the size is strictly positive.\n\tif self.Spec.SparseLoopDevice != nil {\n\t\tif self.Spec.SparseLoopDevice.Size.Sign() <= 0 {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"invalid SparseLoopDevice size (should be greater than 0): %s\",\n\t\t\t\tself.Spec.SparseLoopDevice.Size.String(),\n\t\t\t)\n\t\t}\n\t} else if self.Spec.LVMLogicalVolume != nil {\n\t\tif self.Spec.LVMLogicalVolume.Size.Sign() <= 0 {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"invalid LVM LogicalVolume size (should be greater than 0): %s\",\n\t\t\t\tself.Spec.LVMLogicalVolume.Size.String(),\n\t\t\t)\n\t\t}\n\t}\n\n\t// Default to Filesystem when mode is not specified.\n\tif self.Spec.Mode == \"\" {\n\t\tself.Spec.Mode = corev1.PersistentVolumeFilesystem\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "09e91904a2fd6c530c7ed423549eaf82", "score": "0.47646773", "text": "func (b ThresholdConfigBase) Valid() error {\n\treturn nil\n}", "title": "" }, { "docid": "a733e1d6787d4bdbbda0b48b08c0eaf8", "score": "0.4759214", "text": "func (i Issuance) ValidData() error {\n\tif !i.Type.IsValid() {\n\t\treturn fmt.Errorf(`invalid \"type\": %v`, i.Type)\n\t}\n\tif i.Supply == 0 || i.Supply < -1 {\n\t\treturn fmt.Errorf(`invalid \"supply\": must be positive or -1`)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78e3036c9cf8d0821753ad58fae5f9f2", "score": "0.47585264", "text": "func ValidTime(end, start time.Time) bool {\n\treturn !end.IsZero() && start.Before(end) || end.IsZero()\n}", "title": "" }, { "docid": "d0a8f86c548cec1647f8fc7467c41969", "score": "0.47549766", "text": "func (b *FloatBounds) IsValid() bool {\n\treturn b.Lower <= b.Upper && (b.Lower >= 0 && b.Upper >= 0)\n}", "title": "" } ]
fc3c3ca993fa47382a0d589d04e6ec5f
Dimensions of the metric.
[ { "docid": "4a41a0369c9a441faaf099778f517f52", "score": "0.6946854", "text": "func (o PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricOutput) Dimensions() PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetric) []PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimension {\n\t\treturn v.Dimensions\n\t}).(PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput)\n}", "title": "" } ]
[ { "docid": "1345a7bf47d48339bfcac3996bbac148", "score": "0.71013016", "text": "func (o PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricOutput) Dimensions() PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetric) []PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricDimension {\n\t\treturn v.Dimensions\n\t}).(PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "452415f7c0a8552ca9e31c1c02689af2", "score": "0.7041928", "text": "func (o PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricOutput) Dimensions() PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetric) []PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimension {\n\t\treturn v.Dimensions\n\t}).(PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "2ac7993644b12e3d3a3fefdff2130744", "score": "0.6989165", "text": "func (o *AzureMonitoredMetric) GetDimensions() []string {\n\tif o == nil || o.Dimensions == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.Dimensions\n}", "title": "" }, { "docid": "4d0c41c2f8ae46b7dba95f9b8261484e", "score": "0.6985951", "text": "func (p *Probability) Dimensions() int {\n\treturn p.Dim\n}", "title": "" }, { "docid": "c566cf153b70595077af7be053399bfe", "score": "0.6984763", "text": "func (pc *PromCollector) Dimensions() int {\n\treturn pc.dimensions\n}", "title": "" }, { "docid": "c566cf153b70595077af7be053399bfe", "score": "0.6984763", "text": "func (pc *PromCollector) Dimensions() int {\n\treturn pc.dimensions\n}", "title": "" }, { "docid": "9bb7364864fb4e02d3c75d47a8c98bb8", "score": "0.6966264", "text": "func (o PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricOutput) Dimensions() PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetric) []PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricDimension {\n\t\treturn v.Dimensions\n\t}).(PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "838a2f9815e0c166089cf986560e6645", "score": "0.68737286", "text": "func (o PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricPtrOutput) Dimensions() PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v *PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetric) []PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimensions\n\t}).(PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedLoadMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "341dce5fa6a1898b9f9792751ae9a20b", "score": "0.6846034", "text": "func (n *Normal) Dimensions() int {\n\treturn n.Dim\n}", "title": "" }, { "docid": "3f1da1f5fd8d8dc00513269d30809744", "score": "0.6807782", "text": "func (l *Linear) Dimensions() int {\n\treturn l.Dim\n}", "title": "" }, { "docid": "92e952797d683cdbc0172e4355b6ce07", "score": "0.67262006", "text": "func (o PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricPtrOutput) Dimensions() PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v *PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetric) []PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimensions\n\t}).(PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedCapacityMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "c36146da18a8bdd9f7ed53855d2fc839", "score": "0.67156225", "text": "func (o PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricPtrOutput) Dimensions() PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v *PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetric) []PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimensions\n\t}).(PolicyPredictiveScalingConfigurationMetricSpecificationCustomizedScalingMetricSpecificationMetricDataQueryMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "3d65743c0e68cd4fa5e5aa365bddfbc0", "score": "0.66829437", "text": "func (o PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricPtrOutput) Dimensions() PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v *PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetric) []PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimensions\n\t}).(PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricMetricStatMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "7059e7cebb55be9d88373092763a1a2f", "score": "0.65914047", "text": "func (n *node) Dimensions() LabelPairs {\n\treturn n.myLabels\n}", "title": "" }, { "docid": "0ca4d86c62efa046ab3c79589dd0e7ec", "score": "0.6565855", "text": "func (d *Dimensions) Size() int {\n\treturn d.X * d.Y * d.Z\n}", "title": "" }, { "docid": "f125aaeaf14a746899bede3da26cfc63", "score": "0.6544988", "text": "func (o RuleGroupRuleGroupRulesSourceStatelessRulesAndCustomActionsCustomActionActionDefinitionPublishMetricActionOutput) Dimensions() RuleGroupRuleGroupRulesSourceStatelessRulesAndCustomActionsCustomActionActionDefinitionPublishMetricActionDimensionArrayOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleGroupRulesSourceStatelessRulesAndCustomActionsCustomActionActionDefinitionPublishMetricAction) []RuleGroupRuleGroupRulesSourceStatelessRulesAndCustomActionsCustomActionActionDefinitionPublishMetricActionDimension {\n\t\treturn v.Dimensions\n\t}).(RuleGroupRuleGroupRulesSourceStatelessRulesAndCustomActionsCustomActionActionDefinitionPublishMetricActionDimensionArrayOutput)\n}", "title": "" }, { "docid": "145c6c302458202da49a4fa588ed193b", "score": "0.6535059", "text": "func (z2 *Z2) GetDimensions() int {\n\treturn z2.Dimensions\n}", "title": "" }, { "docid": "bafa4637fae5ed2ee2b1aa87bc62123e", "score": "0.6475852", "text": "func (o PolicyTargetTrackingConfigurationCustomizedMetricSpecificationOutput) MetricDimensions() PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v PolicyTargetTrackingConfigurationCustomizedMetricSpecification) []PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricDimension {\n\t\treturn v.MetricDimensions\n\t}).(PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "75b113cdd5ce33cb839047436db2be82", "score": "0.63873225", "text": "func (m Matrix) Dimension() (rows, columns int) {\n\t// total number of rows in matrix\n\trows = len(m)\n\t// total number of columns in matrix\n\tcolumns = len(m[0])\n\treturn\n}", "title": "" }, { "docid": "2535344460341761e3f65fc1e8521a22", "score": "0.63852566", "text": "func (r *RecordReport) GetDimensions() string {\n\treturn r.Dimensions\n}", "title": "" }, { "docid": "13c137f7619d655c2038c6b80b9c94d9", "score": "0.635365", "text": "func (level *Level) GetDimensions() map[string]*Dimension {\n\tlevel.mutex.RLock()\n\tdefer level.mutex.RUnlock()\n\treturn level.dimensions\n}", "title": "" }, { "docid": "a106b5d9fde8fce54068d9e08529dfbd", "score": "0.6340341", "text": "func (o PolicyTargetTrackingConfigurationCustomizedMetricSpecificationPtrOutput) MetricDimensions() PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricDimensionArrayOutput {\n\treturn o.ApplyT(func(v *PolicyTargetTrackingConfigurationCustomizedMetricSpecification) []PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MetricDimensions\n\t}).(PolicyTargetTrackingConfigurationCustomizedMetricSpecificationMetricDimensionArrayOutput)\n}", "title": "" }, { "docid": "141bab5d25cd08f7ada7628d0e82dd3a", "score": "0.6312448", "text": "func (o FirewallPolicyFirewallPolicyStatelessCustomActionActionDefinitionPublishMetricActionOutput) Dimensions() FirewallPolicyFirewallPolicyStatelessCustomActionActionDefinitionPublishMetricActionDimensionArrayOutput {\n\treturn o.ApplyT(func(v FirewallPolicyFirewallPolicyStatelessCustomActionActionDefinitionPublishMetricAction) []FirewallPolicyFirewallPolicyStatelessCustomActionActionDefinitionPublishMetricActionDimension {\n\t\treturn v.Dimensions\n\t}).(FirewallPolicyFirewallPolicyStatelessCustomActionActionDefinitionPublishMetricActionDimensionArrayOutput)\n}", "title": "" }, { "docid": "43b82b20c2df64f4c0889b916abfd488", "score": "0.6309941", "text": "func (space Space) Dim(data []core.Elemt) (dim int) {\n\tif len(data) > 0 {\n\t\telemts := data[0].([]float64)\n\t\tdim = len(elemts)\n\t}\n\treturn\n}", "title": "" }, { "docid": "783c6bb3d5373c8329b4c61a627363b0", "score": "0.62487733", "text": "func (o GetCostCategoryRuleRuleOutput) Dimensions() GetCostCategoryRuleRuleDimensionArrayOutput {\n\treturn o.ApplyT(func(v GetCostCategoryRuleRule) []GetCostCategoryRuleRuleDimension { return v.Dimensions }).(GetCostCategoryRuleRuleDimensionArrayOutput)\n}", "title": "" }, { "docid": "040a6dedebc03cf9de5e6a13b3b8c78f", "score": "0.6248068", "text": "func (r *Range) Dimensions() *Point {\n\treturn r.P2.Sub(r.P1)\n}", "title": "" }, { "docid": "1e607030349cae30059bfcce3436e6ee", "score": "0.6189755", "text": "func (o ConfigurationResponseOutput) Dimensions() DimensionsResponseOutput {\n\treturn o.ApplyT(func(v ConfigurationResponse) DimensionsResponse { return v.Dimensions }).(DimensionsResponseOutput)\n}", "title": "" }, { "docid": "17ede0170d482fa1f0af48994d3eeddc", "score": "0.61875194", "text": "func (m *Metric) Dimension(name, value string) *Metric {\n\tm.dimensions = append(m.dimensions, &cloudwatch.Dimension{\n\t\tName: &name,\n\t\tValue: &value,\n\t})\n\n\treturn m\n}", "title": "" }, { "docid": "f4af28c20cf79ebe86b9f1c709f916f1", "score": "0.6187437", "text": "func (o ReportOutput) Dimensions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *Report) pulumi.StringArrayOutput { return v.Dimensions }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7f351b1b289f61efbffb9bfed007d4ce", "score": "0.61422706", "text": "func getDimensions() Dimensions {\n\ttermH := goterm.Height()\n\ttermW := goterm.Width()\n\n\t// Let the title widget occupy 10% of terminal height.\n\ttitleH := termH / 10\n\ttitleW := termW\n\n\t// We currently have 4 gauges one under another.\n\tgaugeH := (termH - titleH) / 4\n\tgaugeW := termW / 5\n\n\t// We currently have 2 charts one under another next to the gauges.\n\tchartH := 2 * gaugeH\n\tchartW := termW - gaugeW\n\n\treturn Dimensions{\n\t\tTitleH: titleH,\n\t\tTitleW: titleW,\n\t\tGaugeH: gaugeH,\n\t\tGaugeW: gaugeW,\n\t\tChartH: chartH,\n\t\tChartW: chartW,\n\t}\n}", "title": "" }, { "docid": "db580a3c2956e51d08036bbf0fb83668", "score": "0.6133774", "text": "func (v *vectorComplex) Dim() int { return len(v.elements) }", "title": "" }, { "docid": "b9874f684a760127738c0615db57eadc", "score": "0.61333627", "text": "func (s Shape) NumDimensions() int {\n\tif s.dims == nil {\n\t\treturn -1\n\t}\n\treturn len(s.dims)\n}", "title": "" }, { "docid": "9955c32490023f9b0230c714c76ba2cc", "score": "0.61261296", "text": "func (v *vector) Dim() int { return len(v.elements) }", "title": "" }, { "docid": "3e786b02ba8f692468f833a59722cb6b", "score": "0.61247784", "text": "func (o AnomalySubscriptionThresholdExpressionPtrOutput) Dimension() AnomalySubscriptionThresholdExpressionDimensionPtrOutput {\n\treturn o.ApplyT(func(v *AnomalySubscriptionThresholdExpression) *AnomalySubscriptionThresholdExpressionDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimension\n\t}).(AnomalySubscriptionThresholdExpressionDimensionPtrOutput)\n}", "title": "" }, { "docid": "f6fc5b12087cbfdd6ad3d92e36a75173", "score": "0.6109867", "text": "func (v *Volume) Dimensions() Dimensions {\n\treturn v.dim\n}", "title": "" }, { "docid": "1e203b8b031d6789ea1b14c17170bc2d", "score": "0.61098224", "text": "func (o AnomalySubscriptionThresholdExpressionOutput) Dimension() AnomalySubscriptionThresholdExpressionDimensionPtrOutput {\n\treturn o.ApplyT(func(v AnomalySubscriptionThresholdExpression) *AnomalySubscriptionThresholdExpressionDimension {\n\t\treturn v.Dimension\n\t}).(AnomalySubscriptionThresholdExpressionDimensionPtrOutput)\n}", "title": "" }, { "docid": "c4960aa33646f4b084717598a2488173", "score": "0.6073688", "text": "func (model *LinearModel) Dimensions() (int, error) {\n\tif model.trained == false {\n\t\treturn 0, fmt.Errorf(\"LinearModel: untrained models have no dimentionality\")\n\t}\n\n\treturn len(model.parameters) - 1, nil\n}", "title": "" }, { "docid": "807cbc3cc86c53bce2988fbef53b9114", "score": "0.6054746", "text": "func (m1 *Scale) Dims() (r, c int) {\n\tr, c = m1.M.Dims()\n\treturn\n}", "title": "" }, { "docid": "7d2a0686033fd262dbc6c167c71ba5ca", "score": "0.60362333", "text": "func (o *GenerateAggregationNameRequest) GetDimensions() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Dimensions\n}", "title": "" }, { "docid": "2f0ab96055e5d021068068c41330e213", "score": "0.6026984", "text": "func (o GetCostCategoryRuleRuleNotOutput) Dimensions() GetCostCategoryRuleRuleNotDimensionArrayOutput {\n\treturn o.ApplyT(func(v GetCostCategoryRuleRuleNot) []GetCostCategoryRuleRuleNotDimension { return v.Dimensions }).(GetCostCategoryRuleRuleNotDimensionArrayOutput)\n}", "title": "" }, { "docid": "c63de26b84561f793c41e40b10185131", "score": "0.5993521", "text": "func (o *AzureMonitoredMetric) HasDimensions() bool {\n\tif o != nil && o.Dimensions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ff24a816f8b48fedb8b35d20823f4cfd", "score": "0.5991884", "text": "func (n *node) Metric() DimensionedMetric {\n\treturn n.dimMetric\n}", "title": "" }, { "docid": "aa439c493301efd15598812504276013", "score": "0.5959558", "text": "func (o GetCostCategoryRuleRuleAndOutput) Dimensions() GetCostCategoryRuleRuleAndDimensionArrayOutput {\n\treturn o.ApplyT(func(v GetCostCategoryRuleRuleAnd) []GetCostCategoryRuleRuleAndDimension { return v.Dimensions }).(GetCostCategoryRuleRuleAndDimensionArrayOutput)\n}", "title": "" }, { "docid": "75f5a4dfd3b391a6d86b21b881f3f746", "score": "0.59387475", "text": "func (o AnomalySubscriptionThresholdExpressionOrOutput) Dimension() AnomalySubscriptionThresholdExpressionOrDimensionPtrOutput {\n\treturn o.ApplyT(func(v AnomalySubscriptionThresholdExpressionOr) *AnomalySubscriptionThresholdExpressionOrDimension {\n\t\treturn v.Dimension\n\t}).(AnomalySubscriptionThresholdExpressionOrDimensionPtrOutput)\n}", "title": "" }, { "docid": "8195534960192f879d228bf592c044da", "score": "0.5925158", "text": "func Dim(x, y float32) float32 {\n\treturn float32(math.Dim(float64(x), float64(y)))\n}", "title": "" }, { "docid": "f71000c7e36f7ff6d21332168ecad3b3", "score": "0.5916771", "text": "func (mtr *MdhensintpkeccMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.CorrectableErr.Size()\n\n\tsz += mtr.UncorrectableErr.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "44153a0ba49c1d6c1a75903de1e82341", "score": "0.5901031", "text": "func (v DenseFeatureVector) Dim() int {\n\treturn len(v)\n}", "title": "" }, { "docid": "5eb689c2417331f1ddf659d53754fd63", "score": "0.5894783", "text": "func (o AnomalySubscriptionThresholdExpressionAndOutput) Dimension() AnomalySubscriptionThresholdExpressionAndDimensionPtrOutput {\n\treturn o.ApplyT(func(v AnomalySubscriptionThresholdExpressionAnd) *AnomalySubscriptionThresholdExpressionAndDimension {\n\t\treturn v.Dimension\n\t}).(AnomalySubscriptionThresholdExpressionAndDimensionPtrOutput)\n}", "title": "" }, { "docid": "b6fda065235a442ce8e78b583859d486", "score": "0.5886239", "text": "func (m Matrix) Dims() (r, c int) {\n\treturn m.width, m.length\n}", "title": "" }, { "docid": "f5b55d18fd62b2fba0082adf1e2c89ee", "score": "0.5886083", "text": "func (d *Dataset) Width() int {\n\treturn d.cols\n}", "title": "" }, { "docid": "c4e71ef6e77f51ee683953121705356a", "score": "0.5853993", "text": "func (p PointNd) NumDims() uint8 {\n\treturn uint8(len(p))\n}", "title": "" }, { "docid": "8ca925bef27d896f7795f20960745f8c", "score": "0.58199424", "text": "func (mtr *Pctmpu6intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "3bd3da838225e7d14e5fc6edc67aca5c", "score": "0.5817902", "text": "func (o AnomalySubscriptionThresholdExpressionNotPtrOutput) Dimension() AnomalySubscriptionThresholdExpressionNotDimensionPtrOutput {\n\treturn o.ApplyT(func(v *AnomalySubscriptionThresholdExpressionNot) *AnomalySubscriptionThresholdExpressionNotDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimension\n\t}).(AnomalySubscriptionThresholdExpressionNotDimensionPtrOutput)\n}", "title": "" }, { "docid": "110c491063a98ea928fc7dc60df8d96a", "score": "0.5801452", "text": "func (mtr *Pctmpu1intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "79a6395cae1476e28ae97153881f0379", "score": "0.57976973", "text": "func (gmm *Model) Dim() int { return gmm.ModelDim }", "title": "" }, { "docid": "5418265cc41f90911c25e6ba846f70f5", "score": "0.57918084", "text": "func (mtr *Pctmpu4intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "5b329e41b14f0259f4da06e8696b2bf4", "score": "0.5764178", "text": "func (mtr *Pctmpu3intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "eab927f68992163c0d275f857b9aede7", "score": "0.57606953", "text": "func (mtr *Pctmpu7intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "a17955d09474ca30399cc4f74bf5af88", "score": "0.5735341", "text": "func (o AnomalySubscriptionThresholdExpressionNotOutput) Dimension() AnomalySubscriptionThresholdExpressionNotDimensionPtrOutput {\n\treturn o.ApplyT(func(v AnomalySubscriptionThresholdExpressionNot) *AnomalySubscriptionThresholdExpressionNotDimension {\n\t\treturn v.Dimension\n\t}).(AnomalySubscriptionThresholdExpressionNotDimensionPtrOutput)\n}", "title": "" }, { "docid": "7c6d0966ef772e52a9d446ccc49fb8c7", "score": "0.5733308", "text": "func (fv FloatVector) Dim() int {\n\treturn len(fv)\n}", "title": "" }, { "docid": "7c6d0966ef772e52a9d446ccc49fb8c7", "score": "0.5733308", "text": "func (fv FloatVector) Dim() int {\n\treturn len(fv)\n}", "title": "" }, { "docid": "06a8419b173a67188395f130fba2692e", "score": "0.57255363", "text": "func (mtr *Pctmpu2intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "bcdb04291020bc3157f9deca4e42ffed", "score": "0.57191014", "text": "func (o *OviWrapper) GetDimension() (int, int) {\n\treturn o.prim.GetDimension()\n}", "title": "" }, { "docid": "4f37432862c20230153c3acf814c74c0", "score": "0.5710284", "text": "func (m *TimeSeries) Size() (n int) {\n\tif m == nil {\n\t\treturn 0\n\t}\n\tvar l int\n\t_ = l\n\tif len(m.Labels) > 0 {\n\t\tfor _, e := range m.Labels {\n\t\t\tl = e.Size()\n\t\t\tn += 1 + l + sovTypes(uint64(l))\n\t\t}\n\t}\n\tif len(m.Samples) > 0 {\n\t\tfor _, e := range m.Samples {\n\t\t\tl = e.Size()\n\t\t\tn += 1 + l + sovTypes(uint64(l))\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "1422c22ec42410b8088bbd708a33f938", "score": "0.57089174", "text": "func (b *BaseContainer) Dimensions() gmath.Vector2i {\n\tvar maxw, maxh int\n\n\t// find maximum x and y coordinates taken by some child component\n\tfor _, c := range b.components {\n\t\tp := c.Position()\n\t\td := c.Dimensions()\n\t\tfw := p.X + d.X\n\t\tif fw > maxw {\n\t\t\tmaxw = fw\n\t\t}\n\t\tfh := p.Y + d.Y\n\t\tif fh > maxh {\n\t\t\tmaxh = fh\n\t\t}\n\t}\n\n\t// apply style to maximum values found\n\treturn gmath.Vector2i{\n\t\tX: maxw + b.style.Padding.Left + b.style.Padding.Right + b.style.Border.Size*2,\n\t\tY: maxh + b.style.Padding.Top + b.style.Padding.Bottom + b.style.Border.Size*2,\n\t}\n}", "title": "" }, { "docid": "cb6a2baf46d69d950ca4b7f3b00a5ef4", "score": "0.5706737", "text": "func (r *RawData) Size() int {\n\tif len(r.Metrics) == 0 {\n\t\treturn 0\n\t}\n\treturn (r.Metrics[0].Size() * len(r.Metrics))\n}", "title": "" }, { "docid": "e00a24ff920a0e21fb1acd5209d39d07", "score": "0.5702113", "text": "func (mtr *Pctmpu0intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "342f417e00a4d1f593f8114288d3bd50", "score": "0.5688073", "text": "func (mtr *Pctmpu6interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "ed81e6bf27a0a8b320809cccf6794964", "score": "0.56762654", "text": "func DimensionValues() []Dimension {\n\treturn _DimensionValues\n}", "title": "" }, { "docid": "31e50cb4b498e2bb2a97af2cab38948e", "score": "0.56734854", "text": "func (mtr *Pctmpu5intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "9a08cdace4b7e60b5ddef2c70a6504dc", "score": "0.5672111", "text": "func (o GetCostCategoryRuleRuleOrOutput) Dimensions() GetCostCategoryRuleRuleOrDimensionArrayOutput {\n\treturn o.ApplyT(func(v GetCostCategoryRuleRuleOr) []GetCostCategoryRuleRuleOrDimension { return v.Dimensions }).(GetCostCategoryRuleRuleOrDimensionArrayOutput)\n}", "title": "" }, { "docid": "1f2c234372c5736e1ef9e0f574c57e80", "score": "0.5670775", "text": "func (api *DatasetAPI) getDimensions(w http.ResponseWriter, r *http.Request, limit, offset int) (dimensionsList interface{}, totalCount int, err error) {\n\tctx := r.Context()\n\tvars := mux.Vars(r)\n\tdatasetID := vars[\"dataset_id\"]\n\tedition := vars[\"edition\"]\n\tversion := vars[\"version\"]\n\tlogData := log.Data{\"dataset_id\": datasetID, \"edition\": edition, \"version\": version, \"func\": \"getDimensions\"}\n\n\tversionNumber, err := models.ParseAndValidateVersionNumber(ctx, version)\n\tif err != nil {\n\t\thandleDimensionsErr(ctx, w, \"invalid version request\", err, logData)\n\t\treturn nil, 0, err\n\t}\n\n\tlist, totalCount, err := func() ([]models.Dimension, int, error) {\n\t\tauthorised := api.authenticate(r, logData)\n\n\t\tvar state string\n\t\tif !authorised {\n\t\t\tstate = models.PublishedState\n\t\t}\n\n\t\tversionDoc, err := api.dataStore.Backend.GetVersion(ctx, datasetID, edition, versionNumber, state)\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, \"datastore.getversion returned an error\", err, logData)\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tif err = models.CheckState(\"version\", versionDoc.State); err != nil {\n\t\t\tlogData[\"state\"] = versionDoc.State\n\t\t\tlog.Error(ctx, \"unpublished version has an invalid state\", err, logData)\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tdimensions, err := api.dataStore.Backend.GetDimensions(ctx, versionDoc.ID)\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, \"failed to get version dimensions\", err, logData)\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\tslicedResults := []models.Dimension{}\n\n\t\tif limit > 0 {\n\t\t\tresults, err := api.createListOfDimensions(versionDoc, dimensions)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(ctx, \"failed to convert bson to dimension\", err, logData)\n\t\t\t\treturn nil, 0, err\n\t\t\t}\n\n\t\t\tsort.Slice(results, func(i, j int) bool {\n\t\t\t\treturn results[i].Name < results[j].Name\n\t\t\t})\n\n\t\t\tslicedResults = utils.Slice(results, offset, limit)\n\t\t}\n\n\t\treturn slicedResults, len(dimensions), nil\n\t}()\n\tif err != nil {\n\t\thandleDimensionsErr(ctx, w, \"\", err, logData)\n\t\treturn nil, 0, err\n\t}\n\treturn list, totalCount, nil\n}", "title": "" }, { "docid": "5c58d86d4782ceba660bf0beacaa764d", "score": "0.5662879", "text": "func (mtr *Pctmpu4interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "a167826812642ceb44618e3b8c2efe6c", "score": "0.5657963", "text": "func (o GetTagsFilterPtrOutput) Dimension() GetTagsFilterDimensionPtrOutput {\n\treturn o.ApplyT(func(v *GetTagsFilter) *GetTagsFilterDimension {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dimension\n\t}).(GetTagsFilterDimensionPtrOutput)\n}", "title": "" }, { "docid": "5ee41b22e10c11a0d67c626cd696c696", "score": "0.5649237", "text": "func (mtr *Pctmpu1interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "1c1e6617e324b4b93ddb96faca1262b3", "score": "0.56487805", "text": "func (mtr *MdhensintdrbgintrameccMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.CorrectableErr.Size()\n\n\tsz += mtr.UncorrectableErr.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "11b746d52d0d47fae44f47427529bb32", "score": "0.5640601", "text": "func (ms *MinimalSurface) Dims() (nx, ny int) {\n\treturn len(ms.bottom), len(ms.left)\n}", "title": "" }, { "docid": "1b669958cacca793653cc5e410292420", "score": "0.5640413", "text": "func (l *Logger) Dimension(key, value string) *Logger {\n\tl.defaultContext.metricDirective.Dimensions = append(\n\t\tl.defaultContext.metricDirective.Dimensions, DimensionSet{key})\n\tl.values[key] = value\n\treturn l\n}", "title": "" }, { "docid": "1b669958cacca793653cc5e410292420", "score": "0.5640413", "text": "func (l *Logger) Dimension(key, value string) *Logger {\n\tl.defaultContext.metricDirective.Dimensions = append(\n\t\tl.defaultContext.metricDirective.Dimensions, DimensionSet{key})\n\tl.values[key] = value\n\treturn l\n}", "title": "" }, { "docid": "dc8a448029e94a848e7960a6efffd92f", "score": "0.5627342", "text": "func (o *AzureMonitoredMetric) GetDimensionsOk() (*[]string, bool) {\n\tif o == nil || o.Dimensions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Dimensions, true\n}", "title": "" }, { "docid": "0e7c820b4944af385b5b595207fe0443", "score": "0.5627242", "text": "func CalculateDimensions(grid *Grid, instructions DrawingInstructions) (int, int) {\n\twidth := grid.width*instructions.NodeSize + grid.width*instructions.Margin + instructions.Margin\n\theight := grid.height*instructions.NodeSize + grid.height*instructions.Margin + instructions.Margin\n\treturn width, height\n}", "title": "" }, { "docid": "dc3481c400305eb56771889f788a408a", "score": "0.5613709", "text": "func (v *VShell) Dim() int {\n\tdim := v.NX\n\tif v.NY > dim {\n\t\tdim = v.NY\n\t}\n\tif v.NZ > dim {\n\t\tdim = v.NZ\n\t}\n\treturn dim\n}", "title": "" }, { "docid": "7a1415accbea45ad7ff77902c28867ab", "score": "0.5609883", "text": "func (A Matrix) Dimensions() (int, int) {\n\tm := len(A)\n\tn := len(A[0])\n\tfor i := range A {\n\t\tif n != len(A[i]) {\n\t\t\tpanic(\"inconsistent matrix dimensions\")\n\t\t}\n\t}\n\treturn m, n\n}", "title": "" }, { "docid": "919063e97946f64e000d15cf33d235f2", "score": "0.5605245", "text": "func (mtr *DbwaintlifqstatemapMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.EccUncorrectable.Size()\n\n\tsz += mtr.EccCorrectable.Size()\n\n\tsz += mtr.QidInvalid.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "9cbec4f91989e47ddac6c983e5dbc6be", "score": "0.56021893", "text": "func (mtr *Pctmpu2interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "fce85a00a9e322147b3ac0fde5fde543", "score": "0.5601425", "text": "func (n *NLopt) GetDimension() uint {\n\tvar cDim C.unsigned = C.nlopt_get_dimension(n.cOpt)\n\treturn uint(cDim)\n}", "title": "" }, { "docid": "240c124612cd9ab1ca1e86498a38df9a", "score": "0.5588336", "text": "func (o GetTagsFilterOutput) Dimension() GetTagsFilterDimensionPtrOutput {\n\treturn o.ApplyT(func(v GetTagsFilter) *GetTagsFilterDimension { return v.Dimension }).(GetTagsFilterDimensionPtrOutput)\n}", "title": "" }, { "docid": "a274c1c0f972846c5fad1a9409644323", "score": "0.55872935", "text": "func (mtr *Pctmpu3interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "e0105f7f4b327576614904ea484f34bc", "score": "0.5573878", "text": "func (c *DataGetCall) Dimensions(dimensions string) *DataGetCall {\n\tc.urlParams_.Set(\"dimensions\", dimensions)\n\treturn c\n}", "title": "" }, { "docid": "11ab77377a762091db1bf3decb1fbca7", "score": "0.557273", "text": "func (r *RecordReport) HasDimensions() bool {\n\treturn r.hasDimensions\n}", "title": "" }, { "docid": "bdd267b32e451492fcbd89b2faa654d9", "score": "0.556264", "text": "func (mtr *Pcrmpu6intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "2eae7c3c8f8e78482b3a27765c70bcc1", "score": "0.5556181", "text": "func (mtr *Pctmpu7interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "cf1099f8763f1aadd59e1a050f9a41d7", "score": "0.55412495", "text": "func WorkAreaDimensions(num uint) (x, y, width, height int) {\n\tw := workArea[num]\n\tx = w.X\n\ty = w.Y\n\twidth = int(w.Width)\n\theight = int(w.Height)\n\treturn\n}", "title": "" }, { "docid": "67552263361bb665928495872e7d9f9d", "score": "0.55333024", "text": "func (mtr *Pctmpu0interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "99c95fff3c612f187dc66e551c3ac0e1", "score": "0.5527681", "text": "func (c ChunkPoint2d) NumDims() uint8 {\n\treturn 2\n}", "title": "" }, { "docid": "53b0575a8ba80786d07a582079720b63", "score": "0.5507302", "text": "func (mtr *Pctmpu5interrMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.SdpMemUncorrectable.Size()\n\n\tsz += mtr.SdpMemCorrectable.Size()\n\n\tsz += mtr.IllegalOp_0.Size()\n\n\tsz += mtr.IllegalOp_1.Size()\n\n\tsz += mtr.IllegalOp_2.Size()\n\n\tsz += mtr.IllegalOp_3.Size()\n\n\tsz += mtr.MaxInst_0.Size()\n\n\tsz += mtr.MaxInst_1.Size()\n\n\tsz += mtr.MaxInst_2.Size()\n\n\tsz += mtr.MaxInst_3.Size()\n\n\tsz += mtr.Phvwr_0.Size()\n\n\tsz += mtr.Phvwr_1.Size()\n\n\tsz += mtr.Phvwr_2.Size()\n\n\tsz += mtr.Phvwr_3.Size()\n\n\tsz += mtr.WriteErr_0.Size()\n\n\tsz += mtr.WriteErr_1.Size()\n\n\tsz += mtr.WriteErr_2.Size()\n\n\tsz += mtr.WriteErr_3.Size()\n\n\tsz += mtr.CacheAxi_0.Size()\n\n\tsz += mtr.CacheAxi_1.Size()\n\n\tsz += mtr.CacheAxi_2.Size()\n\n\tsz += mtr.CacheAxi_3.Size()\n\n\tsz += mtr.CacheParity_0.Size()\n\n\tsz += mtr.CacheParity_1.Size()\n\n\tsz += mtr.CacheParity_2.Size()\n\n\tsz += mtr.CacheParity_3.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "ce75d524bc186d5cd72aff4557d0f979", "score": "0.55028546", "text": "func (ws WindowSize) CellDimensions() (int, int) {\n\tif ws.PixelWidth == 0 || ws.PixelHeight == 0 {\n\t\treturn 0, 0\n\t}\n\treturn (ws.PixelWidth / ws.Width), (ws.PixelHeight / ws.Height)\n}", "title": "" }, { "docid": "daf621f7f3ba5517414399d7df937087", "score": "0.5500239", "text": "func (c *Context) Dimension(key, value string) *Context {\n\tc.metricDirective.Dimensions = append(c.metricDirective.Dimensions, DimensionSet{key})\n\tc.values[key] = value\n\treturn c\n}", "title": "" }, { "docid": "daf621f7f3ba5517414399d7df937087", "score": "0.5500239", "text": "func (c *Context) Dimension(key, value string) *Context {\n\tc.metricDirective.Dimensions = append(c.metricDirective.Dimensions, DimensionSet{key})\n\tc.values[key] = value\n\treturn c\n}", "title": "" }, { "docid": "fbcd2881ad0bfc7dcb3d54ce9237556e", "score": "0.54982495", "text": "func (mtr *Pcrmpu4intinfoMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.MpuStop_0.Size()\n\n\tsz += mtr.MpuStop_1.Size()\n\n\tsz += mtr.MpuStop_2.Size()\n\n\tsz += mtr.MpuStop_3.Size()\n\n\treturn sz\n}", "title": "" } ]
4dfe2cfe27171c04ec84f68bfd0b0c6e
Validate validates UpdateAdmissionPluginEndpoint request
[ { "docid": "008e9c1bbac19880a9f5d7d10d972a25", "score": "0.0", "text": "func (r updateSeedReq) Validate() error {\n\tif r.Name != r.Body.Name {\n\t\treturn fmt.Errorf(\"seed name mismatch, you requested to update Seed = %s but body contains Seed = %s\", r.Name, r.Body.Name)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "1cca4f675bbfe20a97a1321201630992", "score": "0.6137398", "text": "func (h *Handler) ValidateUpdate(_ context.Context, _, _ runtime.Object) error {\n\treturn nil\n}", "title": "" }, { "docid": "64e8e60431dbf85e97dc20b00e70bd14", "score": "0.59470886", "text": "func (a *ClusterProvisionValidatingAdmissionHook) validateUpdateRequest(request *admissionv1beta1.AdmissionRequest, logger log.FieldLogger) *admissionv1beta1.AdmissionResponse {\n\tlogger = logger.WithField(\"method\", \"validateUpdateRequest\")\n\n\tnewObject, resp := a.decode(&request.Object, logger.WithField(\"decode\", \"Object\"))\n\tif resp != nil {\n\t\treturn resp\n\t}\n\n\tlogger = logger.\n\t\tWithField(\"object.Name\", newObject.Name).\n\t\tWithField(\"object.Namespace\", newObject.Namespace)\n\n\toldObject, resp := a.decode(&request.OldObject, logger.WithField(\"decode\", \"OldObject\"))\n\tif resp != nil {\n\t\treturn resp\n\t}\n\n\tif allErrs := validateClusterProvisionUpdate(oldObject, newObject); len(allErrs) > 0 {\n\t\tlogger.WithError(allErrs.ToAggregate()).Info(\"failed validation\")\n\t\tstatus := errors.NewInvalid(schemaGVK(request.Kind).GroupKind(), request.Name, allErrs).Status()\n\t\treturn &admissionv1beta1.AdmissionResponse{\n\t\t\tAllowed: false,\n\t\t\tResult: &status,\n\t\t}\n\t}\n\n\t// If we get here, then all checks passed, so the object is valid.\n\tlogger.Info(\"Successful validation\")\n\treturn &admissionv1beta1.AdmissionResponse{\n\t\tAllowed: true,\n\t}\n}", "title": "" }, { "docid": "0807a5f7a4acd0edf1763f57c2fc4914", "score": "0.5904272", "text": "func (endpointsStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {\n\treturn validation.ValidateEndpointsUpdate(obj.(*api.Endpoints), old.(*api.Endpoints))\n}", "title": "" }, { "docid": "97b43913aff1d0ed2a390adefd20297f", "score": "0.5814963", "text": "func Test_ValidatingAdmissionPolicy_UpdateParamResource(t *testing.T) {\n\tdefer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ValidatingAdmissionPolicy, true)()\n\tserver, err := apiservertesting.StartTestServer(t, nil, []string{\n\t\t\"--enable-admission-plugins\", \"ValidatingAdmissionPolicy\",\n\t}, framework.SharedEtcd())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer server.TearDownFn()\n\n\tconfig := server.ClientConfig\n\n\tclient, err := clientset.NewForConfig(config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tparamConfigMap := &v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"allowed-prefix\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tData: map[string]string{\n\t\t\t\"prefix\": \"test-1\",\n\t\t},\n\t}\n\tparamConfigMap, err = client.CoreV1().ConfigMaps(paramConfigMap.Namespace).Create(context.TODO(), paramConfigMap, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpolicy := withValidations([]admissionregistrationv1beta1.Validation{\n\t\t{\n\t\t\tExpression: \"object.metadata.name.startsWith(params.data['prefix'])\",\n\t\t\tMessage: \"wrong prefix\",\n\t\t},\n\t}, withParams(configParamKind(), withNamespaceMatch(withFailurePolicy(admissionregistrationv1beta1.Fail, makePolicy(\"allowed-prefixes\")))))\n\tpolicy = withWaitReadyConstraintAndExpression(policy)\n\t_, err = client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Create(context.TODO(), policy, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// validate that namespaces starting with \"test-1\" are allowed\n\t// and namespaces starting with \"test-2-\" are disallowed\n\tallowedPrefixesBinding := makeBinding(\"allowed-prefixes-binding\", \"allowed-prefixes\", \"allowed-prefix\")\n\tif err := createAndWaitReady(t, client, allowedPrefixesBinding, nil); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif waitErr := wait.PollImmediate(time.Millisecond*10, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tdisallowedNamespace := &v1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tGenerateName: \"test-2-\",\n\t\t\t},\n\t\t}\n\n\t\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), disallowedNamespace, metav1.CreateOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif strings.Contains(err.Error(), \"not yet synced to use for admission\") {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif !strings.Contains(err.Error(), \"wrong prefix\") {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}); waitErr != nil {\n\t\tt.Errorf(\"timed out waiting: %v\", err)\n\t}\n\n\tallowedNamespace := &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"test-1-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), allowedNamespace, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Update the param resource to use \"test-2\" as the new allwoed prefix\n\tparamConfigMapCopy := paramConfigMap.DeepCopy()\n\tparamConfigMapCopy.Data = map[string]string{\n\t\t\"prefix\": \"test-2\",\n\t}\n\t_, err = client.CoreV1().ConfigMaps(paramConfigMapCopy.Namespace).Update(context.TODO(), paramConfigMapCopy, metav1.UpdateOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// validate that namespaces starting with \"test-2\" are allowed\n\t// and namespaces starting with \"test-1\" are disallowed\n\tif waitErr := wait.PollImmediate(time.Millisecond*10, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tdisallowedNamespace := &v1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tGenerateName: \"test-1-\",\n\t\t\t},\n\t\t}\n\n\t\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), disallowedNamespace, metav1.CreateOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif strings.Contains(err.Error(), \"not yet synced to use for admission\") {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif !strings.Contains(err.Error(), \"wrong prefix\") {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}); waitErr != nil {\n\t\tt.Errorf(\"timed out waiting: %v\", err)\n\t}\n\n\tallowedNamespace = &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"test-2-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), allowedNamespace, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "d58c555c782be22a87aa6dc3d94031d9", "score": "0.5811673", "text": "func (m *UpdatePodRequest) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "9675dee050745be0cb5499b66bdb715f", "score": "0.5798617", "text": "func (endpointSliceStrategy) ValidateUpdate(ctx context.Context, new, old runtime.Object) field.ErrorList {\n\tnewEPS := new.(*discovery.EndpointSlice)\n\toldEPS := old.(*discovery.EndpointSlice)\n\treturn validation.ValidateEndpointSliceUpdate(newEPS, oldEPS)\n}", "title": "" }, { "docid": "8f16e3d3276a7997ac16847b03cacf36", "score": "0.5768281", "text": "func (m *UpdateDeploymentRequest) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "bd53258d5a2f833a1c509b80d0014989", "score": "0.57623607", "text": "func (p *Plugin) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) error {\n\tif shouldIgnore(a) {\n\t\treturn nil\n\t}\n\n\tif !p.WaitForReady() {\n\t\treturn admission.NewForbidden(a, fmt.Errorf(\"not yet ready to handle request\"))\n\t}\n\n\t// whitelist verification.\n\tpod := a.GetObject().(*api.Pod)\n\tif len(pod.Spec.Tolerations) > 0 {\n\t\twhitelist, err := p.getNamespaceTolerationsWhitelist(a.GetNamespace())\n\t\twhitelistScope := \"namespace\"\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// If the namespace has not specified its tolerations whitelist,\n\t\t// fall back to cluster's whitelist of tolerations.\n\t\tif whitelist == nil {\n\t\t\twhitelist = p.pluginConfig.Whitelist\n\t\t\twhitelistScope = \"cluster\"\n\t\t}\n\n\t\tif len(whitelist) > 0 {\n\t\t\t// check if the merged pod tolerations satisfy its namespace whitelist\n\t\t\tif !tolerations.VerifyAgainstWhitelist(pod.Spec.Tolerations, whitelist) {\n\t\t\t\treturn fmt.Errorf(\"pod tolerations (possibly merged with namespace default tolerations) conflict with its %s whitelist\", whitelistScope)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd3cb3f95f179cc0104c5d1a20c06eae", "score": "0.57137406", "text": "func (i *Instance) ValidateUpdate(old runtime.Object, req admission.Request) error {\n\toldInstance := old.(*Instance)\n\tif i.Status.AggregatedStatus.Status.IsRunning() && specChanged(i.Spec, oldInstance.Spec) {\n\t\t// when updating anything else than status, there shouldn't be a running plan\n\t\treturn fmt.Errorf(\"cannot update Instance %s/%s right now, there's plan %s in progress\", i.Namespace, i.Name, i.Status.AggregatedStatus.ActivePlanName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ebdbafcfd07c8fc468b61219b6709eb", "score": "0.5695355", "text": "func (Strategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {\n\t// TODO: add validation for ResourceRegistry\n\treturn field.ErrorList{}\n}", "title": "" }, { "docid": "a3eb2ab9bc8af3fd945af5807eac0760", "score": "0.56903726", "text": "func (server *Server) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := server.updateValidations()\n\tvar temp any = server\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "ee44df143d884de5b63a369c2892b4e0", "score": "0.56857437", "text": "func (server *FlexibleServer) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := server.updateValidations()\n\tvar temp any = server\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "1575021c47f95d0bcbd9089c268d9562", "score": "0.5673922", "text": "func (a *AttachmentUpdate) Validate() error {\n\tif a.Type == AddUpdateType &&\n\t\t(a.URI == nil || *a.URI == \"\") {\n\t\treturn server.NewHTTPError(http.StatusBadRequest, \"uri can not be empty with type=add\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "42bbe2247fee89efb0c7a78b7add59da", "score": "0.5650027", "text": "func (group *PrivateEndpointsPrivateDnsZoneGroup) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := group.updateValidations()\n\tvar temp any = group\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "6d8f4823111b4dba13f6b44cc5f3b9d4", "score": "0.5641781", "text": "func (s *InstancePlugin) Validate(req *types.Any) error {\n\treturn fmt.Errorf(\"Validate not supported for swarm instance\")\n}", "title": "" }, { "docid": "41f4c2db80c6b6fd7877d47e2c19be7a", "score": "0.5626524", "text": "func (host *BastionHost) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := host.updateValidations()\n\tvar temp any = host\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "81985ce23386632b4da65191043b2d6a", "score": "0.55867445", "text": "func Test_ValidatingAdmissionPolicy_UpdateParamKind(t *testing.T) {\n\tdefer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ValidatingAdmissionPolicy, true)()\n\tserver, err := apiservertesting.StartTestServer(t, nil, []string{\n\t\t\"--enable-admission-plugins\", \"ValidatingAdmissionPolicy\",\n\t}, framework.SharedEtcd())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer server.TearDownFn()\n\n\tconfig := server.ClientConfig\n\n\tclient, err := clientset.NewForConfig(config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tallowedPrefixesParamsConfigMap := &v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"allowed-prefixes\",\n\t\t},\n\t}\n\tif _, err := client.CoreV1().ConfigMaps(\"default\").Create(context.TODO(), allowedPrefixesParamsConfigMap, metav1.CreateOptions{}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tallowedPrefixesParamSecret := &v1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"allowed-prefixes\",\n\t\t},\n\t}\n\tif _, err := client.CoreV1().Secrets(\"default\").Create(context.TODO(), allowedPrefixesParamSecret, metav1.CreateOptions{}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tparamKind := &admissionregistrationv1beta1.ParamKind{\n\t\tAPIVersion: \"v1\",\n\t\tKind: \"ConfigMap\",\n\t}\n\n\tpolicy := withValidations([]admissionregistrationv1beta1.Validation{\n\t\t{\n\t\t\tExpression: \"object.metadata.name.startsWith(params.kind.lowerAscii())\",\n\t\t\tMessage: \"wrong paramKind\",\n\t\t},\n\t}, withParams(paramKind, withNamespaceMatch(withFailurePolicy(admissionregistrationv1beta1.Fail, makePolicy(\"allowed-prefixes\")))))\n\tpolicy = withWaitReadyConstraintAndExpression(policy)\n\tpolicy, err = client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Create(context.TODO(), policy, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tallowedPrefixesBinding := makeBinding(\"allowed-prefixes-binding\", \"allowed-prefixes\", \"allowed-prefixes\")\n\tif err := createAndWaitReady(t, client, allowedPrefixesBinding, nil); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// validate that namespaces starting with \"configmap-\" are allowed\n\t// and namespaces starting with \"secret-\" are disallowed\n\tallowedNamespace := &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"configmap-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), allowedNamespace, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tdisallowedNamespace := &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"secret-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), disallowedNamespace, metav1.CreateOptions{})\n\tif err == nil {\n\t\tt.Error(\"unexpected nil error\")\n\t}\n\tif !strings.Contains(err.Error(), \"wrong paramKind\") {\n\t\tt.Errorf(\"unexpected error message: %v\", err)\n\t}\n\tcheckFailureReason(t, err, metav1.StatusReasonInvalid)\n\n\t// update the policy ParamKind to reference a Secret\n\tparamKind = &admissionregistrationv1beta1.ParamKind{\n\t\tAPIVersion: \"v1\",\n\t\tKind: \"Secret\",\n\t}\n\tpolicy, err = client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Get(context.TODO(), policy.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tpolicy.Spec.ParamKind = paramKind\n\t_, err = client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Update(context.TODO(), policy, metav1.UpdateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// validate that namespaces starting with \"secret-\" are allowed\n\t// and namespaces starting with \"configmap-\" are disallowed\n\t// wait loop is required here since ConfigMaps were previousy allowed and we need to wait for the new policy\n\t// to be enforced\n\tif waitErr := wait.PollImmediate(time.Millisecond*10, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tdisallowedNamespace = &v1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tGenerateName: \"configmap-\",\n\t\t\t},\n\t\t}\n\n\t\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), disallowedNamespace, metav1.CreateOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif strings.Contains(err.Error(), \"not yet synced to use for admission\") {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif !strings.Contains(err.Error(), \"wrong paramKind\") {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}); waitErr != nil {\n\t\tt.Errorf(\"timed out waiting: %v\", err)\n\t}\n\n\tallowedNamespace = &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"secret-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), allowedNamespace, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "820b162ccc80d9dd9606b036665874fe", "score": "0.5541622", "text": "func (h *DenyPlanChangeIfNotUpdatable) Validate(ctx context.Context, req admission.Request, si *sc.ServiceInstance, traced *webhookutil.TracedLogger) *webhookutil.WebhookError {\n\ttraced.Info(\"Starting validation - DenyPlanChangeIfNotUpdatable\")\n\n\tif si.Spec.ClusterServiceClassRef == nil {\n\t\ttraced.Infof(\"Service class does not exist\")\n\t\treturn nil // user chose a service class that doesn't exist\n\t}\n\n\tcsc := &sc.ClusterServiceClass{}\n\tkey := types.NamespacedName{\n\t\tNamespace: \"\",\n\t\tName: si.Spec.ClusterServiceClassRef.Name,\n\t}\n\n\tif err := h.client.Get(ctx, key, csc); err != nil {\n\t\ttraced.Infof(\"Could not locate service class '%v', can not determine if UpdateablePlan.\", si.Spec.ClusterServiceClassRef.Name)\n\t\treturn webhookutil.NewWebhookError(err.Error(), http.StatusForbidden)\n\t}\n\n\tif csc.Spec.PlanUpdatable {\n\t\ttraced.Info(\"DenyPlanChangeIfNotUpdatable passed - UpdateablePlan is set to true.\")\n\t\treturn nil\n\t}\n\n\tif si.Spec.GetSpecifiedClusterServicePlan() != \"\" {\n\t\torigInstance := &sc.ServiceInstance{}\n\t\tif err := h.decoder.DecodeRaw(req.OldObject, origInstance); err != nil {\n\t\t\ttraced.Errorf(\"Could not decode oldObject: %v\", err)\n\t\t\treturn webhookutil.NewWebhookError(err.Error(), http.StatusBadRequest)\n\t\t}\n\n\t\texternalPlanNameUpdated := si.Spec.ClusterServicePlanExternalName != origInstance.Spec.ClusterServicePlanExternalName\n\t\texternalPlanIDUpdated := si.Spec.ClusterServicePlanExternalID != origInstance.Spec.ClusterServicePlanExternalID\n\t\tk8sPlanUpdated := si.Spec.ClusterServicePlanName != origInstance.Spec.ClusterServicePlanName\n\t\tif externalPlanNameUpdated || externalPlanIDUpdated || k8sPlanUpdated {\n\t\t\tvar oldPlan, newPlan string\n\t\t\tif externalPlanNameUpdated {\n\t\t\t\toldPlan = origInstance.Spec.ClusterServicePlanExternalName\n\t\t\t\tnewPlan = si.Spec.ClusterServicePlanExternalName\n\t\t\t} else if externalPlanIDUpdated {\n\t\t\t\toldPlan = origInstance.Spec.ClusterServicePlanExternalID\n\t\t\t\tnewPlan = si.Spec.ClusterServicePlanExternalID\n\t\t\t} else {\n\t\t\t\toldPlan = origInstance.Spec.ClusterServicePlanName\n\t\t\t\tnewPlan = si.Spec.ClusterServicePlanName\n\t\t\t}\n\t\t\ttraced.Infof(\"update Service Instance %v/%v request specified Plan %v while original instance had %v\", si.Namespace, si.Name, newPlan, oldPlan)\n\t\t\tmsg := fmt.Sprintf(\"The Service Class %v does not allow plan changes.\", csc.Name)\n\t\t\ttraced.Error(msg)\n\t\t\treturn webhookutil.NewWebhookError(msg, http.StatusForbidden)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e9bf3dd560897d8b9e76c3a389d819ca", "score": "0.5539501", "text": "func Test_ValidatingAdmissionPolicy_UpdateParamRef(t *testing.T) {\n\tdefer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ValidatingAdmissionPolicy, true)()\n\tserver, err := apiservertesting.StartTestServer(t, nil, []string{\n\t\t\"--enable-admission-plugins\", \"ValidatingAdmissionPolicy\",\n\t}, framework.SharedEtcd())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer server.TearDownFn()\n\n\tconfig := server.ClientConfig\n\n\tclient, err := clientset.NewForConfig(config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tallowedPrefixesParamsConfigMap1 := &v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"test-1\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t}\n\tif _, err := client.CoreV1().ConfigMaps(\"default\").Create(context.TODO(), allowedPrefixesParamsConfigMap1, metav1.CreateOptions{}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tallowedPrefixesParamsConfigMap2 := &v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"test-2\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t}\n\tif _, err := client.CoreV1().ConfigMaps(\"default\").Create(context.TODO(), allowedPrefixesParamsConfigMap2, metav1.CreateOptions{}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpolicy := withValidations([]admissionregistrationv1beta1.Validation{\n\t\t{\n\t\t\tExpression: \"object.metadata.name.startsWith(params.metadata.name)\",\n\t\t\tMessage: \"wrong paramRef\",\n\t\t},\n\t}, withParams(configParamKind(), withNamespaceMatch(withFailurePolicy(admissionregistrationv1beta1.Fail, makePolicy(\"allowed-prefixes\")))))\n\tpolicy = withWaitReadyConstraintAndExpression(policy)\n\t_, err = client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Create(context.TODO(), policy, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// validate that namespaces starting with \"test-1\" are allowed\n\t// and namespaces starting with \"test-2-\" are disallowed\n\tallowedPrefixesBinding := makeBinding(\"allowed-prefixes-binding\", \"allowed-prefixes\", \"test-1\")\n\tif err := createAndWaitReady(t, client, allowedPrefixesBinding, nil); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif waitErr := wait.PollImmediate(time.Millisecond*10, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tdisallowedNamespace := &v1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tGenerateName: \"test-2-\",\n\t\t\t},\n\t\t}\n\n\t\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), disallowedNamespace, metav1.CreateOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif strings.Contains(err.Error(), \"not yet synced to use for admission\") {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif !strings.Contains(err.Error(), \"wrong paramRef\") {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}); waitErr != nil {\n\t\tt.Errorf(\"timed out waiting: %v\", err)\n\t}\n\n\tallowedNamespace := &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"test-1-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), allowedNamespace, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Update the paramRef in the policy binding to use the test-2 ConfigMap\n\tpolicyBinding, err := client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().Get(context.TODO(), allowedPrefixesBinding.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdenyAction := admissionregistrationv1beta1.DenyAction\n\tpolicyBindingCopy := policyBinding.DeepCopy()\n\tpolicyBindingCopy.Spec.ParamRef = &admissionregistrationv1beta1.ParamRef{\n\t\tName: \"test-2\",\n\t\tNamespace: \"default\",\n\t\tParameterNotFoundAction: &denyAction,\n\t}\n\t_, err = client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().Update(context.TODO(), policyBindingCopy, metav1.UpdateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// validate that namespaces starting with \"test-2\" are allowed\n\t// and namespaces starting with \"test-1\" are disallowed\n\tif waitErr := wait.PollImmediate(time.Millisecond*10, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tdisallowedNamespace := &v1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tGenerateName: \"test-1-\",\n\t\t\t},\n\t\t}\n\n\t\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), disallowedNamespace, metav1.CreateOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif strings.Contains(err.Error(), \"not yet synced to use for admission\") {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif !strings.Contains(err.Error(), \"wrong paramRef\") {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}); waitErr != nil {\n\t\tt.Errorf(\"timed out waiting: %v\", err)\n\t}\n\n\tallowedNamespace = &v1.Namespace{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: \"test-2-\",\n\t\t},\n\t}\n\t_, err = client.CoreV1().Namespaces().Create(context.TODO(), allowedNamespace, metav1.CreateOptions{})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "31092cbf5c437b7d059a053192eb4778", "score": "0.5535981", "text": "func (farm *ServerFarm) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := farm.updateValidations()\n\tvar temp any = farm\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "c0480f9451fd3adc81338812306370da", "score": "0.55355495", "text": "func egressValidator(req *admissionv1.AdmissionRequest) (*admissionv1.AdmissionResponse, error) {\n\tegress := &policyv1alpha1.Egress{}\n\tif err := json.NewDecoder(bytes.NewBuffer(req.Object.Raw)).Decode(egress); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Validate match references\n\tallowedAPIGroups := []string{smiSpecs.SchemeGroupVersion.String(), policyv1alpha1.SchemeGroupVersion.String()}\n\tupstreamTrafficSettingMatchCount := 0\n\tfor _, m := range egress.Spec.Matches {\n\t\tswitch *m.APIGroup {\n\t\tcase smiSpecs.SchemeGroupVersion.String():\n\t\t\tswitch m.Kind {\n\t\t\tcase \"HTTPRouteGroup\":\n\t\t\t\t// no additional validation\n\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Expected 'matches.kind' for match '%s' to be 'HTTPRouteGroup', got: %s\", m.Name, m.Kind)\n\t\t\t}\n\n\t\tcase policyv1alpha1.SchemeGroupVersion.String():\n\t\t\tswitch m.Kind {\n\t\t\tcase \"UpstreamTrafficSetting\":\n\t\t\t\tupstreamTrafficSettingMatchCount++\n\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Expected 'matches.kind' for match '%s' to be 'UpstreamTrafficSetting', got: %s\", m.Name, m.Kind)\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Expected 'matches.apiGroup' to be one of %v, got: %s\", allowedAPIGroups, *m.APIGroup)\n\t\t}\n\t}\n\n\t// Can't have more than 1 UpstreamTrafficSetting match for an Egress policy\n\tif upstreamTrafficSettingMatchCount > 1 {\n\t\treturn nil, fmt.Errorf(\"Cannot have more than 1 UpstreamTrafficSetting match\")\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "8f4f92d8c2ed3478d05deb9b35b9cd3e", "score": "0.55207896", "text": "func (uar *UpdateAccessRuleRequest) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "4819265dc7d24ac8ee8a13cd1227142d", "score": "0.5498053", "text": "func (p *PtrUpdateIpv4Param) Validate() []error {\n\terrors := []error{}\n\t{\n\t\tvalidator := validateRequired\n\t\terrs := validator(\"--hostname\", p.Hostname)\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": "01c25d5062491113407d36de70029a6a", "score": "0.54810023", "text": "func (m *UpdateRequest) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "043e5f676e872f93c3a6dff76fa7aafe", "score": "0.5479703", "text": "func (r *AlamedaNotificationTopic) ValidateUpdate(old runtime.Object) error {\n\treturn r.validateAlamedaNotificationTopic()\n}", "title": "" }, { "docid": "7c200b838452a6d31df581ec3a28e0b6", "score": "0.54689497", "text": "func (r updateReq) Validate() error {\n\tif r.ServiceAccountID != r.Body.ID {\n\t\treturn fmt.Errorf(\"service account ID mismatch, you requested to update ServiceAccount = %s but body contains ServiceAccount = %s\", r.ServiceAccountID, r.Body.ID)\n\t}\n\n\tfor _, existingGroupPrefix := range serviceAccountGroupsPrefixes {\n\t\tif existingGroupPrefix == r.Body.Group {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"invalid group name %s\", r.Body.Group)\n}", "title": "" }, { "docid": "29e8a992c285ede1596e2dc32ac24ed9", "score": "0.54460734", "text": "func (m *UpdatePodResponse) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "16093b35bd2627d6db70ae8cb601cc2c", "score": "0.5445337", "text": "func (m *UpdateDeploymentRequest_Fields) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "4bf63d3f2e89892314be50d1cf245ef1", "score": "0.54295737", "text": "func (h *Handler) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) error {\n\tctx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\n\tsecret, ok := newObj.(*corev1.Secret)\n\tif !ok {\n\t\treturn apierrors.NewBadRequest(fmt.Sprintf(\"expected *corev1.Secret but got %T\", newObj))\n\t}\n\n\toldSecret, ok := oldObj.(*corev1.Secret)\n\tif !ok {\n\t\treturn apierrors.NewBadRequest(fmt.Sprintf(\"expected *corev1.Secret but got %T\", oldObj))\n\t}\n\n\tseedName := gardenerutils.ComputeSeedName(secret.Namespace)\n\tif secret.Namespace != v1beta1constants.GardenNamespace && seedName == \"\" {\n\t\treturn nil\n\t}\n\n\t// If secret was newly labeled with gardener.cloud/role=internal-domain then check whether another internal domain\n\t// secret already exists.\n\tif oldSecret.Labels[v1beta1constants.GardenRole] != v1beta1constants.GardenRoleInternalDomain &&\n\t\tsecret.Labels[v1beta1constants.GardenRole] == v1beta1constants.GardenRoleInternalDomain {\n\t\texists, err := h.internalDomainSecretExists(ctx, secret.Namespace)\n\t\tif err != nil {\n\t\t\treturn apierrors.NewInternalError(err)\n\t\t}\n\t\tif exists {\n\t\t\treturn apierrors.NewConflict(schema.GroupResource{Group: corev1.GroupName, Resource: \"Secret\"}, secret.Name, fmt.Errorf(\"cannot update secret because there can be only one secret with the 'internal-domain' secret role per namespace\"))\n\t\t}\n\t}\n\n\t_, oldDomain, _, err := gardenerutils.GetDomainInfoFromAnnotations(oldSecret.Annotations)\n\tif err != nil {\n\t\treturn apierrors.NewInternalError(err)\n\t}\n\t_, newDomain, _, err := gardenerutils.GetDomainInfoFromAnnotations(secret.Annotations)\n\tif err != nil {\n\t\treturn apierrors.NewInternalError(err)\n\t}\n\n\tif oldDomain != newDomain {\n\t\tatLeastOneShoot, err := h.atLeastOneShootExists(ctx, seedName)\n\t\tif err != nil {\n\t\t\treturn apierrors.NewInternalError(err)\n\t\t}\n\t\tif atLeastOneShoot {\n\t\t\treturn apierrors.NewForbidden(schema.GroupResource{Group: corev1.GroupName, Resource: \"Secret\"}, secret.Name, fmt.Errorf(\"cannot change domain because there are still shoots left in the system\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "99b9efd18b0b15d5456cceeffc03d41e", "score": "0.5426559", "text": "func (StatusStrategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {\n\treturn field.ErrorList{}\n}", "title": "" }, { "docid": "1a19a109712b2418f13cfa173087e81c", "score": "0.5409328", "text": "func validate(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {\n\treq := ar.Request\n\tvar (\n\t\tlabels map[string]string\n\t\tobjectMeta *metav1.ObjectMeta\n\t\tresourceNamespace, resourceName string\n\t)\n\n\tklog.Infof(\"AdmissionReview for Kind=%v, Namespace=%v Name=%v (%v) UID=%v patchOperation=%v UserInfo=%v\",\n\t\treq.Kind, req.Namespace, req.Name, resourceName, req.UID, req.Operation, req.UserInfo)\n\n\tswitch req.Kind.Kind {\n\tcase \"Pod\":\n\t\tvar pod corev1.Pod\n\t\tif err := json.Unmarshal(req.Object.Raw, &pod); err != nil {\n\t\t\tklog.Errorf(\"Could not unmarshal raw object: %v\", err)\n\t\t\treturn &v1beta1.AdmissionResponse{\n\t\t\t\tResult: &metav1.Status{\n\t\t\t\t\tMessage: err.Error(),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tresourceName, resourceNamespace, objectMeta = pod.Name, pod.Namespace, &pod.ObjectMeta\n\t\tlabels = pod.Labels\n\t}\n\n\tif !validationRequired(ignoredNamespaces, objectMeta) {\n\t\tklog.Infof(\"Skipping validation for %s/%s due to policy check\", resourceNamespace, resourceName)\n\t\treturn &v1beta1.AdmissionResponse{\n\t\t\tAllowed: true,\n\t\t}\n\t}\n\n\tallowed := true\n\tvar result *metav1.Status\n\tklog.Info(\"required labels\", requiredLabels)\n\tfor _, rl := range requiredLabels {\n\t\tif _, ok := labels[rl]; !ok {\n\t\t\tallowed = false\n\t\t\tresult = &metav1.Status{\n\t\t\t\tReason: \"required labels are not set\",\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn &v1beta1.AdmissionResponse{\n\t\tAllowed: allowed,\n\t\tResult: result,\n\t}\n}", "title": "" }, { "docid": "61b4b44c9abf2c124d092b567d940e93", "score": "0.54009694", "text": "func (strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {\n\treturn validation.ValidateDeploymentConfigUpdate(obj.(*appsapi.DeploymentConfig), old.(*appsapi.DeploymentConfig))\n}", "title": "" }, { "docid": "f411afd264dcb9a3dea897f725c336d7", "score": "0.53959435", "text": "func (m *APIRuleUpdateV1) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDispositionID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEnabled(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFieldValues(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInstanceID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePatternSeverity(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRulegroupVersion(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": "2d91c4444ca6588cfe511b9d26466d11", "score": "0.5389754", "text": "func (a *Assistant) updatePlugin(req *request) (interface{}, error) {\n\tfmt.Print(\"D! [assistant] Received request: \", req.Operation, \" for plugin \", req.Plugin.UniqueId, \"\\n\")\n\n\tif req.Plugin.Config == nil {\n\t\treturn nil, errors.New(\"no configuration values provided\")\n\t}\n\n\tvar data interface{}\n\tvar err error\n\n\tswitch req.Plugin.Type {\n\tcase \"INPUT\":\n\t\tdata, err = a.agent.UpdateInputPlugin(req.Plugin.UniqueId, req.Plugin.Config)\n\tcase \"OUTPUT\":\n\t\tdata, err = a.agent.UpdateOutputPlugin(req.Plugin.UniqueId, req.Plugin.Config)\n\tdefault:\n\t\terr = fmt.Errorf(\"did not provide a valid plugin type\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "541338be0eab2f163f123e33277ff153", "score": "0.53854716", "text": "func (c *ProxyEndpointComponent) Validate(isInsert bool) aperrors.Errors {\n\terrors := make(aperrors.Errors)\n\n\tif !isInsert && c.ProxyEndpointComponentReferenceID == nil {\n\t\terrors.Add(\n\t\t\t\"proxy_endpoint_component_reference_id\",\n\t\t\t\"must not be undefined\",\n\t\t)\n\t}\n\tif c.SharedComponentID != nil {\n\t\treturn errors\n\t}\n\n\tvm := otto.New()\n\n\terrors.AddErrors(c.validateType())\n\terrors.AddErrors(c.validateTransformations(vm))\n\terrors.AddErrors(c.validateCalls(vm))\n\n\t// Validate javascript\n\tif c.Type == ProxyEndpointComponentTypeJS {\n\t\terr := validateJavascript(c.Data, vm)\n\t\tif err != nil {\n\t\t\terrors.Add(\"data\", err.Error())\n\t\t}\n\t}\n\n\treturn errors\n}", "title": "" }, { "docid": "199a1233e6ebc9c62e57e3e87f22c9aa", "score": "0.53825694", "text": "func (p *UpdateArchiveParam) Validate() []error {\n\terrors := []error{}\n\t{\n\t\tvalidator := define.Resources[\"Archive\"].Commands[\"update\"].Params[\"name\"].ValidateFunc\n\t\terrs := validator(\"--name\", p.Name)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\tvalidator := define.Resources[\"Archive\"].Commands[\"update\"].Params[\"description\"].ValidateFunc\n\t\terrs := validator(\"--description\", p.Description)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\tvalidator := define.Resources[\"Archive\"].Commands[\"update\"].Params[\"tags\"].ValidateFunc\n\t\terrs := validator(\"--tags\", p.Tags)\n\t\tif errs != nil {\n\t\t\terrors = append(errors, errs...)\n\t\t}\n\t}\n\t{\n\t\tvalidator := define.Resources[\"Archive\"].Commands[\"update\"].Params[\"icon-id\"].ValidateFunc\n\t\terrs := validator(\"--icon-id\", p.IconId)\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": "e772aa590f4307b1aaf0e65a54ace70d", "score": "0.538197", "text": "func (a *ClusterProvisionValidatingAdmissionHook) Validate(request *admissionv1beta1.AdmissionRequest) *admissionv1beta1.AdmissionResponse {\n\tlogger := log.WithFields(log.Fields{\n\t\t\"operation\": request.Operation,\n\t\t\"group\": request.Resource.Group,\n\t\t\"version\": request.Resource.Version,\n\t\t\"resource\": request.Resource.Resource,\n\t\t\"method\": \"Validate\",\n\t})\n\n\tif !a.shouldValidate(request, logger) {\n\t\tlogger.Info(\"Skipping validation for request\")\n\t\t// The request object isn't something that this validator should validate.\n\t\t// Therefore, we say that it's allowed.\n\t\treturn &admissionv1beta1.AdmissionResponse{\n\t\t\tAllowed: true,\n\t\t}\n\t}\n\n\tlogger.Info(\"Validating request\")\n\n\tswitch request.Operation {\n\tcase admissionv1beta1.Create:\n\t\treturn a.validateCreateRequest(request, logger)\n\tcase admissionv1beta1.Update:\n\t\treturn a.validateUpdateRequest(request, logger)\n\tdefault:\n\t\tlogger.Info(\"Successful validation\")\n\t\treturn &admissionv1beta1.AdmissionResponse{\n\t\t\tAllowed: true,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e02818330011ec4dc8737a72ef1c7843", "score": "0.53712463", "text": "func (m *UpdateDeploymentResponse) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "7075d9b941fd7e0fa023944d5ce709a4", "score": "0.53572375", "text": "func validateAPIDocUpdate(body Body) error {\n\t// VaLidation for disallowed properties for blip and import should be done in validateNewBody\n\t// _rev, _attachments, _id are validated before reaching this function (due to endpoint specific behaviour)\n\tif _, ok := body[base.SyncPropertyName]; ok {\n\t\treturn base.HTTPErrorf(http.StatusBadRequest, \"document-top level property '_sync' is a reserved internal property\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d80fc5c7b080800bd5e19b65548bf53c", "score": "0.53339326", "text": "func (r *RideRequest) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "934344c1b11f7b1114f32b8a399f0beb", "score": "0.533221", "text": "func (o *UpdateAliasBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateBaseReq(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": "d00d9365913108b05fa3599f248c3711", "score": "0.5332181", "text": "func (a customResourceStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {\n\tvar errs field.ErrorList\n\terrs = append(errs, a.validator.ValidateUpdate(ctx, obj, old, a.scale)...)\n\n\tuNew, ok := obj.(*unstructured.Unstructured)\n\tif !ok {\n\t\treturn errs\n\t}\n\tuOld, ok := old.(*unstructured.Unstructured)\n\tif !ok {\n\t\treturn errs\n\t}\n\n\t// Checks the embedded objects. We don't make a difference between update and create for those.\n\tv := obj.GetObjectKind().GroupVersionKind().Version\n\terrs = append(errs, schemaobjectmeta.Validate(nil, uNew.Object, a.structuralSchemas[v], false)...)\n\n\t// ratcheting validation of x-kubernetes-list-type value map and set\n\tif oldErrs := structurallisttype.ValidateListSetsAndMaps(nil, a.structuralSchemas[v], uOld.Object); len(oldErrs) == 0 {\n\t\terrs = append(errs, structurallisttype.ValidateListSetsAndMaps(nil, a.structuralSchemas[v], uNew.Object)...)\n\t}\n\n\t// validate x-kubernetes-validations rules\n\tif celValidator, ok := a.celValidators[v]; ok {\n\t\tif has, err := hasBlockingErr(errs); has {\n\t\t\terrs = append(errs, err)\n\t\t} else {\n\t\t\terr, _ := celValidator.Validate(ctx, nil, a.structuralSchemas[v], uNew.Object, uOld.Object, celconfig.RuntimeCELCostBudget)\n\t\t\terrs = append(errs, err...)\n\t\t}\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "adc45edf36f9dc30bdf11dad900f4f89", "score": "0.53268236", "text": "func (statusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {\n\treturn validation.ValidateDeploymentConfigStatusUpdate(obj.(*appsapi.DeploymentConfig), old.(*appsapi.DeploymentConfig))\n}", "title": "" }, { "docid": "fbd00a6057165f31c9e0debbfee78d7e", "score": "0.5324954", "text": "func (params UpdateParams) Validate() error {\n\tvar merr = multierror.NewPrefixed(\"deployment update\")\n\tif params.API == nil {\n\t\tmerr = merr.Append(apierror.ErrMissingAPI)\n\t}\n\n\tif params.Request == nil {\n\t\tmerr = merr.Append(errors.New(\"request payload cannot be empty\"))\n\t}\n\n\tif len(params.DeploymentID) != 32 {\n\t\tmerr = merr.Append(apierror.ErrDeploymentID)\n\t}\n\n\treturn merr.ErrorOrNil()\n}", "title": "" }, { "docid": "61f90751b6daede9119f08535192727d", "score": "0.5319044", "text": "func (m *VPNConnectionUpdate) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// short circuits minProperties > 0\n\tif m == nil {\n\t\treturn errors.TooFewProperties(\"\", \"body\", 1)\n\t}\n\n\tprops := make(map[string]json.RawMessage, 4+10)\n\tj, err := swag.WriteJSON(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = swag.ReadJSON(j, &props); err != nil {\n\t\treturn err\n\t}\n\n\tnprops := len(props)\n\n\t// minProperties: 1\n\tif nprops < 1 {\n\t\treturn errors.TooFewProperties(\"\", \"body\", 1)\n\t}\n\n\tif err := m.validatePeerGatewayAddress(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": "04f5b93bbc2f92dedab2e21bb098bef8", "score": "0.5318562", "text": "func (a *Attendee) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "eab89b564bdfa061254582ce685e2141", "score": "0.5311343", "text": "func (assessment *ServersDatabasesVulnerabilityAssessment) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := assessment.updateValidations()\n\tvar temp any = assessment\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "73cb65a620da7737904de3e6d17e531a", "score": "0.5291652", "text": "func (p *PlatformMemberClaim) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "906bb75a43e634fd94919985867d683b", "score": "0.52860576", "text": "func (r *UpdateTenantRequest) Validate() error {\n\tif err := packetbroker.RequestTenantID(r).Validate(); err != nil {\n\t\treturn err\n\t}\n\tfor _, b := range r.GetDevAddrBlocks().GetValue() {\n\t\tif err := b.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif target := r.GetTarget().GetValue(); target != nil {\n\t\tif err := target.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8f36a4f0631a57c6ce8954875233d52d", "score": "0.5282885", "text": "func (m *UpdateServiceProviderRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetPayload()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateServiceProviderRequestValidationError{\n\t\t\t\tfield: \"Payload\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a31a45e8544e6eff470c025126543572", "score": "0.52769136", "text": "func (t *SrlNokiaInterfaces_Interface_Subinterface_Ipv4_Arp_Evpn_Advertise) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"SrlNokiaInterfaces_Interface_Subinterface_Ipv4_Arp_Evpn_Advertise\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5658c0befccb73ce7452d4829f234dec", "score": "0.52637845", "text": "func (o *EtcdPeer) ValidateUpdate(old runtime.Object) error {\n\toldO, ok := old.(*EtcdPeer)\n\tif !ok {\n\t\treturn fmt.Errorf(\"Unexpected type for old: %#v\", old)\n\t}\n\toldO = oldO.DeepCopy()\n\n\t// Overwrite any the fields which are allowed to change\n\t// oldO.Spec.Foo = o.Spec.Foo\n\n\tif diff := cmp.Diff(oldO.Spec, o.Spec); diff != \"\" {\n\t\treturn fmt.Errorf(\"Unsupported changes: (- current, + new) %s\", diff)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb9178bf5000e34bb68dfcb8bc58cfc6", "score": "0.5254338", "text": "func (in *MongoDBAutoscaler) ValidateUpdate(old runtime.Object) error {\n\tmongoLog.Info(\"validate create\", \"name\", in.Name)\n\treturn in.validate()\n}", "title": "" }, { "docid": "93bd369885ea6c23e8655b2c5f1fee03", "score": "0.52510256", "text": "func ValidateCreateUpdate(h fasthttp.RequestHandler) fasthttp.RequestHandler {\n\treturn fasthttp.RequestHandler(func(ctx *fasthttp.RequestCtx) {\n\t\tfirstname := strings.ToLower(getFormValue(ctx, \"firstname\"))\n\t\tlastname := strings.ToLower(getFormValue(ctx, \"lastname\"))\n\t\temail := strings.ToLower(getFormValue(ctx, \"email\"))\n\t\tphone := getFormValue(ctx, \"phone\")\n\t\tpassword := getFormValue(ctx, \"password\")\n\t\tsaAppCode := getFormValue(ctx, \"sa_app_code\")\n\t\tdeAgentId := strings.ToUpper(getFormValue(ctx, \"de_agent_id\"))\n\t\tfbId := getFormValue(ctx, \"fb_id\")\n\t\toriginIp := getFormValue(ctx, \"origin_ip\")\n\t\tmissingFields := make([]string, 0)\n\t\tinvalidFields := make([]string, 0)\n\n\t\t// validation\n\t\tif firstname == \"\" {\n\t\t\tmissingFields = append(missingFields, \"firstname\")\n\t\t}\n\n\t\tif lastname == \"\" {\n\t\t\tmissingFields = append(missingFields, \"lastname\")\n\t\t}\n\n\t\tif email == \"\" {\n\t\t\tmissingFields = append(missingFields, \"email\")\n\t\t}\n\n\t\tif password == \"\" {\n\t\t\tmissingFields = append(missingFields, \"password\")\n\t\t} else if len(password) < 4 {\n\t\t\tinvalidFields = append(invalidFields, \"password(must have at least 4 characters)\")\n\t\t}\n\n\t\tif saAppCode == \"\" {\n\t\t\tmissingFields = append(missingFields, \"sa_app_code\")\n\t\t}\n\n\t\t// empty fields\n\t\tif len(missingFields) > 0 {\n\t\t\toutputResponse(ctx, 400, ellimango.Response{Reason: PLS_FILL_FIELDS + strings.Join(missingFields, \",\")})\n\t\t\t// invalid fields\n\t\t} else if len(invalidFields) > 0 {\n\t\t\toutputResponse(ctx, 400, ellimango.Response{Reason: INVALID_PASSWORD})\n\t\t\t// no missing info\n\t\t} else {\n\t\t\tctx.SetUserValue(\"firstname\", firstname)\n\t\t\tctx.SetUserValue(\"lastname\", lastname)\n\t\t\tctx.SetUserValue(\"email\", email)\n\t\t\tctx.SetUserValue(\"phone\", phone)\n\t\t\tctx.SetUserValue(\"password\", password)\n\t\t\tctx.SetUserValue(\"saAppCode\", saAppCode)\n\t\t\tctx.SetUserValue(\"deAgentId\", deAgentId)\n\t\t\tctx.SetUserValue(\"fbId\", fbId)\n\t\t\tctx.SetUserValue(\"originIp\", originIp)\n\t\t\th(ctx)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "c41be877be8a9969277ca12b3246d97d", "score": "0.5249741", "text": "func (isvc *InferenceService) ValidateUpdate(old runtime.Object) error {\n\tvalidatorLogger.Info(\"validate update\", \"name\", isvc.Name)\n\n\treturn isvc.ValidateCreate()\n}", "title": "" }, { "docid": "f652e263658be1435cf42f510739ea34", "score": "0.52378356", "text": "func (c *CoredumpEndpointStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {\n\tce := obj.(*CoredumpEndpoint)\n\tlog.Printf(\"Validating fields for CoredumpEndpoint %s/%s\\n\", ce.Namespace, ce.Name)\n\terrors := field.ErrorList{}\n\n\tif len(ce.Spec.PodUID) == 0 {\n\t\tif len(ce.Spec.PodName) == 0 {\n\t\t\tce.Spec.PodName = ce.Name\n\t\t}\n\t\tpod, err := c.PodClient.Pods(ce.Namespace).Get(ce.Spec.PodName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tfieldError := field.InternalError(field.NewPath(\"spec\").Child(\"podUID\"), fmt.Errorf(\"get pod failed: %v\", err))\n\t\t\terrors = append(errors, fieldError)\n\t\t\treturn errors\n\t\t}\n\t\tce.Spec.PodUID = pod.UID\n\t}\n\n\t// perform validation here and add to errors using field.Invalid\n\treturn errors\n}", "title": "" }, { "docid": "21f4cecf8008ed5a2af07990dc124305", "score": "0.5236321", "text": "func validatePVC(ctx context.Context, req *admissionv1.AdmissionRequest) *admissionv1.AdmissionResponse {\n\tif !featureGateBlockVolumeSnapshotEnabled {\n\t\t// If CSI block volume snapshot is disabled and webhook is running,\n\t\t// skip validation for PersistentVolumeClaim.\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: true,\n\t\t}\n\t}\n\n\tif req.Operation != admissionv1.Update && req.Operation != admissionv1.Delete {\n\t\t// If AdmissionReview request operation is out of expectation,\n\t\t// skip validation for PersistentVolumeClaim.\n\t\treturn &admissionv1.AdmissionResponse{\n\t\t\tAllowed: true,\n\t\t}\n\t}\n\n\tlog := logger.GetLogger(ctx)\n\tvar result *metav1.Status\n\tallowed := true\n\n\tswitch req.Kind.Kind {\n\tcase \"PersistentVolumeClaim\":\n\t\toldPVC := corev1.PersistentVolumeClaim{}\n\t\tlog.Debugf(\"JSON req.OldObject.Raw: %v\", string(req.OldObject.Raw))\n\t\t// req.OldObject is null for CREATE and CONNECT operations.\n\t\tif err := json.Unmarshal(req.OldObject.Raw, &oldPVC); err != nil {\n\t\t\tlog.Errorf(\"error deserializing old pvc: %v. skipping validation.\", err)\n\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\t// skip validation if there is pvc deserialization error\n\t\t\t\tAllowed: true,\n\t\t\t}\n\t\t}\n\t\toldReq := oldPVC.Spec.Resources.Requests[corev1.ResourceStorage]\n\n\t\tif !isRWOVolumeRequest(oldPVC.Spec.AccessModes) {\n\t\t\tlog.Info(\"the access mode of PVC is not ReadWriteOnce. skipping validation.\")\n\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\t// skip validation if the pvc is not RWO\n\t\t\t\tAllowed: true,\n\t\t\t}\n\t\t}\n\n\t\tvar newReq resource.Quantity\n\t\tif req.Operation != admissionv1.Delete {\n\t\t\tnewPVC := corev1.PersistentVolumeClaim{}\n\t\t\tlog.Debugf(\"JSON req.Object.Raw: %v\", string(req.Object.Raw))\n\t\t\t// req.Object is null for DELETE operations.\n\t\t\tif err := json.Unmarshal(req.Object.Raw, &newPVC); err != nil {\n\t\t\t\tlog.Errorf(\"error deserializing old pvc: %v. skipping validation.\", err)\n\t\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\t\t// skip validation if there is pvc deserialization error\n\t\t\t\t\tAllowed: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewReq = newPVC.Spec.Resources.Requests[corev1.ResourceStorage]\n\t\t} else {\n\t\t\treclaimPolicy, err := getPVReclaimPolicyForPVC(ctx, oldPVC)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"error getting reclaim policy for pvc: %v. skipping validation.\", err)\n\t\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\t\t// skip validation if there is any error in getting reclaim policy for pvc\n\t\t\t\t\tAllowed: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif reclaimPolicy != corev1.PersistentVolumeReclaimDelete {\n\t\t\t\tlog.Info(\"the reclaim policy of PVC is not Delete. skipping validation.\")\n\t\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\t\t// skip validation if the reclaim policy of PVC is not Delete\n\t\t\t\t\tAllowed: true,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// only admit PVC deletion or expansion events.\n\t\tif req.Operation == admissionv1.Delete || req.Operation == admissionv1.Update && newReq.Cmp(oldReq) > 0 {\n\t\t\tsnapshots, err := getSnapshotsForPVC(ctx, oldPVC.Namespace, oldPVC.Name)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"error getting snapshots for pvc: %v. skipping validation.\", err)\n\t\t\t\treturn &admissionv1.AdmissionResponse{\n\t\t\t\t\t// skip validation if there is any error in getting volume snapshots associated with the pvc\n\t\t\t\t\tAllowed: true,\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(snapshots) != 0 {\n\t\t\t\tallowed = false\n\t\t\t\tif req.Operation == admissionv1.Update {\n\t\t\t\t\tresult = &metav1.Status{\n\t\t\t\t\t\tReason: ExpandVolumeWithSnapshotErrorMessage,\n\t\t\t\t\t}\n\t\t\t\t} else if req.Operation == admissionv1.Delete {\n\t\t\t\t\tresult = &metav1.Status{\n\t\t\t\t\t\tReason: DeleteVolumeWithSnapshotErrorMessage,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tallowed = false\n\t\tlog.Errorf(\"Can't validate resource kind: %q using validatePVC function\", req.Kind.Kind)\n\t}\n\n\t// return AdmissionResponse result\n\treturn &admissionv1.AdmissionResponse{\n\t\tAllowed: allowed,\n\t\tResult: result,\n\t}\n}", "title": "" }, { "docid": "632d8b3ade810ccf9736e62f1a44a7a2", "score": "0.5231498", "text": "func (server *FlexibleServer) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {\n\treturn []func(old runtime.Object) (admission.Warnings, error){\n\t\tfunc(old runtime.Object) (admission.Warnings, error) {\n\t\t\treturn server.validateResourceReferences()\n\t\t},\n\t\tserver.validateWriteOnceProperties,\n\t\tfunc(old runtime.Object) (admission.Warnings, error) {\n\t\t\treturn server.validateSecretDestinations()\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1a1b1e58a7bcb94d38f5ab83349c4ff5", "score": "0.5230651", "text": "func (p *Pagamento) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "101e6f0cbe88a86f96ea7f4b91cf258e", "score": "0.5229612", "text": "func shoudValidateRequest(request *admissionv1.AdmissionRequest) bool {\n\treturn request.Kind.Group == \"istacon.org\" && request.Kind.Kind == \"ConferenceTalk\"\n}", "title": "" }, { "docid": "4ed15f4609eb48a450ab296aa09f03df", "score": "0.522378", "text": "func (mco *MultiClusterObservability) ValidateUpdate(old runtime.Object) error {\n\tmulticlusterobservabilitylog.Info(\"validate update\", \"name\", mco.Name)\n\treturn mco.validateMultiClusterObservability(old)\n}", "title": "" }, { "docid": "fcfb6ad01157c9c51a09df47fbb8b52d", "score": "0.5223214", "text": "func internalValidateInstanceUpdateAllowed(new *sc.Instance, old *sc.Instance) field.ErrorList {\n\terrors := field.ErrorList{}\n\tif old.Status.AsyncOpInProgress {\n\t\terrors = append(errors, field.Forbidden(field.NewPath(\"Spec\"), \"Another operation for this service instance is in progress\"))\n\t}\n\treturn errors\n}", "title": "" }, { "docid": "3e89984cceb2c14ec0e9184917c7496b", "score": "0.52131987", "text": "func (r *Qserv) ValidateUpdate(old runtime.Object) error {\n\n\tlog.Info(\"validate update\", \"name\", r.Name)\n\t// Validation logic upon object update.\n\toldQservSpec, _ := old.(*Qserv)\n\tif err := r.validateQservUpdate(*oldQservSpec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "89b8cd8c949f99a76e8c1ec3007e4281", "score": "0.5210128", "text": "func (network *VirtualNetwork) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := network.updateValidations()\n\tvar temp any = network\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "bee25f4b5ce090342ff08e4d1d6aa711", "score": "0.520287", "text": "func (a *approval) Validate(ctx context.Context, req *admissionv1.AdmissionRequest, oldObj, obj runtime.Object) *field.Error {\n\t// Only perform validation on UPDATE operations\n\tif req.Operation != admissionv1.Update {\n\t\treturn nil\n\t}\n\n\t// Only Validate over CertificateRequest resources\n\tif req.RequestKind.Group != certmanager.GroupName || req.RequestKind.Kind != cmapi.CertificateRequestKind {\n\t\treturn nil\n\t}\n\n\t// Error if the clients are not initialised\n\tif a.sarclient == nil || a.discoverclient == nil {\n\t\treturn internalError(errors.New(\"approval validation not initialised\"))\n\t}\n\n\tgvk := schema.GroupVersionKind{\n\t\tGroup: req.RequestKind.Group,\n\t\tVersion: runtime.APIVersionInternal,\n\t\tKind: req.RequestKind.Kind,\n\t}\n\n\t// Convert the incomming old and new CertificateRequest into the internal\n\t// version. This is so we can process a single type, reglardless of whatever\n\t// CertificateRequest version is in the request.\n\tfor _, obj := range []runtime.Object{oldObj, obj} {\n\t\tinternalObj, err := a.scheme.New(gvk)\n\t\tif err != nil {\n\t\t\treturn internalError(err)\n\t\t}\n\n\t\tif err := a.scheme.Convert(obj, internalObj, nil); err != nil {\n\t\t\treturn internalError(err)\n\t\t}\n\t}\n\n\toldCR := oldObj.(*internalcmapi.CertificateRequest)\n\tnewCR := obj.(*internalcmapi.CertificateRequest)\n\n\t// If the request is not for approval, exit early\n\tif !isApprovalRequest(oldCR, newCR) {\n\t\treturn nil\n\t}\n\n\t// Get the referenced signer signer definition\n\tsigner, ok, err := a.signerResource(newCR)\n\tif err != nil {\n\t\treturn internalError(err)\n\t}\n\tif !ok {\n\t\treturn field.Forbidden(field.NewPath(\"spec.issuerRef\"),\n\t\t\tfmt.Sprintf(\"referenced signer resource does not exist: %v\", newCR.Spec.IssuerRef))\n\t}\n\n\t// Construct the signer resource names that permissions should be granted\n\t// for\n\tnames := a.signerResourceNames(signer)\n\n\t// Review whether the approving user has the correct permissions for the\n\t// given signer names\n\tok, err = a.reviewRequest(ctx, req, names)\n\tif err != nil {\n\t\treturn internalError(err)\n\t}\n\n\tif !ok {\n\t\treturn field.Forbidden(field.NewPath(\"status.conditions\"),\n\t\t\tfmt.Sprintf(\"user %q does not have permissions to set approved/denied conditions for issuer %v\", req.UserInfo.Username, newCR.Spec.IssuerRef))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7e2528c84da6d692478e007140c056c3", "score": "0.51939106", "text": "func (server *Server) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {\n\treturn []func(old runtime.Object) (admission.Warnings, error){\n\t\tfunc(old runtime.Object) (admission.Warnings, error) {\n\t\t\treturn server.validateResourceReferences()\n\t\t},\n\t\tserver.validateWriteOnceProperties,\n\t\tfunc(old runtime.Object) (admission.Warnings, error) {\n\t\t\treturn server.validateConfigMapDestinations()\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e90e675970002b24588715b054643856", "score": "0.51912725", "text": "func (m *CardUpdatePayload) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9c7121154cec3f2379f447cb4b3d325a", "score": "0.51909214", "text": "func (e *GRPCEndpointExpr) Validate() error {\n\tverr := new(eval.ValidationErrors)\n\tif e.Name() == \"\" {\n\t\tverr.Add(e, \"Endpoint name cannot be empty\")\n\t}\n\n\t// error if payload, result, and error type define attribute of Any type\n\t// which is unsupported.\n\tverr.Merge(e.hasAnyType(e.MethodExpr.Payload, \"Payload\"))\n\tverr.Merge(e.hasAnyType(e.MethodExpr.Result, \"Result\"))\n\tfor _, er := range e.MethodExpr.Errors {\n\t\tverr.Merge(e.hasAnyType(er.AttributeExpr, fmt.Sprintf(\"Error %q\", er.Name)))\n\t}\n\n\tvar hasMessage, hasMetadata bool\n\t// Validate request\n\tif e.Request.Type != Empty {\n\t\thasMessage = true\n\t\tverr.Merge(e.Request.Validate(\"gRPC request message\", e))\n\t\tverr.Merge(validateMessage(e.Request, e.MethodExpr.Payload, e, true))\n\t}\n\tif !e.Metadata.IsEmpty() {\n\t\thasMetadata = true\n\t\tverr.Merge(e.Metadata.Validate(\"gRPC request metadata\", e))\n\t\tverr.Merge(validateMetadata(e.Metadata, e.MethodExpr.Payload, e, true))\n\t}\n\n\tif pobj := AsObject(e.MethodExpr.Payload.Type); pobj != nil {\n\t\tsecAttrs := getSecurityAttributes(e.MethodExpr)\n\t\tswitch {\n\t\tcase hasMessage && hasMetadata:\n\t\t\t// ensure the attributes defined in message are not defined in metadata.\n\t\t\tmsgObj := AsObject(e.Request.Type)\n\t\t\tmetObj := AsObject(e.Metadata.Type)\n\t\t\tfor _, msgnat := range *msgObj {\n\t\t\t\tfor _, metnat := range *metObj {\n\t\t\t\t\tif metnat.Name == msgnat.Name {\n\t\t\t\t\t\tverr.Add(e, \"Attribute %q defined in both request message and metadata. Define the attribute in either message or metadata.\", metnat.Name)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase !hasMessage && !hasMetadata:\n\t\t\t// no request message or metadata is defined. Ensure that the method\n\t\t\t// payload attributes have \"rpc:tag\" set (except for security attributes\n\t\t\t// as they are added to request metadata by default)\n\t\t\tmsgFields := &Object{}\n\t\t\tif len(secAttrs) > 0 {\n\t\t\t\t// add attributes to msgFields from the payload that are not\n\t\t\t\t// security attributes\n\t\t\t\tvar found bool\n\t\t\t\tfor _, nat := range *pobj {\n\t\t\t\t\tfound = false\n\t\t\t\t\tfor _, n := range secAttrs {\n\t\t\t\t\t\tif n == nat.Name {\n\t\t\t\t\t\t\tfound = true\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 {\n\t\t\t\t\t\tmsgFields.Set(nat.Name, nat.Attribute)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmsgFields = pobj\n\t\t\t}\n\t\t\tif len(*msgFields) > 0 {\n\t\t\t\tverr.Merge(validateRPCTags(msgFields, e))\n\t\t\t}\n\t\t}\n\t} else if hasMessage && hasMetadata {\n\t\tverr.Add(e, \"Both request message and metadata are defined, but payload is not an object. Define either metadata or message or make payload an object type.\")\n\t}\n\n\t// Validate response\n\tverr.Merge(e.Response.Validate(e))\n\n\t// Validate errors\n\tfor _, er := range e.GRPCErrors {\n\t\tverr.Merge(er.Validate())\n\t}\n\treturn verr\n}", "title": "" }, { "docid": "e9f1afa0551228b7121dac9342a0b1e3", "score": "0.5188354", "text": "func (r *Simple) ValidateUpdate(old runtime.Object) error {\n\tsimplelog.Info(\"validate update\", \"name\", r.Name)\n\n\treturn nil\n}", "title": "" }, { "docid": "56722880ff2d1e47acbfd7ad736d6647", "score": "0.5176659", "text": "func (eiec *ErrInvalidEndpointConfig) BadRequest() {}", "title": "" }, { "docid": "2edfc8805c483bf591f6d380fd8a2a47", "score": "0.5172663", "text": "func (v UpdateAdvancedSettingsPrefetchRequest) Validate() error {\n\treturn validation.Errors{\n\t\t\"ConfigID\": validation.Validate(v.ConfigID, validation.Required),\n\t\t\"Version\": validation.Validate(v.Version, validation.Required),\n\t}.Filter()\n}", "title": "" }, { "docid": "094a41043ad8c36ffc419c12c38445fb", "score": "0.5170819", "text": "func (m *SvcEndpointDiscoveryRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4370a3501ffd461aac4cc44915a30749", "score": "0.51679945", "text": "func (a *ArInternalMetadatum) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "df2fddbd1043f029d947d1e9e97f2335", "score": "0.5165754", "text": "func (req *updateCompanyURLRequest) Validate() error {\n\n\tif req.ID == \"\" {\n\t\treturn fmt.Errorf(\"company ID can not be nil\")\n\t}\n\n\tif req.NewURL == \"\" {\n\t\treturn fmt.Errorf(\"comapny URL can not be nil\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8ff3450e2a11168e31d4913e3337b2be", "score": "0.5164784", "text": "func (m *UpdateReq) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif utf8.RuneCountInString(m.GetId()) < 3 {\n\t\treturn UpdateReqValidationError{\n\t\t\tfield: \"Id\",\n\t\t\treason: \"value length must be at least 3 runes\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetGame()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateReqValidationError{\n\t\t\t\tfield: \"Game\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d828440cd9d94e2640baaa64329c2d84", "score": "0.5151006", "text": "func (e *Escola) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "eef16cb8be1e5aaa59e97ed8f9093ad8", "score": "0.5136525", "text": "func (schedule *RedisPatchSchedule) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := schedule.updateValidations()\n\tvar temp any = schedule\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "title": "" }, { "docid": "d44ccde1c5d1b8a0852bff4cc0929d07", "score": "0.51351637", "text": "func (i *Instance) ValidateDelete(req admission.Request) error {\n\treturn nil\n}", "title": "" }, { "docid": "f07b14375f4132f4315676263e1b30d6", "score": "0.51309437", "text": "func (d *Dashboard) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "016692cb8cbfb6da494bbe526086a75a", "score": "0.51255417", "text": "func TestValidateUpdate(t *testing.T) {\n\tplugin := createStubPluginInput()\n\tinfo := &updateinfomocks.T{}\n\tmanifest := createStubManifest()\n\n\tmanager := updateManager{}\n\tout := iohandler.DefaultIOHandler{}\n\tfakeVersion := \"1.0.0\"\n\n\tresult, err := manager.validateUpdate(logger, plugin, info, manifest, &out, fakeVersion)\n\n\tassert.False(t, result)\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "743c8c3d9253a254d273a8f50b904e0d", "score": "0.51219475", "text": "func (m *UpdateServiceOfferRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetPayload()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateServiceOfferRequestValidationError{\n\t\t\t\tfield: \"Payload\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "33d8d06829dd0a026992783055c650c4", "score": "0.5120623", "text": "func Validate(w http.ResponseWriter, r *http.Request) {\n\tarReview := v1beta1.AdmissionReview{}\n\tif err := json.NewDecoder(r.Body).Decode(&arReview); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t} else if arReview.Request == nil {\n\t\thttp.Error(w, \"invalid request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\traw := arReview.Request.Object.Raw\n\n\tns := Namespace{}\n\tif err := json.Unmarshal(raw, &ns); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t} else if ns.Metadata.isEmpty() {\n\t\thttp.Error(w, \"invalid request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tarReview.Response = &v1beta1.AdmissionResponse{\n\t\tUID: arReview.Request.UID,\n\t\tAllowed: true,\n\t}\n\n\tif len(ns.Metadata.Labels) == 0 || ns.Metadata.Labels[requiredLabel] == \"\" {\n\t\tarReview.Response.Allowed = false\n\t\tarReview.Response.Result = &metav1.Status{\n\t\t\tMessage: InvalidMessage,\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(&arReview)\n}", "title": "" }, { "docid": "fe5ad2346db53e758ce2444380c25902", "score": "0.5118946", "text": "func (m *UpdateAssetRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetPayload()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateAssetRequestValidationError{\n\t\t\t\tfield: \"Payload\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetGerogeriGegege()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateAssetRequestValidationError{\n\t\t\t\tfield: \"GerogeriGegege\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3d5f55dc22015d5ece80284b26e0b527", "score": "0.5115903", "text": "func (a *Article) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "92659d5e1f952f6c06c8791c3db594a5", "score": "0.5106908", "text": "func Validate(e *Endpoint) error {\n\tif e == nil {\n\t\treturn errors.New(\"endpoint is nil\")\n\t}\n\n\tif len(e.Name) == 0 {\n\t\treturn errors.New(\"name required\")\n\t}\n\n\tfor _, p := range e.Path {\n\t\t_, err := regexp.CompilePOSIX(p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(e.Handler) == 0 {\n\t\treturn errors.New(\"invalid handler\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79ed3993d2e2e4affbcae8e479c4d9c1", "score": "0.5104618", "text": "func (s *Slide) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "90ddb738638786d185b66c224d0f9c24", "score": "0.50946563", "text": "func (spv *Validator) HandleUpdate(ctx context.Context, req *admission.Request) admission.Response {\n\tshadowpod, err := spv.DecodeShadowPod(req.Object)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusInternalServerError, fmt.Errorf(\"failed decoding of ShadowPod: %w\", err))\n\t}\n\n\toldShadowpod, err := spv.DecodeShadowPod(req.OldObject)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusInternalServerError, fmt.Errorf(\"failed decoding of ShadowPod: %w\", err))\n\t}\n\n\t// Check existence and get shadow pod origin Cluster ID label\n\tclusterID, found := shadowpod.Labels[forge.LiqoOriginClusterIDKey]\n\tif !found {\n\t\tklog.Warningf(\"Missing origin Cluster ID label on ShadowPod %q\", shadowpod.Name)\n\t\treturn admission.Denied(\"missing origin Cluster ID label\")\n\t}\n\n\t// Check existence and get old shadow pod origin Cluster ID label\n\toldClusterID, found := oldShadowpod.Labels[forge.LiqoOriginClusterIDKey]\n\tif !found {\n\t\tklog.Warningf(\"Missing origin Cluster ID label on ShadowPod %q\", oldShadowpod.Name)\n\t\treturn admission.Denied(\"missing origin Cluster ID label\")\n\t}\n\n\tif clusterID != oldClusterID {\n\t\tklog.Warningf(\"The Cluster ID label of the updated shadowpod %s is different from the old one %s\", clusterID, oldClusterID)\n\t\treturn admission.Denied(\"shadopow Cluster ID label is changed\")\n\t}\n\n\tif pod.CheckShadowPodUpdate(&shadowpod.Spec.Pod, &oldShadowpod.Spec.Pod) {\n\t\treturn admission.Allowed(\"\")\n\t}\n\n\treturn admission.Denied(\"\")\n}", "title": "" }, { "docid": "3a5be6638617e649321930507b70e9bb", "score": "0.50943035", "text": "func (e *HTTPEndpointExpr) Validate() error {\n\tverr := new(eval.ValidationErrors)\n\t// Name cannot be empty\n\tif e.Name() == \"\" {\n\t\tverr.Add(e, \"Endpoint name cannot be empty\")\n\t}\n\n\t// SkipRequestBodyEncodeDecode is not compatible with gRPC or WebSocket\n\tif e.SkipRequestBodyEncodeDecode {\n\t\tif s := Root.API.GRPC.Service(e.Service.Name()); s != nil {\n\t\t\tif s.Endpoint(e.Name()) != nil {\n\t\t\t\tverr.Add(e, \"Endpoint cannot use SkipRequestBodyEncodeDecode and define a gRPC transport.\")\n\t\t\t}\n\t\t}\n\t\tif e.MethodExpr.IsPayloadStreaming() {\n\t\t\tverr.Add(e, \"Endpoint cannot use SkipRequestBodyEncodeDecode when method defines a StreamingPayload.\")\n\t\t}\n\t\tif e.MethodExpr.IsResultStreaming() {\n\t\t\tverr.Add(e, \"Endpoint cannot use SkipRequestBodyEncodeDecode when method defines a StreamingResult. Use SkipResponseBodyEncodeDecode instead.\")\n\t\t}\n\t}\n\n\t// SkipResponseBodyEncodeDecode is not compatible with gRPC or WebSocket.\n\tif e.SkipResponseBodyEncodeDecode {\n\t\tif s := Root.API.GRPC.Service(e.Service.Name()); s != nil {\n\t\t\tif s.Endpoint(e.Name()) != nil {\n\t\t\t\tverr.Add(e, \"Endpoint response cannot use SkipResponseBodyEncodeDecode and define a gRPC transport.\")\n\t\t\t}\n\t\t}\n\t\tif e.MethodExpr.IsPayloadStreaming() {\n\t\t\tverr.Add(e, \"Endpoint cannot use SkipResponseBodyEncodeDecode when method defines a StreamingPayload. Use SkipRequestBodyEncodeDecode instead.\")\n\t\t}\n\t\tif e.MethodExpr.IsResultStreaming() {\n\t\t\tverr.Add(e, \"Endpoint cannot use SkipResponseBodyEncodeDecode when method defines a StreamingResult.\")\n\t\t}\n\t\tif rt, ok := e.MethodExpr.Result.Type.(*ResultTypeExpr); ok {\n\t\t\tif len(rt.Views) > 1 {\n\t\t\t\tverr.Add(e, \"Endpoint cannot use SkipResponseBodyEncodeDecode when method result type defines multiple views.\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Redirect is not compatible with Response.\n\tif e.Redirect != nil {\n\t\tfound := false\n\t\tfor _, r := range e.Responses {\n\t\t\tif r.StatusCode != e.Redirect.StatusCode {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif found {\n\t\t\tverr.Add(e, \"Endpoint cannot use Response when using Redirect.\")\n\t\t}\n\t}\n\n\t// Validate routes\n\n\t// Routes cannot be empty\n\tif len(e.Routes) == 0 {\n\t\tverr.Add(e, \"No route defined for HTTP endpoint\")\n\t} else {\n\t\tfor _, r := range e.Routes {\n\t\t\tverr.Merge(r.Validate())\n\t\t}\n\t\t// Make sure that the same parameters are used in all routes\n\t\tparams := e.Routes[0].Params()\n\t\tfor _, r := range e.Routes[1:] {\n\t\t\tfor _, p := range params {\n\t\t\t\tfound := false\n\t\t\t\tfor _, p2 := range r.Params() {\n\t\t\t\t\tif p == p2 {\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\tverr.Add(e, \"Param %q does not appear in all routes\", p)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, p2 := range r.Params() {\n\t\t\t\tfound := false\n\t\t\t\tfor _, p := range params {\n\t\t\t\t\tif p == p2 {\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\tverr.Add(e, \"Param %q does not appear in all routes\", p2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate responses\n\n\t// All responses but one must have tags for the same status code\n\thasTags := false\n\tallTagged := true\n\tsuccessResp := false\n\tfor i, r := range e.Responses {\n\t\tverr.Merge(r.Validate(e))\n\t\tfor j, r2 := range e.Responses {\n\t\t\tif i != j && r.StatusCode == r2.StatusCode {\n\t\t\t\tverr.Add(r, \"Multiple response definitions with status code %d\", r.StatusCode)\n\t\t\t}\n\t\t}\n\t\tif r.Tag[0] == \"\" {\n\t\t\tallTagged = false\n\t\t} else {\n\t\t\thasTags = true\n\t\t}\n\t\tif r.StatusCode < 400 {\n\t\t\tif successResp && e.MethodExpr.Stream == ServerStreamKind {\n\t\t\t\tverr.Add(r, \"At most one success response can be defined for a streaming endpoint.\")\n\t\t\t\tif r.Body != nil && r.Body.Type == Empty {\n\t\t\t\t\tverr.Add(r, \"Response body empty but endpoint defines streaming WebSocket response.\")\n\t\t\t\t}\n\t\t\t} else if successResp && e.SkipResponseBodyEncodeDecode {\n\t\t\t\tverr.Add(r, \"At most one success response can be defined for a endpoint using SkipResponseBodyEncodeDecode.\")\n\t\t\t}\n\t\t\tsuccessResp = true\n\t\t}\n\t}\n\tif hasTags && allTagged {\n\t\tverr.Add(e, \"All responses define a Tag, at least one response must define no Tag.\")\n\t}\n\tif hasTags && !IsObject(e.MethodExpr.Result.Type) {\n\t\tverr.Add(e, \"Some responses define a Tag but the method Result type is not an object.\")\n\t}\n\n\t// Make sure parameters and headers use compatible types\n\tverr.Merge(e.validateParams())\n\tverr.Merge(e.validateHeadersAndCookies())\n\n\t// Validate body attribute (required fields exist etc.)\n\tif e.Body != nil {\n\t\tverr.Merge(e.Body.Validate(\"HTTP body\", e))\n\t\tif e.SkipRequestBodyEncodeDecode {\n\t\t\tverr.Add(e, \"Cannot define a request body when using SkipRequestBodyEncodeDecode.\")\n\t\t}\n\t\t// Make sure Body does not require attribute that are not required in\n\t\t// payload.\n\t\tif v := e.Body.Validation; v != nil {\n\t\t\tvar preqs, missing []string\n\t\t\tif e.MethodExpr.Payload != nil && e.MethodExpr.Payload.Validation != nil {\n\t\t\t\tpreqs = e.MethodExpr.Payload.Validation.Required\n\t\t\t}\n\t\t\tfor _, req := range v.Required {\n\t\t\t\tfound := false\n\t\t\t\tfor _, preq := range preqs {\n\t\t\t\t\tif req == preq {\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\tmissing = append(missing, req)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(missing) > 0 {\n\t\t\t\tis := \"is\"\n\t\t\t\ts := \"\"\n\t\t\t\tif len(missing) > 1 {\n\t\t\t\t\tis = \"are\"\n\t\t\t\t\ts = \"s\"\n\t\t\t\t}\n\t\t\t\tverr.Add(e, \"The following HTTP request body attribute%s %s required but the corresponding method payload attribute%s %s not: %s. Use 'Required' to make the attribute%s required in the method payload as well.\",\n\t\t\t\t\ts, is, s, is, strings.Join(missing, \", \"), s)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate errors\n\tfor _, er := range e.HTTPErrors {\n\t\tverr.Merge(er.Validate())\n\t}\n\n\t// Validate definitions of params, headers and bodies against definition of payload\n\tvar (\n\t\thasParams = !e.Params.IsEmpty()\n\t\thasHeaders = !e.Headers.IsEmpty()\n\t\thasCookies = !e.Cookies.IsEmpty()\n\t)\n\tif isEmpty(e.MethodExpr.Payload) {\n\t\tif e.MapQueryParams != nil {\n\t\t\tverr.Add(e, \"MapParams is set but Payload is not defined\")\n\t\t}\n\t\tif e.MultipartRequest {\n\t\t\tverr.Add(e, \"MultipartRequest is set but Payload is not defined\")\n\t\t}\n\t\tif !e.Params.IsEmpty() {\n\t\t\tverr.Add(e, \"Params are set but Payload is not defined.\")\n\t\t}\n\t\tif !e.Headers.IsEmpty() {\n\t\t\tverr.Add(e, \"Headers are set but Payload is not defined.\")\n\t\t}\n\t\treturn verr\n\t}\n\tif IsArray(e.MethodExpr.Payload.Type) {\n\t\tif e.MapQueryParams != nil {\n\t\t\tverr.Add(e, \"MapParams is set but Payload type is array. Payload type must be map or an object with a map attribute\")\n\t\t}\n\t\tif hasParams && e.MultipartRequest {\n\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint defines MultipartRequest and route/query string parameters. At most one of these must be defined.\")\n\t\t}\n\t\tif hasHeaders {\n\t\t\tif hasCookies || e.MultipartRequest {\n\t\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint defines headers and MultipartRequest or cookies. At most one of these must be defined.\")\n\t\t\t}\n\t\t\tif hasParams {\n\t\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint defines both route or query string parameters and headers. At most one parameter or header must be defined and it must be of type array.\")\n\t\t\t}\n\t\t\tif !IsPrimitive(AsArray(e.MethodExpr.Payload.Type).ElemType.Type) {\n\t\t\t\tverr.Add(e, \"Array payloads used in HTTP headers must be of arrays of primitive types.\")\n\t\t\t}\n\t\t}\n\t\tif e.Body != nil && e.Body.Type != Empty {\n\t\t\tif e.MultipartRequest {\n\t\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint defines MultipartRequest and body. At most one of these must be defined.\")\n\t\t\t}\n\t\t\tif !IsArray(e.Body.Type) {\n\t\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint body is not.\")\n\t\t\t}\n\t\t\tif hasParams {\n\t\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint defines both a body and route or query string parameters. At most one of these must be defined and it must be an array.\")\n\t\t\t}\n\t\t\tif hasHeaders {\n\t\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint defines both a body and headers. At most one of these must be defined and it must be an array.\")\n\t\t\t}\n\t\t}\n\t\tif !hasParams && !hasHeaders && e.SkipRequestBodyEncodeDecode {\n\t\t\tverr.Add(e, \"Payload type is array but HTTP endpoint uses SkipRequestBodyEncodeDecode and does not define headers or params.\")\n\t\t}\n\t}\n\n\tif pMap := AsMap(e.MethodExpr.Payload.Type); pMap != nil {\n\t\tif e.MapQueryParams != nil {\n\t\t\tif e.MultipartRequest {\n\t\t\t\tverr.Add(e, \"Payload type is map but HTTP endpoint defines MultipartRequest and MapParams. At most one of these must be defined.\")\n\t\t\t}\n\t\t\tif *e.MapQueryParams != \"\" {\n\t\t\t\tverr.Add(e, \"MapParams is set to an attribute in the Payload but Payload is a map. Payload must be an object with an attribute of map type\")\n\t\t\t}\n\t\t\tif !IsPrimitive(pMap.KeyType.Type) {\n\t\t\t\tverr.Add(e, \"MapParams is set and Payload type is map. But payload key type must be a primitive\")\n\t\t\t}\n\t\t\tif !IsPrimitive(pMap.ElemType.Type) && !IsArray(pMap.ElemType.Type) {\n\t\t\t\tverr.Add(e, \"MapParams is set and Payload type is map. But payload element type must be a primitive or array\")\n\t\t\t}\n\t\t\tif IsArray(pMap.ElemType.Type) && !IsPrimitive(AsArray(pMap.ElemType.Type).ElemType.Type) {\n\t\t\t\tverr.Add(e, \"MapParams is set and Payload type is map. But array elements in payload element type must be primitive\")\n\t\t\t}\n\t\t}\n\t\tif hasParams && e.MultipartRequest {\n\t\t\tverr.Add(e, \"Payload type is map but HTTP endpoint defines MultipartRequest and route/query string parameters. At most one of these must be defined.\")\n\t\t}\n\t\tif e.Body != nil && e.Body.Type != Empty {\n\t\t\tif e.MultipartRequest {\n\t\t\t\tverr.Add(e, \"Payload type is map but HTTP endpoint defines MultipartRequest and body. At most one of these must be defined.\")\n\t\t\t}\n\t\t\tif !IsMap(e.Body.Type) {\n\t\t\t\tverr.Add(e, \"Payload type is map but HTTP endpoint body is not.\")\n\t\t\t}\n\t\t\tif hasParams {\n\t\t\t\tverr.Add(e, \"Payload type is map but HTTP endpoint defines both a body and route or query string parameters. At most one of these must be defined and it must be a map.\")\n\t\t\t}\n\t\t}\n\t\tif !hasParams && e.SkipRequestBodyEncodeDecode {\n\t\t\tverr.Add(e, \"Payload type is map but HTTP endpoint uses SkipRequestBodyEncodeDecode and does not define headers.\")\n\t\t}\n\t}\n\n\tif IsObject(e.MethodExpr.Payload.Type) {\n\t\tif e.MapQueryParams != nil {\n\t\t\tif pAttr := *e.MapQueryParams; pAttr == \"\" {\n\t\t\t\tverr.Add(e, \"MapParams is set to map entire payload but payload is an object. Payload must be a map.\")\n\t\t\t} else if e.MethodExpr.Payload.Find(pAttr) == nil {\n\t\t\t\tverr.Add(e, \"MapParams is set to an attribute in Payload. But payload has no attribute with type map and name %s\", pAttr)\n\t\t\t}\n\t\t}\n\t\tif e.Body != nil {\n\t\t\tif e.MultipartRequest {\n\t\t\t\tverr.Add(e, \"HTTP endpoint defines MultipartRequest and body. At most one of these must be defined.\")\n\t\t\t}\n\t\t\tif bObj := AsObject(e.Body.Type); bObj != nil {\n\t\t\t\tvar props []string\n\t\t\t\tprops, ok := e.Body.Meta[\"origin:attribute\"]\n\t\t\t\tif !ok {\n\t\t\t\t\tfor _, nat := range *bObj {\n\t\t\t\t\t\tname := strings.Split(nat.Name, \":\")[0]\n\t\t\t\t\t\tprops = append(props, name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, prop := range props {\n\t\t\t\t\tif e.MethodExpr.Payload.Find(prop) == nil {\n\t\t\t\t\t\tverr.Add(e, \"Body %q is not found in Payload.\", prop)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tbody := httpRequestBody(e)\n\tif e.SkipRequestBodyEncodeDecode && body.Type != Empty {\n\t\tverr.Add(e, \"HTTP endpoint request body must be empty when using SkipRequestBodyEncodeDecode but not all method payload attributes are mapped to headers and params. Make sure to define Headers and Params as needed.\")\n\t}\n\tif e.MethodExpr.IsStreaming() && body.Type != Empty {\n\t\t// Refer Websocket protocol - https://tools.ietf.org/html/rfc6455\n\t\t// Protocol does not allow HTTP request body to be passed.\n\t\tverr.Add(e, \"HTTP endpoint request body must be empty when the endpoint uses streaming. Payload attributes must be mapped to headers and/or params.\")\n\t}\n\n\treturn verr\n}", "title": "" }, { "docid": "4a12870631baf7d828b81488f71aaf46", "score": "0.50909805", "text": "func (s *Subscription) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "bc477b399d0945a8470012c00a6ba069", "score": "0.5084617", "text": "func (o *AttendIoAPI) Validate() error {\n\tvar unregistered []string\n\n\tif o.JSONConsumer == nil {\n\t\tunregistered = append(unregistered, \"JSONConsumer\")\n\t}\n\n\tif o.JSONProducer == nil {\n\t\tunregistered = append(unregistered, \"JSONProducer\")\n\t}\n\n\tif o.SystemGetStatusHandler == nil {\n\t\tunregistered = append(unregistered, \"system.GetStatusHandler\")\n\t}\n\tif o.TalksGetTalksHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.GetTalksHandler\")\n\t}\n\tif o.AttendeesPostAttendeesHandler == nil {\n\t\tunregistered = append(unregistered, \"attendees.PostAttendeesHandler\")\n\t}\n\tif o.TalksPostTalksHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.PostTalksHandler\")\n\t}\n\tif o.TalksAddAttendeeToTalkHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.AddAttendeeToTalkHandler\")\n\t}\n\tif o.AttendeesDeleteAttendeeByIDHandler == nil {\n\t\tunregistered = append(unregistered, \"attendees.DeleteAttendeeByIDHandler\")\n\t}\n\tif o.TalksDeleteAttendeeFromTalkHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.DeleteAttendeeFromTalkHandler\")\n\t}\n\tif o.TalksDeleteTalkByIDHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.DeleteTalkByIDHandler\")\n\t}\n\tif o.AttendeesGetAttendeeByFieldHandler == nil {\n\t\tunregistered = append(unregistered, \"attendees.GetAttendeeByFieldHandler\")\n\t}\n\tif o.TalksGetTalkAttendeesHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.GetTalkAttendeesHandler\")\n\t}\n\tif o.TalksGetTalkByIDHandler == nil {\n\t\tunregistered = append(unregistered, \"talks.GetTalkByIDHandler\")\n\t}\n\n\tif len(unregistered) > 0 {\n\t\treturn fmt.Errorf(\"missing registration: %s\", strings.Join(unregistered, \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9bb61fd6d68de49e38080014f55ccec", "score": "0.50807625", "text": "func (m *versionRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "35617a58dc0ae52daa226aa5cdd07e95", "score": "0.50784695", "text": "func (m *ChapterUpdateReq) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif utf8.RuneCountInString(m.GetId()) != 32 {\n\t\treturn ChapterUpdateReqValidationError{\n\t\t\tfield: \"Id\",\n\t\t\treason: \"value length must be 32 runes\",\n\t\t}\n\t}\n\n\tif !_ChapterUpdateReq_Id_Pattern.MatchString(m.GetId()) {\n\t\treturn ChapterUpdateReqValidationError{\n\t\t\tfield: \"Id\",\n\t\t\treason: \"value does not match regex pattern \\\"^[0-9A-Za-z]+$\\\"\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn ChapterUpdateReqValidationError{\n\t\t\t\tfield: \"Name\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif wrapper := m.GetLeaderId(); wrapper != nil {\n\n\t\tif utf8.RuneCountInString(wrapper.GetValue()) != 32 {\n\t\t\treturn ChapterUpdateReqValidationError{\n\t\t\t\tfield: \"LeaderId\",\n\t\t\t\treason: \"value length must be 32 runes\",\n\t\t\t}\n\t\t}\n\n\t\tif !_ChapterUpdateReq_LeaderId_Pattern.MatchString(wrapper.GetValue()) {\n\t\t\treturn ChapterUpdateReqValidationError{\n\t\t\t\tfield: \"LeaderId\",\n\t\t\t\treason: \"value does not match regex pattern \\\"^[0-9A-Za-z]+$\\\"\",\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a53889c6034e6dddd234935ea402674c", "score": "0.5073711", "text": "func validateIngressAddon(ctx context.Context, t *testing.T, profile string) {\n\tdefer PostMortemLogs(t, profile)\n\tif NoneDriver() {\n\t\tt.Skipf(\"skipping: ingress not supported\")\n\t}\n\n\tclient, err := kapi.Client(profile)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to get Kubernetes client: %v\", client)\n\t}\n\n\t// avoid timeouts like:\n\t// Error from server (InternalError): Internal error occurred: failed calling webhook \"validate.nginx.ingress.kubernetes.io\": Post \"https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s\": dial tcp 10.107.218.58:443: i/o timeout\n\t// Error from server (InternalError): Internal error occurred: failed calling webhook \"validate.nginx.ingress.kubernetes.io\": Post \"https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s\": context deadline exceeded\n\tif _, err = Run(t, exec.CommandContext(ctx, \"kubectl\", \"--context\", profile, \"wait\", \"--for=condition=ready\", \"--namespace=ingress-nginx\", \"pod\", \"--selector=app.kubernetes.io/component=controller\", \"--timeout=90s\")); err != nil {\n\t\tt.Fatalf(\"failed waiting for ingress-nginx-controller : %v\", err)\n\t}\n\n\t// use nginx ingress yaml that corresponds to k8s version\n\t// default: k8s >= v1.19, ingress api v1\n\tingressYaml := \"nginx-ingress-v1.yaml\"\n\tingressDNSYaml := \"ingress-dns-example-v1.yaml\"\n\tv, err := client.ServerVersion()\n\tif err == nil {\n\t\t// for pre-release k8s version, remove any \"+\" suffix in minor version to be semver-compliant and not panic\n\t\t// ref: https://github.com/kubernetes/minikube/pull/16145#issuecomment-1483283260\n\t\tminor := strings.TrimSuffix(v.Minor, \"+\")\n\t\tif semver.MustParseRange(\"<1.19.0\")(semver.MustParse(fmt.Sprintf(\"%s.%s.0\", v.Major, minor))) {\n\t\t\t// legacy: k8s < v1.19 & ingress api v1beta1\n\t\t\tingressYaml = \"nginx-ingress-v1beta1.yaml\"\n\t\t\tingressDNSYaml = \"ingress-dns-example-v1beta1.yaml\"\n\t\t}\n\t} else {\n\t\tt.Log(\"failed to get k8s version, assuming v1.19+ => ingress api v1\")\n\t}\n\n\t// create networking.k8s.io/v1 ingress\n\tcreatev1Ingress := func() error {\n\t\t// apply networking.k8s.io/v1 ingress\n\t\trr, err := Run(t, exec.CommandContext(ctx, \"kubectl\", \"--context\", profile, \"replace\", \"--force\", \"-f\", filepath.Join(*testdataDir, ingressYaml)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif rr.Stderr.String() != \"\" {\n\t\t\tt.Logf(\"%v: unexpected stderr: %s (may be temporary)\", rr.Command(), rr.Stderr)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := retry.Expo(createv1Ingress, 1*time.Second, Seconds(90)); err != nil {\n\t\tt.Errorf(\"failed to create ingress: %v\", err)\n\t}\n\n\trr, err := Run(t, exec.CommandContext(ctx, \"kubectl\", \"--context\", profile, \"replace\", \"--force\", \"-f\", filepath.Join(*testdataDir, \"nginx-pod-svc.yaml\")))\n\tif err != nil {\n\t\tt.Errorf(\"failed to kubectl replace nginx-pod-svc. args %q. %v\", rr.Command(), err)\n\t}\n\n\tif _, err := PodWait(ctx, t, profile, \"default\", \"run=nginx\", Minutes(8)); err != nil {\n\t\tt.Fatalf(\"failed waiting for ngnix pod: %v\", err)\n\t}\n\tif err := kapi.WaitForService(client, \"default\", \"nginx\", true, time.Millisecond*500, Minutes(10)); err != nil {\n\t\tt.Errorf(\"failed waiting for nginx service to be up: %v\", err)\n\t}\n\n\twant := \"Welcome to nginx!\"\n\taddr := \"http://127.0.0.1/\"\n\n\t// check if the ingress can route nginx app with networking.k8s.io/v1 ingress\n\tcheckv1Ingress := func() error {\n\t\trr, err := Run(t, exec.CommandContext(ctx, Target(), \"-p\", profile, \"ssh\", fmt.Sprintf(\"curl -s %s -H 'Host: nginx.example.com'\", addr)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tstderr := rr.Stderr.String()\n\t\tif rr.Stderr.String() != \"\" {\n\t\t\tt.Logf(\"debug: unexpected stderr for %v:\\n%s\", rr.Command(), stderr)\n\t\t}\n\t\tstdout := rr.Stdout.String()\n\t\tif !strings.Contains(stdout, want) {\n\t\t\treturn fmt.Errorf(\"%v stdout = %q, want %q\", rr.Command(), stdout, want)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := retry.Expo(checkv1Ingress, 500*time.Millisecond, Seconds(90)); err != nil {\n\t\tt.Errorf(\"failed to get expected response from %s within minikube: %v\", addr, err)\n\t}\n\n\tif NeedsPortForward() {\n\t\tt.Skip(\"skipping ingress DNS test for any combination that needs port forwarding\")\n\t}\n\n\t// check the ingress-dns addon here as well\n\trr, err = Run(t, exec.CommandContext(ctx, \"kubectl\", \"--context\", profile, \"replace\", \"--force\", \"-f\", filepath.Join(*testdataDir, ingressDNSYaml)))\n\tif err != nil {\n\t\tt.Errorf(\"failed to kubectl replace ingress-dns-example. args %q. %v\", rr.Command(), err)\n\t}\n\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), \"-p\", profile, \"ip\"))\n\tif err != nil {\n\t\tt.Errorf(\"failed to retrieve minikube ip. args %q : %v\", rr.Command(), err)\n\t}\n\tip := strings.TrimSuffix(rr.Stdout.String(), \"\\n\")\n\n\trr, err = Run(t, exec.CommandContext(ctx, \"nslookup\", \"hello-john.test\", ip))\n\tif err != nil {\n\t\tt.Errorf(\"failed to nslookup hello-john.test host. args %q : %v\", rr.Command(), err)\n\t}\n\t// nslookup should include info about the hello-john.test host, including minikube's ip\n\tif !strings.Contains(rr.Stdout.String(), ip) {\n\t\tt.Errorf(\"unexpected output from nslookup. stdout: %v\\nstderr: %v\", rr.Stdout.String(), rr.Stderr.String())\n\t}\n\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), \"-p\", profile, \"addons\", \"disable\", \"ingress-dns\", \"--alsologtostderr\", \"-v=1\"))\n\tif err != nil {\n\t\tt.Errorf(\"failed to disable ingress-dns addon. args %q : %v\", rr.Command(), err)\n\t}\n\n\trr, err = Run(t, exec.CommandContext(ctx, Target(), \"-p\", profile, \"addons\", \"disable\", \"ingress\", \"--alsologtostderr\", \"-v=1\"))\n\tif err != nil {\n\t\tt.Errorf(\"failed to disable ingress addon. args %q : %v\", rr.Command(), err)\n\t}\n}", "title": "" }, { "docid": "e3d812d8aab919ae843b3c30472bc252", "score": "0.5073127", "text": "func (r *CniInterface) ValidateUpdate(old runtime.Object) error {\n\tcniinterfacelog.Info(\"validate update\", \"name\", r.Name)\n\n\t// TODO(user): fill in your validation logic upon object update.\n\treturn nil\n}", "title": "" }, { "docid": "573f670d72668d1ae9bf64c343234f07", "score": "0.5069602", "text": "func validateDeriveInvocationRequest(req *pb.DeriveInvocationRequest) error {\n\tif req.SwarmingTask == nil {\n\t\treturn errors.Reason(\"swarming_task missing\").Err()\n\t}\n\n\tif req.SwarmingTask.Hostname == \"\" {\n\t\treturn errors.Reason(\"swarming_task.hostname missing\").Err()\n\t}\n\n\tfor _, prefix := range urlPrefixes {\n\t\tif strings.HasPrefix(req.SwarmingTask.Hostname, prefix) {\n\t\t\treturn errors.Reason(\"swarming_task.hostname should not have prefix %q\", prefix).Err()\n\t\t}\n\t}\n\n\tif req.SwarmingTask.Id == \"\" {\n\t\treturn errors.Reason(\"swarming_task.id missing\").Err()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "feb25992bf941d8345aa5b956c9bbf57", "score": "0.5066549", "text": "func validatePlugin(p plugin.Base) error {\n\tpluginName := p.Name()\n\tif err := plugin.ValidateName(pluginName); err != nil {\n\t\treturn fmt.Errorf(\"invalid plugin name %q: %v\", pluginName, err)\n\t}\n\tif err := p.Version().Validate(); err != nil {\n\t\treturn fmt.Errorf(\"invalid plugin version %q: %v\", p.Version(), err)\n\t}\n\tfor _, projectVersion := range p.SupportedProjectVersions() {\n\t\tif err := validation.ValidateProjectVersion(projectVersion); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid project version %q: %v\", projectVersion, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86b345af82c057ee7609f13b7695c17f", "score": "0.5058361", "text": "func (m *UpdateMeetupInput) Validate() error {\n validate := validator.New()\n return validate.Struct(m)\n}", "title": "" }, { "docid": "70837ff28cd66fc7d042c4e42ea04bb2", "score": "0.5046065", "text": "func (p *Payment) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "d956dd51bb75de48beac07a3052fe441", "score": "0.5045725", "text": "func (p *PatchInstallationRequest) Validate() error {\n\tif p.Version != nil && len(*p.Version) == 0 {\n\t\treturn errors.New(\"provided version update value was blank\")\n\t}\n\tif p.Image != nil && len(*p.Image) == 0 {\n\t\treturn errors.New(\"provided image update value was blank\")\n\t}\n\tif p.Size != nil {\n\t\t_, err := mmv1alpha1.GetClusterSize(*p.Size)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"invalid size\")\n\t\t}\n\t}\n\t// EnvVarMap validation is skipped as all configurations of this now imply\n\t// a specific patch action should be taken.\n\n\treturn nil\n}", "title": "" }, { "docid": "bae097c227560aa31347d9c863a8923d", "score": "0.5034686", "text": "func (in *NetworkChaos) ValidateUpdate(old runtime.Object) error {\n\tnetworkchaoslog.Info(\"validate update\", \"name\", in.Name)\n\tif !reflect.DeepEqual(in.Spec, old.(*NetworkChaos).Spec) {\n\t\treturn ErrCanNotUpdateChaos\n\t}\n\treturn in.Validate()\n}", "title": "" }, { "docid": "f1e61792a7bd1f3329285230c8d2a898", "score": "0.5030925", "text": "func (namespaceStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {\n\terrorList := validation.ValidateNamespace(obj.(*api.Namespace))\n\treturn append(errorList, validation.ValidateNamespaceUpdate(obj.(*api.Namespace), old.(*api.Namespace))...)\n}", "title": "" } ]
fa6ab86d6d9ebe869d32df381b70f250
ReadValue reads the value from input stream
[ { "docid": "a1af33ef22f93d9ace55a2dd0135bcd8", "score": "0.624944", "text": "func (obj *CharAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tvalue, err := is.(*ProtocolDataInputStream).ReadChar()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning CharAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Returning CharAttribute::ReadValue - read value: '%+v'\", value))\n\t}\n\tobj.AttrValue = value\n\treturn nil\n}", "title": "" } ]
[ { "docid": "efbd2d8849376f34b42919a1fe889ccd", "score": "0.7283046", "text": "func readValue(r io.Reader, value interface{}) error {\n\tvar dec = gob.NewDecoder(r)\n\terr := dec.Decode(value)\n\treturn err\n}", "title": "" }, { "docid": "ea08a165e9681c3b383a9b870ec14ab0", "score": "0.69193804", "text": "func (r *Reader) readValue() (string, bool, error) {\n\tvar buf bytes.Buffer\n\tfor {\n\t\tch, _, err := r.Read()\n\t\tif err != nil {\n\t\t\t_, _ = buf.WriteRune(ch)\n\t\t\treturn buf.String(), false, err\n\t\t}\n\n\t\tswitch {\n\t\t// newline and letter, return value.\n\t\tcase IsNewline(ch) && unicode.IsLetter(r.Peek()):\n\t\t\treturn buf.String(), false, nil\n\t\t\t// newline and newline, return value and end-of-record.\n\t\tcase IsNewline(ch) && (IsNewline(r.Peek()) || r.Peek() == eof):\n\t\t\t// read and discard the current newline and next newline (EOR).\n\t\t\t_, _, err := r.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn buf.String(), true, err\n\t\t\t}\n\t\t\treturn buf.String(), true, nil\n\t\t}\n\t\t// nom-nom, keep on accumulating.\n\t\t_, _ = buf.WriteRune(ch)\n\t}\n}", "title": "" }, { "docid": "a6e8f5a0888cba5c45d4685b3688b62e", "score": "0.69168264", "text": "func (t TSL4531) ReadValue(phenomenon string) (float64, error) {\n\tif phenomenon != \"light\" {\n\t\treturn 0, fmt.Errorf(\"invalid phenomenon %s\", phenomenon)\n\t}\n\n\tlux, err := t.Lux()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn lux, nil\n}", "title": "" }, { "docid": "00811b311ae8a5ac5f9e66570baa9d90", "score": "0.6893337", "text": "func (in *DataInputX) ReadValue() (Value, error) {\n\tvalueType, err := in.ReadInt8()\n\tvalue := CreateValue(byte(valueType))\n\tif value == nil {\n\t\treturn NewNilValue(), errors.New(\"[scouter] Not defined value type:\" + strconv.FormatUint(uint64(valueType), 10))\n\t}\n\treadValue, err := value.Read(in)\n\treturn readValue, err\n\n}", "title": "" }, { "docid": "0cd1f57fbd657c9c870a1fc86532c03d", "score": "0.6865304", "text": "func readValue() string {\n\t\t\n\treader := bufio.NewReader(os.Stdin)\n\tvalue, _ := reader.ReadString('\\n')\n\treturn strings.Trim(value,\"\\n\")\n}", "title": "" }, { "docid": "e0d7ccd0809593f5fdeab82d70f11957", "score": "0.67814016", "text": "func (obj *IntegerAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning IntegerAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tvalue, err := is.(*ProtocolDataInputStream).ReadInt()\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning IntegerAttribute:SetValue - unable to extract attribute value in string format/type\"))\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"Returning IntegerAttribute::ReadValue - read value: '%+v'\", value))\n\t\t}\n\t\tobj.AttrValue = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d23320f449f5bd0f4cc41913b9ee1e23", "score": "0.66238594", "text": "func (obj *StringAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning StringAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tvalue, err := is.(*ProtocolDataInputStream).ReadUTF()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"StringAttribute::ReadValue - read value: '%+v'\", value))\n\t\t}\n\t\tobj.AttrValue = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53bbbbe8833aaf498c5954a4b8b23a30", "score": "0.6573796", "text": "func (obj *AbstractAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\treturn nil\n}", "title": "" }, { "docid": "6096497ad7b1279a7f928dc901deff9b", "score": "0.65432537", "text": "func (obj *ByteAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tvalue, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning ByteAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Returning ByteAttribute::ReadValue - read value: '%+v'\", value))\n\t}\n\tobj.AttrValue = value\n\treturn nil\n}", "title": "" }, { "docid": "fab98ac245a3b47c5e2da5312abacefd", "score": "0.65309584", "text": "func (obj *NumberAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning ShortAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\tprecision, err := is.(*ProtocolDataInputStream).ReadShort() // Precision\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning NumberAttribute:ReadValue w/ Error in reading Precision from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside NumberAttribute::ReadValue - read Precision: '%+v'\", precision))\n\t}\n\tscale, err := is.(*ProtocolDataInputStream).ReadShort() // Scale\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning NumberAttribute:ReadValue w/ Error in reading Scale from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside NumberAttribute::ReadValue - read Scale: '%+v'\", scale))\n\t}\n\n\tbdStr, err := is.(*ProtocolDataInputStream).ReadUTF()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning NumberAttribute:ReadValue w/ Error in reading bdStr from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside NumberAttribute::ReadValue - read bdStr: '%+v'\", bdStr))\n\t}\n\tobj.AttrValue, _ = NewTGDecimalFromString(bdStr)\n\treturn nil\n}", "title": "" }, { "docid": "6f570babd1398027933fcffca4b6fabd", "score": "0.6514155", "text": "func (dec *Decoder) readValue() (v []byte, err error) {\n\tvar n int\n\tvar r []byte\n\td := decoder{flags: dec.flags}\n\n\tfor {\n\t\tif len(dec.remain) != 0 {\n\t\t\tv, r, _, err = d.parseValue(dec.remain)\n\t\t\tif err == nil {\n\t\t\t\tdec.remain, n = skipSpacesN(r)\n\t\t\t\tdec.inputOffset += int64(len(v) + n)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(r) != 0 {\n\t\t\t\t// Parsing of the next JSON value stopped at a position other\n\t\t\t\t// than the end of the input buffer, which indicaates that a\n\t\t\t\t// syntax error was encountered.\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif err = dec.err; err != nil {\n\t\t\tif len(dec.remain) != 0 && err == io.EOF {\n\t\t\t\terr = io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tif dec.buffer == nil {\n\t\t\tdec.buffer = make([]byte, 0, minBufferSize)\n\t\t} else {\n\t\t\tdec.buffer = dec.buffer[:copy(dec.buffer[:cap(dec.buffer)], dec.remain)]\n\t\t\tdec.remain = nil\n\t\t}\n\n\t\tif (cap(dec.buffer) - len(dec.buffer)) < minReadSize {\n\t\t\tbuf := make([]byte, len(dec.buffer), 2*cap(dec.buffer))\n\t\t\tcopy(buf, dec.buffer)\n\t\t\tdec.buffer = buf\n\t\t}\n\n\t\tn, err = io.ReadFull(dec.reader, dec.buffer[len(dec.buffer):cap(dec.buffer)])\n\t\tif n > 0 {\n\t\t\tdec.buffer = dec.buffer[:len(dec.buffer)+n]\n\t\t\tif err != nil {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t} else if err == io.ErrUnexpectedEOF {\n\t\t\terr = io.EOF\n\t\t}\n\t\tdec.remain, n = skipSpacesN(dec.buffer)\n\t\td.flags = dec.flags | internalParseFlags(dec.remain)\n\t\tdec.inputOffset += int64(n)\n\t\tdec.err = err\n\t}\n}", "title": "" }, { "docid": "ef8385eab2d27b19f7164fee694dd344", "score": "0.650355", "text": "func ReadValue(path string) (n uint64, err error) {\n\t_, err = os.Stat(path)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer file.Close()\n\n\tcnt := \"\"\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tcnt = scanner.Text()\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn 0, err\n\t}\n\n\tn, err = strconv.ParseUint(cnt, 10, 64)\n\treturn n, nil\n}", "title": "" }, { "docid": "31627f71235d98323ed51b383e1a12c2", "score": "0.6486188", "text": "func (obj *ShortAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning ShortAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tvalue, err := is.(*ProtocolDataInputStream).ReadShort()\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning ShortAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"ShortAttribute::ReadValue - read value: '%+v'\", value))\n\t\t}\n\t\tobj.AttrValue = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14020a66176854c8ce699b5884ef2fac", "score": "0.64837", "text": "func ReadValue(attrTypeId int, is tgdb.TGInputStream) tgdb.TGError {\n\tattr, err := CreateAttributeByType(attrTypeId)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Execute Individual Attribute's method\n\treturn attr.ReadValue(is)\n}", "title": "" }, { "docid": "68172e3d65631254cbb274ad7c0c1fb0", "score": "0.6433514", "text": "func (obj *FloatAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning FloatAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tvalue, err := is.(*ProtocolDataInputStream).ReadFloat()\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning FloatAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"Returning FloatAttribute::ReadValue - read value: '%+v'\", value))\n\t\t}\n\t\tobj.AttrValue = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83f20a3e5a74c11fbcb6a14b37c3ce50", "score": "0.6399621", "text": "func (dec *Decoder) readValue() (int, error) {\n\tdec.scan.Reset()\n\n\tscanp := 0\n\tvar err error\nInput:\n\tfor {\n\t\t// Look in the buffer for a new value.\n\t\tfor i, c := range dec.buf[scanp:] {\n\t\t\tdec.scan.bytes++\n\t\t\tv := dec.scan.Step(&dec.scan, int(c))\n\t\t\tif v == ScanEnd {\n\t\t\t\tscanp += i\n\t\t\t\tbreak Input\n\t\t\t}\n\t\t\t// scanEnd is delayed one byte.\n\t\t\t// We might block trying to get that byte from src,\n\t\t\t// so instead invent a space byte.\n\t\t\tif (v == ScanEndObject || v == ScanEndArray) && dec.scan.Step(&dec.scan, ' ') == ScanEnd {\n\t\t\t\tscanp += i + 1\n\t\t\t\tbreak Input\n\t\t\t}\n\t\t\tif v == ScanError {\n\t\t\t\tdec.err = dec.scan.Err\n\t\t\t\treturn 0, dec.scan.Err\n\t\t\t}\n\t\t}\n\t\tscanp = len(dec.buf)\n\n\t\t// Did the last read have an error?\n\t\t// Delayed until now to allow buffer scan.\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tif dec.scan.Step(&dec.scan, ' ') == ScanEnd {\n\t\t\t\t\tbreak Input\n\t\t\t\t}\n\t\t\t\tif nonSpace(dec.buf) {\n\t\t\t\t\terr = io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t}\n\t\t\tdec.err = err\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Make room to read more into the buffer.\n\t\tconst minRead = 512\n\t\tif cap(dec.buf)-len(dec.buf) < minRead {\n\t\t\tnewBuf := make([]byte, len(dec.buf), 2*cap(dec.buf)+minRead)\n\t\t\tcopy(newBuf, dec.buf)\n\t\t\tdec.buf = newBuf\n\t\t}\n\n\t\t// Read. Delay error for next iteration (after scan).\n\t\tvar n int\n\t\tn, err = dec.r.Read(dec.buf[len(dec.buf):cap(dec.buf)])\n\t\tdec.buf = dec.buf[0 : len(dec.buf)+n]\n\t}\n\treturn scanp, nil\n}", "title": "" }, { "docid": "24f55a2cde4c74fb4bc843e7635b10b7", "score": "0.6393757", "text": "func (obj *LongAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning LongAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tvalue, err := is.(*ProtocolDataInputStream).ReadLong()\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning LongAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"Returning LongAttribute::ReadValue - read value: '%+v'\", value))\n\t\t}\n\t\tobj.AttrValue = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95aa78d44dbfad9b6d6306aff9dbc0ee", "score": "0.63108224", "text": "func (obj *BlobAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tentityId, err := is.(*ProtocolDataInputStream).ReadLong()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning BlobAttribute:ReadValue w/ Error in reading entityId from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"BlobAttribute::ReadValue - read entityId: '%+v'\", entityId))\n\t}\n\tobj.entityId = entityId\n\tobj.isCached = false\n\treturn nil\n}", "title": "" }, { "docid": "93971b81d85d4cd4bf87f792296a6de8", "score": "0.619504", "text": "func (c *Client) ReadValue(ctx context.Context, name string) (value interface{}, err error) {\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn value, ctx.Err()\n\tdefault:\n\t\tif c.isDebug {\n\t\t\tlog.Debugf(\"Value name: %s\", name)\n\t\t}\n\n\t\turl := fmt.Sprintf(\"/%s\", name)\n\t\tdata := make(map[string]interface{})\n\n\t\tresp, err := c.resty.R().\n\t\t\tSetHeader(\"Accept\", \"application/json\").\n\t\t\tSetContext(ctx).\n\t\t\tSetResult(&data).\n\t\t\tGet(url)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlog.Debugf(\"Resp: %s\", resp.String())\n\n\t\tif temp, ok := data[name]; ok {\n\t\t\tvalue = temp\n\t\t} else {\n\t\t\terr = errors.Errorf(\"Variable %s not found\", name)\n\t\t}\n\n\t\treturn value, err\n\t}\n}", "title": "" }, { "docid": "526a102338b91453a5be5d979e52802f", "score": "0.6189184", "text": "func (e T) ReadValue(buf []byte) []byte {\n\tstart := e.offset + e.Key()\n\treturn buf[start : start+e.Value()]\n}", "title": "" }, { "docid": "50cea936b7b5c205a397cd0f85c0481c", "score": "0.6186026", "text": "func (obj *DoubleAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning DoubleAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tvalue, err := is.(*ProtocolDataInputStream).ReadDouble()\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning DoubleAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"DoubleAttribute::ReadValue - read value: '%+v'\", value))\n\t\t}\n\t\tobj.AttrValue = value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f0b7ac3170360c6c6f33fd80cdccb2d", "score": "0.61716396", "text": "func (nilValue *NilValue) Read(in *DataInputX) (Value, error) {\n\treturn nilValue, nil\n}", "title": "" }, { "docid": "f483a4931268540c3a8d39287b89abbb", "score": "0.6105313", "text": "func (obj *BooleanAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tvalue, err := is.(*ProtocolDataInputStream).ReadBoolean()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading value from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"BooleanAttribute::ReadValue - read value: '%+v'\", value))\n\t}\n\tobj.AttrValue = value\n\treturn nil\n}", "title": "" }, { "docid": "e5194fce623c50390f7a5be05e5487b8", "score": "0.6050924", "text": "func (r *ByteValueReader) Value() []byte {\n\treturn decodeBytes(r.value)\n}", "title": "" }, { "docid": "a551cc913bcd33f0953fc2bfde21236d", "score": "0.60134757", "text": "func (r *StringReader) Read(p []byte) (n int, e error) {\n\tif r.offset >= len(r.Val) {\n\t\treturn 0, io.EOF\n\t}\n\n\tif len(r.Val)-r.offset > len(p) {\n\t\tn = len(p)\n\t} else {\n\t\tn = len(r.Val) - r.offset\n\t}\n\n\tfor i, v := range r.Val[r.offset : r.offset+n] {\n\t\tp[i] = byte(v)\n\t\tr.offset++\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "6096f82f667360b63e1e2b493f03466f", "score": "0.59757733", "text": "func (obj *ClobAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tentityId, err := is.(*ProtocolDataInputStream).ReadLong()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning ClobAttribute:ReadValue w/ Error in reading entityId from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Returning BlobAttribute::ReadValue - read entityId: '%+v'\", entityId))\n\t}\n\tobj.entityId = entityId\n\tobj.isCached = false\n\treturn nil\n}", "title": "" }, { "docid": "7f86035d098b47ba3b6d90587efe6780", "score": "0.5958663", "text": "func (c *StdinoutStream) Read(p []byte) (int, error) {\n\treturn os.Stdin.Read(p)\n\n}", "title": "" }, { "docid": "f102f3aea68029ebaa82c76ece19fa47", "score": "0.59423137", "text": "func (r *Receiver) ReadVal(v interface{}) bool {\n\tr.mx.Lock()\n\tdefer r.mx.Unlock()\n\n\tmsg := r.read()\n\tok := fill.Fill(v, msg.v) == nil\n\tif ok {\n\t\tr.swap(msg)\n\t}\n\n\treturn ok\n}", "title": "" }, { "docid": "332793fccd7c6512d2d2d0a03d006b24", "score": "0.5911619", "text": "func (r *readCount) Read(p []byte) (n int, err error) {\n\tn, err = r.reader.Read(p)\n\tr.setValues(int64(n))\n\treturn\n}", "title": "" }, { "docid": "2b575bd6b0acee2d367beb2b66b91a07", "score": "0.5901449", "text": "func (resource *ImmutableResource) Read() (interface{}, error) {\n\treturn resource.value, nil\n}", "title": "" }, { "docid": "6e3f74389936ff89084b96977f33dd24", "score": "0.5898295", "text": "func (user) read(b []byte) (int, error) {\n\ts := \"Test\"\n\treturn copy(b, s), nil\n}", "title": "" }, { "docid": "5c14c5ec07875e6288f3da8e60eb4ebd", "score": "0.58686966", "text": "func (br *ByteReader) GetValue() []byte {\r\n\treturn (*br).buffer.Bytes()\r\n}", "title": "" }, { "docid": "edd100afb91901c38d50163e15cd18cf", "score": "0.58546746", "text": "func (tracker *Tracker) ReadValue() (bool, *db.Measurement) {\n\tcontents := tracker.getJSONFromServer()\n\tvar data map[string]string\n\tif contents != nil {\n\t\terr := json.Unmarshal(contents, &data)\n\t\tif err != nil {\n\t\t\treturn false, nil\n\t\t}\n\t\tmeasure := db.Measurement{Name: data[\"name\"], Timestamp: time.Now()}\n\t\tmeasure.SetValueFromString(data[\"value\"])\n\t\tprintf(\"Read data: Name: (%s) Timestamp: (%s) Value: (%f)\\n\", measure.Name, measure.GetTimeAsString(), measure.Value)\n\t\treturn true, &measure\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "17deb067403fd2e2bbdaef4ac2d8b9f9", "score": "0.57622516", "text": "func (r *Receiver) MustReadVal(v interface{}) {\n\tfor !r.ReadVal(v) {\n\t\tr.Read()\n\t}\n}", "title": "" }, { "docid": "501e2e016f8beceda6a6c38c6f79799e", "score": "0.5692429", "text": "func (s *GattCharacteristic1) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error) {\n\tlog.Debug(\"Characteristic.ReadValue\")\n\n\tb, err := s.config.service.config.app.HandleRead(s.config.service.Path(), s.Path())\n\n\tvar dberr *dbus.Error\n\tif err != nil {\n\t\tif err.code == CallbackNotRegistered {\n\t\t\t// No registered callback, so we'll just use our stored value\n\t\t\tb = s.properties.Value\n\t\t} else {\n\t\t\tdberr = dbus.NewError(err.Error(), nil)\n\t\t}\n\t}\n\n\treturn b, dberr\n}", "title": "" }, { "docid": "0b12662c523cf72f59e9f6976ea81c7f", "score": "0.5685789", "text": "func (p *Pin) Value() (VALUE, error) {\n\tfile := fmt.Sprintf(\"%s/gpio%d/value\", basedir, p.Num)\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\tb, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tv := string(b)\n\tif v == \"0\\n\" {\n\t\treturn LOW, nil\n\t} else if v == \"1\\n\" {\n\t\treturn HIGH, nil\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"UNDEFINED VALUE\")\n\t}\n}", "title": "" }, { "docid": "20d411678994e4cfda35a0f665208502", "score": "0.5674047", "text": "func (g *GID) ValueRead() uint32 {\n\treturn g.gid\n}", "title": "" }, { "docid": "d0e47d353b4affb43600c6e907f383a8", "score": "0.56673115", "text": "func (r *Reader) Read(s []byte) (int, error) { return r.entryReader.Read(s) }", "title": "" }, { "docid": "1b2fc9835d95f7d107b86f765b8338dc", "score": "0.5659437", "text": "func readValue(ch chan []byte, n uint64, logger *log.Logger) ([]byte, bool) {\n\t//now we need to read the value which should have been sent\n\tvalReadLength := uint64(0)\n\tvar v []byte\n\terr := false\n\tup := make(chan bool, 1)\n\t//after 5 seconds passed reading value, we'll just send err to client\n\tgo func() {\n\t\ttime.Sleep(5 * time.Second)\n\t\tup <- true\n\t}()\n\n\t//use select for the data channel and the timeout channel\n\tfor valReadLength < n+2 {\n\t\tselect {\n\t\tcase temp := <-ch:\n\t\t\tvalReadLength += uint64(len(temp))\n\t\t\tif valReadLength > n+2 {\n\t\t\t\terr = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tv = append(v, temp...)\n\n\t\tcase <-up:\n\t\t\terr = true\n\t\t\tbreak\n\t\t}\n\n\t\t//will be true if timeout occurs\n\t\tif err {\n\t\t\tlogger.Println(\"Timeout\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif err {\n\t\treturn []byte{0}, err\n\t}\n\treturn v[:n], err\n}", "title": "" }, { "docid": "b35250936b7a439deba4a9b12794beda", "score": "0.56376123", "text": "func (obj *TimestampAttribute) ReadValue(is tgdb.TGInputStream) tgdb.TGError {\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprint(\"Entering TimestampAttribute::ReadValue\"))\n\t}\n\tif obj.GetAttributeDescriptor().Is_Encrypted() {\n\t\terr := AbstractAttributeReadDecrypted(obj, is)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning StringAttribute:ReadValue w/ Error in AbstractAttributeReadDecrypted()\"))\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\tvar v time.Time\n\tvar year, mon, dom, hr, min, sec, ms, tzType int\n\tera, err := is.(*ProtocolDataInputStream).ReadBoolean()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading era from message buffer\"))\n\t\treturn err\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read era: '%+v'\", era))\n\t}\n\n\tyr, err := is.(*ProtocolDataInputStream).ReadShort()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading yr from message buffer\"))\n\t\treturn err\n\t}\n\tyear = int(yr)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read year: '%+v'\", year))\n\t}\n\n\tmth, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading mth from message buffer\"))\n\t\treturn err\n\t}\n\tmon = int(mth)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read mth: '%+v'\", mth))\n\t}\n\n\tday, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading day from message buffer\"))\n\t\treturn err\n\t}\n\tdom = int(day)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read dom: '%+v'\", dom))\n\t}\n\n\thour, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading hour from message buffer\"))\n\t\treturn err\n\t}\n\thr = int(hour)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read hr: '%+v'\", hr))\n\t}\n\n\tmts, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading mts from message buffer\"))\n\t\treturn err\n\t}\n\tmin = int(mts)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read min: '%+v'\", min))\n\t}\n\n\tsecs, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading secs from message buffer\"))\n\t\treturn err\n\t}\n\tsec = int(secs)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read sec: '%+v'\", sec))\n\t}\n\n\tmSec, err := is.(*ProtocolDataInputStream).ReadUnsignedShort()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading mSec from message buffer\"))\n\t\treturn err\n\t}\n\tms = int(mSec)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read ms: '%+v'\", ms))\n\t}\n\n\ttz, err := is.(*ProtocolDataInputStream).ReadByte()\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading tz from message buffer\"))\n\t\treturn err\n\t}\n\ttzType = int(tz)\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read tz: '%+v' and tzType: '%+v'\", tz, tzType))\n\t}\n\n\tif tzType != -1 && tzType != 255 {\n\t\ttzId, err := is.(*ProtocolDataInputStream).ReadShort()\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprint(\"ERROR: Returning TimestampAttribute:ReadValue w/ Error in reading tzId from message buffer\"))\n\t\t\treturn err\n\t\t}\n\t\tif logger.IsDebug() {\n\t\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - read tzId: '%+v'\", tzId))\n\t\t}\n\t}\n\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Inside TimestampAttribute::ReadValue - attribute type: '%+v'\", obj.AttrDesc.GetAttrType()))\n\t}\n\tswitch obj.AttrDesc.GetAttrType() {\n\tcase AttributeTypeDate:\n\t\tv = time.Date(year, time.Month(mon), dom, 0, 0, 0, 0, time.Local)\n\t\tbreak\n\tcase AttributeTypeTime:\n\t\tv = time.Date(1970, time.January, 01, hr, min, sec, ms*1000, time.Local)\n\t\tbreak\n\tcase AttributeTypeTimeStamp:\n\t\tv = time.Date(year, time.Month(mon), dom, hr, min, sec, ms*1000, time.Local)\n\t\tbreak\n\tdefault:\n\t\terrMsg := fmt.Sprintf(\"Bad Descriptor: %s\", string(obj.AttrDesc.GetAttrType()))\n\t\treturn GetErrorByType(TGErrorIOException, \"TGErrorIOException\", errMsg, \"\")\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(fmt.Sprintf(\"Returning TimestampAttribute::ReadValue - read v: '%+v'\", v))\n\t}\n\n\t//obj.AttrValue = v.In(loc)\t\t// TODO: Revisit later to use this once location/zone information is available\n\tobj.AttrValue = v\n\treturn nil\n}", "title": "" }, { "docid": "7b9d90e58a183a828126fbd93e5013c0", "score": "0.5618521", "text": "func (r *SimpleIntReader) ReadInt() int {\n\tif len(r.buffer) == 0 {\n\t\treturn 0\n\t}\n\tvalue := r.buffer[r.pos]\n\tr.pos = (r.pos + 1) % len(r.buffer)\n\treturn value\n}", "title": "" }, { "docid": "2a3ac93e7bbe611895223603ac9ff137", "score": "0.5606527", "text": "func (inputPin *InputPinDummy) GetValue() (bool, error) {\n\tlog.Println(\"Return Error on 'InputPin.GetValue' (y/n)\")\n\tscanner := bufio.NewScanner(os.Stdin)\n\tif !scanner.Scan() {\n\t\tscanErr := scanner.Err()\n\t\tpanic(scanErr)\n\t}\n\n\tif strings.EqualFold(scanner.Text(), \"y\") {\n\t\treturn false, fmt.Errorf(\"error getting value from input pin %d\", inputPin.port)\n\t}\n\n\tlog.Println(\"Return true on 'Input.GetValue' (y/n)\")\n\tif !scanner.Scan() {\n\t\tscanErr := scanner.Err()\n\t\tpanic(scanErr)\n\t}\n\n\treturn strings.EqualFold(scanner.Text(), \"y\"), nil\n}", "title": "" }, { "docid": "c772adbdf235d7911d5cd7633be86fa5", "score": "0.5599511", "text": "func (resource *LocallySharedResource) Read() (interface{}, error) {\n\tif resource.writtenBuf != nil {\n\t\treturn resource.writtenBuf, nil\n\t}\n\n\treturn resource.val, nil\n}", "title": "" }, { "docid": "fceaf06b7972ee970599e0ac3bf2a7fa", "score": "0.5599269", "text": "func (v *Switch) ReadFrom(r io.Reader) (n int64, err error) {\n\tvar b [1]byte\n\tn, err = readFrom(r, b[:])\n\t*v = b[0] != 0\n\treturn\n}", "title": "" }, { "docid": "e888b51c9a1a7f7c6c9745e71df102e4", "score": "0.559801", "text": "func (self *GraphiteMetric) Read(reader *bufio.Reader) error {\n\tbuf, err := reader.ReadBytes('\\n')\n\tstr := strings.TrimSpace(string(buf))\n\tif err != nil {\n\t\tif err != io.EOF {\n\t\t\treturn fmt.Errorf(\"connection closed uncleanly/broken: %s\\n\", err.Error())\n\t\t}\n\t\tif str == \"\" {\n\t\t\treturn err\n\t\t}\n\t\t// else we got EOF but also data, so just try to process it as valid data\n\t}\n\telements := strings.Fields(str)\n\tif len(elements) != 3 {\n\t\treturn fmt.Errorf(\"Received '%s' which doesn't have three fields\", str)\n\t}\n\tself.name = elements[0]\n\tself.floatValue, err = strconv.ParseFloat(elements[1], 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif i := int64(self.floatValue); float64(i) == self.floatValue {\n\t\tself.isInt = true\n\t\tself.integerValue = int64(self.floatValue)\n\t}\n\ttimestamp, err := strconv.ParseUint(elements[2], 10, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\tself.timestamp = int64(timestamp * 1000000)\n\treturn nil\n}", "title": "" }, { "docid": "b0dccd83805981a5dadacb8cc056622a", "score": "0.5596466", "text": "func (h ReadingHolder) Get() Reading {\n\treturn <-h.getValCh\n}", "title": "" }, { "docid": "d3320c62ecaab564307ff1f2db6af8a6", "score": "0.5595232", "text": "func Input(reader *bufio.Reader, question string) (typedValue string) {\n\tfmt.Printf(\"%s\", question)\n\ttypedValue, _ = reader.ReadString('\\n')\n\ttypedValue = strings.TrimSpace(typedValue)\n\treturn\n}", "title": "" }, { "docid": "2008826be27fff3d0b04248f915b722e", "score": "0.5586825", "text": "func (s *HumiditySensor) Read() (float64, error) {\n\n\tfmt.Sprintf(\"Reading humidity sensor\")\n\n\terr := s.Enable()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\toptions := make(map[string]dbus.Variant)\n\tb, err := s.data.ReadValue(options)\n\n\tfmt.Sprintf(\"Read data: %v\", b)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t//die := binary.LittleEndian.Uint16(b[0:2])\n\tamb := binary.LittleEndian.Uint16(b[2:])\n\n\t//dieValue := calcTmpTarget(uint16(die))\n\tambientValue := calcTmpLocal(uint16(amb))\n\n\treturn ambientValue, err\n}", "title": "" }, { "docid": "02e43ac62633f030b3effddebd953801", "score": "0.55655575", "text": "func (s *BarometricSensor) Read() (float64, error) {\n\n\tfmt.Sprintf(\"Reading BarometricSensor sensor\")\n\n\terr := s.Enable()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\toptions := make(map[string]dbus.Variant)\n\tb, err := s.data.ReadValue(options)\n\n\tfmt.Sprintf(\"Read data: %v\", b)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t//die := binary.LittleEndian.Uint16(b[0:2])\n\tamb := binary.LittleEndian.Uint16(b[2:])\n\n\t//dieValue := calcTmpTarget(uint16(die))\n\tambientValue := calcTmpLocal(uint16(amb))\n\n\treturn ambientValue, err\n}", "title": "" }, { "docid": "9742e77a361e0e6b7da49faeb3676d00", "score": "0.55462825", "text": "func (n Noop) Read([]byte) (int, error) { return 0, nil }", "title": "" }, { "docid": "1ebbae5db84bf2b916386c83f7fc7236", "score": "0.55386835", "text": "func (p *PAM) readStream(echo bool) (string, error) {\n\t// Limit the reader in case stdin is from /dev/zero or other infinite\n\t// source.\n\treader := bufio.NewReader(io.LimitReader(p.stdin, int64(C.PAM_MAX_RESP_SIZE)-1))\n\ttext, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\treturn text, nil\n}", "title": "" }, { "docid": "604c2f188e4c61b9a6269cb5ad607a93", "score": "0.55344737", "text": "func (v *Power) ReadFrom(r io.Reader) (n int64, err error) {\n\tvar b [2]byte\n\tn, err = readFrom(r, b[:])\n\t*v = Power(b[0])<<8 + Power(b[1])\n\treturn\n}", "title": "" }, { "docid": "7f5ce1bea3d61b4210284ed8b86220a5", "score": "0.55197376", "text": "func GetValue(line int) string {\n\tvalueString, _ := shell(\"cat /sys/class/gpio/gpio\" + strconv.Itoa(line) + \"/value\")\n\tswitch valueString {\n\tcase \"0\":\n\t\treturn Values.Low\n\t\tbreak\n\tcase \"1\":\n\t\treturn Values.High\n\t\tbreak\n\tdefault:\n\t\tlog.Fatal(\"Unexpected value for GPIO read: \" + valueString)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "27ea775e728e6c8de307858fc45d2b86", "score": "0.5517998", "text": "func (r *Runtime) Read() error {\n\tb := make([]byte, 1)\n\t_, err := r.inStream.Read(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.cells[r.index] = b[0]\n\n\treturn nil\n}", "title": "" }, { "docid": "9e038e0868768b55ecf24eeccea43c3f", "score": "0.5515248", "text": "func (d *Driver) Read(key string, v interface{}) error {\n\n\tif key == \"\" {\n\t\treturn ErrMissingKey\n\t}\n\n\treturn d.readFile(key, v)\n}", "title": "" }, { "docid": "0e4ffe6bf2142ddf44ced4b225ce98a0", "score": "0.5508297", "text": "func (r *lockedSource) read(p []byte, readVal *int64, readPos *int8) (n int, err error) {\n r.lk.Lock()\n n, err = read(p, r.src.Int63, readVal, readPos)\n r.lk.Unlock()\n return\n}", "title": "" }, { "docid": "3284c475c228a8c13e398b2b0cac2a0f", "score": "0.5507084", "text": "func (s *LuxometerSensor) Read() (float64, error) {\n\n\tfmt.Sprintf(\"Reading LuxometerSensor sensor\")\n\n\terr := s.Enable()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\toptions := make(map[string]dbus.Variant)\n\tb, err := s.data.ReadValue(options)\n\n\tfmt.Sprintf(\"Read data: %v\", b)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t//die := binary.LittleEndian.Uint16(b[0:2])\n\tamb := binary.LittleEndian.Uint16(b[2:])\n\n\t//dieValue := calcTmpTarget(uint16(die))\n\tambientValue := calcTmpLocal(uint16(amb))\n\n\treturn ambientValue, err\n}", "title": "" }, { "docid": "e4af177f5e1579b7e5cfbfb72ea83864", "score": "0.5503012", "text": "func (l *LimitedStrictReadCloser) Read(p []byte) (n int, err error) {\n\tif l.Err != nil {\n\t\treturn 0, l.Err\n\t}\n\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif int64(len(p)) > l.N+1 {\n\t\tp = p[:l.N+1]\n\t}\n\n\tn, err = l.R.Read(p)\n\n\tif int64(n) <= l.N {\n\t\tl.N -= int64(n)\n\t\tl.Err = err\n\t\treturn n, err\n\t}\n\n\tn = int(l.N)\n\tl.N = 0\n\n\tl.Err = errors.New(\"input stream too large\")\n\treturn n, l.Err\n}", "title": "" }, { "docid": "02e2c2c7f03740fdd13547d406da6b32", "score": "0.5482181", "text": "func Read(in []byte) (int, error) {\n\treturn rand.Read(in)\n}", "title": "" }, { "docid": "5ead651853011c2495caf810f871b387", "score": "0.5481114", "text": "func (r *passThruReader) Read(p []byte) (int, error) {\n\tn, err := r.Reader.Read(p)\n\n\tif n > 0 {\n\t\tr.bar.Add(n)\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "402d089d65529f205881cbae70ea8ea2", "score": "0.54781467", "text": "func (gc *GattCharacteristic) ReadValue(ctx context.Context, offset uint16) ([]byte, error) {\n\t// gatt /org/bluez/hci0/dev_D1_40_FD_DE_C6_1C/service0026/char0035\n\t// command gatt returned error [Method \"ReadValue\" with signature \"a{sv}\" on interface \"(null)\" doesn't exist\n\t// ]\n\t// zogctl> gatt /org/bluez/hci0/dev_D1_40_FD_DE_C6_1C/service0026/char0031\n\t// command gatt returned error [Method \"ReadValue\" with signature \"a{sv}\" on interface \"(null)\" doesn't exist\n\t// ]\n\n\targs := map[string]interface{}{\n\t\t\"offset\": offset,\n\t}\n\t// This works for the ALP's sensor (SNM00). Hard to add this as a CLI, so hardcoding it for now,\n\t// but is one of the last things that should be hardcoded.\n\tval := make([]byte, 4)\n\terr := gc.bluez.ops.CallFunctionWithArgs(ctx, val, BluezDest, gc.Path,\n\t\tBluezGATTCharacteristic.ReadValue, args)\n\n\treturn val, err\n}", "title": "" }, { "docid": "8fa0701d733cd555844b130d5f61e1e7", "score": "0.54696715", "text": "func readInput(inStream *os.File) (int, int) {\n\n\tif inStream == nil {\n\t\tinStream = os.Stdin\n\t}\n\tvar low int\n\tvar high int\n\tfmt.Print(\"Enter a lower bound: \")\n\tfmt.Fscanf(inStream, \"%d\", &low)\n\tfmt.Print(\"Enter an upper bound: \")\n\tfmt.Fscanf(inStream, \"%d\", &high)\n\t//fmt.Println(low, high)\n\treturn low, high\n\n}", "title": "" }, { "docid": "50d44893c9aa746ab20cd3967d84c053", "score": "0.54694104", "text": "func (this *DefaultInputBitStream) Read() uint64 {\n\treturn this.read + uint64(this.position)<<3 - uint64(this.availBits)\n}", "title": "" }, { "docid": "3b9e556c6b0a808f4073a482e579e19b", "score": "0.54654837", "text": "func (r *Reader) ReadNumber() (float64, error) {\n\tif err := r.Expect(Number); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn strconv.ParseFloat(string(r.Buf[r.Start:r.End]), 64)\n}", "title": "" }, { "docid": "f428c5b945db7d65580fdf8c67d31782", "score": "0.54619664", "text": "func (s *SecureReader) Read(p []byte) (n int, err error) {\n\t// make sure there is only one goroutine reading\n\t// from the datastream at a time\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tvar nonce [24]byte\n\tbinary.Read(s.reader, binary.LittleEndian, &nonce)\n\n\tvar length int16\n\tbinary.Read(s.reader, binary.LittleEndian, &length)\n\n\treader := io.LimitReader(s.reader, int64(length))\n\tdata, err := ioutil.ReadAll(reader)\n\n\tresult, success := box.Open([]byte{}, data, &nonce, s.pub, s.priv)\n\tif !success {\n\t\treturn 0, errors.New(\"Unable to decode incoming message\")\n\t}\n\n\tcopy(p, result[:])\n\tn = len(result[:])\n\treturn\n}", "title": "" }, { "docid": "35d8356aa173c6d79714862c7f1fdb1e", "score": "0.54593927", "text": "func (trc *meteredReadCloser) Read(p []byte) (n int, err error) {\n\treturn trc.meter.measure(trc.ReadCloser.Read, p)\n}", "title": "" }, { "docid": "04dedd2b3bbaf41999d8bd80b9a7cc7d", "score": "0.5458443", "text": "func (productionDependencies) randRead(b []byte) (int, error) {\n\treturn fastrand.Reader.Read(b)\n}", "title": "" }, { "docid": "aa73c6f4119a2614bccbea985311755b", "score": "0.54530764", "text": "func (s *TemperatureSensor) Read() (float64, error) {\n\n\tfmt.Sprintf(\"Reading temperature sensor\")\n\n\terr := s.Enable()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\toptions := make(map[string]dbus.Variant)\n\tb, err := s.data.ReadValue(options)\n\n\tfmt.Sprintf(\"Read data: %v\", b)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t//die := binary.LittleEndian.Uint16(b[0:2])\n\tamb := binary.LittleEndian.Uint16(b[2:])\n\n\t//dieValue := calcTmpTarget(uint16(die))\n\tambientValue := calcTmpLocal(uint16(amb))\n\n\treturn ambientValue, err\n}", "title": "" }, { "docid": "3b4ea8285d83b24e824dddd0a7a94fb9", "score": "0.54403174", "text": "func (tr *meteredReader) Read(p []byte) (int, error) {\n\treturn tr.measure(tr.Reader.Read, p)\n}", "title": "" }, { "docid": "52a55a54c3622fc8d4d10aca87e0d96c", "score": "0.54281694", "text": "func (pt *passThru) Read(p []byte) (int, error) {\n\tn, err := pt.Reader.Read(p)\n\tatomic.AddInt64(&pt.progress, int64(n))\n\treturn n, err\n}", "title": "" }, { "docid": "b8621e28b93dad80cd785d04282ff19a", "score": "0.5419974", "text": "func Read(b []byte) (n int, err error) {}", "title": "" }, { "docid": "2b4f063b1aa87e6f03f4317940b3856f", "score": "0.54164624", "text": "func (fr *FieldReader) ReadInt() (int, error) {\n\ts, err := fr.Read()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\ti, err := strconv.ParseInt(s, 10, 0)\n\treturn int(i), err\n}", "title": "" }, { "docid": "b2992f593ee1506fd260865c10352c77", "score": "0.54080236", "text": "func (reader *MaskstreamReader) Read(bytes int) (value uint64) {\n\tif bytes > 8 {\n\t\tpanic(\"Limit of byte count: 8\")\n\t}\n\tif bytes < 0 {\n\t\tpanic(\"Minimum byte count: 0\")\n\t}\n\n\tfor i := 0; i < bytes; i++ {\n\t\tvalue |= (reader.nextByte() << uint64(8*i))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "59b14e38d847bc7747d398411f9241d2", "score": "0.540123", "text": "func (r *Reader) ReadInt() (int, error) {\n\tv, err := r.ReadInt64()\n\treturn int(v), err\n}", "title": "" }, { "docid": "7bd43d616fce9134bd1fcefb3a70a721", "score": "0.53944135", "text": "func (i *ringFIO) Read(b []byte) (int, error) {\n\tid, ready, err := i.PrepareRead(b, 0)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tready()\n\tn, err := i.getCqe(id, 1, 1)\n\truntime.KeepAlive(b)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif n == 0 {\n\t\treturn n, io.EOF\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "baca7527284e4beca6ecee37aff21957", "score": "0.53806204", "text": "func (rc *readCloser) Read(p []byte) (n int, err error) {\n\treturn rc.in.Read(p)\n}", "title": "" }, { "docid": "904eaf1e189d9527c4bc9fd9e31ed8c4", "score": "0.5362227", "text": "func (r *reader) Read(p []byte) (int, error) {\n\tn, err := r.r.Read(p)\n\tif uint64(n) > r.n {\n\t\treturn 0, fmt.Errorf(\"reading more than expected\")\n\t}\n\tr.n -= uint64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "e6472eb48ea2297cd2a39da6c8fc6960", "score": "0.5360822", "text": "func (jbobject *JavaIoReader) Read2() (int, error) {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"read\", javabind.Int)\n\tif err != nil {\n\t\tvar zero int\n\t\treturn zero, err\n\t}\n\treturn jret.(int), nil\n}", "title": "" }, { "docid": "0e0e84b88164c8001f6a1b4b2866e81a", "score": "0.5357363", "text": "func (s *MpuSensor) Read() (float64, error) {\n\n\tfmt.Sprintf(\"Reading mpu sensor\")\n\n\terr := s.Enable()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\toptions := make(map[string]dbus.Variant)\n\tb, err := s.data.ReadValue(options)\n\n\tfmt.Sprintf(\"Read data: %v\", b)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t//die := binary.LittleEndian.Uint16(b[0:2])\n\tamb := binary.LittleEndian.Uint16(b[2:])\n\n\t//dieValue := calcTmpTarget(uint16(die))\n\tambientValue := calcTmpLocal(uint16(amb))\n\n\treturn ambientValue, err\n}", "title": "" }, { "docid": "404e7e088ce91ed7dcaf5a1474036c2e", "score": "0.5355618", "text": "func (serde ORecordSerializerV0) readDataValue(dbc *DBClient, buf *bytes.Buffer, datatype byte) (interface{}, error) {\n\tvar (\n\t\tval interface{}\n\t\terr error\n\t)\n\t// TODO: many cases unimplemented\n\tswitch datatype {\n\tcase oschema.BOOLEAN:\n\t\tval, err = rw.ReadBool(buf)\n\t\togl.Debugf(\"DEBUG BOOL: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.INTEGER:\n\t\tval, err = varint.ReadVarIntAndDecode32(buf)\n\t\togl.Debugf(\"DEBUG INT: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.SHORT:\n\t\tval, err = rw.ReadShort(buf)\n\t\togl.Debugf(\"DEBUG SHORT: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.LONG:\n\t\tval, err = varint.ReadVarIntAndDecode64(buf)\n\t\togl.Debugf(\"DEBUG LONG: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.FLOAT:\n\t\tval, err = rw.ReadFloat(buf)\n\t\togl.Debugf(\"DEBUG FLOAT: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.DOUBLE:\n\t\tval, err = rw.ReadDouble(buf)\n\t\togl.Debugf(\"DEBUG DOUBLE: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.DATETIME:\n\t\t// OrientDB DATETIME is precise to the second\n\t\tval, err = serde.readDateTime(buf)\n\t\togl.Debugf(\"DEBUG DATEIME: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.DATE:\n\t\t// OrientDB DATE is precise to the day\n\t\tval, err = serde.readDate(buf)\n\t\togl.Debugf(\"DEBUG DATE: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.STRING:\n\t\tval, err = varint.ReadString(buf)\n\t\togl.Debugf(\"DEBUG STR: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.BINARY:\n\t\tval, err = varint.ReadBytes(buf)\n\t\togl.Debugf(\"DEBUG BINARY: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.EMBEDDEDRECORD:\n\t\tdoc := oschema.NewDocument(\"\")\n\t\terr = serde.Deserialize(dbc, doc, buf)\n\t\tval = interface{}(doc)\n\t\t// ogl.Debugf(\"DEBUG EMBEDDEDREC: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.EMBEDDEDLIST:\n\t\tval, err = serde.readEmbeddedCollection(dbc, buf)\n\t\t// ogl.Debugf(\"DEBUG EMBD-LIST: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.EMBEDDEDSET:\n\t\tval, err = serde.readEmbeddedCollection(dbc, buf) // TODO: may need to create a set type as well\n\t\t// ogl.Debugf(\"DEBUG EMBD-SET: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.EMBEDDEDMAP:\n\t\tval, err = serde.readEmbeddedMap(dbc, buf)\n\t\t// ogl.Debugf(\"DEBUG EMBD-MAP: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.LINK:\n\t\t// a link is two int64's (cluster:record) - we translate it here to a string RID\n\t\tval, err = serde.readLink(buf)\n\t\togl.Debugf(\"DEBUG LINK: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.LINKLIST, oschema.LINKSET:\n\t\tval, err = serde.readLinkList(buf)\n\t\togl.Debugf(\"DEBUG LINK LIST/SET: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.LINKMAP:\n\t\tval, err = serde.readLinkMap(buf)\n\t\togl.Debugf(\"DEBUG LINKMap: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.BYTE:\n\t\tval, err = rw.ReadByte(buf)\n\t\togl.Debugf(\"DEBUG BYTE: +readDataVal val: %v\\n\", val) // DEBUG\n\tcase oschema.CUSTOM:\n\t\t// TODO: impl me -> how? when is this used?\n\t\tpanic(\"ORecordSerializerV0#readDataValue CUSTOM NOT YET IMPLEMENTED\")\n\tcase oschema.DECIMAL:\n\t\t// TODO: impl me -> Java client uses BigDecimal for this\n\t\tpanic(\"ORecordSerializerV0#readDataValue DECIMAL NOT YET IMPLEMENTED\")\n\tcase oschema.LINKBAG:\n\t\tval, err = serde.readLinkBag(buf)\n\t\togl.Debugf(\"DEBUG LINKBAG: +readDataVal val: %v\\n\", val) // DEBUG\n\tdefault:\n\t\t// ANY and TRANSIENT are do nothing ops\n\t}\n\n\treturn val, err\n}", "title": "" }, { "docid": "214b36955d1639df6dae138c0907a8ea", "score": "0.53427595", "text": "func (cr *cryptoReader) Read(b []byte) (n int, err error) {\n\treturn rand.Read(b)\n}", "title": "" }, { "docid": "5a564f6f57ab5e461bc917d0b9ac8cbc", "score": "0.5327779", "text": "func (rb *RegretableReader) Read(p []byte) (n int, err error) {\n\tif rb.overflow {\n\t\treturn rb.reader.Read(p)\n\t}\n\tif rb.r < rb.w {\n\t\tn = copy(p, rb.buf[rb.r:rb.w])\n\t\trb.r += n\n\t\treturn\n\t}\n\tn, err = rb.reader.Read(p)\n\tbn := copy(rb.buf[rb.w:], p[:n])\n\trb.w, rb.r = rb.w+bn, rb.w+n\n\tif bn < n {\n\t\trb.overflow = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "fcd2fa5f9b2c597906cb026edd8581cd", "score": "0.5319166", "text": "func getVal(prompt string, value interface{}, r *bufio.Reader, w io.Writer) (string, error) {\n\tdef := fmt.Sprintf(\"%v\", value)\n\tif value == nil || def == \"\" || def == \"[]\" {\n\t\tfmt.Fprintf(w, \"%s: \", prompt)\n\t} else {\n\t\tfmt.Fprintf(w, \"%s (%s): \", prompt, def)\n\t}\n\tval, err := r.ReadString('\\n')\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(strings.Replace(val, string('\\n'), \"\", -1)), nil\n}", "title": "" }, { "docid": "dc09f659dbcf3253cc8bfeb6a1aced5a", "score": "0.53187245", "text": "func ExampleValue_AsReader_specifiedAsHex() {\n\t// Setup the environment such that the EXAMPLE variable contains the\n\t// configuration value as a hexadecimal string, and the EXAMPLE__DATASOURCE\n\t// specifies the source type as \"string:hex\".\n\t//\n\t// Outside of an example these environment variables would be set in the\n\t// operating system shell, and the path would refer to a real configuration\n\t// file.\n\tos.Setenv(\"EXAMPLE\", hex.EncodeToString([]byte(\"<the configuration value>\")))\n\tos.Setenv(\"EXAMPLE__DATASOURCE\", \"string:hex\")\n\n\t// Get the configuration value from the Environment bucket.\n\tvalue := config.Environment().Get(\"EXAMPLE\")\n\n\t// Consume the value as an io.ReadCloser.\n\tr, err := value.AsReader()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer r.Close()\n\n\t// Read the entire value into a buffer.\n\tbuf, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Print the buffer.\n\tfmt.Println(string(buf))\n\n\t// Output: <the configuration value>\n}", "title": "" }, { "docid": "7f02c53f632cc0073e1ad11275f6292c", "score": "0.5318527", "text": "func (p *port) Read(b []byte) (n int, err error) {\n\tvar done uint32\n\tif err = syscall.ReadFile(p.handle, b, &done, nil); err != nil {\n\t\treturn\n\t}\n\tif done == 0 {\n\t\terr = ErrTimeout\n\t\treturn\n\t}\n\tn = int(done)\n\treturn\n}", "title": "" }, { "docid": "61bae3299de79d93b6cd4c752520779e", "score": "0.5309248", "text": "func (r RefSpec) Value(c *Client) (string, error) {\n\tf := r.File(c)\n\tval, err := f.ReadAll()\n\treturn strings.TrimSpace(val), err\n}", "title": "" }, { "docid": "4aaada87e69b46ea60851585ddd4d2b5", "score": "0.52982223", "text": "func (m *Reader) ReadInt() (int, error) {\n\tif smallint {\n\t\tin, err := m.ReadInt32()\n\t\treturn int(in), err\n\t}\n\tin, err := m.ReadInt64()\n\treturn int(in), err\n}", "title": "" }, { "docid": "2c51f66358ed333eb79f854fc6cb5e51", "score": "0.5294689", "text": "func (c *MockInputOutputHandler) ReadInt() (i int, e error) {\n\t// TODO: provide a method for pre-loading ReadInt with a series of int/error returns\n\treturn -1, nil\n}", "title": "" }, { "docid": "8eeb30b40c601a07333ea7eb099f4538", "score": "0.5291086", "text": "func (s *HumiditySensor) Read() (float64, error) {\n\terr := s.Enable()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\toptions := make(map[string]interface{})\n\tb, err := s.data.ReadValue(options)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\thumid := binary.LittleEndian.Uint16(b[2:])\n\thumidValue := calcHumidLocal(uint16(humid))\n\n\treturn humidValue, err\n}", "title": "" }, { "docid": "790d1bedaff5a435da02abf41845ecdf", "score": "0.52831644", "text": "func (n *NumberReader) Read(stateNode *snreader.StateNode, input snreader.InputItf) (isEnd bool, err error) {\n\tchar := read(input)\n\tcharStr := string([]rune{char})\n\tn.Result.Value += charStr\n\treturn false, nil\n}", "title": "" }, { "docid": "cfba02dc6f212e88bfc9cec9ce78ed79", "score": "0.52802753", "text": "func ValueReader(r io.Reader) ScopeOption {\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlogger.WithField(\"Argument\", \"ValueReader\").Error(err)\n\t}\n\treturn func(a *arg) {\n\t\ta.v = data\n\t}\n}", "title": "" }, { "docid": "843fdef8c3d70e8555b7fa949348d378", "score": "0.52716595", "text": "func (v *Voltage) ReadFrom(r io.Reader) (n int64, err error) {\n\tvar b [2]byte\n\tn, err = readFrom(r, b[:])\n\td := int16(b[0])<<8 + int16(b[1])\n\t*v = Voltage(d) / 100\n\treturn\n}", "title": "" }, { "docid": "8050af4397705b8515f2222be27646df", "score": "0.526766", "text": "func getRawValue(input []byte) (string, int) {\n\tstart := SkipSpace(input)\n\tend := start + skipUntilValueEnd(input[start:])\n\tval := string(input[start:end])\n\tval = strings.TrimRightFunc(val, unicode.IsSpace)\n\n\tidx := end + skipRest(input[end:])\n\treturn val, idx\n}", "title": "" }, { "docid": "34e1ea9428b4a518cca33aa40ad672c3", "score": "0.5266747", "text": "func (reader *TypedStreamReader) Read() Typed {\n\treturn <-reader.outChannel\n}", "title": "" }, { "docid": "2a88b815b9de1c8f715ddc174cc4bf82", "score": "0.52666664", "text": "func ReadInt() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "2a88b815b9de1c8f715ddc174cc4bf82", "score": "0.52666664", "text": "func ReadInt() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "2a88b815b9de1c8f715ddc174cc4bf82", "score": "0.52666664", "text": "func ReadInt() int {\n\treturn int(readInt64())\n}", "title": "" }, { "docid": "3e1585157e9b352b8a9ade0045bcb454", "score": "0.52651244", "text": "func (st *Settings) Read(d []byte) { // TODO: return error?\n\tvar b []byte\n\tvar key uint16\n\tvar value uint32\n\tlast, i, len := 0, 6, len(d)\n\tfor i <= len {\n\t\tb = d[last:i]\n\t\tkey = uint16(b[0])<<8 | uint16(b[1])\n\t\tvalue = uint32(b[2])<<24 | uint32(b[3])<<16 | uint32(b[4])<<8 | uint32(b[5])\n\n\t\tswitch key {\n\t\tcase HeaderTableSize:\n\t\t\tst.tableSize = value\n\t\tcase EnablePush:\n\t\t\tst.enablePush = (value != 0)\n\t\tcase MaxConcurrentStreams:\n\t\t\tst.maxStreams = value\n\t\tcase MaxWindowSize:\n\t\t\tst.windowSize = value\n\t\tcase MaxFrameSize:\n\t\t\tst.frameSize = value\n\t\tcase MaxHeaderListSize:\n\t\t\tst.headerSize = value\n\t\t}\n\t\tlast = i\n\t\ti += 6\n\t}\n}", "title": "" }, { "docid": "8eca94528eb1c1ac172d9ccd42f38fd6", "score": "0.526433", "text": "func (jbobject *JavaIoReader) Read(a JavaNioCharBufferInterface) (int, error) {\n\tconv_a := javabind.NewGoToJavaCallable()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"read\", javabind.Int, conv_a.Value().Cast(\"java/nio/CharBuffer\"))\n\tif err != nil {\n\t\tvar zero int\n\t\treturn zero, err\n\t}\n\tconv_a.CleanUp()\n\treturn jret.(int), nil\n}", "title": "" }, { "docid": "aa36e0cdde178d0747ce672d2079fc49", "score": "0.5263087", "text": "func (r *RBC) InputValue(data []byte) ([]*BroadcastMessage, error) {\n\tt := rbcInputTuple{\n\t\tvalue: data,\n\t\tresponse: make(chan rbcInputResponse),\n\t}\n\tr.inputCh <- t\n\tresp := <-t.response\n\treturn resp.messages, resp.err\n}", "title": "" } ]
24290493e43ea7d70a7cf52ec121eb08
SetNillableMemberID sets the Member edge to Member by id if the given value is not nil.
[ { "docid": "73bc4e4dfb6e02403924d6f4c097333e", "score": "0.8367281", "text": "func (iu *InsuranceUpdate) SetNillableMemberID(id *int) *InsuranceUpdate {\n\tif id != nil {\n\t\tiu = iu.SetMemberID(*id)\n\t}\n\treturn iu\n}", "title": "" } ]
[ { "docid": "a49af64631980d517c9211dbac93a7b6", "score": "0.84625435", "text": "func (iuo *InquiryUpdateOne) SetNillableMemberID(id *int) *InquiryUpdateOne {\n\tif id != nil {\n\t\tiuo = iuo.SetMemberID(*id)\n\t}\n\treturn iuo\n}", "title": "" }, { "docid": "87399717fc930e59b27ec392efa0a216", "score": "0.84524053", "text": "func (iu *InquiryUpdate) SetNillableMemberID(id *int) *InquiryUpdate {\n\tif id != nil {\n\t\tiu = iu.SetMemberID(*id)\n\t}\n\treturn iu\n}", "title": "" }, { "docid": "bddc0a30f7de2645c602c48b84942288", "score": "0.8387601", "text": "func (iuo *InsuranceUpdateOne) SetNillableMemberID(id *int) *InsuranceUpdateOne {\n\tif id != nil {\n\t\tiuo = iuo.SetMemberID(*id)\n\t}\n\treturn iuo\n}", "title": "" }, { "docid": "7f07867cb65542aa45c668a356830338", "score": "0.8381385", "text": "func (pu *PaymentUpdate) SetNillableMemberID(id *int) *PaymentUpdate {\n\tif id != nil {\n\t\tpu = pu.SetMemberID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "bf2df88eba3b462f21574be9caed8de4", "score": "0.83125335", "text": "func (puo *PaymentUpdateOne) SetNillableMemberID(id *int) *PaymentUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetMemberID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "4ac90521c72c5fbf9b69b40ac841f7e7", "score": "0.82280916", "text": "func (euo *EquipmentrentalUpdateOne) SetNillableMemberID(id *int) *EquipmentrentalUpdateOne {\n\tif id != nil {\n\t\teuo = euo.SetMemberID(*id)\n\t}\n\treturn euo\n}", "title": "" }, { "docid": "61ed74f96a2bcd40ebe63a2885ca799b", "score": "0.8107808", "text": "func (eu *EquipmentrentalUpdate) SetNillableMemberID(id *int) *EquipmentrentalUpdate {\n\tif id != nil {\n\t\teu = eu.SetMemberID(*id)\n\t}\n\treturn eu\n}", "title": "" }, { "docid": "e5c98bd76cd10518777cf65a035db5cb", "score": "0.7058587", "text": "func (guo *GaugeUpdateOne) SetNillableMetricID(id *int) *GaugeUpdateOne {\n\tif id != nil {\n\t\tguo = guo.SetMetricID(*id)\n\t}\n\treturn guo\n}", "title": "" }, { "docid": "2be85ad42e14a42499d8d92a5527f28f", "score": "0.701397", "text": "func (gu *GaugeUpdate) SetNillableMetricID(id *int) *GaugeUpdate {\n\tif id != nil {\n\t\tgu = gu.SetMetricID(*id)\n\t}\n\treturn gu\n}", "title": "" }, { "docid": "b56be3112910b2f5ab907241527f303b", "score": "0.69413656", "text": "func (fuo *FileUpdateOne) SetNillableFieldID(i *int) *FileUpdateOne {\n\tif i != nil {\n\t\tfuo.SetFieldID(*i)\n\t}\n\treturn fuo\n}", "title": "" }, { "docid": "5ab029f634d2c1719638c6000b1fedcb", "score": "0.6842624", "text": "func (fu *FileUpdate) SetNillableFieldID(i *int) *FileUpdate {\n\tif i != nil {\n\t\tfu.SetFieldID(*i)\n\t}\n\treturn fu\n}", "title": "" }, { "docid": "f41405e13844ff854805acbfdcc19c62", "score": "0.6791795", "text": "func (fpu *FloorPlanUpdate) SetNillableReferencePointID(id *string) *FloorPlanUpdate {\n\tif id != nil {\n\t\tfpu = fpu.SetReferencePointID(*id)\n\t}\n\treturn fpu\n}", "title": "" }, { "docid": "2f97e3de3429212a69c934bb8ff867a4", "score": "0.67878735", "text": "func (mc *MusicCreate) SetNillableClubID(id *int) *MusicCreate {\n\tif id != nil {\n\t\tmc = mc.SetClubID(*id)\n\t}\n\treturn mc\n}", "title": "" }, { "docid": "fd00c1bc9c61a69e3bfde01e8cffd7ef", "score": "0.6781396", "text": "func (euo *EventUpdateOne) SetNillableCampaignID(id *int) *EventUpdateOne {\n\tif id != nil {\n\t\teuo = euo.SetCampaignID(*id)\n\t}\n\treturn euo\n}", "title": "" }, { "docid": "edbd6b37e3c6954321d732e5f29cfca0", "score": "0.6714872", "text": "func (cu *ConsumerUpdate) SetNillableBillerID(s *string) *ConsumerUpdate {\n\tif s != nil {\n\t\tcu.SetBillerID(*s)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "e4c569bb40d4a6f50a17a0cde334fceb", "score": "0.6692761", "text": "func (cuo *ConsumerUpdateOne) SetNillableBillerID(s *string) *ConsumerUpdateOne {\n\tif s != nil {\n\t\tcuo.SetBillerID(*s)\n\t}\n\treturn cuo\n}", "title": "" }, { "docid": "381b4ef6bde03b72db2761a7823b365c", "score": "0.6673317", "text": "func (fpuo *FloorPlanUpdateOne) SetNillableReferencePointID(id *string) *FloorPlanUpdateOne {\n\tif id != nil {\n\t\tfpuo = fpuo.SetReferencePointID(*id)\n\t}\n\treturn fpuo\n}", "title": "" }, { "docid": "9e2516be66fab34aee0e97a8bdfee701", "score": "0.66511095", "text": "func (eu *EventUpdate) SetNillableCampaignID(id *int) *EventUpdate {\n\tif id != nil {\n\t\teu = eu.SetCampaignID(*id)\n\t}\n\treturn eu\n}", "title": "" }, { "docid": "cfd095e0f1b950d4080226a0b2d618de", "score": "0.6643968", "text": "func (vruo *VarRefUpdateOne) SetNillableInstanceID(id *uuid.UUID) *VarRefUpdateOne {\n\tif id != nil {\n\t\tvruo = vruo.SetInstanceID(*id)\n\t}\n\treturn vruo\n}", "title": "" }, { "docid": "b884f9b1380b7406e9492c241d66fe21", "score": "0.65804756", "text": "func (su *SystemequipmentUpdate) SetNillablePhysicianID(id *int) *SystemequipmentUpdate {\n\tif id != nil {\n\t\tsu = su.SetPhysicianID(*id)\n\t}\n\treturn su\n}", "title": "" }, { "docid": "f1f7c3634b6cc47474247710c957b7e9", "score": "0.6555485", "text": "func (pu *PropertyUpdate) SetNillableLinkID(id *string) *PropertyUpdate {\n\tif id != nil {\n\t\tpu = pu.SetLinkID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "92a8595860e5b6e00cda463891b4bc08", "score": "0.65310025", "text": "func (vru *VarRefUpdate) SetNillableInstanceID(id *uuid.UUID) *VarRefUpdate {\n\tif id != nil {\n\t\tvru = vru.SetInstanceID(*id)\n\t}\n\treturn vru\n}", "title": "" }, { "docid": "092bff2647a964046845eee7356ec88b", "score": "0.65281534", "text": "func (su *SystemequipmentUpdate) SetNillableMedicalequipmentID(id *int) *SystemequipmentUpdate {\n\tif id != nil {\n\t\tsu = su.SetMedicalequipmentID(*id)\n\t}\n\treturn su\n}", "title": "" }, { "docid": "246511fc939f6fb106f3f9b5aaacdd6e", "score": "0.6475424", "text": "func (suo *SystemequipmentUpdateOne) SetNillableMedicalequipmentID(id *int) *SystemequipmentUpdateOne {\n\tif id != nil {\n\t\tsuo = suo.SetMedicalequipmentID(*id)\n\t}\n\treturn suo\n}", "title": "" }, { "docid": "02304a7f1487347907b6cab394842718", "score": "0.6468262", "text": "func (suo *SystemequipmentUpdateOne) SetNillablePhysicianID(id *int) *SystemequipmentUpdateOne {\n\tif id != nil {\n\t\tsuo = suo.SetPhysicianID(*id)\n\t}\n\treturn suo\n}", "title": "" }, { "docid": "5c0f697c6e7378269ed704b52efb80aa", "score": "0.64492065", "text": "func (puo *PropertyUpdateOne) SetNillableLinkID(id *string) *PropertyUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetLinkID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "ceed575ced5d4cec207b4984897ab83f", "score": "0.6447188", "text": "func (pu *PaymentUpdate) SetNillablePromotionID(id *int) *PaymentUpdate {\n\tif id != nil {\n\t\tpu = pu.SetPromotionID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "3494973357392602eac3986cb1bbdc1a", "score": "0.643363", "text": "func (puo *PaymentUpdateOne) SetNillablePromotionID(id *int) *PaymentUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetPromotionID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "805b7c4a388e7b5a8043c34efcb2bd89", "score": "0.6409199", "text": "func (fpuo *FloorPlanUpdateOne) SetNillableLocationID(id *string) *FloorPlanUpdateOne {\n\tif id != nil {\n\t\tfpuo = fpuo.SetLocationID(*id)\n\t}\n\treturn fpuo\n}", "title": "" }, { "docid": "c263105243fe6e151e976fb3b4826001", "score": "0.64078957", "text": "func (suo *SubjectUpdateOne) SetNillableProfessorIDID(id *int) *SubjectUpdateOne {\n\tif id != nil {\n\t\tsuo = suo.SetProfessorIDID(*id)\n\t}\n\treturn suo\n}", "title": "" }, { "docid": "b3028f4d21f350a232f93a328c13c6fe", "score": "0.6405863", "text": "func (pu *PositionassingmentUpdate) SetNillablePositionID(id *int) *PositionassingmentUpdate {\n\tif id != nil {\n\t\tpu = pu.SetPositionID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "659e13a1d1817ca0d0b822b8fe700889", "score": "0.6394963", "text": "func (puo *PositionassingmentUpdateOne) SetNillablePositionID(id *int) *PositionassingmentUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetPositionID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "83f56713c695cdc2c68be7d755c9cada", "score": "0.6387736", "text": "func (mu *MedicalfileUpdate) SetNillablePatientID(id *int) *MedicalfileUpdate {\n\tif id != nil {\n\t\tmu = mu.SetPatientID(*id)\n\t}\n\treturn mu\n}", "title": "" }, { "docid": "71bb4d5732a889332425f6927322612d", "score": "0.6383856", "text": "func (muo *MedicalfileUpdateOne) SetNillablePatientID(id *int) *MedicalfileUpdateOne {\n\tif id != nil {\n\t\tmuo = muo.SetPatientID(*id)\n\t}\n\treturn muo\n}", "title": "" }, { "docid": "e1e9c206af3ab8d83f9fc3eead824dd5", "score": "0.6382776", "text": "func (dc *DevelopperCreate) SetNillableContactID(id *int) *DevelopperCreate {\n\tif id != nil {\n\t\tdc = dc.SetContactID(*id)\n\t}\n\treturn dc\n}", "title": "" }, { "docid": "1e27219c584fa5de2ce58ccc594ac036", "score": "0.63819635", "text": "func (au *AgentUpdate) SetNillableOwnerID(id *uint) *AgentUpdate {\n\tif id != nil {\n\t\tau = au.SetOwnerID(*id)\n\t}\n\treturn au\n}", "title": "" }, { "docid": "b8e402b5a964eb6b574208c4a2b09b5c", "score": "0.63815093", "text": "func (fpu *FloorPlanUpdate) SetNillableLocationID(id *string) *FloorPlanUpdate {\n\tif id != nil {\n\t\tfpu = fpu.SetLocationID(*id)\n\t}\n\treturn fpu\n}", "title": "" }, { "docid": "11b82acc258661dba4844a4f832196e9", "score": "0.63748056", "text": "func (suo *SurveyUpdateOne) SetNillableOwnerID(id *uuid.UUID) *SurveyUpdateOne {\n\tif id != nil {\n\t\tsuo = suo.SetOwnerID(*id)\n\t}\n\treturn suo\n}", "title": "" }, { "docid": "7122544e46de72fbb7fab7410063cf08", "score": "0.6368125", "text": "func (su *SubjectUpdate) SetNillableProfessorIDID(id *int) *SubjectUpdate {\n\tif id != nil {\n\t\tsu = su.SetProfessorIDID(*id)\n\t}\n\treturn su\n}", "title": "" }, { "docid": "5fac5d1434069eb23d7e895e7a8f7b55", "score": "0.6365844", "text": "func (cc *ClubCreate) SetNillableClubtypeID(id *int) *ClubCreate {\n\tif id != nil {\n\t\tcc = cc.SetClubtypeID(*id)\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "6dc01c198b3957874503ccfc928b5ace", "score": "0.63575125", "text": "func (su *SurveyUpdate) SetNillableOwnerID(id *uuid.UUID) *SurveyUpdate {\n\tif id != nil {\n\t\tsu = su.SetOwnerID(*id)\n\t}\n\treturn su\n}", "title": "" }, { "docid": "0faad7287606a88e909177355b7b84e5", "score": "0.6354326", "text": "func (fpu *FloorPlanUpdate) SetNillableImageID(id *string) *FloorPlanUpdate {\n\tif id != nil {\n\t\tfpu = fpu.SetImageID(*id)\n\t}\n\treturn fpu\n}", "title": "" }, { "docid": "1a9fc20cdfb78696fe9250716a5faae6", "score": "0.63322175", "text": "func (epu *EquipmentPortUpdate) SetNillableLinkID(id *string) *EquipmentPortUpdate {\n\tif id != nil {\n\t\tepu = epu.SetLinkID(*id)\n\t}\n\treturn epu\n}", "title": "" }, { "docid": "16c59ede4fe81d89327398ddbd71927c", "score": "0.63272923", "text": "func (fpuo *FloorPlanUpdateOne) SetNillableImageID(id *string) *FloorPlanUpdateOne {\n\tif id != nil {\n\t\tfpuo = fpuo.SetImageID(*id)\n\t}\n\treturn fpuo\n}", "title": "" }, { "docid": "6ab07d34e86ade20851b2a705157eea8", "score": "0.632564", "text": "func (su *SystemequipmentUpdate) SetNillableMedicaltypeID(id *int) *SystemequipmentUpdate {\n\tif id != nil {\n\t\tsu = su.SetMedicaltypeID(*id)\n\t}\n\treturn su\n}", "title": "" }, { "docid": "2ad18fce237135658e6709bd6bc3d18f", "score": "0.63227767", "text": "func (euo *EventUpdateOne) SetNillableNetworkID(id *int) *EventUpdateOne {\n\tif id != nil {\n\t\teuo = euo.SetNetworkID(*id)\n\t}\n\treturn euo\n}", "title": "" }, { "docid": "292bc68bf33426aaebcd8ac531bc74df", "score": "0.63224113", "text": "func (fuo *FileUpdateOne) SetNillableOwnerID(id *string) *FileUpdateOne {\n\tif id != nil {\n\t\tfuo = fuo.SetOwnerID(*id)\n\t}\n\treturn fuo\n}", "title": "" }, { "docid": "08aa877784fbf0cce4a3610a05ced316", "score": "0.6306881", "text": "func (scsuo *SurveyCellScanUpdateOne) SetNillableCellID(s *string) *SurveyCellScanUpdateOne {\n\tif s != nil {\n\t\tscsuo.SetCellID(*s)\n\t}\n\treturn scsuo\n}", "title": "" }, { "docid": "3e4a1cce0c8d6f7dd3009b5f1e7f576d", "score": "0.63056517", "text": "func (auo *AgentUpdateOne) SetNillableOwnerID(id *uint) *AgentUpdateOne {\n\tif id != nil {\n\t\tauo = auo.SetOwnerID(*id)\n\t}\n\treturn auo\n}", "title": "" }, { "docid": "a786682e328a67f4e6c778211cf57f77", "score": "0.6301444", "text": "func (suo *SystemequipmentUpdateOne) SetNillableMedicaltypeID(id *int) *SystemequipmentUpdateOne {\n\tif id != nil {\n\t\tsuo = suo.SetMedicaltypeID(*id)\n\t}\n\treturn suo\n}", "title": "" }, { "docid": "a370ebc0e8c059f7110126984a3cf303", "score": "0.629979", "text": "func (cuo *CardUpdateOne) SetNillableOwnerID(id *string) *CardUpdateOne {\n\tif id != nil {\n\t\tcuo = cuo.SetOwnerID(*id)\n\t}\n\treturn cuo\n}", "title": "" }, { "docid": "cd82cce718fa0c7e62e33c70fb4c677a", "score": "0.6294992", "text": "func (epuo *EquipmentPortUpdateOne) SetNillableLinkID(id *string) *EquipmentPortUpdateOne {\n\tif id != nil {\n\t\tepuo = epuo.SetLinkID(*id)\n\t}\n\treturn epuo\n}", "title": "" }, { "docid": "40e3a17fc68aaadf9613ea53ec6bc883", "score": "0.6285911", "text": "func (quo *QuestionUpdateOne) SetNillableFlowID(id *uuid.UUID) *QuestionUpdateOne {\n\tif id != nil {\n\t\tquo = quo.SetFlowID(*id)\n\t}\n\treturn quo\n}", "title": "" }, { "docid": "1d958d8e40ddb9fd9140c0fb9e3a991d", "score": "0.6268073", "text": "func (cu *CardUpdate) SetNillableOwnerID(id *string) *CardUpdate {\n\tif id != nil {\n\t\tcu = cu.SetOwnerID(*id)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "0928e19cdd81e582b3b32cfd515724e4", "score": "0.62621665", "text": "func (sc *StreetCreate) SetNillableCityID(id *int) *StreetCreate {\n\tif id != nil {\n\t\tsc = sc.SetCityID(*id)\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "68d3c7804439c345e78ae70704674f67", "score": "0.62496805", "text": "func (fic *FlowInstanceCreate) SetNillableFlowID(id *int) *FlowInstanceCreate {\n\tif id != nil {\n\t\tfic = fic.SetFlowID(*id)\n\t}\n\treturn fic\n}", "title": "" }, { "docid": "64cebf0ffbf185e6381bd88a7a83550b", "score": "0.6241116", "text": "func (scsu *SurveyCellScanUpdate) SetNillableCellID(s *string) *SurveyCellScanUpdate {\n\tif s != nil {\n\t\tscsu.SetCellID(*s)\n\t}\n\treturn scsu\n}", "title": "" }, { "docid": "3667c8ad074bb999edca68d2fc92b856", "score": "0.6232861", "text": "func (mu *MedicalfileUpdate) SetNillableDentistID(id *int) *MedicalfileUpdate {\n\tif id != nil {\n\t\tmu = mu.SetDentistID(*id)\n\t}\n\treturn mu\n}", "title": "" }, { "docid": "e1213b5f4ed39ea5aa53d61d4fd0de48", "score": "0.6226916", "text": "func (eu *EventUpdate) SetNillablePageID(id *int) *EventUpdate {\n\tif id != nil {\n\t\teu = eu.SetPageID(*id)\n\t}\n\treturn eu\n}", "title": "" }, { "docid": "592560cadb9dfa33b2055a75cf86752e", "score": "0.6225624", "text": "func (muo *MedicalfileUpdateOne) SetNillableDentistID(id *int) *MedicalfileUpdateOne {\n\tif id != nil {\n\t\tmuo = muo.SetDentistID(*id)\n\t}\n\treturn muo\n}", "title": "" }, { "docid": "9e148e93314ce68ee66d2c3abdde902c", "score": "0.6221184", "text": "func (eu *EventUpdate) SetNillableNetworkID(id *int) *EventUpdate {\n\tif id != nil {\n\t\teu = eu.SetNetworkID(*id)\n\t}\n\treturn eu\n}", "title": "" }, { "docid": "ad865384b009ba798036f36b1e36524f", "score": "0.6220783", "text": "func (fu *FileUpdate) SetNillableOwnerID(id *string) *FileUpdate {\n\tif id != nil {\n\t\tfu = fu.SetOwnerID(*id)\n\t}\n\treturn fu\n}", "title": "" }, { "docid": "e1abbb1d41b95a60ef8319d1bb47708c", "score": "0.6219855", "text": "func (pu *PropertyUpdate) SetNillableLocationID(id *string) *PropertyUpdate {\n\tif id != nil {\n\t\tpu = pu.SetLocationID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "e1671babca098c271dc038ad8f73a219", "score": "0.6218109", "text": "func (pu *PropertyUpdate) SetNillableServiceID(id *string) *PropertyUpdate {\n\tif id != nil {\n\t\tpu = pu.SetServiceID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "523279ae45802d2ec2c99b02c22d0b42", "score": "0.62162787", "text": "func (tru *TriageResultUpdate) SetNillablePatientID(id *int) *TriageResultUpdate {\n\tif id != nil {\n\t\ttru = tru.SetPatientID(*id)\n\t}\n\treturn tru\n}", "title": "" }, { "docid": "ec7f448e1131f2edb328df37c8290c26", "score": "0.6213987", "text": "func (iu *InsuranceUpdate) SetNillableOfficerID(id *int) *InsuranceUpdate {\n\tif id != nil {\n\t\tiu = iu.SetOfficerID(*id)\n\t}\n\treturn iu\n}", "title": "" }, { "docid": "cc0f9356934c39e84d9c58163843aa4c", "score": "0.62128174", "text": "func (cc *CommentCreate) SetNillableOwnerID(id *uint64) *CommentCreate {\n\tif id != nil {\n\t\tcc = cc.SetOwnerID(*id)\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "fb93f41eec439da4ba73288f1b752703", "score": "0.62093985", "text": "func (pu *PetUpdate) SetNillableOwnerID(id *int) *PetUpdate {\n\tif id != nil {\n\t\tpu = pu.SetOwnerID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "43bee51858ad918f29f836b6ca356dc5", "score": "0.6207799", "text": "func (euo *EventUpdateOne) SetNillablePageID(id *int) *EventUpdateOne {\n\tif id != nil {\n\t\teuo = euo.SetPageID(*id)\n\t}\n\treturn euo\n}", "title": "" }, { "docid": "23fb534941971396159c2ab335d926d5", "score": "0.62073094", "text": "func (pc *PatientCreate) SetNillableGenderID(id *int) *PatientCreate {\n\tif id != nil {\n\t\tpc = pc.SetGenderID(*id)\n\t}\n\treturn pc\n}", "title": "" }, { "docid": "159caa606db596535b923cdd8e7005ec", "score": "0.6205028", "text": "func (pu *ProcesUpdate) SetNillableNodeProcessID(id *uint) *ProcesUpdate {\n\tif id != nil {\n\t\tpu = pu.SetNodeProcessID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "07beff00fcf3ed79633b845234c52643", "score": "0.6201654", "text": "func (uc *UserCreate) SetNillableSubscriberID(id *int) *UserCreate {\n\tif id != nil {\n\t\tuc = uc.SetSubscriberID(*id)\n\t}\n\treturn uc\n}", "title": "" }, { "docid": "2315c56c33d98324f8193185d1b6cfe0", "score": "0.6198118", "text": "func (dac *DrugAllergyCreate) SetNillableMedicineID(id *int) *DrugAllergyCreate {\n\tif id != nil {\n\t\tdac = dac.SetMedicineID(*id)\n\t}\n\treturn dac\n}", "title": "" }, { "docid": "e0d7fb4520ce5a5aad4f57f3a5acff18", "score": "0.61949486", "text": "func (iu *InquiryUpdate) SetNillableOfficerID(id *int) *InquiryUpdate {\n\tif id != nil {\n\t\tiu = iu.SetOfficerID(*id)\n\t}\n\treturn iu\n}", "title": "" }, { "docid": "3647feb643ac060504343aea64194fc8", "score": "0.6193388", "text": "func (cc *CommentCreate) SetNillablePostID(u *uint64) *CommentCreate {\n\tif u != nil {\n\t\tcc.SetPostID(*u)\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "bf29b28676680efd3ff549291329b05b", "score": "0.61930764", "text": "func (auo *AgentkycUpdateOne) SetNillableAgentID(s *string) *AgentkycUpdateOne {\n\tif s != nil {\n\t\tauo.SetAgentID(*s)\n\t}\n\treturn auo\n}", "title": "" }, { "docid": "a0ca699810ef6512734335b3abb967ab", "score": "0.6189123", "text": "func (tru *TriageResultUpdate) SetNillableUrgencyLevelID(id *int) *TriageResultUpdate {\n\tif id != nil {\n\t\ttru = tru.SetUrgencyLevelID(*id)\n\t}\n\treturn tru\n}", "title": "" }, { "docid": "632c380502820d75361a22e6c4e104eb", "score": "0.6187402", "text": "func (pu *PaymentUpdate) SetNillableEmployeeID(id *int) *PaymentUpdate {\n\tif id != nil {\n\t\tpu = pu.SetEmployeeID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "3dfdd9ebbe7181c426ef3ad048cedef9", "score": "0.61865157", "text": "func (iuo *InquiryUpdateOne) SetMemberID(id int) *InquiryUpdateOne {\n\tiuo.mutation.SetMemberID(id)\n\treturn iuo\n}", "title": "" }, { "docid": "a0782abe873072910e795983c9bc3f29", "score": "0.6184421", "text": "func (puo *PaymentUpdateOne) SetNillablePaymenttypeID(id *int) *PaymentUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetPaymenttypeID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "94a573bf2065c0350f9f9816ae93c071", "score": "0.6183479", "text": "func (riuo *RepairInvoiceUpdateOne) SetNillableSymptomID(id *int) *RepairInvoiceUpdateOne {\n\tif id != nil {\n\t\triuo = riuo.SetSymptomID(*id)\n\t}\n\treturn riuo\n}", "title": "" }, { "docid": "6b26b6242e9b8d056e6c8b72da1c68ab", "score": "0.61799926", "text": "func (qu *QuestionUpdate) SetNillableFlowID(id *uuid.UUID) *QuestionUpdate {\n\tif id != nil {\n\t\tqu = qu.SetFlowID(*id)\n\t}\n\treturn qu\n}", "title": "" }, { "docid": "8be014299612074cf6639e10b47312aa", "score": "0.61721504", "text": "func (puo *PaymentUpdateOne) SetNillableEmployeeID(id *int) *PaymentUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetEmployeeID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "d598edaa4465227fd8d69367d9ffa4f9", "score": "0.61679137", "text": "func (muo *MedicalfileUpdateOne) SetNillableNurseID(id *int) *MedicalfileUpdateOne {\n\tif id != nil {\n\t\tmuo = muo.SetNurseID(*id)\n\t}\n\treturn muo\n}", "title": "" }, { "docid": "89d5c5711afd3858ad2cc171497f2e6a", "score": "0.61669606", "text": "func (puo *PropertyUpdateOne) SetNillableLocationID(id *string) *PropertyUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetLocationID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "b2c0a10bd4ec8fa51868d844bb749419", "score": "0.6164918", "text": "func (fpuo *FloorPlanUpdateOne) SetNillableScaleID(id *string) *FloorPlanUpdateOne {\n\tif id != nil {\n\t\tfpuo = fpuo.SetScaleID(*id)\n\t}\n\treturn fpuo\n}", "title": "" }, { "docid": "5f8e7f85e0ce370cc05e9d2cdb733cff", "score": "0.61630267", "text": "func (puo *PatientrightsUpdateOne) SetNillablePatientrightsMedicalrecordstaffID(id *int) *PatientrightsUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetPatientrightsMedicalrecordstaffID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "b749772ab98e7d40945b913c24e84a6e", "score": "0.616051", "text": "func (fpu *FloorPlanUpdate) SetNillableScaleID(id *string) *FloorPlanUpdate {\n\tif id != nil {\n\t\tfpu = fpu.SetScaleID(*id)\n\t}\n\treturn fpu\n}", "title": "" }, { "docid": "e5ded86526c6ddaecc25616289de9649", "score": "0.6156659", "text": "func (riu *RepairInvoiceUpdate) SetNillableSymptomID(id *int) *RepairInvoiceUpdate {\n\tif id != nil {\n\t\triu = riu.SetSymptomID(*id)\n\t}\n\treturn riu\n}", "title": "" }, { "docid": "cd52ce0b4981435c3de3742fe3b1d6cc", "score": "0.61565316", "text": "func (ruo *RoomUpdateOne) SetNillableRoomtypeID(id *int) *RoomUpdateOne {\n\tif id != nil {\n\t\truo = ruo.SetRoomtypeID(*id)\n\t}\n\treturn ruo\n}", "title": "" }, { "docid": "b6ae5c12b34dccfbd456eba44b5503b7", "score": "0.61557686", "text": "func (vruo *VarRefUpdateOne) SetNillableWorkflowID(id *uuid.UUID) *VarRefUpdateOne {\n\tif id != nil {\n\t\tvruo = vruo.SetWorkflowID(*id)\n\t}\n\treturn vruo\n}", "title": "" }, { "docid": "832a0fa228a59b523660908899668508", "score": "0.61371", "text": "func (euo *EventUpdateOne) SetNillableActionID(id *int) *EventUpdateOne {\n\tif id != nil {\n\t\teuo = euo.SetActionID(*id)\n\t}\n\treturn euo\n}", "title": "" }, { "docid": "e6a842da137613171dac908a22a3dcff", "score": "0.6136078", "text": "func (sc *SurveyCreate) SetNillableOwnerID(id *uuid.UUID) *SurveyCreate {\n\tif id != nil {\n\t\tsc = sc.SetOwnerID(*id)\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "ee5e07d9a17b8614aead4e6e0c160977", "score": "0.61329377", "text": "func (mu *MedicalfileUpdate) SetNillableNurseID(id *int) *MedicalfileUpdate {\n\tif id != nil {\n\t\tmu = mu.SetNurseID(*id)\n\t}\n\treturn mu\n}", "title": "" }, { "docid": "14f02cb9b873a9472a605eeef2f5b606", "score": "0.6132865", "text": "func (pu *PaymentUpdate) SetNillablePaymenttypeID(id *int) *PaymentUpdate {\n\tif id != nil {\n\t\tpu = pu.SetPaymenttypeID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "dc87052087d4ac6e59930190b6be3ff8", "score": "0.61316687", "text": "func (au *AgentkycUpdate) SetNillableAgentID(s *string) *AgentkycUpdate {\n\tif s != nil {\n\t\tau.SetAgentID(*s)\n\t}\n\treturn au\n}", "title": "" }, { "docid": "6fdc08db4f6715f801cefd93d3965b58", "score": "0.61314815", "text": "func (puo *PetUpdateOne) SetNillableOwnerID(id *int) *PetUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetOwnerID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "47fc4419d3aabebb4acb9612d6ab521f", "score": "0.6129964", "text": "func (quo *QuestionUpdateOne) SetNillableInputID(id *uuid.UUID) *QuestionUpdateOne {\n\tif id != nil {\n\t\tquo = quo.SetInputID(*id)\n\t}\n\treturn quo\n}", "title": "" }, { "docid": "50caac1b6e062a4f6609daad8de09a30", "score": "0.6119963", "text": "func (cu *CustomerUpdate) SetNillableExternalID(s *string) *CustomerUpdate {\n\tif s != nil {\n\t\tcu.SetExternalID(*s)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "e7c4c94b02a4d82f87df3099ae5a3184", "score": "0.6113443", "text": "func (pu *PropertyUpdate) SetNillableWorkOrderID(id *string) *PropertyUpdate {\n\tif id != nil {\n\t\tpu = pu.SetWorkOrderID(*id)\n\t}\n\treturn pu\n}", "title": "" } ]
d053c08b46cb48b62a4712869866b24b
ExitObjectOptionalitySpec is called when production objectOptionalitySpec is exited.
[ { "docid": "7cb9d80bb4894dd6f4dafcd2e33a8447", "score": "0.8684904", "text": "func (s *BaseASNListener) ExitObjectOptionalitySpec(ctx *ObjectOptionalitySpecContext) {}", "title": "" } ]
[ { "docid": "b77c910f4c0ee27ffb708d5b69e5d89b", "score": "0.8144065", "text": "func (s *BaseASNListener) ExitObjectSetOptionalitySpec(ctx *ObjectSetOptionalitySpecContext) {}", "title": "" }, { "docid": "67540a006003628b8d0bc3dcf06cbb8b", "score": "0.7327013", "text": "func (s *BaseASNListener) ExitTypeOptionalitySpec(ctx *TypeOptionalitySpecContext) {}", "title": "" }, { "docid": "201c372ce1ef42d03b19e9cf3800b81c", "score": "0.6969334", "text": "func (s *BaseASNListener) ExitValueOptionalitySpec(ctx *ValueOptionalitySpecContext) {}", "title": "" }, { "docid": "2e05fba0356da15d10d3598f4c5e345b", "score": "0.69631106", "text": "func (s *BaseASNListener) ExitObjectFieldSpec(ctx *ObjectFieldSpecContext) {}", "title": "" }, { "docid": "92678c9d6581a163af27517000d45fda", "score": "0.6869083", "text": "func (s *BaseASNListener) ExitValueSetOptionalitySpec(ctx *ValueSetOptionalitySpecContext) {}", "title": "" }, { "docid": "beb5ef17b5beeb6db3acce48f81eb71c", "score": "0.6654993", "text": "func (s *BaseASNListener) ExitObjectSetSpec(ctx *ObjectSetSpecContext) {}", "title": "" }, { "docid": "04e394aecc68c9346e90630b34ab3094", "score": "0.6550694", "text": "func (s *BaseASNListener) EnterObjectOptionalitySpec(ctx *ObjectOptionalitySpecContext) {}", "title": "" }, { "docid": "a879a56fffab9b23ad987c768db667bd", "score": "0.6496805", "text": "func (s *BaseASNListener) ExitConstraintSpec(ctx *ConstraintSpecContext) {}", "title": "" }, { "docid": "8dcd76db4d1b72173c4780a2bb9d2d57", "score": "0.63152623", "text": "func (s *BaseASNListener) ExitObjectSetFieldSpec(ctx *ObjectSetFieldSpecContext) {}", "title": "" }, { "docid": "2442ea3aeaaafb14d4079f4e720e0c94", "score": "0.6144538", "text": "func (s *BaseASNListener) EnterObjectSetOptionalitySpec(ctx *ObjectSetOptionalitySpecContext) {}", "title": "" }, { "docid": "3bb600b375a5c7e56f79c60230a01823", "score": "0.610643", "text": "func (s *BaseASNListener) ExitObject_(ctx *Object_Context) {}", "title": "" }, { "docid": "253bec754884ee7df1ff6025c9d50697", "score": "0.6082313", "text": "func (s *BaseASNListener) ExitDefinedObject(ctx *DefinedObjectContext) {}", "title": "" }, { "docid": "fd8be2c96f5158b376f20149f9005923", "score": "0.5995013", "text": "func (s *BaseJsonnetListener) ExitForspec(ctx *ForspecContext) {}", "title": "" }, { "docid": "8bd6ba53e6c25f7dd684c25ea73aa9f3", "score": "0.593157", "text": "func (s *BaseASNListener) ExitFieldSpec(ctx *FieldSpecContext) {}", "title": "" }, { "docid": "4146437c8dcd10e30185aeb2c6c0bd19", "score": "0.59308285", "text": "func (s *BaseJsonnetListener) ExitObjectComp(ctx *ObjectCompContext) {}", "title": "" }, { "docid": "460f1c95ae8a21ed8f4728a80ae2a9b7", "score": "0.58272743", "text": "func (s *BaseASNListener) ExitObjectidentifiertype(ctx *ObjectidentifiertypeContext) {}", "title": "" }, { "docid": "d9207427d753acd6e16e2da2058e7fa6", "score": "0.58020294", "text": "func (s *BaseASNListener) ExitOptionalExtensionMarker(ctx *OptionalExtensionMarkerContext) {}", "title": "" }, { "docid": "2e5cb11efd8522c83bf787b209680e4d", "score": "0.5773584", "text": "func (s *BaseJsonnetListener) ExitObject(ctx *ObjectContext) {}", "title": "" }, { "docid": "cba0cd9c8e6b1d3edfb0abc02490fc43", "score": "0.5771509", "text": "func (s *BaseASNListener) ExitExceptionSpec(ctx *ExceptionSpecContext) {}", "title": "" }, { "docid": "89d34621e8dc5db4d7fd0e2dfb6c20b4", "score": "0.5763989", "text": "func (s *BaseASNListener) ExitFixedTypeValueFieldSpec(ctx *FixedTypeValueFieldSpecContext) {}", "title": "" }, { "docid": "d7e29289f294d79f81f112851dbb7c3d", "score": "0.56274587", "text": "func (s *BaseASNListener) ExitOptionalGroup(ctx *OptionalGroupContext) {}", "title": "" }, { "docid": "407e3bb86620d3b5203c60d9667394ca", "score": "0.56239307", "text": "func (s *BaseASNListener) ExitParameterizedObject(ctx *ParameterizedObjectContext) {}", "title": "" }, { "docid": "e06973143168e61df0f862800274355c", "score": "0.56201947", "text": "func (s *BaseJsonnetListener) ExitIfspec(ctx *IfspecContext) {}", "title": "" }, { "docid": "af184b6261abd5db84374c2844e0d974", "score": "0.55991834", "text": "func (s *BaseASNListener) ExitObjectClassDefn(ctx *ObjectClassDefnContext) {}", "title": "" }, { "docid": "c87cdc8c31c295994d53b3a822a2e7b9", "score": "0.55776054", "text": "func (s *BaseASNListener) ExitDefinedObjectClass(ctx *DefinedObjectClassContext) {}", "title": "" }, { "docid": "3e9ae57993ecf21d1db8b7318d54adbf", "score": "0.55531603", "text": "func (s *BaseASNListener) ExitObjectClass(ctx *ObjectClassContext) {}", "title": "" }, { "docid": "ebfaf0b323ae12ca92040e16b58728aa", "score": "0.5544235", "text": "func (s *BaseASNListener) ExitAdditionalElementSetSpec(ctx *AdditionalElementSetSpecContext) {}", "title": "" }, { "docid": "ccda030e841db488cbf17ddf2c0bb4aa", "score": "0.5526892", "text": "func (s *BaseASNListener) ExitConstraint(ctx *ConstraintContext) {}", "title": "" }, { "docid": "43aeb91a49fc19e8fa6a864202e365d2", "score": "0.55138266", "text": "func (s *BaseASNListener) ExitObjectSet(ctx *ObjectSetContext) {}", "title": "" }, { "docid": "8393f399896a44b11e0f641f37777d42", "score": "0.55033123", "text": "func (s *BaseASNListener) ExitTypeFieldSpec(ctx *TypeFieldSpecContext) {}", "title": "" }, { "docid": "ce20817ae92072d53a433548d95f5f04", "score": "0.54458994", "text": "func (s *BaseEGraphQLListener) ExitObjectTypeExtension(ctx *ObjectTypeExtensionContext) {}", "title": "" }, { "docid": "1b8881eac3c6e0af0be56c2a56e2740c", "score": "0.5435732", "text": "func (s *BaseASNListener) ExitWithSyntaxSpec(ctx *WithSyntaxSpecContext) {}", "title": "" }, { "docid": "f8aa61374cd07f14edd5c871513f1add", "score": "0.54313844", "text": "func (s *BaseASNListener) ExitElementSetSpec(ctx *ElementSetSpecContext) {}", "title": "" }, { "docid": "e382445c3c537b8df469894aace6199a", "score": "0.5403496", "text": "func (s *BaseJSONListener) ExitAnObject(ctx *AnObjectContext) {}", "title": "" }, { "docid": "beb29fc8b531292cbaa1ea594c37c20e", "score": "0.5386776", "text": "func (s *BaseASNListener) ExitFixedTypeValueSetFieldSpec(ctx *FixedTypeValueSetFieldSpecContext) {}", "title": "" }, { "docid": "6b9e5a56572137b611c74c51afd1a9ff", "score": "0.53855604", "text": "func (s *BaseASNListener) ExitObjIdComponents(ctx *ObjIdComponentsContext) {}", "title": "" }, { "docid": "19772d72e3cfc3ad1f41bc4225606647", "score": "0.5345698", "text": "func (s *BaseASNListener) ExitVariableTypeValueFieldSpec(ctx *VariableTypeValueFieldSpecContext) {}", "title": "" }, { "docid": "e0a2df0ab7cba901f1afad421ebd0e52", "score": "0.5341993", "text": "func (s *BaseASNListener) ExitTokenOrGroupSpec(ctx *TokenOrGroupSpecContext) {}", "title": "" }, { "docid": "c39ce42cf490969d71108d25ba998a0a", "score": "0.5330095", "text": "func (s *BaseASNListener) ExitContentsConstraint(ctx *ContentsConstraintContext) {}", "title": "" }, { "docid": "39bba9be88a0094f35fb104b350bf985", "score": "0.53085476", "text": "func (_RootChain *RootChainTransactorSession) FinalizeExit(slot uint64) (*types.Transaction, error) {\n\treturn _RootChain.Contract.FinalizeExit(&_RootChain.TransactOpts, slot)\n}", "title": "" }, { "docid": "0c84f3c4f4112c1c5b0f4c43eee404b5", "score": "0.52327263", "text": "func (s *BaseASNListener) ExitRootElementSetSpec(ctx *RootElementSetSpecContext) {}", "title": "" }, { "docid": "6ccdee9089d532d33ca1370c4a9a7aa7", "score": "0.5232663", "text": "func (_RootChain *RootChainTransactor) FinalizeExit(opts *bind.TransactOpts, slot uint64) (*types.Transaction, error) {\n\treturn _RootChain.contract.Transact(opts, \"finalizeExit\", slot)\n}", "title": "" }, { "docid": "ec42590d00c6d6f4b0b60e323959bc3f", "score": "0.5214493", "text": "func (s *BaseASNListener) ExitUserDefinedConstraint(ctx *UserDefinedConstraintContext) {}", "title": "" }, { "docid": "5fb4ad2d1c3313fdd5b53ec858ffc73c", "score": "0.5206817", "text": "func (s *BaseASNListener) ExitUsefulObjectClassReference(ctx *UsefulObjectClassReferenceContext) {}", "title": "" }, { "docid": "f785da35de33d1f7b5c9399b320e2729", "score": "0.5203459", "text": "func (s *BaseWebIDLListener) ExitOptionalType(ctx *OptionalTypeContext) {}", "title": "" }, { "docid": "a743cd47080b70505910011fb506a56b", "score": "0.52032405", "text": "func (s *BaseASNListener) ExitExternalObjectClassReference(ctx *ExternalObjectClassReferenceContext) {\n}", "title": "" }, { "docid": "7e6c14688fbf23f62c083442265146fb", "score": "0.5173507", "text": "func (_RootChain *RootChainSession) FinalizeExit(slot uint64) (*types.Transaction, error) {\n\treturn _RootChain.Contract.FinalizeExit(&_RootChain.TransactOpts, slot)\n}", "title": "" }, { "docid": "aea773e9ea42996ee571ee148479a28c", "score": "0.5170634", "text": "func (s *BaseASNListener) ExitSizeConstraint(ctx *SizeConstraintContext) {}", "title": "" }, { "docid": "9c35e8abfb77c8b38ad5728c181fabbd", "score": "0.51431036", "text": "func (s *BaseEGraphQLListener) ExitObjectField(ctx *ObjectFieldContext) {}", "title": "" }, { "docid": "dca31cdb1f56ae392e87af0eca9af02b", "score": "0.5135581", "text": "func (s *BasebdfListener) ExitRawascentdecl(ctx *RawascentdeclContext) {}", "title": "" }, { "docid": "8e418fb49fdda72327236fb9a0394b59", "score": "0.51272213", "text": "func (s *BaseASNListener) EnterTypeOptionalitySpec(ctx *TypeOptionalitySpecContext) {}", "title": "" }, { "docid": "ed8dbf57dd2d86a8f7a36e2ff049278b", "score": "0.51095915", "text": "func (s *BaseASNListener) ExitObjectClassFieldType(ctx *ObjectClassFieldTypeContext) {}", "title": "" }, { "docid": "573610c0827744bb6f98131ad24b110b", "score": "0.5101656", "text": "func (s *BaseASNListener) ExitSymbol(ctx *SymbolContext) {}", "title": "" }, { "docid": "532847f84d251cc1420f2574f475d832", "score": "0.5089184", "text": "func (s *BaseASNListener) ExitGeneralConstraint(ctx *GeneralConstraintContext) {}", "title": "" }, { "docid": "960d139febf37030ee433458cb520f4f", "score": "0.5067868", "text": "func (s *BaseEGraphQLListener) ExitObjectTypeDefinition(ctx *ObjectTypeDefinitionContext) {}", "title": "" }, { "docid": "8798e72deafa8d959aaaf6096afbd2dc", "score": "0.5066871", "text": "func (s *BaseASNListener) ExitSubtypeConstraint(ctx *SubtypeConstraintContext) {}", "title": "" }, { "docid": "dfea9db80d51074e61d11da9833524aa", "score": "0.50346285", "text": "func (s *BaseASNListener) ExitComponentType(ctx *ComponentTypeContext) {}", "title": "" }, { "docid": "2fb2e359fe5121ab857bdcd328691342", "score": "0.50188744", "text": "func (s *BaseEGraphQLListener) ExitInputObjectTypeExtension(ctx *InputObjectTypeExtensionContext) {}", "title": "" }, { "docid": "dc804d7cccc859723356d93db6058b24", "score": "0.5013509", "text": "func (s *BasebdfListener) ExitResolutionydecl(ctx *ResolutionydeclContext) {}", "title": "" }, { "docid": "9d9eb0d9e720ce33cde4a9de1f569a99", "score": "0.49915797", "text": "func (s *BaseASNListener) EnterValueOptionalitySpec(ctx *ValueOptionalitySpecContext) {}", "title": "" }, { "docid": "23706614ab03ccb1d7e5e8e98b353d24", "score": "0.49801862", "text": "func (s *BaseASNListener) ExitUserDefinedConstraintParameter(ctx *UserDefinedConstraintParameterContext) {\n}", "title": "" }, { "docid": "42d8b7f457df57f30f75803bba09a3f9", "score": "0.49791697", "text": "func (s *BasemoleculeListener) ExitStructure(ctx *StructureContext) {}", "title": "" }, { "docid": "d1818a4d44a48d252eff46c097266e2c", "score": "0.49787912", "text": "func (s *BasemoleculeListener) ExitPart_(ctx *Part_Context) {}", "title": "" }, { "docid": "130e18b7c64c5ca6eb32794e837b27f5", "score": "0.49587035", "text": "func (s *BasebdfListener) ExitRawdescentdecl(ctx *RawdescentdeclContext) {}", "title": "" }, { "docid": "e04d77fc50e9c700841541128728ec90", "score": "0.49535105", "text": "func (s *BaseASNListener) ExitModuleBody(ctx *ModuleBodyContext) {}", "title": "" }, { "docid": "2272c39a01b51e7b20716a60e5bb621b", "score": "0.4932605", "text": "func (s *BaseASNListener) ExitElementSetSpecs(ctx *ElementSetSpecsContext) {}", "title": "" }, { "docid": "5152b49bdc9742bf18f4821c2393f923", "score": "0.48875982", "text": "func (s *BaseSUOKIFListener) ExitEquation(ctx *EquationContext) {}", "title": "" }, { "docid": "a34672605107c4b2f99bfe3e89fa5b48", "score": "0.48820874", "text": "func (s *BaseCadenceListener) ExitEventDeclaration(ctx *EventDeclarationContext) {}", "title": "" }, { "docid": "3776e8137459a2b90f2bc4d9c5fc084a", "score": "0.48800156", "text": "func (s *BaseASNListener) ExitObjectClassAssignment(ctx *ObjectClassAssignmentContext) {}", "title": "" }, { "docid": "31aaf3feb58857473eb93c8047fde1d0", "score": "0.48745796", "text": "func (s *BaseASNListener) ExitObjectSetElements(ctx *ObjectSetElementsContext) {}", "title": "" }, { "docid": "72c24467907ab6304e8300d55e3c44af", "score": "0.4855922", "text": "func (s *BaseEGraphQLListener) ExitObjectValue(ctx *ObjectValueContext) {}", "title": "" }, { "docid": "0637c276acdabf4746f02543017be62a", "score": "0.48231208", "text": "func (s *BaseSQLBaseListener) ExitQuerySpecification(ctx *QuerySpecificationContext) {}", "title": "" }, { "docid": "5ec13078968343518fd629040b533bd1", "score": "0.48218226", "text": "func (s *BasebdfListener) ExitPropertiesdecl(ctx *PropertiesdeclContext) {}", "title": "" }, { "docid": "39b769b9f98c5169616810f19c43c197", "score": "0.4810768", "text": "func (s *BaseCadenceListener) ExitAdditiveOp(ctx *AdditiveOpContext) {}", "title": "" }, { "docid": "e9855337146105199f3d9d987702a0b6", "score": "0.480952", "text": "func (s *BaseASNListener) ExitExtensionAdditionAlternative(ctx *ExtensionAdditionAlternativeContext) {\n}", "title": "" }, { "docid": "e7fa4b648421e1720c0920fbdd3a8d17", "score": "0.48089346", "text": "func (s *BaseASNListener) ExitSimpleTableConstraint(ctx *SimpleTableConstraintContext) {}", "title": "" }, { "docid": "73828ffe1f3b730ed5ecb1fa6efdeb6a", "score": "0.48023108", "text": "func (s *BaseJsonnetListener) ExitObjlocal(ctx *ObjlocalContext) {}", "title": "" }, { "docid": "667bd93580826447564235b14f04257f", "score": "0.47825244", "text": "func (s *BaseEGraphQLListener) ExitExecutableDefinition(ctx *ExecutableDefinitionContext) {}", "title": "" }, { "docid": "7cb458ad63dccf0183786e4effec805b", "score": "0.4780395", "text": "func (s *BaseASNListener) ExitObjectIdentifierValue(ctx *ObjectIdentifierValueContext) {}", "title": "" }, { "docid": "73f088031d02329da94be7b30382d1ce", "score": "0.47727543", "text": "func (s *BasebdfListener) ExitEncodingdecl(ctx *EncodingdeclContext) {}", "title": "" }, { "docid": "811eb4cb2343716e526aa26256a97951", "score": "0.47630113", "text": "func (s *BaseCELListener) ExitOptExpr(ctx *OptExprContext) {}", "title": "" }, { "docid": "4b1f0a6671653d32303e2fd8a581ba39", "score": "0.47596118", "text": "func (r *Reconciler) FinalizeKind(ctx context.Context, resetOffset *kafkav1alpha1.ResetOffset) reconciler.Event {\n\n\t// Get The Logger From Context\n\tlogger := logging.FromContext(ctx)\n\tlogger.Debug(\"<========== START RESET-OFFSET FINALIZATION ==========>\")\n\n\t// Do NOT Finalize ResetOffset Instances That Are \"Executing\"\n\tif resetOffset.Status.IsInitiated() && !resetOffset.Status.IsCompleted() {\n\t\tlogger.Debug(\"Skipping finalization of in-progress ResetOffset instance\")\n\t\treturn fmt.Errorf(\"skipping finalization of in-progress ResetOffset instance\")\n\t}\n\n\t// No-Op Finalization - Nothing To Do\n\tlogger.Info(\"No-Op Finalization Successful\")\n\n\t// Return Finalized Success Event\n\treturn reconciler.NewEvent(corev1.EventTypeNormal, ResetOffsetFinalized.String(), \"Finalized successfully\")\n}", "title": "" }, { "docid": "8edf54ab2e496747c537efbacac7f952", "score": "0.47594577", "text": "func (s *BaseASNListener) ExitIntersections(ctx *IntersectionsContext) {}", "title": "" }, { "docid": "eb3536e5912f7f41dfb602a40367bd3b", "score": "0.47535753", "text": "func (s *BaseASNListener) ExitActualParameter(ctx *ActualParameterContext) {}", "title": "" }, { "docid": "1f8badcdb3487a9efb559f41612f28a2", "score": "0.4740496", "text": "func (s *BasebdfListener) ExitFoundrydecl(ctx *FoundrydeclContext) {}", "title": "" }, { "docid": "3124b4abe65cb1cbd83c6109df189eec", "score": "0.47356623", "text": "func (s *BaseASNListener) ExitVariableTypeValueSetFieldSpec(ctx *VariableTypeValueSetFieldSpecContext) {\n}", "title": "" }, { "docid": "efb59772dc189615aa7eb05b7a111b90", "score": "0.47353825", "text": "func (s *BaseASNListener) ExitUnionMark(ctx *UnionMarkContext) {}", "title": "" }, { "docid": "7057cee1d0b18e5135e9afa490fa8c51", "score": "0.472636", "text": "func (s *BasebdfListener) ExitSizedecl(ctx *SizedeclContext) {}", "title": "" }, { "docid": "2288564a57d3ead4446cce7266e43401", "score": "0.47243875", "text": "func (s *BaseWebIDLListener) ExitOptionalOperationName(ctx *OptionalOperationNameContext) {}", "title": "" }, { "docid": "fe1fae780ad1d2db80e91d6bea23913a", "score": "0.47226986", "text": "func (s *BaseASNListener) EnterValueSetOptionalitySpec(ctx *ValueSetOptionalitySpecContext) {}", "title": "" }, { "docid": "08c3392728b70ea6044e5d9e5cf80072", "score": "0.4720885", "text": "func (s *BaseCadenceListener) ExitCompositeDeclaration(ctx *CompositeDeclarationContext) {}", "title": "" }, { "docid": "373c333a3fa4562f7ff4e6caa808594a", "score": "0.47189423", "text": "func (s *BaseProsr1Listener) ExitBodyDefinition(ctx *BodyDefinitionContext) {}", "title": "" }, { "docid": "ae2490459f906e5d05ac66a736fabf04", "score": "0.4717268", "text": "func (s *BaseASNListener) ExitExtensionAdditions(ctx *ExtensionAdditionsContext) {}", "title": "" }, { "docid": "f6cb192993279cd8b76becd8d70344a7", "score": "0.4714244", "text": "func (s *BaseASNListener) ExitSymbolsExported(ctx *SymbolsExportedContext) {}", "title": "" }, { "docid": "45724b0ba4413e5dcb7e18c29d259a3b", "score": "0.47135812", "text": "func (s *BaseCadenceListener) ExitDeclaration(ctx *DeclarationContext) {}", "title": "" }, { "docid": "f7dcb93056fedf84c1da03ce34c021c0", "score": "0.47124195", "text": "func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1alpha1.TektonPipeline) pkgreconciler.Event {\n\treturn nil\n}", "title": "" }, { "docid": "f601cea46ecc468882c8925d6ce894ff", "score": "0.4711851", "text": "func (s *BasemoleculeListener) ExitSymbol(ctx *SymbolContext) {}", "title": "" }, { "docid": "71c75d20b5135b60ab832f79f7180cbf", "score": "0.47113362", "text": "func (s *BaseJSONListener) ExitObjectValue(ctx *ObjectValueContext) {}", "title": "" }, { "docid": "013b72b265138e80069f0c0582ab3405", "score": "0.47057226", "text": "func (s *BaseEGraphQLListener) ExitExecutableDirectiveLocation(ctx *ExecutableDirectiveLocationContext) {\n}", "title": "" }, { "docid": "78ca18d9c308324293b81e1cebe9d5bd", "score": "0.47047362", "text": "func (s *BaseCadenceListener) ExitProgram(ctx *ProgramContext) {}", "title": "" } ]
248fe9d47e744781ccab9c42cc40bbd0
The paths to exclude from the antimalware scan, separated by `;`. For example `C:\\Windows\\Temp;D:\\Temp`.
[ { "docid": "8591705805f3cbaeedf4bcf8a0774db8", "score": "0.57214785", "text": "func (o ConfigurationAntimalwareExclusionsOutput) Paths() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ConfigurationAntimalwareExclusions) *string { return v.Paths }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
[ { "docid": "e85f8a8071bf4021e4a4a81ad392289d", "score": "0.6341213", "text": "func (tr *NormalizingTarReader) ExcludePaths(paths []string) {\n\ttr.excludedPaths = paths\n}", "title": "" }, { "docid": "783e95e4dac6315fa7d9173a537ffadd", "score": "0.6295668", "text": "func pathsToRemove(ctx *gcp.Context, dir string, exclusions []string) ([]string, error) {\n\tpaths, err := ctx.Glob(filepath.Join(dir, \"*\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"finding paths: %w\", err)\n\t}\n\tvar filteredPaths []string\n\tfor _, path := range paths {\n\t\tremove := true\n\t\tfor _, exclusion := range exclusions {\n\t\t\tif match, err := filepath.Match(path, filepath.Join(dir, exclusion)); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"matching pattern %q with path %q: %v\", filepath.Join(dir, exclusion), path, err)\n\t\t\t} else if match {\n\t\t\t\tremove = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif remove {\n\t\t\tfilteredPaths = append(filteredPaths, path)\n\t\t}\n\t}\n\treturn filteredPaths, nil\n}", "title": "" }, { "docid": "a76cf1c2f014fd559b09a3b165431040", "score": "0.6250231", "text": "func (r Report) Exclude(paths ...string) (result Report) {\n\tif len(paths) == 0 {\n\t\treturn r\n\t}\n\n\treturn r.filter(func(filterPath *ytbx.Path) bool {\n\t\tfor _, pathString := range paths {\n\t\t\tpath, err := ytbx.ParsePathStringUnsafe(pathString)\n\t\t\tif err == nil && filterPath != nil && path.String() == filterPath.String() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "a610b1098473caa27a63da15003ed233", "score": "0.62073445", "text": "func FilterPaths(paths []string) []string {\n\tfileSet := make(map[string]bool)\n\tfor _, p := range paths {\n\t\tif !strings.HasSuffix(p, \".ts\") && !strings.HasSuffix(p, \".tsx\") && filepath.Base(p) != \"BUILD\" {\n\t\t\tcontinue\n\t\t}\n\t\tfileSet[filepath.Dir(p)] = true\n\t}\n\tvar newPaths []string\n\tfor k := range fileSet {\n\t\tnewPaths = append(newPaths, platform.Normalize(k))\n\t}\n\treturn newPaths\n}", "title": "" }, { "docid": "8343072785abea5732613b00dfb19806", "score": "0.61620593", "text": "func genPathIgnoreOpt(ignorePaths []string) cmp.Option {\n\treturn cmp.FilterPath(func(curPath cmp.Path) bool {\n\t\tcp := strings.Join(pathToStringList(curPath), \".\")\n\t\tfor _, ip := range ignorePaths {\n\t\t\tif res, err := filepath.Match(ip, cp); err == nil && res {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}, cmp.Ignore())\n}", "title": "" }, { "docid": "4382198881e596c0113d138162679be5", "score": "0.6147241", "text": "func FilterPaths(fileInfo os.FileInfo) bool {\n\tname := fileInfo.Name()\n\tfor _, pattern := range IgnoredPaths {\n\t\tmatch, _ := filepath.Match(pattern, name)\n\t\tif match {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "150bfef3cce3c488a75e8844117a34fc", "score": "0.5963494", "text": "func excluded(reqStr string, patterns []string) (ok bool) {\n\tvar err error\n\tvar match bool\n\n\tln := len(patterns)\n\tfor j := 0; j < ln && !ok; j++ {\n\t\tmatch, err = path.Match(patterns[j], reqStr)\n\t\tif err == nil {\n\t\t\tif match {\n\t\t\t\tok = true\n\t\t\t\t// fmt.Printf(\"[%s] is excluded by rule [%s]\\n\", reqStr, patterns[j])\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "07dd331850ae028047ba451b4576217e", "score": "0.5937732", "text": "func loadExcluded(excludefile *string) []string {\n\tfile, err := os.Open(*excludefile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\tvar excluded []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tif strings.HasPrefix(scanner.Text(), \"!\") {\n\t\t\texcluded = append(excluded, strings.Trim(scanner.Text(), \"!\"))\n\t\t}\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn excluded\n}", "title": "" }, { "docid": "a838ad303eff0baa3d4c2fa32efb3590", "score": "0.58608747", "text": "func OptExcludeFiles(excludeGlobs ...string) Option {\n\treturn func(p *Profanity) {\n\t\tp.Config.Files.Filter.Exclude = excludeGlobs\n\t}\n}", "title": "" }, { "docid": "cadd8ba68780d03c5c2ededf91e9b302", "score": "0.57987815", "text": "func isExcluded(filePath string) bool {\n\tfor _, p := range excludedPaths {\n\t\tabsP, err := path.Abs(p)\n\t\tif err != nil {\n\t\t\tbeeLogger.Log.Errorf(\"Cannot get absolute path of '%s'\", p)\n\t\t\tcontinue\n\t\t}\n\t\tabsFilePath, err := path.Abs(filePath)\n\t\tif err != nil {\n\t\t\tbeeLogger.Log.Errorf(\"Cannot get absolute path of '%s'\", filePath)\n\t\t\tbreak\n\t\t}\n\t\tif strings.HasPrefix(absFilePath, absP) {\n\t\t\tbeeLogger.Log.Infof(\"'%s' is not being watched\", filePath)\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e42f092f07d989ce74b7e88fa64038b4", "score": "0.56731284", "text": "func OptExcludeDirs(excludeGlobs ...string) Option {\n\treturn func(p *Profanity) {\n\t\tp.Config.Dirs.Filter.Exclude = excludeGlobs\n\t}\n}", "title": "" }, { "docid": "cdc0b8ed80e471f2dccdb6dcf3bf17dc", "score": "0.55640244", "text": "func (c *condition) excludes(v string) bool {\n\tfor _, pattern := range c.Exclude {\n\t\tif ok, _ := filepath.Match(pattern, v); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e4a35a292e529453beb24a9f38b6186b", "score": "0.5559515", "text": "func flagExcludedDirs(modules []*TerraformModule, terragruntOptions *options.TerragruntOptions) ([]*TerraformModule, error) {\n\tfor _, module := range modules {\n\t\tif findModuleInPath(module, terragruntOptions.ExcludeDirs) {\n\t\t\t// Mark module itself as excluded\n\t\t\tmodule.FlagExcluded = true\n\t\t}\n\n\t\t// Mark all affected dependencies as excluded\n\t\tfor _, dependency := range module.Dependencies {\n\t\t\tif findModuleInPath(dependency, terragruntOptions.ExcludeDirs) {\n\t\t\t\tdependency.FlagExcluded = true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn modules, nil\n}", "title": "" }, { "docid": "356d56a6fcbaef28899f3780e7163129", "score": "0.5538362", "text": "func (o IndexingPolicyOutput) ExcludedPaths() ExcludedPathArrayOutput {\n\treturn o.ApplyT(func(v IndexingPolicy) []ExcludedPath { return v.ExcludedPaths }).(ExcludedPathArrayOutput)\n}", "title": "" }, { "docid": "57a79f180ff27ce3b1f2fda06c002d78", "score": "0.5536684", "text": "func ExcludeFields(paths []string, excludePaths ...string) []string {\n\tif len(paths) == 0 {\n\t\treturn paths\n\t}\n\texcluded := make([]string, 0, len(paths))\nouter:\n\tfor _, path := range paths {\n\t\tfor _, excludePath := range excludePaths {\n\t\t\tif path == excludePath || strings.HasPrefix(path, excludePath+\".\") {\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t}\n\t\texcluded = append(excluded, path)\n\t}\n\treturn excluded\n}", "title": "" }, { "docid": "7e0c36f3da2079b59971e54987a97b5f", "score": "0.5462342", "text": "func walker(files *[]string, excludedDirNames stringList) filepath.WalkFunc {\n return func(path string, info os.FileInfo, err error) error {\n if err != nil {\n log.Fatal(\"ERROR: rx error on the walk function err param:\", err)\n }\n\n if info.IsDir() {\n\n // *nix hidden dir should be skipped completely\n // Not accounting for any Windows stuff in this app.\n if info.Name()[0:1] == \".\" {\n // fmt.Println(\"## --skipping hidden dir path: \", path, \", filename: \", info.Name())\n\n // skip the directory and do not descend into it\n return filepath.SkipDir\n }\n\n // If this is an excluded directory name, skip it and don't\n // decend any further.\n for _, dirName := range excludedDirNames {\n if dirName == info.Name() {\n return filepath.SkipDir\n }\n }\n\n // fmt.Println(\"## --skipping dir path: \", path, \", filename: \", info.Name())\n\n // skip the directory file but go ahead and descend into the directory\n return nil\n }\n\n // skip hidden files\n if info.Name()[0:1] == \".\" {\n return nil\n }\n\n // Add this file to the found file list\n *files = append(*files, path)\n\n return nil\n }\n}", "title": "" }, { "docid": "6569c38022b89a240dd4d1904a3c387c", "score": "0.5455432", "text": "func FilterGlobParts(a []string) []string {\n\tb := a[:0]\n\tfor _, x := range a {\n\t\tif !HasGlobChar(x) {\n\t\t\tb = append(b, x)\n\t\t}\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b991e4413725dcfba0a7c2b57d1fb844", "score": "0.54549146", "text": "func (o ConfigurationAntimalwareExclusionsPtrOutput) Paths() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ConfigurationAntimalwareExclusions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Paths\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cc06348b127f025152f22a1c36f29a37", "score": "0.5418249", "text": "func ignoredByGoTool(importPath string) bool {\n\tfor _, el := range strings.Split(importPath, \"/\") {\n\t\tif strings.HasPrefix(el, \".\") || strings.HasPrefix(el, \"_\") || el == \"testdata\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "64bc4d8cd8f4346c07ab6561d8b246e3", "score": "0.54148364", "text": "func ExcludeSubFields(paths []string, excludePaths ...string) []string {\n\tif len(paths) == 0 {\n\t\treturn paths\n\t}\n\texcluded := make([]string, 0, len(paths))\nouter:\n\tfor _, path := range paths {\n\t\tfor _, excludePath := range excludePaths {\n\t\t\tif strings.HasPrefix(path, excludePath+\".\") {\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t}\n\t\texcluded = append(excluded, path)\n\t}\n\treturn excluded\n}", "title": "" }, { "docid": "064d4ae690d97ea95f6aa5486821f8b7", "score": "0.5397922", "text": "func (util copyHandlerUtil) resourceShouldBeExcluded(parentSourcePath string, excludedFilePathMap map[string]int, filePath string) bool {\n\n\t// strip the parent source path from the file path to match against the\n\t//relative path mentioned in the exclude flag\n\tfileRelativePath := strings.Replace(filePath, parentSourcePath, \"\", 1)\n\tif fileRelativePath[0] == common.AZCOPY_PATH_SEPARATOR_CHAR {\n\t\tfileRelativePath = fileRelativePath[1:]\n\t}\n\t// Check if the given filePath exists as an entry in the map\n\t_, ok := excludedFilePathMap[fileRelativePath]\n\tif ok {\n\t\treturn true\n\t}\n\t// Iterate through each entry of the Map\n\t// Matches the given filePath against map entry pattern\n\t// This is to handle case when user passed a sub-dir inside\n\t// source to exclude. All the files inside that sub-directory\n\t// should be excluded.\n\t// For Example: source = C:\\User\\user-1 exclude = \"dir1\"\n\t// Entry in Map = C:\\User\\user-1\\dir1\\* will match the filePath C:\\User\\user-1\\dir1\\file1.txt\n\tfor key, _ := range excludedFilePathMap {\n\t\tif util.blobNameMatchesThePattern(key, fileRelativePath) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e4c04a7651f4148b9737d7f676507534", "score": "0.5396386", "text": "func getIgnorePatterns(filePath, ignoreFile string, verbose bool) (ignorePatterns []string) {\n\tignorePatterns = append(ignorePatterns, \"*.git/*\")\n\n\t// Loop through the files defined to contain ignore patterns (.ge_ignore, .gitignore, etc.)\n\tfor _, ignoreFile := range ignoreFiles {\n\t\tactualFilePath := path.Join(filePath, ignoreFile)\n\t\tif Exists(actualFilePath) {\n\t\t\tfile, err := os.Open(actualFilePath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\tdefer file.Close()\n\t\t\tscanner := bufio.NewScanner(file)\n\t\t\tvar line, firstChar string\n\t\t\tfor scanner.Scan() {\n\t\t\t\tline = scanner.Text()\n\n\t\t\t\t// Ignore comment lines (starting with #)\n\t\t\t\trunes := []rune(line)\n\t\t\t\tfirstChar = string(runes[0:1])\n\t\t\t\tif !(firstChar == \"#\") && strings.Trim(line, \" \") != \"\" {\n\t\t\t\t\tignorePatterns = append(ignorePatterns, line)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif ignoreFile != \"\" {\n\t\tfile, err := os.Open(ignoreFile)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Failed to open ignore file\", err)\n\t\t} else {\n\t\t\tdefer file.Close()\n\t\t\tscanner := bufio.NewScanner(file)\n\t\t\tvar line, firstChar string\n\t\t\tfor scanner.Scan() {\n\t\t\t\tline = scanner.Text()\n\n\t\t\t\t// Ignore comment lines (starting with #)\n\t\t\t\trunes := []rune(line)\n\t\t\t\tfirstChar = string(runes[0:1])\n\t\t\t\tif !(firstChar == \"#\") && strings.Trim(line, \" \") != \"\" {\n\t\t\t\t\tignorePatterns = append(ignorePatterns, line)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif verbose {\n\t\tlog.Println(\"Ignore pattern: \", strings.Join(ignorePatterns, \", \"))\n\t}\n\treturn ignorePatterns\n}", "title": "" }, { "docid": "b51a6beb8635e95bf02d9d965981b1fb", "score": "0.5393754", "text": "func tiltIgnorePath(tiltfilePath string) string {\n\treturn filepath.Join(filepath.Dir(tiltfilePath), TiltIgnoreFileName)\n}", "title": "" }, { "docid": "8ed8b0657f669ec9398ed5f4659415c4", "score": "0.5350568", "text": "func initExcludedTests() sets.String {\n\n\tswitch getTestArch() {\n\tcase \"s390x\":\n\t\treturn sets.NewString(\n\t\t\t// examples\n\t\t\t\"TestExamples/v1alpha1/taskruns/gcs-resource\",\n\t\t\t\"TestExamples/v1beta1/taskruns/gcs-resource\",\n\t\t)\n\tcase \"ppc64le\":\n\t\treturn sets.NewString(\n\t\t\t// examples\n\t\t\t\"TestExamples/v1alpha1/taskruns/gcs-resource\",\n\t\t\t\"TestExamples/v1beta1/taskruns/gcs-resource\",\n\t\t\t\"TestExamples/v1beta1/pipelineruns/pipelinerun\",\n\t\t\t\"TestYamls/yamls/v1beta1/pipelineruns/pipelinerun.yaml\",\n\t\t)\n\t}\n\n\treturn sets.NewString()\n}", "title": "" }, { "docid": "18485260961fdc128c20221816866532", "score": "0.5299116", "text": "func collectNonGoFiles(baseDir string, logger *log.Logger) ([]string, error) {\n\tfiles := make([]string, 0)\n\n\terr := filepath.Walk(baseDir, 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\t// Ignore directories.\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Ignore all Go files.\n\t\tif strings.HasSuffix(info.Name(), \".go\") {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Ignore perserved files.\n\t\tif isPreservedFile(info.Name()) {\n\t\t\treturn nil\n\t\t}\n\n\t\tfiles = append(files, path)\n\n\t\treturn nil\n\t})\n\n\treturn files, err\n}", "title": "" }, { "docid": "d0953aabd3a600990dbbac767856a27e", "score": "0.5279367", "text": "func FindFilesFiltering(dirname string, ignored []string) []string {\n\tvar list []string\n\twalkFunc := 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\tif !info.IsDir() {\n\t\t\tfor _, skip := range ignored {\n\t\t\t\tif strings.Contains(path, skip) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\tp, err := filepath.Rel(dirname, path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist = append(list, p)\n\t\t\treturn nil\n\t\t}\n\t\treturn nil\n\t}\n\n\t_ = filepath.Walk(dirname, walkFunc)\n\treturn list\n}", "title": "" }, { "docid": "d609b42198907f4f27f5534e86d179cb", "score": "0.52790624", "text": "func TestIsExcluded(t *testing.T) {\n\tvar rfs ReverseFS\n\t// If the root directory is excluded, all files and subdirs should be excluded\n\t// as well\n\trfs.cExclude = []string{\"\"}\n\tverifyExcluded(t, &rfs, []string{\"\", \"foo\", \"foo/bar\"})\n}", "title": "" }, { "docid": "3f22fdfc04ccd6174d9439b6522f962d", "score": "0.5279018", "text": "func (o IndexingPolicyPtrOutput) ExcludedPaths() ExcludedPathArrayOutput {\n\treturn o.ApplyT(func(v *IndexingPolicy) []ExcludedPath {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ExcludedPaths\n\t}).(ExcludedPathArrayOutput)\n}", "title": "" }, { "docid": "dd545cb4e7fb93514066dbc701f89444", "score": "0.5246866", "text": "func IgnoreFiles(e *colly.HTMLElement, files []string) bool {\n\tignore := false\n\tfor i := 0; i < len(files); i++ {\n\t\tif strings.Contains(e.Attr(\"href\"), files[i]) {\n\t\t\tignore = true\n\t\t}\n\t}\n\treturn ignore\n}", "title": "" }, { "docid": "c0152e826a90369edd6acf62d7b52802", "score": "0.5226638", "text": "func (c *InfrastructureClusterContract) IgnorePaths() []Path {\n\treturn []Path{\n\t\t// NOTE: the controlPlaneEndpoint struct currently contains two mandatory fields (host and port); without this\n\t\t// ignore path they are going to be always reconciled to the default value or to the value set into the template.\n\t\t{\"spec\", \"controlPlaneEndpoint\"},\n\t}\n}", "title": "" }, { "docid": "c983c4da50418760fdc54c3f2c80073b", "score": "0.5214658", "text": "func (o LinuxWebAppOutput) ClientCertificateExclusionPaths() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinuxWebApp) pulumi.StringPtrOutput { return v.ClientCertificateExclusionPaths }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3a9aff464b2c7ac9a582021b2267b087", "score": "0.51815015", "text": "func importPathsNoDotExpansion(args []string) []string {\n\tif len(args) == 0 {\n\t\treturn []string{\".\"}\n\t}\n\tvar out []string\n\tfor _, a := range args {\n\t\t// Arguments are supposed to be import paths, but\n\t\t// as a courtesy to Windows developers, rewrite \\ to /\n\t\t// in command-line arguments. Handles .\\... and so on.\n\t\tif filepath.Separator == '\\\\' {\n\t\t\ta = strings.Replace(a, `\\`, `/`, -1)\n\t\t}\n\n\t\t// Put argument in canonical form, but preserve leading ./.\n\t\tif strings.HasPrefix(a, \"./\") {\n\t\t\ta = \"./\" + path.Clean(a)\n\t\t\tif a == \"./.\" {\n\t\t\t\ta = \".\"\n\t\t\t}\n\t\t} else {\n\t\t\ta = path.Clean(a)\n\t\t}\n\t\tif a == \"all\" || a == \"std\" {\n\t\t\tout = append(out, matchPackages(a)...)\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, a)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "d8d1394c787e1c0b16386f40ad57ed0f", "score": "0.51799756", "text": "func (o FolderSinkOutput) Exclusions() FolderSinkExclusionArrayOutput {\n\treturn o.ApplyT(func(v *FolderSink) FolderSinkExclusionArrayOutput { return v.Exclusions }).(FolderSinkExclusionArrayOutput)\n}", "title": "" }, { "docid": "f8d4b4d6c340695ffddab2f5f3608bd3", "score": "0.51780754", "text": "func (i *Iterator) AllowPath(p string) bool {\n\tfor _, r := range i.Ignore {\n\t\tif r.MatchString(p) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "3ace43d169eff2577955e8149e7accde", "score": "0.51772857", "text": "func GetAuthSkipPaths() ([]string, error) {\n\tskipPaths := []string{\n\t\t\"/contrail-clusters?fields=uuid,name\",\n\t\t\"/keystone/v3/auth/tokens\",\n\t\t// TODO(dfurman): \"server.dynamic_proxy_path\" or DefaultDynamicProxyPath should be used\n\t\t\"/proxy/\",\n\t\t\"/keystone/v3/projects\",\n\t\t\"/keystone/v3/auth/projects\", // TODO: Remove this, since \"/keystone/v3/projects\" is a keystone endpoint\n\t\t\"/v3/auth/tokens\",\n\t}\n\t// skip auth for all the static fileutil\n\tfor prefix, root := range viper.GetStringMap(\"server.static_files\") {\n\t\tif prefix == \"/\" {\n\t\t\tstaticFiles, err := ioutil.ReadDir(root.(string))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.WithStack(err)\n\t\t\t}\n\t\t\tfor _, staticFile := range staticFiles {\n\t\t\t\tskipPaths = append(skipPaths,\n\t\t\t\t\tfilepath.Join(prefix, staticFile.Name()))\n\t\t\t}\n\t\t} else {\n\t\t\tskipPaths = append(skipPaths, prefix)\n\t\t}\n\t}\n\treturn skipPaths, nil\n}", "title": "" }, { "docid": "7a1f9abf325559ff2270897874d3b729", "score": "0.51416427", "text": "func (urls url) removeExcluded(excluded []string) url {\n\tfound := false\n\tfor _, exclude := range excluded {\n\t\t//loop backwards to avoid skipping elements\n\t\tfor i := len(urls) - 1; i >= 0; i-- {\n\t\t\tif strings.Contains(urls[i], exclude) {\n\t\t\t\tfound = false\n\t\t\t\t//skip if matches included line\n\t\t\t\tfor _, include := range included {\n\t\t\t\t\tif strings.Contains(include, exclude) {\n\t\t\t\t\t\tif strings.Contains(urls[i], include) {\n\t\t\t\t\t\t\tfound = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\turls = append(urls[:i], urls[i+1:]...)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\treturn urls\n}", "title": "" }, { "docid": "4251d2d92097b2ccd1a1b5ad1ae9affe", "score": "0.5141389", "text": "func List(root string, includePatterns []string, excludePatterns []string) ([]string, error) {\n\troot = filepath.FromSlash(root)\n\tnewincludes, bases := baseDirs(root, includePatterns)\n\tret := []string{}\n\tfor _, b := range bases {\n\t\terr := filepath.Walk(\n\t\t\tb,\n\t\t\tfunc(p string, fi os.FileInfo, err error) error {\n\t\t\t\tif err != nil || fi.Mode()&os.ModeSymlink != 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tcleanpath, err := filter.File(p, newincludes, excludePatterns)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif fi.IsDir() {\n\t\t\t\t\tm, err := filter.MatchAny(p, excludePatterns)\n\t\t\t\t\t// We skip the dir only if it's explicitly excluded\n\t\t\t\t\tif err != nil && !m {\n\t\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t\t}\n\t\t\t\t} else if cleanpath != \"\" {\n\t\t\t\t\tret = append(ret, cleanpath)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn normPaths(root, ret)\n}", "title": "" }, { "docid": "4ff7ae59929f3d1d66bc24dc75ba95c6", "score": "0.51070327", "text": "func flagModulesThatDontInclude(modules []*TerraformModule, terragruntOptions *options.TerragruntOptions) ([]*TerraformModule, error) {\n\n\t// If no ModulesThatInclude is specified return the modules list instantly\n\tif len(terragruntOptions.ModulesThatInclude) == 0 {\n\t\treturn modules, nil\n\t}\n\n\tmodulesThatIncludeCanonicalPath := []string{}\n\tfor _, includePath := range terragruntOptions.ModulesThatInclude {\n\t\tcanonicalPath, err := util.CanonicalPath(includePath, terragruntOptions.WorkingDir)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmodulesThatIncludeCanonicalPath = append(modulesThatIncludeCanonicalPath, canonicalPath)\n\t}\n\n\tfor _, module := range modules {\n\t\t// Ignore modules that are already excluded because this feature is a filter for excluding the subset, not\n\t\t// including modules that have already been excluded through other means.\n\t\tif module.FlagExcluded {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Mark modules that don't include any of the specified paths as excluded. To do this, we first flag the module\n\t\t// as excluded, and if it includes any path in the set, we set the exclude flag back to false.\n\t\tmodule.FlagExcluded = true\n\t\tfor _, includeConfig := range module.Config.ProcessedIncludes {\n\t\t\t// resolve include config to canonical path to compare with modulesThatIncludeCanonicalPath\n\t\t\t// https://github.com/gruntwork-io/terragrunt/issues/1944\n\t\t\tcanonicalPath, err := util.CanonicalPath(includeConfig.Path, module.Path)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif util.ListContainsElement(modulesThatIncludeCanonicalPath, canonicalPath) {\n\t\t\t\tmodule.FlagExcluded = false\n\t\t\t}\n\t\t}\n\n\t\t// Also search module dependencies and exclude if the dependency path doesn't include any of the specified\n\t\t// paths, using a similar logic.\n\t\tfor _, dependency := range module.Dependencies {\n\t\t\tif dependency.FlagExcluded {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdependency.FlagExcluded = true\n\t\t\tfor _, includeConfig := range dependency.Config.ProcessedIncludes {\n\t\t\t\tcanonicalPath, err := util.CanonicalPath(includeConfig.Path, module.Path)\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 util.ListContainsElement(modulesThatIncludeCanonicalPath, canonicalPath) {\n\t\t\t\t\tdependency.FlagExcluded = false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn modules, nil\n}", "title": "" }, { "docid": "3c8ee5393e1d0919aa7c5871b3b3e45d", "score": "0.5098166", "text": "func analyzePaths(paths, types, exclude []string) (typesRes, excludeRes []string, errRes error) {\n\tvar err error\n\texc := make([]string, 0)\n\tif types[0] == \"\" { // if '--type' flag was given skip file analyzing\n\t\ttypes, exc, err = analyzer.Analyze(paths)\n\t\tif err != nil {\n\t\t\tlog.Err(err)\n\t\t\treturn []string{}, []string{}, err\n\t\t}\n\t\tlog.Info().Msgf(\"Loading queries of type: %s\", strings.Join(types, \", \"))\n\t}\n\texclude = append(exclude, exc...)\n\treturn types, exclude, nil\n}", "title": "" }, { "docid": "448f6098773158854ed001eb6b502d72", "score": "0.5060564", "text": "func (r Report) ExcludeRegexp(pattern ...string) (result Report) {\n\tif len(pattern) == 0 {\n\t\treturn r\n\t}\n\n\tregexps := make([]*regexp.Regexp, len(pattern))\n\tfor i := range pattern {\n\t\tregexps[i] = regexp.MustCompile(pattern[i])\n\t}\n\n\treturn r.filter(func(filterPath *ytbx.Path) bool {\n\t\tfor _, regexp := range regexps {\n\t\t\tif filterPath != nil && regexp.MatchString(filterPath.String()) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "07d7d148f602260f6d44e4e0d013d609", "score": "0.505996", "text": "func findConfFiles(path string, fileExtention string, excludeDir []string) (configFiles []string) {\n exitErr := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {\n fileInfo, err := os.Stat(path)\n if err != nil {\n return err\n }\n //exclude directories\n if info.IsDir() && len(excludeDir) > 0 {\n for _, dirname := range excludeDir {\n if dirname == info.Name() {\n return filepath.SkipDir\n }\n }\n }\n //filter configFiles based on file extention\n mode := fileInfo.Mode()\n if mode.IsRegular() {\n if filepath.Ext(path) == fileExtention {\n if _,exist := find(excludeDir,fileInfo.Name()); !exist{\n configFiles = append(configFiles, path)\n }\n }\n return nil\n }\n return nil\n })\n if exitErr != nil {\n panic(fmt.Sprintf(\"%v\",exitErr))\n }\n // exit if nothing found\n if !(len(configFiles) > 0) {\n panic(fmt.Sprintf(\"no config files found in '%v'\", path))\n }\n return configFiles\n}", "title": "" }, { "docid": "12ec82d63d4f2351b64aa158bae479da", "score": "0.5059425", "text": "func AllFilePathsIn(dirPath string, ignoreSubPath string, fileName ustr.Pat) (allFilePaths []string) {\n if ignoreSubPath != \"\" && !ustr.Pref(ignoreSubPath, dirPath) {\n ignoreSubPath = filepath.Join(dirPath, ignoreSubPath)\n }\n ok1, ok2 := ignoreSubPath == \"\", fileName == \"\"\n WalkAllFiles(dirPath, func(curfilepath string, _ os.FileInfo) (keepwalking bool) {\n if (ok1 || !ustr.Pref(curfilepath, ignoreSubPath)) && (ok2 || fileName.Match(filepath.Base(curfilepath))) {\n allFilePaths = append(allFilePaths, curfilepath)\n }\n return true\n })\n return\n}", "title": "" }, { "docid": "751a4a459389cf9f150cc628aeeac020", "score": "0.5046197", "text": "func IgnorePatterns(cfg *mybase.Config) ([]tengo.ObjectPattern, error) {\n\tvar patterns []tengo.ObjectPattern\n\tfor _, opt := range ignoreOptionToTypes {\n\t\tre, err := cfg.GetRegexp(opt.optionName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t} else if re != nil {\n\t\t\tfor _, objType := range opt.types {\n\t\t\t\tpatterns = append(patterns, tengo.ObjectPattern{Type: objType, Pattern: re})\n\t\t\t}\n\t\t}\n\t}\n\treturn patterns, nil\n}", "title": "" }, { "docid": "650ce83845e5d0452aba42a75e66bfa7", "score": "0.50442266", "text": "func (c Config) ExcludeFilesOrDefault() []string {\n\tif c.ExcludeFiles != nil {\n\t\treturn c.ExcludeFiles\n\t}\n\treturn DefaultExcludeFiles\n}", "title": "" }, { "docid": "860254ea3af72f5572d0e0e6df840e13", "score": "0.5030794", "text": "func filterFilenames(bctx build.Context, inputs []string) ([]string, error) {\n\toutputs := []string{}\n\n\tfor _, filename := range inputs {\n\t\tfullPath, err := filepath.Abs(filename)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdir, base := filepath.Split(fullPath)\n\n\t\tmatches, err := bctx.MatchFile(dir, base)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif matches {\n\t\t\toutputs = append(outputs, filename)\n\t\t}\n\t}\n\treturn outputs, nil\n}", "title": "" }, { "docid": "3f2566bf30c9118167cf7d476b404c22", "score": "0.50175774", "text": "func (c *Config) IsExcludedPath(path string) bool {\n\tfor _, matcher := range c.ExcludeFiles {\n\t\tif matcher.MatchString(path) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8abd8e66b7788147a0bcfe18a618bdaf", "score": "0.501063", "text": "func ignoreStrToMap(s string) map[string]bool {\n\tm := map[string]bool{}\n\tfor _, dir := range strings.Split(s, \",\") {\n\t\tif dir != \"\" {\n\t\t\t// Clean up trailing slashes if present\n\t\t\tm[filepath.Clean(dir)] = true\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "b7487e85e40b4f16f379329061f59afe", "score": "0.5008125", "text": "func importPathsNoDotExpansion(args []string) []string {\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\tvar out []string\n\tfor _, a := range args {\n\t\t// Arguments are supposed to be import paths, but\n\t\t// as a courtesy to Windows developers, rewrite \\ to /\n\t\t// in command-line arguments. Handles .\\... and so on.\n\t\tif filepath.Separator == '\\\\' {\n\t\t\ta = strings.Replace(a, `\\`, `/`, -1)\n\t\t}\n\n\t\t// Put argument in canonical form, but preserve leading ./.\n\t\tif strings.HasPrefix(a, \"./\") {\n\t\t\ta = \"./\" + path.Clean(a)\n\t\t\tif a == \"./.\" {\n\t\t\t\ta = \".\"\n\t\t\t}\n\t\t} else {\n\t\t\ta = path.Clean(a)\n\t\t}\n\t\tif a == allPackage || a == standardPackages {\n\t\t\tout = append(out, allPackages(a)...)\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, a)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "f83d27c11163d1becb2157b623099b2e", "score": "0.4967855", "text": "func TestExcludeOverride(t *testing.T) {\n\tbaseTest(t, []string{\"LICENSE.*\\n\", \"!LICENSE.md\\n\", \"*.md\"}, []string{\"LICENSE.foo\", \"LICENSE.md\"}, []string{\"foo.bar\"})\n}", "title": "" }, { "docid": "8c2b8a6e24b8d946bfe5d92d7ba041c9", "score": "0.4954445", "text": "func (o ArgoCDSpecOutput) ResourceExclusions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ArgoCDSpec) *string { return v.ResourceExclusions }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d07aef05283e487491eaeb4da947beec", "score": "0.49488562", "text": "func accountPathsToVerificationRegexes(paths []string) []*regexp.Regexp {\n\tregexes := make([]*regexp.Regexp, 0, len(paths))\n\tfor _, path := range paths {\n\t\tlog := log.With().Str(\"path\", path).Logger()\n\t\tparts := strings.Split(path, \"/\")\n\t\tif len(parts) == 0 || len(parts[0]) == 0 {\n\t\t\tlog.Debug().Msg(\"Invalid path\")\n\t\t\tcontinue\n\t\t}\n\t\tif len(parts) == 1 {\n\t\t\tparts = append(parts, \".*\")\n\t\t}\n\t\tif len(parts[1]) == 0 {\n\t\t\tparts[1] = \".*\"\n\t\t}\n\t\tparts[0] = strings.TrimPrefix(parts[0], \"^\")\n\t\tparts[0] = strings.TrimSuffix(parts[0], \"$\")\n\t\tparts[1] = strings.TrimPrefix(parts[1], \"^\")\n\t\tparts[1] = strings.TrimSuffix(parts[1], \"$\")\n\t\tspecifier := fmt.Sprintf(\"^%s/%s$\", parts[0], parts[1])\n\t\tregex, err := regexp.Compile(specifier)\n\t\tif err != nil {\n\t\t\tlog.Warn().Str(\"specifier\", specifier).Err(err).Msg(\"Invalid path regex\")\n\t\t\tcontinue\n\t\t}\n\t\tregexes = append(regexes, regex)\n\t}\n\treturn regexes\n}", "title": "" }, { "docid": "bf2b1f4e198138ce18986595d39ddc3d", "score": "0.49430722", "text": "func (r Report) Filter(paths ...string) (result Report) {\n\tif len(paths) == 0 {\n\t\treturn r\n\t}\n\n\treturn r.filter(func(filterPath *ytbx.Path) bool {\n\t\tfor _, pathString := range paths {\n\t\t\tpath, err := ytbx.ParsePathStringUnsafe(pathString)\n\t\t\tif err == nil && filterPath != nil && path.String() == filterPath.String() {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t})\n}", "title": "" }, { "docid": "02d26778454da8eb00fb7b3347a402bc", "score": "0.4941266", "text": "func (s *Site) Exclude(siteRel string) bool {\n\tfor siteRel != \".\" {\n\t\tdir, base := filepath.Dir(siteRel), filepath.Base(siteRel)\n\t\tswitch {\n\t\tcase utils.MatchList(s.cfg.Include, siteRel):\n\t\t\treturn false\n\t\tcase utils.MatchList(s.cfg.Exclude, siteRel):\n\t\t\treturn true\n\t\tcase dir != \".\" && base[0] == '_':\n\t\t\treturn true\n\t\tdefault:\n\t\t\tif excludeFileRE.MatchString(base) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\tsiteRel = dir\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c846f9264accb8edfd4c050bdb211f19", "score": "0.4939695", "text": "func (s *Site) affectsBuildFilter(paths []string) []string {\n\tvar (\n\t\tresult = make([]string, 0, len(paths))\n\t\tseen = map[string]bool{}\n\t)\nloop:\n\tfor _, path := range paths {\n\t\tswitch {\n\t\tcase s.cfg.IsConfigPath(path):\n\t\t\t// break\n\t\tcase !s.fileAffectsBuild(path):\n\t\t\tcontinue loop\n\t\tcase seen[path]:\n\t\t\tcontinue loop\n\t\t}\n\t\tresult = append(result, path)\n\t\tseen[path] = true\n\t}\n\treturn result\n}", "title": "" }, { "docid": "97aee29dee3589941cc7408ba57087ec", "score": "0.49367243", "text": "func (o IndexingPolicyResponseOutput) ExcludedPaths() ExcludedPathResponseArrayOutput {\n\treturn o.ApplyT(func(v IndexingPolicyResponse) []ExcludedPathResponse { return v.ExcludedPaths }).(ExcludedPathResponseArrayOutput)\n}", "title": "" }, { "docid": "b7feee4a5ceffde949d5a7bc9a811ddb", "score": "0.49338794", "text": "func (rmc *RMakeConf) LoadIgnores(igfile string) {\n\tfi, err := os.Open(igfile)\n\tif err != nil {\n\t\treturn\n\t}\n\tscan := bufio.NewScanner(fi)\n\tfor scan.Scan() {\n\t\trmc.ignore = append(rmc.ignore, scan.Text())\n\t}\n}", "title": "" }, { "docid": "3ab279c045720f3067c528f50fc6c241", "score": "0.49320737", "text": "func filterFiles(bctx build.Context, inputs []string) ([]string, error) {\n\tvar outputs []string\n\tfor _, input := range inputs {\n\t\tif match, _, _, err := matchFile(bctx, input, false); err != nil {\n\t\t\treturn nil, err\n\t\t} else if match {\n\t\t\toutputs = append(outputs, input)\n\t\t}\n\t}\n\treturn outputs, nil\n}", "title": "" }, { "docid": "7935756277b0cab16c4429ed9dfcd78c", "score": "0.49243522", "text": "func onlyRelevantFiles(p string, fi os.FileInfo, err error, fn func(p string) error) error {\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif fi.IsDir() {\n\t\tbase := filepath.Base(p)\n\t\tif strings.HasPrefix(base, \"_\") {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tfor _, n := range []string{\"vendor\", \"node_modules\", \".git\"} {\n\t\t\tif base == n {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\text := filepath.Ext(p)\n\tif ext != \".go\" {\n\t\treturn nil\n\t}\n\n\treturn fn(p)\n}", "title": "" }, { "docid": "dca36141cafdba4642ad82b8de6903ae", "score": "0.49230784", "text": "func NewForbiddenPaths(paths []string) (*ForbiddenPaths, error) {\n\n\tfp := ForbiddenPaths{\n\t\tPaths: make([]*regexp.Regexp, len(paths)),\n\t}\n\n\tfor i, f := range paths {\n\t\tre, err := regexp.Compile(\"(?i)\" + f) // case-insensitive\n\t\tif err != nil {\n\t\t\treturn nil, ErrConfigurationError{fmt.Sprintf(\"could not compile forbidden path %d regexp: '%s': %s\\n\", i, f, err)}\n\t\t}\n\t\tfp.Paths[i] = re\n\t}\n\n\treturn &fp, nil\n}", "title": "" }, { "docid": "4cb4a66134461f123ae7b8eb31d6e686", "score": "0.48972967", "text": "func pkgPaths(projectDir string, exclude matcher.Matcher) ([]string, error) {\n\tpkgs, err := pkgpath.PackagesInDir(projectDir, exclude)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to list packages in %s\", projectDir)\n\t}\n\tresultPkgPaths, err := pkgs.Paths(pkgpath.Relative)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get relative paths for packages %v\", pkgs)\n\t}\n\treturn resultPkgPaths, nil\n}", "title": "" }, { "docid": "84107a2ecdf401085255529433ef2cae", "score": "0.48937976", "text": "func (o ConfigurationAntimalwareOutput) Exclusions() ConfigurationAntimalwareExclusionsPtrOutput {\n\treturn o.ApplyT(func(v ConfigurationAntimalware) *ConfigurationAntimalwareExclusions { return v.Exclusions }).(ConfigurationAntimalwareExclusionsPtrOutput)\n}", "title": "" }, { "docid": "eeede6fa934e2f13623f6d25aa6a253c", "score": "0.48789442", "text": "func flagIncludedDirs(modules []*TerraformModule, terragruntOptions *options.TerragruntOptions) ([]*TerraformModule, error) {\n\n\t// If no IncludeDirs is specified return the modules list instantly\n\tif len(terragruntOptions.IncludeDirs) == 0 {\n\t\t// If we aren't given any include directories, but are given the strict include flag,\n\t\t// return no modules.\n\t\tif terragruntOptions.StrictInclude {\n\t\t\treturn []*TerraformModule{}, nil\n\t\t}\n\t\treturn modules, nil\n\t}\n\n\tfor _, module := range modules {\n\t\tif findModuleInPath(module, terragruntOptions.IncludeDirs) {\n\t\t\tmodule.FlagExcluded = false\n\t\t} else {\n\t\t\tmodule.FlagExcluded = true\n\t\t}\n\t}\n\n\t// Mark all affected dependencies as included before proceeding if not in strict include mode.\n\tif !terragruntOptions.StrictInclude {\n\t\tfor _, module := range modules {\n\t\t\tif !module.FlagExcluded {\n\t\t\t\tfor _, dependency := range module.Dependencies {\n\t\t\t\t\tdependency.FlagExcluded = false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn modules, nil\n}", "title": "" }, { "docid": "3d0ef72ab914925054274485ccc02ecf", "score": "0.48745307", "text": "func (d Dir) SearchPaths() []string {\n\tif d.env == \"\" {\n\t\tpanic(\"xdgdir.Dir.SearchPaths() on zero Dir\")\n\t}\n\tvar paths []string\n\tif p := d.Path(); p != \"\" {\n\t\tpaths = append(paths, p)\n\t}\n\tif d.dirsEnv == \"\" {\n\t\treturn paths\n\t}\n\te := getenv(d.dirsEnv)\n\tif e == \"\" {\n\t\tpaths = append(paths, d.dirsFallback...)\n\t\treturn paths\n\t}\n\tepaths := filepath.SplitList(e)\n\tn := 0\n\tfor _, p := range epaths {\n\t\tif isValidPath(p) {\n\t\t\tepaths[n] = p\n\t\t\tn++\n\t\t}\n\t}\n\tpaths = append(paths, epaths[:n]...)\n\treturn paths\n}", "title": "" }, { "docid": "2529e2764573faafa922249e44960e4a", "score": "0.4874037", "text": "func mustGlobFiles(pattern string) []string {\n\tmatches, err := filepath.Glob(pattern)\n\tif matches == nil {\n\t\tpanic(\"Unable to locate required template files in working dir that match: \" + pattern)\n\t} else if err != nil {\n\t\tpanic(err) // Programmer error, bad glob pattern\n\t}\n\treturn matches\n}", "title": "" }, { "docid": "47f5ae38be4d02e1e023cacce2373e54", "score": "0.48719797", "text": "func VCSPatterns(domain []string) []gitignore.Pattern {\n\tvar ps []gitignore.Pattern\n\tfor _, p := range strings.Split(ExcludeVCS, \",\") {\n\t\tps = append(ps, gitignore.ParsePattern(p, domain))\n\t}\n\treturn ps\n}", "title": "" }, { "docid": "2f08459aeab605ead1fed187e5108dfb", "score": "0.48519546", "text": "func (o DotnetSettingsOutput) IgnoredResources() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v DotnetSettings) []string { return v.IgnoredResources }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "05eaacd8a3f7dc61de0f757d09a1261f", "score": "0.48372734", "text": "func ModifiedDirectoriesExcludeGlobs(globs ...string) ModifiedDirectoriesOption {\n\treturn func(opts *ModifiedDirectoriesOptions) {\n\t\topts.ExcludeGlobs = globs\n\t}\n}", "title": "" }, { "docid": "ecda3317eb231bedba8be55f6463a27f", "score": "0.48370588", "text": "func GetBlacklistedFileNameContents() []string {\n\treturn []string{\"sample\"}\n}", "title": "" }, { "docid": "2a11403f805a0e8266425a083ed7b6cf", "score": "0.48204982", "text": "func getCleanDirs(outDir string, manifest []ManifestEntry) ([]string, error) {\n\tdirs := []string{}\n\toutFiles := []string{}\n\tfor _, m := range manifest {\n\t\tif m.OutFile != \"\" && strings.HasPrefix(m.OutFile, outDir) {\n\t\t\toutFiles = append(outFiles, m.OutFile)\n\t\t}\n\t}\n\n\terr := filepath.Walk(outDir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"prevent panic by handling failure accessing a path %q: %v\\n\", path, err)\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() {\n\t\t\tif !stringSliceContainsPrefix(dirs, path) && !stringSliceHasPrefix(outFiles, path) {\n\t\t\t\tdirs = append(dirs, path)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn dirs, err\n}", "title": "" }, { "docid": "8693e128ab47894d4e4aff7d6e8e213e", "score": "0.48113284", "text": "func (d *BackupDescriptor) Exclude(classes []string) {\n\tif len(classes) == 0 {\n\t\treturn\n\t}\n\tset := make(map[string]struct{}, len(classes))\n\tfor _, cls := range classes {\n\t\tset[cls] = struct{}{}\n\t}\n\tpred := func(s string) bool {\n\t\t_, ok := set[s]\n\t\treturn !ok\n\t}\n\td.Filter(pred)\n}", "title": "" }, { "docid": "cd5f1d19ae95a26410f16536541f10ee", "score": "0.47973225", "text": "func (o IndexingPolicyResponsePtrOutput) ExcludedPaths() ExcludedPathResponseArrayOutput {\n\treturn o.ApplyT(func(v *IndexingPolicyResponse) []ExcludedPathResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ExcludedPaths\n\t}).(ExcludedPathResponseArrayOutput)\n}", "title": "" }, { "docid": "4e345d965b29bfb7d1a8dd01a497faa1", "score": "0.47762063", "text": "func (c Config) ShouldExcludePath(path string) bool {\n\tif strings.HasSuffix(path, \"t8.hcl\") ||\n\t\tstrings.HasSuffix(path, \"t8.yml\") ||\n\t\tstrings.HasSuffix(path, \"before.t8\") ||\n\t\tstrings.HasSuffix(path, \"after.t8\") {\n\t\treturn true\n\t}\n\n\tfor _, excludePath := range c.ExcludePaths {\n\t\tif isUnconditionalExcludePath(excludePath) {\n\t\t\tfor _, excludePath := range excludePath.Paths {\n\t\t\t\tmatched, _ := regexp.MatchString(excludePath, path)\n\t\t\t\tif matched {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, param := range c.Parameters {\n\n\t\t\tif isConditionalExcludePath(excludePath) {\n\t\t\t\tif excludePath.ParameterName == param.Name {\n\n\t\t\t\t\tif excludePath.Operator == NotEqual && excludePath.ParameterValue != param.Actual {\n\t\t\t\t\t\tfor _, excludePath := range excludePath.Paths {\n\t\t\t\t\t\t\tmatched, _ := regexp.MatchString(excludePath, path)\n\t\t\t\t\t\t\tif matched {\n\t\t\t\t\t\t\t\treturn true\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 excludePath.Operator == Equal && excludePath.ParameterValue == param.Actual {\n\t\t\t\t\t\tfor _, excludePath := range excludePath.Paths {\n\t\t\t\t\t\t\tmatched, _ := regexp.MatchString(excludePath, path)\n\t\t\t\t\t\t\tif matched {\n\t\t\t\t\t\t\t\treturn true\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 false\n}", "title": "" }, { "docid": "c85c4cab74b646f086506b0aeb762085", "score": "0.4768392", "text": "func ExcludeAll(src, rejects []string) []string {\n\treturn CollectExcludedAll(src, rejects, GetAll)\n}", "title": "" }, { "docid": "49c3ee2f7eb09b6277fcbe491b090345", "score": "0.47652608", "text": "func ExcludeStrings(strs []string, excludes []string) []string {\n\tcache := make(map[string]bool)\n\tfor _, s := range excludes {\n\t\tcache[s] = true\n\t}\n\tss := make([]string, 0, len(strs))\n\tfor _, s := range strs {\n\t\tif _, ok := cache[s]; ok == false {\n\t\t\tss = append(ss, s)\n\t\t}\n\t}\n\treturn ss\n}", "title": "" }, { "docid": "223f476623722b633fc4f53b93f4a0b2", "score": "0.47633854", "text": "func TestDirIgnoreFile(t *testing.T) {\n\t// Init test files\n\tcurDir, _ := os.Getwd()\n\ttmpDir := filepath.Join(curDir, \"./tmp\")\n\tdefer os.RemoveAll(tmpDir)\n\tmakeTmpFiles(tmpDir, []string{\n\t\t\".git\",\n\t\t\"app.js\",\n\t\t\"package.json\",\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/store.ts\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t\t\"src/service/home.js\",\n\t\t\"src/service/user.js\",\n\t\t\"src/service/test.js\",\n\t})\n\n\tpatterns := []string{\n\t\t\"src/**/*.js\",\n\t\t\"!src/service/home.js\",\n\t}\n\n\t// Match the patterns\n\tfiles := Match(patterns, Option{BaseDir: tmpDir})\n\t// Expected match files:\n\texpected := []string{\n\t\t\"src/router.js\",\n\t\t\"src/store.js\",\n\t\t\"src/api/home.js\",\n\t\t\"src/api/user.js\",\n\t\t\"src/api/test.js\",\n\t\t\"src/service/user.js\",\n\t\t\"src/service/test.js\",\n\t}\n\tif checkFiles(tmpDir, files, expected) {\n\t\tt.Errorf(\"files not match, expected %v, but got %v\", expected, files)\n\t}\n}", "title": "" }, { "docid": "6bc837599ea998a6baeeffa63a3ca699", "score": "0.47612894", "text": "func (o ArgoCDSpecPtrOutput) ResourceExclusions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ArgoCDSpec) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceExclusions\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e6f2f237bf0efa44c5ada5ae547cfc9a", "score": "0.47609016", "text": "func (m *resourcesMatcher) excludeApps(appNames []string) *resourcesMatcher {\n\tam := make(map[string]struct{})\n\tfor _, n := range appNames {\n\t\tif n != \"\" {\n\t\t\tam[n] = struct{}{}\n\t\t}\n\t}\n\tm.resources = resourcesFilter(m.resources, func(r unstructured.Unstructured) bool {\n\t\ta := r.GetAnnotations()\n\t\tif a == nil {\n\t\t\treturn true\n\t\t}\n\t\tif _, ok := am[a[_const.NocalhostApplicationName]]; ok {\n\t\t\treturn false\n\t\t}\n\t\tif _, ok := am[a[_const.HelmReleaseName]]; ok {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\treturn m\n}", "title": "" }, { "docid": "10c125a267db117930f638016701a91f", "score": "0.4743084", "text": "func WithExcludePath(value string) Option {\n\treturn func(opts *options) error {\n\t\t// Compile RegExp first\n\t\tr, err := regexp.Compile(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to compile `%s` as a valid regexp: %w\", value, err)\n\t\t}\n\n\t\t// Append to exclusions\n\t\topts.exclusions = append(opts.exclusions, r)\n\n\t\t// No error\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ce734e6ec4d9e3de96561e22ef5c702a", "score": "0.4738573", "text": "func ListExternalAgentPaths(root string) []string {\n\tvar agentPaths []string\n\tfiles, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\tlog.WithError(err).Warning(\"Cannot list external agents\")\n\t\treturn agentPaths\n\t}\n\tfor _, file := range files {\n\t\tif !file.IsDir() {\n\t\t\tagentPaths = append(agentPaths, path.Join(root, file.Name()))\n\t\t}\n\t}\n\treturn agentPaths\n}", "title": "" }, { "docid": "bc685bbbafbcae9d632ecc3742f6dae5", "score": "0.47154006", "text": "func TestExclusionPatternMatchesWholeDirectory(t *testing.T) {\n\tmatch, _ := Matches(\".\", []string{\"*.go\"})\n\tif match != false {\n\t\tt.Errorf(\"failed to get false match on ., got %v\", match)\n\t}\n}", "title": "" }, { "docid": "3ff5f2f4a36ea12e3cec2e25a2b4fc16", "score": "0.47070926", "text": "func IgnoreDir(dir string) bool {\n\tfor _, s := range Cfg.Run.IgnoreDirs {\n\t\tif strings.Contains(dir, s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a459de43babc27dd079c28874025b92c", "score": "0.4686997", "text": "func requestedFilesToRelativePaths(filteredFiles []string) ([]string, error) {\n\tfilterProvided := len(filteredFiles) > 0\n\tfileNamesIncluded := make(map[string]bool)\n\n\tif filterProvided {\n\t\tlog.Printf(\"Limit archive to files: %v\\n\", filteredFiles)\n\n\t\tfor _, name := range filteredFiles {\n\t\t\tfileNamesIncluded[name] = true\n\t\t}\n\t}\n\n\tfilesToArchive, err := files.ListFiles(conf.StorageFolder, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif filterProvided {\n\t\tvar filteredFileList []files.File\n\t\tfor _, file := range filesToArchive {\n\t\t\tif fileNamesIncluded[file.Name] {\n\t\t\t\tfilteredFileList = append(filteredFileList, file)\n\t\t\t}\n\t\t}\n\t\tlog.Printf(\"Reduced number of files in archive from %d to %d based on user provided filter.\\n\", len(filesToArchive), len(filteredFileList))\n\t\tfilesToArchive = filteredFileList\n\t}\n\n\t// Convert []File to []string\n\tstrFiles := make([]string, len(filesToArchive))\n\tfor i, file := range filesToArchive {\n\t\tstrFiles[i] = fmt.Sprintf(\"%s/%s\", conf.StorageFolder, file.Name)\n\t}\n\n\treturn strFiles, nil\n}", "title": "" }, { "docid": "e8036e3a965f6de4734393628021c562", "score": "0.46833202", "text": "func getFiles(includePath string, fileFilter string) []string {\n\tvar includeFiles []string\n\tfiles, err := ioutil.ReadDir(includePath)\n\tcheckForError(err)\n\tfor _, fileInfo := range files {\n\t\tif !fileInfo.IsDir() {\n\t\t\tfilePath := path.Join(includePath, fileInfo.Name())\n\t\t\tr, err := regexp.MatchString(fileFilter, fileInfo.Name())\n\t\t\tif err == nil && r {\n\t\t\t\tincludeFiles = append(includeFiles, filePath)\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"file\": filePath,\n\t\t\t\t}).Debug(\"Adding file to list\")\n\t\t\t} else {\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"file\": filePath,\n\t\t\t\t}).Debug(\"Ignoring file\")\n\t\t\t}\n\t\t}\n\t}\n\treturn includeFiles\n}", "title": "" }, { "docid": "d52a8daada770cdf73d34c065feb10dd", "score": "0.4679307", "text": "func Exclude(attributes ...string) Options {\n\treturn exclude{attributes: attributes}\n}", "title": "" }, { "docid": "e26f1d00ff6e19c5785afe0d211f379c", "score": "0.46765545", "text": "func (d *DistributedBackupDescriptor) Exclude(classes []string) {\n\tif len(classes) == 0 {\n\t\treturn\n\t}\n\tset := make(map[string]struct{}, len(classes))\n\tfor _, cls := range classes {\n\t\tset[cls] = struct{}{}\n\t}\n\tpred := func(s string) bool {\n\t\t_, ok := set[s]\n\t\treturn !ok\n\t}\n\td.Filter(pred)\n}", "title": "" }, { "docid": "38ede40772bdd175b03b96f0e7621872", "score": "0.46751222", "text": "func pathDirs() []string {\n\treturn nil\n}", "title": "" }, { "docid": "37e4cf855fee7f9c3b7eb6b17c4315d9", "score": "0.46710882", "text": "func LoadIgnorePatterns(dir string, domain []string) ([]gitignore.Pattern, error) {\n\tps, err := ReadIgnoreFile(filepath.Join(dir, IgnoreFile), domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfis, err := os.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, fi := range fis {\n\t\tif fi.IsDir() && fi.Name() != \".git\" {\n\t\t\tvar subps []gitignore.Pattern\n\t\t\tsubps, err = LoadIgnorePatterns(filepath.Join(dir, fi.Name()), append(domain, fi.Name()))\n\t\t\tif len(subps) > 0 {\n\t\t\t\tps = append(ps, subps...)\n\t\t\t}\n\t\t}\n\t}\n\treturn ps, nil\n}", "title": "" }, { "docid": "805d9d35bbb63ae70f727bae7cb5f5bb", "score": "0.466397", "text": "func CollectExcludedAllContrived(src, rejects []string, collect Collector) []string {\n\tvar lastExcluded string\n\treturn CollectVariety(\n\t\tsrc,\n\t\trejects,\n\t\tfunc(dest []string, item string) []string {\n\t\t\tif item != lastExcluded {\n\t\t\t\treturn collect(dest, item)\n\t\t\t}\n\t\t\treturn dest\n\t\t},\n\t\tfunc(dest []string, item string) []string {\n\t\t\tlastExcluded = item\n\t\t\treturn dest\n\t\t},\n\t\tNoOp)\n}", "title": "" }, { "docid": "999b2335090a974056a448471954e85f", "score": "0.466235", "text": "func skip(key, path string, user *user.User, conf *config.Config) bool {\n\tfor _, exclude := range vcsSetting(key, conf) {\n\t\tif strings.HasPrefix(path, exclude) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "874b2937cb47e1c45c23fbf788e29f45", "score": "0.46622562", "text": "func DockerComposeServicesExcluding(excluded []string) []string {\n\tservices := getDockerComposeMap(\"docker-compose.yml\")\n\tif file := os.Getenv(\"LC_BASE_COMPOSE_FILE\"); len(file) > 0 {\n\t\tfor k, v := range getDockerComposeMap(file) {\n\t\t\tif _, ok := services[k]; !ok {\n\t\t\t\tservices[k] = v\n\t\t\t}\n\t\t}\n\t}\n\tvar filtered []string\n\tfor service, image := range services {\n\t\tvar exclude bool\n\t\tfor _, i := range excluded {\n\t\t\tif image.Image == i {\n\t\t\t\texclude = true\n\t\t\t}\n\t\t}\n\t\tif !exclude {\n\t\t\tfiltered = append(filtered, service)\n\t\t}\n\t}\n\treturn filtered\n}", "title": "" }, { "docid": "5ee07028405191cda1396ccec0268aad", "score": "0.4655569", "text": "func Files(files []string, includePatterns []string, excludePatterns []string) ([]string, error) {\n\tret := []string{}\n\tfor _, file := range files {\n\t\tok, err := shouldInclude(file, includePatterns, excludePatterns)\n\t\tif err != nil {\n\t\t\treturn files, err\n\t\t}\n\t\tif ok {\n\t\t\tret = append(ret, file)\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "9c29f77fe99df1a01065d7589b5705bb", "score": "0.46534902", "text": "func Magefiles(magePath, goos, goarch, goCmd string, stderr io.Writer, isMagefilesDirectory, isDebug bool) ([]string, error) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tdebug.Println(\"time to scan for Magefiles:\", time.Since(start))\n\t}()\n\n\tenv, err := internal.EnvWithGOOS(goos, goarch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdebug.Println(\"getting all files including those with mage tag in\", magePath)\n\tmageFiles, err := listGoFiles(magePath, goCmd, \"mage\", env)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listing mage files: %v\", err)\n\t}\n\n\tif isMagefilesDirectory {\n\t\t// For the magefiles directory, we always use all go files, both with\n\t\t// and without the mage tag, as per normal go build tag rules.\n\t\tdebug.Println(\"using all go files in magefiles directory\", magePath)\n\t\treturn mageFiles, nil\n\t}\n\n\t// For folders other than the magefiles directory, we only consider files\n\t// that have the mage build tag and ignore those that don't.\n\n\tdebug.Println(\"getting all files without mage tag in\", magePath)\n\tnonMageFiles, err := listGoFiles(magePath, goCmd, \"\", env)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listing non-mage files: %v\", err)\n\t}\n\n\t// convert non-Mage list to a map of files to exclude.\n\texclude := map[string]bool{}\n\tfor _, f := range nonMageFiles {\n\t\tif f != \"\" {\n\t\t\tdebug.Printf(\"marked file as non-mage: %q\", f)\n\t\t\texclude[f] = true\n\t\t}\n\t}\n\n\t// filter out the non-mage files from the mage files.\n\tvar files []string\n\tfor _, f := range mageFiles {\n\t\tif f != \"\" && !exclude[f] {\n\t\t\tfiles = append(files, f)\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "34de4d8ecbcfa6aae4daa19227e1b2d3", "score": "0.46482348", "text": "func (r *Search) SourceExcludes_(fields ...string) *Search {\n\tr.values.Set(\"_source_excludes\", strings.Join(fields, \",\"))\n\n\treturn r\n}", "title": "" }, { "docid": "fca505f5a861dccbd4ce23befe16bc8f", "score": "0.46482024", "text": "func commandLineFiles(fnames []string) []string {\n if runtime.GOOS == \"windows\" {\n args := make([]string, 0, len(fnames))\n\n for _, fname := range fnames {\n if matches, err := filepath.Glob(fname); err != nil {\n // not a valid pattern\n args = append(args, fname)\n } else if matches != nil {\n // at least one match\n args = append(args, matches...)\n }\n }\n\n return args\n }\n\n // not a Windows OS\n return fnames\n}", "title": "" }, { "docid": "faea7f496ba565a6eb5368ccad7c5bde", "score": "0.46459976", "text": "func (o RuleMfaOutput) UsersExcludeds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *RuleMfa) pulumi.StringArrayOutput { return v.UsersExcludeds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "26866108f136165273f4d4588dc39b44", "score": "0.46458274", "text": "func (o TaskOutput) Excludes() TaskExcludesPtrOutput {\n\treturn o.ApplyT(func(v *Task) TaskExcludesPtrOutput { return v.Excludes }).(TaskExcludesPtrOutput)\n}", "title": "" }, { "docid": "711d3d51decae1633069c8ddac5febeb", "score": "0.46395454", "text": "func GetPaths(filenames []string) []string {\n\tcfgFolder := getConfigFolderPath()\n\tuserCfgFolder := getUserConfigFolderPath()\n\n\tvar paths []string\n\n\tfor _, name := range filenames {\n\t\tif strings.HasPrefix(name, \"/\") {\n\t\t\tif _, err := os.Stat(name); err == nil {\n\t\t\t\t// File exists and starts with a '/', must be an absolute path\n\t\t\t\tpaths = append(paths, name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tpath := cfgFolder + name\n\t\tuserPath := userCfgFolder + name\n\n\t\tif _, err := os.Stat(userPath); err == nil {\n\t\t\tpaths = append(paths, userPath)\n\t\t} else {\n\t\t\tpaths = append(paths, path)\n\t\t}\n\t}\n\n\treturn paths\n}", "title": "" }, { "docid": "d1ced31398e42830c9339455f402dcd1", "score": "0.46386313", "text": "func UniqueExes(exePaths []string, pathext string) ([]string, error) {\n\tpathExt := strings.Split(strings.ToLower(pathext), \";\")\n\texeFiles := map[string]exeFile{}\n\tresult := []string{}\n\n\tfor _, exePath := range exePaths {\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\texePath = strings.ToLower(exePath) // Windows is case-insensitive\n\t\t}\n\n\t\texe := exeFile{exePath, \"\", \"\"}\n\t\text := filepath.Ext(exePath)\n\n\t\t// We only set the executable extension if PATHEXT is present.\n\t\t// Some macOS builds can contain binaries with periods in their\n\t\t// names and we do not want to strip off suffixes after the period.\n\t\tif funk.Contains(pathExt, ext) {\n\t\t\texe.ext = filepath.Ext(exePath)\n\t\t}\n\t\texe.name = strings.TrimSuffix(filepath.Base(exePath), exe.ext)\n\n\t\tif prevExe, exists := exeFiles[exe.name]; exists {\n\t\t\tpathsEqual, err := fileutils.PathsEqual(filepath.Dir(exe.fpath), filepath.Dir(prevExe.fpath))\n\t\t\tif err != nil {\n\t\t\t\treturn result, errs.Wrap(err, \"Could not compare paths\")\n\t\t\t}\n\t\t\tif !pathsEqual {\n\t\t\t\tcontinue // Earlier PATH entries win\n\t\t\t}\n\t\t\tif funk.IndexOf(pathExt, prevExe.ext) < funk.IndexOf(pathExt, exe.ext) {\n\t\t\t\tcontinue // Earlier PATHEXT entries win\n\t\t\t}\n\t\t}\n\n\t\texeFiles[exe.name] = exe\n\t}\n\n\tfor _, exe := range exeFiles {\n\t\tresult = append(result, exe.fpath)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3f7848ec2a9ea5bd0fc40b4a06ef4e37", "score": "0.46331978", "text": "func pruneNonGoFiles(baseDir string, logger *log.Logger) error {\n\tfiles, err := collectNonGoFiles(baseDir, logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not collect non-Go files\")\n\t}\n\n\tif err := deleteFiles(files); err != nil {\n\t\treturn errors.Wrap(err, \"could not prune Go test files\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5f9fe3421fdad601bdabed93d05f5df7", "score": "0.46331024", "text": "func (o ConfigurationAntimalwarePtrOutput) Exclusions() ConfigurationAntimalwareExclusionsPtrOutput {\n\treturn o.ApplyT(func(v *ConfigurationAntimalware) *ConfigurationAntimalwareExclusions {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Exclusions\n\t}).(ConfigurationAntimalwareExclusionsPtrOutput)\n}", "title": "" } ]
bcf6c3dedd4c41ab0cb5ad5fff27598b
SRGBToLMS_CAT02 converts sRGB to Long, Medium, Short conebased responses, using the CAT02 transform from CIECAM02 color appearance model (MoroneyFairchildHuntEtAl02)
[ { "docid": "7a9d9eb4e6944ba0741930245a0ccaf8", "score": "0.8508635", "text": "func SRGBToLMS_CAT02(r, g, b float32) (l, m, s float32) {\n\trl, gl, bl := SRGBToLinear(r, g, b)\n\tl, m, s = SRGBLinToLMS_CAT02(rl, gl, bl)\n\treturn\n}", "title": "" } ]
[ { "docid": "6e6ca47e7c85f16ceaf9a92d5637c5a0", "score": "0.7833992", "text": "func SRGBLinToLMS_CAT02(rl, gl, bl float32) (l, m, s float32) {\n\tl = 0.3904054*rl + 0.54994122*gl + 0.00892632*bl\n\tm = 0.0708416*rl + 0.96317176*gl + 0.00135775*bl\n\ts = 0.0491304*rl + 0.21556128*gl + 0.9450824*bl\n\treturn\n}", "title": "" }, { "docid": "c503d6efbd716676267df6bfaa28c056", "score": "0.7388675", "text": "func XYZToLMS_CAT02(x, y, z float32) (l, m, s float32) {\n\tl = 0.7328*x + 0.4296*y + -0.1624*z\n\tm = -0.7036*x + 1.6975*y + 0.0061*z\n\ts = 0.0030*x + 0.0136*y + 0.9834*z\n\treturn\n}", "title": "" }, { "docid": "beecffad831dac960e55eac01253ba2b", "score": "0.62787825", "text": "func XyzToLmsMcat02(x, y, z float64) (l, m, s float64) {\n\tl = 0.7328*x + 0.4296*y - 0.1624*z\n\tm = -0.7036*x + 1.6974*y + 0.0061*z\n\ts = 0.0030*x + 0.0136*y + 0.9834*z\n\treturn\n}", "title": "" }, { "docid": "f8422bc3825be6232bca759e02bce4df", "score": "0.6186814", "text": "func LmsMcat02ToXyz(l, m, s float64) (x, y, z float64) {\n\tx = 1.0961*l - 0.2789*m + 0.1827*s\n\ty = 0.4544*l + 0.4736*m + 0.0721*s\n\tz = -0.0096*l - 0.0057*m + 1.0153*s\n\treturn\n}", "title": "" }, { "docid": "1db3f0b5327bf8eec97a7f913bccda28", "score": "0.5304181", "text": "func IntToMcs(id int, catRange uint32) string {\n\tif (id < 1) || (id > 523776) {\n\t\treturn \"\"\n\t}\n\n\tSETSIZE := int(catRange)\n\tTIER := SETSIZE\n\n\tORD := id\n\tfor ORD > TIER {\n\t\tORD = ORD - TIER\n\t\tTIER--\n\t}\n\tTIER = SETSIZE - TIER\n\tORD = ORD + TIER\n\treturn fmt.Sprintf(\"s0:c%d,c%d\", TIER, ORD)\n}", "title": "" }, { "docid": "41cb535b30d4c9d4e403a203ccde0752", "score": "0.49848285", "text": "func LMSToComps(l, m, s float32) (lc, mc, sc, lmc, lvm, svlm, grey float32) {\n\tlrc := ResponseCompression(l)\n\tmrc := ResponseCompression(m)\n\tsrc := ResponseCompression(s)\n\t// subtract min and mult by 6 gets values roughly into 1-0 range for L,M\n\tlc = 6.0 * ((lrc + (1.0/11.0)*src) - 0.109091)\n\tmc = 6.0 * (((12.0 / 11.0) * mrc) - 0.109091)\n\tlvm = lc - mc // red-green subtracting \"criterion for unique yellow\"\n\tlmc = 6.0 * (((1.0 / 9.0) * (lrc + mrc)) - 0.0222222)\n\tsc = 6.0 * (((2.0 / 9.0) * src) - 0.0222222)\n\tsvlm = sc - lmc // blue-yellow contrast\n\tgrey = (1.0 / 0.431787) * (2.0*lrc + mrc + .05*src - 0.305)\n\t// note: last term should be: 0.725 * (1/5)^-0.2 = grey background assumption (Yb/Yw = 1/5) = 1\n\treturn\n}", "title": "" }, { "docid": "ea26bd4b8034067017004eb06fdabd7f", "score": "0.48955595", "text": "func Convert(c[]float64) (error,[]float64) {\nif len(c)!=3{\nreturn errors.New(fmt.Sprintf(\"color dimension=[%d] error\", len(c))), nil\n\t}else{\nc[0],c[1],c[2]=colorful.Color{c[0],c[1],c[2]}.Hsl()\nreturn nil,c\n\t}\n}", "title": "" }, { "docid": "431525768f90b2a4e138d032aba044e8", "score": "0.47136736", "text": "func ReadFormat02(data []byte) (*Format02, error) {\n\n\tif len(data) != 7 {\n\t\treturn nil, fmt.Errorf(\"the data must be 7 bytes long (%v given)\", len(data))\n\t}\n\n\tformatTypeCode := (data[0] & 0xF8) >> 3\n\tif formatTypeCode != adsb.Format02.GetTypeCode() {\n\t\treturn nil, fmt.Errorf(\"the data are given at format %v and can not be read at the format Format02\", formatTypeCode)\n\t}\n\n\treturn &Format02{\n\t\tAircraftCategory: fields2.ReadAircraftCategorySetC(data),\n\t\tAircraftIdentification: fields2.ReadAircraftIdentification(data),\n\t}, nil\n}", "title": "" }, { "docid": "ae59c9d0ccd0d259d8322bf2a0e8483d", "score": "0.45274737", "text": "func (p *RGBAM64) ColorModel() color.Model { return p.Model }", "title": "" }, { "docid": "88acb81b9d7c76ffebdd2596a0154dde", "score": "0.4514196", "text": "func (so *SRGBToOp) Init() {\n\tif so.Levels != 0 {\n\t\treturn\n\t}\n\n\tso.Levels = 64\n\tll := so.Levels\n\tllf := float32(ll)\n\tso.Table.SetShape([]int{int(LMSComponentsN), so.Levels, so.Levels, so.Levels}, nil, []string{\"N\", \"R\", \"G\", \"B\"})\n\t// fmt.Printf(\"table size: %d\\n\", so.Table.Len())\n\tfor bi := 0; bi < ll; bi++ {\n\t\tbf := float32(bi) / llf\n\t\tfor gi := 0; gi < ll; gi++ {\n\t\t\tgf := float32(gi) / llf\n\t\t\tfor ri := 0; ri < ll; ri++ {\n\t\t\t\trf := float32(ri) / llf\n\t\t\t\tlc, mc, sc, lmc, lvm, svlm, grey := SRGBToLMSComps(rf, gf, bf)\n\t\t\t\tso.Table.Set([]int{int(LC), ri, gi, bi}, lc)\n\t\t\t\tso.Table.Set([]int{int(MC), ri, gi, bi}, mc)\n\t\t\t\tso.Table.Set([]int{int(SC), ri, gi, bi}, sc)\n\t\t\t\tso.Table.Set([]int{int(LMC), ri, gi, bi}, lmc)\n\t\t\t\tso.Table.Set([]int{int(LvMC), ri, gi, bi}, lvm)\n\t\t\t\tso.Table.Set([]int{int(SvLMC), ri, gi, bi}, svlm)\n\t\t\t\tso.Table.Set([]int{int(GREY), ri, gi, bi}, grey)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "9c0d39f3c94ec6f8603a1d42feeaab9d", "score": "0.45099846", "text": "func mapColor2RGB(c Color) uint16 {\n\tswitch c {\n\tcase ColorBlack:\n\t\treturn 0\n\t\t// primaries\n\tcase ColorRed:\n\t\treturn 0x4\n\tcase ColorGreen:\n\t\treturn 0x2\n\tcase ColorBlue:\n\t\treturn 0x1\n\tcase ColorYellow:\n\t\treturn 0x6\n\tcase ColorMagenta:\n\t\treturn 0x5\n\tcase ColorCyan:\n\t\treturn 0x3\n\tcase ColorWhite:\n\t\treturn 0x7\n\t// bright variants\n\tcase ColorGrey:\n\t\treturn 0x8\n\tcase ColorBrightRed:\n\t\treturn 0xc\n\tcase ColorBrightGreen:\n\t\treturn 0xa\n\tcase ColorBrightBlue:\n\t\treturn 0x9\n\tcase ColorBrightYellow:\n\t\treturn 0xe\n\tcase ColorBrightMagenta:\n\t\treturn 0xd\n\tcase ColorBrightCyan:\n\t\treturn 0xb\n\tcase ColorBrightWhite:\n\t\treturn 0xf\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "b11f190c613f80fd32195a62e966a4dc", "score": "0.44707057", "text": "func (c *Converted) ColorModel() color.Model{\n return c.Mod\n}", "title": "" }, { "docid": "a33a9cd088e4bb80fea0bd5f21412062", "score": "0.44255334", "text": "func (s SamplesI16) ShiftLSBToMSBBits(bits int) {\n\t// TODO(paultag): This would be pretty straightforward to implement in\n\t// ASM / SIMD; may be a good task for down the road.\n\tshift := 16 - bits\n\tfor i := range s {\n\t\ts[i][0] = s[i][0] << shift\n\t\ts[i][1] = s[i][1] << shift\n\t}\n}", "title": "" }, { "docid": "856d9438395c2e86a78b69d5df1c295c", "score": "0.44190642", "text": "func (*ScaledImu2) Crc() uint8 {\n\treturn 76\n}", "title": "" }, { "docid": "7eb3025c1cf80197e9e109ca944dccd9", "score": "0.44035968", "text": "func TestLightMessageDecoding(t *testing.T) {\n\ta := assert.New(t)\n\tr := bytes.NewReader(setColorMessagePayload)\n\tmsg, err := lifx.DecodeSetColorMessage(r)\n\ta.Nil(err)\n\ta.Equal(uint8(0), msg.Reserved)\n\ta.Equal(uint16(21845), msg.Color.Hue)\n\ta.Equal(uint16(65535), msg.Color.Saturation)\n\ta.Equal(uint16(65535), msg.Color.Brightness)\n\ta.Equal(uint16(3500), msg.Color.Kelvin)\n}", "title": "" }, { "docid": "405812410e029c5897479eb7c04e019f", "score": "0.43792763", "text": "func Newasm6502Lexer(input antlr.CharStream) *asm6502Lexer {\n\tl := new(asm6502Lexer)\n\tlexerDeserializer := antlr.NewATNDeserializer(nil)\n\tlexerAtn := lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn)\n\tlexerDecisionToDFA := make([]*antlr.DFA, len(lexerAtn.DecisionToState))\n\tfor index, ds := range lexerAtn.DecisionToState {\n\t\tlexerDecisionToDFA[index] = antlr.NewDFA(ds, index)\n\t}\n\tl.BaseLexer = antlr.NewBaseLexer(input)\n\tl.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache())\n\n\tl.channelNames = lexerChannelNames\n\tl.modeNames = lexerModeNames\n\tl.RuleNames = lexerRuleNames\n\tl.LiteralNames = lexerLiteralNames\n\tl.SymbolicNames = lexerSymbolicNames\n\tl.GrammarFileName = \"asm6502.g4\"\n\t// TODO: l.EOF = antlr.TokenEOF\n\n\treturn l\n}", "title": "" }, { "docid": "3bd88b8eaeb5036e94ce27399fcf7e09", "score": "0.43682596", "text": "func (p *RGBM64) ColorModel() color.Model { return p.Model }", "title": "" }, { "docid": "213b817a14858fbd93a73e1f98515d57", "score": "0.43183056", "text": "func NewLCD1602Driver(connector i2c.Connector, options ...func(i2c.Config)) (*SunFounderLCD1602Driver, error) {\n\tlcd := &SunFounderLCD1602Driver{\n\t\tname: gobot.DefaultName(\"SunFounderLCD1602Driver\"),\n\t\ti2cConnector: connector,\n\t\tConfig: i2c.NewConfig(),\n\t\ti2cAddr: address,\n\t\tbacklightEnabled: true,\n\t}\n\n\tfor _, option := range options {\n\t\toption(lcd)\n\t}\n\n\treturn lcd, nil\n}", "title": "" }, { "docid": "f9c2d9e46859c9bbed1879415ae5f68c", "score": "0.4317724", "text": "func SRGBLinToLMS_HPE(rl, gl, bl float32) (l, m, s float32) {\n\tl = 0.30567503*rl + 0.62274014*gl + 0.04530167*bl\n\tm = 0.15771291*rl + 0.7697197*gl + 0.08807348*bl\n\ts = 0.0193*rl + 0.1192*gl + 0.9505*bl\n\treturn\n}", "title": "" }, { "docid": "c7093c50f72ff2970f4e81211ddb392d", "score": "0.4307024", "text": "func (p *RGBAM) ColorModel() color.Model { return p.Model }", "title": "" }, { "docid": "895edcd05051d4385f052ac47228694f", "score": "0.4304158", "text": "func NewCMYK(r Rectangle) *CMYK", "title": "" }, { "docid": "3434194d2e3d402f0099cb493ad82b5f", "score": "0.42733985", "text": "func SRGBToLMS_HPE(r, g, b float32) (l, m, s float32) {\n\trl, gl, bl := SRGBToLinear(r, g, b)\n\tl, m, s = SRGBLinToLMS_HPE(rl, gl, bl)\n\treturn\n}", "title": "" }, { "docid": "694c6146aa54dd157009a1fff36b7a15", "score": "0.422203", "text": "func (p *RGBM) ColorModel() color.Model { return p.Model }", "title": "" }, { "docid": "4042926e4ef6296329bd922fb67d712d", "score": "0.42198822", "text": "func (mp MultiPolygon) WGS84ToGCJ02() {\n\tif len(mp) == 0 {\n\t\treturn\n\t}\n\tfor i := 0; i < len(mp); i++ {\n\t\tmp[i].WGS84ToGCJ02()\n\t}\n}", "title": "" }, { "docid": "05b0f6e5ffe26031d529580d3c245778", "score": "0.41862705", "text": "func makeRamp(colorA, colorB string, steps float64) (s []string) {\n\tcA, _ := colorful.Hex(colorA)\n\tcB, _ := colorful.Hex(colorB)\n\n\tfor i := 0.0; i < steps; i++ {\n\t\tc := cA.BlendLuv(cB, i/steps)\n\t\ts = append(s, colorToHex(c))\n\t}\n\treturn\n}", "title": "" }, { "docid": "e585f6020f02bf4dac2d8385637320e7", "score": "0.4181877", "text": "func ColorToTermColor(hex string) []int {\n\tif hex == \"\" {\n\t\treturn []int{}\n\t}\n\n\tfi, _ := os.Stdout.Stat()\n\tif fi.Mode()&os.ModeCharDevice == 0 {\n\t\treturn []int{}\n\t}\n\n\tif c, err := ui.HEX(hex[1:]); err == nil {\n\t\treturn append(\n\t\t\t[]int{38, 2},\n\t\t\tc.Values()...,\n\t\t)\n\t}\n\n\treturn []int{}\n}", "title": "" }, { "docid": "bd40d61e12f80878dc84b30a591e4bc0", "score": "0.41703126", "text": "func (w *Writer) ChromaToStyle(chSt chroma.StyleEntry) *Style {\n\ts := w.GetBacktickStyle()\n\ts.TextColor = color.RGBA{\n\t\tR: chSt.Colour.Red(),\n\t\tG: chSt.Colour.Green(),\n\t\tB: chSt.Colour.Blue(),\n\t}\n\ts.FillColor = color.RGBA{\n\t\tR: chSt.Background.Red(),\n\t\tG: chSt.Background.Green(),\n\t\tB: chSt.Background.Blue(),\n\t}\n\n\tstyleStr := strings.ToUpper(s.format)\n\tif chSt.Bold == chroma.Yes && !strings.Contains(styleStr, \"B\") {\n\t\ts.format += \"B\"\n\t}\n\n\tif chSt.Italic == chroma.Yes && !strings.Contains(styleStr, \"I\") {\n\t\ts.format += \"I\"\n\t}\n\n\tif chSt.Underline == chroma.Yes && !strings.Contains(styleStr, \"U\") {\n\t\ts.format += \"U\"\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "b099ad65d01e546f43085c77137ff0bb", "score": "0.41662094", "text": "func (message Format02) ToString() string {\n\treturn bds08ToString(message)\n}", "title": "" }, { "docid": "e3bd0abf498fe9aa14eeeb56bd0d4057", "score": "0.41642845", "text": "func BenchmarkAddenda02TypeCode02(b *testing.B) {\n\tb.ReportAllocs()\n\tfor i := 0; i < b.N; i++ {\n\t\ttestAddenda02TypeCode02(b)\n\t}\n}", "title": "" }, { "docid": "1606594422af2749d12bb697baed8c8f", "score": "0.41618145", "text": "func CvtColor(src Mat, dst Mat, code ColorConversionCode) {\n\tC.CvtColor(src.p, dst.p, C.int(code))\n}", "title": "" }, { "docid": "aa151f7b8bba966c5627ff8aa02c0fb0", "score": "0.4141433", "text": "func SecondImage(fileName string) {\n\tvar x, y float64\n\tcanv := feature.NewCanvas(100, 100)\n\tred := feature.NewColor(1, 0, 0)\n\ts := feature.NewSphere()\n\t//Add Light in here\n\tl := feature.NewLight()\n\tl.PointLight(*feature.Point(1, 0, -5), *feature.NewColor(0.5, 1, 0.3))\n\tfor i, row := range canv.Canv {\n\t\ty = float64(2) - float64(i)/float64(25)\n\t\tfor j := range row {\n\t\t\tx = float64(-2) + float64(j)/float64(25)\n\t\t\tray := feature.NewRay(*feature.Point(x, y, -5), *feature.Vector(0, 0, 1))\n\t\t\t_, ans, intersect := s.IntersectWithRay(ray)\n\t\t\tif intersect {\n\t\t\t\tcolor := DiffuseLight(ans[0].Position, l, ray, red, *s)\n\t\t\t\tcanv.WritePixel(i, j, color)\n\t\t\t}\n\t\t}\n\t}\n\tcanv.CanvasToPPM(fileName)\n}", "title": "" }, { "docid": "f2838f6552b04f432da05e4db3915d9d", "score": "0.41410592", "text": "func (img *Image) decodeBmpRGB16(r io.Reader, width, height int, topDown, bmp565 bool) error {\n\ttmp, imgData, err := prepareBmpCanvas(width, height, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer bmpClearOnPanic(&tmp)\n\n\t// Each row is 4-byte aligned.\n\tb := make([]byte, (2*width+3)&^3)\n\n\ty0, y1, yDelta := height-1, -1, -1\n\tif topDown {\n\t\ty0, y1, yDelta = 0, height, +1\n\t}\n\n\tstride := width * 3\n\n\tfor y := y0; y != y1; y += yDelta {\n\t\tif _, err = io.ReadFull(r, b); err != nil {\n\t\t\tC.clear_image(&tmp)\n\t\t\treturn err\n\t\t}\n\n\t\tp := imgData[y*stride : (y+1)*stride]\n\t\tfor i, j := 0, 0; i < len(p); i, j = i+3, j+2 {\n\t\t\tpixel := readUint16(b[j:])\n\n\t\t\tif bmp565 {\n\t\t\t\tp[i+0] = uint8((pixel&0xF800)>>11) << 3\n\t\t\t\tp[i+1] = uint8((pixel&0x7E0)>>5) << 2\n\t\t\t} else {\n\t\t\t\tp[i+0] = uint8((pixel&0x7C00)>>10) << 3\n\t\t\t\tp[i+1] = uint8((pixel&0x3E0)>>5) << 3\n\t\t\t}\n\t\t\tp[i+2] = uint8(pixel&0x1F) << 3\n\t\t}\n\t}\n\n\tC.swap_and_clear(&img.VipsImage, tmp)\n\n\treturn nil\n}", "title": "" }, { "docid": "d25e6749604ed4de49b4942f807db82c", "score": "0.41409865", "text": "func translateLevel(c int) *ColorSupport {\n\tvar support = &ColorSupport{Level: c}\n\tswitch {\n\tcase c >= 1:\n\t\tsupport.HasBasic = true\n\t\tfallthrough\n\tcase c >= 2:\n\t\tsupport.Has256 = true\n\t\tfallthrough\n\tcase c == 3:\n\t\tsupport.Has1m = true\n\t\tbreak\n\t}\n\treturn support\n}", "title": "" }, { "docid": "88e3ebac85f6e17fc562ea603f1672b6", "score": "0.41397357", "text": "func Gcj02ToBaidu(lng, lat float64) (float64, float64) {\n\tz := math.Sqrt(lng*lng+lat*lat) + 0.00002*math.Sin(lat*gXPI)\n\ttheta := math.Atan2(lat, lng) + 0.000003*math.Cos(lng*gXPI)\n\treturn z*math.Cos(theta) + 0.0065, z*math.Sin(theta) + 0.006\n}", "title": "" }, { "docid": "f08916d6ed6de452350ddb2b9953b853", "score": "0.4134838", "text": "func CvtColor(src Mat, dst *Mat, code ColorConversionCode) {\n\tC.CvtColor(src.p, dst.p, C.int(code))\n}", "title": "" }, { "docid": "d282bd72a9ecdc2745769d43a0287927", "score": "0.41316894", "text": "func (cmap *CMap) parseSystemInfo() error {\n\tinDict := false\n\tinDef := false\n\tname := \"\"\n\tdone := false\n\tsystemInfo := CIDSystemInfo{}\n\n\t// 50 is a generous but arbitrary limit to prevent an endless loop on badly formed cmap files.\n\tfor i := 0; i < 50 && !done; i++ {\n\t\to, err := cmap.parseObject()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch t := o.(type) {\n\t\tcase cmapDict:\n\t\t\td := t.Dict\n\t\t\tr, ok := d[\"Registry\"]\n\t\t\tif !ok {\n\t\t\t\tcommon.Log.Debug(\"ERROR: Bad System Info\")\n\t\t\t\treturn ErrBadCMap\n\t\t\t}\n\t\t\trr, ok := r.(cmapString)\n\t\t\tif !ok {\n\t\t\t\tcommon.Log.Debug(\"ERROR: Bad System Info\")\n\t\t\t\treturn ErrBadCMap\n\t\t\t}\n\t\t\tsystemInfo.Registry = rr.String\n\n\t\t\tr, ok = d[\"Ordering\"]\n\t\t\tif !ok {\n\t\t\t\tcommon.Log.Debug(\"ERROR: Bad System Info\")\n\t\t\t\treturn ErrBadCMap\n\t\t\t}\n\t\t\trr, ok = r.(cmapString)\n\t\t\tif !ok {\n\t\t\t\tcommon.Log.Debug(\"ERROR: Bad System Info\")\n\t\t\t\treturn ErrBadCMap\n\t\t\t}\n\n\t\t\tsystemInfo.Ordering = rr.String\n\n\t\t\ts, ok := d[\"Supplement\"]\n\t\t\tif !ok {\n\t\t\t\tcommon.Log.Debug(\"ERROR: Bad System Info\")\n\t\t\t\treturn ErrBadCMap\n\t\t\t}\n\t\t\tss, ok := s.(cmapInt)\n\t\t\tif !ok {\n\t\t\t\tcommon.Log.Debug(\"ERROR: Bad System Info\")\n\t\t\t\treturn ErrBadCMap\n\t\t\t}\n\t\t\tsystemInfo.Supplement = int(ss.val)\n\n\t\t\tdone = true\n\t\tcase cmapOperand:\n\t\t\tswitch t.Operand {\n\t\t\tcase \"begin\":\n\t\t\t\tinDict = true\n\t\t\tcase \"end\":\n\t\t\t\tdone = true\n\t\t\tcase \"def\":\n\t\t\t\tinDef = false\n\t\t\t}\n\t\tcase cmapName:\n\t\t\tif inDict {\n\t\t\t\tname = t.Name\n\t\t\t\tinDef = true\n\t\t\t}\n\t\tcase cmapString:\n\t\t\tif inDef {\n\t\t\t\tswitch name {\n\t\t\t\tcase \"Registry\":\n\t\t\t\t\tsystemInfo.Registry = t.String\n\t\t\t\tcase \"Ordering\":\n\t\t\t\t\tsystemInfo.Ordering = t.String\n\t\t\t\t}\n\t\t\t}\n\t\tcase cmapInt:\n\t\t\tif inDef {\n\t\t\t\tswitch name {\n\t\t\t\tcase \"Supplement\":\n\t\t\t\t\tsystemInfo.Supplement = int(t.val)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif !done {\n\t\tcommon.Log.Debug(\"ERROR: Parsed System Info dict incorrectly\")\n\t\treturn ErrBadCMap\n\t}\n\n\tcmap.systemInfo = systemInfo\n\treturn nil\n}", "title": "" }, { "docid": "7e54a7faa0d29adc7279ac0d0c606f5f", "score": "0.4124494", "text": "func (this *Color) fromC(color C.sfColor) {\n\tthis.R = byte(color.r)\n\tthis.G = byte(color.g)\n\tthis.B = byte(color.b)\n\tthis.A = byte(color.a)\n}", "title": "" }, { "docid": "6cb215d8db271c29c492981129f74060", "score": "0.4112514", "text": "func (red RedHat) ConvertToModel(cve *gostmodels.RedhatCVE) *models.CveContent {\n\tcwes := red.parseCwe(cve.Cwe)\n\n\tdetails := []string{}\n\tfor _, detail := range cve.Details {\n\t\tdetails = append(details, detail.Detail)\n\t}\n\n\tv2score := 0.0\n\tif cve.Cvss.CvssBaseScore != \"\" {\n\t\tv2score, _ = strconv.ParseFloat(cve.Cvss.CvssBaseScore, 64)\n\t}\n\tv2severity := \"\"\n\tif v2score != 0 {\n\t\tv2severity = cve.ThreatSeverity\n\t}\n\n\tv3score := 0.0\n\tif cve.Cvss3.Cvss3BaseScore != \"\" {\n\t\tv3score, _ = strconv.ParseFloat(cve.Cvss3.Cvss3BaseScore, 64)\n\t}\n\tv3severity := \"\"\n\tif v3score != 0 {\n\t\tv3severity = cve.ThreatSeverity\n\t}\n\n\tvar refs []models.Reference\n\tfor _, r := range cve.References {\n\t\trefs = append(refs, models.Reference{Link: r.Reference})\n\t}\n\n\treturn &models.CveContent{\n\t\tType: models.RedHatAPI,\n\t\tCveID: cve.Name,\n\t\tTitle: cve.Bugzilla.Description,\n\t\tSummary: strings.Join(details, \"\\n\"),\n\t\tCvss2Score: v2score,\n\t\tCvss2Vector: cve.Cvss.CvssScoringVector,\n\t\tCvss2Severity: v2severity,\n\t\tCvss3Score: v3score,\n\t\tCvss3Vector: cve.Cvss3.Cvss3ScoringVector,\n\t\tCvss3Severity: v3severity,\n\t\tReferences: refs,\n\t\tCweIDs: cwes,\n\t\tMitigation: cve.Mitigation,\n\t\tPublished: cve.PublicDate,\n\t\tSourceLink: \"https://access.redhat.com/security/cve/\" + cve.Name,\n\t}\n}", "title": "" }, { "docid": "e5bdd9de68d8cc71dcabb4df77d67b87", "score": "0.41031843", "text": "func SGR256ColorToString(parts []int) (int, string) {\n\tif len(parts) < 1 {\n\t\tlog.Printf(\"Error parsing 256-color SGR code (bad length). Length: %d, Parts: %v\", len(parts), parts)\n\t\treturn 1, \"fg-white\"\n\t}\n\n\tswitch parts[0] {\n\tcase 2:\n\t\tif len(parts) < 4 {\n\t\t\tlog.Printf(\"Error parsing 256-color SGR code (not enough numbers for RGB). Parts: %v\", parts)\n\t\t\treturn 1, \"fg-white\"\n\t\t} else {\n\t\t\treturn 4, rgbColorToString(parts[1], parts[2], parts[3])\n\t\t}\n\tcase 5:\n\t\tif len(parts) < 2 {\n\t\t\tlog.Printf(\"Error parsing 256-color SGR code (no index for palette). Parts: %v\", parts)\n\t\t\treturn 1, \"fg-white\"\n\t\t} else {\n\t\t\treturn 2, palletizedColorToString(parts[1])\n\t\t}\n\tdefault:\n\t\tlog.Printf(\"Error parsing 256-color SGR code (bad code). Code: %d, Parts: %v\", parts[0], parts)\n\t\treturn 1, \"fg-white\"\n\t}\n}", "title": "" }, { "docid": "829e368d541b5f331e8f2a4a0a6f9f80", "score": "0.40967312", "text": "func (st *EncodingRecordSubtableFormat2) GetCMap() map[int32]uint16 {\n\treturn st.cmap\n}", "title": "" }, { "docid": "d9d5df6e0116f7f067a779e53fdabfe5", "score": "0.40912968", "text": "func Wgs84ToGcj02(lng, lat float64) (float64, float64) {\n\treturn transform(lng, lat)\n}", "title": "" }, { "docid": "2e025f920851e670cd0665a99bca72e9", "score": "0.40819648", "text": "func (m *RcChannelsScaled) Decode(buf []byte) {\n\tdata := bytes.NewBuffer(buf)\n\tbinary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN1_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN2_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN3_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN4_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN5_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN6_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN7_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.CHAN8_SCALED)\n\tbinary.Read(data, binary.LittleEndian, &m.PORT)\n\tbinary.Read(data, binary.LittleEndian, &m.RSSI)\n}", "title": "" }, { "docid": "5e2a0a2c4ca414ec4ee4526974feec0f", "score": "0.40513283", "text": "func (*RcChannelsScaled) Crc() uint8 {\n\treturn 237\n}", "title": "" }, { "docid": "399fd782debfa796d6eeb41b13511b5d", "score": "0.40416375", "text": "func (mp MultiPolygon) GCJ02ToWGS84() {\n\tif len(mp) == 0 {\n\t\treturn\n\t}\n\tfor i := 0; i < len(mp); i++ {\n\t\tmp[i].GCJ02ToWGS84()\n\t}\n}", "title": "" }, { "docid": "39d28ab9a39f263eb8eb2e4608e91731", "score": "0.40407327", "text": "func BaiduToGcj02(lng, lat float64) (float64, float64) {\n\tx := lng - 0.0065\n\ty := lat - 0.006\n\tz := math.Sqrt(x*x+y*y) - 0.00002*math.Sin(y*gXPI)\n\ttheta := math.Atan2(y, x) - 0.000003*math.Cos(x*gXPI)\n\treturn z * math.Cos(theta), z * math.Sin(theta)\n}", "title": "" }, { "docid": "9a6e10f21e78efeaa1fc99d1b65b9387", "score": "0.4022391", "text": "func (a *Client) GetCmRoles(params *GetCmRolesParams) (*GetCmRolesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCmRolesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getCmRoles\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v4/diagnostics/cm/{stackCrn}/roles\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetCmRolesReader{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.(*GetCmRolesOK), nil\n\n}", "title": "" }, { "docid": "c73c874e52bb3fcdf7f058eca96daeb7", "score": "0.40106106", "text": "func stdGrayConvert(c color.Color) color.Color {\n\treturn c\n}", "title": "" }, { "docid": "38fb7ae681ac953ad35def272844de7e", "score": "0.40027896", "text": "func HSLtoRGB(h, s, l float64) (r, g, b uint8) {\n\tvar fR, fG, fB float64\n\tif s == 0 {\n\t\tfR, fG, fB = l, l, l\n\t} else {\n\t\tvar q float64\n\t\tif l < 0.5 {\n\t\t\tq = l * (1 + s)\n\t\t} else {\n\t\t\tq = l + s - s*l\n\t\t}\n\t\tp := 2*l - q\n\t\tfR = hueToRGB(p, q, h+1.0/3)\n\t\tfG = hueToRGB(p, q, h)\n\t\tfB = hueToRGB(p, q, h-1.0/3)\n\t}\n\tr = uint8((fR * 255) + 0.5)\n\tg = uint8((fG * 255) + 0.5)\n\tb = uint8((fB * 255) + 0.5)\n\treturn\n}", "title": "" }, { "docid": "fe70c8c310c4605739f473d5609d3fa8", "score": "0.39930394", "text": "func (m *Mat) ToImageYUV() (*image.YCbCr, error) {\n\timg, err := m.ToImage()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbounds := img.Bounds()\n\tconverted := image.NewYCbCr(bounds, image.YCbCrSubsampleRatio420)\n\n\tfor row := 0; row < bounds.Max.Y; row++ {\n\t\tfor col := 0; col < bounds.Max.X; col++ {\n\t\t\tr, g, b, _ := img.At(col, row).RGBA()\n\t\t\ty, cb, cr := color.RGBToYCbCr(uint8(r), uint8(g), uint8(b))\n\n\t\t\tconverted.Y[converted.YOffset(col, row)] = y\n\t\t\tconverted.Cb[converted.COffset(col, row)] = cb\n\t\t\tconverted.Cr[converted.COffset(col, row)] = cr\n\t\t}\n\t}\n\treturn converted, nil\n}", "title": "" }, { "docid": "8ad0f9cc724717e0ff141dd7407271b7", "score": "0.39862108", "text": "func convertShadingToGray(shading *model.PdfShading) (*model.PdfShading, error) {\n\tcs := shading.ColorSpace\n\n\tif cs.GetNumComponents() == 1 {\n\t\t// Already grayscale, should be fine. No action taken.\n\t\treturn shading, nil\n\t} else if cs.GetNumComponents() == 3 {\n\t\t// Create a new DeviceN colorspace that converts R,G,B -> Grayscale\n\t\t// Use: gray := 0.3*R + 0.59G + 0.11B\n\t\t// PS program: { 0.11 mul exch 0.59 mul add exch 0.3 mul add }.\n\t\ttransformFunc := &model.PdfFunctionType4{}\n\t\ttransformFunc.Domain = []float64{0, 1, 0, 1, 0, 1}\n\t\ttransformFunc.Range = []float64{0, 1}\n\t\trgbToGrayPsProgram := ps.NewPSProgram()\n\t\trgbToGrayPsProgram.Append(ps.MakeReal(0.11))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"mul\"))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"exch\"))\n\t\trgbToGrayPsProgram.Append(ps.MakeReal(0.59))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"mul\"))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"add\"))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"exch\"))\n\t\trgbToGrayPsProgram.Append(ps.MakeReal(0.3))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"mul\"))\n\t\trgbToGrayPsProgram.Append(ps.MakeOperand(\"add\"))\n\t\ttransformFunc.Program = rgbToGrayPsProgram\n\n\t\t// Define the DeviceN colorspace that performs the R,G,B -> Gray conversion for us.\n\t\ttransformcs := model.NewPdfColorspaceDeviceN()\n\t\ttransformcs.AlternateSpace = model.NewPdfColorspaceDeviceGray()\n\t\ttransformcs.ColorantNames = core.MakeArray(core.MakeName(\"R\"), core.MakeName(\"G\"), core.MakeName(\"B\"))\n\t\ttransformcs.TintTransform = transformFunc\n\n\t\t// Replace the old colorspace with the new.\n\t\tshading.ColorSpace = transformcs\n\n\t\treturn shading, nil\n\t} else if cs.GetNumComponents() == 4 {\n\t\t// Create a new DeviceN colorspace that converts C,M,Y,K -> Grayscale.\n\t\t// Use: gray = 1.0 - min(1.0, 0.3*C + 0.59*M + 0.11*Y + K) ; where BG(k) = k simply.\n\t\t// PS program: {exch 0.11 mul add exch 0.59 mul add exch 0.3 mul add dup 1.0 ge { pop 1.0 } if}\n\t\ttransformFunc := &model.PdfFunctionType4{}\n\t\ttransformFunc.Domain = []float64{0, 1, 0, 1, 0, 1, 0, 1}\n\t\ttransformFunc.Range = []float64{0, 1}\n\n\t\tcmykToGrayPsProgram := ps.NewPSProgram()\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"exch\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeReal(0.11))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"mul\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"add\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"exch\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeReal(0.59))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"mul\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"add\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"exch\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeReal(0.30))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"mul\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"add\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"dup\"))\n\t\tcmykToGrayPsProgram.Append(ps.MakeReal(1.0))\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"ge\"))\n\t\t// Add sub procedure.\n\t\tsubProc := ps.NewPSProgram()\n\t\tsubProc.Append(ps.MakeOperand(\"pop\"))\n\t\tsubProc.Append(ps.MakeReal(1.0))\n\t\tcmykToGrayPsProgram.Append(subProc)\n\t\tcmykToGrayPsProgram.Append(ps.MakeOperand(\"if\"))\n\t\ttransformFunc.Program = cmykToGrayPsProgram\n\n\t\t// Define the DeviceN colorspace that performs the R,G,B -> Gray conversion for us.\n\t\ttransformcs := model.NewPdfColorspaceDeviceN()\n\t\ttransformcs.AlternateSpace = model.NewPdfColorspaceDeviceGray()\n\t\ttransformcs.ColorantNames = core.MakeArray(core.MakeName(\"C\"), core.MakeName(\"M\"), core.MakeName(\"Y\"), core.MakeName(\"K\"))\n\t\ttransformcs.TintTransform = transformFunc\n\n\t\t// Replace the old colorspace with the new.\n\t\tshading.ColorSpace = transformcs\n\n\t\treturn shading, nil\n\t} else {\n\t\tcommon.Log.Debug(\"Cannot convert to shading pattern grayscale, color space N = %d\", cs.GetNumComponents())\n\t\treturn nil, errors.New(\"Unsupported pattern colorspace for grayscale conversion\")\n\t}\n}", "title": "" }, { "docid": "0779bd994d0272d89b4cf88789a704bb", "score": "0.39852712", "text": "func HSLToRGB(h, s, l float64) color.RGBA {\n\n\tvar r, g, b float64\n\tif s == 0 {\n\t\tr = l\n\t\tg = l\n\t\tb = l\n\t} else {\n\t\tvar temp0, temp1 float64\n\t\tif l < 0.5 {\n\t\t\ttemp0 = l * (1 + s)\n\t\t} else {\n\t\t\ttemp0 = (l + s) - (s * l)\n\t\t}\n\t\ttemp1 = 2*l - temp0\n\n\t\th /= 360\n\n\t\thueFn := func(v float64) float64 {\n\t\t\tif v < 0 {\n\t\t\t\tv++\n\t\t\t} else if v > 1 {\n\t\t\t\tv--\n\t\t\t}\n\n\t\t\tif v < 1.0/6.0 {\n\t\t\t\treturn temp1 + (temp0-temp1)*6*v\n\t\t\t}\n\t\t\tif v < 1.0/2.0 {\n\t\t\t\treturn temp0\n\t\t\t}\n\t\t\tif v < 2.0/3.0 {\n\t\t\t\treturn temp1 + (temp0-temp1)*(2.0/3.0-v)*6\n\t\t\t}\n\t\t\treturn temp1\n\t\t}\n\n\t\tr = hueFn(h + 1.0/3.0)\n\t\tg = hueFn(h)\n\t\tb = hueFn(h - 1.0/3.0)\n\n\t}\n\n\toutR := uint8(f64.Clamp(r*255+0.5, 0, 255))\n\toutG := uint8(f64.Clamp(g*255+0.5, 0, 255))\n\toutB := uint8(f64.Clamp(b*255+0.5, 0, 255))\n\n\treturn color.RGBA{outR, outG, outB, 0xFF}\n}", "title": "" }, { "docid": "ee8078f77241cd9d15fcd4219d6649d9", "score": "0.39841425", "text": "func newSSAColorFromColor(i *Color) string {\n\treturn \"&H\" + i.SSAString()\n}", "title": "" }, { "docid": "cd48fe0317dcbbfc83cae54d5062953d", "score": "0.39797872", "text": "func (cpu *CPU) sbcc(inst *Instruction, operand []byte) {\n\tacc := uint32(cpu.Reg.A)\n\tsub := uint32(cpu.load(inst.Mode, operand))\n\tcarry := boolToUint32(cpu.Reg.Carry)\n\tcpu.Reg.Overflow = ((acc ^ sub) & 0x80) != 0\n\tvar v uint32\n\n\tswitch cpu.Reg.Decimal {\n\tcase true:\n\t\tcpu.deltaCycles++\n\n\t\tlo := 0x0f + (acc & 0x0f) - (sub & 0x0f) + carry\n\n\t\tvar carrylo uint32\n\t\tif lo < 0x10 {\n\t\t\tlo -= 0x06\n\t\t\tcarrylo = 0\n\t\t} else {\n\t\t\tlo -= 0x10\n\t\t\tcarrylo = 0x10\n\t\t}\n\n\t\thi := 0xf0 + (acc & 0xf0) - (sub & 0xf0) + carrylo\n\n\t\tif hi < 0x100 {\n\t\t\tcpu.Reg.Carry = false\n\t\t\tif hi < 0x80 {\n\t\t\t\tcpu.Reg.Overflow = false\n\t\t\t}\n\t\t\thi -= 0x60\n\t\t} else {\n\t\t\tcpu.Reg.Carry = true\n\t\t\tif hi >= 0x180 {\n\t\t\t\tcpu.Reg.Overflow = false\n\t\t\t}\n\t\t\thi -= 0x100\n\t\t}\n\n\t\tv = hi | lo\n\n\tcase false:\n\t\tv = 0xff + acc - sub + carry\n\t\tif v < 0x100 {\n\t\t\tcpu.Reg.Carry = false\n\t\t\tif v < 0x80 {\n\t\t\t\tcpu.Reg.Overflow = false\n\t\t\t}\n\t\t} else {\n\t\t\tcpu.Reg.Carry = true\n\t\t\tif v >= 0x180 {\n\t\t\t\tcpu.Reg.Overflow = false\n\t\t\t}\n\t\t}\n\t}\n\n\tcpu.Reg.A = byte(v)\n\tcpu.updateNZ(cpu.Reg.A)\n}", "title": "" }, { "docid": "f2c60f8ae58a3a22a2494d6fa5a021bd", "score": "0.39778125", "text": "func NewRGTC2_BC5_RG_S8_NORM(name string) *Format {\n\treturn &Format{Name: name, Format: &Format_Rgtc2Bc5RgS8Norm{&FmtRGTC2_BC5_RG_S8_NORM{}}}\n}", "title": "" }, { "docid": "4003040cce8170696150422ef0d0bc53", "score": "0.39715695", "text": "func (p *boxTrak) parseCslg(r *atomReader) {\n\tcslg := new(boxCslg)\n\tv, _ := r.ReadVersionFlags()\n\tif v == 0 {\n\t\tcslg.compositionToDTSShift = int64(r.Read4S())\n\t\tcslg.leastDecodeToDisplayDelta = int64(r.Read4S())\n\t\tcslg.greatestDecodeToDisplayDelta = int64(r.Read4S())\n\t\tcslg.compositionStartTime = int64(r.Read4S())\n\t\tcslg.compositionEndTime = int64(r.Read4S())\n\t} else {\n\t\tcslg.compositionToDTSShift = r.Read8S()\n\t\tcslg.leastDecodeToDisplayDelta = r.Read8S()\n\t\tcslg.greatestDecodeToDisplayDelta = r.Read8S()\n\t\tcslg.compositionStartTime = r.Read8S()\n\t\tcslg.compositionEndTime = r.Read8S()\n\t}\n\tp.cslg = cslg\n}", "title": "" }, { "docid": "ba49b9994e8eb131888a8789c668f301", "score": "0.39605567", "text": "func CSSMatrixComponentOptionsFromJS(value js.Value) *CSSMatrixComponentOptions {\n\tvar out CSSMatrixComponentOptions\n\tvar (\n\t\tvalue0 bool // javascript: boolean {is2D Is2D is2D}\n\t)\n\tvalue0 = (value.Get(\"is2D\")).Bool()\n\tout.Is2D = value0\n\treturn &out\n}", "title": "" }, { "docid": "44b60ee5bf62e2da16dbc2c99db0bcc0", "score": "0.3945858", "text": "func HslToRgb(h, s, l float64) (rgb int) {\n\tr, g, b := colorconv.HSLToRGB(h, s, l)\n\treturn packColor(int(r), int(g), int(b))\n}", "title": "" }, { "docid": "7d6db5a0d3c16d8180837b7563cf98be", "score": "0.3944765", "text": "func (p *YCbCr) ToYCbCr(src image.Image) {\n\tbounds := src.Bounds()\n\tdraw.Draw(p, bounds, src, bounds.Min, draw.Src)\n}", "title": "" }, { "docid": "bc4804f088f3ad2db7a0ace01aadf76f", "score": "0.39411673", "text": "func LCS2(a, b []uint64) []CommonSubstring {\n\tvar input []uint64\n\tvar max uint64\n\tfor _, v := range a {\n\t\tinput = append(input, v)\n\t\tif v > max {\n\t\t\tmax = v\n\t\t}\n\t}\n\tmiddle := len(input)\n\tinput = append(input, 0)\n\tfor _, v := range b {\n\t\tinput = append(input, v)\n\t\tif v > max {\n\t\t\tmax = v\n\t\t}\n\t}\n\tinput = append(input, max+2)\n\tinput[middle] = max + 1\n\tsa := InducedSuffixArray(input)\n\tvar pairs [][3]int\n\tfor i := 0; i < len(sa)-1; i++ {\n\t\tif (sa[i] < middle) == (sa[i+1] < middle) {\n\t\t\tcontinue\n\t\t}\n\t\tif sa[i] == middle || sa[i+1] == middle {\n\t\t\tcontinue\n\t\t}\n\t\tvar aoff, boff int\n\t\tif sa[i] < middle {\n\t\t\taoff = sa[i]\n\t\t\tboff = sa[i+1] - middle - 1\n\t\t}\n\t\tif sa[i+1] < middle {\n\t\t\taoff = sa[i+1]\n\t\t\tboff = sa[i] - middle - 1\n\t\t}\n\t\tif a[aoff] != b[boff] {\n\t\t\tcontinue\n\t\t}\n\t\tpairs = append(pairs, [3]int{aoff, boff, 0})\n\t}\n\tif len(pairs) == 0 {\n\t\treturn nil\n\t}\n\n\t// New cool stuff here\n\tsort.Slice(pairs, func(i, j int) bool {\n\t\tif pairs[i][0] != pairs[j][0] {\n\t\t\treturn pairs[i][0] < pairs[j][0]\n\t\t}\n\t\treturn pairs[i][1] < pairs[j][1]\n\t})\n\t// for _, p := range pairs {\n\t// \tfmt.Printf(\"pair: %v\\n\", p)\n\t// }\n\tvar css []CommonSubstring\n\tfor {\n\t\tvar cs CommonSubstring\n\t\tfor i := range pairs {\n\t\t\tif pairs[i][2] > 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tprev := i\n\t\t\tfor {\n\t\t\t\t// We know the value we are looking for is after prev, so restrict our search to that.\n\t\t\t\ttp := pairs[prev:]\n\t\t\t\tdex := sort.Search(len(tp), func(idx int) bool {\n\t\t\t\t\treturn tp[idx][0] > pairs[prev][0]+1 ||\n\t\t\t\t\t\t(tp[idx][0] == pairs[prev][0]+1 && tp[idx][1] >= pairs[prev][1]+1)\n\t\t\t\t})\n\t\t\t\tdex += prev\n\t\t\t\tif dex >= len(pairs) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif pairs[dex][0] != pairs[prev][0]+1 || pairs[dex][1] != pairs[prev][1]+1 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tpairs[dex][2] = 1\n\t\t\t\tprev = dex\n\t\t\t}\n\t\t\tif pairs[prev][0]-pairs[i][0]+1 > cs.Length {\n\t\t\t\tcs = CommonSubstring{\n\t\t\t\t\tAi: pairs[i][0],\n\t\t\t\t\tBi: pairs[i][1],\n\t\t\t\t\tLength: pairs[prev][0] - pairs[i][0] + 1,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// fmt.Printf(\"Got Common Substring: %v\\n\", cs)\n\t\tif cs.Length == 0 {\n\t\t\tbreak\n\t\t}\n\t\tcount := 0\n\t\tfor i := 0; i < len(pairs); i++ {\n\t\t\tpairs[count] = pairs[i]\n\t\t\tpairs[count][2] = 0\n\t\t\tif (pairs[i][0] >= cs.Ai && pairs[i][0] < cs.Ai+cs.Length) ||\n\t\t\t\t(pairs[i][1] >= cs.Bi && pairs[i][1] < cs.Bi+cs.Length) {\n\t\t\t} else {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t\t// fmt.Printf(\"%d down to %d/%d\\n\", len(pairs), count, cs.Length)\n\t\t// if len(pairs) == 1 {\n\t\t// \tfmt.Printf(\"%v\\n\", pairs)\n\t\t// }\n\t\tpairs = pairs[0:count]\n\t\tcss = append(css, cs)\n\t}\n\t// fmt.Printf(\"Got %d runs with %d pairs remaining\\n\", len(css), len(pairs))\n\treturn css\n}", "title": "" }, { "docid": "8b6454b338079ab43d6fcdc7a55773b5", "score": "0.39385268", "text": "func parseLsColor(s string) *lsColor {\n\tlc := &lsColor{make(map[fileFeature]string), make(map[string]string)}\n\tfor _, spec := range strings.Split(s, \":\") {\n\t\twords := strings.Split(spec, \"=\")\n\t\tif len(words) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tkey, value := words[0], words[1]\n\t\tfilterValues := []string{}\n\t\tfor _, splitValue := range strings.Split(value, \";\") {\n\t\t\tif strings.Count(splitValue, \"0\") == len(splitValue) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfilterValues = append(filterValues, splitValue)\n\t\t}\n\t\tif len(filterValues) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tvalue = strings.Join(filterValues, \";\")\n\t\tif strings.HasPrefix(key, \"*.\") {\n\t\t\tlc.styleForExt[key[2:]] = value\n\t\t} else {\n\t\t\tfeature, ok := featureForName[key]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlc.styleForFeature[feature] = value\n\t\t}\n\t}\n\treturn lc\n}", "title": "" }, { "docid": "9d732270dd7ab2629e1c9c552899ff46", "score": "0.3938201", "text": "func (p *GrayAM48) ColorModel() color.Model { return p.Model }", "title": "" }, { "docid": "f7d5552e73d2bc7db37cb91aa642af31", "score": "0.39355052", "text": "func (s *ProfileService) SC2() (*SC2Profile, *bnet.Response, error) {\n\treq, err := s.client.NewRequest(\"GET\", \"sc2/profile/user\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar profile SC2Profile\n\tresp, err := s.client.Do(req, &profile)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn &profile, resp, nil\n}", "title": "" }, { "docid": "3e287fb1b0df14b17b94f41409413914", "score": "0.39267313", "text": "func CgoC2s(p [3]float64) (theta, phi float64) {\n\tvar cTheta, cPhi C.double\n\tcP := v3sGo2C(p)\n\tC.iauC2s(&cP[0], &cTheta, &cPhi)\n\treturn float64(cTheta), float64(cPhi)\n}", "title": "" }, { "docid": "c2acfdcdfdbd2aa692d5395bd7cea52e", "score": "0.39250565", "text": "func (s *Mpesa) C2BRes(endpoint string, payload interface{}) (c2bRes *C2BRes, err error) {\n\trBody, err := s.APIRequest(endpoint, payload)\n\tif err != nil {\n\t\treturn\n\t}\n\tc2bRes = &C2BRes{}\n\terr = json.Unmarshal(rBody, c2bRes)\n\treturn\n\n}", "title": "" }, { "docid": "32dee8234215cd9a5d72248473d901b4", "score": "0.3920076", "text": "func ListMcisGroupVms(nsId string, mcisId string, groupId string) ([]string, error) {\n\t// SubGroupId is the Key for SubGroupId in TbVmInfo struct\n\tfilterKey := \"SubGroupId\"\n\treturn ListVmByFilter(nsId, mcisId, filterKey, groupId)\n}", "title": "" }, { "docid": "626f35ab0f6ec9ca473af18e2348fcd9", "score": "0.39008662", "text": "func (m *Matrix4) SetScale2Comp(sx, sy float64) *Matrix4 {\n\tm.Scale.Set3Components(sx, sy, 1.0)\n\n\tm.ToIdentity()\n\n\tm.e[M00] = sx\n\tm.e[M11] = sy\n\tm.e[M22] = 1.0\n\n\treturn m\n}", "title": "" }, { "docid": "fdb4a98a74d22795ba5a0d42839a8a4c", "score": "0.39002606", "text": "func RgbToHsl(color int) (h, s, l float64) {\n\tr, g, b := unpackColor(color)\n\th, s, l = colorconv.RGBToHSL(uint8(r), uint8(g), uint8(b))\n\treturn\n}", "title": "" }, { "docid": "8e81a8c31c0d3d2379186c2555ba8527", "score": "0.3897188", "text": "func (v VulnInfo) MaxCvss2Score() CveContentCvss {\n\torder := []CveContentType{Nvd, NvdXML, RedHat, RedHatAPI, Jvn}\n\tmax := 0.0\n\tvalue := CveContentCvss{\n\t\tType: Unknown,\n\t\tValue: Cvss{Type: CVSS2},\n\t}\n\tfor _, ctype := range order {\n\t\tif cont, found := v.CveContents[ctype]; found && max < cont.Cvss2Score {\n\t\t\t// https://nvd.nist.gov/vuln-metrics/cvss\n\t\t\tvalue = CveContentCvss{\n\t\t\t\tType: ctype,\n\t\t\t\tValue: Cvss{\n\t\t\t\t\tType: CVSS2,\n\t\t\t\t\tScore: cont.Cvss2Score,\n\t\t\t\t\tVector: cont.Cvss2Vector,\n\t\t\t\t\tSeverity: strings.ToUpper(cont.Cvss2Severity),\n\t\t\t\t},\n\t\t\t}\n\t\t\tmax = cont.Cvss2Score\n\t\t}\n\t}\n\tif 0 < max {\n\t\treturn value\n\t}\n\n\t// If CVSS score isn't on NVD, RedHat and JVN, use OVAL and advisory Severity.\n\t// Convert severity to cvss srore roughly, then returns max severity.\n\t// Only Ubuntu, RedHat and Oracle have severity data in OVAL.\n\torder = []CveContentType{Ubuntu, RedHat, Oracle}\n\tfor _, ctype := range order {\n\t\tif cont, found := v.CveContents[ctype]; found && 0 < len(cont.Cvss2Severity) {\n\t\t\tscore := severityToV2ScoreRoughly(cont.Cvss2Severity)\n\t\t\tif max < score {\n\t\t\t\tvalue = CveContentCvss{\n\t\t\t\t\tType: ctype,\n\t\t\t\t\tValue: Cvss{\n\t\t\t\t\t\tType: CVSS2,\n\t\t\t\t\t\tScore: score,\n\t\t\t\t\t\tCalculatedBySeverity: true,\n\t\t\t\t\t\tVector: cont.Cvss2Vector,\n\t\t\t\t\t\tSeverity: strings.ToUpper(cont.Cvss2Severity),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t\tmax = score\n\t\t}\n\t}\n\n\t// Only RedHat, Oracle and Amazon has severity data in advisory.\n\tfor _, adv := range v.DistroAdvisories {\n\t\tif adv.Severity != \"\" {\n\t\t\tscore := severityToV2ScoreRoughly(adv.Severity)\n\t\t\tif max < score {\n\t\t\t\tvalue = CveContentCvss{\n\t\t\t\t\tType: \"Vendor\",\n\t\t\t\t\tValue: Cvss{\n\t\t\t\t\t\tType: CVSS2,\n\t\t\t\t\t\tScore: score,\n\t\t\t\t\t\tCalculatedBySeverity: true,\n\t\t\t\t\t\tVector: \"-\",\n\t\t\t\t\t\tSeverity: adv.Severity,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn value\n}", "title": "" }, { "docid": "69c138a028c2a403178a3d67a57b923f", "score": "0.38953573", "text": "func newColorFromSSAColor(i string) (_ *Color, _ error) {\n\t// Empty\n\tif len(i) == 0 {\n\t\treturn\n\t}\n\n\t// Check whether input is decimal or hexadecimal\n\tvar s = i\n\tvar base = 10\n\tif strings.HasPrefix(i, \"&H\") {\n\t\ts = i[2:]\n\t\tbase = 16\n\t}\n\treturn newColorFromSSAString(s, base)\n}", "title": "" }, { "docid": "4223cf22bbc0b96eb865c58b774ddee8", "score": "0.38736358", "text": "func C2() {\n\tc21()\n\tc24()\n\tc25()\n}", "title": "" }, { "docid": "aaf849c82097d3b5cd505ad7957a3019", "score": "0.38674846", "text": "func RGBtoHSL(r, g, b uint8) (h, s, l float64) {\n\tfR := float64(r) / 255\n\tfG := float64(g) / 255\n\tfB := float64(b) / 255\n\tmax := math.Max(math.Max(fR, fG), fB)\n\tmin := math.Min(math.Min(fR, fG), fB)\n\tl = (max + min) / 2\n\tif max == min {\n\t\t// Achromatic.\n\t\th, s = 0, 0\n\t} else {\n\t\t// Chromatic.\n\t\td := max - min\n\t\tif l > 0.5 {\n\t\t\ts = d / (2.0 - max - min)\n\t\t} else {\n\t\t\ts = d / (max + min)\n\t\t}\n\t\tswitch max {\n\t\tcase fR:\n\t\t\th = (fG - fB) / d\n\t\t\tif fG < fB {\n\t\t\t\th += 6\n\t\t\t}\n\t\tcase fG:\n\t\t\th = (fB-fR)/d + 2\n\t\tcase fB:\n\t\t\th = (fR-fG)/d + 4\n\t\t}\n\t\th /= 6\n\t}\n\treturn\n}", "title": "" }, { "docid": "1954415d6668c2a6dcd5cc8882116720", "score": "0.3863117", "text": "func msgs(sbsText string) (ret []*adsb.CompositeMsg) {\n\tscanner := bufio.NewScanner(strings.NewReader(sbsText))\n\tfor scanner.Scan() {\n\t\tif text := scanner.Text(); text != \"\" {\n\t\t\tm := adsb.Msg{}\n\t\t\tif err := m.FromSBS1(text); err != nil { panic(err) }\n\t\t\tcm := adsb.CompositeMsg{Msg:m}\n\t\t\tret = append(ret, &cm)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "73e0a4097c71ab7a7992668c314521a8", "score": "0.3861969", "text": "func LearnLKM2L(lvs vars.VarList, gs1, gs2 []vars.VarList, ds dataset,\n\tparamLearner emlearner.EMLearner) (*model.CTree, vars.VarList, []vars.VarList, []vars.VarList) {\n\t// create initial structure and learn parameters\n\tct := createLKMStruct(lvs, gs1, gs2, -1)\n\tct, _, _ = paramLearner.Run(ct, ds.IntMaps())\n\tct.SetBIC(scores.ComputeBIC(ct, ds.IntMaps()))\n\n\tfmt.Printf(\"LearnLKM2L\\n\")\n\tfmt.Printf(\"current: %v\\n\", ct.Nodes())\n\tfmt.Printf(\"bic: %v\\n\", ct.BIC())\n\t// TODO: correctly apply NI search if necessary\n\t// TODO: check if its better to use SI before or after NR\n\t// ct, lvs = applyStateInsertion(ct, ds, paramLearner, lvs, gs1, gs2)\n\t// ct, gs1, gs2 = applyNodeRelocation(ct, ds, paramLearner, lvs, gs1, gs2)\n\t// ct, lvs = applyStateInsertion(ct, ds, paramLearner, lvs, gs1, gs2)\n\tct, lvs = applySeqStateInsertion(ct, ds, paramLearner, lvs, gs1, gs2)\n\treturn ct, lvs, gs1, gs2\n}", "title": "" }, { "docid": "b9f129daacdf2cdec14a13af00b574dc", "score": "0.3858992", "text": "func (img *Image) decodeBmpRGB(r io.Reader, width, height, bands int, topDown, noAlpha bool) error {\n\tif bands != 3 && bands != 4 {\n\t\treturn errBmpUnsupported\n\t}\n\n\timgBands := 3\n\tif bands == 4 && !noAlpha {\n\t\t// Create RGBA image only when source has 4 bands and the last one is alpha\n\t\timgBands = 4\n\t}\n\n\ttmp, imgData, err := prepareBmpCanvas(width, height, imgBands)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer bmpClearOnPanic(&tmp)\n\n\t// Each row is 4-byte aligned.\n\tb := make([]byte, (bands*width+3)&^3)\n\n\ty0, y1, yDelta := height-1, -1, -1\n\tif topDown {\n\t\ty0, y1, yDelta = 0, height, +1\n\t}\n\n\tstride := width * imgBands\n\n\tfor y := y0; y != y1; y += yDelta {\n\t\tif _, err = io.ReadFull(r, b); err != nil {\n\t\t\tC.clear_image(&tmp)\n\t\t\treturn err\n\t\t}\n\n\t\tp := imgData[y*stride : (y+1)*stride]\n\t\tfor i, j := 0, 0; i < len(p); i, j = i+imgBands, j+bands {\n\t\t\t// BMP images are stored in BGR order rather than RGB order.\n\t\t\tp[i+0] = b[j+2]\n\t\t\tp[i+1] = b[j+1]\n\t\t\tp[i+2] = b[j+0]\n\n\t\t\tif imgBands == 4 {\n\t\t\t\tp[i+3] = b[j+3]\n\t\t\t}\n\t\t}\n\t}\n\n\tC.swap_and_clear(&img.VipsImage, tmp)\n\n\treturn nil\n}", "title": "" }, { "docid": "644da85457cd13ee95e308445709d2d3", "score": "0.38579395", "text": "func MIPICamerasFromCrOSCameraTool(ctx context.Context) ([]map[string]string, error) {\n\tcmd := testexec.CommandContext(ctx, \"cros-camera-tool\", \"modules\", \"list\")\n\tout, err := cmd.Output(testexec.DumpLogOnError)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to run cros-camera-tool\")\n\t}\n\tvar cams []map[string]string\n\tif err := json.Unmarshal(out, &cams); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse cros-camera-tool output\")\n\t}\n\treturn cams, nil\n}", "title": "" }, { "docid": "b8c5b2b9cdde19b4009e6fe520587b10", "score": "0.38557616", "text": "func modifyMessageBC(message types.Message, receiver int) types.Message {\n\tmsg := new(types.BcMessage)\n\tbuf := bytes.NewBuffer(message.Payload)\n\tdec := gob.NewDecoder(buf)\n\terr := dec.Decode(&msg)\n\tif err != nil {\n\t\tlogger.ErrLogger.Fatal(err)\n\t}\n\n\tswitch msg.Tag % 3 {\n\tcase 0:\n\t\tmsg.Value = uint(receiver % 2)\n\tcase 1:\n\t\tmsg.Value = uint(0)\n\tcase 2:\n\t\tmsg.Value = uint(1)\n\t}\n\n\tlogger.ErrLogger.Print(config.Scenario, \": (\", message.Type, \") \", receiver, \" --> [\",\n\t\tmsg.Tag, \",\", msg.Value, \"]\\n\")\n\n\tw := new(bytes.Buffer)\n\tencoder := gob.NewEncoder(w)\n\terr = encoder.Encode(msg)\n\tif err != nil {\n\t\tlogger.ErrLogger.Fatal(err)\n\t}\n\n\treturn types.NewMessage(w.Bytes(), message.Type)\n}", "title": "" }, { "docid": "34051348879ddf928faa9b98e7222362", "score": "0.3854381", "text": "func ParseMPCLC(in io.Reader) (*Circuit, error) {\n\tr := bufio.NewReader(in)\n\n\tvar header struct {\n\t\tMagic uint32\n\t\tNumGates uint32\n\t\tNumWires uint32\n\t\tNumInputs uint32\n\t\tNumOutputs uint32\n\t}\n\tif err := binary.Read(r, bo, &header); err != nil {\n\t\treturn nil, err\n\t}\n\tvar inputs, outputs IO\n\tvar inputWires, outputWires int\n\n\twiresSeen := make(Seen, header.NumWires)\n\n\tfor i := 0; i < int(header.NumInputs); i++ {\n\t\targ, err := parseIOArg(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinputs = append(inputs, arg)\n\t\tinputWires += arg.Size\n\t}\n\tfor i := 0; i < int(header.NumOutputs); i++ {\n\t\tout, err := parseIOArg(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\toutputs = append(outputs, out)\n\t\toutputWires += out.Size\n\t}\n\n\t// Mark input wires seen.\n\tfor i := 0; i < inputWires; i++ {\n\t\tif err := wiresSeen.Set(Wire(i)); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tgates := make([]Gate, header.NumGates)\n\tvar stats Stats\n\tvar gate int\n\tfor gate = 0; ; gate++ {\n\t\top, err := r.ReadByte()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tswitch Operation(op) {\n\t\tcase XOR, XNOR, AND, OR:\n\t\t\tvar bin struct {\n\t\t\t\tInput0 uint32\n\t\t\t\tInput1 uint32\n\t\t\t\tOutput uint32\n\t\t\t}\n\t\t\tif err := binary.Read(r, bo, &bin); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tseen, err := wiresSeen.Get(Wire(bin.Input0))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !seen {\n\t\t\t\treturn nil, fmt.Errorf(\"input %d of gate %d not set\",\n\t\t\t\t\tbin.Input0, gate)\n\t\t\t}\n\t\t\tseen, err = wiresSeen.Get(Wire(bin.Input1))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !seen {\n\t\t\t\treturn nil, fmt.Errorf(\"input %d of gate %d not set\",\n\t\t\t\t\tbin.Input1, gate)\n\t\t\t}\n\t\t\tif err := wiresSeen.Set(Wire(bin.Output)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tgates[gate] = Gate{\n\t\t\t\tInput0: Wire(bin.Input0),\n\t\t\t\tInput1: Wire(bin.Input1),\n\t\t\t\tOutput: Wire(bin.Output),\n\t\t\t\tOp: Operation(op),\n\t\t\t}\n\n\t\tcase INV:\n\t\t\tvar unary struct {\n\t\t\t\tInput0 uint32\n\t\t\t\tOutput uint32\n\t\t\t}\n\t\t\tif err := binary.Read(r, bo, &unary); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tseen, err := wiresSeen.Get(Wire(unary.Input0))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !seen {\n\t\t\t\treturn nil, fmt.Errorf(\"input %d of gate %d not set\",\n\t\t\t\t\tunary.Input0, gate)\n\t\t\t}\n\t\t\tif err := wiresSeen.Set(Wire(unary.Output)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tgates[gate] = Gate{\n\t\t\t\tInput0: Wire(unary.Input0),\n\t\t\t\tOutput: Wire(unary.Output),\n\t\t\t\tOp: Operation(op),\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported gate type %s\", Operation(op))\n\t\t}\n\t\tstats[Operation(op)]++\n\t}\n\n\tif uint32(gate) != header.NumGates {\n\t\treturn nil, fmt.Errorf(\"not enough gates: got %d, expected %d\",\n\t\t\tgate, header.NumGates)\n\t}\n\n\t// Check that all wires are seen.\n\tfor i := 0; i < len(wiresSeen); i++ {\n\t\tif !wiresSeen[i] {\n\t\t\treturn nil, fmt.Errorf(\"wire %d not assigned\", i)\n\t\t}\n\t}\n\n\treturn &Circuit{\n\t\tNumGates: int(header.NumGates),\n\t\tNumWires: int(header.NumWires),\n\t\tInputs: inputs,\n\t\tOutputs: outputs,\n\t\tGates: gates,\n\t\tStats: stats,\n\t}, nil\n}", "title": "" }, { "docid": "f7567f0bf6aaf14777662dc08a3da418", "score": "0.38449523", "text": "func BenchmarkClearToColor(b *testing.B) {\n b.StopTimer()\n InstallSystem()\n defer UninstallSystem()\n display := makeDisplay()\n blue := CreateColor(0.0, 0.0, 1.0, 1.0)\n if display == nil {\n b.Fatal(\"Error creating display. Cannot benchmark it.\")\n }\n b.StartTimer()\n for i := 0; i < b.N; i++ {\n ClearToColor(blue)\n }\n // FlipDisplay()\n display.Destroy()\n}", "title": "" }, { "docid": "633559366ceae96a7c8fde3ee2b8c113", "score": "0.38436288", "text": "func newColorFromSSAString(s string, base int) (c *Color, err error) {\n\tvar i int64\n\tif i, err = strconv.ParseInt(s, base, 64); err != nil {\n\t\terr = fmt.Errorf(\"parsing int %s with base %d failed: %w\", s, base, err)\n\t\treturn\n\t}\n\tc = &Color{\n\t\tAlpha: uint8(i>>24) & 0xff,\n\t\tBlue: uint8(i>>16) & 0xff,\n\t\tGreen: uint8(i>>8) & 0xff,\n\t\tRed: uint8(i) & 0xff,\n\t}\n\treturn\n}", "title": "" }, { "docid": "d333c5122307aa0c2f07d0d093e0513d", "score": "0.38432264", "text": "func XyzToLms(x, y, z float64) (l, m, s float64) {\n\tl = 0.4002*x + 0.7075*y - 0.0807*z\n\tm = -0.228*x + 1.1500*y + 0.0612*z\n\ts = 0.0000*x + 0.0000*y + 0.9184*z\n\treturn\n}", "title": "" }, { "docid": "efd4e501743234d8447b4e303c365070", "score": "0.38358012", "text": "func LmsToXyz(l, m, s float64) (x, y, z float64) {\n\tx = 1.8501*l - 1.1385*m + 0.2384*s\n\ty = 0.3668*l + 0.6438*m - 0.0107*s\n\tz = 0.0000*l + 0.0000*m + 1.0889*s\n\treturn\n}", "title": "" }, { "docid": "130f92c16b8b4c6c8bb3049bcf145f82", "score": "0.38307452", "text": "func convertSegmentRecs(segmentRecs []*fit.LapMsg) ( dumprec[][]string ) {\n // Calculate values from raw values.\n\tfor _, record := range segmentRecs {\n // Convert distance to meters, timer time to seconds, calories to kcal and type conversions on \n // the raw values to strings.\n newrec := []string{record.StartPositionLat.String(),\n record.StartPositionLong.String(),\n record.EndPositionLat.String(),\n record.EndPositionLong.String(),\n strconv.FormatFloat(record.GetTotalDistanceScaled(), 'G', -1, 64),\n strconv.FormatFloat(record.GetTotalTimerTimeScaled(), 'G', -1, 64),\n strconv.Itoa(int(record.TotalCalories)),\n }\n dumprec = append(dumprec, newrec)\n }\n\t\treturn dumprec\n\t}", "title": "" }, { "docid": "3d959c347efacfc89088ef713cdc7287", "score": "0.38065395", "text": "func newCCMType(blk cipher.Block, TagSize int, NonceSize int) (c *CCMType, err error) {\n\t// verify block size of cypher is acceptable\n\tif blk.BlockSize() != CcmBlockSize {\n\t\treturn nil, ErrInvalidBlockSize\n\t}\n\n\t// checks that tag size is divisable by 2 and between 4 and 16\n\tif TagSize < 4 || TagSize > 16 || TagSize%2 == 1 {\n\t\treturn nil, ErrTagSize\n\t}\n\n\t// Check that NonceSize is in range of proper sizes\n\tl := 15 - NonceSize\n\tif l < 2 || l > 8 {\n\t\treturn nil, ErrNonceSize\n\t}\n\n\t// All Good - return it.\n\tc = &CCMType{blk: blk, M: uint64(TagSize), L: uint64(l)}\n\treturn\n}", "title": "" }, { "docid": "a137dedb708615dba9c315992d4a8dbd", "score": "0.3805599", "text": "func cp2r2(v cp.Vector) r.Vector2 {\n\treturn r.NewVector2(float32(v.X), float32(v.Y))\n}", "title": "" }, { "docid": "500f7734da1edaa358bc112d198572ce", "score": "0.38052818", "text": "func (mask bitmap) ColorModel() color.Model {\n\treturn color.AlphaModel\n}", "title": "" }, { "docid": "901d3772241125af55b728fb1dc58451", "score": "0.37987503", "text": "func imgchannel(c string) string {\n\tswitch c {\n\tcase \"R\", \"G\", \"B\", \"A\":\n\t\treturn c\n\tcase \"r\", \"g\", \"b\", \"a\":\n\t\treturn strings.ToUpper(c)\n\tcase \"red\", \"green\", \"blue\", \"alpha\":\n\t\treturn strings.ToUpper(c[0:1])\n\tcase \"Red\", \"Green\", \"Blue\", \"Alpha\":\n\t\treturn c[0:1]\n\t}\n\treturn \"R\"\n}", "title": "" }, { "docid": "e7aa6538d98de84572eb6c457c5c0af9", "score": "0.37977386", "text": "func RgbToColor256(red, green, blue uint8) uint8 {\n\t// red, green, blue range 0-255 on input\n\n\tif red == green && red == blue {\n\t\t// Grayscale\n\t\tswitch {\n\t\tcase red == 255:\n\t\t\t// Bright white\n\t\t\treturn 15\n\t\tcase red == 0:\n\t\t\t// Black\n\t\t\treturn 0\n\t\t}\n\n\t\treturn 232 + uint8(math.Round(float64(red)/10.65))\n\t}\n\n\treturn (36*ColorToAnsiIndex(red) +\n\t\t6*ColorToAnsiIndex(green) +\n\t\tColorToAnsiIndex(blue)) + 16\n}", "title": "" }, { "docid": "95e3246e73dbb47b97e0f920c51467c3", "score": "0.3796507", "text": "func NewStationExitAPIControllerGet3202Status299() *StationExitAPIControllerGet3202Status299 {\n\treturn &StationExitAPIControllerGet3202Status299{}\n}", "title": "" }, { "docid": "5c64cb709b8b3b46cd1feb1629228d63", "score": "0.3794335", "text": "func (st *EncodingRecordSubtableFormat12) GetCMap() map[int32]uint16 {\n\treturn st.cmap\n}", "title": "" }, { "docid": "9f36b118d279bc5e9c3f32e4409d3b79", "score": "0.37933457", "text": "func GetMcisInfo(nsId string, mcisId string) (*TbMcisInfo, error) {\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\ttemp := &TbMcisInfo{}\n\t\tcommon.CBLog.Error(err)\n\t\treturn temp, err\n\t}\n\n\terr = common.CheckString(mcisId)\n\tif err != nil {\n\t\ttemp := &TbMcisInfo{}\n\t\tcommon.CBLog.Error(err)\n\t\treturn temp, err\n\t}\n\tcheck, _ := CheckMcis(nsId, mcisId)\n\n\tif !check {\n\t\ttemp := &TbMcisInfo{}\n\t\terr := fmt.Errorf(\"The mcis \" + mcisId + \" does not exist.\")\n\t\treturn temp, err\n\t}\n\n\tmcisObj, err := GetMcisObject(nsId, mcisId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn nil, err\n\t}\n\n\t// common.PrintJsonPretty(mcisObj)\n\n\tmcisStatus, err := GetMcisStatus(nsId, mcisId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn nil, err\n\t}\n\t// common.PrintJsonPretty(mcisStatus)\n\n\tmcisObj.Status = mcisStatus.Status\n\tmcisObj.StatusCount = mcisStatus.StatusCount\n\n\tvmList, err := ListVmId(nsId, mcisId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tsort.Slice(mcisObj.Vm, func(i, j int) bool {\n\t\treturn mcisObj.Vm[i].Id < mcisObj.Vm[j].Id\n\t})\n\n\tfor vmInfoIndex := range vmList {\n\t\tfor vmStatusInfoIndex := range mcisStatus.Vm {\n\t\t\tif mcisObj.Vm[vmInfoIndex].Id == mcisStatus.Vm[vmStatusInfoIndex].Id {\n\t\t\t\tmcisObj.Vm[vmInfoIndex].Status = mcisStatus.Vm[vmStatusInfoIndex].Status\n\t\t\t\tmcisObj.Vm[vmInfoIndex].TargetStatus = mcisStatus.Vm[vmStatusInfoIndex].TargetStatus\n\t\t\t\tmcisObj.Vm[vmInfoIndex].TargetAction = mcisStatus.Vm[vmStatusInfoIndex].TargetAction\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &mcisObj, nil\n}", "title": "" }, { "docid": "a31bf3a115a0b32d88c1261cfdf30b0d", "score": "0.379272", "text": "func (ctx *Context) Whisper_pcm_to_mel(data []float32, threads int) error {\n\tif C.whisper_pcm_to_mel((*C.struct_whisper_context)(ctx), (*C.float)(&data[0]), C.int(len(data)), C.int(threads)) == 0 {\n\t\treturn nil\n\t} else {\n\t\treturn ErrConversionFailed\n\t}\n}", "title": "" }, { "docid": "0b78859db33a850c7988b6717e94991c", "score": "0.37923202", "text": "func matrixToLables(m model.Matrix) []labels.Labels {\n\tvar labels []labels.Labels\n\tfor _, ss := range m {\n\t\tfor range ss.Values {\n\t\t\tlabels = append(labels, cortexpb.FromLabelAdaptersToLabels(cortexpb.FromMetricsToLabelAdapters(ss.Metric)))\n\t\t}\n\t}\n\treturn labels\n}", "title": "" }, { "docid": "0312391bcee8783b8c288b2831d6a2e6", "score": "0.37917092", "text": "func ColorToScale(clr color.Color) (float64, float64, float64, float64) {\n\tr, g, b, a := clr.RGBA()\n\trf := float64(r) / 0xffff\n\tgf := float64(g) / 0xffff\n\tbf := float64(b) / 0xffff\n\taf := float64(a) / 0xffff\n\t// Convert to non-premultiplied alpha components.\n\tif 0 < af {\n\t\trf /= af\n\t\tgf /= af\n\t\tbf /= af\n\t}\n\treturn rf, gf, bf, af\n}", "title": "" }, { "docid": "60bf9d2691c5ab783dfa0ee31e895100", "score": "0.3790128", "text": "func decodeCOBS(wr, rd []byte) int {\n\tif len(wr) < len(rd) {\n\t\tlog.Fatalf(\"ERROR: len(wr) = %d < len(rd) = %d\\n\", len(wr), len(rd))\n\t}\n\td := cobs.Decode(rd) // to do: avoid allocation\n\tif d == nil {\n\t\treturn 0\n\t}\n\treturn copy(wr, d)\n}", "title": "" }, { "docid": "f86264a4333804b972b569a57bedc1ac", "score": "0.3788201", "text": "func TestCreateSMSSecondFactor(t *testing.T) {\n\tsrv, teardown := ServiceForTest()\n\tdefer teardown()\n\tviper.Set(\"contact_verification_expiry_for_phone\", \"5s\")\n\n\tu, err := srv.UserStore.UserByID(context.Background(), 1)\n\tassert.NoError(t, err)\n\tctx := user.NewContextWithCurrentUser(context.Background(), u)\n\n\t// 1. List the second factors\n\treq := &authapi.ListSecondFactorsRequest{}\n\tres, err := srv.ListSecondFactors(ctx, req)\n\tassert.NoError(t, err)\n\tassert.Len(t, res.SecondFactors, 0)\n\n\t// 2. Request a SMS code for creating SMS second factor\n\tphoneNumber := \"+85290000000\"\n\treq2 := &authapi.StartCreateSecondFactorRequest{\n\t\tInfo: &authapi.StartCreateSecondFactorRequest_SmsInfo{\n\t\t\tSmsInfo: &authapi.SMSInfo{\n\t\t\t\tPhoneNumber: phoneNumber,\n\t\t\t},\n\t\t},\n\t}\n\t_, err = srv.StartCreateSecondFactor(ctx, req2)\n\tassert.NoError(t, err)\n\n\t// 3. Create a SMS second factor\n\tclosedLoopCodePartialKey := srv.UserStore.GetClosedLoopCodePartialKeyBySecondFactorValue(phoneNumber)\n\tclosedLoopCode, err := srv.UserStore.FindClosedLoopCodeByKey(context.Background(), closedLoopCodePartialKey)\n\tassert.NoError(t, err)\n\n\treq3 := &authapi.CreateSecondFactorRequest{\n\t\tInfo: &authapi.CreateSecondFactorRequest_SmsInfo{\n\t\t\tSmsInfo: &authapi.SMSInfo{\n\t\t\t\tPhoneNumber: phoneNumber,\n\t\t\t},\n\t\t},\n\t\tAnswer: closedLoopCode.Code,\n\t}\n\t_, err = srv.CreateSecondFactor(ctx, req3)\n\tassert.NoError(t, err)\n\n\t// 4. List the second factors again\n\treq4 := &authapi.ListSecondFactorsRequest{}\n\tres4, err := srv.ListSecondFactors(ctx, req4)\n\tassert.NoError(t, err)\n\tassert.Len(t, res4.SecondFactors, 1)\n\tsecondFactor := res4.SecondFactors[0]\n\tassert.Equal(t, phoneNumber, secondFactor.Content.PhoneNumber)\n}", "title": "" }, { "docid": "2d74131cb53fdb2b3712fd9acdbcf679", "score": "0.3786226", "text": "func Scale2D(scaleX, scaleY float32) Mat3 {\n\treturn Mat3{float32(scaleX), 0, 0, 0, float32(scaleY), 0, 0, 0, 1}\n}", "title": "" }, { "docid": "0b59fc02b428bc25a4261af6fabfcdc8", "score": "0.37849554", "text": "func LCS() {\n\tvar x, y string\n\tfmt.Printf(\"Enter First Sequence: \")\n\tfmt.Scanf(\"%s\", &x)\n\tfmt.Printf(\"Enter Second Sequence: \")\n\tfmt.Scanf(\"%s\", &y)\n\tx = strings.ToUpper(x)\n\ty = strings.ToUpper(y)\n\tfirst := []byte(x)\n\tsecond := []byte(y)\n\tc, b := lcsLength(first, second)\n\tfmt.Printf(\"Longest Subsequnce Length: %d\\n\", c[len(first)][len(second)])\n\tfmt.Printf(\"Longest Subsequence: %s\\n\", getLCS(b, first, len(first)-1, len(second)-1))\n}", "title": "" }, { "docid": "e8220435051ea969369532dea7dda21b", "score": "0.37823483", "text": "func SecondsToCbsExpiry(ttl int) uint32 {\n\treturn DurationToCbsExpiry(time.Duration(ttl) * time.Second)\n}", "title": "" }, { "docid": "e4b6cd0f72e116a115f30313134b427f", "score": "0.37798187", "text": "func convertToMC(data map[string]interface{}) (*machineconfigv1.MachineConfig, error) {\n\t// Convert the yaml string to json\n\tjsonData, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Printf(\"Error: could not convert map to json: (%s): %s\\n\", data, err)\n\t\treturn nil, err\n\t}\n\tmc := machineconfigv1.MachineConfig{}\n\t// Convert the json string to machine config struct\n\terr = json.Unmarshal(jsonData, &mc)\n\tif err != nil {\n\t\tlog.Printf(\"Error: could not convert json to mc: (%s): %s\\n\", jsonData, err)\n\t\treturn nil, err\n\t}\n\treturn &mc, nil\n}", "title": "" }, { "docid": "a42be52ee23f4c9d6311edf3b5da3910", "score": "0.37783012", "text": "func LoadCmapFromData(data []byte, isSimple bool) (*CMap, error) {\n\tcommon.Log.Trace(\"LoadCmapFromData: isSimple=%t\", isSimple)\n\n\tcmap := newCMap(isSimple)\n\tcmap.cMapParser = newCMapParser(data)\n\n\t// In debugging it may help to see the data being parsed.\n\t// fmt.Println(\"===============*******===========\")\n\t// fmt.Printf(\"%s\\n\", string(data))\n\t// fmt.Println(\"===============&&&&&&&===========\")\n\n\terr := cmap.parse()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(cmap.codespaces) == 0 {\n\t\tcommon.Log.Debug(\"ERROR: No codespaces. cmap=%s\", cmap)\n\t\treturn nil, ErrBadCMap\n\t}\n\t// We need to sort codespaces so that we check shorter codes first.\n\tsort.Slice(cmap.codespaces, func(i, j int) bool {\n\t\treturn cmap.codespaces[i].Low < cmap.codespaces[j].Low\n\t})\n\treturn cmap, nil\n}", "title": "" } ]
b2ccfdd6b7852f6c2961930b24a3574f
String returns a string representing the duration in the form "72h3m0.5s". Zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli, micro, or nanoseconds) to ensure that the leading digit is nonzero. The zero duration formats as 0s.
[ { "docid": "cf8b7a600ba3b03fe7b62bf519d450b2", "score": "0.7699564", "text": "func String(d time.Duration) string {\n\t// Largest time is 2540400h10m10.000000000s\n\tu := int64(d)\n\tif u == 0 {\n\t\treturn \"0s\"\n\t}\n\tbuf := make([]byte, 0, 32)\n\tif d < 0 {\n\t\tu = -u\n\t\tbuf = append(buf, '-')\n\t}\n\n\tif u >= int64(time.Hour) {\n\t\tn := u / int64(time.Hour)\n\t\tbuf = strconv.AppendInt(buf, n, 10)\n\t\tbuf = append(buf, 'h')\n\t\tu -= n * int64(time.Hour)\n\t}\n\tif u >= int64(time.Minute) {\n\t\tn := u / int64(time.Minute)\n\t\tbuf = strconv.AppendInt(buf, n, 10)\n\t\tbuf = append(buf, 'm')\n\t\tu -= n * int64(time.Minute)\n\t}\n\n\t// second part\n\tif u == 0 {\n\t\tif len(buf) == 0 {\n\t\t\tbuf = append(buf, \"0s\"...)\n\t\t}\n\t} else {\n\t\t// print seconds\n\t\tbuf = fmtSec(buf, u)\n\t\tbuf = append(buf, \"s\"...)\n\t}\n\treturn unsafeString(buf)\n}", "title": "" } ]
[ { "docid": "fe153782250de24ed00aa9d19c524311", "score": "0.7956138", "text": "func (d Duration) String() string {\n\tdur := d.Duration.String()\n\tif len(dur) > 3 && dur[len(dur)-3:] == \"m0s\" {\n\t\tdur = dur[:len(dur)-2]\n\t}\n\n\tif len(dur) > 3 && dur[len(dur)-3:] == \"h0m\" {\n\t\tdur = dur[:len(dur)-2]\n\t}\n\n\treturn dur\n}", "title": "" }, { "docid": "7ada854a2f7fd03e5bbfde5fe6c0870b", "score": "0.7160865", "text": "func (d Duration) String() string {\n\tvar buf bytes.Buffer\n\td.Format(&buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "e82dcd3b36477f4f8ac84bd9c5f32940", "score": "0.699873", "text": "func formatDuration(d time.Duration) string {\n\tbuf := pool.Get()\n\tbuf.AppendUint(uint64(d / time.Millisecond))\n\n\tp := uint64(d % time.Millisecond)\n\tif p > 0 {\n\t\tom := 0\n\t\tm := uint64(100000)\n\t\tfor p < m {\n\t\t\tom++\n\t\t\tm /= 10\n\t\t}\n\n\t\tfor {\n\t\t\tif p%10 == 0 {\n\t\t\t\tp /= 10\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\t_ = buf.WriteByte('.')\n\n\t\tfor om > 0 {\n\t\t\t_ = buf.WriteByte('0')\n\t\t\tom--\n\t\t}\n\n\t\tbuf.AppendUint(p)\n\t}\n\n\tbuf.WriteString(\"ms\")\n\tres := string(buf.Bytes())\n\tpool.Put(buf)\n\n\treturn res\n}", "title": "" }, { "docid": "99e16e44c0e31556b9b8b641a8c78ef7", "score": "0.6866042", "text": "func FormatDuration(duration time.Duration, includeMillis bool) string {\n\tif duration < 0 {\n\t\tduration = 0\n\t}\n\thours := duration / time.Hour\n\tduration -= hours * time.Hour\n\tminutes := duration / time.Minute\n\tduration -= minutes * time.Minute\n\tseconds := duration / time.Second\n\tduration -= seconds * time.Second\n\tif includeMillis {\n\t\treturn fmt.Sprintf(\"%d:%02d:%02d.%03d\", hours, minutes, seconds, duration/time.Millisecond)\n\t}\n\treturn fmt.Sprintf(\"%d:%02d:%02d\", hours, minutes, seconds)\n}", "title": "" }, { "docid": "f8066a6569cac893ca9fe3d075e5b4f8", "score": "0.68473047", "text": "func fmtDuration(d time.Duration) string {\n\th := d / time.Hour\n\td -= h * time.Hour\n\tm := d / time.Minute\n\td -= m * time.Minute\n\ts := d / time.Second\n\treturn fmt.Sprintf(\"%02d:%02d:%02d\", h, m, s)\n}", "title": "" }, { "docid": "b3c0eb49821d0588923489bb25928c56", "score": "0.6829673", "text": "func DurationToString(d time.Duration) string {\n\tminutes := int(d.Minutes()) % 60\n\thours := int(d.Hours())\n\tdays := hours / 24\n\thours = hours % 24\n\tif days > 0 {\n\t\treturn fmt.Sprintf(\"%dd %dhr\", days, hours)\n\t}\n\tif hours > 0 {\n\t\treturn fmt.Sprintf(\"%dhr %dm\", hours, minutes)\n\t}\n\treturn fmt.Sprintf(\"%dm\", minutes)\n}", "title": "" }, { "docid": "8fcdc31c35782cf41ec2081c4e2378ce", "score": "0.68044466", "text": "func FmtDuration(d time.Duration) string {\n\tif d < 0 {\n\t\treturn \"0h00m\"\n\t}\n\td = d.Round(time.Second)\n\th := d / time.Hour\n\td -= h * time.Hour\n\tm := d / time.Minute\n\treturn fmt.Sprintf(\"%dh%02dm\", h, m)\n}", "title": "" }, { "docid": "3be839ed2b71f78da8fbdd514b6a9e93", "score": "0.6763976", "text": "func Duration(d time.Duration) (result string) {\n\thours := int(d.Hours())\n\tminutes := int(d.Minutes()) - (hours * 60)\n\tseconds := int(d.Seconds()) - (minutes * 60) - (hours * 60 * 60)\n\n\tif hours > 0 {\n\t\tdays := hours / 24\n\t\thoursLeft := hours % 24\n\t\tif days > 0 {\n\t\t\tresult += strconv.Itoa(days) + \"d\"\n\t\t}\n\t\tif hoursLeft > 0 {\n\t\t\tresult += strconv.Itoa(hoursLeft) + \"h\"\n\t\t}\n\t}\n\tif minutes > 0 {\n\t\tresult += strconv.Itoa(minutes) + \"m\"\n\t}\n\tif seconds > 0 {\n\t\tresult += strconv.Itoa(seconds) + \"s\"\n\t}\n\treturn result\n}", "title": "" }, { "docid": "8cf25c08fb9e9f3c42e5deb7c746a09a", "score": "0.6743167", "text": "func (d *Duration) String() string {\n\treturn time.Duration(*d).String()\n}", "title": "" }, { "docid": "00bfca9e4e60e9bef284bffeba34c1be", "score": "0.6714105", "text": "func (d Duration) String() string {\n\treturn time.Duration(d).String()\n}", "title": "" }, { "docid": "e3e146e87191b6b6b8218e6d90d9ae1d", "score": "0.6675708", "text": "func FormatDuration(d time.Duration) string {\n\treturn d.String()\n}", "title": "" }, { "docid": "8f094bfd776c9ab39a6258542a2258a5", "score": "0.6661048", "text": "func FormatDuration(d time.Duration) string {\n\tif d >= time.Hour {\n\t\treturn fmt.Sprintf(\"%dh\", d.Round(time.Hour)/time.Hour)\n\t}\n\tif d >= time.Minute {\n\t\treturn fmt.Sprintf(\"%dm\", d.Round(time.Minute)/time.Minute)\n\t}\n\tif d >= time.Second {\n\t\treturn fmt.Sprintf(\"%ds\", d.Round(time.Second)/time.Second)\n\t}\n\tif d >= time.Millisecond {\n\t\treturn fmt.Sprintf(\"%dms\", d.Round(time.Millisecond)/time.Millisecond)\n\t}\n\tif d >= time.Microsecond {\n\t\treturn fmt.Sprint(d.Round(time.Microsecond))\n\t}\n\treturn fmt.Sprint(d)\n}", "title": "" }, { "docid": "b41d264f9cb24a20550609756d0fd42a", "score": "0.6651283", "text": "func FormatDuration(dur *time.Duration) string {\n\tvar days int = int(dur.Hours() / 24)\n\tvar hrs int = int(dur.Hours()) % 24\n\tvar mins int = int(dur.Minutes()) % 60\n\tvar secs int = int(dur.Seconds()) % 60\n\n\treturn fmt.Sprintf(\"%d days, %d hours, %d minutes and %d seconds\", days, hrs, mins, secs)\n}", "title": "" }, { "docid": "bf7e715e7a60e16dd7b0e2c2f37fa658", "score": "0.66476756", "text": "func FormatDuration(d time.Duration) string {\n\td = d.Round(time.Second)\n\th := d / time.Hour\n\td -= h * time.Hour\n\tm := d / time.Minute\n\td -= m * time.Minute\n\ts := d / time.Second\n\treturn fmt.Sprintf(\"%02dh, %02dm, %02ds\", h, m, s)\n}", "title": "" }, { "docid": "4bf41fe1aa425a09f5e1db601d71b39b", "score": "0.66300684", "text": "func getDurationStringRounded(micro uint64) string {\n\trn := micro * uint64(time.Microsecond)\n\tswitch {\n\tcase rn == 0:\n\t\treturn fmt.Sprintf(\"0s\")\n\tcase rn < 2*uint64(time.Millisecond):\n\t\treturn fmt.Sprintf(\"%vµs\", micro)\n\tcase rn < 2*uint64(time.Second):\n\t\tmicro = uint64(math.Round(float64(micro) / 1000))\n\t\treturn fmt.Sprintf(\"%vms\", micro)\n\tdefault:\n\t\tx := time.Duration(rn)\n\t\td := x.Round(time.Second)\n\t\treturn d.String()\n\t}\n\n}", "title": "" }, { "docid": "18ac3490fb3d38044cdf49a4a1571def", "score": "0.6617883", "text": "func FormatDuration(dur time.Duration) string {\n\tconst Decisecond = 100 * time.Millisecond\n\tconst Day = 24 * time.Hour\n\td := dur / Day\n\tdur = dur % Day\n\th := dur / time.Hour\n\tdur = dur % time.Hour\n\tm := dur / time.Minute\n\tdur = dur % time.Minute\n\ts := dur / time.Second\n\tdur = dur % time.Second\n\tf := dur / Decisecond\n\tif d >= 1 {\n\t\treturn fmt.Sprintf(\"%02d-%02d:%02d:%02d.%02d\", d, h, m, s, f)\n\t} else if h >= 1 {\n\t\treturn fmt.Sprintf(\"%02d:%02d:%02d.%02d\", h, m, s, f)\n\t} else {\n\t\treturn fmt.Sprintf(\"%02d:%02d.%02d\", m, s, f)\n\t}\n}", "title": "" }, { "docid": "a03a0144be7ed7f5986eb6cbff23d04b", "score": "0.6610055", "text": "func humanDuration(d time.Duration) string {\n\tvar buf [32]byte\n\tw := len(buf)\n\n\tu := uint64(d)\n\tneg := d < 0\n\tif neg {\n\t\tu = -u\n\t}\n\tw--\n\tbuf[w] = 's'\n\n\t_, u = fmtFrac(buf[:w], u, 9)\n\n\t// u is now integer seconds\n\tw = fmtInt(buf[:w], u%60)\n\tu /= 60\n\n\t// u is now integer minutes\n\tif u > 0 {\n\t\tw--\n\t\tbuf[w] = 'm'\n\t\tw = fmtInt(buf[:w], u%60)\n\t\tu /= 60\n\n\t\t// u is now integer hours\n\t\tif u > 0 {\n\t\t\tw--\n\t\t\tbuf[w] = 'h'\n\t\t\tw = fmtInt(buf[:w], u%24)\n\t\t\tu /= 24\n\t\t\tif u > 0 {\n\t\t\t\tw--\n\t\t\t\tbuf[w] = 'd'\n\t\t\t\tw = fmtInt(buf[:w], u)\n\t\t\t}\n\t\t}\n\t}\n\n\tif neg {\n\t\tw--\n\t\tbuf[w] = '-'\n\t}\n\treturn string(buf[w:])\n}", "title": "" }, { "docid": "7f16e43289f6c0270f260046464a05cf", "score": "0.66089356", "text": "func (d Duration) Format(buf *bytes.Buffer) {\n\tif d.Nanos == 0 && d.Days == 0 && d.Months == 0 {\n\t\tbuf.WriteString(\"0s\")\n\t\treturn\n\t}\n\n\tif absGE(d.Months, 11) {\n\t\tfmt.Fprintf(buf, \"%dy\", d.Months/12)\n\t\td.Months %= 12\n\t}\n\tif d.Months != 0 {\n\t\tfmt.Fprintf(buf, \"%dmon\", d.Months)\n\t}\n\tif d.Days != 0 {\n\t\tfmt.Fprintf(buf, \"%dd\", d.Days)\n\t}\n\n\t// The following comparisons are careful to preserve the sign in\n\t// case the value is MinInt64, and thus cannot be made positive lest\n\t// an overflow occur.\n\tif absGE(d.Nanos, time.Hour.Nanoseconds()) {\n\t\tfmt.Fprintf(buf, \"%dh\", d.Nanos/time.Hour.Nanoseconds())\n\t\td.Nanos %= time.Hour.Nanoseconds()\n\t}\n\tif absGE(d.Nanos, time.Minute.Nanoseconds()) {\n\t\tfmt.Fprintf(buf, \"%dm\", d.Nanos/time.Minute.Nanoseconds())\n\t\td.Nanos %= time.Minute.Nanoseconds()\n\t}\n\tif absGE(d.Nanos, time.Second.Nanoseconds()) {\n\t\tfmt.Fprintf(buf, \"%ds\", d.Nanos/time.Second.Nanoseconds())\n\t\td.Nanos %= time.Second.Nanoseconds()\n\t}\n\tif absGE(d.Nanos, time.Millisecond.Nanoseconds()) {\n\t\tfmt.Fprintf(buf, \"%dms\", d.Nanos/time.Millisecond.Nanoseconds())\n\t\td.Nanos %= time.Millisecond.Nanoseconds()\n\t}\n\tif absGE(d.Nanos, time.Microsecond.Nanoseconds()) {\n\t\tfmt.Fprintf(buf, \"%dµs\", d.Nanos/time.Microsecond.Nanoseconds())\n\t\td.Nanos %= time.Microsecond.Nanoseconds()\n\t}\n\tif d.Nanos != 0 {\n\t\tfmt.Fprintf(buf, \"%dns\", d.Nanos)\n\t}\n}", "title": "" }, { "docid": "846d3cf56d1319b6f753b005900419ff", "score": "0.64538145", "text": "func SecondToString(seconds int) string {\n\td, _ := time.ParseDuration(fmt.Sprintf(\"%vs\", seconds))\n\tduration := d.String()\n\n\th, m, s := \"00\", \"00\", \"00\"\n\n\t// Count hour.\n\tr := regexp.MustCompile(`\\d+h`)\n\tmatch := r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\th = strings.Replace(match[0], \"h\", \"\", -1)\n\t\tif len(h) == 1 {\n\t\t\th = \"0\" + h\n\t\t}\n\t}\n\n\t// Count minute.\n\tr = regexp.MustCompile(`\\d+m`)\n\tmatch = r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\tm = strings.Replace(match[0], \"m\", \"\", -1)\n\t\tif len(m) == 1 {\n\t\t\tm = \"0\" + m\n\t\t}\n\t}\n\n\t// Count minute.\n\tr = regexp.MustCompile(`\\d+s`)\n\tmatch = r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\ts = strings.Replace(match[0], \"s\", \"\", -1)\n\t\tif len(s) == 1 {\n\t\t\ts = \"0\" + s\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"%v:%v:%v\", h, m, s)\n}", "title": "" }, { "docid": "3f3b648bee7d47ba74866fc1325b21c1", "score": "0.6381287", "text": "func (s *Durations) String() string { return str(s) }", "title": "" }, { "docid": "96114c80ee820fba1721782ff26f8db3", "score": "0.62925917", "text": "func (t Duration) String() string {\n\treturn t.V().String()\n}", "title": "" }, { "docid": "5e0c491fe5095f012e8dfcf9ee81c664", "score": "0.6278782", "text": "func formatDurationSTL(d time.Duration, framerate int) (o string) {\n\t// Add hours\n\tif d.Hours() < 10 {\n\t\to += \"0\"\n\t}\n\tvar delta = int(math.Floor(d.Hours()))\n\to += strconv.Itoa(delta)\n\td -= time.Duration(delta) * time.Hour\n\n\t// Add minutes\n\tif d.Minutes() < 10 {\n\t\to += \"0\"\n\t}\n\tdelta = int(math.Floor(d.Minutes()))\n\to += strconv.Itoa(delta)\n\td -= time.Duration(delta) * time.Minute\n\n\t// Add seconds\n\tif d.Seconds() < 10 {\n\t\to += \"0\"\n\t}\n\tdelta = int(math.Floor(d.Seconds()))\n\to += strconv.Itoa(delta)\n\td -= time.Duration(delta) * time.Second\n\n\t// Add frames\n\tvar frames = int(int(d.Nanoseconds()) * framerate / 1e9)\n\tif frames < 10 {\n\t\to += \"0\"\n\t}\n\to += strconv.Itoa(frames)\n\treturn\n}", "title": "" }, { "docid": "64ded71e4c5c0826e6b64ed921819f3b", "score": "0.62740314", "text": "func AppendDuration(b []byte, d time.Duration) []byte {\n\t// Largest time is 2540400h10m10.000000000s\n\tvar buf [32]byte\n\tw := len(buf)\n\n\tu := uint64(d)\n\tneg := d < 0\n\tif neg {\n\t\tu = -u\n\t}\n\n\tif u < uint64(time.Second) {\n\t\t// Special case: if duration is smaller than a second,\n\t\t// use smaller units, like 1.2ms\n\t\tvar prec int\n\t\tw--\n\t\tbuf[w] = 's'\n\t\tw--\n\t\tswitch {\n\t\tcase u == 0:\n\t\t\treturn append(b, '0', 's')\n\t\tcase u < uint64(time.Microsecond):\n\t\t\t// print nanoseconds\n\t\t\tprec = 0\n\t\t\tbuf[w] = 'n'\n\t\tcase u < uint64(time.Millisecond):\n\t\t\t// print microseconds\n\t\t\tprec = 3\n\t\t\t// U+00B5 'µ' micro sign == 0xC2 0xB5\n\t\t\tw-- // Need room for two bytes.\n\t\t\tcopy(buf[w:], \"µ\")\n\t\tdefault:\n\t\t\t// print milliseconds\n\t\t\tprec = 6\n\t\t\tbuf[w] = 'm'\n\t\t}\n\t\tw, u = fmtFrac(buf[:w], u, prec)\n\t\tw = fmtInt(buf[:w], u)\n\t} else {\n\t\tw--\n\t\tbuf[w] = 's'\n\n\t\tw, u = fmtFrac(buf[:w], u, 9)\n\n\t\t// u is now integer seconds\n\t\tw = fmtInt(buf[:w], u%60)\n\t\tu /= 60\n\n\t\t// u is now integer minutes\n\t\tif u > 0 {\n\t\t\tw--\n\t\t\tbuf[w] = 'm'\n\t\t\tw = fmtInt(buf[:w], u%60)\n\t\t\tu /= 60\n\n\t\t\t// u is now integer hours\n\t\t\t// Stop at hours because days can be different lengths.\n\t\t\tif u > 0 {\n\t\t\t\tw--\n\t\t\t\tbuf[w] = 'h'\n\t\t\t\tw = fmtInt(buf[:w], u)\n\t\t\t}\n\t\t}\n\t}\n\n\tif neg {\n\t\tw--\n\t\tbuf[w] = '-'\n\t}\n\n\treturn append(b, buf[w:]...)\n}", "title": "" }, { "docid": "8b8ce98bcdaced6cf3e1a40bcbad98e2", "score": "0.624764", "text": "func (m Milli) String() string {\n\td := m % 1000\n\tif d < 0 {\n\t\td = -d\n\t}\n\treturn fmt.Sprintf(\"%d.%03d\", m/1000, d)\n}", "title": "" }, { "docid": "afa23d0c4081ae76c28ba94bebfc9ce7", "score": "0.6244032", "text": "func FormatDuration(d time.Duration) Duration {\n\tvar (\n\t\tn time.Duration\n\t\ttmp = \"P\"\n\t)\n\n\tif n = d / (365 * 24 * time.Hour); n > 0 {\n\t\ttmp += fmt.Sprintf(\"%dY\", n)\n\t\td %= 365 * 24 * time.Hour\n\t}\n\n\tif n = d / (30 * 24 * time.Hour); n > 0 {\n\t\ttmp += fmt.Sprintf(\"%dM\", n)\n\t\td %= 30 * 24 * time.Hour\n\t}\n\n\tif n = d / (24 * time.Hour); n > 0 {\n\t\ttmp += fmt.Sprintf(\"%dD\", n)\n\t\td %= 24 * time.Hour\n\t}\n\n\ttmp += \"T\"\n\n\tif n = d / time.Hour; n > 0 {\n\t\ttmp += fmt.Sprintf(\"%dH\", n)\n\t\td %= time.Hour\n\t}\n\n\tif n = d / time.Minute; n > 0 {\n\t\ttmp += fmt.Sprintf(\"%dM\", n)\n\t\td %= time.Minute\n\t}\n\n\td /= time.Millisecond\n\ttmp += fmt.Sprintf(\"%.3gS\", float64(d)/1000)\n\n\treturn Duration(tmp)\n}", "title": "" }, { "docid": "7a364622a5aa1401b493e2cf29bd1f9d", "score": "0.6226258", "text": "func (d *Dive) Duration() time.Duration {\n\tif strings.HasSuffix(d.RawDuration, \" min\") {\n\t\ta := strings.Split(d.RawDuration, \" \")\n\t\tb := strings.Split(a[0], \":\")\n\t\tsecondsInt, err := strconv.Atoi(b[1])\n\t\tvar secondsFraction float64\n\t\tif err == nil {\n\t\t\tsecondsFraction = float64(secondsInt) / 60.0\n\t\t}\n\t\tminutesInt, _ := strconv.Atoi(b[0])\n\t\tdurationFraction := float64(minutesInt) + secondsFraction\n\t\tduration, _ := time.ParseDuration(fmt.Sprintf(\"%.5f\", durationFraction) + \"m\")\n\t\treturn duration\n\t}\n\tzeroDuration, _ := time.ParseDuration(\"0s\")\n\treturn zeroDuration\n}", "title": "" }, { "docid": "3ade99ab5c37465fe388d41ded0ea175", "score": "0.6156903", "text": "func durToMsec(dur time.Duration) string {\n\tms := dur / time.Millisecond\n\tif dur > 0 && ms == 0 {\n\t\tms = 1\n\t}\n\treturn fmt.Sprintf(\"%dms\", ms)\n}", "title": "" }, { "docid": "6710c41672b63a4af1a9f3bdd274ff3b", "score": "0.6128604", "text": "func (tm TimeUnit) String() string {\n switch tm {\n case Milliseconds:\n return \"milliseconds\"\n case Seconds:\n return \"seconds\"\n case Minutes:\n return \"minutes\"\n case Hours:\n return \"hours\"\n case Days:\n return \"days\"\n case Weeks:\n return \"weeks\"\n case Months:\n return \"months\"\n case Years:\n return \"years\"\n default:\n return \"unknown\"\n }\n}", "title": "" }, { "docid": "1d91d7fb41dea2a38a6a5f30db189808", "score": "0.6102131", "text": "func (s TimeSpan) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2aa0f38fa822ef9bb5d04f53fb751c2b", "score": "0.6065934", "text": "func MillisecondStr() string {\n\treturn strconv.FormatInt(Millisecond(), 10)\n}", "title": "" }, { "docid": "57f8f26f799a3a6a058b481c527b11b8", "score": "0.60472685", "text": "func DurationToCode(duration time.Duration) string {\n\tvar buffer strings.Builder\n\tif duration >= time.Hour {\n\t\tfmt.Fprintf(&buffer, \"%d * time.Hour\", duration/time.Hour)\n\t\tduration -= (duration / time.Hour) * time.Hour\n\t}\n\tif duration >= time.Minute {\n\t\tif buffer.Len() > 0 {\n\t\t\tbuffer.WriteString(\" + \")\n\t\t}\n\t\tfmt.Fprintf(&buffer, \"%d * time.Minute\", duration/time.Minute)\n\t\tduration -= (duration / time.Minute) * time.Minute\n\t}\n\tif duration >= time.Second {\n\t\tif buffer.Len() > 0 {\n\t\t\tbuffer.WriteString(\" + \")\n\t\t}\n\t\tfmt.Fprintf(&buffer, \"%d * time.Second\", duration/time.Second)\n\t\tduration -= (duration / time.Second) * time.Second\n\t}\n\tif duration >= time.Millisecond {\n\t\tif buffer.Len() > 0 {\n\t\t\tbuffer.WriteString(\" + \")\n\t\t}\n\t\tfmt.Fprintf(&buffer, \"%d * time.Millisecond\", duration/time.Millisecond)\n\t\tduration -= (duration / time.Millisecond) * time.Millisecond\n\t}\n\tif duration >= time.Microsecond {\n\t\tif buffer.Len() > 0 {\n\t\t\tbuffer.WriteString(\" + \")\n\t\t}\n\t\tfmt.Fprintf(&buffer, \"%d * time.Microsecond\", duration/time.Microsecond)\n\t\tduration -= (duration / time.Microsecond) * time.Microsecond\n\t}\n\tif duration != 0 {\n\t\tif buffer.Len() > 0 {\n\t\t\tbuffer.WriteString(\" + \")\n\t\t}\n\t\tfmt.Fprintf(&buffer, \"%d\", duration)\n\t}\n\treturn buffer.String()\n}", "title": "" }, { "docid": "b2c37081d94d59d91721544cf42359d5", "score": "0.60469455", "text": "func PrettyDuration(duration time.Duration) string {\n\tseconds := duration.Seconds()\n\n\tif seconds < 1.0 {\n\t\treturn fmt.Sprintf(\"%dms\", duration.Milliseconds())\n\t} else if seconds < 240.0 {\n\t\treturn fmt.Sprintf(\"%ds\", int(seconds))\n\t} else if seconds < (2.0 * 60.0 * 60.0) {\n\t\treturn fmt.Sprintf(\"%dm\", int(duration.Minutes()))\n\t} else {\n\t\treturn fmt.Sprintf(\"%dh\", int(duration.Hours()))\n\t}\n}", "title": "" }, { "docid": "df4fd749140fc4150f59ec62db8c9e28", "score": "0.6043754", "text": "func DurationToHHMMSS(d time.Duration) string {\r\n\th := d.Truncate(time.Hour).Hours()\r\n\tm := d.Truncate(time.Minute).Minutes() - h*60\r\n\ts := d.Truncate(time.Second).Seconds() - h*3600 - m*60\r\n\treturn fmt.Sprintf(\"%02.f:%02.f:%02.f\", h, math.Abs(m), math.Abs(s))\r\n}", "title": "" }, { "docid": "7e7e79e745c20e761deb64ad1c4503c3", "score": "0.6021024", "text": "func (t Time) String() string {\n\ts := fmt.Sprintf(\"%02d:%02d:%02d\", t.Hour, t.Minute, t.Second)\n\tif t.Nanosecond == 0 {\n\t\treturn s\n\t}\n\treturn s + fmt.Sprintf(\".%09d\", t.Nanosecond)\n}", "title": "" }, { "docid": "bd70bae3a126502ff23e5c348e41f4c0", "score": "0.6001896", "text": "func (s Stopwatch) Duration() string {\n\treturn util.SecToTime(s.Seconds())\n}", "title": "" }, { "docid": "4fc6b4bdc89004a373cc4b33b353c60b", "score": "0.59871197", "text": "func ToShortTimeFormat(d time.Duration) string {\n\tu := uint64(d)\n\tif u < uint64(time.Second) {\n\t\tswitch {\n\t\tcase u == 0:\n\t\t\treturn \"0\"\n\t\tcase u < uint64(time.Microsecond):\n\t\t\treturn fmt.Sprintf(\"%.2fns\", float64(u))\n\t\tcase u < uint64(time.Millisecond):\n\t\t\treturn fmt.Sprintf(\"%.2fus\", float64(u)/1000)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%.2fms\", float64(u)/1000/1000)\n\t\t}\n\t} else {\n\t\tswitch {\n\t\tcase u < uint64(time.Minute):\n\t\t\treturn fmt.Sprintf(\"%.2fs\", float64(u)/1000/1000/1000)\n\t\tcase u < uint64(time.Hour):\n\t\t\treturn fmt.Sprintf(\"%.2fm\", float64(u)/1000/1000/1000/60)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%.2fh\", float64(u)/1000/1000/1000/60/60)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f0d0c1aca1cc8765b5b848276e7b8ab3", "score": "0.5951768", "text": "func FixedDuration(d time.Duration) string {\n\tstr := fmt.Sprintf(\"%02ds\", int(d.Seconds())%60)\n\tif d >= time.Minute {\n\t\tstr = fmt.Sprintf(\"%02dm\", int(d.Minutes())%60) + str\n\t}\n\tif d >= time.Hour {\n\t\tstr = fmt.Sprintf(\"%02dh\", int(d.Hours())) + str\n\t}\n\treturn str\n}", "title": "" }, { "docid": "c8f92be03d0567c18680958849819550", "score": "0.5920777", "text": "func (d LocalTime) String() string {\n\ts := fmt.Sprintf(\"%02d:%02d:%02d\", d.Hour, d.Minute, d.Second)\n\n\tif d.Precision > 0 {\n\t\ts += fmt.Sprintf(\".%09d\", d.Nanosecond)[:d.Precision+1]\n\t} else if d.Nanosecond > 0 {\n\t\t// Nanoseconds are specified, but precision is not provided. Use the\n\t\t// minimum.\n\t\ts += strings.Trim(fmt.Sprintf(\".%09d\", d.Nanosecond), \"0\")\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "1ec271674c8dcb18b3cf5d9eb517ebd2", "score": "0.58905226", "text": "func timeScaler(d time.Duration) string {\n\tif d == 0 && forceNonZeroTestVal != 0 {\n\t\td = forceNonZeroTestVal\n\t}\n\tif d == -1 {\n\t\treturn \"\"\n\t}\n\tswitch {\n\tcase d == 0:\n\t\treturn \"0.0ms\"\n\tcase d >= time.Minute:\n\t\tmins := d / time.Minute\n\t\td = d - mins*time.Minute\n\t\ts := strconv.FormatFloat(float64(d.Nanoseconds())/1e9, 'f', 0, 64)\n\t\treturn strconv.Itoa(int(mins)) + \"m\" + fmt.Sprintf(\"%02s\", s) + \"s\"\n\tcase d >= time.Second:\n\t\treturn strconv.FormatFloat(float64(d.Nanoseconds())/1e9, 'f', 1, 64) + \"s\"\n\tcase d >= 50*time.Microsecond:\n\t\treturn strconv.FormatFloat(float64(d.Nanoseconds())/1e9*1000, 'f', 0, 64) + \"ms\"\n\tcase d >= time.Microsecond:\n\t\treturn strconv.FormatFloat(float64(d.Nanoseconds())/1e9*1000*1000, 'f', 0, 64) + \"µs\"\n\tdefault:\n\t\treturn strconv.FormatFloat(float64(d.Nanoseconds()), 'f', 0, 64) + \"ns\"\n\t}\n}", "title": "" }, { "docid": "f30c73b0fa8bad72c4e311d30eae4737", "score": "0.58852416", "text": "func (t Time) String() string {\n\tif t.Second == 0 && t.Millisecond == 0 {\n\t\treturn fmt.Sprintf(\"%v:%v\", fieldToString(t.Hour), fieldToString(t.Minute))\n\t}\n\n\tif t.Millisecond == 0 {\n\t\treturn fmt.Sprintf(\"%v:%v:%v\", fieldToString(t.Hour), fieldToString(t.Minute), fieldToString(t.Second))\n\t}\n\n\tmillisecond := fmt.Sprintf(\"%d\", t.Millisecond)\n\tif t.Millisecond < 10 {\n\t\tmillisecond = fmt.Sprintf(\"00%d\", t.Millisecond)\n\t} else if t.Millisecond < 100 {\n\t\tmillisecond = fmt.Sprintf(\"0%d\", t.Millisecond)\n\t}\n\n\treturn fmt.Sprintf(\"%v:%v:%v.%s\", fieldToString(t.Hour), fieldToString(t.Minute), fieldToString(t.Second),\n\t\tmillisecond[:len(millisecond)-countTrailingZeros(millisecond)])\n}", "title": "" }, { "docid": "6cf0f935c25945324289b0c9055ad95f", "score": "0.58761847", "text": "func HumanDuration(d time.Duration) string {\n\tif seconds := int(d.Seconds()); seconds < 1 {\n\t\treturn \"Less than a second\"\n\t} else if seconds < 60 {\n\t\treturn fmt.Sprintf(\"%d seconds\", seconds)\n\t} else if minutes := int(d.Minutes()); minutes == 1 {\n\t\treturn \"About a minute\"\n\t} else if minutes < 60 {\n\t\treturn fmt.Sprintf(\"%d minutes\", minutes)\n\t} else if hours := int(d.Hours()); hours == 1 {\n\t\treturn \"About an hour\"\n\t} else if hours < 48 {\n\t\treturn fmt.Sprintf(\"%d hours\", hours)\n\t} else if hours < 24*7*2 {\n\t\treturn fmt.Sprintf(\"%d days\", hours/24)\n\t} else if hours < 24*30*3 {\n\t\treturn fmt.Sprintf(\"%d weeks\", hours/24/7)\n\t} else if hours < 24*365*2 {\n\t\treturn fmt.Sprintf(\"%d months\", hours/24/30)\n\t}\n\treturn fmt.Sprintf(\"%f years\", d.Hours()/24/365)\n}", "title": "" }, { "docid": "9b19809c7bbc641aab86f71e925946be", "score": "0.5852576", "text": "func (s Timing) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "95236ef8eabc5cebe14709a4e4ad7aa1", "score": "0.5786139", "text": "func HumanTime(t time.Duration) (rs string) {\n\tsec := int64(t.Seconds()) // converts duration in nanosec to seconds\n\tif sec < 60 {\n\t\trs = fmt.Sprintf(\"%d seconds\", sec)\n\t\treturn\n\t}\n\tif sec < 3600 {\n\t\trs = fmt.Sprintf(\"%5.2f minutes\", float64(sec)/60.0)\n\t\treturn\n\t}\n\tif sec < 86400 {\n\t\trs = fmt.Sprintf(\"%5.2f hours\", float64(sec)/3600.0)\n\t\treturn\n\t}\n\tif sec < int64(86400.0*30.4375) {\n\t\trs = fmt.Sprintf(\"%5.2f days\", float64(sec)/86400.0)\n\t\treturn\n\t}\n\tif sec < int64(86400.0*365.25) {\n\t\trs = fmt.Sprintf(\"%5.2f months\", float64(sec)/(86400.0*30.4375))\n\t\treturn\n\t}\n\trs = fmt.Sprintf(\"%5.2f years\", float64(sec)/(86400.0*365.25))\n\treturn\n}", "title": "" }, { "docid": "78cd776126ca9716e0da0461d3be63c2", "score": "0.5761404", "text": "func LongDuration(val time.Duration) string {\n\tvar round time.Duration\n\tvar unit string\n\n\tswitch {\n\tcase val < time.Minute:\n\t\tround = time.Second\n\t\tunit = \"second\"\n\n\tcase val < time.Hour:\n\t\tround = time.Minute\n\t\tunit = \"minute\"\n\n\tcase val < 24*time.Hour:\n\t\tround = time.Hour\n\t\tunit = \"hour\"\n\n\tdefault:\n\t\tround = 24 * time.Hour\n\t\tunit = \"day\"\n\t}\n\n\tn := int64(val.Round(round) / round)\n\ts := \"\"\n\tif n != 1 {\n\t\ts = \"s\"\n\t}\n\treturn fmt.Sprintf(\"%d %s%s\", n, unit, s)\n}", "title": "" }, { "docid": "1c03286107510e78fb043040aefb998b", "score": "0.57557267", "text": "func (t *Timing) String() string {\n\tt.itemLock.Lock()\n\tdefer t.itemLock.Unlock()\n\n\tpos := int(math.Ceil(math.Log10(float64(len(t.items)))))\n\tnameFmt := fmt.Sprintf(\"%%0%dd_%%s\", pos)\n\tparts := make([]string, 0)\n\tfor idx, item := range t.items {\n\t\tsubParts := []string{}\n\t\tif t.prefix {\n\t\t\tsubParts = append(subParts, fmt.Sprintf(nameFmt, idx, item.Name))\n\t\t} else {\n\t\t\tsubParts = append(subParts, item.Name)\n\t\t}\n\t\tif item.Description != \"\" {\n\t\t\tsubParts = append(subParts, fmt.Sprintf(\"desc=%#v\", item.Description))\n\t\t}\n\t\tif item.Duration != 0 {\n\t\t\tsubParts = append(subParts, fmt.Sprintf(\"dur=%.2f\", item.Duration.Seconds()*1000))\n\t\t}\n\n\t\tparts = append(parts, strings.Join(subParts, \";\"))\n\t}\n\n\treturn strings.Join(parts, \", \")\n}", "title": "" }, { "docid": "b9b5bbf2abf06b3770762fdfd90d8bd6", "score": "0.5741463", "text": "func TimeDurationGoString(t *time.Duration) string {\n\tif t == nil {\n\t\treturn \"(*time.Duration)(nil)\"\n\t}\n\treturn fmt.Sprintf(\"%s\", t)\n}", "title": "" }, { "docid": "6cb8f46d43e0c7342efd2d5be5c59323", "score": "0.57395554", "text": "func formatDurationWebVTT(i time.Duration) string {\n\treturn formatDuration(i, \".\", 3)\n}", "title": "" }, { "docid": "5af2ffff4b89e24e115d6e7f028da485", "score": "0.57373726", "text": "func FormatTime(s uint64) string {\n\tmin := s / 60\n\tsec := s % 60\n\tformat := \"%d:%d\"\n\tif sec < 10 {\n\t\tformat = \"%d:0%d\"\n\t}\n\treturn fmt.Sprintf(format, min, sec)\n}", "title": "" }, { "docid": "e8c278344b7ec766e2183230b501e545", "score": "0.5720943", "text": "func timeStr(t int64) string {\n\tsec := t / 1000 % 60\n\tmin := t / 1000 / 60 % 60\n\thour := t / 1000 / 60 / 60\n\treturn fmt.Sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n}", "title": "" }, { "docid": "428b21dac4bba865aeb2ca0aa03f4f55", "score": "0.57173455", "text": "func toTimeCode(d time.Duration) string {\n\th := int64(math.Abs(d.Hours()))\n\tm := int64(math.Mod(math.Abs(d.Minutes()), 60))\n\ts := int64(math.Mod(math.Abs(d.Seconds()), 60))\n\treturn fmt.Sprintf(\"%02d:%02d:%02d\", h, m, s)\n}", "title": "" }, { "docid": "3fd5f83fd0b5cb568c43874e909ee0a6", "score": "0.5668756", "text": "func ParseDuration(s string) (time.Duration, error) {\n\t// Return an error if the string is blank or one character\n\tif len(s) < 2 {\n\t\treturn 0, ErrInvalidDuration\n\t}\n\n\t// Split string into individual runes.\n\ta := []rune(s)\n\n\t// Start with a zero duration.\n\tvar d time.Duration\n\ti := 0\n\n\t// Check for a negative.\n\tisNegative := false\n\tif a[i] == '-' {\n\t\tisNegative = true\n\t\ti++\n\t}\n\n\tvar measure int64\n\tvar unit string\n\n\t// Parsing loop.\n\tfor i < len(a) {\n\t\t// Find the number portion.\n\t\tstart := i\n\t\tfor ; i < len(a) && isDigit(a[i]); i++ {\n\t\t\t// Scan for the digits.\n\t\t}\n\n\t\t// Check if we reached the end of the string prematurely.\n\t\tif i >= len(a) || i == start {\n\t\t\treturn 0, ErrInvalidDuration\n\t\t}\n\n\t\t// Parse the numeric part.\n\t\tn, err := strconv.ParseInt(string(a[start:i]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, ErrInvalidDuration\n\t\t}\n\t\tmeasure = n\n\n\t\t// Extract the unit of measure.\n\t\t// If the last two characters are \"ms\" then parse as milliseconds.\n\t\t// Otherwise just use the last character as the unit of measure.\n\t\tunit = string(a[i])\n\t\tswitch a[i] {\n\t\tcase 'n':\n\t\t\tif i+1 < len(a) && a[i+1] == 's' {\n\t\t\t\tunit = string(a[i : i+2])\n\t\t\t\td += time.Duration(n)\n\t\t\t\ti += 2\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn 0, ErrInvalidDuration\n\t\tcase 'u', 'µ':\n\t\t\td += time.Duration(n) * time.Microsecond\n\t\tcase 'm':\n\t\t\tif i+1 < len(a) && a[i+1] == 's' {\n\t\t\t\tunit = string(a[i : i+2])\n\t\t\t\td += time.Duration(n) * time.Millisecond\n\t\t\t\ti += 2\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\td += time.Duration(n) * time.Minute\n\t\tcase 's':\n\t\t\td += time.Duration(n) * time.Second\n\t\tcase 'h':\n\t\t\td += time.Duration(n) * time.Hour\n\t\tcase 'd':\n\t\t\td += time.Duration(n) * 24 * time.Hour\n\t\tcase 'w':\n\t\t\td += time.Duration(n) * 7 * 24 * time.Hour\n\t\tdefault:\n\t\t\treturn 0, ErrInvalidDuration\n\t\t}\n\t\ti++\n\t}\n\n\t// Check to see if we overflowed a duration\n\tif d < 0 && !isNegative {\n\t\treturn 0, fmt.Errorf(\"overflowed duration %d%s: choose a smaller duration or INF\", measure, unit)\n\t}\n\n\tif isNegative {\n\t\td = -d\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "9149fdcb84585142202a24cfa1696e59", "score": "0.56652826", "text": "func durationInstr(p unsafe.Pointer, w Writer, es *encodeState) error {\n\td := *(*time.Duration)(p)\n\n\tif es.opts.durationFmt == DurationString {\n\t\t// The largest time is 2540400h10m10.000000000s,\n\t\t// which fit in a 32-byte buffer.\n\t\tb := es.scratch[:32]\n\t\tb = appendDuration(b, d)\n\n\t\tif err := w.WriteByte('\"'); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := w.Write(b); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn w.WriteByte('\"')\n\t}\n\tswitch es.opts.durationFmt {\n\tcase DurationMinutes:\n\t\tf := d.Minutes()\n\t\treturn floatInstr(unsafe.Pointer(&f), w, es, 64)\n\tcase DurationSeconds:\n\t\tf := d.Seconds()\n\t\treturn floatInstr(unsafe.Pointer(&f), w, es, 64)\n\tcase DurationMicroseconds:\n\t\ti := int64(d) / 1e3\n\t\treturn integerInstr(unsafe.Pointer(&i), w, es, reflect.Int64)\n\tcase DurationMilliseconds:\n\t\ti := int64(d) / 1e6\n\t\treturn integerInstr(unsafe.Pointer(&i), w, es, reflect.Int64)\n\tcase DurationNanoseconds:\n\t\ti := d.Nanoseconds()\n\t\treturn integerInstr(unsafe.Pointer(&i), w, es, reflect.Int64)\n\t}\n\treturn fmt.Errorf(\"unknown duration format: %v\", es.opts.durationFmt)\n}", "title": "" }, { "docid": "faaa0ecec498bebe6cc4a820511d542d", "score": "0.5655253", "text": "func Parse(s string) (d *Duration, err error) {\n\tvar digitBuf bytes.Buffer\n\tvar unitBuf bytes.Buffer\n\n\tflushBuffers := func() {\n\t\tdigitBuf = bytes.Buffer{}\n\t\tunitBuf = bytes.Buffer{}\n\t}\n\n\td = &Duration{}\n\n\tflush := func() error {\n\t\tdigit := digitBuf.String()\n\t\tunit := unitBuf.String()\n\t\tflushBuffers()\n\n\t\tif len(digit) < 1 {\n\t\t\treturn fmt.Errorf(\"Digit not supplied for unit '%s'\", unit)\n\t\t}\n\t\tif len(unit) < 1 {\n\t\t\treturn fmt.Errorf(\"Unit not supplied for digit '%s'\", digit)\n\t\t}\n\n\t\tdigitInt, err := strconv.Atoi(digit)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to parse digit '%s' as int: %s\", digit, err.Error())\n\t\t}\n\n\t\tswitch strings.ToUpper(unit) {\n\t\tcase \"Y\":\n\t\t\td.Years = digitInt\n\t\tcase \"MO\":\n\t\t\td.Months = digitInt\n\t\tcase \"D\":\n\t\t\td.Days = digitInt\n\t\tcase \"H\":\n\t\t\td.Hours = digitInt\n\t\tcase \"M\":\n\t\t\td.Minutes = digitInt\n\t\tcase \"S\":\n\t\t\td.Seconds = digitInt\n\t\tcase \"MS\":\n\t\t\td.Milliseconds = digitInt\n\t\tcase \"US\":\n\t\t\tfallthrough\n\t\tcase \"µS\":\n\t\t\td.Microseconds = digitInt\n\t\tcase \"NS\":\n\t\t\td.Nanoseconds = digitInt\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"invalid unit '%s'\", unit)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tisUnit := false\n\tflushBuffers()\n\tfor i, char := range s {\n\t\tif unicode.IsSpace(char) {\n\t\t\tcontinue\n\t\t}\n\t\tif unicode.IsDigit(char) {\n\t\t\tdigitBuf.WriteRune(char)\n\t\t\tisUnit = false\n\t\t} else {\n\t\t\tunitBuf.WriteRune(char)\n\t\t\tisUnit = true\n\t\t}\n\n\t\t// if we're at the last rune in iteration, or looking at a unit and next rune is either a digit or whitespace, flush\n\t\tif len(s)-1 == i || (isUnit && (unicode.IsDigit(rune(s[i+1])) || unicode.IsSpace(rune(s[i+1])))) {\n\t\t\terr := flush()\n\t\t\tif err != nil {\n\t\t\t\treturn d, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn d, err\n}", "title": "" }, { "docid": "fcca3165a7d98153546ebb5d608092dc", "score": "0.56423616", "text": "func (f *TimeFormatter) Format(value float64) string {\n\tvar unit string\n\tif value < 60 {\n\t\tunit = \"s\"\n\t} else if value < 60*60 {\n\t\tvalue = value / float64(60)\n\t\tunit = \"min\"\n\t} else {\n\t\tvalue = value / float64(60*60)\n\t\tunit = \"h\"\n\t}\n\treturn fmt.Sprintf(\"%.1f %s\", value, unit)\n}", "title": "" }, { "docid": "b9a2caa5cff0a920375dd1eee5c1719a", "score": "0.55768883", "text": "func DurationStamp(dur float64) string {\n\tif dur < 0 {\n\t\treturn \"--NEGATIVE--\"\n\t}\n\tstamp := \"\"\n\thh := int(dur) / int(3600)\n\thLeft := int(dur) % int(3600)\n\tmm := hLeft / 60\n\tss := hLeft % 60\n\tsLeft := dur - (float64(hh*3600) + float64(mm*60) + float64(ss))\n\tms := int(sLeft * 1000)\n\t////////\n\thhs := strconv.Itoa(int(hh))\n\tfor len(hhs) < 2 {\n\t\thhs = \"0\" + hhs\n\t}\n\tmms := strconv.Itoa(int(mm))\n\tfor len(mms) < 2 {\n\t\tmms = \"0\" + mms\n\t}\n\tsss := strconv.Itoa(int(ss))\n\tfor len(sss) < 2 {\n\t\tsss = \"0\" + sss\n\t}\n\tmss := strconv.Itoa(int(ms))\n\tfor len(mss) < 3 {\n\t\tmss = \"0\" + mss\n\t}\n\tstamp = hhs + \":\" + mms + \":\" + sss + \".\" + mss\n\treturn stamp\n\n}", "title": "" }, { "docid": "1deceebf56e09411592b728869a342d2", "score": "0.55738163", "text": "func durationSerialize(d time.Duration) (s string) {\n\ts = \"P\"\n\tif d < 0 {\n\t\ts = \"-P\"\n\t\td = -1 * d\n\t}\n\tvar tally time.Duration\n\tif years := d.Hours() / 8760.0; years >= 1 {\n\t\tnYears := int64(math.Floor(years))\n\t\ttally += time.Duration(nYears) * 8760 * time.Hour\n\t\ts = fmt.Sprintf(\"%s%dY\", s, nYears)\n\t}\n\tif months := (d.Hours() - tally.Hours()) / 720.0; months >= 1 {\n\t\tnMonths := int64(math.Floor(months))\n\t\ttally += time.Duration(nMonths) * 720 * time.Hour\n\t\ts = fmt.Sprintf(\"%s%dM\", s, nMonths)\n\t}\n\tif days := (d.Hours() - tally.Hours()) / 24.0; days >= 1 {\n\t\tnDays := int64(math.Floor(days))\n\t\ttally += time.Duration(nDays) * 24 * time.Hour\n\t\ts = fmt.Sprintf(\"%s%dD\", s, nDays)\n\t}\n\tif tally < d {\n\t\ts = fmt.Sprintf(\"%sT\", s)\n\t\tif hours := d.Hours() - tally.Hours(); hours >= 1 {\n\t\t\tnHours := int64(math.Floor(hours))\n\t\t\ttally += time.Duration(nHours) * time.Hour\n\t\t\ts = fmt.Sprintf(\"%s%dH\", s, nHours)\n\t\t}\n\t\tif minutes := d.Minutes() - tally.Minutes(); minutes >= 1 {\n\t\t\tnMinutes := int64(math.Floor(minutes))\n\t\t\ttally += time.Duration(nMinutes) * time.Minute\n\t\t\ts = fmt.Sprintf(\"%s%dM\", s, nMinutes)\n\t\t}\n\t\tif seconds := d.Seconds() - tally.Seconds(); seconds >= 1 {\n\t\t\tnSeconds := int64(math.Floor(seconds))\n\t\t\ttally += time.Duration(nSeconds) * time.Second\n\t\t\ts = fmt.Sprintf(\"%s%dS\", s, nSeconds)\n\t\t}\n\t}\n\treturn\n\n}", "title": "" }, { "docid": "b3d65a4f5f0ddcc70bc7363ec45e90de", "score": "0.55486256", "text": "func toString(s float64, fps float64) string {\n\tif fps == 0 {\n\t\tfps = defaultFps\n\t}\n\t{\n\t\td := int64(s)\n\t\th := d / 3600\n\t\td %= 3600\n\t\tm := d / 60\n\t\tm %= 60\n\t\ts := d % 60\n\t\tf := 0 // TODO(as): frame number\n\t\treturn fmt.Sprintf(\"%02d:%02d:%02d:%02d\", h, m, s, f)\n\t}\n}", "title": "" }, { "docid": "00db584dcc821245670ae3d238b0d6f8", "score": "0.5533045", "text": "func (t DurationString) Duration() (time.Duration, error) {\n\treturn time.ParseDuration(string(t))\n}", "title": "" }, { "docid": "b12c74e89a2d962f65e48842fd845574", "score": "0.55109954", "text": "func AtForString(hour int, minute int, duration int) string {\n\tif hour < 0 || hour > 23 {\n\t\tif duration > 0 {\n\t\t\thour = 0\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\tif hour == 0 && minute == 0 && duration == 0 {\n\t\treturn \"\"\n\t}\n\tatString := fmt.Sprintf(\"@%02d\", hour)\n\tif minute < 0 || minute > 59 {\n\t\tminute = 0\n\t}\n\tatString += fmt.Sprintf(\":%02d\", minute)\n\tif duration > 0 {\n\t\tvar forString string\n\t\tdays := duration / 1440\n\t\thours := duration / 60 % 24\n\t\tminutes := duration % 60\n\t\tif days > 0 {\n\t\t\tforString += fmt.Sprintf(\"%dd\", days)\n\t\t}\n\t\tif hours > 0 {\n\t\t\tforString += fmt.Sprintf(\"%dh\", hours)\n\t\t}\n\t\tif minutes > 0 {\n\t\t\tforString += fmt.Sprintf(\"%dm\", minutes)\n\t\t}\n\t\tif days > 0 && hours == 0 && minutes == 0 && hour == 0 && minute == 0 {\n\t\t\treturn \"for \" + forString\n\t\t} else {\n\t\t\treturn atString + \" for \" + forString\n\t\t}\n\t} else {\n\t\treturn atString\n\t}\n}", "title": "" }, { "docid": "56d9739d6e66e1a37faa9310cf301f26", "score": "0.5499281", "text": "func (d *DurationOpt) String() string {\n\tif d.value != nil {\n\t\treturn d.value.String()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a33605501725370a0aa76f705a8f067a", "score": "0.54820496", "text": "func ConvertUnitToString(unit int) (unitStr string) {\n\tswitch unit {\n\tcase int(PacketsPerSecond): unitStr = string(messages.PACKETS_PER_SECOND)\n\tcase int(BitsPerSecond): unitStr = string(messages.BITS_PER_SECOND)\n\tcase int(BytesPerSecond): unitStr = string(messages.BYTES_PER_SECOND)\n\tcase int(KiloPacketsPerSecond): unitStr = string(messages.KILOPACKETS_PER_SECOND)\n\tcase int(KiloBitsPerSecond): unitStr = string(messages.KILOBITS_PER_SECOND)\n\tcase int(KiloBytesPerSecond): unitStr = string(messages.KILOBYTES_PER_SECOND)\n\tcase int(MegaPacketsPerSecond): unitStr = string(messages.MEGAPACKETS_PER_SECOND)\n\tcase int(MegaBitsPerSecond): unitStr = string(messages.MEGABITS_PER_SECOND)\n\tcase int(MegaBytesPerSecond): unitStr = string(messages.MEGABYTES_PER_SECOND)\n\tcase int(GigaPacketsPerSecond): unitStr = string(messages.GIGAPACKETS_PER_SECOND)\n\tcase int(GigaBitsPerSecond): unitStr = string(messages.GIGABITS_PER_SECOND)\n\tcase int(GigaBytesPerSecond): unitStr = string(messages.GIGABYTES_PER_SECOND)\n\tcase int(TeraPacketsPerSecond): unitStr = string(messages.TERAPACKETS_PER_SECOND)\n\tcase int(TeraBitsPerSecond): unitStr = string(messages.TERABITS_PER_SECOND)\n\tcase int(TeraBytesPerSecond): unitStr = string(messages.TERABYTES_PER_SECOND)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5f053d83c6faa213e91772a3f9ff798b", "score": "0.5473448", "text": "func TestGetDurationInSeconds(t *testing.T) {\n\ttype args struct {\n\t\tcreativeTag string // ad element\n\t}\n\ttype want struct {\n\t\tduration int // seconds (will converted from string with format as HH:MM:SS.mmm)\n\t\terr error\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant want\n\t}{\n\t\t// duration validation tests\n\t\t{name: \"duration 00:00:25 (= 25 seconds)\", want: want{duration: 25}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>00:00:25</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration 00:00:-25 (= -25 seconds)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>00:00:-25</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration 00:00:30.999 (= 30.990 seconds (int -> 30 seconds))\", want: want{duration: 30}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>00:00:30.999</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration 00:01:08 (1 min 8 seconds = 68 seconds)\", want: want{duration: 68}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>00:01:08</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration 02:13:12 (2 hrs 13 min 12 seconds) = 7992 seconds)\", want: want{duration: 7992}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>02:13:12</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration 3:40:43.5 (3 hrs 40 min 43 seconds 5 ms) = 6043.005 seconds (int -> 6043 seconds))\", want: want{duration: 13243}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>3:40:43.5</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration 00:00:25.0005458 (0 hrs 0 min 25 seconds 0005458 ms) - invalid max ms is 999\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>00:00:25.0005458</Duration> </Linear> </Creative>`}},\n\t\t{name: \"invalid duration 3:13:900 (3 hrs 13 min 900 seconds) = Invalid seconds )\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>3:13:900</Duration> </Linear> </Creative>`}},\n\t\t{name: \"invalid duration 3:13:34:44 (3 hrs 13 min 34 seconds :44=invalid) = ?? )\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>3:13:34:44</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration = 0:0:45.038 , with milliseconds duration (0 hrs 0 min 45 seconds and 038 millseconds) = 45.038 seconds (int -> 45 seconds) )\", want: want{duration: 45}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>0:0:45.038</Duration> </Linear> </InLine> </Creative>`}},\n\t\t{name: \"duration = 0:0:48.50 = 48.050 seconds (int -> 48 seconds))\", want: want{duration: 48}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>0:0:48.50</Duration> </Linear> </InLine> </Creative>`}},\n\t\t{name: \"duration = 0:0:28.59 = 28.059 seconds (int -> 28 seconds))\", want: want{duration: 28}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>0:0:28.59</Duration> </Linear> </InLine> </Creative>`}},\n\t\t{name: \"duration = 56 (ambiguity w.r.t. HH:MM:SS.mmm format)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>56</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration = :56 (ambiguity w.r.t. HH:MM:SS.mmm format)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>:56</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration = :56: (ambiguity w.r.t. HH:MM:SS.mmm format)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>:56:</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration = ::56 (ambiguity w.r.t. HH:MM:SS.mmm format)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>::56</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration = 56.445 (ambiguity w.r.t. HH:MM:SS.mmm format)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>56.445</Duration> </Linear> </Creative>`}},\n\t\t{name: \"duration = a:b:c.d (no numbers)\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative sequence=\"1\"> <Linear> <Duration>a:b:c.d</Duration> </Linear> </Creative>`}},\n\n\t\t// tag validations tests\n\t\t{name: \"Linear Creative no duration\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative><Linear><Linear></Creative>`}},\n\t\t{name: \"Companion Creative no duration\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative><CompanionAds></CompanionAds></Creative>`}},\n\t\t{name: \"Non-Linear Creative no duration\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative><NonLinearAds></NonLinearAds></Creative>`}},\n\t\t{name: \"Invalid Creative tag\", want: want{err: errors.New(\"Invalid Creative\")}, args: args{creativeTag: `<Ad></Ad>`}},\n\t\t{name: \"Nil Creative tag\", want: want{err: errors.New(\"Invalid Creative\")}, args: args{creativeTag: \"\"}},\n\n\t\t// multiple linear tags in creative\n\t\t{name: \"Multiple Linear Ads within Creative\", want: want{duration: 25}, args: args{creativeTag: `<Creative><Linear><Duration>0:0:25<Duration></Linear><Linear><Duration>0:0:30<Duration></Linear></Creative>`}},\n\t\t// Case sensitivity check - passing DURATION (vast is case-sensitive as per https://vastvalidator.iabtechlab.com/dash)\n\t\t{name: \"<DURATION> all caps\", want: want{err: errors.New(\"Invalid Duration\")}, args: args{creativeTag: `<Creative><Linear><DURATION>0:0:10</Duration></Linear></Creative>`}},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tdoc := etree.NewDocument()\n\t\t\tdoc.ReadFromString(tt.args.creativeTag)\n\t\t\tdur, err := getDuration(doc.FindElement(\"./Creative\"))\n\t\t\tassert.Equal(t, tt.want.duration, dur)\n\t\t\tassert.Equal(t, tt.want.err, err)\n\t\t\t// if error expects 0 value for duration\n\t\t\tif nil != err {\n\t\t\t\tassert.Equal(t, 0, dur)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ee9a15f1c963c53df3bdd65e509f417f", "score": "0.54361445", "text": "func (s QueryTiming) String() string {\n\tswitch s {\n\tcase TotalEvalTime:\n\t\treturn \"Total eval time\"\n\tcase ResultSortTime:\n\t\treturn \"Result sorting time\"\n\tcase QueryPreparationTime:\n\t\treturn \"Query preparation time\"\n\tcase InnerEvalTime:\n\t\treturn \"Inner eval time\"\n\tcase ResultAppendTime:\n\t\treturn \"Result append time\"\n\tcase ExecQueueTime:\n\t\treturn \"Exec queue wait time\"\n\tdefault:\n\t\treturn \"Unknown query timing\"\n\t}\n}", "title": "" }, { "docid": "59bb346605ba9a4bb813b36de5c0f4e9", "score": "0.54254025", "text": "func GetDuration(duration string) (seconds int) {\n\tduration = strings.TrimSpace(duration)\n\tif duration == \"\" {\n\t\treturn 0\n\t}\n\n\t// Count hour.\n\tr := regexp.MustCompile(`\\d+ hr.`)\n\tmatch := r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\th := GetValueFromSplit(match[0], \" \", 0)\n\t\tseconds += StrToNum(h) * 3600\n\t}\n\n\t// Count minute.\n\tr = regexp.MustCompile(`\\d+ min.`)\n\tmatch = r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\tm := GetValueFromSplit(match[0], \" \", 0)\n\t\tseconds += StrToNum(m) * 60\n\t}\n\n\t// Count minute.\n\tr = regexp.MustCompile(`\\d+ sec.`)\n\tmatch = r.FindStringSubmatch(duration)\n\tif len(match) > 0 {\n\t\ts := GetValueFromSplit(match[0], \" \", 0)\n\t\tseconds += StrToNum(s)\n\t}\n\n\treturn seconds\n}", "title": "" }, { "docid": "6c3f5d2adcfa62b36bea862576342d3f", "score": "0.54181516", "text": "func (i Interval) String() string {\n\treturn i.Duration().String()\n}", "title": "" }, { "docid": "c1a8da3d503bd510d5484f206038847a", "score": "0.54177624", "text": "func simpleDur(d time.Duration) time.Duration {\n\tif d < time.Second {\n\t\treturn d.Round(time.Millisecond)\n\t}\n\tif d < time.Minute {\n\t\treturn d.Round(time.Second)\n\t}\n\treturn d.Round(time.Minute)\n}", "title": "" }, { "docid": "48cd33a41e7b221a8493d92d98ed1e5f", "score": "0.53721666", "text": "func (du displayUnit) Format(val float64) string {\n\tswitch du {\n\tcase displayUnitMs:\n\t\treturn humanize.FormatFloat(\"#,###.##\", val) + \" ms\"\n\tcase displayUnitUs:\n\t\treturn humanize.FormatFloat(\"#,###.##\", val) + \" us\"\n\tdefault:\n\t\treturn humanize.Comma(int64(val)) + \" ns\"\n\t}\n}", "title": "" }, { "docid": "6d30e7cb4a569f9b4c615d505a0f55b5", "score": "0.53646", "text": "func (t *TimeDivision) String() string {\n\tif t.value == 0 {\n\t\treturn \"&TimeDivision{bpm: 120}\"\n\t}\n\tif t.value < 32768 {\n\t\treturn fmt.Sprintf(\"&TimeDivision{bpm: %d}\", t.value)\n\t}\n\n\tframes := (t.value & 0x7F00) >> 8\n\tticks := t.value & 0x00FF\n\n\treturn fmt.Sprintf(\"&TimeDivision{frames: %v, ticks: %v}\", frames, ticks)\n}", "title": "" }, { "docid": "d87bb2b4e5e88d5452072c194ecdc570", "score": "0.53508234", "text": "func (client *Client) TimeDuration(metric string, d time.Duration) {\n\tclient.Send(metric, fmt.Sprintf(\"%d\", d.Nanoseconds()/1e6), \"ms\", 1)\n}", "title": "" }, { "docid": "8077ebc33e8e9a35f0bacc4348a1f028", "score": "0.5344504", "text": "func (t Time) Format() string {\n\ts := time.Time(t).Format(timeFormat)\n\t// ravendb server only accepts 7 digits for fraction part but Go's\n\t// formatting might remove trailing zeros, producing 6 digits\n\tdotIdx := strings.LastIndexByte(s, '.')\n\n\tif dotIdx == -1 {\n\t\ts = s[:len(s)-1] // remove 'Z'\n\t\ts = s + \".0000000Z\"\n\t} else {\n\t\tnToAdd := 9 - (len(s) - dotIdx) // 9: 7 + 1 for 'Z' and 1 for '.'\n\t\tif nToAdd > 0 {\n\t\t\ts = s[:len(s)-1] // remove 'Z'\n\t\t\tfor ; nToAdd > 0; nToAdd-- {\n\t\t\t\ts = s + \"0\"\n\t\t\t}\n\t\t\ts = s + \"Z\"\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "28af1793bf8dcc9f9d1a09547c1ee70d", "score": "0.5344353", "text": "func (t DurationString) DurationDefault(defaultDuration time.Duration) time.Duration {\n\tval, err := t.Duration()\n\tif err != nil {\n\t\treturn defaultDuration\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "6bae2c974872e6dd4d62594c3da07591", "score": "0.5343254", "text": "func (me TdurationType) String() string { return xsdt.Nmtoken(me).String() }", "title": "" }, { "docid": "43fc09259bbd42507be9f6c0a509a8b2", "score": "0.53404766", "text": "func (i Interval) String() string {\n\tif i.Months == 0 && i.Days == 0 && i.SomeSeconds == 0 {\n\t\treturn \"00:00:00\"\n\t}\n\n\ty := i.NormalYears()\n\tmon := i.NormalMonths()\n\n\tstr := \"\"\n\tif y != 0 {\n\t\tstr += strconvhelper.FormatInt32(y) + \" year \"\n\t}\n\tif mon != 0 {\n\t\tstr += strconvhelper.FormatInt32(mon) + \" mons \"\n\t}\n\tif i.Days != 0 {\n\t\tstr += strconvhelper.FormatInt32(i.Days) + \" days \"\n\t}\n\n\tif i.SomeSeconds != 0 {\n\t\tnegativeTime := i.SomeSeconds < 0\n\t\tif negativeTime { // TODO possible overflow because of MinInt64*-1\n\t\t\ti.SomeSeconds *= -1\n\t\t}\n\n\t\ttmp := mathhelper.PowInt64(10, int64(i.precision))\n\t\th := i.NormalHours()\n\t\tm := i.NormalMinutes()\n\t\tf := i.SomeSeconds % (tmp * SecsInMin)\n\t\ts := f / tmp\n\t\tf -= s * tmp\n\n\t\tif negativeTime {\n\t\t\tstr += \"-\"\n\t\t}\n\n\t\tstr += stringshelper.PadLeftWithByte(strconvhelper.FormatInt64(h), '0', 2) + \":\" +\n\t\t\tstringshelper.PadLeftWithByte(strconvhelper.FormatInt8(m), '0', 2) + \":\" +\n\t\t\tstringshelper.PadLeftWithByte(strconvhelper.FormatInt64(s), '0', 2)\n\t\tif f != 0 {\n\t\t\tstr += \".\" + strings.TrimRight(\n\t\t\t\tstringshelper.PadLeftWithByte(strconvhelper.FormatInt64(f), '0', int(i.precision)),\n\t\t\t\t\"0\",\n\t\t\t)\n\t\t}\n\n\t\treturn str\n\t}\n\t// As all null interval filtered at the beginning of method there is a space at the end of string\n\treturn str[:len(str)-1]\n}", "title": "" }, { "docid": "6f833f6ae319c238422b4498d3509e5b", "score": "0.53380984", "text": "func secondsToHHMMSS(s float64) string {\n\thh := math.Floor(s / 3600)\n\tmm := math.Floor((s - hh*3600) / 60)\n\tss := int64(math.Floor(s-hh*3600-mm*60)) + round(math.Remainder(s, 1.0))\n\n\thhString := strconv.FormatInt(int64(hh), 10)\n\tmmString := strconv.FormatInt(int64(mm), 10)\n\tssString := strconv.FormatInt(int64(ss), 10)\n\n\tif hh < 10 {\n\t\thhString = \"0\" + hhString\n\t}\n\tif mm < 10 {\n\t\tmmString = \"0\" + mmString\n\t}\n\tif ss < 10 {\n\t\tssString = \"0\" + ssString\n\t}\n\treturn hhString + \":\" + mmString + \":\" + ssString\n}", "title": "" }, { "docid": "b50149d1f9fe5b65c842c4b4f0807574", "score": "0.53213155", "text": "func getMillisecondsFromDurationString(s string) (string, error) {\n\tduration, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strconv.Itoa(int(duration.Seconds() * 1000)), nil\n}", "title": "" }, { "docid": "0d029551b3813853f33c8a53b1482042", "score": "0.5320942", "text": "func (t *WorkingTime) String() string {\n if t == nil || t.IsZero() {\n return \" \"\n }\n\n return fmt.Sprintf(\"%02d:%02d:%02d\", t.t/3600, (t.t/60)%60, t.t%60)\n}", "title": "" }, { "docid": "c90afc66bf655d77328a905663587aed", "score": "0.5306707", "text": "func ConvertMesurementSampleToString(measurementSample int) (measurementSampleStr string) {\n\tswitch measurementSample {\n\tcase int(Second): measurementSampleStr = string(messages.SECOND)\n\tcase int(FiveSeconds): measurementSampleStr = string(messages.FIVE_SECONDS)\n\tcase int(ThirtySeconds):measurementSampleStr = string(messages.THIRTY_SECONDDS)\n\tcase int(OneMinute): measurementSampleStr = string(messages.ONE_MINUTE)\n\tcase int(FiveMinutes): measurementSampleStr = string(messages.FIVE_MINUTES)\n\tcase int(TenMinutes): measurementSampleStr = string(messages.TEN_MINUTES)\n\tcase int(ThirtyMinutes):measurementSampleStr = string(messages.THIRTY_MINUTES)\n\tcase int(OneHour): measurementSampleStr = string(messages.ONE_HOUR)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc3c79d836e4092a6ad19330ee2e026f", "score": "0.52993", "text": "func ComputeDuration(startTime, endTime time.Time) string {\n\tif startTime.After(endTime) {\n\t\treturn \"0s\"\n\t}\n\tdiff := endTime.Sub(startTime).Seconds()\n\tif diff == 0 {\n\t\treturn \"0s\"\n\t} else if diff > 0 && diff < 1 {\n\t\treturn \"1s\"\n\t} else if diff < 60 {\n\t\treturn fmt.Sprintf(\"%ds\", int(diff+0.5))\n\t} else if diff >= 60 && diff < 3600 {\n\t\treturn fmt.Sprintf(\"%dm\", int((diff/60)+0.5))\n\t}\n\tdiffH := endTime.Sub(startTime).Hours()\n\thoursPart := int(diffH)\n\tminPart := int((diffH - float64(int(diffH))) * 60)\n\tif minPart == 0 {\n\t\treturn fmt.Sprintf(\"%dH\", hoursPart)\n\t}\n\treturn fmt.Sprintf(\"%dH%dm\", hoursPart, minPart)\n}", "title": "" }, { "docid": "4fcee6daac9baf41e4d692d889c534bc", "score": "0.52598387", "text": "func Duration(val string, def time.Duration) time.Duration {\n\td, err := time.ParseDuration(val)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn d\n}", "title": "" }, { "docid": "a1d17b705e096c470fe1b7a7448e7273", "score": "0.52456474", "text": "func (d Measure) String() (repr string) {\n\trepr = fmt.Sprintf(\"(%d) %s\\t|\", d.Id, d.Name)\n\n\tfor i, b := range d.Steps {\n\t\tif i%4 == 0 && i > 0 {\n\t\t\trepr += \"|\"\n\t\t}\n\t\tif b {\n\t\t\trepr += \"-\"\n\t\t} else {\n\t\t\trepr += \"x\"\n\t\t}\n\t}\n\trepr += \"|\"\n\treturn\n}", "title": "" }, { "docid": "07c86f2f5c0e4d74f0d693def465d7b4", "score": "0.5237084", "text": "func parseDuration(duration string) float64 {\n\t// fmt.Println(duration)\n\ttmp := strings.Split(duration, \"H\")\n\thours,_ := strconv.ParseFloat(tmp[0], 64)\n\tif len(tmp) > 1 {\n\t\ttmp = strings.Split(tmp[1], \"M\")\n\t} else {\n\t\ttmp = strings.Split(tmp[0], \"M\")\n\t}\n\tminutes,_ := strconv.ParseFloat(tmp[0], 64)\n\n\treturn hours + minutes/60\n}", "title": "" }, { "docid": "52cfee6a4c3fd2228398c9bc92a12788", "score": "0.52351797", "text": "func FmtDuration(value time.Duration, name string) Field {\n\treturn Field(fmt.Sprintf(\"%q: %q\", name, value))\n}", "title": "" }, { "docid": "81517ce62a2d13ff7a4861136cf878d2", "score": "0.52338535", "text": "func DurationToMS(d time.Duration, multiplier float64) string {\n\treturn strconv.Itoa(int(d.Seconds() * 1000.0 * multiplier))\n}", "title": "" }, { "docid": "dec1f5bf2a26fa53dca39f2a7cc1485f", "score": "0.52079415", "text": "func (c Clock) String() string {\n\th := c / 60\n\tm := c % 60\n\treturn fmt.Sprintf(\"%02d:%02d\", h, m)\n}", "title": "" }, { "docid": "6dadc94465b7f784dc3c1fbcb6ff8d30", "score": "0.5204916", "text": "func durationToSQL(d time.Duration) []byte {\n\tdSeconds := d.Seconds()\n\tdMinutes, fSeconds := math.Modf(dSeconds / 60)\n\tseconds := fSeconds * 60\n\tdHours, fMinutes := math.Modf(dMinutes / 60)\n\tminutes := fMinutes * 60\n\tdays, fHours := math.Modf(dHours / 24)\n\thours := fHours * 24\n\tsql := fmt.Sprintf(\"%.0f %.0f:%.0f:%f\", days, hours, minutes, seconds)\n\treturn []byte(sql)\n}", "title": "" }, { "docid": "70977581a60b838824c5c32cf7bd3f56", "score": "0.5196798", "text": "func (p *Period) String() string {\n\treturn fmt.Sprintf(\"Period [%d ms]\", p.Value)\n}", "title": "" }, { "docid": "99d8eda4c54838a7b5e9b1af08cb00f2", "score": "0.51801705", "text": "func (t *Timer) String() string {\n\treturn fmt.Sprintf(\"Loop %sms (Avg %sms)\", t.Elapsed(), t.AverageElapsed())\n}", "title": "" }, { "docid": "c049a1e0b2fcba3c2284a2a5c402a03e", "score": "0.51787543", "text": "func (t Time) String() string {\n\treturn time.Time(t).UTC().Format(timeFormatParameters)\n}", "title": "" }, { "docid": "f0837c63a0b193404a7dbde2499414e0", "score": "0.5176761", "text": "func (c Clock) String() string {\n\treturn fmt.Sprintf(\"%02d:%02d\", c/60, c-(c/60)*60)\n}", "title": "" }, { "docid": "5faed82fcb9e76fa4a16e9ba7f6fdb75", "score": "0.5176744", "text": "func (c Clock) String() string {\n\treturn fmt.Sprintf(\"%02d:%02d\", c.h, c.m)\n}", "title": "" }, { "docid": "c1e1c6a6b3dd3afb54504377a851ede0", "score": "0.51735204", "text": "func ConvertMesurementIntervalToString(measurementInterval int) (measurementIntervalStr string) {\n\tswitch measurementInterval {\n\tcase int(Hour): measurementIntervalStr = string(messages.HOUR)\n\tcase int(Day): measurementIntervalStr = string(messages.DAY)\n\tcase int(Week): measurementIntervalStr = string(messages.WEEK)\n\tcase int(Month):measurementIntervalStr = string(messages.MONTH)\n\t}\n\treturn\n}", "title": "" }, { "docid": "060d5086447465f4c75df45c7fa72234", "score": "0.51399976", "text": "func (s Size) String() string {\n\tmant := s.bytes\n\tvar exp int\n\tvar suffix string\n\n\tswitch s.Base {\n\tcase 0, Metric:\n\t\tfor mant != 0 && mant%1000 == 0 && exp < len(metricSuffixes) {\n\t\t\texp++\n\t\t\tmant = mant / 1000\n\t\t}\n\t\tsuffix = metricSuffixes[exp]\n\tcase Binary:\n\t\tfor mant != 0 && mant%1024 == 0 && exp < len(binarySuffixes) {\n\t\t\texp++\n\t\t\tmant = mant / 1024\n\t\t}\n\t\tsuffix = binarySuffixes[exp]\n\tdefault:\n\t\tpanic(\"invalid base\")\n\t}\n\n\tresult := make([]byte, 0, 20) // Pre-allocate a size most numbers would fit within.\n\tresult = strconv.AppendInt(result, mant, 10)\n\tresult = append(result, ' ')\n\tresult = append(result, suffix...)\n\treturn string(result)\n}", "title": "" }, { "docid": "b44c8cdf1218bec1389b25f39c8076fa", "score": "0.5139654", "text": "func (c *converters) formatSimpleTime(s string) string {\n\tif s == \"\" {\n\t\treturn c.stringField(s, 4)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "14e48345a212fc52ac5553ab5196f54f", "score": "0.5132339", "text": "func StringDurationEncoder(d time.Duration, m TypeEncoder) {\n\tm.EncodeTypeString(d.String())\n}", "title": "" }, { "docid": "87e9d1e21d3344a7f398be4d693e49ee", "score": "0.512417", "text": "func ParseDuration(duration string) (time.Duration, error) {\n\tparts := strings.Split(strings.TrimSpace(duration), \":\")\n\tif len(parts) != 3 {\n\t\treturn 0, errs.New(\"Invalid format\")\n\t}\n\thours, err := strconv.Atoi(parts[0])\n\tif err != nil || hours < 0 {\n\t\treturn 0, errs.New(\"Invalid hour format\")\n\t}\n\tminutes, err := strconv.Atoi(parts[1])\n\tif err != nil || minutes < 0 {\n\t\treturn 0, errs.New(\"Invalid minute format\")\n\t}\n\tparts = strings.Split(parts[2], \".\")\n\tvar seconds int\n\tvar millis int\n\tswitch len(parts) {\n\tcase 2:\n\t\tif millis, err = strconv.Atoi(parts[1]); err != nil || millis < 0 {\n\t\t\treturn 0, errs.New(\"Invalid millisecond format\")\n\t\t}\n\t\tfallthrough\n\tcase 1:\n\t\tif seconds, err = strconv.Atoi(parts[0]); err != nil || seconds < 0 {\n\t\t\treturn 0, errs.New(\"Invalid second format\")\n\t\t}\n\tdefault:\n\t\treturn 0, errs.New(\"Invalid second format: too many decimal points\")\n\t}\n\treturn time.Duration(hours)*time.Hour + time.Duration(minutes)*time.Minute + time.Duration(seconds)*time.Second + time.Duration(millis)*time.Millisecond, nil\n}", "title": "" }, { "docid": "bca7fa5cf9aed1d27b4891c1f562066c", "score": "0.5119504", "text": "func Durations(d time.Duration) []string {\n\thours := d.Hours()\n\treturn []string{\n\t\t// fmt.Sprintf(\"%dns\", d.Nanoseconds()),\n\t\tfmt.Sprintf(\"seconds: %.2fs\", d.Seconds()),\n\t\tfmt.Sprintf(\"minutes: %.2fm\", d.Minutes()),\n\t\tfmt.Sprintf(\"hours: %.2fh\", hours),\n\t\tfmt.Sprintf(\"days: %.2fd\", hours/perDay),\n\t\tfmt.Sprintf(\"months: %.2fmo\", hours/perMonth),\n\t\tfmt.Sprintf(\"years: %.2fy\", hours/perYear),\n\t}\n}", "title": "" }, { "docid": "59c7cf66084c1f9cc3f2a7fbb9a33b7f", "score": "0.5118515", "text": "func DisplayForTime(seconds int, locale string) string {\n\tif locale == \"\" {\n\t\tlocale = \"US\"\n\t}\n\tresult := \"\"\n\tif seconds >= 3600 {\n\t\tresult = strconv.Itoa(seconds/3600) + \"h \"\n\t}\n\tif seconds%3600 >= 60 {\n\t\tresult = result + strconv.Itoa(seconds%3600/60) + \"min\"\n\t}\n\tif seconds < 60 {\n\t\tresult = strconv.Itoa(seconds) + \"sec\"\n\t}\n\treturn strings.TrimSpace(result)\n}", "title": "" }, { "docid": "d0ca3e79741b49938346206cb066ac93", "score": "0.5118378", "text": "func (ts *Time_slice) To_str( ) ( string ) {\n\ts := time.Unix( ts.commence, 0 )\n\te := time.Unix( ts.conclude, 0 )\n\treturn fmt.Sprintf( \"from %s to %s: %d\", s.Format( time.RFC822Z ), e.Format( time.RFC822Z ), ts.Amt )\n}", "title": "" }, { "docid": "bff01df6ca0794eefb01a369e0c3ab2e", "score": "0.51167977", "text": "func durationToMill(s string) int {\n\tv, _ := time.ParseDuration(s)\n\treturn int(v.Milliseconds())\n}", "title": "" }, { "docid": "a4168a24bc862bb7b8fdade6ed52e870", "score": "0.5116012", "text": "func ParseDuration(since time.Duration) string {\n\tif since.Hours() > 24 {\n\t\treturn parseHours(since.Hours())\n\t}\n\tif since.Minutes() >= 90 {\n\t\treturn fmt.Sprintf(\"%0.f hours ago\", since.Hours())\n\t}\n\tif since.Minutes() < 90 && since.Minutes() > 60 {\n\t\treturn \"1 hour ago\"\n\t}\n\tif since.Seconds() > 90 {\n\t\treturn fmt.Sprintf(\"%0.f minutes ago\", since.Minutes())\n\t}\n\tif since.Seconds() > 60 {\n\t\treturn \"1 minute ago\"\n\t}\n\tif since.Seconds() < 1.5 {\n\t\treturn \"1 second ago\"\n\t}\n\treturn fmt.Sprintf(\"%0.f seconds ago\", since.Seconds())\n}", "title": "" } ]
dffec644bc28e4470eb372b747bb3bff
RemovedIDs returns all ids (to other nodes) that were removed for the given edge name.
[ { "docid": "0f9ec9371d1b2fb0d611e7ed742e7fed", "score": "0.7269898", "text": "func (m *PatientMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase patient.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "53ef526280352b14cef12d4eb6acf97b", "score": "0.7545822", "text": "func (m *GraphMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase graph.EdgeMetrics:\n\t\tids := make([]ent.Value, 0, len(m.removedmetrics))\n\t\tfor id := range m.removedmetrics {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c020bbdd1af10fa6f674cbd59e860906", "score": "0.7544274", "text": "func (m *DataRoomMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase dataroom.EdgeReserves:\n\t\tids := make([]ent.Value, 0, len(m.removedreserves))\n\t\tfor id := range m.removedreserves {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase dataroom.EdgeFixs:\n\t\tids := make([]ent.Value, 0, len(m.removedfixs))\n\t\tfor id := range m.removedfixs {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase dataroom.EdgeDetails:\n\t\tids := make([]ent.Value, 0, len(m.removeddetails))\n\t\tfor id := range m.removeddetails {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase dataroom.EdgeCheckins:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckins))\n\t\tfor id := range m.removedcheckins {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8db924043c6d8b08a47a956a00139ec", "score": "0.7517443", "text": "func (m *GroupMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase group.EdgeGraphs:\n\t\tids := make([]ent.Value, 0, len(m.removedgraphs))\n\t\tfor id := range m.removedgraphs {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ecff1c92cc6031130696ad18fb5761e", "score": "0.74940044", "text": "func (m *ApplicationMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase application.EdgeGroups:\n\t\tids := make([]ent.Value, 0, len(m.removedgroups))\n\t\tfor id := range m.removedgroups {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase application.EdgeTags:\n\t\tids := make([]ent.Value, 0, len(m.removedtags))\n\t\tfor id := range m.removedtags {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "56d7f0a994b0d4f78b97b1c2ab22d1fe", "score": "0.74058187", "text": "func (m *PromotionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase promotion.EdgeReserves:\n\t\tids := make([]ent.Value, 0, len(m.removedreserves))\n\t\tfor id := range m.removedreserves {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase promotion.EdgeDatarooms:\n\t\tids := make([]ent.Value, 0, len(m.removeddatarooms))\n\t\tfor id := range m.removeddatarooms {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60138b47d6cc1a05ac8b28d7f91ddf9e", "score": "0.74013126", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgePets:\n\t\tids := make([]ent.Value, 0, len(m.removedpets))\n\t\tfor id := range m.removedpets {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeChildren:\n\t\tids := make([]ent.Value, 0, len(m.removedchildren))\n\t\tfor id := range m.removedchildren {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeInfo:\n\t\tids := make([]ent.Value, 0, len(m.removedinfo))\n\t\tfor id := range m.removedinfo {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeRentals:\n\t\tids := make([]ent.Value, 0, len(m.removedrentals))\n\t\tfor id := range m.removedrentals {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "57102fe2a34952d11e2af21ef9cd3c4a", "score": "0.7399749", "text": "func (m *EmployeeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase employee.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4add337c338fbe5d62f3b52db28bcaa6", "score": "0.7393027", "text": "func (m *ReserveRoomMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase reserveroom.EdgeCheckins:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckins))\n\t\tfor id := range m.removedcheckins {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "234c51576dbae50d8b4154ef9008aaac", "score": "0.7391243", "text": "func (m *PatientMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase patient.EdgeMedicalfiles:\n\t\tids := make([]ent.Value, 0, len(m.removedmedicalfiles))\n\t\tfor id := range m.removedmedicalfiles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase patient.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase patient.EdgeAppointment:\n\t\tids := make([]ent.Value, 0, len(m.removedappointment))\n\t\tfor id := range m.removedappointment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32e942b13c58602551a1fd5102d6ccb2", "score": "0.73841447", "text": "func (m *CounterStaffMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase counterstaff.EdgeCheckins:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckins))\n\t\tfor id := range m.removedcheckins {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase counterstaff.EdgeCheckouts:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckouts))\n\t\tfor id := range m.removedcheckouts {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase counterstaff.EdgeDetails:\n\t\tids := make([]ent.Value, 0, len(m.removeddetails))\n\t\tfor id := range m.removeddetails {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "baabd1e0727d4d367b1e6479207ca494", "score": "0.7379404", "text": "func (m *EmployeeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase employee.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d2a24cd3129a05d397ee6db14f080dd1", "score": "0.73617315", "text": "func (m *MetricMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase metric.EdgeHistograms:\n\t\tids := make([]ent.Value, 0, len(m.removedhistograms))\n\t\tfor id := range m.removedhistograms {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase metric.EdgeCounters:\n\t\tids := make([]ent.Value, 0, len(m.removedcounters))\n\t\tfor id := range m.removedcounters {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase metric.EdgeGauges:\n\t\tids := make([]ent.Value, 0, len(m.removedgauges))\n\t\tfor id := range m.removedgauges {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db86a9f3e326bf131bf3222bd81e78fb", "score": "0.7354552", "text": "func (m *DegreeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase degree.EdgeDentists:\n\t\tids := make([]ent.Value, 0, len(m.removeddentists))\n\t\tfor id := range m.removeddentists {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d3bd0c7782b7836cf84b3b627830d99", "score": "0.73519474", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeCities:\n\t\tids := make([]ent.Value, 0, len(m.removedcities))\n\t\tfor id := range m.removedcities {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeConstructions:\n\t\tids := make([]ent.Value, 0, len(m.removedconstructions))\n\t\tfor id := range m.removedconstructions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f091623bf522438c3d3cac2299596ddb", "score": "0.7347233", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeAddresses:\n\t\tids := make([]ent.Value, 0, len(m.removedaddresses))\n\t\tfor id := range m.removedaddresses {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeCards:\n\t\tids := make([]ent.Value, 0, len(m.removedcards))\n\t\tfor id := range m.removedcards {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "813507df90b2923f33256dcf99a50847", "score": "0.73408014", "text": "func (m *WorkspaceMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase workspace.EdgeWorkspaceRoles:\n\t\tids := make([]ent.Value, 0, len(m.removedworkspace_roles))\n\t\tfor id := range m.removedworkspace_roles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase workspace.EdgeGroups:\n\t\tids := make([]ent.Value, 0, len(m.removedgroups))\n\t\tfor id := range m.removedgroups {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d51f4b0f7ebfb448ccded093dd8a90d6", "score": "0.73347276", "text": "func (m *DentistMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase dentist.EdgeMedicalfiles:\n\t\tids := make([]ent.Value, 0, len(m.removedmedicalfiles))\n\t\tfor id := range m.removedmedicalfiles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase dentist.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase dentist.EdgeAppointment:\n\t\tids := make([]ent.Value, 0, len(m.removedappointment))\n\t\tfor id := range m.removedappointment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8270b01d538e8040dda9a38b48b47aad", "score": "0.73294795", "text": "func (m *MedicalfileMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase medicalfile.EdgeDentalexpenses:\n\t\tids := make([]ent.Value, 0, len(m.removeddentalexpenses))\n\t\tfor id := range m.removeddentalexpenses {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "396b47392344005e5495f47ea209628c", "score": "0.73259366", "text": "func (m *GroupMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase group.EdgeGroupRoles:\n\t\tids := make([]ent.Value, 0, len(m.removedgroup_roles))\n\t\tfor id := range m.removedgroup_roles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25aa690f85a57d5f496ae3aece3ec1f1", "score": "0.7318612", "text": "func (m *SexMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase sex.EdgePeople:\n\t\tids := make([]ent.Value, 0, len(m.removedpeople))\n\t\tfor id := range m.removedpeople {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5adb6eacf52c7dd576bc366ad9652cd8", "score": "0.73090434", "text": "func (m *RoomMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase room.EdgeAppointment:\n\t\tids := make([]ent.Value, 0, len(m.removedappointment))\n\t\tfor id := range m.removedappointment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "366912aacf2f341192bcc0e88dae0aa6", "score": "0.7306525", "text": "func (m *MemberMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase member.EdgeOrders:\n\t\tids := make([]ent.Value, 0, len(m.removedorders))\n\t\tfor id := range m.removedorders {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "80dfadc98a0df5403b31b3f86e0fa907", "score": "0.72957504", "text": "func (m *StatusReserveMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase statusreserve.EdgeReserves:\n\t\tids := make([]ent.Value, 0, len(m.removedreserves))\n\t\tfor id := range m.removedreserves {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f8e17d6633bd8e27ea6b72168fa9b5a0", "score": "0.72824246", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeWorkspaceRoles:\n\t\tids := make([]ent.Value, 0, len(m.removedworkspace_roles))\n\t\tfor id := range m.removedworkspace_roles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeGroupRoles:\n\t\tids := make([]ent.Value, 0, len(m.removedgroup_roles))\n\t\tfor id := range m.removedgroup_roles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgeUserRoles:\n\t\tids := make([]ent.Value, 0, len(m.removeduser_roles))\n\t\tfor id := range m.removeduser_roles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cf1e6a963de628dafcb04c205eebdcb", "score": "0.72798395", "text": "func (m *PlayerMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase player.EdgeServers:\n\t\tids := make([]ent.Value, 0, len(m.removedservers))\n\t\tfor id := range m.removedservers {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase player.EdgeIdentifiers:\n\t\tids := make([]ent.Value, 0, len(m.removedidentifiers))\n\t\tfor id := range m.removedidentifiers {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f80b7d0da8e34c8566154de4b726073", "score": "0.72675705", "text": "func (m *GameServerMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase gameserver.EdgePlayers:\n\t\tids := make([]ent.Value, 0, len(m.removedplayers))\n\t\tfor id := range m.removedplayers {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b9234a70b18a7f2c1965a85cd077b208", "score": "0.7263694", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeOauthConnections:\n\t\tids := make([]ent.Value, 0, len(m.removedoauth_connections))\n\t\tfor id := range m.removedoauth_connections {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase user.EdgePeople:\n\t\tids := make([]ent.Value, 0, len(m.removedpeople))\n\t\tfor id := range m.removedpeople {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "060065fa3483d6ee2543a022c148a274", "score": "0.72593117", "text": "func (m *DiseaseMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase disease.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "060065fa3483d6ee2543a022c148a274", "score": "0.72593117", "text": "func (m *DiseaseMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase disease.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9247d2c0742731fcb2fe662ad656809f", "score": "0.72515833", "text": "func (m *PositionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase position.EdgeMembers:\n\t\tids := make([]ent.Value, 0, len(m.removedmembers))\n\t\tfor id := range m.removedmembers {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase position.EdgeOfficers:\n\t\tids := make([]ent.Value, 0, len(m.removedofficers))\n\t\tfor id := range m.removedofficers {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "300ff3a591c56b4c1c9429f191acb7ea", "score": "0.7242333", "text": "func (m *PatientMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase patient.EdgePrescriptions:\n\t\tids := make([]ent.Value, 0, len(m.removedprescriptions))\n\t\tfor id := range m.removedprescriptions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "258baffed2e5d2a51e03510673ac3628", "score": "0.72361976", "text": "func (m *GenderMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase gender.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd5a5dd9bd1b4388bb4fe31ef8b243c2", "score": "0.72248733", "text": "func (m *CategoryMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase category.EdgeChildren:\n\t\tids := make([]ent.Value, 0, len(m.removedchildren))\n\t\tfor id := range m.removedchildren {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase category.EdgeItems:\n\t\tids := make([]ent.Value, 0, len(m.removeditems))\n\t\tfor id := range m.removeditems {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0f0945255c4cf709aa572bde545c4a9", "score": "0.7220373", "text": "func (m *LabelMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase label.EdgePosts:\n\t\tids := make([]ent.Value, 0, len(m.removedposts))\n\t\tfor id := range m.removedposts {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase label.EdgeGithubRepositories:\n\t\tids := make([]ent.Value, 0, len(m.removedgithub_repositories))\n\t\tfor id := range m.removedgithub_repositories {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "010d23459a09cd54e388f7919a2100ec", "score": "0.72190034", "text": "func (m *GenderMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase gender.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase gender.EdgeDentists:\n\t\tids := make([]ent.Value, 0, len(m.removeddentists))\n\t\tfor id := range m.removeddentists {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32b24bf18185a6af9d6a381bad1dd600", "score": "0.7198711", "text": "func (m *RaceMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase race.EdgePeople:\n\t\tids := make([]ent.Value, 0, len(m.removedpeople))\n\t\tfor id := range m.removedpeople {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ac8161a08d0c6ee07a76cdeffa83c2a8", "score": "0.7198182", "text": "func (m *ExpertMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase expert.EdgeDentists:\n\t\tids := make([]ent.Value, 0, len(m.removeddentists))\n\t\tfor id := range m.removeddentists {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e6c6a896054a8b49090a3b46363c9b9", "score": "0.7194946", "text": "func (m *SystemmemberMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase systemmember.EdgePrescriptions:\n\t\tids := make([]ent.Value, 0, len(m.removedprescriptions))\n\t\tfor id := range m.removedprescriptions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "453d2c9fe67eb31907a7dd6440d4c9ae", "score": "0.7194037", "text": "func (m *StatusRoomMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase statusroom.EdgeDatarooms:\n\t\tids := make([]ent.Value, 0, len(m.removeddatarooms))\n\t\tfor id := range m.removeddatarooms {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a5c0a0d10ec2fc5cae1db5b89b6f03c", "score": "0.71928596", "text": "func (m *QuestionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase question.EdgeAnswer:\n\t\tids := make([]ent.Value, 0, len(m.removedanswer))\n\t\tfor id := range m.removedanswer {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7ea15b6d626ed1d09128f5b51aed0ca", "score": "0.71913004", "text": "func (m *MmedicineMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase mmedicine.EdgePrescriptions:\n\t\tids := make([]ent.Value, 0, len(m.removedprescriptions))\n\t\tfor id := range m.removedprescriptions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f3d67af72bfb5316dc085af6f981069", "score": "0.7188406", "text": "func (m *NurseMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase nurse.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase nurse.EdgeMedicalfiles:\n\t\tids := make([]ent.Value, 0, len(m.removedmedicalfiles))\n\t\tfor id := range m.removedmedicalfiles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase nurse.EdgeDentalexpenses:\n\t\tids := make([]ent.Value, 0, len(m.removeddentalexpenses))\n\t\tfor id := range m.removeddentalexpenses {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase nurse.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase nurse.EdgeDentists:\n\t\tids := make([]ent.Value, 0, len(m.removeddentists))\n\t\tfor id := range m.removeddentists {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase nurse.EdgeAppointment:\n\t\tids := make([]ent.Value, 0, len(m.removedappointment))\n\t\tfor id := range m.removedappointment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07a5fba1d67b6e32d46675c3fb020213", "score": "0.7184412", "text": "func (m *ConstructionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase construction.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase construction.EdgeAffects:\n\t\tids := make([]ent.Value, 0, len(m.removedaffects))\n\t\tfor id := range m.removedaffects {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase construction.EdgeAffectedBy:\n\t\tids := make([]ent.Value, 0, len(m.removedaffected_by))\n\t\tfor id := range m.removedaffected_by {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbee418d3a343e7c555fc09111fe784b", "score": "0.7184058", "text": "func (m *CustomerMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase customer.EdgeReserves:\n\t\tids := make([]ent.Value, 0, len(m.removedreserves))\n\t\tfor id := range m.removedreserves {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase customer.EdgeFixs:\n\t\tids := make([]ent.Value, 0, len(m.removedfixs))\n\t\tfor id := range m.removedfixs {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase customer.EdgeCheckins:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckins))\n\t\tfor id := range m.removedcheckins {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2d4cd204e534a288518a66da73f32fd8", "score": "0.71798486", "text": "func (m *PatientMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase patient.EdgePatientID:\n\t\tids := make([]ent.Value, 0, len(m.removedpatient_id))\n\t\tfor id := range m.removedpatient_id {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6da096e3ca23b553aaef502673b49ea0", "score": "0.7169303", "text": "func (m *StatusCheckInMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase statuscheckin.EdgeCheckins:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckins))\n\t\tfor id := range m.removedcheckins {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "200308b0d6f56ad219bc2ea5c6dc2fb1", "score": "0.716326", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeUserID:\n\t\tids := make([]ent.Value, 0, len(m.removed_User_ID))\n\t\tfor id := range m.removed_User_ID {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95cba6d80097d994fa980ec79255b829", "score": "0.7163258", "text": "func (m *DentistMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase dentist.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b80b599f3296e0b87adf1badb552f9f7", "score": "0.71627563", "text": "func (m *PostMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase post.EdgeLabels:\n\t\tids := make([]ent.Value, 0, len(m.removedlabels))\n\t\tfor id := range m.removedlabels {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76b58e3c7170999cb80b9f9f5aa45e24", "score": "0.7160181", "text": "func (m *SubjectMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase subject.EdgeSubjectID:\n\t\tids := make([]ent.Value, 0, len(m.removed_Subject_ID))\n\t\tfor id := range m.removed_Subject_ID {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a506783772c694e47d5af8cc14c68e9", "score": "0.7159916", "text": "func (m *ItemMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase item.EdgeCategories:\n\t\tids := make([]ent.Value, 0, len(m.removedcategories))\n\t\tfor id := range m.removedcategories {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fb096b0883814b1489f733f96eaaedbc", "score": "0.7149809", "text": "func (m *AmountpaidMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase amountpaid.EdgeAmountpaidRecordinsurance:\n\t\tids := make([]ent.Value, 0, len(m.removedamountpaid_recordinsurance))\n\t\tfor id := range m.removedamountpaid_recordinsurance {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c72c643566efdfd45cc4b22ff2c2c26d", "score": "0.714068", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgePosts:\n\t\tids := make([]ent.Value, 0, len(m.removedposts))\n\t\tfor id := range m.removedposts {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "494832a3c6d92f88ff5784f5e71f60fc", "score": "0.7135232", "text": "func (m *OrderMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase order.EdgeOrderItems:\n\t\tids := make([]ent.Value, 0, len(m.removedorderItems))\n\t\tfor id := range m.removedorderItems {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b3aaf1514cd6af807042182cabd60f2", "score": "0.7132566", "text": "func (m *FurnitureMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase furniture.EdgeDetails:\n\t\tids := make([]ent.Value, 0, len(m.removeddetails))\n\t\tfor id := range m.removeddetails {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66ac99b2000d4ee67832385794b06bc9", "score": "0.7131365", "text": "func (m *DoctorMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase doctor.EdgePrescriptions:\n\t\tids := make([]ent.Value, 0, len(m.removedprescriptions))\n\t\tfor id := range m.removedprescriptions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "997ddc529795dab8c3cac8fa227e1aa4", "score": "0.7122321", "text": "func (m *StateMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase state.EdgeVehicleRegistrations:\n\t\tids := make([]ent.Value, 0, len(m.removedvehicle_registrations))\n\t\tfor id := range m.removedvehicle_registrations {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ffe1cda9ead8ad4904e8ea8afe0b215", "score": "0.71126944", "text": "func (m *MedicalCareMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase medicalcare.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ffe1cda9ead8ad4904e8ea8afe0b215", "score": "0.71126944", "text": "func (m *MedicalCareMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase medicalcare.EdgePatients:\n\t\tids := make([]ent.Value, 0, len(m.removedpatients))\n\t\tfor id := range m.removedpatients {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d8f13d5b49f7f45cd0b7a70e3151901", "score": "0.71107954", "text": "func (m *VehicleMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase vehicle.EdgeRegistrations:\n\t\tids := make([]ent.Value, 0, len(m.removedregistrations))\n\t\tfor id := range m.removedregistrations {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d10c1cb863e498bb861bdf94d5e86673", "score": "0.7094795", "text": "func (m *MetadataMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase metadata.EdgeChildren:\n\t\tids := make([]ent.Value, 0, len(m.removedchildren))\n\t\tfor id := range m.removedchildren {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51dd8ae5c0b2cf6627ca874fbde018b6", "score": "0.70898163", "text": "func (m *OrderMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase order.EdgeOrderItems:\n\t\tids := make([]ent.Value, 0, len(m.removedorder_items))\n\t\tfor id := range m.removedorder_items {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0254a41d6c94ae9f753957f4112083b", "score": "0.7079145", "text": "func (m *CollectionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase collection.EdgeBooks:\n\t\tids := make([]ent.Value, 0, len(m.removedbooks))\n\t\tfor id := range m.removedbooks {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08e567873a38498825a8124ca8902082", "score": "0.7077677", "text": "func (m *SectionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase section.EdgeSecID:\n\t\tids := make([]ent.Value, 0, len(m.removedsec_id))\n\t\tfor id := range m.removedsec_id {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b259334e83b5f087812e7980b4076c9", "score": "0.70716983", "text": "func (m *AnswerMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase answer.EdgeQuestionID:\n\t\tids := make([]ent.Value, 0, len(m.removedquestion_id))\n\t\tfor id := range m.removedquestion_id {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef7c25e1f04ab83557fe40ac0a8dc846", "score": "0.7066605", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeDoctorID:\n\t\tids := make([]ent.Value, 0, len(m.removeddoctor_id))\n\t\tfor id := range m.removeddoctor_id {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "865b5b45fa30c6a293c486918f308bf7", "score": "0.7064498", "text": "func (m *MedicalEquipmentMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase medicalequipment.EdgeSystemequipment:\n\t\tids := make([]ent.Value, 0, len(m.removedsystemequipment))\n\t\tfor id := range m.removedsystemequipment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "049c6db22fff70ac995a65f1a4be52c8", "score": "0.7058667", "text": "func (m *PersonMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase person.EdgeVehicleRegistrations:\n\t\tids := make([]ent.Value, 0, len(m.removedvehicle_registrations))\n\t\tfor id := range m.removedvehicle_registrations {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase person.EdgeCertifiedDeaths:\n\t\tids := make([]ent.Value, 0, len(m.removedcertified_deaths))\n\t\tfor id := range m.removedcertified_deaths {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a9e935751635246fb31515c3a146547", "score": "0.70496446", "text": "func (m *VehicleColorMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase vehiclecolor.EdgeVehiclesMajor:\n\t\tids := make([]ent.Value, 0, len(m.removedvehicles_major))\n\t\tfor id := range m.removedvehicles_major {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase vehiclecolor.EdgeVehiclesMinor:\n\t\tids := make([]ent.Value, 0, len(m.removedvehicles_minor))\n\t\tfor id := range m.removedvehicles_minor {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14e4f4296de54656c3baefc346614eb0", "score": "0.7043867", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeCards:\n\t\tids := make([]ent.Value, 0, len(m.removedcards))\n\t\tfor id := range m.removedcards {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f22d5e12af6941eaf5ef2fee62d6b924", "score": "0.70415825", "text": "func (m *CityMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase city.EdgeConstructions:\n\t\tids := make([]ent.Value, 0, len(m.removedconstructions))\n\t\tfor id := range m.removedconstructions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase city.EdgeQueue:\n\t\tids := make([]ent.Value, 0, len(m.removedqueue))\n\t\tfor id := range m.removedqueue {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "429524f87eb35f73255251e87033a45d", "score": "0.7030179", "text": "func (m *CarMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase car.EdgeRentals:\n\t\tids := make([]ent.Value, 0, len(m.removedrentals))\n\t\tfor id := range m.removedrentals {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39bc82fdde98b4718ee17d284a510171", "score": "0.7028525", "text": "func (m *OperationroomMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase operationroom.EdgeOperationroomID:\n\t\tids := make([]ent.Value, 0, len(m.removedoperationroom_id))\n\t\tfor id := range m.removedoperationroom_id {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "709cef2c11b01ffcb4752f9bfe629308", "score": "0.70260257", "text": "func (m *PhysicianMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase physician.EdgeSystemequipment:\n\t\tids := make([]ent.Value, 0, len(m.removedsystemequipment))\n\t\tfor id := range m.removedsystemequipment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ec5dcacfc8bdc22e5548939a2dd501c", "score": "0.70246035", "text": "func (m *EthnicityMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase ethnicity.EdgePeople:\n\t\tids := make([]ent.Value, 0, len(m.removedpeople))\n\t\tfor id := range m.removedpeople {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c766b22435824e101d1cbb295058c2f3", "score": "0.7019189", "text": "func (m *GroupOfAgeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase groupofage.EdgeGroupofageProduct:\n\t\tids := make([]ent.Value, 0, len(m.removedgroupofage_product))\n\t\tfor id := range m.removedgroupofage_product {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f562258351942bd866e762808a7d2d6", "score": "0.7013512", "text": "func (m *EquipmentMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase equipment.EdgeOrderEquipmentt:\n\t\tids := make([]ent.Value, 0, len(m.removedorder_equipmentt))\n\t\tfor id := range m.removedorder_equipmentt {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "580d0adc2edb840f37076cabef681567", "score": "0.7012411", "text": "func (m *MemberMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase member.EdgeMemberInsurance:\n\t\tids := make([]ent.Value, 0, len(m.removedmember_insurance))\n\t\tfor id := range m.removedmember_insurance {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase member.EdgeMemberPayment:\n\t\tids := make([]ent.Value, 0, len(m.removedmember_payment))\n\t\tfor id := range m.removedmember_payment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase member.EdgeMemberInquiry:\n\t\tids := make([]ent.Value, 0, len(m.removedmember_inquiry))\n\t\tfor id := range m.removedmember_inquiry {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase member.EdgeMemberPayback:\n\t\tids := make([]ent.Value, 0, len(m.removedmember_payback))\n\t\tfor id := range m.removedmember_payback {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase member.EdgeMemberRecordinsurance:\n\t\tids := make([]ent.Value, 0, len(m.removedmember_recordinsurance))\n\t\tfor id := range m.removedmember_recordinsurance {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4da13b162124a9c16dbe06406e52f1a4", "score": "0.70058936", "text": "func (m *UserMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase user.EdgeOrderUserr:\n\t\tids := make([]ent.Value, 0, len(m.removedorder_userr))\n\t\tfor id := range m.removedorder_userr {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b58cefaa22f8790ee8df9ff76bbf2b97", "score": "0.70031554", "text": "func (m *VehicleModelMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase vehiclemodel.EdgeVehicles:\n\t\tids := make([]ent.Value, 0, len(m.removedvehicles))\n\t\tfor id := range m.removedvehicles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd20c93e912b9eb969d4797a8eec77e9", "score": "0.69958264", "text": "func (m *CategoryMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase category.EdgeCategoryInquiry:\n\t\tids := make([]ent.Value, 0, len(m.removedcategory_inquiry))\n\t\tfor id := range m.removedcategory_inquiry {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f65a61e4fd83862eefebaaf079fd1d6d", "score": "0.69888604", "text": "func (m *ContactParentsMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase contactparents.EdgeChild:\n\t\tids := make([]ent.Value, 0, len(m.removedchild))\n\t\tfor id := range m.removedchild {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0be4e5e09b93386e1521bbcfc78c7f76", "score": "0.6981285", "text": "func (m *DeathMannerMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase deathmanner.EdgeDeathCertificates:\n\t\tids := make([]ent.Value, 0, len(m.removeddeath_certificates))\n\t\tfor id := range m.removeddeath_certificates {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4b6d1e33aeb43d0bf8eb24538667925", "score": "0.6979139", "text": "func (m *GithubRepositoryMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase githubrepository.EdgeLabels:\n\t\tids := make([]ent.Value, 0, len(m.removedlabels))\n\t\tfor id := range m.removedlabels {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase githubrepository.EdgeReleases:\n\t\tids := make([]ent.Value, 0, len(m.removedreleases))\n\t\tfor id := range m.removedreleases {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "490bc037ac903ca1dbd7d89daf5abf02", "score": "0.6969624", "text": "func (m *StatusOpinionMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase statusopinion.EdgeCheckouts:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckouts))\n\t\tfor id := range m.removedcheckouts {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6a29306176df91d2cfe2da9b064ac4e7", "score": "0.69586354", "text": "func (m *MedicalTypeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase medicaltype.EdgeSystemequipment:\n\t\tids := make([]ent.Value, 0, len(m.removedsystemequipment))\n\t\tfor id := range m.removedsystemequipment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7765d7bcb15ce54026772a914fd82192", "score": "0.6947737", "text": "func (m *DeathPlaceMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase deathplace.EdgeDeathCertificates:\n\t\tids := make([]ent.Value, 0, len(m.removeddeath_certificates))\n\t\tfor id := range m.removeddeath_certificates {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bcd8a63726887fd49dbbd0f55387d0f2", "score": "0.69410026", "text": "func (m *StatusMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase status.EdgeCheckouts:\n\t\tids := make([]ent.Value, 0, len(m.removedcheckouts))\n\t\tfor id := range m.removedcheckouts {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66c18f07062bd609d94dfc7e1caa9953", "score": "0.6938014", "text": "func (m *PricetypeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase pricetype.EdgeDentalexpenses:\n\t\tids := make([]ent.Value, 0, len(m.removeddentalexpenses))\n\t\tfor id := range m.removeddentalexpenses {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "315dcc01a67e52d1d554901e70944fa0", "score": "0.6931861", "text": "func (m *MoneytransferMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase moneytransfer.EdgeMoneytransferPayment:\n\t\tids := make([]ent.Value, 0, len(m.removedmoneytransfer_payment))\n\t\tfor id := range m.removedmoneytransfer_payment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a670ee9c1ad8ec7eca75f570650b6a12", "score": "0.6927035", "text": "func (m *FurnitureTypeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase furnituretype.EdgeDetails:\n\t\tids := make([]ent.Value, 0, len(m.removeddetails))\n\t\tfor id := range m.removeddetails {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55e7b26f99a9439a346de27d95c96734", "score": "0.69261056", "text": "func (m *TeacherMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase teacher.EdgeTeacherID:\n\t\tids := make([]ent.Value, 0, len(m.removed_Teacher_ID))\n\t\tfor id := range m.removed_Teacher_ID {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase teacher.EdgeTeachersID:\n\t\tids := make([]ent.Value, 0, len(m.removed_Teachers_ID))\n\t\tfor id := range m.removed_Teachers_ID {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69ff598d92491b1bf20fa73b83b83302", "score": "0.69015783", "text": "func (m *TypeRoomMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase typeroom.EdgeDatarooms:\n\t\tids := make([]ent.Value, 0, len(m.removeddatarooms))\n\t\tfor id := range m.removeddatarooms {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9000cecd660b6b3328e4ea06a9502a2f", "score": "0.6900032", "text": "func (m *InsuranceMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase insurance.EdgeInsurancePayment:\n\t\tids := make([]ent.Value, 0, len(m.removedinsurance_payment))\n\t\tfor id := range m.removedinsurance_payment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6c6ea414c4d1a574aae7cbfee74b808", "score": "0.6893082", "text": "func (m *GenderMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase gender.EdgeGenderProduct:\n\t\tids := make([]ent.Value, 0, len(m.removedgender_product))\n\t\tfor id := range m.removedgender_product {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f970639133347da2b17778d2bf26c56", "score": "0.6884022", "text": "func (m *FurnitureDetailMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase furnituredetail.EdgeFixs:\n\t\tids := make([]ent.Value, 0, len(m.removedfixs))\n\t\tfor id := range m.removedfixs {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b5990bfbf6d54dd65755e0f353ef537", "score": "0.6856189", "text": "func (m *DeathCertifierMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase deathcertifier.EdgeDeathCertificates:\n\t\tids := make([]ent.Value, 0, len(m.removeddeath_certificates))\n\t\tfor id := range m.removeddeath_certificates {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0431827dadd800b9f76c7649badc0ee6", "score": "0.68514955", "text": "func (m *BankMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase bank.EdgeBankPayment:\n\t\tids := make([]ent.Value, 0, len(m.removedbank_payment))\n\t\tfor id := range m.removedbank_payment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase bank.EdgeBankPayback:\n\t\tids := make([]ent.Value, 0, len(m.removedbank_payback))\n\t\tfor id := range m.removedbank_payback {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f65b8c1803ae06becebab27125a3fbf", "score": "0.6830499", "text": "func (m *OperatingSystemMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase operatingsystem.EdgePhones:\n\t\tids := make([]ent.Value, 0, len(m.removedphones))\n\t\tfor id := range m.removedphones {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "434ed3bd5f96a096c74cb51effdd09f5", "score": "0.68201363", "text": "func (m *VehicleMakeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase vehiclemake.EdgeVehicles:\n\t\tids := make([]ent.Value, 0, len(m.removedvehicles))\n\t\tfor id := range m.removedvehicles {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" } ]
fd77b50fb8e07d8be19e11dd03883f5d
Credentials returns credentials for simple storage connectivity
[ { "docid": "0e2ca5195a1e14d17b280b8710637c79", "score": "0.701551", "text": "func (serviceImpl *StorageManagerServiceImpl) Credentials() *credentials.Credentials {\n\treturn credentials.NewStaticCredentials(serviceImpl.AccessKey, serviceImpl.SecretKey, \"\")\n}", "title": "" } ]
[ { "docid": "9ec47d14b65d59b01f1d277ffd16babc", "score": "0.70852655", "text": "func (c *Credentials) GetCredentials() *Credentials { return c }", "title": "" }, { "docid": "7205a79797c59f8cd62c1794babcd426", "score": "0.6794409", "text": "func (p *Platform) Credentials(params ...string) {\n\tif len(params) != 3 {\n\t\tpanic(fmt.Sprintf(\"received %d credential parameters, expected 3\", len(params)))\n\t}\n\tp.ui.Log.Debug(\"getting openstack credentials\")\n\t// To config\n\tp.config.OpenstackAuthURL = params[0]\n\tp.config.OpenstackUserName = params[1]\n\tp.config.OpenstackPassword = params[2]\n}", "title": "" }, { "docid": "54cf252c5c7b4f566756a1b067de1d07", "score": "0.66944486", "text": "func (p *EnvCredentialProvider) Credentials(profile ...string) (credentials.Value, error) {\n\tec := credentials.NewEnvCredentials()\n\treturn ec.Get()\n}", "title": "" }, { "docid": "69f00b0708066ee51c50ec0bcbee7288", "score": "0.663193", "text": "func Credentials() (string, string, error) {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfmt.Print(\"Username: \")\n\tusername, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tfmt.Print(\"Password: \")\n\tbytePassword, err := terminal.ReadPassword(int(syscall.Stdin))\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpassword := string(bytePassword)\n\n\treturn strings.TrimSpace(username), strings.TrimSpace(password), nil\n}", "title": "" }, { "docid": "63631c89de0555099b761695655c1d6c", "score": "0.647305", "text": "func Credentials(c *cli.Context) (*gophercloud.AuthOptions, string, error) {\n\thave := make(map[string]authCred)\n\tneed := map[string]string{\n\t\t\"username\": \"\",\n\t\t\"apikey\": \"\",\n\t\t\"authurl\": \"\",\n\t\t\"region\": \"\",\n\t}\n\n\t// use command-line options if available\n\tcliopts(c, have, need)\n\t// are there any unset auth variables?\n\tif len(need) != 0 {\n\t\t// if so, look in config file\n\t\terr := configfile(c, have, need)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\t// still unset auth variables?\n\t\tif len(need) != 0 {\n\t\t\t// if so, look in environment variables\n\t\t\tenvvars(have, need)\n\t\t}\n\t}\n\n\t// if the user didn't provide an auth URL, default to the Rackspace US endpoint\n\tif _, ok := have[\"authurl\"]; !ok || have[\"authurl\"].value == \"\" {\n\t\thave[\"authurl\"] = authCred{value: rackspace.RackspaceUSIdentity, from: \"default value\"}\n\t\tdelete(need, \"authurl\")\n\t}\n\n\tif len(need) > 0 {\n\t\thaveString := \"\"\n\t\tfor k, v := range have {\n\t\t\thaveString += fmt.Sprintf(\"%s: %s (from %s)\\n\", k, v.value, v.from)\n\t\t}\n\n\t\tneedString := \"\"\n\t\tfor k := range need {\n\t\t\tneedString += fmt.Sprintf(\"%s\\n\", k)\n\t\t}\n\n\t\tauthErrSlice := []string{\"There are some required Rackspace Cloud credentials that we couldn't find.\",\n\t\t\t\"Here's what we have:\",\n\t\t\tfmt.Sprintf(\"%s\", haveString),\n\t\t\t\"and here's what we we're missing:\",\n\t\t\tfmt.Sprintf(\"%s\", needString),\n\t\t\t\"\",\n\t\t\t\"You can set any of these credentials in the following ways:\",\n\t\t\t\"- Run `rack configure` to interactively create a configuration file,\",\n\t\t\t\"- Specify it in the command as a flag (--username, --apikey, --region), or\",\n\t\t\t\"- Export it as an environment variable (RS_USERNAME, RS_API_KEY, RS_REGION_NAME).\",\n\t\t\t\"\",\n\t\t}\n\n\t\treturn nil, \"\", fmt.Errorf(strings.Join(authErrSlice, \"\\n\"))\n\t}\n\n\tao := &gophercloud.AuthOptions{\n\t\tUsername: have[\"username\"].value,\n\t\tAPIKey: have[\"apikey\"].value,\n\t\tIdentityEndpoint: have[\"authurl\"].value,\n\t}\n\n\t// upper-case the region\n\tregion := strings.ToUpper(have[\"region\"].value)\n\t// allow Gophercloud to re-authenticate\n\tao.AllowReauth = true\n\n\treturn ao, region, nil\n}", "title": "" }, { "docid": "a601a68d629fcb8e4c7ddbce28d1d566", "score": "0.6388168", "text": "func (c *Config) Retrieve() (aws.Credentials, error) {\n\treturn aws.Credentials{\n\t\tAccessKeyID: c.AWSAccessKeyID,\n\t\tSecretAccessKey: c.AWSSecretKey,\n\t\tCanExpire: false,\n\t}, nil\n}", "title": "" }, { "docid": "f2af3190767762667afd178bb78ff6b5", "score": "0.6385345", "text": "func (clusterConfig *ClusterConfigLegacy) GetCredentials() (string, string, string) {\n\treturn base.TransformBucketCredentials(clusterConfig.Username, clusterConfig.Password, *clusterConfig.Bucket)\n}", "title": "" }, { "docid": "6b9c7d8170d9a65cc498a00df5aef3e6", "score": "0.6380645", "text": "func getCredentials() (string, string, error) {\n\tclientID, present := os.LookupEnv(\"TDCLIENTID\")\n\tif !present {\n\t\treturn \"\", \"\", fmt.Errorf(\"TDCLIENTID environment variable is not set\")\n\t}\n\n\tclientSecret, present := os.LookupEnv(\"TDCLIENTSECRET\")\n\tif !present {\n\t\treturn \"\", \"\", fmt.Errorf(\"TDCLIENTSECRET environment variable is not set\")\n\t}\n\n\treturn clientID, clientSecret, nil\n}", "title": "" }, { "docid": "f29a470cc671e3f19b1f3d930b3afc4b", "score": "0.63547534", "text": "func (_Repository *RepositorySession) Credentials(arg0 [32]byte) ([32]byte, error) {\n\treturn _Repository.Contract.Credentials(&_Repository.CallOpts, arg0)\n}", "title": "" }, { "docid": "e2bd15491a3a512459c00943da47cf00", "score": "0.63325423", "text": "func LoadCredentials() (string, string, error) {\n\tlogger.Debug(\"ocean: loading credentials\")\n\n\tconfig := spotinst.DefaultConfig()\n\tc, err := config.Credentials.Get()\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"ocean: error loading credentials: %w\", err)\n\t}\n\n\tlogger.Debug(\"ocean: loaded credentials for account: %s\", c.Account)\n\treturn c.Token, c.Account, nil\n}", "title": "" }, { "docid": "04ef866605447af856bd87d33b0c68c2", "score": "0.6331656", "text": "func getCredentials() (username, password string) {\n\t_, err := clientToTarget(\"shoot\")\n\tcheckError(err)\n\toutput := execCmdReturnOutput(\"kubectl config view\", \"KUBECONFIG=\"+KUBECONFIG)\n\tscanner := bufio.NewScanner(strings.NewReader(output))\n\tfor scanner.Scan() {\n\t\tif strings.Contains(scanner.Text(), \"password:\") {\n\t\t\tpassword = strings.TrimPrefix(scanner.Text(), \" password: \")\n\t\t} else if strings.Contains(scanner.Text(), \"username:\") {\n\t\t\tusername = strings.TrimPrefix(scanner.Text(), \" username: \")\n\t\t}\n\t}\n\treturn username, password\n}", "title": "" }, { "docid": "0777573ca08f1ed828376bda51f0a06d", "score": "0.6324028", "text": "func (m *FakeCredentialsManager) GetCredentials() (*sts.Credentials, error) {\n\treturn &sts.Credentials{\n\t\tAccessKeyId: aws.String(\"xxxxxxxxxxxx\"),\n\t\tExpiration: aws.Time(time.Now().Add(time.Duration(60 * time.Minute))),\n\t\tSecretAccessKey: aws.String(\"yyyyyyyyyyyyyyyyyyyyyyy\"),\n\t\tSessionToken: aws.String(\"xxxxxxxxxxx-yyyyyyyyyyy-zzzzzzzzzzzz\"),\n\t}, nil\n}", "title": "" }, { "docid": "9de20a93567e24ac80df9c434ecc2b05", "score": "0.6321847", "text": "func (rc *RunContext) Credentials() (clientID, clientSecret string, err error) {\n\treturn rc.ia.im.credentials()\n}", "title": "" }, { "docid": "2f1639982e943238ed4823521f72006f", "score": "0.6261472", "text": "func (o *AzureIntegration) GetCredentials() []PairSymbolString {\n\tif o == nil {\n\t\tvar ret []PairSymbolString\n\t\treturn ret\n\t}\n\treturn o.Credentials\n}", "title": "" }, { "docid": "17d8c74ad9231e340baebba18a8b4608", "score": "0.6252487", "text": "func genCredentials(t *testing.T) (string, string, string, string) {\n\thostname, err := os.Hostname()\n\trequire.NoError(t, err)\n\n\tu, err := user.Current()\n\trequire.NoError(t, err)\n\n\temail := strings.Join([]string{u.Username, hostname, gofakeit.Email(), \"test\"}, \".\")\n\tpassword := gofakeit.Password(true, true, true, false, false, 14)\n\tfirstName := gofakeit.FirstName()\n\tlastName := gofakeit.LastName()\n\treturn email, password, firstName, lastName\n}", "title": "" }, { "docid": "1512029d7264d61a904efbfc7f72bf12", "score": "0.62326324", "text": "func (_Repository *RepositoryCallerSession) Credentials(arg0 [32]byte) ([32]byte, error) {\n\treturn _Repository.Contract.Credentials(&_Repository.CallOpts, arg0)\n}", "title": "" }, { "docid": "432c0bb5b4d70df0286cc3ac53cd77ae", "score": "0.6227754", "text": "func (m *Meta) AskCredentials() (string, string, error) {\n\tusername, err := m.UI.Ask(\"Username:\")\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpassword, err := m.UI.AskSecret(\"Password:\")\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn username, password, nil\n}", "title": "" }, { "docid": "984d0d25f5d53bb06f97c0ed29ac6137", "score": "0.6218049", "text": "func FindCredentials(username string) *Credentials {\n\tif username == \"\" {\n\t\tusername = Anonymous\n\t}\n\tif bytes, err := db.GetCache(username); err == nil {\n\t\tcreds := &Credentials{}\n\t\tif err = json.Unmarshal(bytes, creds); err == nil {\n\t\t\treturn creds\n\t\t}\n\t}\n\treturn &Credentials{\n\t\tBase: &models.Configuration{\n\t\t\tDockerUsername: username,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "db60c4f07ee6e57745253e1314a64852", "score": "0.62169856", "text": "func (this *stsCredentials) Retrieve() (value credentials.Value, err error) {\n\tvalue.SecretAccessKey = this.KeySecret\n\tvalue.AccessKeyID = this.KeyID\n\treturn\n}", "title": "" }, { "docid": "1e3993c98c15e64df4f3f7de838c30e3", "score": "0.6216106", "text": "func transportCredentials() (credentials.TransportCredentials, error) {\n\tpool, err := x509.SystemCertPool()\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"cannot get system certs\")\n\t}\n\treturn credentials.NewClientTLSFromCert(pool, \"\"), nil\n}", "title": "" }, { "docid": "f3c99d26d33eafe5459fced4e23bfb44", "score": "0.61984706", "text": "func getCredentials() (serviceCredentials, error) {\n\t// TODO: implement environment vars\n\n\tcredentials := serviceCredentials{}\n\n\tflag.StringVar(&credentials.shart.token, \"token\", \"\", \"token used for bot authentication\")\n\tflag.StringVar(&credentials.radarr.url, \"radarr-url\", \"\", \"url that points to your radarr app\")\n\tflag.StringVar(&credentials.radarr.apiKey, \"radarr-key\", \"\", \"api key used for radarr\")\n\tflag.StringVar(&credentials.sonarr.url, \"sonarr-url\", \"\", \"url that points to your sonarr app\")\n\tflag.StringVar(&credentials.sonarr.apiKey, \"sonarr-key\", \"\", \"api key used for sonarr\")\n\tflag.BoolVar(&isVerbose, \"verbose\", false, \"output more inforation\")\n\tversionFlag = flag.Bool(\"version\", false, \"get program version\")\n\n\tflag.Parse()\n\n\t// check for version flag\n\tif *versionFlag {\n\t\tfmt.Println(version)\n\t\tos.Exit(0)\n\t}\n\n\tif credentials.shart.token == \"\" {\n\t\treturn credentials, errors.New(\"a token is required\")\n\t}\n\n\treturn credentials, nil\n}", "title": "" }, { "docid": "4523aadebbc47a1535b1c8d162535106", "score": "0.6189863", "text": "func GetCredentials(secretID int, url, domain string) (string, string, error) {\n\tthyUser, thyPassword, err := credentials()\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tc := server.Configuration{\n\t\tCredentials: server.UserCredential{\n\t\t\tUsername: thyUser,\n\t\t\tPassword: thyPassword,\n\t\t},\n\t\tServerURL: url,\n\t\tDomain: domain,\n\t}\n\n\ts, err := server.New(c)\n\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"creating thycotic server: %s\", err)\n\t}\n\n\tsecret, err := s.Secret(secretID)\n\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"getting secret '%d' from thycotic: %s\", secretID, err)\n\t}\n\n\tusername, err := getField(secret, \"Username\")\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tpassword, err := getField(secret, \"Password\")\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn username, password, nil\n}", "title": "" }, { "docid": "e6c949af538b2549052df20a363dd878", "score": "0.6185201", "text": "func retrieveCredentials(instance rDSInstance) credentialSet {\n\t//todo,error handling\n\tcredPath := instance.TagValue(\"cred_path\")\n\ts := strings.Split(credPath, \":\")\n\tregion, paramPath := s[0], s[1]\n\tcred := GetParamAtPath(paramPath, region)\n\tvar v map[string]string\n\terr := json.Unmarshal([]byte(cred), &v)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not unmarshall param json to needed values for %s, %s\", credPath, err)\n\t}\n\tvar c credentialSet\n\tc.user = v[\"mysql_username\"]\n\tc.password = v[\"mysql_password\"]\n\tif c.user == \"\" || c.password == \"\" {\n\t\tlog.Fatal(\"Credentials from Param store invalid or missing\")\n\t}\n\treturn c\n}", "title": "" }, { "docid": "dcb5f9d1dce4bbde0bf7c99380b280bc", "score": "0.6162753", "text": "func (k *KeyringStorage) RetrieveLoginCredentials() (*types.CognitoAuthenticationCredentials, error) {\n\tusername, err := k.Keyring.Get(usernameKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpassword, err := k.Keyring.Get(passwordKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tuserPoolID, err := k.Keyring.Get(userPoolIDKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientID, err := k.Keyring.Get(clientIDKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &types.CognitoAuthenticationCredentials{\n\t\tUsername: string(username.Data),\n\t\tPassword: string(password.Data),\n\t\tUserPoolID: string(userPoolID.Data),\n\t\tClientID: string(clientID.Data),\n\t}, nil\n}", "title": "" }, { "docid": "3dd02db06f0f262bd561a9c7922ca302", "score": "0.6158609", "text": "func (c *Connection) GetBrokerCredentials() (string, string) {\n\tconnection := c.Config.Get(\"connection\").(map[string]interface{})\n\treturn connection[\"username\"].(string), connection[\"password\"].(string)\n}", "title": "" }, { "docid": "2d001be52fdf5b1faf05abde18449373", "score": "0.61540544", "text": "func ReadCredentials() (string, error) {\n\tfile, err := os.Open(\"internal/database/credentials.json\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\tconfiguration := Credentials{}\n\terr = decoder.Decode(&configuration)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err)\n\t}\n\treturn configuration.DBPassword, nil\n}", "title": "" }, { "docid": "cf289b27d15a091dafe11897f4bf7d16", "score": "0.6129769", "text": "func GetGoodreadsCredentials() (string, string) {\n\tgoodreads_user := os.Getenv(\"GOODREADS_USERNAME\")\n\tgoodreads_pass := os.Getenv(\"GOODREADS_PASSWORD\")\n\tif len(goodreads_user) > 0 && len(goodreads_pass) > 0 {\n\t\treturn goodreads_user, goodreads_pass\n\t}\n\tlog.Println(\"env variables GOODREADS_USERNAME & GOODREADS_PASSWORD not found. Returning default values: admin/password.\")\n\treturn \"admin\", \"password\"\n}", "title": "" }, { "docid": "a6154398d920deab60a0b185559a3768", "score": "0.61282456", "text": "func parsecred() Credentials {\n\tc := Credentials{}\n\tif cred == \"\" {\n\t\tc.Params = []CredParams{}\n\t\treturn c\n\t}\n\traw := strings.Split(cred, \",\")\n\tparams := []CredParams{}\n\t// 2nd to end are cred params in key-value format:\n\tfor _, p := range raw[1:] {\n\t\tpair := strings.SplitN(p, \"=\", 2)\n\t\tp := CredParams{\n\t\t\tKey: pair[0],\n\t\t\tValue: pair[1],\n\t\t}\n\t\tparams = append(params, p)\n\t}\n\tc.StorageTargetEndpoint = raw[0]\n\tc.Params = params\n\treturn c\n}", "title": "" }, { "docid": "66f859e5685fc29210589f7cbb5ae71a", "score": "0.6106247", "text": "func (a *Agent) GetLocalUserCredentials() (frag string, pwd string) {\n\treturn a.localUfrag, a.localPwd\n}", "title": "" }, { "docid": "f51da1266e8ff81621cba0d530524ab6", "score": "0.60944474", "text": "func (c *CqlClientConnection) Credentials() *AuthCredentials {\n\tif c.credentials == nil {\n\t\treturn nil\n\t}\n\treturn c.credentials.Copy()\n}", "title": "" }, { "docid": "d5a3ecb1ab075641319d1a69d82e8bba", "score": "0.60861605", "text": "func Credentials(w http.ResponseWriter, r *http.Request) *appError {\n session, err := store.Get(r, \"session-name\")\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n rendering.JSON(w, http.StatusOK, struct {\n AccessKey string `json:\"access-key\"`\n SecretKey string `json:\"secret-key\"`\n Endpoint string `json:\"endpoint\"`\n Html5browser string `json:\"html5browser\"`\n } {\n AccessKey: session.Values[\"AccessKey\"].(string),\n SecretKey: session.Values[\"SecretKey\"].(string),\n Endpoint: session.Values[\"Endpoint\"].(string),\n Html5browser: os.Getenv(\"HTML5BROWSER\"),\n })\n\n return nil\n}", "title": "" }, { "docid": "19a4fca32f227c26fc08bf2568e824c3", "score": "0.6080682", "text": "func (c *Configuration) HostCredentials(key string) (string, string, error) {\n\tu := make([]string, 3)\n\tp := make([]string, 3)\n\n\tcredKey := c.HostGlobals[key][hosts.GlobalCred.String()]\n\n\tvar err error\n\n\t// Check for normal cred config entries\n\tif credKey != \"\" {\n\t\tcred, ok := c.Creds[credKey]\n\t\tif !ok {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"cred config '%s' not found\", credKey)\n\t\t}\n\n\t\tu[0], p[0], err = cred.Retrieve()\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"retrieving credentials for %s: %w\", credKey, err)\n\t\t}\n\t}\n\n\t// Check if the host itself implements Cred\n\th := c.Hosts[key]\n\thostCred, ok := h.(Cred)\n\tif ok {\n\t\tu[1], p[1], err = hostCred.Retrieve()\n\t}\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"retrieving host credentials for %s: %w\", key, err)\n\t}\n\n\t// Check if a literal username is defined using the global username variable (not permitted for passwords)\n\tu[2] = c.HostGlobals[key][hosts.GlobalUsername.String()]\n\n\t// Apply the order of preference\n\tuser, pass := lastNotEmptyStrings(u, p)\n\n\treturn user, pass, nil\n}", "title": "" }, { "docid": "26f1d562fe813bd19e26711b9e2db618", "score": "0.60252684", "text": "func GetCredentials(registry string, verbose bool) (types.AuthConfig, error) {\n\t// Constructing docker config json from home directory if DOCKER_CONFIG env is found empty\n\tvar authConfig types.AuthConfig\n\tif configDir == \"\" {\n\t\tHomeDir, err := os.UserHomeDir()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error while fetching home directory\", err)\n\t\t\treturn authConfig, err\n\t\t}\n\t\tconfigDir = filepath.Join(HomeDir, DockerDir)\n\t}\n\n\treturn GetCredentialsFromConfig(registry, verbose, configDir)\n}", "title": "" }, { "docid": "69c23b3cb5daffb4f60d9ca102a9900c", "score": "0.6024083", "text": "func (s StaticCredentialsProvider) Retrieve() (aws.Credentials, error) {\n\tv := s.Value\n\tif v.AccessKeyID == \"\" || v.SecretAccessKey == \"\" {\n\t\treturn aws.Credentials{}, errors.New(\"static credentials are empty\")\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "6e4a5fcc9a1dfcea876df6d53891e6a0", "score": "0.6019541", "text": "func (o MethodIntegrationOutput) Credentials() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MethodIntegration) *string { return v.Credentials }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5f8b1190fe4a4a2b1f4027c8157ba01d", "score": "0.6007129", "text": "func getCredentialsFile() string {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t}\n\treturn usr.HomeDir + \"/.acs/credentials\"\n}", "title": "" }, { "docid": "d9d48472b46ec2f5d8a45a090e41ff41", "score": "0.60055816", "text": "func (h *Cred) Retrieve() (string, string, error) {\n\treturn h.Username, h.Password, nil\n}", "title": "" }, { "docid": "c08e9d3b62647b71ffc11e88ba10d2b7", "score": "0.5996604", "text": "func Creds(ctx context.Context, ds *DialSettings) (*google.Credentials, error) {\n\tif ds.Credentials != nil {\n\t\treturn ds.Credentials, nil\n\t}\n\tif ds.CredentialsJSON != nil {\n\t\treturn credentialsFromJSON(ctx, ds.CredentialsJSON, ds.Endpoint, ds.Scopes, ds.Audiences)\n\t}\n\tif ds.CredentialsFile != \"\" {\n\t\tdata, err := ioutil.ReadFile(ds.CredentialsFile)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot read credentials file: %v\", err)\n\t\t}\n\t\treturn credentialsFromJSON(ctx, data, ds.Endpoint, ds.Scopes, ds.Audiences)\n\t}\n\tif ds.TokenSource != nil {\n\t\treturn &google.Credentials{TokenSource: ds.TokenSource}, nil\n\t}\n\tcred, err := google.FindDefaultCredentials(ctx, ds.Scopes...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(cred.JSON) > 0 {\n\t\treturn credentialsFromJSON(ctx, cred.JSON, ds.Endpoint, ds.Scopes, ds.Audiences)\n\t}\n\t// For GAE and GCE, the JSON is empty so return the default credentials directly.\n\treturn cred, nil\n}", "title": "" }, { "docid": "5badf0130533dbb95a82a2139a485859", "score": "0.598379", "text": "func (getGas) ReadCredentials(credentialsPath string, net dex.Network) (addr, provider string, err error) {\n\tvar creds *fileCredentials\n\tcreds, provider, err = getFileCredentials(credentialsPath, net)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tprivB, zero, err := privKeyFromSeed(creds.Seed)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tdefer zero()\n\tprivateKey, err := crypto.ToECDSA(privB)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\taddr = crypto.PubkeyToAddress(privateKey.PublicKey).String()\n\treturn\n}", "title": "" }, { "docid": "f9cd7b53a983daef1834f4d9155bce96", "score": "0.5981325", "text": "func GetCredentials() collections.Users {\n\tjsonFile, err := os.Open(fmt.Sprintf(\"%s/git-credentials.json\", GetHomeDir()))\n\tCheck(err)\n\tdefer jsonFile.Close()\n\n\tvar users collections.Users\n\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\n\tjson.Unmarshal(byteValue, &users)\n\n\treturn users\n}", "title": "" }, { "docid": "0688d3cb17303657c8af06bcdcbbc888", "score": "0.5973348", "text": "func ProviderCredentials(p kubeone.CloudProviderName, credentialsFilePath string) (map[string]string, error) {\n\tf, err := newFetcher(credentialsFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch p {\n\tcase kubeone.CloudProviderNameAWS:\n\t\treturn f.parseAWSCredentials()\n\tcase kubeone.CloudProviderNameAzure:\n\t\treturn f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: AzureClientID, MachineControllerName: AzureClientIDMC},\n\t\t\t{Name: AzureClientSecret, MachineControllerName: AzureClientSecretMC},\n\t\t\t{Name: AzureTenantID, MachineControllerName: AzureTenantIDMC},\n\t\t\t{Name: AzureSubscribtionID, MachineControllerName: AzureSubscribtionIDMC},\n\t\t}, defaultValidationFunc)\n\tcase kubeone.CloudProviderNameOpenStack:\n\t\treturn f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: OpenStackAuthURL},\n\t\t\t{Name: OpenStackUserName, MachineControllerName: OpenStackUserNameMC},\n\t\t\t{Name: OpenStackPassword},\n\t\t\t{Name: OpenStackDomainName},\n\t\t\t{Name: OpenStackRegionName},\n\t\t\t{Name: OpenStackTenantID},\n\t\t\t{Name: OpenStackTenantName},\n\t\t}, openstackValidationFunc)\n\tcase kubeone.CloudProviderNameHetzner:\n\t\treturn f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: HetznerTokenKey, MachineControllerName: HetznerTokenKeyMC},\n\t\t}, defaultValidationFunc)\n\tcase kubeone.CloudProviderNameDigitalOcean:\n\t\treturn f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: DigitalOceanTokenKey, MachineControllerName: DigitalOceanTokenKeyMC},\n\t\t}, defaultValidationFunc)\n\tcase kubeone.CloudProviderNameGCE:\n\t\tgsa, err := f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: GoogleServiceAccountKey, MachineControllerName: GoogleServiceAccountKeyMC},\n\t\t}, defaultValidationFunc)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\t// encode it before sending to secret to be consumed by\n\t\t// machine-controller, as machine-controller assumes it will be double encoded\n\t\tgsa[GoogleServiceAccountKeyMC] = base64.StdEncoding.EncodeToString([]byte(gsa[GoogleServiceAccountKeyMC]))\n\t\treturn gsa, nil\n\tcase kubeone.CloudProviderNamePacket:\n\t\treturn f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: PacketAPIKey, MachineControllerName: PacketAPIKeyMC},\n\t\t\t{Name: PacketProjectID},\n\t\t}, defaultValidationFunc)\n\tcase kubeone.CloudProviderNameVSphere:\n\t\tvscreds, err := f.parseCredentialVariables([]ProviderEnvironmentVariable{\n\t\t\t{Name: VSphereAddress, MachineControllerName: VSphereAddressMC},\n\t\t\t{Name: VSphereUsername, MachineControllerName: VSphereUsernameMC},\n\t\t\t{Name: VSpherePassword},\n\t\t}, defaultValidationFunc)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\n\t\tvcenterPrefix := vscreds[VSphereAddressMC]\n\n\t\t// force scheme, as machine-controller requires it while terraform does not\n\t\tvscreds[VSphereAddressMC] = \"https://\" + vscreds[VSphereAddressMC]\n\n\t\t// Save credentials in Secret and configure vSphere cloud controller\n\t\t// manager to read it, in replace of storing those in /etc/kubernates/cloud-config\n\t\t// see more: https://vmware.github.io/vsphere-storage-for-kubernetes/documentation/k8s-secret.html\n\t\tvscreds[fmt.Sprintf(\"%s.username\", vcenterPrefix)] = vscreds[VSphereUsernameMC]\n\t\tvscreds[fmt.Sprintf(\"%s.password\", vcenterPrefix)] = vscreds[VSpherePassword]\n\t\treturn vscreds, nil\n\tcase kubeone.CloudProviderNameNone:\n\t\treturn map[string]string{}, nil\n\t}\n\n\treturn nil, errors.New(\"no provider matched\")\n}", "title": "" }, { "docid": "6a7d20afab6910546b84444c2d69e17d", "score": "0.5968705", "text": "func (h *HostCred) Retrieve() (string, string, error) {\n\treturn h.Username, h.Password, nil\n}", "title": "" }, { "docid": "8837fafc651ebee7d8d9146097c7c1b4", "score": "0.59676814", "text": "func CredentialsFromString(ctx context.Context, content string) (*google.Credentials, error) {\n\tcreds, err := google.CredentialsFromJSON(ctx, []byte(content), \"https://www.googleapis.com/auth/cloud-platform\")\n\treturn creds, err\n}", "title": "" }, { "docid": "b3cdc77d46e366343cb3d9728af8cf7d", "score": "0.5966734", "text": "func (a *AzureKeyVaultSmbCredentials) GetCredentials() *Credentials {\n\treturn &Credentials{\n\t\tType: a.Type,\n\t}\n}", "title": "" }, { "docid": "ee40077cb4f8348c4fe3ad7b5c856fab", "score": "0.59613365", "text": "func (rp *ResolvingPath) Credentials() *auth.Credentials {\n\treturn rp.creds\n}", "title": "" }, { "docid": "2bcbfc945e0cf2a5a97eda488bbac7f0", "score": "0.5949601", "text": "func newCredentials() Credentials {\n\treturn Credentials{params: make(map[string]string)}\n}", "title": "" }, { "docid": "73e51aa2be85f607b9628d395e848958", "score": "0.5942317", "text": "func (c *Credentials) getCredentials(ctx context.Context, opts ...Option) (Credentials, error) {\n\tvar cred Credentials\n\n\tcfg := options{audience: \"lora-app-server\"}\n\tfor _, o := range opts {\n\t\to(&cfg)\n\t}\n\ttoken, err := getTokenFromContext(ctx)\n\tif err != nil {\n\t\treturn cred, err\n\t}\n\tjwtClaims, err := c.h.jwtValidator.GetClaims(token, cfg.audience)\n\tif err != nil {\n\t\treturn cred, errors.Wrap(err, \"getCredentials\")\n\t}\n\tif jwtClaims.Username == \"\" {\n\t\treturn cred, fmt.Errorf(\"username is required in claims\")\n\t}\n\n\totpClaims, err := c.h.otpValidator.GetClaims(ctx)\n\tif err != nil {\n\t\treturn cred, errors.Wrap(err, \"getCredentials\")\n\t}\n\n\tif cfg.requireOTP {\n\t\tif otpClaims.OTP == \"\" {\n\t\t\treturn cred, errors.Wrap(err, \"getCredentials: OTP is required\")\n\t\t}\n\t\tif enabled, err := c.h.otpValidator.IsEnabled(ctx, jwtClaims.Username); !enabled || err != nil {\n\t\t\treturn cred, errors.Wrap(err, \"getCredentials: two-factor authentication is not enabled\")\n\t\t}\n\t\tif err := c.h.otpValidator.Validate(ctx, jwtClaims.Username, otpClaims.OTP); err != nil {\n\t\t\treturn cred, errors.Wrap(err, \"getCredentials: OTP is not valid\")\n\t\t}\n\t}\n\n\tif cfg.limitedCred {\n\t\t// when cfg.limitedCred is true, func returns Credentials that only contain username. All\n\t\t// other checks will fail and possibly panic.\n\t\t//\n\t\t// Deprecated: this is only should be used for the user registration process,\n\t\t// and user registration process should be fixed to not require this hack\n\t\tcred.h = c.h\n\t\tcred.user.ID = -1\n\t\tcred.user.Email = jwtClaims.Username\n\t\tcred.user.IsGlobalAdmin = false\n\t\treturn cred, nil\n\t}\n\n\tu, err := c.h.st.AuthGetUser(ctx, jwtClaims.Username)\n\tif err != nil {\n\t\treturn cred, errors.Wrap(err, \"getCredentials\")\n\t}\n\n\tcred.h = c.h\n\tcred.user.ID = u.ID\n\tcred.user.Email = jwtClaims.Username\n\tcred.user.IsGlobalAdmin = u.IsGlobalAdmin\n\n\tif cred.user.IsGlobalAdmin {\n\t\treturn cred, nil\n\t}\n\n\tif cfg.orgID != 0 {\n\t\torgUser, err := c.h.st.AuthGetOrgUser(ctx, u.ID, cfg.orgID)\n\t\tif err != nil {\n\t\t\treturn cred, errors.Wrap(err, \"getCredentials\")\n\t\t}\n\t\tif !orgUser.IsOrgUser {\n\t\t\treturn cred, fmt.Errorf(\"not an org user\")\n\t\t}\n\n\t\tcred.orgUser.IsGatewayAdmin = orgUser.IsGatewayAdmin\n\t\tcred.orgUser.IsDeviceAdmin = orgUser.IsDeviceAdmin\n\t\tcred.orgUser.IsOrgAdmin = orgUser.IsOrgAdmin\n\t\tcred.orgUser.IsOrgUser = orgUser.IsOrgUser\n\t}\n\n\treturn cred, nil\n}", "title": "" }, { "docid": "ad9403a414aa5beed6975d9a5314b730", "score": "0.5938805", "text": "func (ma *APIClient) Credentials() cmd.ClusterV1CredentialsInterface {\n\treturn nil\n}", "title": "" }, { "docid": "d12dad674638699bb48eacc3adbe108f", "score": "0.5936448", "text": "func EnvCreds() (CredentialsProvider, error) {\n\tid := os.Getenv(\"AWS_ACCESS_KEY_ID\")\n\tif id == \"\" {\n\t\tid = os.Getenv(\"AWS_ACCESS_KEY\")\n\t}\n\n\tsecret := os.Getenv(\"AWS_SECRET_ACCESS_KEY\")\n\tif secret == \"\" {\n\t\tsecret = os.Getenv(\"AWS_SECRET_KEY\")\n\t}\n\n\tif id == \"\" {\n\t\treturn nil, ErrAccessKeyIDNotFound\n\t}\n\n\tif secret == \"\" {\n\t\treturn nil, ErrSecretAccessKeyNotFound\n\t}\n\n\treturn Creds(id, secret, os.Getenv(\"AWS_SESSION_TOKEN\")), nil\n}", "title": "" }, { "docid": "eb7b9e33dd57ff421511c34672ae5bcc", "score": "0.5933047", "text": "func String(accessKeyID, secretAccessKey, sessionToken string) (*credentials.Credentials, error) {\n\treturn creds(accessKeyID, secretAccessKey, sessionToken)\n}", "title": "" }, { "docid": "1c17d1c5f1cdea68acb6849380844e91", "score": "0.5906593", "text": "func getFileCredentials(path string, net dex.Network) (*fileCredentials, string, error) {\n\tb, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"error reading credentials file: %v\", err)\n\t}\n\tcreds := new(fileCredentials)\n\tif err := json.Unmarshal(b, creds); err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"error parsing credentials file: %v\", err)\n\t}\n\tif len(creds.Seed) == 0 {\n\t\treturn nil, \"\", fmt.Errorf(\"must provide both seeds in testnet credentials file\")\n\t}\n\tprovider := creds.Providers[net.String()]\n\tif provider == \"\" {\n\t\treturn nil, \"\", fmt.Errorf(\"credentials file does not specify an RPC provider\")\n\t}\n\treturn creds, provider, nil\n}", "title": "" }, { "docid": "658ba045b072c68571446a4283af1092", "score": "0.5893001", "text": "func getCredentials(a interfaces.AssumeCredentialProcess) error {\n\n\tr := response.New()\n\tvar err error\n\n\tdefer func() {\n\t\terr := r.Teardown()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tp := a.GetProfile()\n\tlogger.Debugln(a, \"👷\", \"Role\", p.Target.RoleArn)\n\n\terr = r.GetCachedCredentials(a)\n\tif err != nil {\n\t\tlogger.Debugf(a, \"ℹ️ \", \"Credentials\", \"Cached: %s\\n\", err.Error())\n\t\terr = r.GetNewCredentials(a)\n\t\tif err != nil {\n\t\t\tlogger.Errorln(a, \"ℹ️ \", \"Credentials\", err.Error())\n\t\t\treturn err\n\t\t} else {\n\t\t\tlogger.Debugln(a, \"ℹ️ \", \"Credentials\", \"Received from STS\")\n\t\t\tlogger.PrintRuler(a, \"=\")\n\t\t\terr = r.Output()\n\t\t\treturn err\n\n\t\t}\n\t} else {\n\t\tlogger.Debugln(a, \"ℹ️ \", \"Credentials\", \"Received from Cache\")\n\t\tlogger.PrintRuler(a, \"=\")\n\t\terr = r.Output()\n\t\treturn err\n\t}\n\n}", "title": "" }, { "docid": "9c831810712bd7ccd675725adc93b393", "score": "0.5883357", "text": "func GetCredential() Credential {\n\tcredential := Credential{}\n\tcredential.AccessKey = os.Getenv(envAccessKey)\n\tcredential.SecretKey = os.Getenv(envSecretKey)\n\n\treturn credential\n}", "title": "" }, { "docid": "e6a722684a6e7be0902347224fd2a509", "score": "0.58800924", "text": "func getUsernameAndPassword(cloud kubermaticv1.CloudSpec, secretKeySelector provider.SecretKeySelectorValueFunc, infraManagementUser bool) (username, password string, err error) {\n\tif infraManagementUser {\n\t\tusername = cloud.VSphere.InfraManagementUser.Username\n\t\tpassword = cloud.VSphere.InfraManagementUser.Password\n\t}\n\tif username == \"\" {\n\t\tusername = cloud.VSphere.Username\n\t}\n\tif password == \"\" {\n\t\tpassword = cloud.VSphere.Password\n\t}\n\n\tif username != \"\" && password != \"\" {\n\t\treturn username, password, nil\n\t}\n\n\tif cloud.VSphere.CredentialsReference == nil {\n\t\treturn \"\", \"\", errors.New(\"cluster contains no password an and empty credentialsReference\")\n\t}\n\n\tif username == \"\" && infraManagementUser {\n\t\tusername, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VsphereInfraManagementUserUsername)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\tif username == \"\" {\n\t\tusername, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VsphereUsername)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif password == \"\" && infraManagementUser {\n\t\tpassword, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VsphereInfraManagementUserPassword)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif password == \"\" {\n\t\tpassword, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VspherePassword)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif username == \"\" {\n\t\treturn \"\", \"\", errors.New(\"unable to get username\")\n\t}\n\n\tif password == \"\" {\n\t\treturn \"\", \"\", errors.New(\"unable to get password\")\n\t}\n\n\treturn username, password, nil\n}", "title": "" }, { "docid": "e6a722684a6e7be0902347224fd2a509", "score": "0.58800924", "text": "func getUsernameAndPassword(cloud kubermaticv1.CloudSpec, secretKeySelector provider.SecretKeySelectorValueFunc, infraManagementUser bool) (username, password string, err error) {\n\tif infraManagementUser {\n\t\tusername = cloud.VSphere.InfraManagementUser.Username\n\t\tpassword = cloud.VSphere.InfraManagementUser.Password\n\t}\n\tif username == \"\" {\n\t\tusername = cloud.VSphere.Username\n\t}\n\tif password == \"\" {\n\t\tpassword = cloud.VSphere.Password\n\t}\n\n\tif username != \"\" && password != \"\" {\n\t\treturn username, password, nil\n\t}\n\n\tif cloud.VSphere.CredentialsReference == nil {\n\t\treturn \"\", \"\", errors.New(\"cluster contains no password an and empty credentialsReference\")\n\t}\n\n\tif username == \"\" && infraManagementUser {\n\t\tusername, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VsphereInfraManagementUserUsername)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\tif username == \"\" {\n\t\tusername, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VsphereUsername)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif password == \"\" && infraManagementUser {\n\t\tpassword, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VsphereInfraManagementUserPassword)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif password == \"\" {\n\t\tpassword, err = secretKeySelector(cloud.VSphere.CredentialsReference, resources.VspherePassword)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\tif username == \"\" {\n\t\treturn \"\", \"\", errors.New(\"unable to get username\")\n\t}\n\n\tif password == \"\" {\n\t\treturn \"\", \"\", errors.New(\"unable to get password\")\n\t}\n\n\treturn username, password, nil\n}", "title": "" }, { "docid": "f0f8bcaa88c5400be091ceae2fabf10b", "score": "0.58781886", "text": "func Credentials(apiKey, secret string) func(*Client) {\n\treturn func(c *Client) {\n\t\tc.apiKey = apiKey\n\t\tc.secret = secret\n\t}\n}", "title": "" }, { "docid": "ced9a9638dca6b7e01952e70a1389a28", "score": "0.5872177", "text": "func (_Repository *RepositoryCaller) Credentials(opts *bind.CallOpts, arg0 [32]byte) ([32]byte, error) {\n\tvar (\n\t\tret0 = new([32]byte)\n\t)\n\tout := ret0\n\terr := _Repository.contract.Call(opts, out, \"credentials\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "bfe194689fd5df55b8c70f995c1a3c63", "score": "0.58605367", "text": "func (c *client) GetCredentials(user *schema.User) (credentials.Value, error) {\n\treturn c.do(user, \"GET\", \"/credentials\", nil)\n}", "title": "" }, { "docid": "0f0b55f2990108044a9b31edeccf8ee4", "score": "0.58541465", "text": "func File(path string) (*credentials.Credentials, error) {\n\tc := &credentials.Value{}\n\tif err := vsjson.DecodeFile(path, c); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn creds(c.AccessKeyID, c.SecretAccessKey, c.SessionToken)\n}", "title": "" }, { "docid": "d496d88d11bc791aefbadf31dd866ead", "score": "0.5841455", "text": "func (_this *Navigator) Credentials() *credential.CredentialsContainer {\n\tvar ret *credential.CredentialsContainer\n\tvalue := _this.Value_JS.Get(\"credentials\")\n\tret = credential.CredentialsContainerFromJS(value)\n\treturn ret\n}", "title": "" }, { "docid": "db40d03bfbf0df4cc4b21d49192a694c", "score": "0.5840233", "text": "func (c *Config) SaveCredentials(creds *hive.Credentials) error {\n\tc.Username = creds.Username\n\tc.LoginURL = creds.URL\n\treturn keyring.Set(keyringService, creds.Username, creds.Password)\n}", "title": "" }, { "docid": "be1c26aff1201cbf01703d2d91efed63", "score": "0.5837754", "text": "func TestCredentials(c *C) Credentials {\n\tclientCreds := TestClientCredentials(c)\n\tcreds := TestServerCredentials(c)\n\treturn Credentials{Client: clientCreds, Server: creds}\n}", "title": "" }, { "docid": "ee61df01b872f8c36b7cf11d6611cf46", "score": "0.5835206", "text": "func (d *Device) Credentials(rpID string, pin string) ([]*Credential, error) {\n\tif rpID == \"\" {\n\t\treturn nil, errors.Errorf(\"no rpID specified\")\n\t}\n\tdev, err := d.open()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer d.close(dev)\n\n\tcRK := C.fido_credman_rk_new()\n\tdefer C.fido_credman_rk_free(&cRK)\n\n\tif cErr := C.fido_credman_get_dev_rk(dev, C.CString(rpID), cRK, cStringOrNil(pin)); cErr != C.FIDO_OK {\n\t\treturn nil, errors.Wrap(errFromCode(cErr), \"failed to get resident key info\")\n\t}\n\n\tcount := int(C.fido_credman_rk_count(cRK))\n\tcredentials := make([]*Credential, 0, count)\n\tfor i := 0; i < count; i++ {\n\t\tcCred := C.fido_credman_rk(cRK, C.size_t(i))\n\t\tcred, err := credential(cCred)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcredentials = append(credentials, cred)\n\t}\n\treturn credentials, nil\n}", "title": "" }, { "docid": "8308e082fa77185e2238c70e1ed3c669", "score": "0.5813048", "text": "func CredentialsFromFile(ctx context.Context, path string) (*google.Credentials, error) {\n\tjsonData, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(jsonData) == 0 {\n\t\treturn nil, ErrCredentialsEmpty\n\t}\n\n\tcreds, err := google.CredentialsFromJSON(ctx, []byte(jsonData), \"https://www.googleapis.com/auth/cloud-platform\")\n\treturn creds, err\n}", "title": "" }, { "docid": "8eed82b1a7dd48b7852fe2006b460d05", "score": "0.5811819", "text": "func (c *AwsCredentials) List() {\n\theader := \"Name\\tPlatform\\tRegion\\tAccess Key\\tSecret Key\\tSession Token\\tProfile\" //\\tLocation\"\n\taccessKey := c.AccessKey\n\tif len(accessKey) == 0 {\n\t\taccessKey = emptyValue\n\t} else {\n\t\taccessKey = filter(accessKey, truncLen, false)\n\t}\n\tsecretKey := c.SecretKey\n\tif len(secretKey) == 0 {\n\t\tsecretKey = emptyValue\n\t} else {\n\t\tsecretKey = filter(secretKey, truncLen, false)\n\t}\n\tsessionToken := c.SessionToken\n\tif len(sessionToken) == 0 {\n\t\tsessionToken = emptyValue\n\t}\n\tregion := c.Region\n\tif len(region) == 0 {\n\t\tregion = emptyValue\n\t}\n\tprofile := c.Profile\n\tif len(profile) == 0 {\n\t\tprofile = emptyValue\n\t}\n\trow := fmt.Sprintf(\"%s\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\", c.cluster, c.Platform, region, accessKey, secretKey, sessionToken, profile) //, c.path)\n\tprintCredentials(header, row)\n}", "title": "" }, { "docid": "69038a04e3265b55cf5575c96831195c", "score": "0.5807026", "text": "func GetCreds() string {\n\tstatsUser := getSecretOrEnvVar(os.Getenv(\"STATS_USER_ENV\"), \"\")\n\tstatsPass := getSecretOrEnvVar(os.Getenv(\"STATS_PASS_ENV\"), \"\")\n\tif len(statsUser) > 0 && !strings.EqualFold(statsUser, \"none\") && len(statsPass) > 0 && !strings.EqualFold(statsPass, \"none\") {\n\t\treturn fmt.Sprintf(\"%s:%s@\", statsUser, statsPass)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8f957055e8c95db48041f79475a717e2", "score": "0.57998085", "text": "func getBasicAuthCredentials(token string) (string, string, error) {\n\tb, err := base64.StdEncoding.DecodeString(token)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"invalid basic auth token: %v\", err)\n\t}\n\n\tpair := strings.SplitN(string(b), \":\", 2)\n\tif len(pair) != 2 {\n\t\treturn \"\", \"\", fmt.Errorf(\"invalid format: %q\", b)\n\t}\n\t// user, password\n\treturn pair[0], pair[1], nil\n}", "title": "" }, { "docid": "25cb108d2958df16411579bad3607787", "score": "0.57923275", "text": "func NewCredentials(provider Provider) *Credentials {\n\tc := &Credentials{\n\t\tprovider: provider,\n\t}\n\treturn c\n}", "title": "" }, { "docid": "4dc237d4adaf977fc27678bdb7daccf8", "score": "0.57795167", "text": "func (c *Client) GetCredential(hostname string) (string, string, error) {\n\thostname = resolveHostname(hostname)\n\n\tvar (\n\t\tauth ctypes.AuthConfig\n\t\terr error\n\t)\n\n\tfor _, cfg := range c.cfgs {\n\t\tauth, err = cfg.GetAuthConfig(hostname)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif auth.IdentityToken != \"\" {\n\t\t\treturn \"\", auth.IdentityToken, nil\n\t\t}\n\t\tif auth.Username == \"\" && auth.Password == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\treturn auth.Username, auth.Password, nil\n\t}\n\n\treturn \"\", \"\", err\n}", "title": "" }, { "docid": "b3f563303679dfb7cdd206732b1c6487", "score": "0.5767856", "text": "func (o MethodIntegrationPtrOutput) Credentials() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MethodIntegration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Credentials\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a3507f6c32f99fb6118abeb47050f6b7", "score": "0.57656044", "text": "func NewCredentials(logger gateways.Logger) gateways.Credentials {\n\treturn &credentialsCache{\n\t\tBase: &credentialsIfEnv{\n\t\t\tLogger: logger,\n\t\t\tBase: &credentialsData{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9a22d2af254f3f9ab4ec6419bd9a2aac", "score": "0.5761756", "text": "func (credManager MockCredManager) GetCredentials(registry string) (*credentials.RegistryCredentials, error) {\n\tfor _, cred := range credManager.storedCredentials {\n\t\tif cred.Registry == registry && cred.Username != \"\" && cred.Password != \"\" {\n\t\t\treturn cred, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "3de50baf589aaacccd779d779ee1aee0", "score": "0.5760038", "text": "func DefaultCredentials() (*RoleCredentials, error) {\n\treturn DefaultClient.DefaultCredentials()\n}", "title": "" }, { "docid": "9898c54059212328138ff552f9410138", "score": "0.5749051", "text": "func getAuthCredentialsFromBroker(client kubernetes.Interface, broker *v1alpha1.Broker) (username, password string, err error) {\n\tif broker.Spec.AuthSecret == nil {\n\t\treturn \"\", \"\", nil\n\t}\n\n\tauthSecret, err := client.Core().Secrets(broker.Spec.AuthSecret.Namespace).Get(broker.Spec.AuthSecret.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tusernameBytes, ok := authSecret.Data[\"username\"]\n\tif !ok {\n\t\treturn \"\", \"\", fmt.Errorf(\"auth secret didn't contain username\")\n\t}\n\n\tpasswordBytes, ok := authSecret.Data[\"password\"]\n\tif !ok {\n\t\treturn \"\", \"\", fmt.Errorf(\"auth secret didn't contain password\")\n\t}\n\n\treturn string(usernameBytes), string(passwordBytes), nil\n}", "title": "" }, { "docid": "45c8274dbb2e1a2bb30ce5aa2eca95c1", "score": "0.57340187", "text": "func GetCredentials(k8s kubernetes.Interface, ref *v1.SecretReference) (map[string]string, error) {\n\tif ref == nil {\n\t\treturn nil, nil\n\t}\n\n\tsecret, err := k8s.CoreV1().Secrets(ref.Namespace).Get(context.TODO(), ref.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting secret %s in namespace %s: %v\", ref.Name, ref.Namespace, err)\n\t}\n\n\tcredentials := map[string]string{}\n\tfor key, value := range secret.Data {\n\t\tcredentials[key] = string(value)\n\t}\n\treturn credentials, nil\n}", "title": "" }, { "docid": "2ae6293a7a71c5bc700b7299b1980f9f", "score": "0.5730127", "text": "func GetGenericCredentials(cmd *cobra.Command) map[string]string {\n\tcredMap := map[string]string{}\n\n\t// Only check for AWS, Azure and vSphere. Any the other platform will have the\n\t// same credential parameters as these 3. Do not use \"vra\", \"raw\" or \"stacki\",\n\t// they do not have credentials\n\tfor _, platform := range []string{\"aws\", \"azure\", \"vsphere\"} {\n\t\tcred := GetCredentials(platform, cmd)\n\t\tfor k, v := range cred {\n\t\t\tcredMap[k] = v\n\t\t}\n\t}\n\n\treturn credMap\n}", "title": "" }, { "docid": "a4ea36926bd231338549e1a9e97a28ef", "score": "0.5718823", "text": "func (credManager KeyringCredManager) GetCredentials(registry string) (*RegistryCredentials, error) {\n\tif registry == \"\" {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"registry to which the credentials belongs to is required for retrieving credentials\")\n\t}\n\tregistryKey := getCredManagerKeyForRegistry(registry)\n\n\tvar registryCredentials = &RegistryCredentials{\n\t\tRegistry: registry,\n\t}\n\tringItem, err := credManager.ring.Get(registryKey)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), keyringDoesNotExistErrMsg) {\n\t\t\treturn registryCredentials, nil\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"failed to get credentials from the native keyring due to: %v\", err)\n\t\t}\n\t}\n\tif ringItem.Data == nil {\n\t\treturn registryCredentials, nil\n\t}\n\terr = json.Unmarshal(ringItem.Data, registryCredentials)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decode the stored credentials due to: %v\", err)\n\t}\n\treturn registryCredentials, err\n}", "title": "" }, { "docid": "df25ce79584e37d0cff442722d266000", "score": "0.5717967", "text": "func (ri *remoteInterface) Credentials(_ context.Context,\n\treq *protov1.CredentialsRequest) (*protov1.CredentialsResponse, error) {\n\t// For security, admin credentials can't be generated via the API\n\tif !isRoleValid(req.Role) || req.Role == \"admin\" {\n\t\treturn nil, errInvalidRequest\n\t}\n\treturn ri.srv.AccessToken(req, true)\n}", "title": "" }, { "docid": "727440b6feea7c9b40936fefccd75031", "score": "0.5712829", "text": "func (p *accountProvider) GardenerCredentials(hyperscalerType Type, tenantName string) (Credentials, error) {\n\tif p.gardenerPool == nil {\n\t\treturn Credentials{}, fmt.Errorf(\"failed to get Gardener Credentials. Gardener Account pool is not configured for tenant: %s\", tenantName)\n\t}\n\n\treturn p.gardenerPool.Credentials(hyperscalerType, tenantName)\n}", "title": "" }, { "docid": "2403ddf36ac24ab9bbcb4b234117675b", "score": "0.57107407", "text": "func GetEnvCredentials(ctx context.Context) aws.Credentials {\n\treturn aws.Credentials{AccessKeyID: os.Getenv(\"AWS_ACCESS_KEY_ID\"), SecretAccessKey: os.Getenv(\"AWS_SECRET_ACCESS_KEY\"), SessionToken: os.Getenv(\"AWS_SESSION_TOKEN\")}\n}", "title": "" }, { "docid": "bc35e4abd8434b187aa7fac25728accc", "score": "0.56984645", "text": "func NewCredentials(username, password, clientID, clientSecret string) *Credentials {\n\treturn &Credentials{\n\t\tusername: username,\n\t\tpassword: password,\n\t\tclientID: clientID,\n\t\tclientSecret: clientSecret,\n\t\ttokenURL: redditAuthURL,\n\t}\n}", "title": "" }, { "docid": "17cf4e7684b649c3bf69ce0b63ef8b60", "score": "0.56958133", "text": "func (azkey *azAuthBfsKey) getCredential() interface{} {\n\tif azkey.config.AccountKey == \"\" {\n\t\tlog.Err(\"azAuthBfsKey::getCredential : Shared key for account is empty, cannot authenticate user\")\n\t\treturn nil\n\t}\n\n\tcredential := azbfs.NewSharedKeyCredential(\n\t\tazkey.config.AccountName,\n\t\tazkey.config.AccountKey)\n\n\treturn credential\n}", "title": "" }, { "docid": "756c39c7afec56b3a9459a43dc1edc88", "score": "0.56878614", "text": "func NewCredentials(args ...string) (Credentials, error) {\n\tvar err error\n\n\tc := newCredentials()\n\n\tswitch len(args) {\n\tcase 0:\n\t\terr = c.init()\n\tcase 1:\n\t\terr = c.load(args[0])\n\tcase 2:\n\t\terr = c.load(args[0], args[1])\n\tcase 3:\n\t\terr = c.set(args[0], args[1], args[2])\n\tcase 4:\n\t\terr = c.set(args[0], args[1], args[2], args[3])\n\t}\n\n\treturn c, err\n}", "title": "" }, { "docid": "f8233434a8f56da69ed14284491879ec", "score": "0.56830937", "text": "func (client *GenericClient) Creds() azcore.TokenCredential {\n\treturn client.creds\n}", "title": "" }, { "docid": "f541ad5207911cfbe8e5f7f5d093fd41", "score": "0.5682426", "text": "func NewSharedCredentials(filename, profile string) *Credentials {\n\treturn NewCredentials(&SharedCredentialsProvider{\n\t\tFilename: filename,\n\t\tProfile: profile,\n\t})\n}", "title": "" }, { "docid": "476c437f16980b4043c6f6def8efb9d7", "score": "0.56793404", "text": "func GetCredentials(ctx context.Context, namespace string) (*Credential, error) {\n\tq := fmt.Sprintf(`query{\n\t\tcredentials(space: \"%s\"){\n\t\t\tserver, certificate, token, namespace\n\t\t},\n\t}`, namespace)\n\n\tvar cred Credentials\n\tif err := query(ctx, q, &cred); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &cred.Credentials, nil\n}", "title": "" }, { "docid": "140cc440b136f9ad7aad71ec6287159d", "score": "0.56672055", "text": "func prepateCredentials(fwinfo *mesos.FrameworkInfo) *mesos.Credential {\n\tif *mesosAuthPrincipal != \"\" {\n\t\tfwinfo.Principal = proto.String(*mesosAuthPrincipal)\n\t\tsecret, err := ioutil.ReadFile(*mesosAuthSecretFile)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\treturn &mesos.Credential{\n\t\t\tPrincipal: proto.String(*mesosAuthPrincipal),\n\t\t\tSecret: secret,\n\t\t}\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "55293ef32fc8fe6a4bf2d2ceddb1da94", "score": "0.5664073", "text": "func (b *backend) pathCredsRead(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\t// Get the role\n\trole, err := b.Role(ctx, req.Storage, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif role == nil {\n\t\treturn logical.ErrorResponse(fmt.Sprintf(\"unknown role: %s\", name)), nil\n\t}\n\n\n\t// Get the client configuration\n\tclient, err := b.Client(ctx, req.Storage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif client == nil {\n\t\treturn logical.ErrorResponse(\"failed to get the client\"), nil\n\t}\n\n\tpassword := client.Password\n\n\t// Generate credentials in the backend, with the NPMJS server\n\ttokenhash, err := client.CreateToken(npmgo.TokenSettings{\n\t\tPassword: password,\n\t\tReadonly: false,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create a new token\")\n\t}\n\n\t// Return the secret\n\tresp := b.Secret(SecretCredsType).Response(map[string]interface{}{\n\t\t\"token\": tokenhash.Token,\n\t}, map[string]interface {}{\n\t\t\"id\": tokenhash.Id,\n\t})\n\n\t// Determine if we have a lease\n//\tlease, err := b.Lease(ctx, req.Storage)\n//\tif err != nil {\n//\t\treturn nil, err\n//\t}\n\n//\tif lease != nil {\n//\t\tresp.Token.TTL = lease.TTL\n//\t\tresp.Token.MaxTTL = lease.MaxTTL\n//\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "44f16faab87ff166530982612ffc399e", "score": "0.5662137", "text": "func (ak *AccessKey) GetCredentials() (auth.Credential, error) {\n\terr := ak.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &credentials.AccessKeyCredential{AccessKeyId: ak.AccessKeyID, AccessKeySecret: ak.AccessKeySecret}, nil\n}", "title": "" }, { "docid": "5e6f7b9d7846824d1e758abdc108e77e", "score": "0.56597733", "text": "func (azkey *azAuthBlobKey) getCredential() interface{} {\n\tif azkey.config.AccountKey == \"\" {\n\t\tlog.Err(\"azAuthBlobKey::getCredential : Shared key for account is empty, cannot authenticate user\")\n\t\treturn nil\n\t}\n\n\tcredential, err := azblob.NewSharedKeyCredential(\n\t\tazkey.config.AccountName,\n\t\tazkey.config.AccountKey)\n\tif err != nil {\n\t\tlog.Err(\"azAuthBlobKey::getCredential : Failed to create shared key credentials\")\n\t\treturn nil\n\t}\n\n\treturn credential\n}", "title": "" }, { "docid": "de3171e740fea460ad708cfb06d87c7b", "score": "0.5657379", "text": "func askCredentials() (username string, password string) {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfmt.Print(\"Name: \")\n\tusername, _ = reader.ReadString('\\n')\n\tusername = strings.Trim(username, \" \\n\\r\")\n\n\tfmt.Print(\"Password: \")\n\tpwbytes, err := terminal.ReadPassword(int(syscall.Stdin))\n\tfmt.Println(\"\") // Move down one line\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn username, strings.Trim(string(pwbytes), \" \\r\")\n}", "title": "" }, { "docid": "0b12997e0ab5abf603cc264ae709c371", "score": "0.5638622", "text": "func fetchCredentialsFileFromSecret(secret *corev1.Secret, config *providers.Configuration) error {\n\t//accessKeyID/accessKeySecret\n\tif len(secret.Data[kubeAccessKeyID]) > 0 && len(secret.Data[kubeAccessKeySecret]) > 0 {\n\t\tconfig.AccessKeyID = utils.ByteArray2String(secret.Data[kubeAccessKeyID])\n\t\tconfig.AccessKeySecret = utils.ByteArray2String(secret.Data[kubeAccessKeySecret])\n\t}\n\n\t//ststoken\n\tif len(secret.Data[kubeAccessKeyStsToken]) > 0 {\n\t\tconfig.AccessKeyStsToken = utils.ByteArray2String(secret.Data[kubeAccessKeyStsToken])\n\t}\n\n\t// roleArn ,roleSessionName ,roleSessionExpiration\n\tif len(secret.Data[kubeRoleArn]) > 0 && len(secret.Data[kubeRoleSessionName]) > 0 && len(secret.Data[kubeRoleSessionExpiration]) > 0 {\n\t\tif roleSessionExpiration, err := utils.String2IntPointer(string(secret.Data[kubeRoleSessionExpiration])); roleSessionExpiration != nil && err == nil {\n\t\t\tconfig.RoleArn = string(secret.Data[kubeRoleArn])\n\t\t\tconfig.RoleSessionName = string(secret.Data[kubeRoleSessionName])\n\t\t\tconfig.RoleSessionExpiration = roleSessionExpiration\n\t\t}\n\t}\n\n\t// roleName\n\tif len(secret.Data[kubeRoleName]) > 0 {\n\t\tconfig.RoleName = string(secret.Data[kubeRoleName])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "88c622b3e5bcac1ae3c9de4fd9938ace", "score": "0.5635653", "text": "func (c *Config) LoadCredentials() (*hive.Credentials, error) {\n\tif c.Username == \"\" {\n\t\treturn nil, ErrNoUsername\n\t}\n\tif c.LoginURL == \"\" {\n\t\treturn nil, ErrNoURL\n\t}\n\n\tpass, err := keyring.Get(keyringService, c.Username)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &hive.Credentials{\n\t\tUsername: c.Username,\n\t\tPassword: pass,\n\t\tURL: c.LoginURL,\n\t}, nil\n}", "title": "" }, { "docid": "f63966926ead9af94cb2cef353b903e0", "score": "0.56263494", "text": "func GetCredentialsFromFile(file string) (bitbucket string, crowd string) {\r\n\tf, err := os.Open(file)\r\n\tif err != nil {\r\n\t\treturn \"\", \"\"\r\n\t}\r\n\tdefer f.Close()\r\n\r\n\tbitbucket, crowd = \"\", \"\"\r\n\r\n\tscanner := bufio.NewScanner(f)\r\n\r\n\tfor scanner.Scan() {\r\n\t\tline := strings.Split(scanner.Text(), \" \")\r\n\t\tkey, value := line[0], line[1]\r\n\t\tif key == \"Bitbucket\" || key == \"bitbucket\" {\r\n\t\t\tbitbucket = value\r\n\t\t} else if key == \"Crowd\" || key == \"crowd\" {\r\n\t\t\tcrowd = value\r\n\t\t}\r\n\t}\r\n\r\n\treturn bitbucket, crowd\r\n}", "title": "" }, { "docid": "893690de69fa1db790739444f15c8384", "score": "0.56251496", "text": "func (p *SharedCredentialsProvider) Retrieve() (Value, error) {\n\tp.retrieved = false\n\n\tfilename, err := p.filename()\n\tif err != nil {\n\t\treturn Value{ProviderName: SharedCredsProviderName}, err\n\t}\n\n\tcreds, err := loadProfile(filename, p.profile())\n\tif err != nil {\n\t\treturn Value{ProviderName: SharedCredsProviderName}, err\n\t}\n\n\tp.retrieved = true\n\treturn creds, nil\n}", "title": "" }, { "docid": "2e288de7d4858936d9788efe416c66d2", "score": "0.5612254", "text": "func setup(config *Config) (*UserCredentials, error) {\n\t// Check if folder exists\n\tif _, err := os.Stat(config.Dir); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(config.Dir, 0755)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Configuration folder %s could not be created: %s\", config.Dir, err.Error())\n\t\t}\n\t}\n\t// Create auth token file\n\tauthTokenFilename := config.AuthTokenPath()\n\tcredentialsFilename := config.CredentialsPath()\n\tif _, err := os.Stat(authTokenFilename); os.IsNotExist(err) {\n\t\terr = ioutil.WriteFile(authTokenFilename, []byte{}, 0600)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Could not create token file %s: %s\", authTokenFilename, err.Error())\n\t\t}\n\t}\n\tif _, err := os.Stat(credentialsFilename); os.IsNotExist(err) {\n\t\tusername, password, err := readAndSaveUserCredentials(credentialsFilename)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Cannot read and save credentials: %s\", err.Error())\n\t\t}\n\n\t\treturn &UserCredentials{Username: username, Password: password}, nil\n\t}\n\tc, err := ioutil.ReadFile(credentialsFilename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read data from the credentials file: %s\", err.Error())\n\t}\n\tparts := strings.Split(string(c), \":\")\n\tif len(parts) == 2 {\n\t\treturn &UserCredentials{Username: parts[0], Password: parts[1]}, nil\n\t}\n\t// read credentials and save\n\tusername, password, err := readAndSaveUserCredentials(credentialsFilename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Cannot read and save credentials: %s\", err.Error())\n\t}\n\treturn &UserCredentials{Username: username, Password: password}, nil\n}", "title": "" }, { "docid": "ebc6fc80c397c89d9121f62c62358735", "score": "0.55969286", "text": "func CredentialsFromEnvVar(ctx context.Context, name string) (*google.Credentials, error) {\n\tcontent := os.Getenv(name)\n\tif len(content) == 0 {\n\t\treturn nil, ErrCredentialsEmpty\n\t}\n\n\tcreds, err := google.CredentialsFromJSON(ctx, []byte(content), \"https://www.googleapis.com/auth/cloud-platform\")\n\treturn creds, err\n}", "title": "" }, { "docid": "061186859b5ee0d1b52eeae486e18648", "score": "0.55874264", "text": "func GetCredentials(platform string, cmd *cobra.Command) map[string]string {\n\tcreds := map[string]string{}\n\n\tenvPrefix, varNames := getVarNames(platform)\n\tfor _, name := range varNames {\n\t\tif value := getVarValue(name, envPrefix, cmd.Flags().Lookup(name)); value != \"\" {\n\t\t\t// Get the value of the environment variable `PLATFORM_NAME` (if exists) and append it to the list of variables\n\t\t\tcreds[name] = value\n\t\t}\n\t}\n\n\treturn creds\n}", "title": "" }, { "docid": "139706c5b5a02019bdb7fbe2560f1182", "score": "0.5587375", "text": "func Creds(accessKeyID, secretAccessKey, securityToken string) CredentialsProvider {\n\treturn staticCredentialsProvider{\n\t\tcreds: Credentials{\n\t\t\tAccessKeyID: accessKeyID,\n\t\t\tSecretAccessKey: secretAccessKey,\n\t\t\tSecurityToken: securityToken,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6e803a244a885134c25234593517116d", "score": "0.55861187", "text": "func (j *JWTAuthenticator) NewCredentials() (*Credentials, error) {\n\t// expiry needs to be set to 3 minutes or less\n\t// See: https://help.salesforce.com/articleView?id=remoteaccess_oauth_jwt_flow.htm\n\tj.claims.ExpiresAt = jwt.NewNumericDate(time.Now().Add(time.Minute * 3))\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodRS256, j.claims)\n\tsignedToken, err := token.SignedString(j.signKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not sign JWT token: %w\", err)\n\t}\n\n\tform := url.Values{\n\t\t\"grant_type\": []string{grantJWT},\n\t\t\"assertion\": []string{signedToken},\n\t}\n\n\treq, err := http.NewRequest(\"POST\", j.authURL, strings.NewReader(form.Encode()))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not build authentication request: %w\", err)\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tres, err := j.client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not execute authentication request: %w\", err)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode >= 400 {\n\t\tmsg := fmt.Sprintf(\"received unexpected status code %d from authentication\", res.StatusCode)\n\t\tif resb, err := io.ReadAll(res.Body); err == nil {\n\t\t\tmsg += \": \" + string(resb)\n\t\t}\n\t\treturn nil, errors.New(msg)\n\t}\n\n\tc := &Credentials{}\n\terr = json.NewDecoder(res.Body).Decode(c)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not decode authentication response into credentails: %w\", err)\n\t}\n\n\treturn c, nil\n}", "title": "" } ]
de30c1e7b1e0d3df63ebdd691d3e1f6a
RecvMsg indicates an expected call of RecvMsg
[ { "docid": "8c92d860880458c35f7d09c376fb9a6c", "score": "0.67667425", "text": "func (mr *MockHealth_HealthStreamClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockHealth_HealthStreamClient)(nil).RecvMsg), arg0)\n}", "title": "" } ]
[ { "docid": "88bc5d084412a9cb3d38e4d2a672284b", "score": "0.7088618", "text": "func (mr *MockBlobService_GetServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockBlobService_GetServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "55f630037c56db64414e7dbccdff2d56", "score": "0.69902986", "text": "func (mr *MockLogCheck_CheckServerMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockLogCheck_CheckServer)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "6682d6abb612e53ab0c7daf94a280f8f", "score": "0.69809306", "text": "func (mr *MockMetadataService_GetAgentUpdatesServerMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockMetadataService_GetAgentUpdatesServer)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "09387b5d6206de6d143448acefe124f9", "score": "0.6978642", "text": "func (mr *MockBlobService_GetClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockBlobService_GetClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "999a3002de8dab6c386ea3269f795271", "score": "0.6955247", "text": "func (mr *MockOperator_PullFileServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockOperator_PullFileServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "51649f1377044fc37e625af8a2b436b2", "score": "0.6941626", "text": "func (mr *MockMetadataService_GetAgentUpdatesClientMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockMetadataService_GetAgentUpdatesClient)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "44eeaf73fa4b29611389ace0ba0de608", "score": "0.6927509", "text": "func (mr *MockService_MigrateServerMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockService_MigrateServer)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "e6ebf942885f83bfde7068c7ab66f687", "score": "0.69002485", "text": "func (mr *MockDiscoveryService_EstablishStreamServerMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockDiscoveryService_EstablishStreamServer)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "f127475cf0e27a9938a6cb82f8b43dc6", "score": "0.68977743", "text": "func (mr *MockOperator_PullFileClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockOperator_PullFileClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "9fcef7681638717f6abc2443f8ccf240", "score": "0.6892996", "text": "func (mr *MockLogCheck_CheckClientMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockLogCheck_CheckClient)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "08a8d390fd66a3b179b71dc12e8152e7", "score": "0.6888069", "text": "func (mr *MockNumbers_FindMaxNumberClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockNumbers_FindMaxNumberClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "99874ef938ec3da5fd88fdbbcbc215ae", "score": "0.6884211", "text": "func (mr *MockMeterReportService_CollectBatchClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockMeterReportService_CollectBatchClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "23c05f82380a70c505d7fdba0eca252f", "score": "0.68782693", "text": "func (mr *MockCliToHub_ExecuteServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockCliToHub_ExecuteServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "e35274c867ce2d43b6099607d027c9f7", "score": "0.68782276", "text": "func (mr *MockResultSinkService_TransferResultChunkServerMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockResultSinkService_TransferResultChunkServer)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "5ee70c7738b0fb9a4ad69dea04fa36ea", "score": "0.68552464", "text": "func (mr *MockProducts_SetAttributeDatasClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockProducts_SetAttributeDatasClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "0e61546c87e01c17bc9a1e0d5df6cad7", "score": "0.68396443", "text": "func (mr *MockHealth_HealthStreamServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockHealth_HealthStreamServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "71ccc4067c1bd08ba209edf4a3b72893", "score": "0.683581", "text": "func (mr *MockObserver_GetFlowsClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockObserver_GetFlowsClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "52a9c1b4b9db722b38ca15e094289078", "score": "0.6833157", "text": "func (mr *MockService_MigrateClientMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockService_MigrateClient)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "d986d4b0e509dd0d04f8939fe320a4f8", "score": "0.6828462", "text": "func (m *MessageService_MessageClientMock) RecvMsg(p interface{}) (r error) {\n\tatomic.AddUint64(&m.RecvMsgPreCounter, 1)\n\tdefer atomic.AddUint64(&m.RecvMsgCounter, 1)\n\n\tif m.RecvMsgMock.mockExpectations != nil {\n\t\ttestify_assert.Equal(m.t, *m.RecvMsgMock.mockExpectations, MessageService_MessageClientMockRecvMsgParams{p},\n\t\t\t\"MessageService_MessageClient.RecvMsg got unexpected parameters\")\n\n\t\tif m.RecvMsgFunc == nil {\n\n\t\t\tm.t.Fatal(\"No results are set for the MessageService_MessageClientMock.RecvMsg\")\n\n\t\t\treturn\n\t\t}\n\t}\n\n\tif m.RecvMsgFunc == nil {\n\t\tm.t.Fatal(\"Unexpected call to MessageService_MessageClientMock.RecvMsg\")\n\t\treturn\n\t}\n\n\treturn m.RecvMsgFunc(p)\n}", "title": "" }, { "docid": "f9deaa832ccee555ad36e9fb1dd73680", "score": "0.68136555", "text": "func (mr *MockResultSinkService_TransferResultChunkClientMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockResultSinkService_TransferResultChunkClient)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "e04bbc423d8524c3bc30fa085728206f", "score": "0.6804602", "text": "func (mr *MockDiscoveryService_EstablishStreamClientMockRecorder) RecvMsg(m interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockDiscoveryService_EstablishStreamClient)(nil).RecvMsg), m)\n}", "title": "" }, { "docid": "1cdebea3cd7870806cba987ba12b8373", "score": "0.6797409", "text": "func (mr *MockAlert_RequestReplyServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockAlert_RequestReplyServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "baaaf26dc6e019eba2d4d9d73269e615", "score": "0.67958957", "text": "func (mr *MockFederation_EventStreamClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockFederation_EventStreamClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "1a95a2289b4c4121045fa8b851e2e324", "score": "0.6781856", "text": "func (mr *MockBlobService_PushServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockBlobService_PushServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "b5648130b5bce6b6d56d1409174201c1", "score": "0.6780651", "text": "func (mr *MockProducts_PredictCategoryClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockProducts_PredictCategoryClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "9a9b89a9f48435cd788e98e13f390c5f", "score": "0.67772114", "text": "func (d Before) AssertRecv(t TestingT, ch interface{}, msgAndArgs ...interface{}) interface{} {\n\tt.Helper()\n\tv, ok := d.assertRecv(t, ch)\n\tif !ok {\n\t\tt.Fatal(defaultOrCustomMessage(\"timeout waiting for channel send or receive\", msgAndArgs...))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3abf31afb85f2b87e67aac9d2a2e82e6", "score": "0.67765886", "text": "func (mr *MockProcessor_RequestNotificationClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockProcessor_RequestNotificationClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "56d747c125d0516f9d83a1a16ad65f22", "score": "0.6770129", "text": "func (mr *MockCliToHub_ExecuteClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockCliToHub_ExecuteClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "11809858c9ccdcb818cd66befef6a1c9", "score": "0.6744699", "text": "func (mr *MockUserService_ListUsersServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockUserService_ListUsersServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "0ff51e5fae9b9c8f239727662344e63a", "score": "0.6734285", "text": "func (mr *MockProcessor_RegisterStreamProcessClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockProcessor_RegisterStreamProcessClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "b18366f9c488b3189aeb2a5c5e56dac5", "score": "0.67310613", "text": "func (mr *MockOperator_PushFileClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockOperator_PushFileClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "4d288e338e3b8b755ddb1e92c0a25e99", "score": "0.6726523", "text": "func (mr *MockUserManagementApi_StreamUsersClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockUserManagementApi_StreamUsersClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "1695da384c08c581feba4a2a54ecb0f9", "score": "0.6721547", "text": "func (mr *MockJobQueue_JobStreamServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockJobQueue_JobStreamServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "0bf26ab347a138abe75cbd300e4bc949", "score": "0.67184955", "text": "func (mr *MockUserService_ListUsersByRoleServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockUserService_ListUsersByRoleServer)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "2afcf84db81d5ac8cfd717840cc7a9ff", "score": "0.6715655", "text": "func (_m *MockClientTransport) IncrMsgRecv() {\n\t_m.Called()\n}", "title": "" }, { "docid": "c8ca59d46b4e8cbf3dc047df42228d63", "score": "0.67052156", "text": "func (mr *MockBlobService_PushClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RecvMsg\", reflect.TypeOf((*MockBlobService_PushClient)(nil).RecvMsg), arg0)\n}", "title": "" }, { "docid": "24d40d97c0d765b7c6a588629ceaeecb", "score": "0.6511163", "text": "func (e *errorLoggingClientStream) RecvMsg(m interface{}) error {\n\terr := e.ClientStream.RecvMsg(m)\n\ts, ok := status.FromError(err)\n\tisCtxCanceledErr := ok && s.Code() == codes.Canceled\n\tif err != nil && !isCtxCanceledErr {\n\t\te.logger.Errorf(\"[%v]: %v\", e.methodName, err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "0bce54ef6cf440892597c190f8c75c4a", "score": "0.6470067", "text": "func (f *fakeDownloadFileServer) RecvMsg(m interface{}) error { return nil }", "title": "" }, { "docid": "cb1bdb4db7adf9aada00dc5626ad5873", "score": "0.64569235", "text": "func Test_onRecvMsg(t *testing.T) {\n\tassert := assert.New(t)\n\tvar sw = NewGossipSwitch(&mockSwitchFiler{})\n\tassert.NotNil(sw, \"FAILED: failed to create GossipSwitch\")\n\n\tcheckSwitchStatus(t, sw.Start(), sw.isRunning, 1)\n\n\t//send message to switch\n\ttxMsg := &types.Transaction{}\n\tsw.InPort(LocalInPortId).Channel() <- txMsg\n\n\trecvMsgChan := make(chan interface{})\n\t// bind output func to switch out port\n\toutPort := sw.OutPort(LocalOutPortId)\n\toutPort.BindToPort(func(msg interface{}) error {\n\t\trecvMsgChan <- msg\n\t\treturn nil\n\t})\n\n\trecvMsg := <-recvMsgChan\n\tif recvMsg != txMsg {\n\t\tt.Error(\"FAILED: failed to receive the message\")\n\t}\n\tt.Log(\"PASS: succed receiving the message\")\n}", "title": "" }, { "docid": "62e643faa1df471b3048a56376b1aa4f", "score": "0.64267063", "text": "func AssertRecv(t TestingT, ch interface{}, msgAndArgs ...interface{}) interface{} {\n\tt.Helper()\n\treturn Default.AssertRecv(t, ch, msgAndArgs...)\n}", "title": "" }, { "docid": "1216663269d74c3d5079271ee922f258", "score": "0.6343545", "text": "func (m *MockNumbers_FindMaxNumberClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6a3df831859e033d42762beae9fe57c8", "score": "0.63267064", "text": "func (cs *clientStream) RecvMsg(m interface{}) (err error) {\n\tdefer func(begin time.Time) {\n\t\tinstrumentStreamRecv(cs.reg, time.Since(begin), err)\n\t}(time.Now())\n\n\treturn cs.ClientStream.RecvMsg(m)\n}", "title": "" }, { "docid": "798133d50877f9d3c6f3617bb4e34844", "score": "0.6308033", "text": "func Test_onRecvMsg(t *testing.T) {\n\tassert := assert.New(t)\n\tvar sw = NewGossipSwitch(&mockSwitchFiler{})\n\tassert.NotNil(sw, \"FAILED: failed to create GossipSwitch\")\n\n\tcheckSwitchStatus(t, sw.Start(), sw.isRunning, 1)\n\n\trecvMsgChan := make(chan interface{})\n\t// bind output func to switch out port\n\toutPort := sw.OutPort(port.LocalOutPortId)\n\toutPort.BindToPort(func(msg interface{}) error {\n\t\tlog.Info(\"received a message\")\n\t\trecvMsgChan <- msg\n\t\treturn nil\n\t})\n\n\t//send message to switch\n\ttxMsg := &types.Transaction{}\n\tsw.InPort(port.LocalInPortId).Channel() <- txMsg\n\n\tticker := time.NewTicker(2 * time.Second)\n\tselect {\n\tcase recvMsg := <-recvMsgChan:\n\t\tassert.Equal(txMsg, recvMsg)\n\tcase <-ticker.C:\n\t\tassert.Nil(errors.New(\"failed to receive message\"))\n\n\t}\n}", "title": "" }, { "docid": "8b2aae517d8e11f7028b1d263c92c110", "score": "0.6303236", "text": "func (cc *ClientConn) RecvMsg(method string, res IResponse) error {\n\trecvMethod, mTypeID, seqID, err := cc.iproto.ReadMessageBegin()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif method != recvMethod {\n\t\treturn NewApplicationException(WRONG_METHOD_NAME, fmt.Sprintf(\"%s failed: wrong method name\", method))\n\t}\n\n\tif cc.seqID != seqID {\n\t\treturn NewApplicationException(BAD_SEQUENCE_ID, fmt.Sprintf(\"%s failed: out of sequence response\", method))\n\t}\n\n\tswitch mTypeID {\n\tcase REPLY:\n\t\tif err := res.Read(cc.iproto); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn cc.iproto.ReadMessageEnd()\n\tcase EXCEPTION:\n\t\terr := NewApplicationException(UNKNOWN_APPLICATION_EXCEPTION, \"Unknown exception\")\n\n\t\trecvdErr, readErr := err.Read(cc.iproto)\n\n\t\tif readErr != nil {\n\t\t\treturn readErr\n\t\t}\n\n\t\tif msgEndErr := cc.iproto.ReadMessageEnd(); msgEndErr != nil {\n\t\t\treturn msgEndErr\n\t\t}\n\t\treturn recvdErr\n\tdefault:\n\t\treturn NewApplicationException(INVALID_MESSAGE_TYPE_EXCEPTION, fmt.Sprintf(\"%s failed: invalid message type\", method))\n\t}\n}", "title": "" }, { "docid": "1c28d6654c5d7bfad59f85e596e5567a", "score": "0.6295679", "text": "func (m *MockAlert_RequestReplyServer) RecvMsg(arg0 interface{}) error {\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "837445c9d6dd900371698a54ab5b4820", "score": "0.6286739", "text": "func (m_2 *MockMetadataService_GetAgentUpdatesServer) RecvMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "acef92d327302ce473de65585d1719f8", "score": "0.62629", "text": "func (m_2 *MockMetadataService_GetAgentUpdatesClient) RecvMsg(m interface{}) error {\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "792f0ce7fd63c95c06c5b72b1b48db3a", "score": "0.62546504", "text": "func (m *MockBlobService_GetServer) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5d375f557945ed287e4206b0433f4515", "score": "0.62520623", "text": "func (m *MockOperator_PullFileServer) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "516be070f0ece251856aa10638c2766b", "score": "0.6231797", "text": "func (m *MockOperator_PullFileClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "362dff58833bd5ddaa5da91da151fb7c", "score": "0.6215251", "text": "func (m_2 *MockService_MigrateServer) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8e5b8594769fac893706c75a2b1a950a", "score": "0.6209153", "text": "func Msgreceive(msgid int, msgType uint, flags int) ([]byte, error) {\n\treturn msg.Receive(msgid, msgType, flags)\n}", "title": "" }, { "docid": "caa78c31cef0309d99c03532c5a67d2a", "score": "0.620229", "text": "func RecvMsg(rw ReaderWriter, msg proto.Message) error {\n\trlengthBuf := make([]byte, 4)\n\trbytes := 0\n\n\tfor rbytes != len(rlengthBuf) {\n\t\tr, rerr := rw.Read(rlengthBuf[rbytes:])\n\t\tif rerr != nil {\n\t\t\treturn rerr\n\t\t}\n\n\t\trbytes += r\n\t}\n\n\trlength := binary.LittleEndian.Uint32(rlengthBuf)\n\trecvBuf := make([]byte, int(rlength))\n\n\trbytes = 0\n\tfor rbytes != len(recvBuf) {\n\t\tr, rerr := rw.Read(recvBuf[rbytes:])\n\t\tif rerr != nil {\n\t\t\treturn rerr\n\t\t}\n\n\t\trbytes += r\n\t}\n\n\tuerr := proto.Unmarshal(recvBuf, msg)\n\tif uerr != nil {\n\t\treturn uerr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7734d60bea5b7e2128e0509fc55b7eb5", "score": "0.61966723", "text": "func (m_2 *MockService_MigrateClient) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f6626c2ffbe9a1884831a08004d047bf", "score": "0.61688685", "text": "func (m *MockBlobService_GetClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fc7772bcb8ddc6270fdc526eda30958e", "score": "0.6162395", "text": "func (m *MessageService_MessageClientMock) Recv() (r *message.Msg, r1 error) {\n\tatomic.AddUint64(&m.RecvPreCounter, 1)\n\tdefer atomic.AddUint64(&m.RecvCounter, 1)\n\n\tif m.RecvFunc == nil {\n\t\tm.t.Fatal(\"Unexpected call to MessageService_MessageClientMock.Recv\")\n\t\treturn\n\t}\n\n\treturn m.RecvFunc()\n}", "title": "" }, { "docid": "049f4f7ae3733682f76c96984d26842f", "score": "0.6151899", "text": "func (m *MockObserver_GetFlowsClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f447990ba502e878564c46a688e0dbf4", "score": "0.6134986", "text": "func (st *msgSender) RecvMsg(m interface{}) error {\n\treturn st.stream.RecvMsg(m)\n}", "title": "" }, { "docid": "b835299cbd10e9f1b1f42984942bcdeb", "score": "0.61318535", "text": "func (m *MockUserService_ListUsersServer) RecvMsg(arg0 interface{}) error {\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a108adb53ce57f393893704f3a44f906", "score": "0.61187816", "text": "func Msgrcv(msgid int, msgp uintptr, msgsz int, msgtyp uint, msgflg int) (int, error) {\n\treturn msg.Rcv(msgid, msgp, msgsz, msgtyp, msgflg)\n}", "title": "" }, { "docid": "9b8bc87a8ddbb584a807a8359b9ca19b", "score": "0.61084515", "text": "func (m *MockProcessor_RequestNotificationClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "df1b9b920b0ef8d6216cdedc511fe237", "score": "0.6091344", "text": "func (s *Socket) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags int, haveDeadline bool, deadline ktime.Time, senderRequested bool, controlDataLen uint64) (n int, msgFlags int, senderAddr linux.SockAddr, senderAddrLen uint32, controlMessages socket.ControlMessages, err *syserr.Error) {\n\ttrunc := flags&linux.MSG_TRUNC != 0\n\tpeek := flags&linux.MSG_PEEK != 0\n\tdontWait := flags&linux.MSG_DONTWAIT != 0\n\twaitAll := flags&linux.MSG_WAITALL != 0\n\tisPacket := s.isPacket()\n\n\t// Calculate the number of FDs for which we have space and if we are\n\t// requesting credentials.\n\tvar wantCreds bool\n\trightsLen := int(controlDataLen) - unix.SizeofCmsghdr\n\tif s.Passcred() {\n\t\t// Credentials take priority if they are enabled and there is space.\n\t\twantCreds = rightsLen > 0\n\t\tif !wantCreds {\n\t\t\tmsgFlags |= linux.MSG_CTRUNC\n\t\t}\n\t\tcredLen := unix.CmsgSpace(unix.SizeofUcred)\n\t\trightsLen -= credLen\n\t}\n\t// FDs are 32 bit (4 byte) ints.\n\tnumRights := rightsLen / 4\n\tif numRights < 0 {\n\t\tnumRights = 0\n\t}\n\n\tr := EndpointReader{\n\t\tCtx: t,\n\t\tEndpoint: s.ep,\n\t\tCreds: wantCreds,\n\t\tNumRights: numRights,\n\t\tPeek: peek,\n\t}\n\tif senderRequested {\n\t\tr.From = &transport.Address{}\n\t}\n\n\tdoRead := func() (int64, error) {\n\t\tn, err := dst.CopyOutFrom(t, &r)\n\t\tif r.Notify != nil {\n\t\t\tr.Notify()\n\t\t}\n\t\treturn n, err\n\t}\n\n\t// If MSG_TRUNC is set with a zero byte destination then we still need\n\t// to read the message and discard it, or in the case where MSG_PEEK is\n\t// set, leave it be. In both cases the full message length must be\n\t// returned.\n\tif trunc && dst.Addrs.NumBytes() == 0 {\n\t\tdoRead = func() (int64, error) {\n\t\t\terr := r.Truncate()\n\t\t\t// Always return zero for bytes read since the destination size is\n\t\t\t// zero.\n\t\t\treturn 0, err\n\t\t}\n\n\t}\n\n\tvar total int64\n\tif n, err := doRead(); err != linuxerr.ErrWouldBlock || dontWait {\n\t\tvar from linux.SockAddr\n\t\tvar fromLen uint32\n\t\tif r.From != nil && len([]byte(r.From.Addr)) != 0 {\n\t\t\tfrom, fromLen = convertAddress(*r.From)\n\t\t}\n\n\t\tif r.ControlTrunc {\n\t\t\tmsgFlags |= linux.MSG_CTRUNC\n\t\t}\n\n\t\tif err != nil || dontWait || !waitAll || isPacket || n >= dst.NumBytes() {\n\t\t\tif isPacket && n < int64(r.MsgSize) {\n\t\t\t\tmsgFlags |= linux.MSG_TRUNC\n\t\t\t}\n\n\t\t\tif trunc {\n\t\t\t\tn = int64(r.MsgSize)\n\t\t\t}\n\n\t\t\treturn int(n), msgFlags, from, fromLen, socket.ControlMessages{Unix: r.Control}, syserr.FromError(err)\n\t\t}\n\n\t\t// Don't overwrite any data we received.\n\t\tdst = dst.DropFirst64(n)\n\t\ttotal += n\n\t}\n\n\t// We'll have to block. Register for notification and keep trying to\n\t// send all the data.\n\te, ch := waiter.NewChannelEntry(waiter.ReadableEvents)\n\ts.EventRegister(&e)\n\tdefer s.EventUnregister(&e)\n\n\tfor {\n\t\tif n, err := doRead(); err != linuxerr.ErrWouldBlock {\n\t\t\tvar from linux.SockAddr\n\t\t\tvar fromLen uint32\n\t\t\tif r.From != nil {\n\t\t\t\tfrom, fromLen = convertAddress(*r.From)\n\t\t\t}\n\n\t\t\tif r.ControlTrunc {\n\t\t\t\tmsgFlags |= linux.MSG_CTRUNC\n\t\t\t}\n\n\t\t\tif trunc {\n\t\t\t\t// n and r.MsgSize are the same for streams.\n\t\t\t\ttotal += int64(r.MsgSize)\n\t\t\t} else {\n\t\t\t\ttotal += n\n\t\t\t}\n\n\t\t\tstreamPeerClosed := s.stype == linux.SOCK_STREAM && n == 0 && err == nil\n\t\t\tif err != nil || !waitAll || isPacket || n >= dst.NumBytes() || streamPeerClosed {\n\t\t\t\tif total > 0 {\n\t\t\t\t\terr = nil\n\t\t\t\t}\n\t\t\t\tif isPacket && n < int64(r.MsgSize) {\n\t\t\t\t\tmsgFlags |= linux.MSG_TRUNC\n\t\t\t\t}\n\t\t\t\treturn int(total), msgFlags, from, fromLen, socket.ControlMessages{Unix: r.Control}, syserr.FromError(err)\n\t\t\t}\n\n\t\t\t// Don't overwrite any data we received.\n\t\t\tdst = dst.DropFirst64(n)\n\t\t}\n\n\t\tif err := t.BlockWithDeadline(ch, haveDeadline, deadline); err != nil {\n\t\t\tif total > 0 {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\tif linuxerr.Equals(linuxerr.ETIMEDOUT, err) {\n\t\t\t\treturn int(total), msgFlags, nil, 0, socket.ControlMessages{}, syserr.ErrTryAgain\n\t\t\t}\n\t\t\treturn int(total), msgFlags, nil, 0, socket.ControlMessages{}, syserr.FromError(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "908d0c681d7302905d43e2c34e8c1280", "score": "0.6083049", "text": "func (m *MockUserService_ListUsersByRoleServer) RecvMsg(arg0 interface{}) error {\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "367cf9cc19fa038db75ea59ac9edc619", "score": "0.60809976", "text": "func (m_2 *MockDiscoveryService_EstablishStreamServer) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ba466cfd0c66e94346a10a860c5dd34e", "score": "0.60799456", "text": "func (m *MockCliToHub_ExecuteServer) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b1ef882dd373e0f72abf4cf18979de1c", "score": "0.6074978", "text": "func Msgrcv(qid uint, msg *Msgbuf, flags uint) error {\n\tqbuf := msgbufInternal{\n\t\tMtype: msg.Mtype,\n\t}\n\tlengthRead, _, err := syscall.Syscall6(syscall.SYS_MSGRCV,\n\t\tuintptr(qid),\n\t\tuintptr(unsafe.Pointer(&qbuf)),\n\t\tuintptr(bufSize),\n\t\tuintptr(msg.Mtype),\n\t\tuintptr(flags),\n\t\t0,\n\t)\n\tif err != 0 {\n\t\treturn err\n\t}\n\n\tmsg.Mtype = qbuf.Mtype\n\tmsg.Mtext = qbuf.Mtext[:lengthRead]\n\treturn nil\n}", "title": "" }, { "docid": "fda9afa5f3576c448768033c79e5d2e7", "score": "0.6060022", "text": "func (a *adapter) Recv(msg *pb.Event) (bool, error) {\n\tif o, e := msg.Event.(*pb.Event_Block); e {\n\t\ta.notfy <- o\n\t\treturn true, nil\n\t}\n\tif o, e := msg.Event.(*pb.Event_Rejection); e {\n\t\tif a.listenToRejections {\n\t\t\ta.rejected <- o\n\t\t}\n\t\treturn true, nil\n\t}\n\tif o, e := msg.Event.(*pb.Event_ChaincodeEvent); e {\n\t\ta.cEvent <- o\n\t\treturn true, nil\n\t}\n\treturn false, fmt.Errorf(\"Receive unkown type event: %v\", msg)\n}", "title": "" }, { "docid": "b0ffcab044422ec77773d4d7a5c60cb5", "score": "0.60599536", "text": "func (mr *MockLogCheck_CheckServerMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockLogCheck_CheckServer)(nil).Recv))\n}", "title": "" }, { "docid": "6fe95ea6cc126c81fd8b29158dcf5d38", "score": "0.6046135", "text": "func (m *MockOperator_PushFileClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2dd7c3a30401e5bf7d862d1c7f9037c9", "score": "0.60426915", "text": "func (m_2 *MockDiscoveryService_EstablishStreamClient) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7fb945d27416d60e987c59faf3564e72", "score": "0.6040101", "text": "func (a *DefaultAdapter) Recv(msg *peer.Event) (bool, error) {\n\tif o, e := msg.Event.(*peer.Event_Block); e {\n\t\ta.Notify <- o\n\t\treturn true, nil\n\t}\n\treturn false, fmt.Errorf(\"Receive unkown type event: %v\", msg)\n}", "title": "" }, { "docid": "7e312c7da3686ce37211f622e9f15c4f", "score": "0.60399854", "text": "func (_m *MockCollectionConfigService_WaitForProbeConfigServer) RecvMsg(m interface{}) error {\n\tret := _m.Called(m)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interface{}) error); ok {\n\t\tr0 = rf(m)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "549e15f38c4475bddf531f7c133d50a0", "score": "0.6032354", "text": "func (mr *MockprotoClientMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockprotoClient)(nil).Recv))\n}", "title": "" }, { "docid": "11dbb654a73da8f99df52d916c5eb727", "score": "0.60199887", "text": "func (m *MockCliToHub_ExecuteClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ea23001a79b7543e57f39feab1db0c42", "score": "0.6018854", "text": "func (d Before) AssertNoRecv(t TestingT, ch interface{}, msgAndArgs ...interface{}) interface{} {\n\tt.Helper()\n\tv, ok := d.assertRecv(t, ch)\n\tif !ok {\n\t\treturn nil\n\t}\n\tt.Fatal(defaultOrCustomMessage(\"unexpected channel receive\", msgAndArgs...))\n\treturn v\n}", "title": "" }, { "docid": "b59d816c917267ba4a9b079e96c814d4", "score": "0.6018748", "text": "func (m *MockProducts_SetAttributeDatasClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "eee6642527c89820ac680568fe0a2eee", "score": "0.60171586", "text": "func (mr *MockPeerPacketStreamMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockPeerPacketStream)(nil).Recv))\n}", "title": "" }, { "docid": "da48676e8976bd9a5fc7b382519a06dd", "score": "0.6012036", "text": "func (w *wrappedServerStream) RecvMsg(m interface{}) error {\n\treturn w.recvMsgDispatch.Stream(m)\n}", "title": "" }, { "docid": "d2f3aba6e95a239c02b90226d476e770", "score": "0.6003381", "text": "func (_m *Starfriends_ListStarshipActionsServer) RecvMsg(m interface{}) error {\n\tret := _m.Called(m)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interface{}) error); ok {\n\t\tr0 = rf(m)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "dc0ddef65bb8adc9a0777ea7c4f2ea16", "score": "0.6003371", "text": "func (m *MockHealth_HealthStreamClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8517fbbb8bc4d17357cce313821a7ec5", "score": "0.5998557", "text": "func (m *MockUserManagementApi_StreamUsersClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "46e9f8b98d1b3118fa95f189df4cb961", "score": "0.5996822", "text": "func (m *MockHealth_HealthStreamServer) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0978c52f70c4f277ce321cabe637d66f", "score": "0.5996793", "text": "func (b *Bot) MsgRecieved(client *irc.Client, inMsg irc.Msg) {\n\tif inMsg.User == \"\" {\n\t\treturn\n\t}\n\n\tmsg := b.buildMessage(client, inMsg)\n\n\tif strings.HasPrefix(msg.Body, \"help\") && msg.Command {\n\t\tparts := strings.Fields(strings.ToLower(msg.Body))\n\t\tb.checkHelp(msg.Channel, parts)\n\t\tgoto RET\n\t}\n\n\tfor _, name := range b.PluginOrdering {\n\t\tp := b.Plugins[name]\n\t\tif p.Message(msg) {\n\t\t\tbreak\n\t\t}\n\t}\n\nRET:\n\tb.logIn <- msg\n\treturn\n}", "title": "" }, { "docid": "56cde4d3c6aa545c409c99edec10d6f2", "score": "0.59903663", "text": "func (m_2 *MockLogCheck_CheckClient) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3fbaa95570e8d2ed4de2e7ee7c58d960", "score": "0.5988396", "text": "func (m *MockProducts_PredictCategoryClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d5c47fbabc066a7fca2284cebd2754dc", "score": "0.59867376", "text": "func (m *MockProcessor_RegisterStreamProcessClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "44b7b780816bd552c3a8a20c16fcf7bf", "score": "0.5986671", "text": "func (*pushSocket) Recv() (Msg, error) {\n\treturn Msg{}, fmt.Errorf(\"zmq4: PUSH sockets can't recv messages\")\n}", "title": "" }, { "docid": "29e4f72638b4297b3af9478789a3e362", "score": "0.59839815", "text": "func (mr *MockNumbers_FindMaxNumberClientMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockNumbers_FindMaxNumberClient)(nil).Recv))\n}", "title": "" }, { "docid": "0229d83200c845039e4b24bfd5c645e3", "score": "0.5982172", "text": "func (mr *MockFederation_EventStreamClientMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockFederation_EventStreamClient)(nil).Recv))\n}", "title": "" }, { "docid": "fbb6ffe625a15ef09af1b94aa9a44dfb", "score": "0.59741366", "text": "func (mr *MockHealth_HealthStreamServerMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockHealth_HealthStreamServer)(nil).Recv))\n}", "title": "" }, { "docid": "445089f5af26f12e50dc77c9582991a8", "score": "0.5972251", "text": "func (m_2 *MockLogCheck_CheckServer) RecvMsg(m interface{}) error {\n\tm_2.ctrl.T.Helper()\n\tret := m_2.ctrl.Call(m_2, \"RecvMsg\", m)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b48323f2e2d3b672206473f7aaf2a21c", "score": "0.5963973", "text": "func RecvMsg(conn golib.Conn, data []byte) {\n\tjstack.log.LogDebug(conn, \"Recv[Raw]: %s\", string(data))\n\tjsip, err := jstack.jsipUnParser(data)\n\tif err != nil {\n\t\tjstack.log.LogError(conn, \"jsipUnParser err %s\", err)\n\t\treturn\n\t}\n\n\tjsip.conn = conn\n\n\tjstack.recvq_t <- jsip\n}", "title": "" }, { "docid": "31a00d0867946161d96a298131d7f747", "score": "0.5952414", "text": "func (mr *MockAlert_RequestReplyServerMockRecorder) Recv() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockAlert_RequestReplyServer)(nil).Recv))\n}", "title": "" }, { "docid": "8d6ee548a379fe7ebcf12a29ee627c37", "score": "0.5946886", "text": "func (mr *MockProcessor_RequestNotificationClientMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockProcessor_RequestNotificationClient)(nil).Recv))\n}", "title": "" }, { "docid": "1c46c9b6556930050951ace8382f9211", "score": "0.5940172", "text": "func (mr *MockHealth_HealthStreamClientMockRecorder) Recv() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Recv\", reflect.TypeOf((*MockHealth_HealthStreamClient)(nil).Recv))\n}", "title": "" }, { "docid": "de1d9c8a0141450460a36a45c088f3a3", "score": "0.5930398", "text": "func (m *MockFederation_EventStreamClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "50e181c548736b899603f45c22e99dc4", "score": "0.59292835", "text": "func (m *MockBlobService_PushServer) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "62ca0654d9f422784f18eb8b80461bf5", "score": "0.59290326", "text": "func (m *MockBlobService_PushClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1b1f45c6af6d34d0f15ca58443cdf4cf", "score": "0.5928424", "text": "func (op *obcClassic) RecvMsg(ocMsg *pb.Message, senderHandle *pb.PeerID) error {\n\tif ocMsg.Type == pb.Message_CHAIN_TRANSACTION {\n\t\tlogger.Info(\"New consensus request received\")\n\n\t\treq := &Request{Payload: ocMsg.Payload, ReplicaId: op.pbft.id}\n\t\tpbftMsg := &Message{&Message_Request{req}}\n\t\tpackedPbftMsg, _ := proto.Marshal(pbftMsg)\n\t\top.broadcast(packedPbftMsg)\n\t\top.pbft.request(ocMsg.Payload, op.pbft.id)\n\n\t\treturn nil\n\t}\n\n\tif ocMsg.Type != pb.Message_CONSENSUS {\n\t\treturn fmt.Errorf(\"Unexpected message type: %s\", ocMsg.Type)\n\t}\n\n\tsenderID, err := getValidatorID(senderHandle)\n\tif err != nil {\n\t\tpanic(\"Cannot map sender's PeerID to a valid replica ID\")\n\t}\n\n\top.pbft.receive(ocMsg.Payload, senderID)\n\n\treturn nil\n}", "title": "" }, { "docid": "56cfe512b0db5445c685dca9378ec916", "score": "0.5919323", "text": "func (m *MockMeterReportService_CollectBatchClient) RecvMsg(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RecvMsg\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" } ]
c8ce4cbb654ad582dc91980459909381
Hours returns the number of hours on a clock
[ { "docid": "5007688f27c34d9b65d11d7479933f07", "score": "0.80217904", "text": "func (c Clock) Hours() int {\n\treturn int(c) / 60\n}", "title": "" } ]
[ { "docid": "18b6fc78f1c092aa436964ac3e29946d", "score": "0.8336988", "text": "func (c Clock) hours() int {\n\treturn (c.m / 60) - (c.m / (60 * 24))\n}", "title": "" }, { "docid": "2d95a62939fdf310f94f5523aff640a2", "score": "0.7183502", "text": "func hours(unix int64) int {\n\treturn int(unix / 60 / 60)\n}", "title": "" }, { "docid": "2985887e635e49ac157dd8347c9e7257", "score": "0.7056149", "text": "func (su SkyUtxo) GetHours() uint64 {\n\treturn su.Hours\n}", "title": "" }, { "docid": "bc9fdd1a8117718b6f49654fb90b2765", "score": "0.68837947", "text": "func (period Period) Hours() int {\n\treturn int(period.HoursFloat())\n}", "title": "" }, { "docid": "d63abf3161fef512bb526c604ab641ef", "score": "0.6825487", "text": "func (o TransferJobScheduleStartTimeOfDayOutput) Hours() pulumi.IntOutput {\n\treturn o.ApplyT(func(v TransferJobScheduleStartTimeOfDay) int { return v.Hours }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "5678e0f31b3ee4287d1103736fe690f0", "score": "0.6810269", "text": "func GetHours(hours int) int {\n\thr, _ := GetRemainderQuotient(hours, MaxHours)\n\n\treturn CheckHours(hr)\n}", "title": "" }, { "docid": "9a3424fb71c6aa4ca70cd0f7c712951d", "score": "0.6706014", "text": "func (timestamp *OTimestamp) Hours() int {\n\treturn timestamp.dateTime.Hour()\n}", "title": "" }, { "docid": "2e064748f60380ffdb758c184a573a66", "score": "0.6688564", "text": "func (e Energy) HectowattHours() float64 {\n\treturn float64(e / HectowattHour)\n}", "title": "" }, { "docid": "4632edcbbb521e2841b446270152291d", "score": "0.65513414", "text": "func (o TransferJobScheduleStartTimeOfDayPtrOutput) Hours() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *TransferJobScheduleStartTimeOfDay) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Hours\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "1525db2a711cdaf0350fafe5f811d433", "score": "0.6533403", "text": "func HoursDiff(timeFrom time.Time, timeTo time.Time) int {\n\td := timeTo.Sub(timeFrom)\n\tdv := d.Hours()\n\thr := int(dv)\n\treturn hr\n}", "title": "" }, { "docid": "091d23c6cb3a1f87a76604a802abffec", "score": "0.64154845", "text": "func (e Energy) PicowattHours() float64 {\n\treturn float64(e / PicowattHour)\n}", "title": "" }, { "docid": "02ce1d83d5f9dccc63f97967e234f137", "score": "0.6356881", "text": "func (e Energy) DeciwattHours() float64 {\n\treturn float64(e / DeciwattHour)\n}", "title": "" }, { "docid": "092f41fe8d170dc6019adc21679485df", "score": "0.6345769", "text": "func CheckHours(hours int) int {\n\tif hours == MaxHours {\n\t\treturn 0\n\t}\n\n\thr, _ := GetRemainderQuotient(hours, MaxHours)\n\n\tif hr < 0 {\n\t\treturn MaxHours - Abs(hours)\n\t}\n\n\treturn hr\n}", "title": "" }, { "docid": "87795bab69ef1d7b6c79b1d85c3988b2", "score": "0.63100404", "text": "func (e Energy) CentiwattHours() float64 {\n\treturn float64(e / CentiwattHour)\n}", "title": "" }, { "docid": "167652e9831e30b8d6aacdeb984ef740", "score": "0.6278892", "text": "func (o *InlineResponse20023InvoiceLineItems) GetHours() string {\n\tif o == nil || o.Hours == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Hours\n}", "title": "" }, { "docid": "41b15118e3f5eea91eca3ec378e81699", "score": "0.6244689", "text": "func (e Energy) YoctowattHours() float64 {\n\treturn float64(e / YoctowattHour)\n}", "title": "" }, { "docid": "35d1f9858d335b33d726ad47aca944de", "score": "0.6240789", "text": "func (e Energy) AttowattHours() float64 {\n\treturn float64(e / AttowattHour)\n}", "title": "" }, { "docid": "72fea58ddd20e3e525a860c0580d868e", "score": "0.62052035", "text": "func getHourNumber() int {\n\treturn time.Now().UTC().Hour()\n}", "title": "" }, { "docid": "c1f26d4a93d7eced8de4b9b0add71bb0", "score": "0.6199486", "text": "func (e Energy) ZeptowattHours() float64 {\n\treturn float64(e / ZeptowattHour)\n}", "title": "" }, { "docid": "04c88fa76dc5ac10318b6df6d327a5a1", "score": "0.6155158", "text": "func (d Duration) Hours() float64 {\n\thour := d / Hour\n\tnsec := d % Hour\n\treturn float64(hour) + float64(nsec)*(1e-9/60/60)\n}", "title": "" }, { "docid": "f77bde6d14599c013bd98eb9f996e4b2", "score": "0.6141253", "text": "func (e Energy) PetawattHours() float64 {\n\treturn float64(e / PetawattHour)\n}", "title": "" }, { "docid": "e9b35547a4747e57c114c4a926c04d3f", "score": "0.61178195", "text": "func (t CoreTime) Hour() int {\n\treturn int(t.getHour())\n}", "title": "" }, { "docid": "4d422bda0d21d2f8ffcee16f83dc410c", "score": "0.6112599", "text": "func (e Energy) DecawattHours() float64 {\n\treturn float64(e / DecawattHour)\n}", "title": "" }, { "docid": "808d2cde2e95d0ad5c6e4dc31b392170", "score": "0.6100953", "text": "func (user *User) AccessHours(when time.Time) (from, to time.Time) {\n\tsunrise := astrotime.CalcSunrise(when, LATITUDE, LONGITUDE)\n\tloc, err := time.LoadLocation(\"Local\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tzeroHour := time.Date(when.Year(), when.Month(), when.Day(), 0, 0, 0, 0, loc)\n\tmidnight := zeroHour.Add(24 * time.Hour)\n\ttwentyTwoHour := zeroHour.Add(22 * time.Hour)\n\n\tswitch user.UserLevel {\n\tcase LevelMember:\n\t\treturn zeroHour, midnight // all access\n\tcase LevelFulltimeUser:\n\t\treturn sunrise, midnight // sunrise .. 23:59\n\tcase LevelUser:\n\t\treturn sunrise.Add(3 * time.Hour), twentyTwoHour // sunrise+3 .. 21:59\n\t}\n\t// TODO: for time-restricted users such as users for classes,\n\t// we can have custom hours here.\n\n\treturn zeroHour, zeroHour // no access.\n}", "title": "" }, { "docid": "737f5b8d939012928fa7a5fa87e0e519", "score": "0.60930914", "text": "func (e *every) Hours() *every {\n\te.t = tHour\n\treturn e\n}", "title": "" }, { "docid": "7e376939144f947de4addb14b0ebee88", "score": "0.60544944", "text": "func (e Energy) KilowattHours() float64 {\n\treturn float64(e / KilowattHour)\n}", "title": "" }, { "docid": "82b7e6b58d04e5ec1120ed4542966660", "score": "0.60486144", "text": "func (e Energy) WattHours() float64 {\n\treturn float64(e / WattHour)\n}", "title": "" }, { "docid": "59869299594dace884cfa2379d004c39", "score": "0.60214555", "text": "func (o *EarningsTotal) GetHours() float32 {\n\tif o == nil || o.Hours.Get() == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\treturn *o.Hours.Get()\n}", "title": "" }, { "docid": "c3de1610987b264ba2dc77cd6a2e62eb", "score": "0.5973243", "text": "func (e Energy) TerawattHours() float64 {\n\treturn float64(e / TerawattHour)\n}", "title": "" }, { "docid": "5853fa202ff9e80b039961f136ddcb19", "score": "0.5918909", "text": "func (e Energy) GigawattHours() float64 {\n\treturn float64(e / GigawattHour)\n}", "title": "" }, { "docid": "b24c740349c2fd9936efb1ccd7b33db1", "score": "0.59140426", "text": "func (itm ScheduleItem) Hour() string {\n\th := itm.OffsetFromMidnight / (60 * 60)\n\treturn fmt.Sprintf(\"%.2d\", h)\n}", "title": "" }, { "docid": "951aec0620cadf0ca0eaf107da5a0fa8", "score": "0.58857167", "text": "func (e Energy) ExawattHours() float64 {\n\treturn float64(e / ExawattHour)\n}", "title": "" }, { "docid": "258458b004181d3acf4eb85e3eb9cf34", "score": "0.5858648", "text": "func (e Energy) ZettawattHours() float64 {\n\treturn float64(e / ZettawattHour)\n}", "title": "" }, { "docid": "fc8e569d68d88daef0b5974f87cd3a14", "score": "0.58558095", "text": "func (lc *localeData) perH(t time.Time) string {\n\treturn fmt.Sprintf(\"%02d\", t.Hour())\n}", "title": "" }, { "docid": "d3fcf71fdffa90b8cb093528cb5e35e8", "score": "0.58519006", "text": "func (period Period) HoursFloat() float32 {\n\treturn float32(period.hours) / 10\n}", "title": "" }, { "docid": "e88824e007bccb50c962d26ce01edd82", "score": "0.58360523", "text": "func (e Energy) NanowattHours() float64 {\n\treturn float64(e / NanowattHour)\n}", "title": "" }, { "docid": "bf5bdc022dc483dd96c0f64fb7be7b68", "score": "0.5810674", "text": "func (e Energy) MegawattHours() float64 {\n\treturn float64(e / MegawattHour)\n}", "title": "" }, { "docid": "95bdc1b4deeab5829e09a0c82048f9e5", "score": "0.5790228", "text": "func (o *ViewWorkingHourEntry) GetTaskHours() float32 {\n\tif o == nil || o.TaskHours == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\treturn *o.TaskHours\n}", "title": "" }, { "docid": "f7a4b7ef0947f4fce2544aeba23457f1", "score": "0.57259065", "text": "func (e Energy) MilliwattHours() float64 {\n\treturn float64(e / MilliwattHour)\n}", "title": "" }, { "docid": "eaaeec4b217195a0d6072b5298c6778b", "score": "0.5683349", "text": "func (i InternationalColorTime) Hour() Color {\n\treturn i.hour\n}", "title": "" }, { "docid": "e786712d86e21a6edf4296e715a7da59", "score": "0.5643236", "text": "func (o *InlineResponse20023InvoiceLineItems) GetHoursOk() (*string, bool) {\n\tif o == nil || o.Hours == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Hours, true\n}", "title": "" }, { "docid": "b17b80de48170eb4b000a48df3ca725d", "score": "0.5629458", "text": "func DiffHours(loc *time.Location, payload modelDomain.Domain) float64 {\n\tt1 := time.Date(time.Now().Year(),\n\t\ttime.Now().Month(),\n\t\ttime.Now().Day(),\n\t\ttime.Now().Hour(),\n\t\t0, 0, 0, loc)\n\n\tt2 := time.Date(payload.LastConsultation.Year(),\n\t\tpayload.LastConsultation.Month(),\n\t\tpayload.LastConsultation.Day(),\n\t\tpayload.LastConsultation.Hour(),\n\t\t0, 0, 0, loc)\n\n\treturn t1.Sub(t2).Hours()\n}", "title": "" }, { "docid": "782b9e2c0013d9b24ddb172844027fda", "score": "0.5626215", "text": "func (e Energy) YottawattHours() float64 {\n\treturn float64(e / YottawattHour)\n}", "title": "" }, { "docid": "18f70834a00258b0b21f2ba85b499236", "score": "0.5586157", "text": "func (t Time) Hour() Hour {\n\treturn Hour(t >> _TIME_OFFSET_HOUR) & _TIME_MASK_HOUR\n}", "title": "" }, { "docid": "bbd33a82f11d0ea48409f96988b77ef9", "score": "0.5558453", "text": "func MinuteHourOfTheDay(minuteOfTheDay int16) int8 { return int8(minuteOfTheDay / 60) }", "title": "" }, { "docid": "4eeeb8b0605f67b825f38b09dc102e19", "score": "0.55152005", "text": "func (recv *DateTime) GetHour() int32 {\n\tretC := C.g_date_time_get_hour((*C.GDateTime)(recv.native))\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "575a3fe595a665d67d5882559c466d01", "score": "0.54972535", "text": "func (e Energy) FemtowattHours() float64 {\n\treturn float64(e / FemtowattHour)\n}", "title": "" }, { "docid": "c53f4296238a9b9c4449eb83f92d6569", "score": "0.5489891", "text": "func (o *InlineResponse20023InvoiceLineItems) SetHours(v string) {\n\to.Hours = &v\n}", "title": "" }, { "docid": "8fbe9a2fa49053840c92e045b2f59a35", "score": "0.54664505", "text": "func getHour() string {\n\tnow := time.Now().UTC().Truncate(time.Hour)\n\treturn now.Format(time.RFC3339)\n}", "title": "" }, { "docid": "d15e600491c40144b2ffccad02431e44", "score": "0.54452455", "text": "func getHoursEnv(name string, defaultVal int) time.Duration {\n\tvalueStr := getEnv(name, \"\")\n\tif value, err := strconv.Atoi(valueStr); err == nil {\n\t\treturn time.Hour * time.Duration(value)\n\t}\n\n\treturn time.Hour * time.Duration(defaultVal)\n}", "title": "" }, { "docid": "2953f858d4937113983c5b4ad0f102f1", "score": "0.5434905", "text": "func (o *ViewWorkingHourEntry) GetTaskHoursOk() (*float32, bool) {\n\tif o == nil || o.TaskHours == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TaskHours, true\n}", "title": "" }, { "docid": "e8b2e72081b15d810af1dd547c12f390", "score": "0.5434664", "text": "func (i InternationalColorTime) Clock() (hour Color, min, sec int) {\n\treturn i.hour, i.Minute(), i.Second()\n}", "title": "" }, { "docid": "fc31d451b8c032695543473ac9f7fbf8", "score": "0.5418646", "text": "func (o *InlineResponse20023InvoiceLineItems) HasHours() bool {\n\tif o != nil && o.Hours != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dcf9c5836eccc51126b5120c54876601", "score": "0.53969437", "text": "func (m *Monkey) StartHour() int { return m.v.GetInt(param.StartHour) }", "title": "" }, { "docid": "f906ada4ee359f89c2eb1720527faaa6", "score": "0.5396562", "text": "func (c Clock) Minutes() int {\n\treturn int(c) % 60\n}", "title": "" }, { "docid": "d9a032fdd2620f2a5a0873d99de44f29", "score": "0.53622323", "text": "func hoursBCDToInt(value uint8) (hour int) {\n\tif value&0x40 != 0x00 {\n\t\thour = bcdToInt(value & 0x1F)\n\t\tif (value & 0x20) != 0x00 {\n\t\t\thour += 12\n\t\t}\n\t} else {\n\t\thour = bcdToInt(value)\n\t}\n\treturn\n}", "title": "" }, { "docid": "294b9c216fec8b4de9c1adde0ea10e38", "score": "0.53544253", "text": "func TimeSubHour(t1, t2 time.Time) int {\n\tt1 = time.Date(t1.Year(), t1.Month(), t1.Day(), t1.Hour(), 0, 0, 0, time.Local)\n\tt2 = time.Date(t2.Year(), t2.Month(), t2.Day(), t2.Hour(), 0, 0, 0, time.Local)\n\treturn int(t1.Sub(t2).Hours())\n}", "title": "" }, { "docid": "a6343d852360f8e05b30b29be7cc2d18", "score": "0.535365", "text": "func (o VmUptimeOutput) HoursPerDay() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v VmUptime) *float64 { return v.HoursPerDay }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "a847583426aa98243dff92a020396807", "score": "0.5346845", "text": "func DaysHour(input string) (computedTime time.Time) {\n\tvar day int\n\tvar timeString string\n\tfmt.Sscanf(input, \"%d %s\", &day, &timeString)\n\tparsedHourMin, _ := time.Parse(time.Kitchen, timeString)\n\tyear, month, _ := time.Now().Date()\n\treturn time.Date(year, month, day, parsedHourMin.Hour(), parsedHourMin.Minute(), 0, 0, time.UTC)\n}", "title": "" }, { "docid": "2bb2ed7f6022ca5c1cdc458a5dbb54ca", "score": "0.53445506", "text": "func (o *UsageRumSessionsHour) GetHour() time.Time {\n\tif o == nil || o.Hour == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.Hour\n}", "title": "" }, { "docid": "31dffc108f91f6e73bef61093c30e596", "score": "0.5340779", "text": "func (o *EarningsTotal) GetHoursOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Hours.Get(), o.Hours.IsSet()\n}", "title": "" }, { "docid": "0acfe0f5e2ba945f13b5e0899773aa6b", "score": "0.5328477", "text": "func (s *stack) Count(unit string) int {\n\tswitch unit {\n\tcase \"hour\":\n\t\treturn len(s.s) + 1\n\tdefault:\n\t\treturn len(s.s)\n\t}\n}", "title": "" }, { "docid": "7eb48622d3f87cbb4b184ce804536654", "score": "0.53263485", "text": "func sunHourAngle(hour int) int{\n\treturn 0\n}", "title": "" }, { "docid": "f85ec611c3df6615eb3acee7fba582e4", "score": "0.53054696", "text": "func HitsPerHour(options ...Option) iris.Handler {\n\topts := applyOptions(options)\n\n\tif opts.MetricName == \"\" {\n\t\topts.MetricName = \"hits_per_hour\"\n\t}\n\n\topts.AvgDiv = 24\n\n\treturn hits(time.Hour, opts)\n}", "title": "" }, { "docid": "5a4b07328477a745bf36f006144ffe7f", "score": "0.5302943", "text": "func (o *InlineResponse200113Timezones) GetOffsetHours() string {\n\tif o == nil || o.OffsetHours == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.OffsetHours\n}", "title": "" }, { "docid": "57cd7fbf8a13b79fcc8c5fc9d4f629f1", "score": "0.5296393", "text": "func HoursByJSON(data []byte) (Hours, error) {\n\tvar (\n\t\ttimetable timetableJSON\n\t\terr = json.Unmarshal(data, &timetable)\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn timetable.ToHours(), nil\n}", "title": "" }, { "docid": "a56c732bc7cd148e9045e42d4afebb2f", "score": "0.52425236", "text": "func (clock Clock) CurrentHour() int {\n\treturn (clock.seconds / (MinutesInAnHour * SecondsInAMinute)) % HoursInADay\n}", "title": "" }, { "docid": "d43272ccc8c9c5962c27478ec5016438", "score": "0.5237126", "text": "func RoundPartOfHour(n int) time.Time { return findPartMin(time.Now(), n) }", "title": "" }, { "docid": "9cefde6210bb37c549962e207952c771", "score": "0.52363986", "text": "func (o MaintenanceWindowResponseOutput) HourOfDay() pulumi.IntOutput {\n\treturn o.ApplyT(func(v MaintenanceWindowResponse) int { return v.HourOfDay }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "cba5c63baeaf20b57112af712dbc3398", "score": "0.52316934", "text": "func (r Account) CountHourlyInstances() (resp int, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Account\", \"countHourlyInstances\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "769bdf70c283b3ad698350acb5fb3220", "score": "0.52007216", "text": "func (lc *localeData) perI(t time.Time) string {\n\thr := t.Hour() % 12\n\tif hr == 0 {\n\t\thr = 12\n\t}\n\n\treturn fmt.Sprintf(\"%02d\", hr)\n}", "title": "" }, { "docid": "3853d345b8276a94c58339c166fbfd11", "score": "0.515167", "text": "func minutes(hour, min int) int {\n\treturn 60*hour + min\n}", "title": "" }, { "docid": "b70e5c98cc62afbc32564e9993c0e77c", "score": "0.5145325", "text": "func (o *InlineResponse20023InvoiceLineItems) GetDecimalHours() string {\n\tif o == nil || o.DecimalHours == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DecimalHours\n}", "title": "" }, { "docid": "ebf0ed1b819ccd070633e4301509aac2", "score": "0.514067", "text": "func (c Clock) minutes() int {\n\treturn c.m - (c.hours() * 60)\n}", "title": "" }, { "docid": "78f787f498530c09809e90841555623a", "score": "0.5126192", "text": "func (o *EarningsTotal) HasHours() bool {\n\tif o != nil && o.Hours.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6ab73242e96fa78524b4bc7ab2079f2b", "score": "0.5116148", "text": "func (r *Room) activeHours() bool {\n\tif r.StartTime == 0 && r.StopTime == 0 {\n\t\treturn true\n\t}\n\n\tt := time.Now()\n\tnow := time.Hour*time.Duration(t.Hour()) + time.Minute*time.Duration(t.Minute())\n\n\tif now > r.StartTime && now < r.StopTime {\n\t\tlog.Debugf(\"inside active hours for the next %v\", r.StopTime-now)\n\t\treturn true\n\t}\n\tlog.Debugf(\"outside active hours for the next %v\", r.StartTime+time.Hour*24-now)\n\treturn false\n}", "title": "" }, { "docid": "9a71dbb64e2ef87a8152b23107bb522b", "score": "0.51127744", "text": "func (o VmUptimeResponseOutput) HoursPerDay() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v VmUptimeResponse) *float64 { return v.HoursPerDay }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "bba8001b8de056f5fd26da0dc2c0e314", "score": "0.5112293", "text": "func (o VmUptimePtrOutput) HoursPerDay() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *VmUptime) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HoursPerDay\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "b2c961160bd48c38c6975305bc1db5b0", "score": "0.5105059", "text": "func HourTicker(hour uint, tilStart time.Duration, update chan uint, quit chan bool) {\n\tlog.Println(\"waiting until \", time.Now().Add(tilStart).Format(\"3:04PM\"))\n\ttime.AfterFunc(tilStart, func() {\n\t\ttick := time.NewTicker(time.Hour).C\n\t\tupdate <- hour\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-tick:\n\t\t\t\thour++\n\t\t\t\tupdate <- hour\n\t\t\tcase <-quit:\n\t\t\t\tlog.Println(\"stop counting hours\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b627d7a72fa5b599aa03112590bc2a7c", "score": "0.50983614", "text": "func (h *HourNode) Count(s Search) int {\n\tif !s.Minute.Valid {\n\t\treturn len(h.Hits)\n\t}\n\n\tvar ret int\n\tif m := h.Minutes[s.Minute.Int]; m != nil {\n\t\tret = m.Count(s)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "45f6fc36e2ab23c453b45308dffe5ba2", "score": "0.5086112", "text": "func (o *ViewWorkingHourEntry) HasTaskHours() bool {\n\tif o != nil && o.TaskHours != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f3c36c1de3cf622ee5fe465d3edf435a", "score": "0.5082783", "text": "func getTime() int {\n\tt := time.Now()\n\treturn t.Hour() * 3600 + t.Minute() * 60 + t.Second()\n}", "title": "" }, { "docid": "a6a443c91097a44c28551b0d33fd01b3", "score": "0.50725055", "text": "func getTimeHash(scheduledTime time.Time) int64 {\n\treturn scheduledTime.Unix()\n}", "title": "" }, { "docid": "2d5d5eaa2041b6199b5274a6b20e6414", "score": "0.50299466", "text": "func (o *EarningsTotal) SetHours(v float32) {\n\to.Hours.Set(&v)\n}", "title": "" }, { "docid": "ff22e01afe43ae125e5d535d6c9956c1", "score": "0.5018502", "text": "func (o *InlineResponse20023InvoiceLineItems) GetDecimalHoursOk() (*string, bool) {\n\tif o == nil || o.DecimalHours == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DecimalHours, true\n}", "title": "" }, { "docid": "4667bfc58b6f5f800df194a25142a68a", "score": "0.5008306", "text": "func (b *builtinHourSig) evalInt(row chunk.Row) (int64, bool, error) {\n\ttrace_util_0.Count(_builtin_time_00000, 165)\n\tdur, isNull, err := b.args[0].EvalDuration(b.ctx, row)\n\t// ignore error and return NULL\n\tif isNull || err != nil {\n\t\ttrace_util_0.Count(_builtin_time_00000, 167)\n\t\treturn 0, true, nil\n\t}\n\ttrace_util_0.Count(_builtin_time_00000, 166)\n\treturn int64(dur.Hour()), false, nil\n}", "title": "" }, { "docid": "62ad14113a2e07be796e9ba9a14d1004", "score": "0.5007632", "text": "func (o MaintenanceWindowOutput) HourOfDay() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v MaintenanceWindow) *int { return v.HourOfDay }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "75fc54ddb917e9520dc64630dd1c7083", "score": "0.49859214", "text": "func (o *InlineResponse20023InvoiceLineItems) HasDecimalHours() bool {\n\tif o != nil && o.DecimalHours != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "29b75bde6ad33c80ac3cdfe25491b620", "score": "0.49759787", "text": "func FormatPlaybackDurationHours(t time.Duration) string {\n\thours := t.Truncate(time.Hour)\n\tt -= hours\n\tminutes := t.Truncate(time.Minute)\n\tseconds := t - minutes\n\n\treturn fmt.Sprintf(\"%.2d:%.2d:%.2d\",\n\t\thours/time.Hour, minutes/time.Minute, seconds/time.Second)\n}", "title": "" }, { "docid": "fb35b8770ab5f9fd0fd6a33a01796a6a", "score": "0.49651226", "text": "func (o MaintenanceWindowPtrOutput) HourOfDay() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *MaintenanceWindow) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HourOfDay\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "7cf655f06da43ec25e9ff7622ca829ad", "score": "0.4963753", "text": "func (q TimeQuantum) HasHour() bool { return strings.ContainsRune(string(q), 'H') }", "title": "" }, { "docid": "7cf655f06da43ec25e9ff7622ca829ad", "score": "0.4963753", "text": "func (q TimeQuantum) HasHour() bool { return strings.ContainsRune(string(q), 'H') }", "title": "" }, { "docid": "f3205c1426400e8d0b193d0907fc041a", "score": "0.4950282", "text": "func (o *UsageRumSessionsHour) GetHourOk() (*time.Time, bool) {\n\tif o == nil || o.Hour == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Hour, true\n}", "title": "" }, { "docid": "36e16c99f78bc2f91464d000f451d0f3", "score": "0.49320358", "text": "func findPartHour(now time.Time, num int) time.Time {\n\tvar hour int\n\n\tif num > now.Hour() || num > 12 || num <= 0 {\n\t\thour = 0\n\t} else {\n\t\thour = now.Hour() - (now.Hour() % num)\n\t}\n\n\treturn time.Date(now.Year(), now.Month(), now.Day(), hour, 0, 0, 0, time.UTC)\n}", "title": "" }, { "docid": "b67d735c248e2fd38b2c670c458f0727", "score": "0.49281284", "text": "func getDaysDiff(issuetime *time.Time) int {\n\tnow := time.Now().UTC()\n\tdiff := now.Sub(*issuetime)\n\tdays := int(diff.Hours() / 24)\n\treturn days\n}", "title": "" }, { "docid": "8fbd2100ff455e0c0b6f2364c25e892e", "score": "0.4912244", "text": "func (o VmUptimeResponsePtrOutput) HoursPerDay() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *VmUptimeResponse) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HoursPerDay\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "6276b105f215d809d4f4b779663b0a69", "score": "0.49111935", "text": "func drawtime(deck *generate.Deck, x, y, r float64, h, m, s int) {\n\tif (m > 59 || m < 0) || (s > 59 || s < 0) {\n\t\treturn\n\t}\n\tclock(deck, x, y, r)\n\tlinesize := r * 0.09\n\textrar := r / 4 // length of the line past the centerline\n\n\t// get angles for hour, minute, second\n\tha := hrangles[h%12]\n\tma := minangles[m]\n\tsa := minangles[s]\n\n\tif m > 30 { // if the minute is > 30, adjust the hour angle proportionally\n\t\tha = ha - (30.0 * float64(m) / 60.0)\n\t}\n\n\t// the hour, minute, and second hands are drawn in two parts.\n\t// part 1 is the line between the center point (x,y) and radius\n\t// part 2 is the extra line past the center whose angle is opposite the part 1 line.\n\n\t// hour line\n\thx, hy := polar(x, y, r*0.7, ha)\n\thx2, hy2 := polar(x, y, extrar, oppangle(ha))\n\tdeck.Line(x, y, hx, hy, linesize, \"gray\")\n\tdeck.Line(x, y, hx2, hy2, linesize, \"gray\")\n\n\t// minute line\n\tmx, my := polar(x, y, r*0.95, ma)\n\tmx2, my2 := polar(x, y, extrar, oppangle(ma))\n\tdeck.Line(x, y, mx, my, linesize, \"black\")\n\tdeck.Line(x, y, mx2, my2, linesize, \"black\")\n\n\t// second line -- includes dot at the end\n\tdotsize := r * 0.2\n\tslinesize := linesize * 0.275\n\tsx, sy := polar(x, y, (r*0.7)-dotsize/2, sa)\n\tsx2, sy2 := polar(x, y, extrar, oppangle(sa))\n\tcx, cy := polar(x, y, r*0.7, sa)\n\tdeck.Line(x, y, sx, sy, slinesize, \"red\")\n\tdeck.Line(x, y, sx2, sy2, slinesize, \"red\")\n\tdeck.Circle(cx, cy, dotsize, \"red\")\n}", "title": "" }, { "docid": "33782ccd2f0c2cf73f6c0fe8e053cdca", "score": "0.4899659", "text": "func New(hour, minute int) Clock {\n //for negative minutes , add 60 minutes and substract 1 \n for minute < 0 {\n minute += 60\n hour --\n } \n //for minutes , substract 60 minutes and add 1 \n for minute > 59 {\n minute -= 60\n hour++\n }\n \n //for negative hours, just make positive \n for hour < 0 {\n hour += 24 \n }\n hour = hour % 24\n \n return Clock {hour,minute}\n \n}", "title": "" }, { "docid": "bc669b752fd57c5ecb448824d512796e", "score": "0.48897412", "text": "func ConvertHoursToNano(hours int) int64 {\n\treturn int64(hours) * time.Hour.Nanoseconds()\n}", "title": "" }, { "docid": "6751ae00044c816dd1a518b47e99717c", "score": "0.4888612", "text": "func RoundPartOfDay(n int) time.Time { return findPartHour(time.Now(), n) }", "title": "" } ]
5d5b6d36b8594465d0e2a4d253bad878
Get read the properties and relationships of an educationUser object. [Find more info here] [Find more info here]:
[ { "docid": "4cc6310a55115ce91ff0d57719bbf2c5", "score": "0.5371278", "text": "func (m *UsersEducationUserItemRequestBuilder) Get(ctx context.Context, requestConfiguration *UsersEducationUserItemRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationUserable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, 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.CreateEducationUserFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationUserable), nil\n}", "title": "" } ]
[ { "docid": "541731d1eeca4559004ff885432c3f77", "score": "0.6343126", "text": "func (r *EducationUserRequest) Get(ctx context.Context) (resObj *EducationUser, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "title": "" }, { "docid": "21beb4988be433f9e99f32be78ecda71", "score": "0.59603906", "text": "func EducationGet(id int64) (Education, error) {\n\tvar education Education\n\tif id == 0 {\n\t\treturn education, nil\n\t}\n\teducation.ID = id\n\terr := pool.QueryRow(context.Background(), `\n\t\tSELECT\n\t\t\tcontact_id,\n\t\t\tstart_date,\n\t\t\tend_date,\n\t\t\tpost_id,\n\t\t\tnote,\n\t\t\tcreated_at,\n\t\t\tupdated_at\n\t\tFROM\n\t\t\teducations\n\t\tWHERE\n\t\t\tid = $1\n\t`, id).Scan(&education.ContactID, &education.StartDate, &education.EndDate, &education.PostID, &education.Note, &education.CreatedAt, &education.UpdatedAt)\n\tif err != nil {\n\t\terrmsg(\"EducationGet QueryRow\", err)\n\t}\n\treturn education, err\n}", "title": "" }, { "docid": "388fd04db328ee30216c93697eb15b38", "score": "0.564339", "text": "func (u *User) Read(fields ...string) error {\n\tif err := orm.NewOrm().Read(u, fields...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53a877ef7a75b45ce1266f5e1db14c0e", "score": "0.5639432", "text": "func(db *GraphPersistence) GetUserDetails(uid string) (User, error) {\n log.Debug(fmt.Sprintf(\"retreiving details for user %s...\", uid))\n // create new persitence session for graph and defer closing\n session := db.NewSession()\n defer session.Close()\n\n cfg := map[string]interface{}{\n \"uid\": uid,\n }\n // generate config metadata for query\n handler := func(tx neo4j.Transaction) (interface{}, error) {\n query := `MATCH (n:User{uid: $uid})\n RETURN n.uid, n.email, n.created, n.admin`\n result, err := tx.Run(query, cfg)\n if err != nil {\n return nil, err\n }\n // retrieve first instance of user node\n node, err := neo4j.Single(result, err)\n if err != nil {\n return nil, ErrUserDoesNotExist\n }\n return node, nil\n }\n // get all habits from graph using persistence session\n user, err := neo4j.AsRecord(session.ReadTransaction(handler))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to retrieve user details: %+v\", err))\n return User{}, err\n }\n return User{\n Uid: user.Values[0].(string),\n Email: user.Values[1].(string),\n Created: user.Values[2].(time.Time),\n Admin: user.Values[3].(bool),\n }, nil\n}", "title": "" }, { "docid": "1732ec276cbab5bdcd2bd4dee2dbb5b8", "score": "0.5624746", "text": "func (user *User) Details() UserDetails {\n\tswitch user.UserType {\n\t//case types.UserTypeNotVerified:\n\n\t//case UserTypeIndividual:\n\t//\tdetails := IndividualDetails{}\n\t//\n\t//\tbankDetails := entities.GetSingle(KYCEntityTypeBankDetails)\n\t//\tdetails.BankDetails.Populate(bankDetails)\n\t//\n\t//\tpersonalDetails := entities.GetSingle(KYCEntityTypePersonalDetails)\n\t//\tdetails.PersonalDetails.Populate(personalDetails)\n\t//\n\t//\temployment := entities.GetSingle(KYCEntityTypeEmploymentDetails)\n\t//\tdetails.EmploymentDetails.Populate(employment)\n\t//\n\t//\taddress := entities.GetSingle(KYCEntityTypeAddress)\n\t//\tdetails.Address.Populate(address)\n\t//\n\t//\treturn &details\n\t//case UserTypeJoint:\n\t//\tdetails := JointDetails{}\n\t//\n\t//\tidentityEntities := entities.Get(KYCEntityTypeJointIdentity)\n\t//\tdetails.Identities = map[int64]IdentityDetails{}\n\t//\tfor _, entity := range identityEntities {\n\t//\t\tentity := entity\n\t//\t\tidentity := IdentityDetails{}\n\t//\t\tidentity.Populate(&entity)\n\t//\t\tdetails.Identities[entity.ID] = identity\n\t//\t}\n\t//\n\t//\treturn &details\n\t//case UserTypeBusiness:\n\t//\tdetails := BusinessDetails{}\n\t//\n\t//\townerEntities := entities.Get(KYCEntityTypeBusinessOwner)\n\t//\tdetails.Owners = map[int64]BusinessPerson{}\n\t//\tfor _, entity := range ownerEntities {\n\t//\t\tentity := entity\n\t//\t\tperson := BusinessPerson{}\n\t//\t\tperson.Populate(&entity)\n\t//\t\tdetails.Owners[entity.ID] = person\n\t//\t}\n\t//\n\t//\tsignatoryEntites := entities.Get(KYCEntityTypeBusinessSignatory)\n\t//\tdetails.Signatories = map[int64]BusinessPerson{}\n\t//\tfor _, entity := range signatoryEntites {\n\t//\t\tentity := entity\n\t//\t\tperson := BusinessPerson{}\n\t//\t\tperson.Populate(&entity)\n\t//\t\tdetails.Signatories[entity.ID] = person\n\t//\t}\n\t//\n\t//\tentity := entities.GetSingle(KYCEntityTypeCorporationDetails)\n\t//\tdetails.CorporationDetails.Populate(entity)\n\t//\n\t//\tentity = entities.GetSingle(KYCEntityTypeRegisteredAddress)\n\t//\tdetails.RegisteredAddress.Populate(entity)\n\t//\n\t//\tentity = entities.GetSingle(KYCEntityTypeFinancialDetails)\n\t//\tdetails.FinancialDetails.Populate(entity)\n\t//\n\t//\tentity = entities.GetSingle(KYCEntityTypeCorrespondenceAddress)\n\t//\tdetails.CorrespondenceAddress.Populate(entity)\n\t//\n\t//\treturn &details\n\tdefault:\n\t\tpanic(\"unknown details user type\")\n\t}\n}", "title": "" }, { "docid": "fdaa7db3b7e5c94a9f5bed40e053438f", "score": "0.5514194", "text": "func (m *EducationRoot) GetUsers()([]EducationUserable) {\n val, err := m.GetBackingStore().Get(\"users\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]EducationUserable)\n }\n return nil\n}", "title": "" }, { "docid": "288508021e51afc23cbe1e211f24ba96", "score": "0.536296", "text": "func (m *UsersEducationUserItemRequestBuilder) Get(ctx context.Context, requestConfiguration *UsersEducationUserItemRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationUserable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, 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.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateEducationUserFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationUserable), nil\n}", "title": "" }, { "docid": "f263cdb756c4fab7df8c7fa814b8911b", "score": "0.53403693", "text": "func (u *UserInfoBuilder) Education(edu *Education) *UserInfoBuilder {\n\tu.userInfo.Education = edu\n\treturn u\n}", "title": "" }, { "docid": "f84de4d52a1f7e0de3b39ef0714588b3", "score": "0.53216344", "text": "func GetPropertyUser(user int, db *gorm.DB) []*Property {\r\n\tproperties := []*Property{}\r\n\tdb.Where(\"Property.user_id = ?\", user).Find(&properties)\r\n\treturn properties\r\n}", "title": "" }, { "docid": "1a9dadce77c86a565b16627dbce04dab", "score": "0.5302338", "text": "func (api *api) UserRead(userBody *UserGet) (*UserRead, error) {\n\n\turi := \"/v1/objects/user\"\n\trespBody, err := api.makeRequest(\"POST\", uri, \"user\", userBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar u UserRead\n\tif err = json.Unmarshal(respBody, &u); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &u, nil\n}", "title": "" }, { "docid": "af46a80d3cb5e6b229e7403ede3ac8d3", "score": "0.52735174", "text": "func(db *GraphPersistence) GetAllUsers() ([]User, error) {\n log.Debug(\"retreiving all users...\")\n users := []User{}\n\n // create new persitence session for graph and defer closing\n session := db.NewSession()\n defer session.Close()\n // generate config metadata for query\n handler := func(tx neo4j.Transaction) (interface{}, error) {\n query := `MATCH (n:User) \n RETURN n.uid, n.email, n.created, n.admin`\n return neo4j.Collect(tx.Run(query, nil))\n }\n // get all habits from graph using persistence session\n nodes, err := neo4j.AsRecords(session.ReadTransaction(handler))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to retrieve user details: %+v\", err))\n return users, err\n }\n for _, node := range(nodes) {\n users = append(users, User{\n Uid: node.Values[0].(string),\n Email: node.Values[1].(string),\n Created: node.Values[2].(time.Time),\n Admin: node.Values[3].(bool),\n })\n }\n return users, nil\n}", "title": "" }, { "docid": "9acb35320046ad1cfd17f99d226953f1", "score": "0.52666146", "text": "func ReadUser(objid bson.ObjectId) (*model.User, error) {\n\tuserCollection, session := userCollection()\n\tdefer session.Close()\n\n\tuser := &model.User{}\n\t// Read Data\n\terr := userCollection.FindId(objid).One(&user)\n\treturn user, err\n}", "title": "" }, { "docid": "eceb6fb0a8f4004038c5e4f3f4cebb75", "score": "0.5246281", "text": "func (state *UserState) Properties(username string) []string {\n\tprops, err := state.users.Keys(username)\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\treturn props\n}", "title": "" }, { "docid": "1f0583d88fc0179350e82ff5f6e1970d", "score": "0.521935", "text": "func getUser(storage Storage, email string) (User, error) {\n\tvar user User\n\n\t// open user reg\n\tuserData, err := storage.LoadUser(email)\n\tif err != nil {\n\t\tif _, ok := err.(ErrNotExist); ok {\n\t\t\t// create a new user\n\t\t\treturn newUser(email)\n\t\t}\n\t\treturn user, err\n\t}\n\n\t// load user information\n\terr = json.Unmarshal(userData.Reg, &user)\n\tif err != nil {\n\t\treturn user, err\n\t}\n\n\t// load their private key\n\tuser.key, err = loadPrivateKey(userData.Key)\n\treturn user, err\n}", "title": "" }, { "docid": "36ff1a627e4096ee8af93991f9b53536", "score": "0.5210486", "text": "func GetUserDetail(name string) (*swagger.User, error) {\n\tlog.Printf(\"call GetUserDetail:%s\", name)\n\tconf := config.GetConfig()\n\tif conf.Username != \"admin\" {\n\t\treturn &swagger.User{}, errors.New(\"only admin can get user.\")\n\t}\n\tharborClient := client.GetHarborClient()\n\n\tuser, err := getUser(harborClient, name, \"\")\n\tif err != nil {\n\t\treturn &swagger.User{}, err\n\t}\n\n\tlog.Printf(\"User:%#v\", user)\n\treturn user, nil\n}", "title": "" }, { "docid": "d2d8d22a076fd50cd6a6354c91951c42", "score": "0.5177253", "text": "func (m *EducationRoot) GetMe()(EducationUserable) {\n val, err := m.GetBackingStore().Get(\"me\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(EducationUserable)\n }\n return nil\n}", "title": "" }, { "docid": "500d6ad12687ec9ddee29f4fc0bac50d", "score": "0.51669914", "text": "func GetUser(id int, full bool) (User, error) {\r\n\tvar user User\r\n\r\n\tif full {\r\n\t\te := DB.Preload(clause.Associations).First(&user, \"id = ?\", id)\r\n\t\treturn user, e.Error\r\n\t}\r\n\r\n\te := DB.First(&user, \"id = ?\", id)\r\n\treturn user, e.Error\r\n}", "title": "" }, { "docid": "1abdd001c57d9bb858f575e0acedbb84", "score": "0.51231706", "text": "func Read(c user.UserServiceClient) {\n\tfmt.Println(\"Read schema: id\")\n\tvar id int32\n\n\tfmt.Scanf(\"%d\", &id)\n\n\tu, err := c.Read(context.Background(), &user.ReadRequest{Id: id})\n\tif err != nil {\n\t\terrors.Wrap(err, \"Unable to read user by id\")\n\t}\n\n\tfmt.Println(u)\n}", "title": "" }, { "docid": "0ed7a49223d4494d0a5d1ce1e5fdec16", "score": "0.5098139", "text": "func getUserApiModel() (*User, error) {\n\tdata, err := ioutil.ReadFile(\"user.json\")\n\tif err != nil {\n\t\tfmt.Println(\"File error\", err)\n\t\treturn nil, err\n\t}\n\tuserResponse := &UserResponse{}\n\terr = json.Unmarshal(data, userResponse)\n\tif err != nil {\n\t\tfmt.Println(\"Json error\", err)\n\t\treturn nil, err\n\t}\n\treturn userResponse.User, nil\n}", "title": "" }, { "docid": "ba84f9586f5d28a46d1b19adf6e4ad23", "score": "0.5085698", "text": "func (door *AccountStore) Read() (datatype.Account, error) {\n\tvar acc datatype.Account\n\n\t// TODO: Temporarily loads a static user file, eventually load from \"database\"\n\tjsonBytes, err := ioutil.ReadFile(\"../static/user.json\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn acc, err\n\t}\n\n\tif err := json.Unmarshal(jsonBytes, &acc); err != nil {\n\t\tlog.Print(err)\n\t\treturn acc, err\n\t}\n\n\tlog.Printf(\"The user is: %+v\\n\", acc)\n\treturn acc, nil\n}", "title": "" }, { "docid": "b31e8e73de0e7c2b8cddb2bcd68ca5f9", "score": "0.50633353", "text": "func (_Expertise *ExpertiseSession) Expertise(user common.Address) (struct {\n\tScore *big.Int\n\tLevel string\n\tRank string\n}, error) {\n\treturn _Expertise.Contract.Expertise(&_Expertise.CallOpts, user)\n}", "title": "" }, { "docid": "4a291057258faf82ea0d3fe5e23d328b", "score": "0.50524783", "text": "func education(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\ttokenString := r.Header.Get(\"Authorization\")\n\n\ttokenString = strings.TrimPrefix(tokenString, \"Bearer \")\n\tfmt.Println(\"token\", tokenString)\n\n\ttoken, _ := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {\n\t\t// Don't forget to validate the alg is what you expect:\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method\")\n\t\t}\n\t\treturn []byte(\"secret\"), nil\n\t})\n\t// var result database.User\n\tvar name, email string\n\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\tname = claims[\"name\"].(string)\n\t\temail = claims[\"email\"].(string)\n\t}\n\tfmt.Println(name, email)\n\tp := database.Finddb(cl, email)\n\tfmt.Println(p)\n\tif p.Name != \"\" {\n\t\tvar edu database.Education\n\t\tbody, _ := ioutil.ReadAll(r.Body)\n\t\terr := json.Unmarshal(body, &edu)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(`{\"error\": \"body not parsed\"}`))\n\t\t\treturn\n\t\t}\n\t\tok := database.Updateeducation(cl1, p.Email, edu)\n\t\tif ok {\n\t\t\tw.WriteHeader(http.StatusCreated)\n\t\t\tw.Write([]byte(`{\"success\": \"created\"}`))\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(`{\"error\": \"not created\"}`))\n\t}\n}", "title": "" }, { "docid": "15bdfb07ef6236848541bfd854fcf2c9", "score": "0.5019742", "text": "func (h Handler) GetUserProfile(c echo.Context) error {\n\tpaginator, err := paginate(c, \"name\")\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest,\n\t\t\tresponse.Exception{\n\t\t\t\tCode: errcode.ValidationError,\n\t\t\t\tError: errors.WithStack(err),\n\t\t\t})\n\t}\n\n\tusers, cursor, err := h.repository.User.Paginate(paginator)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError,\n\t\t\tresponse.Exception{\n\t\t\t\tCode: errcode.SystemError,\n\t\t\t\tError: errors.WithStack(err),\n\t\t\t})\n\t}\n\n\treturn c.JSON(http.StatusOK,\n\t\tresponse.Items{\n\t\t\tItems: funk.Map(users, func(user *model.User) *transformer.User {\n\t\t\t\treturn transformer.ToUser(user)\n\t\t\t}),\n\t\t\tCursor: cursor,\n\t\t})\n}", "title": "" }, { "docid": "910f9fc390f6c6018c48141df64edead", "score": "0.5017512", "text": "func (m *EducationRoot) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"classes\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateEducationClassFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]EducationClassable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(EducationClassable)\n }\n }\n m.SetClasses(res)\n }\n return nil\n }\n res[\"me\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateEducationUserFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMe(val.(EducationUserable))\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"schools\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateEducationSchoolFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]EducationSchoolable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(EducationSchoolable)\n }\n }\n m.SetSchools(res)\n }\n return nil\n }\n res[\"users\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateEducationUserFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]EducationUserable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(EducationUserable)\n }\n }\n m.SetUsers(res)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "dc0c73e665606da219216671e2b3ba7a", "score": "0.5004495", "text": "func (repo *PgUserRepository) GetUserProfileExpand(id int) (m.UserProfileExpand, error) {\n\tuser := m.UserProfileExpand{}\n\terr := repo.DB.Model(&user).\n\t\tColumnExpr(\"usr.id, usr.organization_id, usr.email, usr.role_id, rol.name as role_name\").\n\t\tColumnExpr(\"pro.avatar, pro.first_name, pro.last_name, pro.birthday, pro.rank, pro.job_title\").\n\t\tColumnExpr(\"pro.phone_number, pro.company_joined_date, pro.skill, pro.language, pro.education\").\n\t\tColumnExpr(\"pro.certificate, pro.award, pro.experience\").\n\t\tColumnExpr(\"pro.introduce, pro.branch, pro.employee_id\").\n\t\tWhere(\"usr.id = ?\", id).\n\t\tJoin(\"JOIN user_profiles AS pro ON pro.user_id = usr.id\").\n\t\tJoin(\"JOIN organizations AS org ON org.id = usr.organization_id\").\n\t\tJoin(\"JOIN user_roles AS rol ON rol.id = usr.role_id\").\n\t\tFirst()\n\n\tif err != nil {\n\t\trepo.Logger.Errorf(\"%+v\", err)\n\t}\n\n\treturn user, err\n}", "title": "" }, { "docid": "bf8755d095115ec3e94f16a225f17b34", "score": "0.5002432", "text": "func (repoUser UserRepositoryImpl) Get() []entities.User {\n\tqueryRes, err := repoUser.Db.Query(\"select user_id,user_name,email,profilepic from iam.user\twhere status=$1 \", \"Activate\")\n\tif err != nil {\n\t\tpanic(\"Error while Executing Query : \" + err.Error())\n\t}\n\n\tuserArray := entities.User{}\n\tvar userSlice []entities.User\n\tfor queryRes.Next() {\n<<<<<<< HEAD\n\t\toutput := queryRes.Scan(&userArray.Userdetails.ID,&userArray.Userdetails.Name, &userArray.Userdetails.Email, &userArray.Roledetails.Name)\n=======\n\t\toutput := queryRes.Scan(&userArray.ID, &userArray.Name, &userArray.Email, &userArray.Profilepic)\n>>>>>>> d9b04e621bed3908f3ac63ebb93a04dae8c64749\n\t\tif output != nil {\n\t\t\tpanic(\"Error while reading : \" + output.Error())\n\t\t}\n\t\tuserSlice = append(userSlice, userArray)\n\t}\n\treturn userSlice\n}", "title": "" }, { "docid": "31e237b20d63f3a88a407e2a3387e076", "score": "0.49879777", "text": "func GetOwnUser(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{})\n}", "title": "" }, { "docid": "968339ce9b18219e461f3bbbcda558c1", "score": "0.4974911", "text": "func Read(id string) (User, error) {\n\tvar sess *session.Session\n\tvar tableName string\n\n\tlocal, err := strconv.ParseBool(os.Getenv(\"AWS_SAM_LOCAL\"))\n\tif err != nil {\n\t\treturn User{}, err\n\t}\n\t// Create dynamo client object locally if running SAM CLI\n\tif local {\n\t\tsess = session.Must(session.NewSession(&aws.Config{\n\t\t\tEndpoint: aws.String(\"http://dynamodb:8000\"),\n\t\t}))\n\t\ttableName = \"users\"\n\t} else {\n\t\tsess = session.Must(session.NewSession())\n\t\ttableName = os.Getenv(\"USER_TABLE_NAME\")\n\t}\n\tsvc := dynamodb.New(sess)\n\tuser := User{}\n\n\t// Perform the query\n\tfmt.Println(\"Trying to read from table: \", \"users\")\n\tresult, err := svc.GetItem(&dynamodb.GetItemInput{\n\t\tTableName: aws.String(tableName),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(id),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn user, err\n\t}\n\n\t// Unmarshall the result in to an Item\n\terr = dynamodbattribute.UnmarshalMap(result.Item, &user)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn user, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "b1d453f02045a6acabf494eb5b5ce36c", "score": "0.49545714", "text": "func (_Expertise *ExpertiseCallerSession) Expertise(user common.Address) (struct {\n\tScore *big.Int\n\tLevel string\n\tRank string\n}, error) {\n\treturn _Expertise.Contract.Expertise(&_Expertise.CallOpts, user)\n}", "title": "" }, { "docid": "0d30a6e175e30bcc27f8928d52deba48", "score": "0.49478427", "text": "func flattenUserData(usr *user.User) map[string]interface{} {\n\tres := make(map[string]interface{})\n\tif usr == nil {\n\t\treturn res\n\t}\n\n\tif val, ok := usr.GetIdOk(); ok {\n\t\tres[\"id\"] = *val\n\t}\n\tif val, ok := usr.GetCreatedAtOk(); ok {\n\t\tres[\"created_at\"] = *val\n\t}\n\tif val, ok := usr.GetUpdatedAtOk(); ok {\n\t\tres[\"updated_at\"] = *val\n\t}\n\tif val, ok := usr.GetOrganizationIdOk(); ok {\n\t\tres[\"organization_id\"] = *val\n\t}\n\tif val, ok := usr.GetPhoneNumberOk(); ok {\n\t\tres[\"phone_number\"] = *val\n\t}\n\tif val, ok := usr.GetEnabledOk(); ok {\n\t\tres[\"enabled\"] = *val\n\t}\n\tif val, ok := usr.GetDeletedOk(); ok {\n\t\tres[\"deleted\"] = *val\n\t}\n\tif val, ok := usr.GetIdproviderIdOk(); ok {\n\t\tres[\"idprovider_id\"] = *val\n\t}\n\tif val, ok := usr.GetLastLoginOk(); ok {\n\t\tres[\"last_login\"] = *val\n\t}\n\tif val, ok := usr.GetIsFederatedOk(); ok {\n\t\tres[\"is_federated\"] = *val\n\t}\n\tif val, ok := usr.GetUsernameOk(); ok {\n\t\tres[\"username\"] = *val\n\t}\n\tif val, ok := usr.GetTypeOk(); ok {\n\t\tres[\"type\"] = *val\n\t}\n\tif val, ok := usr.GetMfaVerifiersConfiguredOk(); ok {\n\t\tres[\"mfa_verifiers_configured\"] = *val\n\t}\n\tif val, ok := usr.GetMfaVerificationExcludedOk(); ok {\n\t\tres[\"mfa_verification_excluded\"] = *val\n\t}\n\tif val, ok := usr.GetOrganizationOk(); ok {\n\t\tusrOrgData := val\n\t\tres[\"organization\"] = flattenUserOrganizationData(usrOrgData)\n\t}\n\tif val, ok := usr.GetOrganizationPreferencesOk(); ok {\n\t\tres[\"organization_preferences\"] = *val\n\t}\n\tif val, ok := usr.GetPropertiesOk(); ok {\n\t\tjsonProps, _ := json.Marshal(val)\n\t\tres[\"properties\"] = string(jsonProps)\n\t}\n\tif val, ok := usr.GetMemberOfOrganizationsOk(); ok {\n\t\tres[\"member_of_organizations\"] = flattenUserOrgsData(val)\n\t}\n\tif val, ok := usr.GetContributorOfOrganizationsOk(); ok {\n\t\tres[\"contributor_of_organizations\"] = flattenUserOrgsData(val)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "c48d17156563eae78eb6c9f8970d33d5", "score": "0.49386165", "text": "func HasExpertiseUser() predicate.Expertise {\n\treturn predicate.Expertise(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ExpertiseUserTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, ExpertiseUserTable, ExpertiseUserColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "c91655ce95aba8ce9419d8acef68de21", "score": "0.49358243", "text": "func (ur *UserRepository) Read(u *models.User) ([]*models.User, error) {\n\tcurrentDB := ur.db.Pdb\n\tusers := make([]*models.User, 0)\n\tvar result *gorm.DB\n\tif u == nil {\n\t\tresult = currentDB.Model(&models.User{}).Select(\"*\").Find(&users)\n\t\tprint(\"HERE\")\n\t} else {\n\t\tif len(u.Login) == 0 {\n\t\t\tresult = currentDB.Model(&models.User{}).Where(\"id = ?\", u.ID).First(&users)\n\t\t} else {\n\t\t\tresult = currentDB.Model(&models.User{}).Where(\"login = ?\", u.Login).First(&users)\n\t\t}\n\t}\n\n\tif result.Error != nil && len(users) != 0 {\n\t\treturn nil, result.Error\n\t}\n\n\tif len(users) == 0 {\n\t\treturn nil, nil\n\t}\n\t\n\treturn users, nil\n}", "title": "" }, { "docid": "5255b63379222d6ceae6ca268a1dc33e", "score": "0.49340072", "text": "func UserRead(c *gin.Context) {\n\tvar u models.User\n\ta, err := strconv.ParseUint(c.Param(\"id\"), 10, 32)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\tu.ID = uint(a)\n\tif services.ContainsUser(&u) {\n\t\tc.JSON(200, u)\n\t} else {\n\t\tc.Writer.WriteHeader(403)\n\t\tc.Writer.Write([]byte(\"User does not exist\"))\n\t}\n\n}", "title": "" }, { "docid": "2aea88fb42f3da5833897c4f9e2c3a42", "score": "0.49195555", "text": "func GetAllUser() []Person{\n\n\tdbinfo := fmt.Sprintf(\"user=%s password=%s dbname=%s sslmode=disable\",\n\t\tDB_USER, DB_PASSWORD, DB_NAME)\n\tdb, err := sql.Open(\"postgres\", dbinfo)\n\tcheckErr(err)\n\tdefer db.Close()\n\n\tfmt.Println(\"# Querying\")\n\trows, err := db.Query(\"SELECT * FROM userinfo\")\n\tcheckErr(err)\n\n\tvar people []Person\n\tfor rows.Next() {\n\t\tvar uid int\n\t\tvar username string\n\t\tvar password string\n\t\tvar firstname string\n\t\tvar lastname string\n\t\tvar address string\n\t\tvar created time.Time\n\t\tvar modified time.Time\n\t\terr = rows.Scan(&uid, &username, &password ,&firstname, &lastname, &address, &created, &modified)\n\t\tcheckErr(err)\n\t\tfmt.Println(\"uid | username | password | firstname | lastname | address | created | modified \")\n\t\tfmt.Printf(\"%3v | %8v | %8v | %8v | %8v | %8v | %8v| %8v\\n\", uid, username, password, firstname, lastname, address, created, modified)\n\n\t\t//lets put the value inside person\n\t\tvar person Person\n\t\tperson.Username = username\n\t\tperson.Password = password\n\t\tperson.Firstname = firstname\n\t\tperson.Lastname = lastname\n\n\t\tvar addressPerson Address\n\t\taddressPerson.City = address\n\t\taddressPerson.State = address\n\n\t\tperson.Address = &addressPerson\n\t\tpeople = append(people, person)\n\t}\n\treturn people\n}", "title": "" }, { "docid": "7333e26a332fe5f4da3ac691df351400", "score": "0.4909958", "text": "func GetUserProfile(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *UserProfileState, opts ...pulumi.ResourceOption) (*UserProfile, error) {\n\tvar resource UserProfile\n\terr := ctx.ReadResource(\"aws-native:sagemaker:UserProfile\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "23ff5cf15a9add00633a024f5470ce43", "score": "0.4907062", "text": "func (u *Usr) ReadUserInfo(userid int64) *ResJSUser {\n\n\tvar resjsu = &ResJSUser{}\n\n\tstmt, err := u.DB.Prepare(`SELECT id, nickname\n\t\t\t\t FROM user WHERE user.id = ?`)\n\tif err != nil {\n\t\tlog.Println(\"[ERR] prepare stmt err : \", err)\n\t\treturn nil\n\t}\n\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(userid)\n\tif err != nil {\n\t\tlog.Println(\"[ERR] stmt query err : \", err)\n\t\treturn nil\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&resjsu.ID, &resjsu.NickName)\n\t\tif err != nil {\n\t\t\tlog.Println(\"[ERR] stmt query err : \", err)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn resjsu\n}", "title": "" }, { "docid": "5ad8a421ebcbfaafdfd26e41b3e78b9e", "score": "0.4901619", "text": "func (o *AaaAuditRecord) GetUser() IamUserRelationship {\n\tif o == nil || o.User == nil {\n\t\tvar ret IamUserRelationship\n\t\treturn ret\n\t}\n\treturn *o.User\n}", "title": "" }, { "docid": "dd2c89385cc4b952fa8b861751d6bf50", "score": "0.48877347", "text": "func GetUserMain() Users {\n\tdb := gormdb.ConnectMySQL()\n\tresult := Users{}\n\tuser := []User{}\n\t//rows := db.Find(&user)\n\t//rows := db.Find(&user)\n\t/*\n\t\tif err := db.Find(&user).Error; err != nil {\n\t\t\t//c.String(http.StatusNotFound, \"not found page\")\n\t\t\tfmt.Println(err)\n\t\t}\n\t*/\n\n\t//defer db.Close()\n\t/*\n\t\tif rows, err := db.Debug().Where(\"name = ?\", \"Hanajung\").Order(\"id desc, name\").Find(&result).Rows(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t} else {\n\t\t\tdefer rows.Close()\n\t\t\tfor rows.Next() {\n\t\t\t\t//db.ScanRows(rows, &user)\n\t\t\t\terr2 := db.ScanRows(rows, &user)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\tfmt.Print(err2)\n\t\t\t\t}\n\n\t\t\t\tfmt.Println(\"users => \", user)\n\t\t\t\tresult.Users = append(result.Users, user)\n\t\t\t}\n\t\t}\n\t*/\n\n\t//err := db.Debug().Where(\"name = ?\", \"Hanajung\").Order(\"id desc, name\").Find(&user).Error\n\terr := db.Debug().Order(\"id desc, name\").Find(&user).Error\n\tif err != nil {\n\t\tfmt.Print(\"error db debug => \", err)\n\t}\n\n\tfor _, ar := range user {\n\t\tfmt.Println(ar.ID)\n\t\tresult.Users = append(result.Users, ar)\n\t}\n\n\t/*\n\t\tfor rows.Next() {\n\t\t\t//return result\n\t\t\terr2 := db.ScanRows(rows, &user)\n\t\t\tfmt.Println(\"rows => \", rows)\n\t\t\tfmt.Println(\"result => \", result)\n\n\t\t\tif err2 != nil {\n\t\t\t\tfmt.Print(err2)\n\t\t\t}\n\t\t\tresult.Users = append(result.Users, user)\n\t\t}\n\t*/\n\n\t//result.Users = append(result.Users, user)\n\n\t//fmt.Println(\"user => \", user)\n\t//fmt.Println(\"result => \", result)\n\n\treturn result\n}", "title": "" }, { "docid": "2e4f77079104941020df3d686d649b11", "score": "0.48868448", "text": "func (repo *PgUserRepository) GetUserProfile(id int) (m.User, error) {\n\tuser := m.User{}\n\terr := repo.DB.Model(&user).\n\t\tColumn(\"usr.*\").\n\t\tWhere(\"usr.id = ?\", id).\n\t\tWhere(\"usr.deleted_at is null\").\n\t\tRelation(\"UserProfile\").\n\t\tRelation(\"Role\").\n\t\tRelation(\"Organization\").\n\t\tFirst()\n\n\tif err != nil {\n\t\trepo.Logger.Errorf(\"%+v\", err)\n\t}\n\n\treturn user, err\n}", "title": "" }, { "docid": "f4ca1d7434f9a988968b255b922a5de0", "score": "0.4870379", "text": "func userProfileAccessExtended() *xdominion.XTable {\n\tt := xdominion.NewXTable(\"user_profileaccessextended\", \"user_pae_\")\n\n\t// profile\n\tt.AddField(xdominion.XFieldVarChar{Name: \"profile\", Size: 30, Constraints: xdominion.XConstraints{\n\t\txdominion.XConstraint{Type: xdominion.NN},\n\t\txdominion.XConstraint{Type: xdominion.FK, Data: []string{\"user_profile\", \"user_pro_key\"}},\n\t\txdominion.XConstraint{Type: xdominion.IN},\n\t\txdominion.XConstraint{Type: xdominion.DC},\n\t}})\n\n\t// access extended\n\tt.AddField(xdominion.XFieldVarChar{Name: \"accessextended\", Size: 30, Constraints: xdominion.XConstraints{\n\t\txdominion.XConstraint{Type: xdominion.NN},\n\t\txdominion.XConstraint{Type: xdominion.FK, Data: []string{\"user_accessextended\", \"user_ace_key\"}},\n\t\txdominion.XConstraint{Type: xdominion.IN},\n\t\txdominion.XConstraint{Type: xdominion.DC},\n\t}})\n\n\t// external key\n\tt.AddField(xdominion.XFieldVarChar{Name: \"keyextended\", Size: 255, Constraints: xdominion.XConstraints{\n\t\txdominion.XConstraint{Type: xdominion.NN},\n\t}})\n\n\treturn t\n}", "title": "" }, { "docid": "35e064874bc491c3f17412725436e909", "score": "0.4847791", "text": "func GetUserProfile(userNo int) (result UserProfile, err error) {\r\n\tclient := http.Client{}\r\n\r\n\tform := url.Values{}\r\n\tform.Add(\"job\", \"3\")\r\n\tform.Add(\"user_no\", fmt.Sprint(userNo))\r\n\tbody := strings.NewReader(form.Encode())\r\n\r\n\treq, err := http.NewRequest(\"POST\", baseURL+profileEndpoint, body)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\r\n\tres, err := client.Do(req)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\tresBody, err := ioutil.ReadAll(res.Body)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\tvar stats statsJSON\r\n\tif err = json.Unmarshal(resBody, &stats); err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\tif err = json.Unmarshal(stats.Stats, &result); err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "663eb50883bd145f57806dd07ccf6fed", "score": "0.4830809", "text": "func (s *GRPCServer) Read(ctx context.Context, req *ReadRequest) (*UserResponse, error) {\n\tvar email string\n\tvar firstName string\n\tvar lastName string\n\tvar id int32\n\n\tif err := s.db.QueryRow(\"SELECT * FROM users WHERE id = $1\",\n\t\treq.GetId(),\n\t).Scan(&id, &lastName, &email, &firstName); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &UserResponse{User: &User{\n\t\tId: req.GetId(),\n\t\tFirstName: firstName,\n\t\tLastName: lastName,\n\t\tEmail: email,\n\t}}, nil\n}", "title": "" }, { "docid": "02555fec712f8fb4b15f1b6be5c351fd", "score": "0.483017", "text": "func UserProfileGet(ctx *fasthttp.RequestCtx) {\n\tnickname := ctx.UserValue(\"nickname\").(string)\n\tresponse, err := mw.UserProfileGetMiddleware(nickname)\n\n\tif err == nil {\n\t\tmw.SetHeaders(ctx, fasthttp.StatusOK)\n\t\tresult, _ := response.MarshalJSON()\n\t\tctx.Write(result)\n\n\t} else if err == models.ErrUserNotFound {\n\t\tmw.SetHeaders(ctx, fasthttp.StatusNotFound)\n\t\tresult, _ := err.MarshalJSON()\n\t\tctx.Write(result)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5cf49239d275ed2201597a85c01ea500", "score": "0.48139614", "text": "func GetUserHierarchyStructure(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *UserHierarchyStructureState, opts ...pulumi.ResourceOption) (*UserHierarchyStructure, error) {\n\tvar resource UserHierarchyStructure\n\terr := ctx.ReadResource(\"aws:connect/userHierarchyStructure:UserHierarchyStructure\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "c90b4fca61541a67e9e46f60b5e40d03", "score": "0.4780803", "text": "func GetUsers(c *gin.Context) {\n\tvar user userModel.User\n\tfmt.Println(user)\n\n}", "title": "" }, { "docid": "a530cd8148b65c7715d0296ef7a2916c", "score": "0.4775512", "text": "func GetUserInformation(oAuthID string) (user User, err error) {\n\t//Create database connection\n\tdb, err := CreateDBConnection()\n\tif err != nil {\n\t\treturn user, errors.New(\"Failed to get Database connection\")\n\t}\n\tdefer db.Close()\n\t//Prepare SQL Statemment for getting user informations\n\tstmtUserOut, err := db.Prepare(\"Select oAuthID, oAuthType, email, image, username from user where oAuthID = ?\")\n\tif err != nil {\n\t\treturn user, errors.New(\"Failed to get User properties\")\n\t}\n\tstmtUserOut.QueryRow(oAuthID).Scan(&user.OAuthID, &user.OAuthType, &user.EMail, &user.Image, &user.Username)\n\t//Give back error in case user doesn't exist\n\tif user.OAuthID == \"\" {\n\t\treturn user, errors.New(\"Failed to get User properties\")\n\t}\n\t//Give back user informations\n\treturn user, nil\n}", "title": "" }, { "docid": "343b8a020384d3a087ebaeb381c9a7a4", "score": "0.4774968", "text": "func getProfilesUser(db *gorm.DB, userid string) []models.UserProfile {\n\tprofiles := []models.UserProfile{}\n\tif err := db.Debug().Where(\"app_user_id = ? and user_profile_status = ?\", userid, true).Find(&profiles).Error; err != nil {\n\t\treturn profiles\n\t}\n\tfmt.Println(userid)\n\treturn profiles\n}", "title": "" }, { "docid": "1dce1472dc72fc162da0ba490cb6505a", "score": "0.47740072", "text": "func GetProfile(w http.ResponseWriter, r *http.Request) {\n\tuserID := chi.URLParam(r, \"userID\")\n\n\tclient, cancel := getDbConnection()\n\tdefer cancel()\n\tcollection := client.Database(\"users_db\").Collection(\"ceb\")\n\n\tvar goodMan user\n\n\tid, _ := primitive.ObjectIDFromHex(userID)\n\tresult := collection.FindOne(context.TODO(), bson.M{\"_id\": id})\n\tresult.Decode(&goodMan)\n\n\t//pretty print json object\n\tb, _ := json.MarshalIndent(goodMan, \"\", \" \")\n\tos.Stdout.Write(b)\n\n\trender.JSON(w, r, goodMan) // A chi router helper for serializing and returning json\n}", "title": "" }, { "docid": "d5f18aaef1b671bba8f96e75e857c92b", "score": "0.47652894", "text": "func GetDetailUsers(userId int) (models.User, error) {\n\tvar user models.User\n\tif err := config.DB.Find(&user, userId).Error; err != nil {\n\t\treturn user, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "3d9dc8129c8a3526c5d538ba697d44d5", "score": "0.47512746", "text": "func GetProfile(db sqlx.Queryer, id int64) (UserProfile, error) {\n\tvar prof UserProfile\n\n\tuser, err := GetUser(db, id)\n\tif err != nil {\n\t\treturn prof, errors.Wrap(err, \"get user error\")\n\t}\n\tprof.User = UserProfileUser{\n\t\tID: user.ID,\n\t\tUsername: user.Username,\n\t\tSessionTTL: user.SessionTTL,\n\t\tIsAdmin: user.IsAdmin,\n\t\tIsActive: user.IsActive,\n\t\tCreatedAt: user.CreatedAt,\n\t\tUpdatedAt: user.UpdatedAt,\n\t}\n\n\terr = sqlx.Select(db, &prof.Organizations, `\n\t\tselect\n\t\t\tou.organization_id as organization_id,\n\t\t\to.name as organization_name,\n\t\t\tou.is_admin as is_admin,\n\t\t\tou.created_at as created_at,\n\t\t\tou.updated_at as updated_at\n\t\tfrom\n\t\t\torganization_user ou,\n\t\t\torganization o\n\t\twhere\n\t\t\tou.user_id = $1\n\t\t\tand ou.organization_id = o.id`,\n\t\tid,\n\t)\n\tif err != nil {\n\t\treturn prof, errors.Wrap(err, \"select error\")\n\t}\n\n\treturn prof, nil\n}", "title": "" }, { "docid": "bfdbe4c21b1a04869bd5b8584ec0ceee", "score": "0.47502404", "text": "func (handler *SQLHandler) getUser(e string) *model.User {\n\tvar user model.User\n\tq := handler.queryManager.getAllFromUserWithEmail(e)\n\tqueryErr := handler.DB.QueryRow(q).Scan(&user.ID, &user.FirstName, &user.LastName, &user.Email, &user.Token, &user.IsEnabled)\n\tif queryErr == nil {\n\t\treturn &user\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71306d5c5890c79938d5eff6aa372acf", "score": "0.47489566", "text": "func GetUser(user *User, wg *sync.WaitGroup) {\n\tsqlStr := fmt.Sprintf(\"select enterpriseId,retailId,realname from t_base_enterprise_user where id=%d\", user.Id)\n\terr := Db.QueryRow(sqlStr).Scan(&user.EnterpriseId, &user.RetailId, &user.Realname)\n\tif err != nil {\n\t\tuser.IsUser = err\n\t}\n\twg.Done()\n\treturn\n}", "title": "" }, { "docid": "854b89b6ebbf6b649e1ec2f1f2bca0b4", "score": "0.4748116", "text": "func (m *ConditionalAccessUsers) GetAdditionalData()(map[string]interface{}) {\n return m.additionalData\n}", "title": "" }, { "docid": "466a4ca8d04cf88e8089150e85fed13f", "score": "0.47470158", "text": "func (user *User) ReadOne() {\n\tdb := GetDB()\n\tif err := db.First(user).Error; err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "c0f3ec383d2a9c63e82c7afe593e6aa8", "score": "0.47423163", "text": "func (a *ASRockRack) UserRead(ctx context.Context) (users []map[string]string, err error) {\n\terr = a.Open(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccounts, err := a.listUsers(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(bmclibErrs.ErrRetrievingUserAccounts, err.Error())\n\t}\n\n\tusers = make([]map[string]string, 0)\n\tfor _, account := range accounts {\n\t\tif account.Access == 1 {\n\t\t\tuser := map[string]string{\n\t\t\t\t\"ID\": fmt.Sprintf(\"%d\", account.ID),\n\t\t\t\t\"Name\": account.Name,\n\t\t\t\t\"RoleID\": account.NetworkPrivilege,\n\t\t\t}\n\t\t\tusers = append(users, user)\n\t\t}\n\t}\n\n\treturn users, nil\n}", "title": "" }, { "docid": "909139febb58781cac9f14e3cf366d6a", "score": "0.47353092", "text": "func (user *User) Detail(role string, organization string) UserDetails {\n\treturn UserDetails{user.ID, user.FirstName, user.LastName, user.Email, user.Address, user.Status, user.Phone, user.Language, user.GroupID, role, organization}\n}", "title": "" }, { "docid": "746219fb69fe4bfffb6df50bf4e0a098", "score": "0.4731481", "text": "func GetUserProfile(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *UserProfileState, opts ...pulumi.ResourceOption) (*UserProfile, error) {\n\tvar resource UserProfile\n\terr := ctx.ReadResource(\"aws-native:opsworks:UserProfile\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "12c0f57db53153ce5411c6673df055a7", "score": "0.4729186", "text": "func (m *Organization) GetPrivacyProfile()(PrivacyProfileable) {\n return m.privacyProfile\n}", "title": "" }, { "docid": "cbed9c3838e676e40433e5aea32495cc", "score": "0.472717", "text": "func GetUserAttributes(u *users.User) error {\n\terr := DefaultDb.GetUserAttributes(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, _ := range u.Addresses {\n\t\tu.Addresses[k].AddLinks()\n\t}\n\tfor k, _ := range u.Cards {\n\t\tu.Cards[k].AddLinks()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b43c5bb33b12277ddc3ec6c8eeaa5849", "score": "0.47263896", "text": "func main() {\n\ta := Admin{\n\t\tUser: User{\n\t\t\tName: \"Homer\",\n\t\t\tAge: 40,\n\t\t},\n\t\tPermissions: map[string]bool{},\n\t}\n\n\tfmt.Println(a.User.Name)\n}", "title": "" }, { "docid": "2c1d5e884a759b7b74b09a02e0034573", "score": "0.47236472", "text": "func GetUser(c *gin.Context) {\n\n\tvar user model.User\n\n\tget(c, &user)\n}", "title": "" }, { "docid": "3286c7d7763707e57104d533d3b73f87", "score": "0.47188854", "text": "func (cl *ClientModel) GetUserData() interface{} { return cl.GetUserData() }", "title": "" }, { "docid": "904fa59cff5bc27da0189712204760ae", "score": "0.4701249", "text": "func (mc *MembershipController) GetUser(c *gin.Context) (int, gin.H, error) {\n\tuserID := c.Param(\"userID\")\n\n\tuser, err := mc.Storage.GetUserByID(userID)\n\tif err != nil {\n\t\treturn toResponse(err)\n\t}\n\n\troles := make([]gin.H, len(user.Roles))\n\tfor i, role := range user.Roles {\n\t\troles[i] = gin.H{\n\t\t\t\"id\": role.ID, // does frontend need ID?\n\t\t\t\"name\": role.Name,\n\t\t\t\"name_en\": role.NameEn,\n\t\t\t\"key\": role.Key,\n\t\t}\n\t}\n\n\tvar activated *time.Time\n\tif user.Activated.Valid && !user.Activated.Time.IsZero() {\n\t\tactivated = &user.Activated.Time\n\t}\n\n\tmailGroups := make([]string, 0)\n\tfor _, group := range user.MailGroups {\n\t\tfor key, value := range globals.Conf.Mailchimp.InterestIDs {\n\t\t\tif value == group.MailgroupID {\n\t\t\t\tmailGroups = append(mailGroups, key)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treadPreferenceArr := make([]string, 0)\n\tif user.ReadPreference.Valid {\n\t\treadPreferenceArr = strings.Split(user.ReadPreference.String, \",\")\n\t}\n\n\treturn http.StatusOK, gin.H{\"status\": \"success\", \"data\": gin.H{\n\t\t\"user_id\": userID,\n\t\t\"first_name\": user.FirstName.String,\n\t\t\"last_name\": user.LastName.String,\n\t\t\"email\": user.Email.String,\n\t\t\"registration_date\": user.RegistrationDate.Time,\n\t\t\"activated\": activated,\n\t\t\"roles\": roles,\n\t\t\"read_preference\": readPreferenceArr,\n\t\t\"maillist\": mailGroups,\n\t},\n\t}, nil\n}", "title": "" }, { "docid": "e484a7735ec16aa30169e58e298fdf01", "score": "0.46998662", "text": "func (meetupL) LoadUser(ctx context.Context, e boil.ContextExecutor, singular bool, maybeMeetup interface{}, mods queries.Applicator) error {\n\tvar slice []*Meetup\n\tvar object *Meetup\n\n\tif singular {\n\t\tobject = maybeMeetup.(*Meetup)\n\t} else {\n\t\tslice = *maybeMeetup.(*[]*Meetup)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &meetupR{}\n\t\t}\n\t\targs = append(args, object.UserID)\n\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &meetupR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.UserID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.UserID)\n\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\tquery := NewQuery(\n\t\tqm.From(`users`),\n\t\tqm.WhereIn(`users.id in ?`, args...),\n\t)\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.QueryContext(ctx, e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load User\")\n\t}\n\n\tvar resultSlice []*User\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice User\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results of eager load for users\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for users\")\n\t}\n\n\tif len(meetupAfterSelectHooks) != 0 {\n\t\tfor _, obj := range resultSlice {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, 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.User = foreign\n\t\tif foreign.R == nil {\n\t\t\tforeign.R = &userR{}\n\t\t}\n\t\tforeign.R.Meetups = append(foreign.R.Meetups, object)\n\t\treturn nil\n\t}\n\n\tfor _, local := range slice {\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif local.UserID == foreign.ID {\n\t\t\t\tlocal.R.User = foreign\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &userR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Meetups = append(foreign.R.Meetups, local)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0af236da838c1736aa82596e6fb6bf0f", "score": "0.4696781", "text": "func GetUser(ctx *gin.Context) {\n\tsqlStatement := `SELECT first_name, last_name, school_email\n\tFROM users WHERE id=$1;`\n\trow := dbObj.QueryRow(sqlStatement, *getUserIDFromCookie(ctx))\n\tvar userObj user\n\tif err := row.Scan(&userObj.FirstName, &userObj.LastName, &userObj.SchoolEmail); err != nil {\n\t\tlog.Panic(err)\n\t}\n\tctx.JSON(http.StatusOK, gin.H{\n\t\t\"first_name\": userObj.FirstName,\n\t\t\"last_name\": userObj.LastName,\n\t\t\"school_email\": userObj.SchoolEmail,\n\t})\n}", "title": "" }, { "docid": "9a9e2248f1fb967d57a7fdfb21207860", "score": "0.469127", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\turlParams := mux.Vars(r)\n\tid := urlParams[\"id\"]\n\tfmt.Println(id, \"yesysey\")\n\tReadUser := api.User{}\n\terr := database.QueryRow(\"select * from users where user_id=?\", id).\n\t\tScan(&ReadUser.ID, &ReadUser.Name, &ReadUser.First, &ReadUser.Last, &ReadUser.Email)\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tfmt.Fprintf(w, \"No such user\")\n\tcase err != nil:\n\t\tlog.Fatal(err)\n\t\tfmt.Fprintf(w, \"Error\")\n\tdefault:\n\t\toutput, _ := json.Marshal(ReadUser)\n\t\tfmt.Fprintf(w, string(output))\n\t}\n}", "title": "" }, { "docid": "0bec00f33145a7378c3df6b18eb36167", "score": "0.46736154", "text": "func EducationListGet() ([]EducationList, error) {\n\tvar educations []EducationList\n\trows, err := pool.Query(context.Background(), `\n\t\tSELECT\n\t\t\te.id,\n\t\t\te.contact_id,\n\t\t\tc.name AS contact_name,\n\t\t\te.start_date,\n\t\t\te.end_date,\n\t\t\te.post_id,\n\t\t\tp.name AS post_name,\n\t\t\te.note\n\t\tFROM\n\t\t\teducations AS e\n\t\tLEFT JOIN\n\t\t\tcontacts AS c ON c.id = e.contact_id\n\t\tLEFT JOIN\n\t\t\tposts AS p ON p.id = e.post_id\n\t\tORDER BY\n\t\t\tstart_date DESC\n\t`)\n\tif err != nil {\n\t\terrmsg(\"EducationListGet Query\", err)\n\t\treturn educations, err\n\t}\n\tfor rows.Next() {\n\t\tvar education EducationList\n\t\terr := rows.Scan(&education.ID, &education.ContactID, &education.ContactName, &education.StartDate,\n\t\t\t&education.EndDate, &education.PostID, &education.PostName, &education.Note)\n\t\tif err != nil {\n\t\t\terrmsg(\"EducationListGet Scan\", err)\n\t\t\treturn educations, err\n\t\t}\n\t\teducations = append(educations, education)\n\t}\n\t// for i := range educations {\n\t// \teducations[i].StartStr = setStrMonth(educations[i].StartDate)\n\t// \teducations[i].EndStr = setStrMonth(educations[i].EndDate)\n\t// }\n\treturn educations, rows.Err()\n}", "title": "" }, { "docid": "1147f147bef1b6e099e407ee6a129d9c", "score": "0.46677735", "text": "func (repo *PgUserRepository) GetUserProfileList(orgID int, userProfileListParams *param.UserProfileListParams) ([]m.UserExt, int, error) {\n\tvar user []m.UserExt\n\n\tqueryObj := repo.DB.Model(&user).\n\t\tRelation(\"Role\").\n\t\tRelation(\"UserProfile\").\n\t\tRelation(\"UserProfile.UserBranch\").\n\t\tWhere(\"usr.organization_id = ?\", orgID)\n\n\tif userProfileListParams.Name != \"\" {\n\t\tprofileName := \"%\" + userProfileListParams.Name + \"%\"\n\t\tqueryObj.Where(\"vietnamese_unaccent(LOWER(user_profile.first_name)) || ' ' || vietnamese_unaccent(LOWER(user_profile.last_name)) \"+\n\t\t\t\"LIKE vietnamese_unaccent(LOWER(?0))\",\n\t\t\tprofileName)\n\t}\n\n\tif userProfileListParams.Email != \"\" {\n\t\tqueryObj.Where(\"LOWER(usr.email) LIKE LOWER(?)\", \"%\"+userProfileListParams.Email+\"%\")\n\t}\n\n\tif userProfileListParams.PhoneNumber != \"\" {\n\t\tqueryObj.Where(\"user_profile.phone_number LIKE ?\", \"%\"+userProfileListParams.PhoneNumber+\"%\")\n\t}\n\n\tif !userProfileListParams.DateFrom.IsZero() {\n\t\tqueryObj.Where(\"DATE(user_profile.company_joined_date) >= DATE(?)\", userProfileListParams.DateFrom)\n\t}\n\n\tif !userProfileListParams.DateTo.IsZero() {\n\t\tqueryObj.Where(\"DATE(user_profile.company_joined_date) <= DATE(?)\", userProfileListParams.DateTo)\n\t}\n\n\tif userProfileListParams.Rank != 0 {\n\t\tqueryObj.Where(\"user_profile.rank = ?\", userProfileListParams.Rank)\n\t}\n\n\tif userProfileListParams.Branch != 0 {\n\t\tqueryObj.Where(\"user_profile.branch = ?\", userProfileListParams.Branch)\n\t}\n\tqueryObj.Offset((userProfileListParams.CurrentPage - 1) * userProfileListParams.RowPerPage)\n\tqueryObj.Order(\"user_profile.created_at DESC\")\n\tqueryObj.Limit(userProfileListParams.RowPerPage)\n\ttotalRow, err := queryObj.SelectAndCount()\n\n\tif err != nil {\n\t\trepo.Logger.Error(err)\n\t}\n\n\treturn user, totalRow, err\n}", "title": "" }, { "docid": "0977ea98d0802b5497c8751a5f92b1a6", "score": "0.46622416", "text": "func (regimens *Regimens) GetUserRegimens(db *gorm.DB, userID uuid.UUID) error {\n\tif err := db.Preload(\"Account\").Preload(\"User\").Preload(\"Pod\").Preload(\"Reminders\").Preload(\"Usages\").Find(&regimens, \"user_id = ?\", userID).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84d974fea5840c9fca0868db5f62dd02", "score": "0.46590075", "text": "func (c *UserClient) QueryUserExpertise(u *User) *ExpertiseQuery {\n\tquery := &ExpertiseQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := u.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(user.Table, user.FieldID, id),\n\t\t\tsqlgraph.To(expertise.Table, expertise.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, user.UserExpertiseTable, user.UserExpertiseColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(u.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "c102564065d0e0b2f1bbc3bff88749e3", "score": "0.4657169", "text": "func (studentL) LoadUser(e boil.Executor, singular bool, maybeStudent interface{}) error {\n\tvar slice []*Student\n\tvar object *Student\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeStudent.(*Student)\n\t} else {\n\t\tslice = *maybeStudent.(*StudentSlice)\n\t\tcount = len(slice)\n\t}\n\n\targs := make([]interface{}, count)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &studentR{}\n\t\t}\n\t\targs[0] = object.UserID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &studentR{}\n\t\t\t}\n\t\t\targs[i] = obj.UserID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select * from \\\"users\\\" where \\\"user_id\\\" in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintf(boil.DebugWriter, \"%s\\n%v\\n\", query, args)\n\t}\n\n\tresults, err := e.Query(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load User\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*User\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice User\")\n\t}\n\n\tif len(studentAfterSelectHooks) != 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\tobject.R.User = resultSlice[0]\n\t\treturn nil\n\t}\n\n\tfor _, local := range slice {\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif local.UserID == foreign.UserID {\n\t\t\t\tlocal.R.User = foreign\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6c2c1a957c2f9cdadffe081ca2749ad0", "score": "0.46439266", "text": "func (personI18nL) LoadUser(e boil.Executor, singular bool, maybePersonI18n interface{}, mods queries.Applicator) error {\n\tvar slice []*PersonI18n\n\tvar object *PersonI18n\n\n\tif singular {\n\t\tobject = maybePersonI18n.(*PersonI18n)\n\t} else {\n\t\tslice = *maybePersonI18n.(*[]*PersonI18n)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &personI18nR{}\n\t\t}\n\t\tif !queries.IsNil(object.UserID) {\n\t\t\targs = append(args, object.UserID)\n\t\t}\n\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &personI18nR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif queries.Equal(a, obj.UserID) {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !queries.IsNil(obj.UserID) {\n\t\t\t\targs = append(args, obj.UserID)\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\tquery := NewQuery(\n\t\tqm.From(`users`),\n\t\tqm.WhereIn(`users.id in ?`, args...),\n\t)\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 User\")\n\t}\n\n\tvar resultSlice []*User\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice User\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results of eager load for users\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for users\")\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.User = foreign\n\t\tif foreign.R == nil {\n\t\t\tforeign.R = &userR{}\n\t\t}\n\t\tforeign.R.PersonI18ns = append(foreign.R.PersonI18ns, object)\n\t\treturn nil\n\t}\n\n\tfor _, local := range slice {\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif queries.Equal(local.UserID, foreign.ID) {\n\t\t\t\tlocal.R.User = foreign\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &userR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.PersonI18ns = append(foreign.R.PersonI18ns, local)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4a8700a51a549f1b1e2adc9d0b79f343", "score": "0.46430138", "text": "func GetUserByEmail(email string, full bool) (User, error) {\r\n\tvar user User\r\n\r\n\tif full {\r\n\t\te := DB.Preload(clause.Associations).First(&user, \"email = ?\", email)\r\n\t\treturn user, e.Error\r\n\t}\r\n\r\n\te := DB.First(&user, \"email = ?\", email)\r\n\treturn user, e.Error\r\n}", "title": "" }, { "docid": "85043b050113262b21f578bb20f3ed68", "score": "0.46322718", "text": "func (n *Node) UserData() interface{} {\r\n\r\n\treturn n.userData\r\n}", "title": "" }, { "docid": "f75b78da09f725dc37611ba71d14378e", "score": "0.46317077", "text": "func (api *API) ReadUsers() (*[]User, error) {\n\tdata, err := api.Get(\"/user/\")\n\treturn api.decodeUsers(data, err)\n}", "title": "" }, { "docid": "305d443fee3c09beb7a64dab7cc5474e", "score": "0.46175525", "text": "func ReadUsers(res render.Render, db *gorm.DB) {\n\tvar user User\n\tusers, err := user.GetAll(db)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(500, err)\n\t\treturn\n\t}\n\tres.JSON(200, users)\n}", "title": "" }, { "docid": "31f1525cac05b7e9214a32cc5114fa17", "score": "0.46069008", "text": "func (k Keeper) GetUserRelationships(ctx sdk.Context, user sdk.AccAddress) types.Relationships {\n\tstore := ctx.KVStore(k.StoreKey)\n\tkey := types.RelationshipsStoreKey(user)\n\n\tvar relationships types.Relationships\n\tk.Cdc.MustUnmarshalBinaryBare(store.Get(key), &relationships)\n\n\treturn relationships\n}", "title": "" }, { "docid": "0539c13873ca0588aaccc96301a7da94", "score": "0.4606443", "text": "func (g Graph) GetMe(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tlogger.Debug().Msg(\"calling get user in /me\")\n\tsanitizedPath := strings.TrimPrefix(r.URL.Path, \"/graph/v1.0/\")\n\n\todataReq, err := godata.ParseRequest(r.Context(), sanitizedPath, r.URL.Query())\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"query\", r.URL.Query()).Msg(\"could not get users: query error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tu, ok := revactx.ContextGetUser(r.Context())\n\tif !ok {\n\t\tlogger.Debug().Msg(\"could not get user: user not in context\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, \"user not in context\")\n\t\treturn\n\t}\n\n\texp, err := identity.GetExpandValues(odataReq.Query)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"query\", r.URL.Query()).Msg(\"could not get users: $expand error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tvar me *libregraph.User\n\t// We can just return the user from context unless we need to expand the group memberships\n\tif !slices.Contains(exp, \"memberOf\") {\n\t\tme = identity.CreateUserModelFromCS3(u)\n\t} else {\n\t\tvar err error\n\t\tlogger.Debug().Msg(\"calling get user on backend\")\n\t\tme, err = g.identityBackend.GetUser(r.Context(), u.GetId().GetOpaqueId(), odataReq)\n\t\tif err != nil {\n\t\t\tlogger.Debug().Err(err).Interface(\"user\", u).Msg(\"could not get user from backend\")\n\t\t\terrorcode.RenderError(w, r, err)\n\t\t\treturn\n\t\t}\n\t\tif me.MemberOf == nil {\n\t\t\tme.MemberOf = []libregraph.Group{}\n\t\t}\n\t}\n\n\t// expand appRoleAssignments if requested\n\tif slices.Contains(exp, \"appRoleAssignments\") {\n\t\tvar err error\n\t\tme.AppRoleAssignments, err = g.fetchAppRoleAssignments(r.Context(), me.GetId())\n\t\tif err != nil {\n\t\t\tlogger.Debug().Err(err).Str(\"userid\", me.GetId()).Msg(\"could not get appRoleAssignments for self\")\n\t\t\terrorcode.RenderError(w, r, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, me)\n}", "title": "" }, { "docid": "de0b64fca8b0c24ce717c40348d26924", "score": "0.46064398", "text": "func (c *Controller) ReadUserData(user interface{}) error {\n\ttoken := c.Context().Request.Token()\n\tif token == nil {\n\t\treturn errors.New(\"controller: jwt claim is empty\")\n\t}\n\n\tif reflect.TypeOf(user).Kind() != reflect.Ptr {\n\t\treturn errors.New(\"controller: ReadUserData request a pointer as argument\")\n\n\t}\n\n\treflect.ValueOf(user).Elem().Set(reflect.ValueOf(token).Elem())\n\n\treturn nil\n}", "title": "" }, { "docid": "913b6e84f920bb977ac0e6a52df9c0a4", "score": "0.4600824", "text": "func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tlogger.Debug().Msg(\"calling get user\")\n\n\tsanitizedPath := strings.TrimPrefix(r.URL.Path, \"/graph/v1.0/\")\n\n\tuserID := chi.URLParam(r, \"userID\")\n\tuserID, err := url.PathUnescape(userID)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Str(\"id\", userID).Msg(\"could not get user: unescaping user id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping user id failed\")\n\t\treturn\n\t}\n\n\tif userID == \"\" {\n\t\tlogger.Debug().Msg(\"could not get user: missing user id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing user id\")\n\t\treturn\n\t}\n\n\todataReq, err := godata.ParseRequest(r.Context(), sanitizedPath, r.URL.Query())\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"query\", r.URL.Query()).Msg(\"could not get users: query error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\texp, err := identity.GetExpandValues(odataReq.Query)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"query\", r.URL.Query()).Msg(\"could not get users: $expand error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tlogger.Debug().Str(\"id\", userID).Msg(\"calling get user from backend\")\n\tuser, err := g.identityBackend.GetUser(r.Context(), userID, odataReq)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Msg(\"could not get user: error fetching user from backend\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\tlistDrives := slices.Contains(exp, \"drives\")\n\tlistDrive := slices.Contains(exp, \"drive\")\n\n\t// do we need to list all or only the personal drive\n\tfilters := []*storageprovider.ListStorageSpacesRequest_Filter{}\n\tif listDrives || listDrive {\n\t\tfilters = append(filters, listStorageSpacesUserFilter(user.GetId()))\n\t\tif !listDrives {\n\t\t\t// TODO filter by owner when decomposedfs supports the OWNER filter\n\t\t\tfilters = append(filters, listStorageSpacesTypeFilter(\"personal\"))\n\t\t}\n\t}\n\n\tif len(filters) > 0 {\n\t\twdu, err := g.getWebDavBaseURL()\n\t\tif err != nil {\n\t\t\t// log error, wrong configuration\n\t\t\tlogger.Error().\n\t\t\t\tErr(err).\n\t\t\t\tStr(\"webdav_base\", g.config.Spaces.WebDavBase).\n\t\t\t\tStr(\"webdav_path\", g.config.Spaces.WebDavPath).\n\t\t\t\tMsg(\"error parsing webdav URL\")\n\t\t\trender.Status(r, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tlogger.Debug().Str(\"id\", user.GetId()).Msg(\"calling list storage spaces with filter\")\n\n\t\t// use the unrestricted flag to get all possible spaces\n\t\t// users with the canListAllSpaces permission should see all spaces\n\n\t\tclient, err := g.gatewaySelector.Next()\n\t\tif err != nil {\n\t\t\tlogger.Error().Err(err).Msg(\"error selecting next gateway client\")\n\t\t\trender.Status(r, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\topaque := utils.AppendPlainToOpaque(nil, \"unrestricted\", \"T\")\n\t\tlspr, err := client.ListStorageSpaces(r.Context(), &storageprovider.ListStorageSpacesRequest{\n\t\t\tOpaque: opaque,\n\t\t\tFilters: filters,\n\t\t})\n\t\tif err != nil {\n\t\t\t// transport error, needs to be fixed by admin\n\t\t\tlogger.Error().Err(err).Interface(\"query\", r.URL.Query()).Msg(\"error getting storages: transport error\")\n\t\t\trender.Status(r, http.StatusInternalServerError)\n\t\t\trender.JSON(w, r, user)\n\t\t\treturn\n\t\t}\n\t\tif lspr.GetStatus().GetCode() != cs3rpc.Code_CODE_OK {\n\t\t\tlogger.Debug().Str(\"grpc\", lspr.GetStatus().GetMessage()).Msg(\"could not list drives for user\")\n\t\t\t// in case of NOT_OK, we can just return the user object with empty drives\n\t\t\trender.Status(r, status.HTTPStatusFromCode(http.StatusOK))\n\t\t\trender.JSON(w, r, user)\n\t\t\treturn\n\t\t}\n\t\tif listDrives {\n\t\t\tuser.Drives = make([]libregraph.Drive, 0, len(lspr.GetStorageSpaces()))\n\t\t}\n\t\tif listDrive {\n\t\t\tuser.Drive = &libregraph.Drive{}\n\t\t}\n\t\tfor _, sp := range lspr.GetStorageSpaces() {\n\t\t\td, err := g.cs3StorageSpaceToDrive(r.Context(), wdu, sp)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Debug().Err(err).Interface(\"id\", sp.Id).Msg(\"error converting space to drive\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tquota, err := g.getDriveQuota(r.Context(), sp)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Debug().Err(err).Interface(\"id\", sp.Id).Msg(\"error calling get quota on drive\")\n\t\t\t}\n\t\t\td.Quota = &quota\n\t\t\tif d.GetDriveType() == \"personal\" && sp.GetOwner().GetId().GetOpaqueId() == user.GetId() {\n\t\t\t\tif listDrive {\n\t\t\t\t\tuser.Drive = d\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif listDrives {\n\t\t\t\t\tuser.Drives = append(user.Drives, *d)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// expand appRoleAssignments if requested\n\tif slices.Contains(exp, \"appRoleAssignments\") {\n\t\tuser.AppRoleAssignments, err = g.fetchAppRoleAssignments(r.Context(), user.GetId())\n\t\tif err != nil {\n\t\t\tlogger.Debug().Err(err).Str(\"userid\", user.GetId()).Msg(\"could not get appRoleAssignments for user\")\n\t\t\terrorcode.RenderError(w, r, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, user)\n}", "title": "" }, { "docid": "802c0322c05b00111de645271a279aee", "score": "0.45992935", "text": "func (s Serializer) ReadFromStorage(key string, storage *ss.SecureStorage) (interface{}, error) {\n\tvar user AmUserInfo\n\n\tif storage == nil {\n\t\treturn nil, fmt.Errorf(\"Error: can't read AM property from storage, storage is nil\")\n\t}\n\tvalue, exist := storage.Data[key]\n\tif exist == false {\n\t\treturn nil, fmt.Errorf(\"Error: key '%v' was not found\", key)\n\t}\n\terr := json.Unmarshal([]byte(value), &user)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user, nil\n}", "title": "" }, { "docid": "d829e963639511a3c7a115ad9fd2340b", "score": "0.45985782", "text": "func (c *CanvasClient) GetUserProfile(userID int64) (*User, error) {\n\tprofile := User{}\n\n\trequestURL := fmt.Sprintf(\"%s/api/v1/users/%d/profile\", c.ClientURL(), userID)\n\terr := c.getJSON(requestURL, &profile)\n\n\tif err != nil {\n\t\treturn &profile, err\n\t}\n\n\treturn &profile, nil\n}", "title": "" }, { "docid": "fc34229969f166cacbe56a873a656c8d", "score": "0.45967895", "text": "func (obj *User) Get(ormObj *orm.User, id uint64) error {\n\treturn ormObj.Get(ormObj, id)\n}", "title": "" }, { "docid": "06886803f1ec08c20e41628f1069632c", "score": "0.459081", "text": "func (c *ExpertiseClient) QueryExpertiseUser(e *Expertise) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := e.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(expertise.Table, expertise.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, expertise.ExpertiseUserTable, expertise.ExpertiseUserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(e.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "3e5b31135e97ab6a4c379f660cbb28df", "score": "0.45883027", "text": "func ReadUserByEmail(ctx context.Context, identity string) (*User, error) {\n\tidentity = strings.ToLower(strings.TrimSpace(identity))\n\tif len(identity) < 3 {\n\t\treturn nil, nil\n\t}\n\n\tvar user *User\n\terr := session.Database(ctx).RunInTransaction(ctx, func(tx pgx.Tx) error {\n\t\tvar err error\n\t\tuser, err = findUserByIdentity(ctx, tx, identity)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, session.TransactionError(ctx, err)\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "919f28355f87c9d046aef445738ace67", "score": "0.45870703", "text": "func UserFromProps(props map[string]interface{}) *User {\n\tif props == nil {\n\t\treturn nil\n\t}\n\n\tuser := &User{}\n\tdb.UnmarshalNeoFields(user, props)\n\treturn user\n}", "title": "" }, { "docid": "d38921d47be4b50a42d92688898381eb", "score": "0.45840293", "text": "func UserGet(c *fiber.Ctx) {\n\tuser := &models.User{\n\t\tID: 1,\n\t\tFirstName: \"John\",\n\t\tLastName: \"Doe\",\n\t}\n\tc.JSON(fiber.Map{\n\t\t\"success\": true,\n\t\t\"user\": user,\n\t})\n}", "title": "" }, { "docid": "9f33e76983c9cf253675e73a1a5bb576", "score": "0.45830163", "text": "func (this *Body) GetUserData() interface{} {\n\treturn this.userData\n}", "title": "" }, { "docid": "6df3c65b166ab48237c06cc25a37c1cd", "score": "0.45762286", "text": "func GetObject(e ld.Entity) interface{} { return e.Get(Prop_Object.ID) }", "title": "" }, { "docid": "115735ba61a5fb06d4b9285721206ed8", "score": "0.45745394", "text": "func GetUser(ctx iris.Context) {\n\t//Estructura vacia donde se gurdarán los datos\n\tusers := []models.User{}\n\n\t// Se obtiene el parametro id de la URL\n\t//id := ctx.Params().GetUint64Default(\"id\", 0)\n\n\t//Conexión a la DB\n\t//db := db.GetConnection()\n\n\t//Se codifican los datos a formato JSON\n\tj, _ := json.Marshal(users)\n\t// Se envian los datos\n\tresponse.SendResponse(ctx, http.StatusOK, j)\n\n\t// Si no existe se envia un error 404\n\tlog.Println(users)\n\t//response.SendErr(ctx, http.StatusNotFound)\n\n}", "title": "" }, { "docid": "3901a407aee6817c25dbbe0bcae0c158", "score": "0.45715863", "text": "func (m *DeviceManagement) GetUserExperienceAnalyticsOverview()(UserExperienceAnalyticsOverviewable) {\n val, err := m.GetBackingStore().Get(\"userExperienceAnalyticsOverview\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(UserExperienceAnalyticsOverviewable)\n }\n return nil\n}", "title": "" }, { "docid": "17706079dbd42a3cae7b665ccad699d4", "score": "0.45703173", "text": "func (_Identity *IdentityCallerSession) GetAcademicDetails(studentId string) (IdentityAcademicDetailsI, error) {\n\treturn _Identity.Contract.GetAcademicDetails(&_Identity.CallOpts, studentId)\n}", "title": "" }, { "docid": "1c0203a0041bdbf1aefbca46d35c4502", "score": "0.45659474", "text": "func GetUser(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {\n\tvar resource User\n\terr := ctx.ReadResource(\"linode:index/user:User\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "3ba9ad03c243719f63532417b447ed44", "score": "0.45644742", "text": "func (h *ResultHelper) getProfiles(obj *unstructured.Unstructured) ([]interface{}, error) {\n\tprofs, found, err := unstructured.NestedSlice(obj.Object, \"profiles\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to get profiles of %s/%s of type %s: %s\", obj.GetNamespace(), obj.GetName(), \"ComplianceCheckResult\", err)\n\t}\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"%s/%s of type %s: has no 'profiles'\", obj.GetNamespace(), obj.GetName(), \"Profile\")\n\t}\n\treturn profs, nil\n}", "title": "" }, { "docid": "6cf0a492c0ec5c8194d1cd8195a39ad9", "score": "0.45640615", "text": "func Get(ctx *aero.Context) string {\n\tnick := ctx.Get(\"nick\")\n\tviewUser, err := arn.GetUserByNick(nick)\n\n\tif err != nil {\n\t\treturn ctx.Error(404, \"User not found\", err)\n\t}\n\n\treturn Profile(ctx, viewUser)\n}", "title": "" }, { "docid": "9df82068fd6f38944da321e2a30b3d56", "score": "0.45638573", "text": "func (m *DeviceManagement) GetAppleUserInitiatedEnrollmentProfiles()([]AppleUserInitiatedEnrollmentProfileable) {\n val, err := m.GetBackingStore().Get(\"appleUserInitiatedEnrollmentProfiles\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AppleUserInitiatedEnrollmentProfileable)\n }\n return nil\n}", "title": "" }, { "docid": "b88cd67e1d4e98ecca586cc4303b9059", "score": "0.4560548", "text": "func (_Expertise *ExpertiseSession) GetAchievements(user common.Address, category string) ([][32]byte, [][32]byte, [][32]byte, []*big.Int, [][32]byte, error) {\n\treturn _Expertise.Contract.GetAchievements(&_Expertise.CallOpts, user, category)\n}", "title": "" }, { "docid": "8a80759124179d3798c6330a26b392c7", "score": "0.45602724", "text": "func (store Manager) GetTOTPEnrollment(userName string) (TotpEnrollment, error) {\n\t//\tOur return item\n\tenrollment := TotpEnrollment{}\n\n\t//\tFirst, make sure we can look up the user's enrollment:\n\terr := store.systemdb.View(func(txn *badger.Txn) error {\n\t\titem, err := txn.Get(GetKey(\"TotpEnrollment\", userName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval, err := item.Value()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(val) > 0 {\n\t\t\t//\tUnmarshal data into our item\n\t\t\tif err := json.Unmarshal(val, &enrollment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\t//\tIf we got an error, we have a problem:\n\tif err != nil {\n\t\treturn enrollment, fmt.Errorf(\"Enrollment not found\")\n\t}\n\n\t//\tReturn our data:\n\treturn enrollment, nil\n}", "title": "" }, { "docid": "1a68ae33b408adff98dafaca7fc14fc8", "score": "0.4559535", "text": "func (paymentL) LoadUser(ctx context.Context, e boil.ContextExecutor, singular bool, maybePayment interface{}, mods queries.Applicator) error {\n\tvar slice []*Payment\n\tvar object *Payment\n\n\tif singular {\n\t\tobject = maybePayment.(*Payment)\n\t} else {\n\t\tslice = *maybePayment.(*[]*Payment)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &paymentR{}\n\t\t}\n\t\tif !queries.IsNil(object.UserID) {\n\t\t\targs = append(args, object.UserID)\n\t\t}\n\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &paymentR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif queries.Equal(a, obj.UserID) {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !queries.IsNil(obj.UserID) {\n\t\t\t\targs = append(args, obj.UserID)\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\tquery := NewQuery(qm.From(`users`), qm.WhereIn(`users.id in ?`, args...))\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.QueryContext(ctx, e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load User\")\n\t}\n\n\tvar resultSlice []*User\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice User\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results of eager load for users\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for users\")\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.User = foreign\n\t\tif foreign.R == nil {\n\t\t\tforeign.R = &userR{}\n\t\t}\n\t\tforeign.R.Payments = append(foreign.R.Payments, object)\n\t\treturn nil\n\t}\n\n\tfor _, local := range slice {\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif queries.Equal(local.UserID, foreign.ID) {\n\t\t\t\tlocal.R.User = foreign\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &userR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Payments = append(foreign.R.Payments, local)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3ab9f85b220821344e8d7e42a22e8c47", "score": "0.45531216", "text": "func (ms *dbStorage) getUser(email string) (*atium.UserDetails, error) {\n\tqs := fmt.Sprintf(\"%s %s %s %s\",\n\t\t\"SELECT U.id, U.name, U.dob, U.gender, U.created_at,\",\n\t\t\"C.address, C.primary_ph, C.secondary_ph FROM user U\",\n\t\t\"LEFT JOIN contact C ON C.email = U.email\",\n\t\t\"WHERE U.email = ?\")\n\n\tvar address string\n\tvar id int64\n\tu := atium.UserDetails{}\n\trow := ms.db.QueryRow(qs, email)\n\tu.Email = email\n\terr := row.Scan(&id, &u.Name, &u.Dob, &u.Gender, &u.CreatedAt,\n\t\t&address, &u.PrimaryPh, &u.SecondaryPh)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"user not found: %v\", err)\n\t}\n\terr = json.Unmarshal([]byte(address), &u.Address)\n\tif err != nil {\n\t\tfmt.Printf(\"unmarshalling address failed: %v\", err)\n\t\tfmt.Println(address)\n\t}\n\tstats, err := getLatestStats(ms.db, id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"err getting stats: %v\", err)\n\t}\n\tu.Stats = *stats\n\treturn &u, err\n}", "title": "" } ]
fdb8ad113b424597146f3969bc65d757
scanValues returns the types for scanning values from sql.Rows.
[ { "docid": "da0d74079adc5a924ab4d7b337266e11", "score": "0.0", "text": "func (*Subject) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // code\n\t\t&sql.NullString{}, // subjects\n\t\t&sql.NullInt64{}, // creditpiont\n\t}\n}", "title": "" } ]
[ { "docid": "71da1cbaea58b50aca91b82073e902a9", "score": "0.7774115", "text": "func (*BloodType) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase bloodtype.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase bloodtype.FieldBlood:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type BloodType\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "69daf03a15773932b77a3ef3910af918", "score": "0.76761186", "text": "func (*Status) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase status.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase status.FieldStatusname:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Status\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "a567e3349aedfb82e500eca25d5ab391", "score": "0.7674737", "text": "func (*Game) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase game.FieldEvents:\n\t\t\tvalues[i] = &[]byte{}\n\t\tcase game.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase game.FieldCreatedAt:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Game\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "55522949a81de0b68ac624b850a82fca", "score": "0.7665125", "text": "func (*Agentkyc) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase agentkyc.FieldID, agentkyc.FieldFileimportID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase agentkyc.FieldKYCDate, agentkyc.FieldKYCTime, agentkyc.FieldAgentID, agentkyc.FieldAgentemail, agentkyc.FieldAgentNameLastname, agentkyc.FieldKYCStatus, agentkyc.FieldConsumerwalletid, agentkyc.FieldKYCRespond, agentkyc.FieldDOPARespond, agentkyc.FieldAgentType:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Agentkyc\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "78873097fa67e45a44bbae6ae2d96073", "score": "0.7646554", "text": "func (*Like) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase like.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase like.FieldUserID:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase like.ForeignKeys[0]: // restaurant_likes\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Like\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "08c20cec8f363ab49506101ba266078c", "score": "0.7641563", "text": "func (*Typeproduct) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Typeproduct\n\t}\n}", "title": "" }, { "docid": "8e1df3af00068a5d0154ce49a6390d3a", "score": "0.7595643", "text": "func (*Reportwallettb) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase reportwallettb.FieldID, reportwallettb.FieldGroupUser:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase reportwallettb.FieldWalletid, reportwallettb.FieldWalletTypeName, reportwallettb.FieldWalletPhoneno, reportwallettb.FieldWalletName, reportwallettb.FieldCitizenId, reportwallettb.FieldStatus, reportwallettb.FieldUserAgent, reportwallettb.FieldATMCard, reportwallettb.FieldAccountNo, reportwallettb.FieldAddressDetail, reportwallettb.FieldStreet, reportwallettb.FieldDistrict, reportwallettb.FieldSubDistrict, reportwallettb.FieldProvince, reportwallettb.FieldPostalCode, reportwallettb.FieldIsKYC:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase reportwallettb.FieldRegisterDate, reportwallettb.FieldKYCDate, reportwallettb.FieldUpdateDate:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Reportwallettb\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "a555813fe7c6e44f05c9e6f05143e8aa", "score": "0.7559636", "text": "func (*Dentalappointment) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase dentalappointment.FieldID, dentalappointment.FieldAmount, dentalappointment.FieldPrice:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase dentalappointment.FieldNote:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase dentalappointment.FieldAppointtime:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase dentalappointment.ForeignKeys[0]: // kindname\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase dentalappointment.ForeignKeys[1]: // _Patient_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase dentalappointment.ForeignKeys[2]: // _Personnel_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Dentalappointment\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "bcd4d999a5a2122608d6391b150b8a8a", "score": "0.7530704", "text": "func (*User) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase user.FieldID, user.FieldAge:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase user.FieldLastName, user.FieldFirstName, user.FieldProfile, user.FieldEmail, user.FieldPassword:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase user.FieldUUID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type User\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "d4dd0417a73ccafa6b22e542dcac980c", "score": "0.75289375", "text": "func (*Category) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase category.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase category.FieldName, category.FieldDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase category.FieldCreatedAt, category.FieldModifiedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Category\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "3af24b2d9d4e6822f32687bc64e15a75", "score": "0.75108373", "text": "func (*User) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase user.FieldData:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase user.FieldIsSuper:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase user.FieldID, user.FieldParentID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase user.FieldTenant, user.FieldUUID:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase user.FieldCreatedAt, user.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type User\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "05e778f760a6a24be50babc72ceec84d", "score": "0.75045824", "text": "func (*Summary) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase summary.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase summary.FieldTitle:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Summary\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "f5146011a596a0e041652e5207aae4a8", "score": "0.7481906", "text": "func (*Bag) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase bag.FieldName, bag.FieldIcon:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase bag.FieldID, bag.FieldUserID:\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Bag\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "66b9b375e354336affac3186379ad063", "score": "0.74792767", "text": "func (*SurveyCellScan) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullInt64{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullInt64{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullInt64{},\n\t\t&sql.NullInt64{},\n\t\t&sql.NullInt64{},\n\t\t&sql.NullFloat64{},\n\t\t&sql.NullFloat64{},\n\t}\n}", "title": "" }, { "docid": "a79c40e11ce00613ea0e4c03cb7810f1", "score": "0.747553", "text": "func (*Variant) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase variant.FieldPrice:\n\t\t\tvalues[i] = &sql.NullFloat64{}\n\t\tcase variant.FieldCode, variant.FieldName:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase variant.FieldID:\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tcase variant.ForeignKeys[0]: // product_variants\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Variant\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "e7c8877ce9e7ec2ee94d9b4c465ed684", "score": "0.7463598", "text": "func (*User) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase user.FieldGender:\n\t\t\tvalues[i] = new(schema.Gender)\n\t\tcase user.FieldRemindMe:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase user.FieldWeight:\n\t\t\tvalues[i] = new(sql.NullFloat64)\n\t\tcase user.FieldID, user.FieldDailyIntake, user.FieldContainerVolume, user.FieldDrinkAtATime:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase user.FieldUsername, user.FieldAvatar, user.FieldContainerImage, user.FieldPassword:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldWakeUpTime, user.FieldSleepTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type User\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b7899dc6724bb9bed414b3fafe7cb2d6", "score": "0.74450284", "text": "func (*Variant) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // type\n\t\t&sql.NullString{}, // value\n\t}\n}", "title": "" }, { "docid": "97331f2a16d8b7e4e5712780ff136195", "score": "0.7436181", "text": "func (*Media) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase media.FieldDatamedia:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase media.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase media.FieldNomemedia, media.FieldMimemedia:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase media.FieldCreationdatemedia:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Media\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "cec58608cfc48e217ca221980ae8131b", "score": "0.7414354", "text": "func (*User) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase user.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase user.FieldUsername, user.FieldFullname, user.FieldPassword, user.FieldEmail, user.FieldPhone, user.FieldBio, user.FieldIntro, user.FieldGithubProfile, user.FieldProfilePictureURL, user.FieldStatus:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase user.FieldCreatedAt, user.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type User\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "c329f5a9f67f94cdac36a69b17477584", "score": "0.7391902", "text": "func (*Notice) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase notice.FieldID, notice.FieldNoticeType, notice.FieldUserId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase notice.FieldContent:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase notice.FieldCreateTime, notice.FieldUpdateTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Notice\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "ebefd3f9f71f068fa81d82da864cb4a1", "score": "0.73830444", "text": "func (*Patientrecord) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Name\n\t\t&sql.NullInt64{}, // Idcardnumber\n\t\t&sql.NullInt64{}, // Age\n\t\t&sql.NullString{}, // Bloodtype\n\t\t&sql.NullString{}, // Disease\n\t\t&sql.NullString{}, // Allergic\n\t\t&sql.NullString{}, // Phonenumber\n\t\t&sql.NullString{}, // Email\n\t\t&sql.NullString{}, // Home\n\t\t&sql.NullTime{}, // Date\n\t}\n}", "title": "" }, { "docid": "f23849e9873813dc8c64383cb8bac971", "score": "0.73779845", "text": "func (*User) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase user.FieldAdmin:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase user.FieldName, user.FieldDisplayName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase user.FieldID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type User\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "9849aeca6f597543cfe057d57ba7e69e", "score": "0.7368365", "text": "func (*Physicaltherapyroom) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase physicaltherapyroom.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase physicaltherapyroom.FieldPhysicaltherapyroomname:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Physicaltherapyroom\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "127a5f18a312cf9696b8bdbec4a9f832", "score": "0.733859", "text": "func (*TemplateTagRelation) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase templatetagrelation.FieldID, templatetagrelation.FieldStatus:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase templatetagrelation.FieldTemplateUUID, templatetagrelation.FieldTagUUID:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase templatetagrelation.FieldCreatedAt, templatetagrelation.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type TemplateTagRelation\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "8c82a1c271bdcb7f6e12ef27a7525964", "score": "0.73343664", "text": "func (*OAuthConnection) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase oauthconnection.FieldID, oauthconnection.FieldCreatedBy, oauthconnection.FieldUpdatedBy:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase oauthconnection.FieldCreatedWith, oauthconnection.FieldUpdatedWith, oauthconnection.FieldProvider, oauthconnection.FieldProviderUserID, oauthconnection.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase oauthconnection.FieldCreatedAt, oauthconnection.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase oauthconnection.ForeignKeys[0]: // user_oauth_connections\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type OAuthConnection\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b8bd976a5c2cd5d75c106f4f9622b040", "score": "0.732993", "text": "func (*Product) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase product.FieldID, product.FieldVersionId, product.FieldProductId, product.FieldPrice:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase product.FieldVersionName, product.FieldProductName, product.FieldAttr, product.FieldProductDesc:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase product.FieldAddtime, product.FieldMtime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Product\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "483fa36303cb34b2d7fe5d8029ac5ec3", "score": "0.731654", "text": "func (*Other) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase other.FieldID:\n\t\t\tvalues[i] = new(sid.ID)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Other\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "53fc138903ac31bdc1c417384deccea6", "score": "0.7310612", "text": "func (*DChessdbCache) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase dchessdbcache.FieldResp:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase dchessdbcache.FieldID, dchessdbcache.FieldBoard:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase dchessdbcache.FieldCreateTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type DChessdbCache\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4d0930ad3d81f5bdb71e10fcb7985e73", "score": "0.729182", "text": "func (*CompanyUser) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase companyuser.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase companyuser.FieldLastName, companyuser.FieldFirstName, companyuser.FieldLastNameFurigana, companyuser.FieldFirstNameFurigana, companyuser.FieldProfileName, companyuser.FieldIconURL, companyuser.FieldGender:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type CompanyUser\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "c8c76a6171e1ef7bdf659b5e779994d8", "score": "0.7279974", "text": "func (*History) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase history.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase history.FieldIP, history.FieldCity, history.FieldRegion:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase history.FieldLoginTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type History\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "0240b54b80155050504108be3a1066a7", "score": "0.72656876", "text": "func (*K8sObjectTag) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase k8sobjecttag.FieldID, k8sobjecttag.FieldK8sObjectId, k8sobjecttag.FieldK8sLabelId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase k8sobjecttag.FieldCreatedAt, k8sobjecttag.FieldUpdatedAt, k8sobjecttag.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type K8sObjectTag\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "1a5a00d4af9cd9b341e27a2f0c6a6ace", "score": "0.724288", "text": "func (*Demo) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // code\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // memo\n\t\t&sql.NullInt64{}, // status\n\t\t&sql.NullString{}, // creator\n\t\t&sql.NullString{}, // updator\n\t\t&sql.NullTime{}, // created_at\n\t\t&sql.NullTime{}, // updated_at\n\t}\n}", "title": "" }, { "docid": "1a9a0701ff9525270a222d5e2223d609", "score": "0.7238232", "text": "func (*Transaction) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase transaction.FieldReversal, transaction.FieldReversed:\n\t\t\tvalues[i] = &sql.NullBool{}\n\t\tcase transaction.FieldExecutedAmount, transaction.FieldExchangeRate, transaction.FieldOriginatingAmount, transaction.FieldRunningBalance, transaction.FieldLatitude, transaction.FieldLongitude:\n\t\t\tvalues[i] = &sql.NullFloat64{}\n\t\tcase transaction.FieldSequenceInDay:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase transaction.FieldStatus, transaction.FieldExecutedCurrencyCode, transaction.FieldOriginatingCurrencyCode, transaction.FieldDirection, transaction.FieldDescription, transaction.FieldMemo, transaction.FieldGroup, transaction.FieldType, transaction.FieldMainCategory, transaction.FieldSubCategory, transaction.FieldCheckNumber, transaction.FieldMerchantCode, transaction.FieldReversalFor, transaction.FieldReversedBy, transaction.FieldURL:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase transaction.FieldCreatedDate, transaction.FieldPostedDate, transaction.FieldExecutedDate, transaction.FieldUpdatedDate:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase transaction.FieldID:\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tcase transaction.ForeignKeys[0]: // account_transactions\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Transaction\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "9580f2eb8b57216639420dcb32ba38f4", "score": "0.7225234", "text": "func (*UserLog) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase userlog.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase userlog.FieldIP, userlog.FieldRemark:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase userlog.FieldCreateAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase userlog.ForeignKeys[0]: // user_user_logs\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type UserLog\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "5e01155f2405a6e1754bf7186c831993", "score": "0.72081816", "text": "func (*OutcomeCategory) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase outcomecategory.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase outcomecategory.FieldOutcomeCategoryTitle:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase outcomecategory.ForeignKeys[0]: // outcome_class_outcome_category_list\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type OutcomeCategory\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "dc9fabdc5e663706f664f098d451de5d", "score": "0.718588", "text": "func (*Patient) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // patient_ID\n\t\t&sql.NullString{}, // patient_name\n\t\t&sql.NullString{}, // patient_cardID\n\t\t&sql.NullString{}, // patient_address\n\t\t&sql.NullString{}, // patient_tel\n\t\t&sql.NullInt64{}, // patient_age\n\t\t&sql.NullTime{}, // patient_birthday\n\t}\n}", "title": "" }, { "docid": "7386e60095b3b7c0443bc725aedebd17", "score": "0.71811277", "text": "func (*Blog) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase blog.FieldID, blog.FieldOid:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Blog\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b05ae3d4b25cbcff49d58bec94e097e0", "score": "0.7178911", "text": "func (*Order) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase order.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Order\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "5dc3326e95a062aa91fd3fd6bf3c037d", "score": "0.7156038", "text": "func (*ServicePoint) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // COUNTER_NUMBER\n\t}\n}", "title": "" }, { "docid": "fd78cb07a462f5efb59e79dc3727edf3", "score": "0.7146452", "text": "func (*MessageWithID) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase messagewithid.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type MessageWithID\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "7cb2be3c84eb421be2156f787db6cf85", "score": "0.713185", "text": "func (*Todo) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullString{},\n\t}\n}", "title": "" }, { "docid": "050b63184f51fa1a8d789b1a007e7ec5", "score": "0.7121954", "text": "func (*Tool) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase tool.FieldPowered:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase tool.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase tool.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase tool.FieldCreateTime, tool.FieldUpdateTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase tool.ForeignKeys[0]: // category_tool\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase tool.ForeignKeys[1]: // location_tool\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Tool\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "0a2c40cb5b637c5795f53436289d5177", "score": "0.7111617", "text": "func (*Equipment) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t}\n}", "title": "" }, { "docid": "bf5b76bc94c70a09ee18ec8aaaf119cf", "score": "0.7107739", "text": "func (*FlowGroup) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase flowgroup.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase flowgroup.FieldFlowGroupID, flowgroup.FieldFlowGroupTitle, flowgroup.FieldFlowGroupDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase flowgroup.ForeignKeys[0]: // participant_flow_module_flow_group_list\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type FlowGroup\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "fbfa75bf121eb039d9f4b5284f083ee1", "score": "0.71051055", "text": "func (*MessageWithEnum) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase messagewithenum.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase messagewithenum.FieldEnumType, messagewithenum.FieldEnumWithoutDefault:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type MessageWithEnum\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "2e67b22062d8002fb5631a58550258c5", "score": "0.7089207", "text": "func (*TradeTimeRange) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase tradetimerange.FieldID, tradetimerange.FieldIntervalID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase tradetimerange.FieldStart, tradetimerange.FieldEnd:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type TradeTimeRange\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "66ff38781c4c7cb9b8bd853d4716cc2d", "score": "0.708325", "text": "func (*Message) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase message.FieldID, message.FieldFrom, message.FieldSessionType, message.FieldServerMsgSeq, message.FieldMsgType, message.FieldMsgResCode, message.FieldMsgFeature, message.FieldMsgStatus, message.FieldCreateTime:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase message.FieldSessionKey, message.FieldTo, message.FieldClientMsgID, message.FieldMsgData:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase message.FieldCreated, message.FieldUpdated:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Message\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "f3eec1751641887dc5ec82802069b86b", "score": "0.7083225", "text": "func (*Drug) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // DrugType\n\t\t&sql.NullInt64{}, // Strength\n\t\t&sql.NullString{}, // Information\n\t}\n}", "title": "" }, { "docid": "6c63e32f00362ed398f73666d94aef0f", "score": "0.70816565", "text": "func (*Address) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase address.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase address.FieldName, address.FieldMobile, address.FieldAddress, address.FieldPostCode:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase address.FieldCreatedAt, address.FieldUpdatedAt:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase address.ForeignKeys[0]: // user_addresses\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Address\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "82df6bde3015387933888db8a023b4a6", "score": "0.7072549", "text": "func (*BarGroup) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase bargroup.FieldID, bargroup.FieldCount, bargroup.FieldTimeRangeID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase bargroup.FieldFirst, bargroup.FieldLast:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type BarGroup\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "2426fbb44161637c1cadfbd324524056", "score": "0.7061555", "text": "func (*Task) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase enttask.FieldPriorities:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase enttask.FieldID, enttask.FieldPriority:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase enttask.FieldCreatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Task\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "d07c6949e994b42110f53d5dfb99b028", "score": "0.7058883", "text": "func (*Doc) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase doc.FieldID:\n\t\t\tvalues[i] = new(schema.DocID)\n\t\tcase doc.FieldText:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase doc.ForeignKeys[0]: // doc_children\n\t\t\tvalues[i] = &sql.NullScanner{S: new(schema.DocID)}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Doc\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "2e3cdf59c13f1cd0951ffae1752d2f1e", "score": "0.70537835", "text": "func (*ItemDescription) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase itemdescription.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase itemdescription.FieldDescription:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase itemdescription.ForeignKeys[0]: // item_item_description\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type ItemDescription\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "5c319b83c48a430b0bc5344c7c02a9fa", "score": "0.70489705", "text": "func (*ObjectType) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // kind\n\t\t&sql.NullString{}, // description\n\t}\n}", "title": "" }, { "docid": "f393134343777bc67eaf74ac4a67e41f", "score": "0.7030774", "text": "func (*Pointpendingkyctransaction) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase pointpendingkyctransaction.FieldStatusExport:\n\t\t\tvalues[i] = &sql.NullBool{}\n\t\tcase pointpendingkyctransaction.FieldID, pointpendingkyctransaction.FieldPoint:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase pointpendingkyctransaction.FieldWalletId, pointpendingkyctransaction.FieldNote, pointpendingkyctransaction.FieldKYCDate:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase pointpendingkyctransaction.FieldDateExport, pointpendingkyctransaction.FieldDateGen:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Pointpendingkyctransaction\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "162ff2d56854d853899b95794b77fe96", "score": "0.70251787", "text": "func (*WorkOrder) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullInt64{},\n\t}\n}", "title": "" }, { "docid": "0a3bf7628b12e902bf64e4e884c5053e", "score": "0.7020487", "text": "func (*Repairinvoice) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // bequipment\n\t\t&sql.NullString{}, // emtell\n\t\t&sql.NullInt64{}, // num\n\t}\n}", "title": "" }, { "docid": "d06c6997e2a28ea56506ca79414b9890", "score": "0.69943434", "text": "func (*User) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // field1\n\t\t&sql.NullString{}, // field2\n\t\t&sql.NullString{}, // field3\n\t\t&sql.NullString{}, // first_name\n\t\t&sql.NullString{}, // last_name\n\t}\n}", "title": "" }, { "docid": "98d49249bc30e6d5d2ca36f305b68a81", "score": "0.6992824", "text": "func (*DrugAllergy) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t}\n}", "title": "" }, { "docid": "06c55f2d4e01b5de2b22fb25c29edc22", "score": "0.69603276", "text": "func (*ProfileUKM) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // reason\n\t}\n}", "title": "" }, { "docid": "6447ab8801414e42a25008694e907042", "score": "0.6943275", "text": "func (*Location) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase location.FieldCoords:\n\t\t\tvalues[i] = new(schema.Point)\n\t\tcase location.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase location.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase location.ForeignKeys[0]: // location_children\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Location\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "fa0b05e702cfadbf81bc91fbef50f7d9", "score": "0.6940696", "text": "func (*RecommendationsCategory) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // name\n\t}\n}", "title": "" }, { "docid": "dc4445f9e602f280a8603d43c69154af", "score": "0.69225746", "text": "func (*Adult) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // Amount\n\t}\n}", "title": "" }, { "docid": "57a5abdbbb7e3b7fae3fa27d1569edaf", "score": "0.6889725", "text": "func (*Diagnosis) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // DiagnosticMessages\n\t\t&sql.NullString{}, // SurveillancePeriod\n\t\t&sql.NullString{}, // DiagnosisDate\n\t}\n}", "title": "" }, { "docid": "05c6251ec404e31ac52b44c7dbba0748", "score": "0.6877018", "text": "func (*Review) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // write_at\n\t\t&sql.NullString{}, // title\n\t\t&sql.NullString{}, // contents\n\t\t&sql.NullBool{}, // is_delete\n\t}\n}", "title": "" }, { "docid": "a2f6117a6b5f59d73f1a7dcb8238b045", "score": "0.68728167", "text": "func (*Bill) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // amount\n\t\t&sql.NullString{}, // annotation\n\t\t&sql.NullString{}, // payer\n\t}\n}", "title": "" }, { "docid": "42282a321e4a768934b66ecf7910d363", "score": "0.68646514", "text": "func (*Branch) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase branch.FieldLatitude, branch.FieldLongitude:\n\t\t\tvalues[i] = &sql.NullFloat64{}\n\t\tcase branch.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase branch.FieldBranchCode, branch.FieldStreetNumber, branch.FieldStreetName, branch.FieldCity, branch.FieldState, branch.FieldZip:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase branch.ForeignKeys[0]: // bank_branches\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Branch\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b191da9e11b3decf5f6f9a247926fbc8", "score": "0.6849961", "text": "func (*Project) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t}\n}", "title": "" }, { "docid": "1a6fe966cfb6ba15847778e81e12552c", "score": "0.683538", "text": "func (*JobHistory) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase jobhistory.FieldID, jobhistory.FieldCreateByUser:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase jobhistory.FieldJobEntryLeaveType:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase jobhistory.FieldCreateTime, jobhistory.FieldDate:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase jobhistory.ForeignKeys[0]: // user_job_histories\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type JobHistory\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4ffb560043e8b3e1878711c31294f188", "score": "0.68132", "text": "func (*Post) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase post.FieldPublic:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase post.FieldID, post.FieldViewCount:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase post.FieldSlug, post.FieldTitle, post.FieldContent, post.FieldContentHTML, post.FieldSummary:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase post.FieldCreateTime, post.FieldUpdateTime, post.FieldPublishedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase post.ForeignKeys[0]: // user_posts\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "7a55c8beb742ce72761c7f5e5eafc6b7", "score": "0.68031865", "text": "func (*Statusd) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // statusdname\n\t}\n}", "title": "" }, { "docid": "feb20b08c3c8fa1496bfb9a83ac7cefd", "score": "0.68028057", "text": "func (*Book) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // book_id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // description\n\t\t&sql.NullBool{}, // public\n\t\t&sql.NullTime{}, // created_at\n\t}\n}", "title": "" }, { "docid": "f8bb77447f38511a5b00c833c58ef59a", "score": "0.67652637", "text": "func (*Template) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullString{}, // id\n\t\t&sql.NullTime{}, // created_at\n\t\t&sql.NullTime{}, // updated_at\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // selectionType\n\t\t&sql.NullInt64{}, // participantCount\n\t\t&[]byte{}, // internalCriteria\n\t\t&[]byte{}, // mturkCriteria\n\t\t&sql.NullBool{}, // adult\n\t\t&sql.NullBool{}, // sandbox\n\t}\n}", "title": "" }, { "docid": "e325b8154eecbfe6ebdc63cd7da8f77d", "score": "0.67651486", "text": "func (*Merchant) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // uuid\n\t\t&sql.NullString{}, // dba\n\t}\n}", "title": "" }, { "docid": "ad30d03bcd49ca86cadd23910db89088", "score": "0.6758783", "text": "func (*VarRef) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase varref.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase varref.FieldID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tcase varref.ForeignKeys[0]: // instance_vars\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tcase varref.ForeignKeys[1]: // namespace_vars\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tcase varref.ForeignKeys[2]: // var_data_varrefs\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tcase varref.ForeignKeys[3]: // workflow_vars\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type VarRef\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "fbc447815f36b85b083546666f5e5890", "score": "0.6733901", "text": "func (*Group) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // nickname\n\t\t&sql.NullInt64{}, // count\n\t\t&sql.NullInt64{}, // code\n\t\t&sql.NullInt64{}, // index\n\t\t&sql.NullInt64{}, // min\n\t\t&sql.NullInt64{}, // max\n\t\t&sql.NullInt64{}, // range\n\t\t&sql.NullString{}, // note\n\t\t&sql.NullString{}, // log\n\t\t&sql.NullString{}, // username\n\t}\n}", "title": "" }, { "docid": "ea3444d52cfe46a5cbb69ba076b8b9dd", "score": "0.6733171", "text": "func (*Dialog) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&[]byte{}, // meta\n\t}\n}", "title": "" }, { "docid": "0f859d25f56c8233ef1de43b7aa548a9", "score": "0.6729505", "text": "func (*Ecdict) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // word\n\t\t&sql.NullString{}, // sw\n\t\t&sql.NullString{}, // phonetic\n\t\t&sql.NullString{}, // definition\n\t\t&sql.NullString{}, // translation\n\t\t&sql.NullString{}, // pos\n\t\t&sql.NullInt64{}, // collins\n\t\t&sql.NullInt64{}, // oxford\n\t\t&sql.NullString{}, // tag\n\t\t&sql.NullInt64{}, // bnc\n\t\t&sql.NullInt64{}, // frq\n\t\t&sql.NullString{}, // exchange\n\t\t&sql.NullString{}, // detail\n\t\t&sql.NullString{}, // audio\n\t}\n}", "title": "" }, { "docid": "6858afc881cd4567f935881f6d0875fe", "score": "0.67257315", "text": "func (*Timing) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // category\n\t\t&sql.NullString{}, // timing_label\n\t\t&sql.NullString{}, // unit\n\t\t&sql.NullString{}, // variable\n\t\t&sql.NullFloat64{}, // value\n\t}\n}", "title": "" }, { "docid": "43d75902abed23c43239ab15ffee1ff7", "score": "0.67228603", "text": "func (*User) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // email\n\t\t&sql.NullString{}, // password\n\t\t&sql.NullString{}, // images\n\t}\n}", "title": "" }, { "docid": "18bcfcc37e52dddaf75215f93b419efe", "score": "0.67105013", "text": "func (*Payment) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // PAYDAY\n\t}\n}", "title": "" }, { "docid": "55577a1a70b83ca92a7de5f1e95229e1", "score": "0.67056227", "text": "func (*Training) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // trainingplace\n\t\t&sql.NullTime{}, // firstday\n\t\t&sql.NullTime{}, // lastday\n\t\t&sql.NullString{}, // doctoridcard\n\t\t&sql.NullInt64{}, // hour\n\t}\n}", "title": "" }, { "docid": "576c6f3261ccefb78fe280c4b08ecd4a", "score": "0.6700489", "text": "func (*Employee) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // EMPLOYEEID\n\t\t&sql.NullString{}, // EMPLOYEENAME\n\t\t&sql.NullString{}, // EMPLOYEEADDRESS\n\t\t&sql.NullString{}, // IDCARDNUMBER\n\t}\n}", "title": "" }, { "docid": "977c2838c250a386a90c3d8c234075c8", "score": "0.6694254", "text": "func (rows *Rows) Values() ([]interface{}, error) {\n\tif rows.closed {\n\t\treturn nil, errors.New(\"rows is closed\")\n\t}\n\n\tvalues := make([]interface{}, 0, len(rows.fields))\n\n\tfor range rows.fields {\n\t\tvr, _ := rows.nextColumn()\n\n\t\tif vr.Len() == -1 {\n\t\t\tvalues = append(values, nil)\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch vr.Type().FormatCode {\n\t\t// All intrinsic types (except string) are encoded with binary\n\t\t// encoding so anything else should be treated as a string\n\t\tcase TextFormatCode:\n\t\t\tvalues = append(values, vr.ReadString(vr.Len()))\n\t\tcase BinaryFormatCode:\n\t\t\tswitch vr.Type().DataType {\n\t\t\tcase TextOid, VarcharOid:\n\t\t\t\tvalues = append(values, decodeText(vr))\n\t\t\tcase BoolOid:\n\t\t\t\tvalues = append(values, decodeBool(vr))\n\t\t\tcase ByteaOid:\n\t\t\t\tvalues = append(values, decodeBytea(vr))\n\t\t\tcase Int8Oid:\n\t\t\t\tvalues = append(values, decodeInt8(vr))\n\t\t\tcase Int2Oid:\n\t\t\t\tvalues = append(values, decodeInt2(vr))\n\t\t\tcase Int4Oid:\n\t\t\t\tvalues = append(values, decodeInt4(vr))\n\t\t\tcase OidOid:\n\t\t\t\tvalues = append(values, decodeOid(vr))\n\t\t\tcase Float4Oid:\n\t\t\t\tvalues = append(values, decodeFloat4(vr))\n\t\t\tcase Float8Oid:\n\t\t\t\tvalues = append(values, decodeFloat8(vr))\n\t\t\tcase BoolArrayOid:\n\t\t\t\tvalues = append(values, decodeBoolArray(vr))\n\t\t\tcase Int2ArrayOid:\n\t\t\t\tvalues = append(values, decodeInt2Array(vr))\n\t\t\tcase Int4ArrayOid:\n\t\t\t\tvalues = append(values, decodeInt4Array(vr))\n\t\t\tcase Int8ArrayOid:\n\t\t\t\tvalues = append(values, decodeInt8Array(vr))\n\t\t\tcase Float4ArrayOid:\n\t\t\t\tvalues = append(values, decodeFloat4Array(vr))\n\t\t\tcase Float8ArrayOid:\n\t\t\t\tvalues = append(values, decodeFloat8Array(vr))\n\t\t\tcase TextArrayOid, VarcharArrayOid:\n\t\t\t\tvalues = append(values, decodeTextArray(vr))\n\t\t\tcase TimestampArrayOid, TimestampTzArrayOid:\n\t\t\t\tvalues = append(values, decodeTimestampArray(vr))\n\t\t\tcase DateOid:\n\t\t\t\tvalues = append(values, decodeDate(vr))\n\t\t\tcase TimestampTzOid:\n\t\t\t\tvalues = append(values, decodeTimestampTz(vr))\n\t\t\tcase TimestampOid:\n\t\t\t\tvalues = append(values, decodeTimestamp(vr))\n\t\t\tcase InetOid, CidrOid:\n\t\t\t\tvalues = append(values, decodeInet(vr))\n\t\t\tcase JsonOid:\n\t\t\t\tvar d interface{}\n\t\t\t\tdecodeJSON(vr, &d)\n\t\t\t\tvalues = append(values, d)\n\t\t\tcase JsonbOid:\n\t\t\t\tvar d interface{}\n\t\t\t\tdecodeJSON(vr, &d)\n\t\t\t\tvalues = append(values, d)\n\t\t\tdefault:\n\t\t\t\trows.Fatal(errors.New(\"Values cannot handle binary format non-intrinsic types\"))\n\t\t\t}\n\t\tdefault:\n\t\t\trows.Fatal(errors.New(\"Unknown format code\"))\n\t\t}\n\n\t\tif vr.Err() != nil {\n\t\t\trows.Fatal(vr.Err())\n\t\t}\n\n\t\tif rows.Err() != nil {\n\t\t\treturn nil, rows.Err()\n\t\t}\n\t}\n\n\treturn values, rows.Err()\n}", "title": "" }, { "docid": "4d024e81ea02a1c21eedea77baf9bfb9", "score": "0.6659647", "text": "func (*Restaurant) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // description\n\t}\n}", "title": "" }, { "docid": "ed90f5cb12ce6d72c3ad4bc6b84dbb02", "score": "0.6658575", "text": "func (*OutboundDeal) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // quantity\n\t\t&sql.NullInt64{}, // amount\n\t}\n}", "title": "" }, { "docid": "082fec04bbadfe3ab6ca5e1bf4e5e9b7", "score": "0.66171914", "text": "func (*Session) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&uuid.UUID{}, // id\n\t\t&sql.NullBool{}, // new_user\n\t\t&sql.NullBool{}, // is_unique\n\t\t&sql.NullBool{}, // is_bounce\n\t\t&sql.NullBool{}, // is_finished\n\t\t&sql.NullInt64{}, // duration\n\t\t&sql.NullTime{}, // started_at\n\t\t&sql.NullTime{}, // finished_at\n\t}\n}", "title": "" }, { "docid": "37bc3cadd1ca723cbd55702c4e83bf10", "score": "0.66171515", "text": "func (*ServiceInfo) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // load_type\n\t\t&sql.NullString{}, // service_name\n\t\t&sql.NullString{}, // service_desc\n\t\t&sql.NullTime{}, // create_at\n\t\t&sql.NullTime{}, // update_at\n\t\t&sql.NullInt64{}, // is_delete\n\t}\n}", "title": "" }, { "docid": "13a4159948fa190c69ec991fcdf2bcdb", "score": "0.6614905", "text": "func (*User) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // email\n\t\t&sql.NullString{}, // firebaseUid\n\t}\n}", "title": "" }, { "docid": "cec5fc03d3a88bacc0f969e4b8f2af01", "score": "0.6572233", "text": "func (*Notes) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Title\n\t\t&sql.NullString{}, // Content\n\t\t&sql.NullBool{}, // Private\n\t\t&sql.NullTime{}, // created_at\n\t}\n}", "title": "" }, { "docid": "3f179a3f7ab455171a4320761f9b44f2", "score": "0.6560122", "text": "func (*CheckIn) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // checkin_date\n\t\t&sql.NullString{}, // mobile_key\n\t\t&sql.NullString{}, // phone_number\n\t\t&sql.NullString{}, // person_number\n\t}\n}", "title": "" }, { "docid": "b781c1c52610c9848a22e81d75c90862", "score": "0.65403897", "text": "func (*Course) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // COURSE\n\t}\n}", "title": "" }, { "docid": "f07214990e04eb61ccb8e165b89626fb", "score": "0.6516879", "text": "func (*Symptom) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Syname\n\t}\n}", "title": "" }, { "docid": "50aaf92c4976da41be74348c040b56a6", "score": "0.647787", "text": "func (*OutboundShipping) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // courier\n\t\t&sql.NullString{}, // courier_tracking_code\n\t\t&sql.NullString{}, // type\n\t\t&sql.NullString{}, // state\n\t\t&sql.NullString{}, // consignee\n\t\t&sql.NullString{}, // consignee_phone\n\t\t&sql.NullString{}, // address\n\t\t&sql.NullInt64{}, // postal_code\n\t\t&sql.NullInt64{}, // cost\n\t}\n}", "title": "" }, { "docid": "1386a92d6c8e329bda9357abed1f90b9", "score": "0.6472012", "text": "func (*Course) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // course\n\t\t&sql.NullString{}, // annotation\n\t\t&sql.NullInt64{}, // credit\n\t\t&sql.NullInt64{}, // course_id\n\t}\n}", "title": "" }, { "docid": "558109636f48adbdb956af946e44553a", "score": "0.64401007", "text": "func (*Artist) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // slug\n\t\t&sql.NullInt64{}, // age\n\t\t&sql.NullString{}, // phone\n\t\t&sql.NullInt64{}, // plays\n\t\t&sql.NullString{}, // gender\n\t}\n}", "title": "" }, { "docid": "31b02e10537ca0a4499487c8ae17f264", "score": "0.6430917", "text": "func (rows *Rows) Scan(dest ...interface{}) (err error) {\n\tif len(rows.fields) != len(dest) {\n\t\terr = fmt.Errorf(\"Scan received wrong number of arguments, got %d but expected %d\", len(dest), len(rows.fields))\n\t\trows.Fatal(err)\n\t\treturn err\n\t}\n\n\tfor i, d := range dest {\n\t\tvr, _ := rows.nextColumn()\n\n\t\tif d == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check for []byte first as we allow sidestepping the decoding process and retrieving the raw bytes\n\t\tif b, ok := d.(*[]byte); ok {\n\t\t\t// If it actually is a bytea then pass it through decodeBytea (so it can be decoded if it is in text format)\n\t\t\t// Otherwise read the bytes directly regardless of what the actual type is.\n\t\t\tif vr.Type().DataType == ByteaOid {\n\t\t\t\t*b = decodeBytea(vr)\n\t\t\t} else {\n\t\t\t\tif vr.Len() != -1 {\n\t\t\t\t\t*b = vr.ReadBytes(vr.Len())\n\t\t\t\t} else {\n\t\t\t\t\t*b = nil\n\t\t\t\t}\n\t\t\t}\n\t\t} else if s, ok := d.(Scanner); ok {\n\t\t\terr = s.Scan(vr)\n\t\t\tif err != nil {\n\t\t\t\trows.Fatal(scanArgError{col: i, err: err})\n\t\t\t}\n\t\t} else if s, ok := d.(sql.Scanner); ok {\n\t\t\tvar val interface{}\n\t\t\tif 0 <= vr.Len() {\n\t\t\t\tswitch vr.Type().DataType {\n\t\t\t\tcase BoolOid:\n\t\t\t\t\tval = decodeBool(vr)\n\t\t\t\tcase Int8Oid:\n\t\t\t\t\tval = int64(decodeInt8(vr))\n\t\t\t\tcase Int2Oid:\n\t\t\t\t\tval = int64(decodeInt2(vr))\n\t\t\t\tcase Int4Oid:\n\t\t\t\t\tval = int64(decodeInt4(vr))\n\t\t\t\tcase TextOid, VarcharOid:\n\t\t\t\t\tval = decodeText(vr)\n\t\t\t\tcase OidOid:\n\t\t\t\t\tval = int64(decodeOid(vr))\n\t\t\t\tcase Float4Oid:\n\t\t\t\t\tval = float64(decodeFloat4(vr))\n\t\t\t\tcase Float8Oid:\n\t\t\t\t\tval = decodeFloat8(vr)\n\t\t\t\tcase DateOid:\n\t\t\t\t\tval = decodeDate(vr)\n\t\t\t\tcase TimestampOid:\n\t\t\t\t\tval = decodeTimestamp(vr)\n\t\t\t\tcase TimestampTzOid:\n\t\t\t\t\tval = decodeTimestampTz(vr)\n\t\t\t\tdefault:\n\t\t\t\t\tval = vr.ReadBytes(vr.Len())\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = s.Scan(val)\n\t\t\tif err != nil {\n\t\t\t\trows.Fatal(scanArgError{col: i, err: err})\n\t\t\t}\n\t\t} else if vr.Type().DataType == JsonOid || vr.Type().DataType == JsonbOid {\n\t\t\t// Because the argument passed to decodeJSON will escape the heap.\n\t\t\t// This allows d to be stack allocated and only copied to the heap when\n\t\t\t// we actually are decoding JSON. This saves one memory allocation per\n\t\t\t// row.\n\t\t\td2 := d\n\t\t\tdecodeJSON(vr, &d2)\n\t\t} else {\n\t\t\tif err := Decode(vr, d); err != nil {\n\t\t\t\trows.Fatal(scanArgError{col: i, err: err})\n\t\t\t}\n\t\t}\n\t\tif vr.Err() != nil {\n\t\t\trows.Fatal(scanArgError{col: i, err: vr.Err()})\n\t\t}\n\n\t\tif rows.Err() != nil {\n\t\t\treturn rows.Err()\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2190467636e891ed2b6f28af42e711af", "score": "0.6429488", "text": "func (*Browser) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // version\n\t\t&sql.NullString{}, // useragent\n\t}\n}", "title": "" }, { "docid": "80a50141ea7a3351e2bf514a89520b0e", "score": "0.6425921", "text": "func (*TodoItem) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // uid\n\t\t&sql.NullString{}, // title\n\t\t&sql.NullBool{}, // completed\n\t\t&sql.NullInt64{}, // order\n\t\t&sql.NullTime{}, // created_at\n\t\t&sql.NullTime{}, // updated_at\n\t}\n}", "title": "" }, { "docid": "2ee531f67f68162db204db0c52ec9dd0", "score": "0.64192307", "text": "func (r *rows) Scan(i ...interface{}) (err error) {\n\tif i == nil {\n\t\treturn nil\n\t} else if isVariadic(i...) {\n\t\treturn r.ScanVal(i...)\n\t} else if ii, ok := i[0].([]interface{}); ok {\n\t\treturn r.ScanVal(ii...)\n\t}\n\n\tval, valErr := validate(i[0])\n\tif valErr != nil {\n\t\terr = valErr\n\t\treturn\n\t}\n\n\tvar rowCount int64\n\tdefer func() {\n\t\tr.Close()\n\t\tif r.cfg.ReturnErrNoRowsForRows && err == nil && rowCount == 0 {\n\t\t\terr = pgx.ErrNoRows\n\t\t}\n\t}()\n\tswitch val.Kind() {\n\tcase reflect.Slice:\n\t\tsliceOf := sqlmaper.GetSliceElementType(val)\n\t\tfor r.Next() {\n\t\t\tsliceVal := reflect.New(sliceOf)\n\n\t\t\tcols, colErr := GetColumnNames(&r.rows)\n\t\t\tif colErr != nil {\n\t\t\t\terr = colErr\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif ssErr := ScanStruct(r.rows.Scan, sliceVal.Interface(), cols, r.cfg.MatchAllColumnsToStruct); ssErr != nil {\n\t\t\t\terr = ssErr\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsqlmaper.AppendSliceElement(val, sliceVal)\n\t\t\trowCount++\n\t\t}\n\tcase reflect.Struct:\n\t\tfor r.Next() {\n\t\t\tif val.CanAddr() {\n\t\t\t\tcols, colErr := GetColumnNames(&r.rows)\n\t\t\t\tif colErr != nil {\n\t\t\t\t\terr = colErr\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif ssErr := ScanStruct(r.rows.Scan, val.Addr().Interface(), cols, r.cfg.MatchAllColumnsToStruct); ssErr != nil {\n\t\t\t\t\terr = ssErr\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\trowCount++\n\t\t}\n\t}\n\treturn r.Err()\n}", "title": "" }, { "docid": "87d1e42abc13f35179c5e366c22e38e0", "score": "0.6405756", "text": "func (*PillorderItem) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // PillorderItem_name\n\t}\n}", "title": "" } ]
daedf261796db44c7fdece798db21235
AddMarkdownTag appends a tag to the end of the given string. Bitbucket doesn't support markdown comments.
[ { "docid": "8a4cadc63e1009e2f1cda0640177f77b", "score": "0.85307467", "text": "func (h *bitbucketServerPRHandler) AddMarkdownTag(s string, tag string) string {\n\treturn fmt.Sprintf(\"%s%s\", s, bitbucketMarkdownTag(tag))\n}", "title": "" } ]
[ { "docid": "a8838032357a4a6f50b381a19c629319", "score": "0.8573425", "text": "func (h *bitbucketPRHandler) AddMarkdownTag(s string, tag string) string {\n\treturn fmt.Sprintf(\"%s%s\", s, bitbucketMarkdownTag(tag))\n}", "title": "" }, { "docid": "1fd30306fe441a2cea7760d985745d50", "score": "0.8536495", "text": "func (h *bitbucketCommitHandler) AddMarkdownTag(s string, tag string) string {\n\treturn fmt.Sprintf(\"%s%s\", s, bitbucketMarkdownTag(tag))\n}", "title": "" }, { "docid": "04b2b1f18ddb9ca5133f33b6e9eac5c9", "score": "0.5698072", "text": "func markdown(text string) string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"`\")\n\tbuffer.WriteString(text)\n\tbuffer.WriteString(\"`\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "8f7656ebf38e2715b451741770950ae6", "score": "0.52548873", "text": "func (o *Tile) SetMarkdown(v string) {\n\to.Markdown = &v\n}", "title": "" }, { "docid": "b28fb19947b19ace5922cf90ba5676b4", "score": "0.5254653", "text": "func Markdown(input string, style style) string {\n\t// When quoting, there is no need to escape other characters\n\tif style == mdquote {\n\t\treturn string(style) + mdUnquote(input) + string(style)\n\t}\n\treturn string(style) + MDEscape(input) + string(style)\n}", "title": "" }, { "docid": "75c5ab0631fdddda1215b366bb5bee03", "score": "0.50889313", "text": "func TestMarkdown(t *testing.T) {\n\theading := \"## This is some text\\n\"\n\thtml := Markdown(heading)\n\n\tif html != \"<h2>This is some text</h2>\" {\n\t\tt.Error(\"## did not correctly generate an h2\")\n\t}\n}", "title": "" }, { "docid": "5d81647a6ea84949480b3eb0c1bbeb28", "score": "0.5041472", "text": "func (cmd CommitCmd) CreateMarkdown(fs filesys.Filesys, path, commandStr string) error {\n\tap := cmd.createArgParser()\n\treturn CreateMarkdown(fs, path, cli.GetCommandDocumentation(commandStr, commitDocs, ap))\n}", "title": "" }, { "docid": "9df6beba7258361d2247979f542c047a", "score": "0.4997929", "text": "func Markdown(input []byte, renderer Renderer, extensions int) []byte {\n\treturn MarkdownOptions(input, renderer, Options{\n\t\tExtensions: extensions})\n}", "title": "" }, { "docid": "fbdd2e85cc75473ab958eeb4b6662d2c", "score": "0.49766564", "text": "func Markdown(input any, urlPrefix string, metas map[string]string) []byte {\n\treturn Render(TypeMarkdown, input, urlPrefix, metas)\n}", "title": "" }, { "docid": "b23682c93780b70ed6ea4917ba13e599", "score": "0.49565724", "text": "func RenderMarkdown(doc *Document, bucket, tars, prevTag, newTag string) (string, error) {\n\to := &strings.Builder{}\n\tif err := createDownloadsTable(o, bucket, tars, prevTag, newTag); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// we always want to render the document with SIGs in alphabetical order\n\tsortedSIGs := []string{}\n\tfor sig := range doc.SIGs {\n\t\tsortedSIGs = append(sortedSIGs, sig)\n\t}\n\tsort.Strings(sortedSIGs)\n\n\tnl := func() {\n\t\to.WriteRune('\\n')\n\t}\n\tnlnl := func() {\n\t\tnl()\n\t\tnl()\n\t}\n\n\t// writeNote encapsulates the pre-processing that might happen on a note text\n\t// before it gets bulleted and written to the io.Writer\n\twriteNote := func(s string) {\n\t\tconst prefix = \"- \"\n\t\tif !strings.HasPrefix(s, prefix) {\n\t\t\to.WriteString(prefix)\n\t\t}\n\t\to.WriteString(s)\n\t\tnl()\n\t}\n\n\t// the \"Action Required\" section\n\tif len(doc.ActionRequired) > 0 {\n\t\to.WriteString(\"## Action Required\")\n\t\tnlnl()\n\t\tfor _, note := range doc.ActionRequired {\n\t\t\twriteNote(note)\n\t\t}\n\t\tnlnl()\n\t}\n\n\t// the \"New Feautres\" section\n\tif len(doc.NewFeatures) > 0 {\n\t\to.WriteString(\"## New Features\")\n\t\tnlnl()\n\t\tfor _, note := range doc.NewFeatures {\n\t\t\twriteNote(note)\n\t\t}\n\t\tnlnl()\n\t}\n\n\t// the \"API Changes\" section\n\tif len(doc.APIChanges) > 0 {\n\t\to.WriteString(\"### API Changes\")\n\t\tnlnl()\n\t\tfor _, note := range doc.APIChanges {\n\t\t\twriteNote(note)\n\t\t}\n\t\tnlnl()\n\t}\n\n\t// the \"Duplicate Notes\" section\n\tif len(doc.Duplicates) > 0 {\n\t\to.WriteString(\"### Notes from Multiple SIGs\")\n\t\tnlnl()\n\t\tfor header, notes := range doc.Duplicates {\n\t\t\to.WriteString(\"#### \")\n\t\t\to.WriteString(header)\n\t\t\tnlnl()\n\t\t\tfor _, note := range notes {\n\t\t\t\twriteNote(note)\n\t\t\t}\n\t\t\tnl()\n\t\t}\n\t\tnl()\n\t}\n\n\t// each SIG gets a section (in alphabetical order)\n\tif len(sortedSIGs) > 0 {\n\t\to.WriteString(\"### Notes from Individual SIGs\")\n\t\tnlnl()\n\t\tfor _, sig := range sortedSIGs {\n\t\t\to.WriteString(\"#### SIG \")\n\t\t\to.WriteString(prettySIG(sig))\n\t\t\tnlnl()\n\t\t\tfor _, note := range doc.SIGs[sig] {\n\t\t\t\twriteNote(note)\n\t\t\t}\n\t\t\tnl()\n\t\t}\n\t\tnlnl()\n\t}\n\n\t// the \"Bug Fixes\" section\n\tif len(doc.BugFixes) > 0 {\n\t\to.WriteString(\"### Bug Fixes\")\n\t\tnlnl()\n\t\tfor _, note := range doc.BugFixes {\n\t\t\twriteNote(note)\n\t\t}\n\t\tnlnl()\n\t}\n\n\t// we call the uncategorized notes \"Other Notable Changes\". ideally these\n\t// notes would at least have a SIG label.\n\tif len(doc.Uncategorized) > 0 {\n\t\to.WriteString(\"### Other Notable Changes\")\n\t\tnlnl()\n\t\tfor _, note := range doc.Uncategorized {\n\t\t\twriteNote(note)\n\t\t}\n\t\tnlnl()\n\t}\n\n\treturn o.String(), nil\n}", "title": "" }, { "docid": "45e27dcd30f20cf109a35dbd377e8f71", "score": "0.4916827", "text": "func (graph *Graph) WithDescriptionMarkdown(markdown string) *Graph {\n\tif graph.Description == nil {\n\t\tgraph.Description = &Message{}\n\t}\n\tgraph.Description.Markdown = &markdown\n\treturn graph\n}", "title": "" }, { "docid": "3dcc698f1c0c1486c5185dbb279f0827", "score": "0.49063137", "text": "func ParseMarkdown(input string) string {\n\textensions := parser.HardLineBreak | parser.NoIntraEmphasis | parser.FencedCode\n\tmarkdownParser := parser.NewWithExtensions(extensions)\n\trenderer := html.NewRenderer(html.RendererOptions{\n\t\tFlags: 0,\n\t})\n\tparsedMarkdown := markdown.ToHTML([]byte(input), markdownParser, renderer)\n\tres := string(parsedMarkdown)\n\tres = strings.TrimPrefix(res, \"<p>\")\n\tres = strings.TrimSuffix(res, \"</p>\\n\")\n\treturn res\n}", "title": "" }, { "docid": "9312bccbf447bea5a28c2af82cf73c4c", "score": "0.47567722", "text": "func (codeFlow *CodeFlow) WithMessageMarkdown(markdown string) *CodeFlow {\n\tif codeFlow.Message == nil {\n\t\tcodeFlow.Message = &Message{}\n\t}\n\tcodeFlow.Message.Markdown = &markdown\n\treturn codeFlow\n}", "title": "" }, { "docid": "36823f9e41408a38928f423ff44faeb5", "score": "0.47138906", "text": "func SendMarkdownMessage(bot *tgbotapi.BotAPI, chatID int, text string) error {\n\treturn SendMessage(bot, chatID, text, true, true)\n}", "title": "" }, { "docid": "29028e7219fa5288eaa3fd2dda650649", "score": "0.46752405", "text": "func ValidateMarkdown(fieldName string) error {\n\terr := Validate.Var(fieldName, \"markdownsource,max=1024\") // 1024 seems like a reasonable first guess\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed6c53ff8581d33d105c33b2054bf479", "score": "0.46677", "text": "func (s *schema) markdown() string {\n\ttmp := template.Must(template.New(\"\").Parse(markdownTemplate))\n\tbuf := bytes.NewBuffer(nil)\n\terr := tmp.Execute(buf, s)\n\tif err != nil {\n\t\treturn \"Error: \" + err.Error()\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "15599467abdf99092e6e0fd8c5ba87b0", "score": "0.46514952", "text": "func (g *gitBackEnd) commitMD(path, id, msg string) error {\n\t// git add id/brm.json\n\tfilename := pijoin(joinLatest(path, id),\n\t\tdefaultRecordMetadataFilename)\n\terr := g.gitAdd(path, filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// git commit -m \"message\"\n\treturn g.gitCommit(path, \"Update record status \"+id+\" \"+msg)\n}", "title": "" }, { "docid": "d34eeca4172c2118586e048e77421a0e", "score": "0.4618853", "text": "func (n *NegotiationBuilder) Markdown(v ...[]byte) *NegotiationBuilder {\n\tvar content interface{}\n\tif len(v) > 0 {\n\t\tcontent = v\n\t}\n\treturn n.MIME(ContentMarkdownHeaderValue, content)\n}", "title": "" }, { "docid": "1b7511e0d69d5de138441000cb8b5771", "score": "0.4588427", "text": "func GenerateMarkdown(command Command) string {\n\tvar generate func(command Command, depth int) string\n\tgenerate = func(command Command, depth int) string {\n\t\tname, info, description, help, commands := command.Name(),\n\t\t\tcommand.Info(),\n\t\t\tcommand.Description(),\n\t\t\tcommand.Help(),\n\t\t\tcommand.Commands()\n\n\t\t// modify\n\t\tif name == \"\" {\n\t\t\tname = \"COMMAND\"\n\t\t}\n\t\tif lines := strings.Split(strings.TrimSuffix(info, \"\\n\"), \"\\n\"); len(lines) > 0 {\n\t\t\tinfo = \"\"\n\t\t\tfor _, line := range lines {\n\t\t\t\tinfo += \"> \" + line + \"\\n\"\n\t\t\t}\n\t\t}\n\n\t\t// newlines for optional segments\n\t\tif info != \"\" {\n\t\t\tinfo += \"\\n\"\n\t\t}\n\t\tif description != \"\" {\n\t\t\tdescription += \"\\n\"\n\t\t}\n\n\t\t// build\n\t\tbody := strings.Repeat(`#`, depth+1) + \" \" + name + \"\\n\" +\n\t\t\t\"\\n\" +\n\t\t\tinfo +\n\t\t\tdescription +\n\t\t\t\"```\\n\" +\n\t\t\thelp + \"\\n\" +\n\t\t\t\"```\\n\"\n\t\tfor _, subCommand := range commands {\n\t\t\tbody += \"\\n\" + generate(subCommand, depth+1)\n\t\t}\n\n\t\treturn body\n\t}\n\treturn generate(command, 0)\n}", "title": "" }, { "docid": "1ea3e5a6a442da92a898a8f9eb341fb6", "score": "0.4568908", "text": "func (rc *RootCommandeer) CreateMarkdown(path string) error {\n\treturn doc.GenMarkdownTree(rc.cmd, path)\n}", "title": "" }, { "docid": "638ca4e7addacbcc0d3633ccd03469d1", "score": "0.4541172", "text": "func (mdl *MetaDataList) Add(fmd FileMetaData) {\n\tif mdl.Exists(fmd) {\n\t\treturn\n\t}\n\tmdl.mutex.Lock()\n\tmdl.metaDataFiles = append(mdl.metaDataFiles, fmd)\n\tmdl.mutex.Unlock()\n}", "title": "" }, { "docid": "61cded3a70d59633a6f06367aebe5986", "score": "0.45374903", "text": "func (h *CodeBoxHandler) GenerateMarkdown(editorJSBlock EditorJSBlock) (string, error) {\n\tcodeBox, err := h.parse(editorJSBlock)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcodeBox.Code = strings.ReplaceAll(codeBox.Code, \"<div>\", \"\\n\")\n\tcodeBox.Code = removeHTMLTags(codeBox.Code)\n\n\treturn fmt.Sprintf(\"```%s\\n%s\\n```\", codeBox.Language, codeBox.Code), nil\n}", "title": "" }, { "docid": "ab4151599fc5d7c79e68bffd41c65043", "score": "0.44848594", "text": "func parseMarkdown(body []byte) []byte{\n\textensions := parser.CommonExtensions | parser.AutoHeadingIDs\n\tparser := parser.NewWithExtensions(extensions)\n\treturn markdown.ToHTML(body,parser,nil)\n}", "title": "" }, { "docid": "b522f4b974243cb408e56db003fc3c7e", "score": "0.4460701", "text": "func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {\n\tbuf := new(bytes.Buffer)\n\tname := cmd.CommandPath()\n\n\tshort := cmd.Short\n\tlong := cmd.Long\n\tif len(long) == 0 {\n\t\tlong = short\n\t}\n\n\tbuf.WriteString(\"# \" + name + \"\\n\\n\")\n\tbuf.WriteString(short + \"\\n\\n\")\n\tbuf.WriteString(\"## Synopsis\\n\\n\")\n\tbuf.WriteString(long + \"\\n\\n\")\n\n\tif cmd.Runnable() {\n\t\tbuf.WriteString(fmt.Sprintf(\"```\\n%s\\n```\\n\\n\", cmd.UseLine()))\n\t}\n\n\tif len(cmd.Example) > 0 {\n\t\tbuf.WriteString(\"## Examples\\n\\n\")\n\t\tbuf.WriteString(fmt.Sprintf(\"```\\n%s\\n```\\n\\n\", cmd.Example))\n\t}\n\n\tif err := printOptions(buf, cmd, name); err != nil {\n\t\treturn err\n\t}\n\tif hasSeeAlso(cmd) {\n\t\tbuf.WriteString(\"## SEE ALSO\\n\\n\")\n\t\tif cmd.HasParent() {\n\t\t\tparent := cmd.Parent()\n\t\t\tpname := parent.CommandPath()\n\t\t\tlink := pname + \".md\"\n\t\t\tlink = strings.Replace(link, \" \", \"_\", -1)\n\t\t\tbuf.WriteString(fmt.Sprintf(\"* [%s](%s)\\t - %s\\n\", pname, linkHandler(link), parent.Short))\n\t\t\tcmd.VisitParents(func(c *cobra.Command) {\n\t\t\t\tif c.DisableAutoGenTag {\n\t\t\t\t\tcmd.DisableAutoGenTag = c.DisableAutoGenTag\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tchildren := cmd.Commands()\n\t\tsort.Sort(byName(children))\n\n\t\tfor _, child := range children {\n\t\t\tif !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcname := name + \" \" + child.Name()\n\t\t\tlink := cname + \".md\"\n\t\t\tlink = strings.Replace(link, \" \", \"_\", -1)\n\t\t\tbuf.WriteString(fmt.Sprintf(\"* [%s](%s)\\t - %s\\n\", cname, linkHandler(link), child.Short))\n\t\t}\n\t\tbuf.WriteString(\"\\n\")\n\t}\n\t_, err := buf.WriteTo(w)\n\treturn err\n}", "title": "" }, { "docid": "49bbfbd087088c59078dcceb879c6165", "score": "0.4453584", "text": "func (c *Change) Add(relative string, mode os.FileMode, content string) error {\n\tif err := c.Repo.Add(relative, mode, []byte(content)); err != nil {\n\t\treturn err\n\t}\n\treturn c.Repo.Amend()\n}", "title": "" }, { "docid": "1270377b9aeb41342ed3474473064f4c", "score": "0.44409204", "text": "func (d *Document) AddTag(tag string) bool {\n\tif tag == \"\" {\n\t\tlog.Printf(\"empty tag given\")\n\t\treturn false\n\t}\n\n\td.mutex.Lock()\n\tdefer d.mutex.Unlock()\n\n\tfor _, el := range d.tags {\n\t\tif el == tag {\n\t\t\treturn false\n\t\t}\n\t}\n\n\td.tags = append(d.tags, tag)\n\treturn true\n}", "title": "" }, { "docid": "68773873bd4b1aa5c708df8e8c4b75eb", "score": "0.44406906", "text": "func (h *ParagraphHandler) GenerateMarkdown(editorJSBlock EditorJSBlock) (string, error) {\n\tparagraph, err := h.parse(editorJSBlock)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif paragraph.Alignment != \"left\" {\n\t\t// Native markdown doesn't support alignment, so we'll use html instead.\n\t\treturn fmt.Sprintf(`<p style=\"text-align:%s\">%s</p>`, paragraph.Alignment, paragraph.Text), nil\n\t}\n\n\treturn paragraph.Text, nil\n}", "title": "" }, { "docid": "b01a6f01dd2561ec9e72becdb526b940", "score": "0.4437715", "text": "func (t *Traffic) AddTagFlag(cmd *cobra.Command) {\n\tcmd.Flags().StringSliceVar(&t.RevisionsTags,\n\t\t\"tag\",\n\t\tnil,\n\t\t\"Set tag (format: --tag revisionRef=tagName) where revisionRef can be a revision or '@latest' string representing latest ready revision. \"+\n\t\t\t\"This flag can be specified multiple times.\")\n}", "title": "" }, { "docid": "968e7364d1a0dcb6796464c27194c27f", "score": "0.4409931", "text": "func (cmd DumpCmd) CreateMarkdown(wr io.Writer, commandStr string) error {\n\tap := cmd.createArgParser()\n\treturn CreateMarkdown(wr, cli.GetCommandDocumentation(commandStr, lsDocs, ap))\n}", "title": "" }, { "docid": "003dcf59b05b0aa0e0c80cd0f96bbb55", "score": "0.4400824", "text": "func (r ModuleTags) Add(tag string) bool {\n\tmodule, version, ok := parseTag(tag)\n\tif !ok {\n\t\treturn false\n\t}\n\n\tindex := sort.Search(len(r[module]), func(i int) bool {\n\t\treturn semver.Compare(version, r[module][i]) >= 0\n\t})\n\n\tif index < len(r[module]) && index >= 0 {\n\t\tif semver.Compare(r[module][index], version) == 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tr[module] = append(r[module], \"\")\n\tcopy(r[module][index+1:], r[module][index:])\n\tr[module][index] = version\n\n\treturn true\n}", "title": "" }, { "docid": "ecda669ec50266fcb30f9965c6eb3f4e", "score": "0.43969518", "text": "func ParseMarkdown(filepath string) (string, error) {\n\tSetupLogger()\n\tmarkdownData, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\tfmt.Println(\"File reading error\", err)\n\t\treturn \"\", err\n\t}\n\n\tmarkdownDataList := strings.Split(strings.TrimSuffix(string(markdownData), \"\\n\"), \"\\n\")\n\tvar lineDataList []string\n\tfor _, line := range markdownDataList {\n\t\tlist := strings.Split(line, \"\\t\")\n\t\tif len(list) != 0 {\n\t\t\tlineDataList = append(lineDataList, list[0])\n\t\t}\n\t}\n\tmarkdownBlockList, err := createMarkdownBlockList(lineDataList)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresult := generateMarkdownString(markdownBlockList)\n\treturn result, nil\n}", "title": "" }, { "docid": "e7ce50dc308b9d7ed29979cf93d4c5a8", "score": "0.4392611", "text": "func (it *BaseIterator) AddTag(tag string) {\n\tif it.tags == nil {\n\t\tit.tags = make([]string, 0)\n\t}\n\tit.tags = append(it.tags, tag)\n}", "title": "" }, { "docid": "1b85b8d163206f0ef1bdee7e16a0ea73", "score": "0.43783027", "text": "func GenerateMarkdownFile(conf *modules.Config, issues []modules.Issue) error {\n\t// open a markdown file\n\tvar file *os.File\n\tvar err error\n\tfilePath := \"./\" + conf.FileInfo.Title + \".md\"\n\tdefer file.Close()\n\tfmt.Println(\"fileName:\", filePath)\n\tif checkFileIsExist(filePath) {\n\t\tfile, err = os.OpenFile(filePath, os.O_WRONLY|os.O_TRUNC, 0666)\n\t\tfmt.Println(\"文件存在\")\n\t} else {\n\t\tfile, err = os.Create(filePath)\n\t\tfmt.Println(\"文件不存在,创建名为\" + conf.FileInfo.Title + \"的文件\")\n\t}\n\tbug, new := groupingAndWriteIssue(issues)\n\twriter := bufio.NewWriter(file)\n\t_, err = fmt.Fprintln(writer, \"# \"+conf.FileInfo.Title)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// bug fix tile\n\t_, err = fmt.Fprintln(writer, \"* \"+conf.FileInfo.Subtitle[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t// write bug fix's issue slice\n\terr = wtriteIssueSlice(writer, bug)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// what's new tilte\n\t_, err = fmt.Fprintln(writer, \"* \"+conf.FileInfo.Subtitle[1])\n\tif err != nil {\n\t\treturn err\n\t}\n\t// write what's new issue slice\n\terr = wtriteIssueSlice(writer, new)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn writer.Flush()\n}", "title": "" }, { "docid": "c52686409646d1b442df0db140f5aa58", "score": "0.43727705", "text": "func helmRepoAdd(repoName, repoURL string, logger log.FieldLogger) error {\n\tlogger.Infof(\"Adding helm repo %s\", repoName)\n\targuments := []string{\n\t\t\"repo\",\n\t\t\"add\",\n\t\trepoName,\n\t\trepoURL,\n\t}\n\n\thelmClient, err := helm.New(logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to create helm wrapper\")\n\t}\n\tdefer helmClient.Close()\n\n\terr = helmClient.RunGenericCommand(arguments...)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to add repo %s\", repoName)\n\t}\n\n\treturn helmRepoUpdate(logger)\n}", "title": "" }, { "docid": "9d34dc1245fdbba77a401c92315d2819", "score": "0.4367569", "text": "func (om *OutgoingMessage) SetMarkdown(to bool) *OutgoingMessage {\n\tif to {\n\t\tom.ParseMode = ModeMarkdown\n\t} else {\n\t\tom.ParseMode = ModeDefault\n\t}\n\treturn om\n}", "title": "" }, { "docid": "78fbde38679b38207c4deefdd2915013", "score": "0.4360526", "text": "func MarkDown(raw string) (output string) {\n\tinput := []byte(raw)\n\tbOutput := blackfriday.MarkdownCommon(input)\n\toutput = string(bOutput)\n\treturn\n}", "title": "" }, { "docid": "93c5d630616a13a083323fde9751e7e5", "score": "0.43506065", "text": "func ExampleAdd() {\n\tnotes := Notes{&logger{}, NewRepo()}\n\n\tnotes.Add(\"title\", []byte(\"hi world\"))\n\n\t// output:\n\t//\n\t// add page \"title\"\n}", "title": "" }, { "docid": "9a251abf58d08cb9b7370d30fbb46dc4", "score": "0.43460476", "text": "func (m Minify) AddCmd(mediatype string, cmd *exec.Cmd) error {\n\tm[mediatype] = func(_ Minifier, _ string, w io.Writer, r io.Reader) error {\n\t\tstdOut, err := cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer stdOut.Close()\n\n\t\tstdIn, err := cmd.StdinPipe()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer stdIn.Close()\n\n\t\tif err = cmd.Start(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := io.Copy(stdIn, r); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tstdIn.Close()\n\t\tif _, err = io.Copy(w, stdOut); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn cmd.Wait()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "269167dfa586ad812de291526ff8a07d", "score": "0.43425864", "text": "func (c *TagCache) AddTag(ctx context.Context, pin common.Pin, tag string) error {\n\tif err := common.ValidatePin(pin, common.AnyHash); err != nil {\n\t\treturn err\n\t}\n\tif err := common.ValidateInstanceTag(tag); err != nil {\n\t\treturn err\n\t}\n\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tif c.addedTags == nil {\n\t\tc.addedTags = make(map[tagKey]*messages.TagCache_Entry, 1)\n\t}\n\n\t// 'Save' will merge this into 'c.cache' before dumping to disk.\n\tc.addedTags[makeTagKey(pin.PackageName, tag)] = &messages.TagCache_Entry{\n\t\tService: c.service,\n\t\tPackage: pin.PackageName,\n\t\tTag: tag,\n\t\tInstanceId: pin.InstanceID,\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8b8adce22b02d84cce9f4bfadfc5da52", "score": "0.43382606", "text": "func (h *ImageHandler) GenerateMarkdown(editorJSBlock EditorJSBlock) (string, error) {\n\timage, err := h.parse(editorJSBlock)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif image.Stretched || image.WithBackground || image.WithBorder {\n\t\treturn h.generateHTML(image)\n\t}\n\treturn fmt.Sprintf(`![alt text](%s \"%s\")`, image.File.URL, image.Caption), nil\n\n}", "title": "" }, { "docid": "14d8716817bfcda05a771592607dc11e", "score": "0.4333345", "text": "func addHelmRepository(t *testing.T, repositoryName, repositoryURI string) {\n\tt.Helper()\n\n\trequire.NotContains(t, listHelmRepositoryNames(t), repositoryName)\n\n\toutput, errorOutput, err := runCommand(\"helm\", \"repo\", \"add\", repositoryName, repositoryURI)\n\texpectedOutput := fmt.Sprintf(\"\\\"%s\\\" has been added to your repositories\\n\", repositoryName)\n\trequireCommandOutput(t, expectedOutput, \"\", nil, output, errorOutput, err)\n\n\trequire.Contains(t, listHelmRepositoryNames(t), repositoryName)\n}", "title": "" }, { "docid": "b63e015209239d1402c71a7ecf9330f7", "score": "0.4325364", "text": "func (g *DefaultGit) Tag(tag string) error {\n\tcmd := exec.Command(\"git\", \"tag\", tag)\n\t_, err := g.CmdRunner.Output(cmd)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"tagging the commit in git: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "19eb238dd18ef60f0d9939917ba903d1", "score": "0.4310489", "text": "func (b *BuildArgs) AddMetaArg(key string, value *string) {\n\tb.allowedMetaArgs[key] = value\n}", "title": "" }, { "docid": "a3194171b85821fdcd821b3f6a7d48dd", "score": "0.42921287", "text": "func (s *manifestStore) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error {\n\tref, err := s.repo.ParseReference(reference)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx = registryutil.WithScopeHint(ctx, ref, auth.ActionPull, auth.ActionPush)\n\trc, err := s.Fetch(ctx, desc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rc.Close()\n\n\treturn s.push(ctx, desc, rc, ref.Reference)\n}", "title": "" }, { "docid": "a24d490b27f252313d8c9dd4ede996e3", "score": "0.4291435", "text": "func Markdown(text []byte) []byte {\n\tconst htmlFlags = 0\n\trenderer := &renderer{Html: blackfriday.HtmlRenderer(htmlFlags, \"\", \"\").(*blackfriday.Html)}\n\tunsanitized := blackfriday.Markdown(text, renderer, extensions)\n\tsanitized := policy.SanitizeBytes(unsanitized)\n\treturn sanitized\n}", "title": "" }, { "docid": "2074b20ba8550f58971654fe7abc3ae3", "score": "0.42827857", "text": "func (t *Trace) AddStringTag(key string, value string) error {\n\trootSpanID, err := t.rootSpanID()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.spans[rootSpanID].BinaryAnnotations[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "eb68f123a7ceccae20215862a7f39fc4", "score": "0.42606905", "text": "func isMarkdownStart(text string) bool {\n\treturn strings.HasPrefix(text, \"#\") ||\n\t\tstrings.HasPrefix(text, \"-\") ||\n\t\tstrings.HasPrefix(text, \"*\")\n}", "title": "" }, { "docid": "5ad7643ef74da97912ca4dc8f54f97d4", "score": "0.42599684", "text": "func AddTag(tag *models.Tag) (error, *models.Tag) {\n\tif len(strings.TrimSpace(tag.Name)) == 0 {\n\t\treturn errors.New(\"Tried to add tag with null or empty name\"), nil\n\t}\n\n\tfmt.Printf(\"Adding tag '%s'\\n\", tag.Name)\n\treturn nil, tag\n}", "title": "" }, { "docid": "f7ceec052dc108f0886c26e707e003d8", "score": "0.4252265", "text": "func (p Plugin) cmdTag(tag string) *exec.Cmd {\n\ttarget := fmt.Sprintf(\"%s:%s\", p.Repo, tag)\n\treturn exec.Command(\n\t\tdockerBin, \"tag\", p.Name, target,\n\t)\n}", "title": "" }, { "docid": "3f678804a46288aa6a6b9e18bf4e1b9a", "score": "0.42483768", "text": "func (m *DefaultMinifier) AddCmd(mediatype string, cmd *exec.Cmd) error {\n\tm.minify[mediatype] = func(m Minifier, w io.Writer, r io.Reader) error {\n\t\tstdOut, err := cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer stdOut.Close()\n\n\t\tstdIn, err := cmd.StdinPipe()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer stdIn.Close()\n\n\t\tif err = cmd.Start(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := io.Copy(stdIn, r); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tstdIn.Close()\n\t\tif _, err = io.Copy(w, stdOut); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn cmd.Wait()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a5d5c00596248b911c0756849b268f8", "score": "0.42395473", "text": "func (c Context) Markdown(filename string) (string, error) {\n\tbody, err := c.Include(filename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\trenderer := blackfriday.HtmlRenderer(0, \"\", \"\")\n\textns := 0\n\textns |= blackfriday.EXTENSION_TABLES\n\textns |= blackfriday.EXTENSION_FENCED_CODE\n\textns |= blackfriday.EXTENSION_STRIKETHROUGH\n\textns |= blackfriday.EXTENSION_DEFINITION_LISTS\n\tmarkdown := blackfriday.Markdown([]byte(body), renderer, extns)\n\n\treturn string(markdown), nil\n}", "title": "" }, { "docid": "448331104326b9e74b66eab272e1c834", "score": "0.42355436", "text": "func MarkdownToHTML(markdown string) string {\n\tvar buffer bytes.Buffer\n\temphasisOpen := false\n\tboldOpen := false\n\tunderscoreOpen := false\n\ti := 0\n\tfor ;; {\n\t\tif markdown[i] == '*' {\n\t\t\tif i < len(markdown) - 1 && markdown[i + 1] == '*' {\n\t\t\t\tboldOpen = !boldOpen\n\t\t\t\tif boldOpen {\n\t\t\t\t\tbuffer.WriteString(\"<b>\")\n\t\t\t\t} else {\n\t\t\t\t\tbuffer.WriteString(\"</b>\")\n\t\t\t\t}\n\t\t\t\ti += 2\n\t\t\t} else {\n\t\t\t\temphasisOpen = !emphasisOpen\n\t\t\t\tif emphasisOpen {\n\t\t\t\t\tbuffer.WriteString(\"<em>\")\n\t\t\t\t} else {\n\t\t\t\t\tbuffer.WriteString(\"</em>\")\n\t\t\t\t}\n\t\t\t\ti++\n\t\t\t}\n\t\t} else if markdown[i] == '_' {\n\t\t\tunderscoreOpen = !underscoreOpen\n\t\t\tif underscoreOpen {\n\t\t\t\tbuffer.WriteString(\"<u>\")\n\t\t\t} else {\n\t\t\t\tbuffer.WriteString(\"</u>\")\n\t\t\t}\n\t\t\ti++\n\t\t} else if markdown[i] == '@'{\n\t\t\tnextI := i + 1\n\t\t\tfor ; nextI < len(markdown) && IsLetter(markdown[nextI]); nextI++ {}\n\t\t\tusername := markdown[i + 1 : nextI]\n\t\t\tif IsUser(UserForName(username)) {\n\t\t\t\tbuffer.WriteString(\"<a href=\\\"#profile-\" + username + \"\\\">@\" + username + \"</a>\")\n\t\t\t} else {\n\t\t\t\tbuffer.WriteString(\"@\" + username)\n\t\t\t}\n\t\t\ti = nextI\n\t\t} else if markdown[i] == '#' {\n\t\t\tnextI := i + 1\n\t\t\tfor ; nextI < len(markdown) && IsLetter(markdown[nextI]); nextI++ {}\n\t\t\thashTag := markdown[i + 1 : nextI]\n\t\t\tbuffer.WriteString(\"<a href=\\\"#search-\" + hashTag + \"\\\">#\" + hashTag + \"</a>\")\n\t\t\ti = nextI\n\t\t}else {\n\t\t\tbuffer.WriteByte(markdown[i])\n\t\t\ti++\n\t\t}\n\t\t\n\t\tif i == len(markdown) {\n\t\t\tbreak\n\t\t}\n\t}\n\t\n\tif emphasisOpen {\n\t\tbuffer.WriteString(\"</i>\")\n\t}\n\tif boldOpen {\n\t\tbuffer.WriteString(\"</b>\")\n\t}\n\tif underscoreOpen {\n\t\tbuffer.WriteString(\"</u>\")\n\t}\n\t\n\treturn buffer.String()\n}", "title": "" }, { "docid": "c8a1ef2a03585c9b5fcd2cbe8af2c45d", "score": "0.423325", "text": "func Tag(tag string) error {\n\tcmd := execCommand(\"git\", \"tag\", tag)\n\t_, err := cmd.Output()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"tagging the commit in git: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c9c7bea4ba980473fb846ada64201b7c", "score": "0.42246863", "text": "func (b *githubbook) AddNote(issue int, body string) (*github.IssueComment, error) {\n\tissueComment := &github.IssueComment{Body: &body}\n\tcomment, _, err := b.Client.Issues.CreateComment(\n\t\tcontext.Background(),\n\t\tb.Options.Config.GitHub.Owner,\n\t\tb.Options.Config.GitHub.Repo,\n\t\tissue,\n\t\tissueComment)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn comment, nil\n}", "title": "" }, { "docid": "4d6144ed6ee3925de48b92d72efbc92b", "score": "0.42222255", "text": "func PostDescriptionText(txt string) MarkdownOption {\n\treturn func(config *markdownConfig) {\n\t\tconfig.PostDescriptionText = txt\n\t}\n}", "title": "" }, { "docid": "3d77f0430f8c6651bfb85ad6023be7c2", "score": "0.4220192", "text": "func (ds *DockerStages) addDockerMetaArg(key, value string) (string, string, error) {\n\tresolvedKey, err := ds.ShlexProcessWordWithMetaArgs(key)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tvar resolvedValue string\n\tif buildArgValue, ok := ds.dockerBuildArgsHash[resolvedKey]; ok {\n\t\tresolvedValue = buildArgValue\n\t} else {\n\t\trValue, err := ds.ShlexProcessWordWithMetaArgs(value)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tresolvedValue = rValue\n\t}\n\n\tds.dockerMetaArgsHash[resolvedKey] = resolvedValue\n\treturn resolvedKey, resolvedValue, err\n}", "title": "" }, { "docid": "866c79c598912e6da42fcbb61461bb4b", "score": "0.4212253", "text": "func (ss *String) Add(s string) {\n\tss.mu.Lock()\n\tdefer ss.mu.Unlock()\n\tss.content[s] = true\n}", "title": "" }, { "docid": "f3eb67a1fc4c92a88989a0ac03930ef3", "score": "0.4208256", "text": "func (s *Memory) Add(name, mediaType string, content []byte) (ocispec.Descriptor, error) {\n\tvar annotations map[string]string\n\tif name != \"\" {\n\t\tannotations = map[string]string{\n\t\t\tocispec.AnnotationTitle: name,\n\t\t}\n\t}\n\n\tif mediaType == \"\" {\n\t\tmediaType = DefaultBlobMediaType\n\t}\n\n\tdesc := ocispec.Descriptor{\n\t\tMediaType: mediaType,\n\t\tDigest: digest.FromBytes(content),\n\t\tSize: int64(len(content)),\n\t\tAnnotations: annotations,\n\t}\n\n\ts.Set(desc, content)\n\treturn desc, nil\n}", "title": "" }, { "docid": "eb22d63c5c3e9fa7a6c3e2fc8d07d322", "score": "0.41756308", "text": "func (validator utf8LengthAtMostValidator) MarkdownDescription(ctx context.Context) string {\n\treturn validator.Description(ctx)\n}", "title": "" }, { "docid": "24eb9d9c188b891f17660defa6ea8924", "score": "0.41677362", "text": "func AddMark(_type string, identity string) *models.Mark {\n\tvar v models.Mark\n\tv.Type = _type\n\tv.Identity = identity\n\tif _, err := models.AddMark(&v); err == nil {\n\t\treturn &v\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f89ee0de13f432f7e8c0cd4ee89892a7", "score": "0.41611862", "text": "func markdownToLongDescription(markdown string) (string, error) {\n\tr, _ := glamour.NewTermRenderer(\n\t\tglamour.WithStylesFromJSONBytes(descriptionJSONBytes),\n\t\tglamour.WithWordWrap(72),\n\t)\n\tout, err := r.Render(markdown)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"fail to render Markdown: %w\", err)\n\t}\n\t//fmt.Println(out)\n\t//fmt.Println(reformatForControl(out))\n\treturn reformatForControl(out), nil\n}", "title": "" }, { "docid": "6cb1998582257a3b277aadffd1eb9806", "score": "0.41598567", "text": "func (track *Track) AddComment(comment string) {\n\tvar delimiter string\n\tif len(track.Notes) > 0 {\n\t\tdelimiter = \"\\n\"\n\t}\n\ttrack.Notes += fmt.Sprintf(\"%s%s\", delimiter, comment)\n}", "title": "" }, { "docid": "8498ec314ca3056c06132130d433740f", "score": "0.4159314", "text": "func AddStepSummary(markdown string) {\n\tdefaultAction.AddStepSummary(markdown)\n}", "title": "" }, { "docid": "fd43e5ed72f35537c658970d36f02d52", "score": "0.4148923", "text": "func (i *InMemDictionary) Add(name, dockerCmd string, forMultipleContainers bool) error {\n\tif _, ok := i.translations[name]; ok {\n\t\treturn fmt.Errorf(\"command %q already exists\", name)\n\t}\n\n\ti.translations[name] = Command{Translation: dockerCmd, AllowMultipleContainers: forMultipleContainers}\n\treturn nil\n}", "title": "" }, { "docid": "bcaa97c2294b59255c15d206ef5986c1", "score": "0.41488865", "text": "func NewMarkdownSection(document *ast.Document) *MarkdownSection {\n\tsection := &MarkdownSection{Document: document}\n\tparseMarkdownSection(section, 1, false)\n\treturn section\n}", "title": "" }, { "docid": "d0266b75251ecc58af7976cfd1456b73", "score": "0.41396335", "text": "func parseMarkdown(content string) (breadcrumb []string, htmlContent string, err error) {\n\tif len(content) == 0 {\n\t\treturn nil, \"\", errors.New(\"Empty file given\")\n\t}\n\n\tsections := strings.SplitN(content, \"\\n\", 2)\n\tif len(sections) != 2 {\n\t\treturn nil, \"\", errors.New(\"Content must contain a breadcrumb line\")\n\t}\n\n\tif len(sections[0]) == 0 {\n\t\tbreadcrumb = []string{}\n\t} else {\n\t\tbreadcrumb = strings.Split(sections[0], \",\")\n\t\tfor i, _ := range breadcrumb {\n\t\t\tbreadcrumb[i] = string(blackfriday.MarkdownCommon([]byte(breadcrumb[i])))\n\t\t}\n\t}\n\thtmlContent = string(blackfriday.MarkdownCommon([]byte(sections[1])))\n\terr = nil\n\n\treturn\n}", "title": "" }, { "docid": "ebff29bd031f2ebf47f3fe74265ca8fd", "score": "0.41261932", "text": "func (obj *files) Add(content contents.Content) error {\n\tchunkHash := content.Chunk()\n\tkeyname := chunkHash.String()\n\tif obj.Exists(chunkHash) {\n\t\tstr := fmt.Sprintf(\"the chunk (hash: %s) already exists and therefore cannot be added\", keyname)\n\t\treturn errors.New(str)\n\t}\n\n\tobj.contents = append(obj.contents, content)\n\tobj.mp[keyname] = content\n\treturn nil\n}", "title": "" }, { "docid": "9acbf15a0a74310549e8237995b77bab", "score": "0.41221997", "text": "func (h *Helm2) RepoAdd(name, url string, flags []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "ab76071bb9e1187a95c5cdf05f2f421b", "score": "0.41034064", "text": "func (r *Repo) Add(arg ...string) (error) {\n\treturn r.chdirRun(\"add\", arg...)\n}", "title": "" }, { "docid": "c9a7b97c5cfcc0476b918d40e5552650", "score": "0.41022158", "text": "func cleanupMarkDown(mdString string) (md string, anchors []string) {\n\t// remove leading/trailing whitespace, and replace tabs in the whole content\n\tmdString = strings.TrimSpace(mdString)\n\tmdString = strings.ReplaceAll(mdString, \"\\t\", \" \")\n\tmdString = strings.ReplaceAll(mdString, \"https://docs.docker.com\", \"\")\n\n\tvar id string\n\t// replace trailing whitespace per line, and handle custom anchors\n\tlines := strings.Split(mdString, \"\\n\")\n\tfor i := 0; i < len(lines); i++ {\n\t\tlines[i] = strings.TrimRightFunc(lines[i], unicode.IsSpace)\n\t\tlines[i], id = convertHTMLAnchor(lines[i])\n\t\tif id != \"\" {\n\t\t\tanchors = append(anchors, id)\n\t\t}\n\t}\n\treturn strings.Join(lines, \"\\n\"), anchors\n}", "title": "" }, { "docid": "6a66912ea43b70783639f6f4f77ffaeb", "score": "0.4094798", "text": "func (c *Covet) ReportSummaryMarkdown(w io.Writer, options ReportSummaryOptions) error {\n\treturn c.reportSummary(w, options, summary.FormatMarkdown)\n}", "title": "" }, { "docid": "13cd2050af9d6b8c22feabba049cb386", "score": "0.4072236", "text": "func (w *objectChunkWriter) addMd5(md5binary *[]byte, chunkNumber int64) {\n\tw.md5sMu.Lock()\n\tdefer w.md5sMu.Unlock()\n\tstart := chunkNumber * md5.Size\n\tend := start + md5.Size\n\tif extend := end - int64(len(w.md5s)); extend > 0 {\n\t\tw.md5s = append(w.md5s, make([]byte, extend)...)\n\t}\n\tcopy(w.md5s[start:end], (*md5binary)[:])\n}", "title": "" }, { "docid": "2175f1bd71502eb93c65a068de3769d1", "score": "0.40701836", "text": "func AddCommand(name string, fn CommandFunc, help string) {\n\tlog.Stderrf(\"AddCommand %s\\n\", name);\n\tcmds[name] = &command{name, fn, help};\n}", "title": "" }, { "docid": "c052a154acb1c790d4578a5e3891ff88", "score": "0.4068775", "text": "func (a *Attachment) AddMarkDownField(field string) {\n\ta.MrkDwnIn = append(a.MrkDwnIn, field)\n}", "title": "" }, { "docid": "7ee755c87c133b624eefc13954d32333", "score": "0.40657747", "text": "func (n *PipeNode) AddCmd(c *CommandNode) {\n\tn.cmds = append(n.cmds, c)\n}", "title": "" }, { "docid": "e17b6df97b13b6faf4005a84055f5a8f", "score": "0.405883", "text": "func AddLink(last, path, hash string) (string, error) {\n\treturn Exec(\"object\", \"patch\", \"add-link\", last, path, hash)\n}", "title": "" }, { "docid": "d173d5efaeb2ed98915848dbdf2817c2", "score": "0.4056734", "text": "func (o *Operation) AddTag(mutatorTag tag.Mutator) {\n\to.mutatorTags = append(o.mutatorTags, mutatorTag)\n}", "title": "" }, { "docid": "f1e95f71e804254227bc83d5002991ad", "score": "0.40549925", "text": "func (rt *RichText) Add(ff FontFace, s string) *RichText {\n\tif 0 < len(s) {\n\t\trPrev := ' '\n\t\trNext, size := utf8.DecodeRuneInString(s)\n\t\tif 0 < len(rt.text) {\n\t\t\trPrev, _ = utf8.DecodeLastRuneInString(rt.text)\n\t\t}\n\t\tif isWhitespace(rPrev) && isWhitespace(rNext) {\n\t\t\ts = s[size:]\n\t\t}\n\t}\n\n\tstart := len(rt.text)\n\trt.text += s\n\n\t// TODO: can we simplify this? Just merge adjacent spans, don't split at newlines or sentences?\n\ti := 0\n\tfor _, boundary := range calcTextBoundaries(s, 0, len(s)) {\n\t\tif boundary.kind == lineBoundary || boundary.kind == sentenceBoundary || boundary.kind == eofBoundary {\n\t\t\tj := boundary.pos + boundary.size\n\t\t\tif i < j {\n\t\t\t\textendPrev := false\n\t\t\t\tif i == 0 && boundary.kind != lineBoundary && 0 < len(rt.spans) && rt.spans[len(rt.spans)-1].Face.Equals(ff) {\n\t\t\t\t\tprevSpan := rt.spans[len(rt.spans)-1]\n\t\t\t\t\tif 1 < len(prevSpan.boundaries) {\n\t\t\t\t\t\tprevBoundaryKind := prevSpan.boundaries[len(prevSpan.boundaries)-2].kind\n\t\t\t\t\t\tif prevBoundaryKind != lineBoundary && prevBoundaryKind != sentenceBoundary {\n\t\t\t\t\t\t\textendPrev = true\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\textendPrev = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif extendPrev {\n\t\t\t\t\tdiff := len(rt.spans[len(rt.spans)-1].Text)\n\t\t\t\t\trt.spans[len(rt.spans)-1] = newTextSpan(ff, rt.text[:start+j], start+i-diff)\n\t\t\t\t} else {\n\t\t\t\t\trt.spans = append(rt.spans, newTextSpan(ff, rt.text[:start+j], start+i))\n\t\t\t\t}\n\t\t\t}\n\t\t\ti = j\n\t\t}\n\t}\n\trt.fonts[ff.Font] = true\n\treturn rt\n}", "title": "" }, { "docid": "75ea3dc82f12b9490ca92cc7c3bb53ef", "score": "0.40502012", "text": "func (t *Traffic) AddUntagFlag(cmd *cobra.Command) {\n\tcmd.Flags().StringSliceVar(&t.UntagRevisions,\n\t\t\"untag\",\n\t\tnil,\n\t\t\"Untag revision (format: --untag tagName). This flag can be specified multiple times.\")\n}", "title": "" }, { "docid": "d954aa89718666ae1be13eec855ad079", "score": "0.40465838", "text": "func (p *Podcast) AddSummary(summary string) {\n\tcount := utf8.RuneCountInString(summary)\n\tif count == 0 {\n\t\treturn\n\t}\n\tif count > 4000 {\n\t\ts := []rune(summary)\n\t\tsummary = string(s[0:4000])\n\t}\n\tp.ISummary = &ISummary{\n\t\t// TODO: Perform proper string programming.\n\t\tText: summary,\n\t}\n}", "title": "" }, { "docid": "ecf485c39d5e6baef6b3620dfb15af60", "score": "0.4037891", "text": "func MarkdownToHTML(markdown string) template.HTML {\n\tif len(markdown) >= 3 && markdown[:3] == \"&gt;\" {\n\t\tmarkdown = \">\" + markdown[3:]\n\t}\n\tmarkdown = strings.Replace(markdown,\"\\n&gt;\",\"\\n>\", -1)\n\tunsafe := md.MarkdownOptions([]byte(markdown), HtmlMdRenderer, md.Options{Extensions: mdOptions})\n\thtml := bluemonday.UGCPolicy().SanitizeBytes(unsafe)\n\treturn template.HTML(html)\n}", "title": "" }, { "docid": "a33c655e3a1609423461c10d2ac5f162", "score": "0.40340963", "text": "func (h *RawHTMLHandler) GenerateMarkdown(editorJSBlock EditorJSBlock) (string, error) {\n\treturn h.raw(editorJSBlock)\n}", "title": "" }, { "docid": "4031b44f007e7b0fcd67a2c84d9092ec", "score": "0.40329608", "text": "func AddFromString(json string, tag ...language.Tag) error {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\treturn Add(strings.NewReader(json), tag...)\n}", "title": "" }, { "docid": "a07165893afe2edec7e848966cca2f4d", "score": "0.40245196", "text": "func AddCommand(name, description string, args ...string) {\n\tusg.commands = append(usg.commands, command{\n\t\tname: name,\n\t\tdescription: description,\n\t\targuments: args,\n\t})\n}", "title": "" }, { "docid": "6407d455f67e8370e0d4269d370f85b3", "score": "0.40059206", "text": "func (self *Repository) Tag(tagValue string) (output []byte, err error) {\n\t_, output, err = self.run(\"tag\", []string{\n\t\t\"--cwd\", self.Path,\n\t\ttagValue,\n\t})\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error tagging current commit: %s\", err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "33666e0354f114428a8654b7ad1dbdc2", "score": "0.40059027", "text": "func (u *Usage) AddUsage(arguments, description string) {\n\tdi := *newDescriptedItem(fmt.Sprintf(\"%s %s\", u.command, arguments), description)\n\tu.usages = append(u.usages, di)\n}", "title": "" }, { "docid": "789426aa3123aade6e9bde7e2e0e8c8f", "score": "0.40053883", "text": "func MDTemplateEngine(input string, data map[string]interface{}, helpers map[string]interface{}) (string, error) {\n\tif ct, ok := data[\"contentType\"].(string); ok && ct == \"text/plain\" {\n\t\treturn plush.BuffaloRenderer(input, data, helpers)\n\t}\n\tsource := github_flavored_markdown.Markdown([]byte(input))\n\tsource = []byte(html.UnescapeString(string(source)))\n\treturn plush.BuffaloRenderer(string(source), data, helpers)\n}", "title": "" }, { "docid": "61484d8a736acc5bd252a8d8970a21db", "score": "0.4005066", "text": "func (r *Registry) CreateRepoTag(repoName, tag, mf string) (digest string, err error) {\n\turl := fmt.Sprintf(\"%s/v2/%s/manifests/%s\", r.Address, repoName, tag)\n\treq, err := http.NewRequest(\"PUT\", url, bytes.NewReader([]byte(mf)))\n\tif err != nil {\n\t\treturn\n\t}\n\treq.Header.Set(\"Content-Type\", SCHEMA2_MEDIA_TYPE_MANIFEST)\n\tscope := fmt.Sprintf(\"repository:%s:push\", repoName)\n\tres, err := r.do(req, scope)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer res.Body.Close()\n\n\t_, err = checkAndReadResponse(res)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdigest = res.Header.Get(\"Docker-Content-Digest\")\n\treturn\n}", "title": "" }, { "docid": "a569816d4b92419e3047df244e5d6d05", "score": "0.4002082", "text": "func MarkdownBasic(input []byte) []byte {\n\t// set up the HTML renderer\n\thtmlFlags := HTML_USE_XHTML\n\trenderer := HtmlRenderer(htmlFlags, \"\", \"\")\n\n\t// set up the parser\n\treturn MarkdownOptions(input, renderer, Options{Extensions: 0})\n}", "title": "" }, { "docid": "818dabb1d1da7af5f26b4e6be3c4dbf3", "score": "0.3999724", "text": "func (ReleaseNoteLabel) AddFlags(cmd *cobra.Command, config *github.Config) {}", "title": "" }, { "docid": "fd93737a751001b0acd909f2c6ced70d", "score": "0.39977548", "text": "func WriteMarkdown(w io.Writer, pkg *Package, options ...Option) error {\n\to := &option{}\n\tfor _, opt := range options {\n\t\topt.apply(o)\n\t}\n\tb := bufio.NewWriter(w)\n\tprintHeader(b, pkg, o)\n\tprintTOC(b, pkg)\n\tprintTypes(b, pkg, o)\n\treturn b.Flush()\n}", "title": "" }, { "docid": "8b22ba01d031c9fea58b6271381c463a", "score": "0.39967507", "text": "func (r *Repository) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error {\n\treturn r.Manifests().Tag(ctx, desc, reference)\n}", "title": "" }, { "docid": "9e67b835c19dacdd5c5ebfaf98600a0b", "score": "0.39946362", "text": "func (v *TextTagTable) Add(tag *TextTag) {\n\tC.gtk_text_tag_table_add(v.native(), tag.native())\n\t//return gobool(c) // TODO version-separate\n}", "title": "" }, { "docid": "a6c9b26074da8039b19c0391b756f3cf", "score": "0.39945894", "text": "func (c *DockerImageCopyCmd) AddTags(tag ...string) {\n\n\tif c.Tags == nil {\n\t\tc.Tags = []string{}\n\t}\n\n\tc.Tags = append(c.Tags, tag...)\n}", "title": "" }, { "docid": "da64b2a62b8417288937cdf3f77b1501", "score": "0.398957", "text": "func (h CliClient) AddRepo(ctx context.Context, name, url string) error {\n\tlog.Debug().Print(\"Adding helm repo\", field.M{\"name\": name, \"url\": url})\n\tout, err := RunCmdWithTimeout(ctx, h.helmBin, []string{\"repo\", \"add\", name, url})\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug().Print(\"Result\", field.M{\"output\": out})\n\n\t// Update all repos to fetch the latest charts\n\t_ = h.UpdateRepo(ctx)\n\treturn nil\n}", "title": "" }, { "docid": "78744d7f3c071e240e3b25d04e9419cd", "score": "0.39873934", "text": "func (s *schema) Markdown() string {\n\tbuf := new(bytes.Buffer)\n\n\tfor _, v := range s.sections() {\n\t\tv.write(buf)\n\t}\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "d7e35c0b0cff9bb12230e8d4947a561a", "score": "0.39861754", "text": "func GenerateMarkdown(space *contentful.Space, contentType string) {\n\tpath := config.Hugo.Root + \"/content/\" + contentType\n\tentries, err := contentful.GetEntries(space, contentType)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, item := range entries {\n\t\tfrontMatter := frontMatter{Contentful: item, Type: contentType}\n\t\tcreateFile(frontMatter, path)\n\t}\n\n}", "title": "" }, { "docid": "8c55f9376f85b5299187a9aa673631d8", "score": "0.3982327", "text": "func (cs *CommandSet) AddCmd(verb, helptext string, permissions, handler Handler) error {\n\treturn cs.Add(NewBasicCommand(verb, helptext, permissions, handler))\n}", "title": "" }, { "docid": "4f390ea068742c106064f1661064fd13", "score": "0.3976875", "text": "func (f *feed) Add(body string, timestamp float64) {\n\n\tnPost := newPost(body, timestamp, nil, false, nil)\n\n\toldEnd := f.end.pred\n\n\toldEnd.next = nPost\n\n\tf.end.pred = nPost\n}", "title": "" }, { "docid": "33e7f2cb5b1cd8f630de41e424808556", "score": "0.39741236", "text": "func RenderHTML(markdown string) string {\n\treturn RenderBlockHTML(Parse(markdown))\n}", "title": "" } ]
42c6f212d4aef902e2e8b4280c2fc993
As soon as server is initialized but not run yet, this function will be called. If you need to modify a config, store server instance to stop it individually later, this is the place. This function can be called multiple times, depending on the number of serving schemes. scheme value will be set accordingly: "http", "https" or "unix"
[ { "docid": "b2536a56a6f80ba5c871935414868b66", "score": "0.7435745", "text": "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "title": "" } ]
[ { "docid": "8a64f2f8238dc7c3213a87ec8006b4d8", "score": "0.7718599", "text": "func configureServer(s *graceful.Server, scheme string) {\n}", "title": "" }, { "docid": "16154a2d3aa7b186888bf8bfd007dbae", "score": "0.75215274", "text": "func configureServer(s *http.Server, scheme, addr string) {\r\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "9a6e11a6db483c43ccce08a3ffa56c10", "score": "0.74440163", "text": "func configureServer(s *http.Server, scheme, addr string) {\n}", "title": "" }, { "docid": "581cb11d9a5cab7cf07921cc3e44dfb7", "score": "0.61108136", "text": "func configureServer(s *http.Server, scheme, addr string) {\n\tmatches.Addr(addr)\n}", "title": "" }, { "docid": "e1e36ca887709af167b4352dbd7e2b7b", "score": "0.60715413", "text": "func configureServer(s *http.Server, scheme, addr string) {\n\t// Create message service\n\tmessaging = &messages.Messaging{}\n\n\t// Load the config using the flags\n\tserverConfig = &config.WeaviateConfig{}\n\terr := serverConfig.LoadConfig(connectorOptionGroup, messaging)\n\n\t// Add properties to the config\n\tserverConfig.Hostname = addr\n\tserverConfig.Scheme = scheme\n\n\t// Fatal error loading config file\n\tif err != nil {\n\t\tmessaging.ExitError(78, err.Error())\n\t}\n\n\tloadContextionary()\n\n\tconnectToNetwork()\n\n\t// Connect to MQTT via Broker\n\tweaviateBroker.ConnectToMqtt(serverConfig.Environment.Broker.Host, serverConfig.Environment.Broker.Port)\n\n\t// Create the database connector usint the config\n\t// TODO make this configureable\n\terr, dbConnector := dblisting.NewConnector(serverConfig.Environment.Database.Name, serverConfig.Environment.Database.DatabaseConfig)\n\n\t// Could not find, or configure connector.\n\tif err != nil {\n\t\tmessaging.ExitError(78, err.Error())\n\t}\n\n\t// Construct a (distributed lock)\n\t// TODO: make part of schema manager?\n\tlocalMutex := sync.RWMutex{}\n\tdbLock := database.RWLocker(&localMutex)\n\n\t// Configure schema manager\n\tif serverConfig.Environment.Database.LocalSchemaConfig == nil {\n\t\tmessaging.ExitError(78, \"Local schema manager is not configured.\")\n\t}\n\n\tmanager, err := db_local_schema_manager.New(serverConfig.Environment.Database.LocalSchemaConfig.StateDir, dbConnector)\n\tif err != nil {\n\t\tmessaging.ExitError(78, fmt.Sprintf(\"Could not initialize local database state: %v\", err))\n\t}\n\n\tmanager.RegisterSchemaUpdateCallback(func(updatedSchema schema.Schema) {\n\t\t// Note that this is thread safe; we're running in a single go-routine, because the event\n\t\t// handlers are called when the SchemaLock is still held.\n\n\t\tfmt.Printf(\"UPDATESCHEMA DB: %#v\\n\", db)\n\t\tupdatedGraphQL, err := graphqlapi.Build(&updatedSchema, db)\n\t\tif err != nil {\n\t\t\t// TODO: turn on safe mode\n\t\t\tgraphQL = nil\n\t\t\tmessaging.ErrorMessage(fmt.Sprintf(\"Could not re-generate GraphQL schema, because:\\n%#v\\n\", err))\n\t\t} else {\n\t\t\tmessaging.InfoMessage(\"Updated GraphQL schema\")\n\t\t\tgraphQL = updatedGraphQL\n\t\t}\n\t})\n\n\t// Now instantiate a database, with the configured lock, manager and connector.\n\terr, db = database.New(messaging, dbLock, manager, dbConnector, contextionary)\n\tif err != nil {\n\t\tmessaging.ExitError(1, fmt.Sprintf(\"Could not initialize the database: %s\", err.Error()))\n\t}\n\tmanager.TriggerSchemaUpdateCallbacks()\n}", "title": "" }, { "docid": "af4c7d5c01e7409ad92d736102d61981", "score": "0.5949442", "text": "func StartServer() {\n clientPrefix := \"/\" + goconfig.GetString(config.KEY_CLIENT_BASE_URL) + \"/\";\n\n router := api.CreateRouter(clientPrefix);\n\n // Attach an additional prefix for serving client files.\n http.Handle(clientPrefix, BasicFileServer(clientPrefix, goconfig.GetString(config.KEY_CLIENT_BASE_DIR)));\n\n http.HandleFunc(\"/favicon.ico\", serveFavicon);\n http.HandleFunc(\"/robots.txt\", serveRobots);\n\n http.Handle(\"/\", router);\n\n if (goconfig.GetBool(config.KEY_USE_SSL)) {\n httpsPort := goconfig.GetInt(config.KEY_HTTPS_PORT);\n\n // Forward http\n if (goconfig.GetBoolDefault(config.KEY_FORWARD_HTTP, false) && goconfig.Has(config.KEY_HTTP_PORT)) {\n httpPort := goconfig.GetInt(config.KEY_HTTP_PORT);\n\n go func() {\n err := http.ListenAndServe(fmt.Sprintf(\":%d\", httpPort), http.HandlerFunc(redirectToHttps));\n if err != nil {\n golog.PanicE(\"Failed to redirect http to https\", err);\n }\n }()\n }\n\n // Serve https\n golog.Info(fmt.Sprintf(\"Starting media server on https port %d\", httpsPort));\n\n err := http.ListenAndServeTLS(fmt.Sprintf(\":%d\", httpsPort), goconfig.GetString(config.KEY_HTTPS_CERT_PATH), goconfig.GetString(config.KEY_HTTPS_KEY_PATH), nil);\n if err != nil {\n golog.PanicE(\"Failed to server https\", err);\n }\n } else {\n port := goconfig.GetInt(config.KEY_HTTP_PORT);\n golog.Info(fmt.Sprintf(\"Starting media server on http port %d\", port));\n\n err := http.ListenAndServe(fmt.Sprintf(\":%d\", port), nil);\n if err != nil {\n golog.PanicE(\"Failed to server http\", err);\n }\n }\n}", "title": "" }, { "docid": "bd7517712df007405b6f6f022b311100", "score": "0.58403444", "text": "func InitHTTPServer(bindAddr string, port int, getExtraHandlers ...GinConfigHandlers) {\n\thttpServer = httpService{\n\t\tBindAddr: bindAddr,\n\t\tPort: port,\n\t\trouter: gin.New(),\n\t}\n\n\thttpServer.router.Use(gin.Recovery())\n\thttpServer.router.GET(\"/health\", controllers.HealthHandler)\n\thttpServer.router.GET(\"/google-validate\", controllers.GoogleWebTokenHandler)\n\thttpServer.router.GET(\"/coords\", controllers.CoordsHandler)\n\thttpServer.router.GET(\"/sun\", controllers.SunriseSunsetHandler)\n\thttpServer.AddExtraHandlers(getExtraHandlers...)\n}", "title": "" }, { "docid": "dd2a5edf49d5c4f24d9fcc8748ac19db", "score": "0.5833606", "text": "func main() {\n // Run HTTP server\n fmt.Println(\"Domain: \" + config.String(\"server.domain\"))\n fmt.Println(\"Start rotator server: \" + *flagHost)\n\n if *flagFastCGI {\n fmt.Println(\"FastCGI Mode: ON\")\n }\n if *flagDebug {\n fmt.Println(\"Debug Mode: ON\")\n }\n\n // Run server\n if *flagFastCGI {\n if tcp, err := net.Listen(\"tcp\", *flagHost); nil == err {\n fcgi.Serve(tcp, router.NewRouter(*flagDebug))\n } else if err != nil {\n log.Fatal(err)\n }\n } else {\n var err error\n http.Handle(\"/\", router.NewRouter(*flagDebug))\n http.Handle(\"/public/\", http.FileServer(http.Dir(*flagBaseDir)))\n if err = http.ListenAndServe(*flagHost, nil); nil != err {\n log.Fatal(err)\n }\n }\n}", "title": "" }, { "docid": "6c9f25a9520b18151117ba852a60a5a8", "score": "0.5828507", "text": "func initHttpServer(wg *sync.WaitGroup) bool {\n\tlistenPort := AppConfig.GetInt32(\"server.http.listen_port\", 0)\n\tif listenPort <= 0 {\n\t\tlog.Println(\"No valid [server.http.listen_port] configured, HTTP server is disabled.\")\n\t\treturn false\n\t}\n\tlistenAddr := AppConfig.GetString(\"server.http.listen_addr\", \"127.0.0.1\")\n\te := echo.New()\n\n\trequestTimeout := AppConfig.GetTimeDuration(\"server.request_timeout\", time.Duration(0))\n\tif requestTimeout > 0 {\n\t\te.Server.ReadTimeout = requestTimeout\n\t}\n\n\tbodyLimit := AppConfig.GetByteSize(\"server.max_request_size\")\n\tif bodyLimit != nil && bodyLimit.Int64() > 0 {\n\t\te.Use(middleware.BodyLimit(bodyLimit.String()))\n\t}\n\n\te.POST(\"/api/log\", httpHandlerLog)\n\te.PUT(\"/api/log\", httpHandlerLog)\n\n\tlog.Printf(\"Starting [%s] HTTP server on [%s:%d]...\\n\", AppConfig.GetString(\"app.name\")+\" v\"+AppConfig.GetString(\"app.version\"), listenAddr, listenPort)\n\tgo func() {\n\t\terr := e.Start(fmt.Sprintf(\"%s:%d\", listenAddr, listenPort))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\twg.Done()\n\t}()\n\treturn true\n}", "title": "" }, { "docid": "37fdb583d915f912cfdb1e685bd42e89", "score": "0.5776189", "text": "func InitServer(state State) {\n\tfmt.Println(\"[SERVER] Starting server\")\n\tfmt.Println(\"[SERVER] Magic is happening in port\", port)\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", QueryHandler(state))\n\n\t//CORS accept *\n\thandler := cors.Default().Handler(mux)\n\thttp.ListenAndServe(port, handler)\n}", "title": "" }, { "docid": "1371fbb216b512ea33e023a71077e6d5", "score": "0.57624745", "text": "func (rc *routeConfig) startHttpServer() {\n\t// start a http server only if no other configuration previously started the server on given port\n\tmutex.Lock()\n\tif _, ok := activeServers[rc.sgConfig.Port]; !ok {\n\t\trc.configExecutor.Log.Info().Str(\"config-key\", rc.gatewayConfig.Data.Src).Str(\"port\", rc.sgConfig.Port).Msg(\"http server will start listening\")\n\t\ts := &server{\n\t\t\tmux: http.NewServeMux(),\n\t\t}\n\t\trc.sgConfig.mux = s.mux\n\t\trc.sgConfig.srv = &http.Server{\n\t\t\tAddr: \":\" + fmt.Sprintf(\"%s\", rc.sgConfig.Port),\n\t\t\tHandler: s,\n\t\t}\n\t\tactiveServers[rc.sgConfig.Port] = s.mux\n\n\t\t// start http server\n\t\tgo func() {\n\t\t\terr := rc.sgConfig.srv.ListenAndServe()\n\t\t\trc.configExecutor.Log.Info().Str(\"config-key\", rc.gatewayConfig.Data.Src).Str(\"port\", rc.sgConfig.Port).Msg(\"http server stopped\")\n\t\t\tif err == http.ErrServerClosed {\n\t\t\t\terr = nil\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\trc.gatewayConfig.ErrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t}\n\tmutex.Unlock()\n}", "title": "" }, { "docid": "6cd4e3d26689327563b6d7b108b58c68", "score": "0.57062936", "text": "func setupServer() {\n\ts := http.NewServeMux()\n\ts.HandleFunc(\"/content\", handler)\n\n\tgo func() {\n\t\tfor {\n\t\t\tp := fmt.Sprintf(\":%v\", PORT)\n\t\t\tLOCAL_URL = \"http://localhost\" + p\n\n\t\t\terr := http.ListenAndServe(\n\t\t\t\tp,\n\t\t\t\ts,\n\t\t\t)\n\n\t\t\tif err != nil {\n\t\t\t\tPORT += 1\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "5d776c5ff5726255af099cb1d953d5f7", "score": "0.5674001", "text": "func initHTTPServer() {\n\tlog.Println(\"Starting thepingpong service\")\n\tportvalue := \"8287\" // TODO add setting parameter\n\tif portvalue == \"\" { // check service port\n\t\tfmt.Println(\"You have not defined the application port SERVICE_APP_PORT environment variable, so we are going to use [8287] value\")\n\t\tfmt.Println()\n\t\tportvalue = \"8287\"\n\t}\n\tlog.Println(\"Starting application on \", portvalue)\n\n\twebserver.StartWebServer(portvalue)\n}", "title": "" }, { "docid": "dcf63351ff4518052249ded516b84a54", "score": "0.5618868", "text": "func setupWebServer(config *configuration) *webServer {\n\tws := config.Web\n\tif ws == nil {\n\t\tws = new(webServer)\n\t}\n\n\tws.serverID = ksuid.New().String()\n\n\tif len(config.Server.Ports.HTTP) == 0 {\n\t\tconfig.Server.Ports.HTTP = defaultHTTPPort\n\t}\n\n\tws.http = new(serveHTTP)\n\tws.http.Router = chi.NewRouter()\n\tws.http.Use(log.HTTPMiddleware)\n\tws.http.server = &http.Server{Addr: config.Server.Ports.HTTP, Handler: ws.http.Router}\n\n\tif len(config.Server.Ports.HTTPS) == 0 {\n\t\tconfig.Server.Ports.HTTPS = defaultHTTPSPort\n\t}\n\n\tws.https = new(serveHTTPS)\n\tws.https.Router = chi.NewRouter()\n\tws.https.Use(log.HTTPMiddleware)\n\tws.https.server = &http.Server{Addr: config.Server.Ports.HTTPS, Handler: ws.https.Router}\n\n\tif config.Server.ForceHTTP {\n\t\treturn ws\n\n\t}\n\t// if we're gonna do HTTPS then load certs or grab some LetsEncrypt certs to serve uo TLS\n\n\tvar tlsConfig *tls.Config\n\tcrt, key, uri := config.Server.Certs.Certificate, config.Server.Certs.PrivateKey, config.Server.LetsEncrypt.CertificateURI\n\n\tcrtL, keyL, uriL := len(crt), len(key), len(uri)\n\tswitch {\n\tcase (crtL > 0 || keyL > 0) && uriL > 0:\n\t\tlog.Fatal(\"must use only server.certs.private_key and server.certs.certificate and not letencrypt.uri or vice versa\")\n\tcase crtL > 0 && keyL == 0, crtL == 0 && keyL > 0:\n\t\tlog.Fatal(\"must have both server.certs.private_key and server.certs.certificate\")\n\tcase crtL == 0 && keyL == 0 && uriL == 0 && !config.Server.ForceHTTP:\n\t\tlog.Fatal(\"must have a server.certs.private_key and server.certs.certificate or letsencrypt.uri, or use force_http\")\n\t}\n\n\tif crtL > 0 {\n\t\tcert, err := tls.LoadX509KeyPair(crt, key)\n\t\tlog.OnErr(err).Fatalf(\"load tls certificate and private key: %v\", err)\n\n\t\ttlsConfig = &tls.Config{\n\t\t\tCertificates: []tls.Certificate{cert},\n\t\t}\n\t}\n\n\tif uriL > 0 {\n\t\tif len(config.Server.LetsEncrypt.Email) == 0 {\n\t\t\tlog.Fatalf(\"letsencrypt needs an email\")\n\t\t}\n\n\t\tu, err := url.Parse(uri)\n\t\tlog.OnErr(err).Fatalf(\"letsencrypt uri: %v\", err)\n\n\t\tvar certStore autocert.Cache\n\t\tswitch strings.ToLower(u.Scheme) {\n\t\tcase \"s3\":\n\t\t\tcertStore, err = s3cache.NewDSN(uri)\n\t\t\tlog.OnErr(err).Fatalf(\"letsencrypt s3 cache: %v\", err)\n\t\tcase \"file\":\n\t\t\tcertStore = autocert.DirCache(u.Path)\n\t\tdefault:\n\t\t\tlog.Field(\"scheme\", u.Scheme).Fatalf(\"letsencrypt invalid store scheme\")\n\t\t}\n\n\t\tmanager := &autocert.Manager{\n\t\t\tEmail: config.Server.LetsEncrypt.Email,\n\t\t\tCache: certStore,\n\t\t\tPrompt: autocert.AcceptTOS,\n\t\t\tHostPolicy: autocert.HostWhitelist(config.Server.LetsEncrypt.DomainWhitelist...),\n\t\t}\n\t\ttlsConfig = &tls.Config{\n\t\t\tGetCertificate: manager.GetCertificate,\n\t\t}\n\n\t\tws.http.Handle(\"/\", manager.HTTPHandler(nil))\n\t}\n\n\tws.https.server.TLSConfig = tlsConfig\n\n\treturn ws\n}", "title": "" }, { "docid": "aaa22ad6e6b55a10a45180d553d62df6", "score": "0.5603172", "text": "func runServer() {\n\thttp.HandleFunc(\"/kill\", handlerKill)\n\thttp.HandleFunc(\"/chrome\", handlerKill)\n\tlog.Println(\"Listening on \" + LISTEN_URL)\n\terr := http.ListenAndServe(LISTEN_URL, nil)\n\tif err != nil {\n\t\tlog.Fatalln(\"ListenAndServe:\", err)\n\t}\n}", "title": "" }, { "docid": "2dab47acb99f4910d1806943964067f1", "score": "0.5587067", "text": "func RunWithDefaultServerConfig(sm *mux.Router) {\n\tdefaultServer := &http.Server{\n\t\tAddr: \":8080\",\n\t\tHandler: sm,\n\t\tReadTimeout: 1 * time.Second,\n\t\tWriteTimeout: 1 * time.Second,\n\t\tIdleTimeout: 120 * time.Second,\n\t}\n\tRun(defaultServer)\n}", "title": "" }, { "docid": "0bf8ba5d3696c2e89c8a69f98ed6bc41", "score": "0.5576277", "text": "func initRpcServer(){\n\ts := rpc.NewServer()\n\ts.RegisterCodec(json.NewCodec(), \"application/json\")\n\ts.RegisterCodec(json.NewCodec(), \"application/json;charset=UTF-8\")\n\tarith := new(Proxy)\n\ts.RegisterService(arith, \"\")\n\tr := mux.NewRouter()\n\tr.Handle(\"/rpc\", s)\n\tif e := http.ListenAndServe(\"127.0.0.1:1234\", r); e != nil{\n\t\tif strings.Contains(e.Error(),\"already in use\") && gui {\n\t\t\tsendRpcMsg(\"fatal\",[1]string{\"RPC port 1234 in use, terminate it and try again\"})\n\t\t}else{\n\t\t\tlog.Fatal(e)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3d2f916718257907a7ba7d5b72ef226e", "score": "0.5571424", "text": "func CreateSingle(scheme string, cfg map[string]interface{}, fh httpHandleFunc) (err error) {\n\tfmt.Println(scheme)\n\tswitch scheme {\n\tcase \"ws\":\n\t\terr = httpServer(scheme, cfg, fh)\n\t\tbreak\n\tcase \"wss\":\n\t\terr = httpsServer(scheme, cfg, fh)\n\t\tbreak\n\t}\n\treturn err\n}", "title": "" }, { "docid": "928324270c969af3e093284138d7645a", "score": "0.5557031", "text": "func launchServer() {\r\n\tr := mux.NewRouter().\r\n\t\tStrictSlash(true)\r\n\r\n\t// Grab all our config junk and prepare to launch\r\n\tip := viper.GetString(\"ListenAddr\")\r\n\tport := viper.GetInt(\"ListenPort\")\r\n\tfmt.Println(viper.GetInt(\"ListenPort\"))\r\n\r\n\t\r\n\r\n\t// I... I guess, if you want TLS, you can totally have it\r\n\tcert, key := viper.GetString(\"CertFile\"), viper.GetString(\"KeyFile\")\r\n\tuseTLS := len(cert) > 0 && len(key) > 0\r\n\tscheme := \"https\"\r\n\tif !useTLS {\r\n\t\tif port == 0 { port = 80 }\r\n\t\tscheme = \"http\"\r\n\t} else if port == 0 { port = 443 }\r\n\r\n\tp := fmt.Sprintf(\"%s:%d\", ip, port)\r\n\r\n\troot, files := viper.GetString(\"ServerRoot\"), viper.GetString(\"StaticFiles\")\r\n\r\n\treload, err := lr.New(lr.DefaultName, lr.DefaultPort)\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t\tos.Exit(1)\r\n\t}\r\n\tgo reload.ListenAndServe()\r\n\r\n\tr.PathPrefix(root).\r\n\tHandler( \r\n\t\thandlers.CombinedLoggingHandler(\r\n\t\t\tos.Stdout, injectReload(root, files, scheme),\r\n\t\t),\r\n\t)\r\n\r\n\tgo func() {\r\n\t\tfmt.Printf(\"Launching ogload on %s\\n\", p)\r\n\t\tif !useTLS {\r\n\t\t\tif err := http.ListenAndServe(p, r); err != nil {\r\n\t\t\t\tfmt.Printf(\"Server failed! scheme=%s, addr=%s, err=%v\\n\", scheme, p, err)\r\n\t\t\t\tos.Exit(1)\r\n\t\t\t}\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif err := http.ListenAndServeTLS(p, cert, key, r); err != nil {\r\n\t\t\tfmt.Printf(\"TLS Server failed! scheme=%s, addr=%s, err=%v\\n\", scheme, p, err)\r\n\t\t\tos.Exit(1)\r\n\t\t}\r\n\t}()\r\n\r\n\twait := watchDir(files, reload)\r\n\t<- wait\r\n}", "title": "" }, { "docid": "740d1a0698c4def1d88b0a3c688578b9", "score": "0.553682", "text": "func InitServer(addr string) (*http.Server, error) {\n\tr, err := loadRouter()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrv := &http.Server{\n\t\tHandler: r,\n\t\tAddr: addr,\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\treturn srv, nil\n}", "title": "" }, { "docid": "e8b4ce00de4098c147d55766938bdc3f", "score": "0.55234337", "text": "func ServerListenAndServe(srv *http.Server,) error", "title": "" }, { "docid": "aee40bff592de2efa5527062a0626b90", "score": "0.5503801", "text": "func (s *Server) setupHTTPServer() {\n\tlogging.SugaredLog.Debugf(\"Create new HTTP server on port %d\", s.config.RestPort)\n\n\tif s.config != nil {\n\t\ts.httpServer = &http.Server{\n\t\t\tAddr: fmt.Sprintf(httpServerHostFormat, s.config.RestHost, s.config.RestPort),\n\t\t\tHandler: s.router,\n\t\t\t// Good practice to set timeouts to avoid Slowloris attacks.\n\t\t\tWriteTimeout: httpServerWriteTimeoutDefault,\n\t\t\tReadTimeout: httpServerReadTimeoutDefault,\n\t\t\tIdleTimeout: httpServerIdelTimeoutDefault,\n\t\t}\n\t\treturn\n\t}\n\n\tlogging.Log.Error(\"HTTP server creation failed: REST server configurations not initialized\")\n}", "title": "" }, { "docid": "97e8cb9b3066dd8fb66d484a2686c1a3", "score": "0.5493766", "text": "func ListenAndServe(listenAddr string, r http.Handler) error {\r\n\tvar err error\r\n\tswitch Protocol {\r\n\tcase SCHEME_HTTP:\r\n\t\terr = http.ListenAndServe(listenAddr, r)\r\n\tcase SCHEME_HTTPS:\r\n\t\tserver := &http.Server{Addr: listenAddr, TLSConfig: &tls.Config{\r\n\t\t\tMinVersion: tls.VersionTLS10,\r\n\t\t\tCurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},\r\n\t\t\tPreferServerCipherSuites: true,\r\n\t\t\tCipherSuites: []uint16{\r\n\t\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\r\n\t\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, // Required for HTTP/2 support.\r\n\t\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,\r\n\t\t\t\ttls.TLS_RSA_WITH_AES_256_CBC_SHA,\r\n\t\t\t},\r\n\t\t}, Handler: r}\r\n\t\terr = server.ListenAndServeTLS(CertFile, KeyFile)\r\n\tcase SCHEME_FCGI:\r\n\t\terr = fcgi.Serve(nil, r)\r\n\tcase SCHEME_UNIX_SOCKET:\r\n\t\tos.Remove(listenAddr)\r\n\r\n\t\tvar listener *net.UnixListener\r\n\t\tlistener, err = net.ListenUnix(\"unix\", &net.UnixAddr{Name: listenAddr, Net: \"unix\"})\r\n\t\tif err != nil {\r\n\t\t\tbreak // Trigger error after switch\r\n\t\t}\r\n\r\n\t\t// FIXME: add proper implementation of signal capture on all protocols\r\n\t\t// execute this on SIGTERM or SIGINT: listener.Close()\r\n\t\tif err = os.Chmod(listenAddr, os.FileMode(UnixSocketPermission)); err != nil {\r\n\t\t\tlog.Fatalf(\"Failed to set permission of unix socket: %v\", err)\r\n\t\t}\r\n\t\terr = http.Serve(listener, r)\r\n\tdefault:\r\n\t\tlog.Fatalf(\"Invalid protocol: %s\", Protocol)\r\n\t}\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"Fail to start server: %v\", err)\r\n\t}\r\n\treturn err\r\n}", "title": "" }, { "docid": "e9afe3276f94b03b6ee12d951ea67ffb", "score": "0.5491852", "text": "func Server() {\n\t// suscripción SIGINT\n\tstopChan := make(chan os.Signal)\n\tsignal.Notify(stopChan, os.Interrupt)\n\n\tmux := http.NewServeMux()\n\n\t// Logger starts\n\ttracelog.StartFile(1, \"log/log-server\", 30)\n\n\t// Endpoints\n\tmux.Handle(\"/register\", http.HandlerFunc(register))\n\tmux.Handle(\"/login\", http.HandlerFunc(loginWithToken))\n\tmux.HandleFunc(\"/list\", ValidateMiddleware(listUserFiles))\n\tmux.HandleFunc(\"/upload\", ValidateMiddleware(uploadEndpoint))\n\tmux.HandleFunc(\"/download\", ValidateMiddleware(downloadEndpoint))\n\tmux.HandleFunc(\"/delete\", ValidateMiddleware(delete))\n\n\tmux.Handle(\"/gen-secret\", http.HandlerFunc(GenerateSecret))\n\tmux.Handle(\"/2fauth\", http.HandlerFunc(VerifyOtpEndpoint))\n\tmux.Handle(\"/getFauth\", http.HandlerFunc(getUserFauth))\n\n\t//mux.Handle(\"/checkUserFA\", http.HandlerFunc(checkFAEnabledEndpoint))\n\tmux.Handle(\"/enableTwoFA\", http.HandlerFunc(enableTwoFAEndpoint))\n\tmux.Handle(\"/disableTwoFA\", http.HandlerFunc(disableTwoFAEndpoint))\n\n\tsrv := &http.Server{Addr: \":10443\", Handler: mux}\n\n\tgo func() {\n\t\tif err := srv.ListenAndServeTLS(\"cert.pem\", \"key.pem\"); err != nil {\n\t\t\tlog.Printf(\"listen: %s\\n\", err)\n\t\t}\n\t}()\n\n\t<-stopChan // Waits for SIGINT signal\n\tlog.Println(\"Turning off server...\")\n\n\t// Secure server turn down\n\tctx, fnc := context.WithTimeout(context.Background(), 5*time.Second)\n\tfnc()\n\tsrv.Shutdown(ctx)\n\n\tlog.Println(\"Server stopped successfully\")\n}", "title": "" }, { "docid": "d17a03c17c5610f3930ad02c6985bfec", "score": "0.54865474", "text": "func newServer(options ...Option) (*server, error) {\n\tctx, cancelFunc := context.WithCancel(context.Background())\n\ts := &server{\n\t\tport: defaultServerPort,\n\t\tcancelFunc: cancelFunc,\n\t\tworkers: newWorkerPool(ctx),\n\t\tgracefulTimeout: defaultShutdownTimeout * time.Second,\n\t\tshutdownHooks: make(map[string]domain.Shutdown),\n\t\tctx: ctx,\n\t}\n\n\ts.setRouterdefaults()\n\n\t// apply options\n\tfor _, option := range options {\n\t\tif err := option(s); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// set global logger\n\tif s.logger != nil {\n\t\tlog.Logger = s.logger.Logger\n\t}\n\n\tif s.logger == nil {\n\t\tl := logger.Nop()\n\t\ts.logger = &l\n\t}\n\n\t// append default middleware\n\ts.middleware = append(s.middleware, DefaultMiddleware()...)\n\n\ts.router.Use(s.middleware...)\n\n\t// recover is not optional\n\ts.router.Use(s.recoverer)\n\n\tif s.sentry {\n\t\tsentryMiddleware := sentryhttp.New(sentryhttp.Options{\n\t\t\tRepanic: true,\n\t\t})\n\t\ts.router.Use(sentryMiddleware.Handle)\n\t}\n\n\t// cors is not optional\n\ts.router.Use(\n\t\tcors.Handler(cors.Options{\n\t\t\t// AllowedOrigins: []string{\"https://foo.com\"}, // Use this to allow specific origin hosts\n\t\t\tAllowedOrigins: []string{\"*\"},\n\t\t\t// AllowOriginFunc: func(r *http.Request, origin string) bool { return true },\n\t\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"},\n\t\t\tAllowedHeaders: []string{\"Accept\", \"Authorization\", \"Content-Type\", \"X-CSRF-Token\"},\n\t\t\tExposedHeaders: []string{\"Link\"},\n\t\t\tAllowCredentials: false,\n\t\t\tMaxAge: 300, // Maximum value not ignored by any of major browsers\n\t\t}),\n\t)\n\n\t// setting up request logging middleware\n\tif !s.disableRequestLogger {\n\t\ts.router.Use(middleware.RequestLogger(&log.Logger, s.ignore404Paths...))\n\t}\n\n\t// setup oto server\n\tif s.oto != nil {\n\t\tlog.Info().Msg(\"starting with oto service\")\n\t\ts.router.HandleFunc(\"/oto/*\", s.oto.ServeHTTP)\n\t}\n\n\t// setting default services\n\ts.setDefaultServices()\n\n\t// apply default routes\n\ts.routes()\n\n\t// register services with ikuzo server and router\n\tfor _, svc := range s.services {\n\t\tif err := s.registerService(svc); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// apply custom routes\n\tfor _, f := range s.routerFuncs {\n\t\tf(s.router)\n\t}\n\n\tif s.introspect {\n\t\ts.router.Get(\"/introspect/routes\", func(w http.ResponseWriter, req *http.Request) {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.Write([]byte(docgen.JSONRoutesDoc(s.router)))\n\t\t})\n\t}\n\n\t// s.logger.Debug().Msg(docgen.JSONRoutesDoc(s.router))\n\t// TODO: maybe add server validation function\n\n\treturn s, nil\n}", "title": "" }, { "docid": "b9f0e525f4380d43922e3d57e4b1fd04", "score": "0.5453479", "text": "func (p *Plugin) AfterInit() (err error) {\n\tcfgCopy := *p.Config\n\n\tvar handler http.Handler = p.mx\n\tif p.Authenticator != nil {\n\t\thandler = auth(handler, p.Authenticator)\n\t}\n\n\tp.server, err = ListenAndServe(cfgCopy, handler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif cfgCopy.UseHTTPS() {\n\t\tp.Log.Info(\"Listening on https://\", cfgCopy.Endpoint)\n\t} else {\n\t\tp.Log.Info(\"Listening on http://\", cfgCopy.Endpoint)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e700496bc271a48f8d178552088b7aa", "score": "0.5434897", "text": "func setupHTTPServerSettings(cfg *Config) error {\n\t// Setup default values if none were provided. Only the file path\n\t// defaults need to be checked. All other defaults should be set\n\t// on the original config initialization.\n\tif cfg.HTTPSCert == \"\" {\n\t\tcfg.HTTPSCert = DefaultHTTPSCert\n\t}\n\tif cfg.HTTPSKey == \"\" {\n\t\tcfg.HTTPSKey = filepath.Join(cfg.HomeDir, defaultHTTPSKeyFilename)\n\t}\n\tif cfg.CookieKeyFile == \"\" {\n\t\tcfg.CookieKeyFile = filepath.Join(cfg.HomeDir, defaultCookieKeyFilename)\n\t}\n\n\t// Clean file paths\n\tcfg.HTTPSCert = util.CleanAndExpandPath(cfg.HTTPSCert)\n\tcfg.HTTPSKey = util.CleanAndExpandPath(cfg.HTTPSKey)\n\tcfg.CookieKeyFile = util.CleanAndExpandPath(cfg.CookieKeyFile)\n\n\t// Add the default listener if none were specified. The\n\t// default listener is all addresses on the listen port\n\t// for the network we are to connect to.\n\tport := DefaultMainnetPort\n\tif cfg.TestNet {\n\t\tport = DefaultTestnetPort\n\t}\n\tif len(cfg.Listeners) == 0 {\n\t\tcfg.Listeners = []string{\n\t\t\tnet.JoinHostPort(\"\", port),\n\t\t}\n\t}\n\n\t// Add default port to all listener addresses if needed\n\t// and remove duplicate addresses.\n\tcfg.Listeners = normalizeAddresses(cfg.Listeners, port)\n\n\treturn nil\n}", "title": "" }, { "docid": "92ebdced076e7c31f0d10b8c8da574c5", "score": "0.54304165", "text": "func (s *Server) Run() error {\n\tif s.GetConf(ConfFCGIBind) != \"\" {\n\t\treturn s.FastCGI()\n\t}\n\thttpAddr := s.GetConf(ConfHTTPBind)\n\thttpsAddr := s.GetConf(ConfHTTPSBind)\n\n\tlog.Debugf(\"Run(). httpAddr = %s, httpsAddr = %s\", httpAddr, httpsAddr)\n\n\tif httpAddr != \"\" && httpsAddr != \"\" {\n\t\treturn s.serveBoth(httpsAddr, httpAddr)\n\t}\n\tif httpAddr != \"\" {\n\t\treturn s.serveHTTP(httpAddr)\n\t}\n\treturn s.serveHTTPS(httpsAddr)\n}", "title": "" }, { "docid": "4090e45a6fdca2c28c436ed570d0e4a0", "score": "0.54143065", "text": "func SetServer(r *mux.Router) *http.Server {\n\tallowedOrigins := handlers.AllowedOrigins([]string{\"*\"}) // Allowing all origin as of now\n\n\tallowedHeaders := handlers.AllowedHeaders([]string{\n\t\t\"X-Requested-With\",\n\t\t\"X-CSRF-Token\",\n\t\t\"X-Auth-Token\",\n\t\t\"Content-Type\",\n\t\t\"processData\",\n\t\t\"contentType\",\n\t\t\"Origin\",\n\t\t\"Authorization\",\n\t\t\"Accept\",\n\t\t\"Client-Security-Token\",\n\t\t\"Accept-Encoding\",\n\t\t\"timezone\",\n\t\t\"locale\",\n\t})\n\n\tallowedMethods := handlers.AllowedMethods([]string{\n\t\t\"POST\",\n\t\t\"GET\",\n\t\t\"DELETE\",\n\t\t\"PUT\",\n\t\t\"PATCH\",\n\t\t\"OPTIONS\"})\n\n\tallowCredential := handlers.AllowCredentials()\n\n\ts := &http.Server{\n\t\tAddr: \":\" + servicePort,\n\t\t//\tHandler: r,\n\t\tHandler: handlers.CORS(\n\t\t\tallowedHeaders,\n\t\t\tallowedMethods,\n\t\t\tallowedOrigins,\n\t\t\tallowCredential)(\n\t\t\tcontext.ClearHandler(\n\t\t\t\tr,\n\t\t\t)),\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 30 * time.Second,\n\t\t// MaxHeaderBytes: 1 << 20,\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "b630d9edba0a06e8819012e3a9044eac", "score": "0.5406362", "text": "func NewServer() *Server {\n s := &Server {\n Server: http.NewServer(),\n Handler: NewHandler(),\n }\n s.Server.Handler = s.Handler.Handler\n\n //use a random port\n s.Addr = \":0\"\n\n return s\n}", "title": "" }, { "docid": "5f6ec9247738176030993ad93e372af7", "score": "0.54060477", "text": "func main() {\n\n\tinitCache()\n\n\tstop := make(chan os.Signal, 1)\n\n\tsignal.Notify(stop, os.Interrupt)\n\n\taddr := \":\" + os.Getenv(\"PORT\")\n\tif addr == \":\" {\n\t\taddr = \":2017\"\n\t}\n\n\tm := http.NewServeMux()\n\n\ts := http.Server{Addr: \":8000\", Handler: m}\n\n\t// creating a new file server\n\tfileServer := http.FileServer(http.Dir(\"/Users/josefkim/go-workspace/personal-website/src/main/stylesheets\"))\n\n\t// Use the m.Handle() function to register the file server as the handler for\n\t// all URL paths that start with \"/stylesheets/\". For matching paths, we strip the\n\t// \"/stylesheets\" prefix before the request reaches the file server.\n\tm.Handle(\"/stylesheets/\", http.StripPrefix(\"/stylesheets\", fileServer))\n\n\t//looks for css files and returns if cannot find them\n\tif _, err := os.Stat(\"/Users/josefkim/go-workspace/personal-website/src/main/stylesheets/fp.css\"); err != nil {\n\t\tfmt.Println(\"couldnt find css files\")\n\t}\n\n\tm.HandleFunc(\"/\", frontPageHandler)\n\tm.HandleFunc(\"/AboutMe\", aboutmeHandler)\n\tm.HandleFunc(\"/ProjectsPage\", projectPageHandler)\n\tm.HandleFunc(\"/ContactMe\", contactmeHandler)\n\tm.HandleFunc(\"/loginPage\", loginPageHandler)\n\tm.HandleFunc(\"/cvRequestsTable\", cvRequestsTableHandler)\n\n\t//login handler without json body\n\tm.HandleFunc(\"/login\", loginHandler)\n\tm.HandleFunc(\"/CreateNewCVRequest\", createNewCVRequest)\n\n\t//login handler with json body\n\t//m.HandleFunc(\"/signin\", signin)\n\tm.HandleFunc(\"/welcome\", welcome)\n\tm.HandleFunc(\"/refreshToken\", refreshToken)\n\n\tm.HandleFunc(\"/fetchRequests\", fetchRequests)\n\n\tm.HandleFunc(\"/deleteRequest\", deleteRequest)\n\n\tm.HandleFunc(\"/replyRequest\", replyRequest)\n\n\tm.HandleFunc(\"/shutdown\", func(w http.ResponseWriter, r *http.Request) {\n\t\ts.Shutdown(context.Background())\n\t})\n\tgo func() {\n\t\tif erro := s.ListenAndServe(); erro != nil {\n\t\t\tfmt.Println(\"error while shutting down\")\n\t\t\tlog.Fatal(erro)\n\t\t}\n\t}()\n\t<-stop\n\n\tlog.Printf(\"Finsihed\")\n\ts.Shutdown(context.Background())\n\n}", "title": "" }, { "docid": "093ae45be24921208032676e4e9b45f8", "score": "0.5405633", "text": "func (mCtx *mainContext) configureServerCallback(s *http.Server, scheme, addr string) {\n\tmCtx.Log.Infof(\"ConfigureServerCallback %s %s\", scheme, addr)\n}", "title": "" }, { "docid": "d685b340c065454e7f86eb156d36cf09", "score": "0.53987664", "text": "func (c *Coordinator) server() {\n\trpc.Register(c)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := coordinatorSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "d685b340c065454e7f86eb156d36cf09", "score": "0.53987664", "text": "func (c *Coordinator) server() {\n\trpc.Register(c)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := coordinatorSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "d685b340c065454e7f86eb156d36cf09", "score": "0.53987664", "text": "func (c *Coordinator) server() {\n\trpc.Register(c)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := coordinatorSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "d685b340c065454e7f86eb156d36cf09", "score": "0.53987664", "text": "func (c *Coordinator) server() {\n\trpc.Register(c)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := coordinatorSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "d685b340c065454e7f86eb156d36cf09", "score": "0.53987664", "text": "func (c *Coordinator) server() {\n\trpc.Register(c)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := coordinatorSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "d685b340c065454e7f86eb156d36cf09", "score": "0.53987664", "text": "func (c *Coordinator) server() {\n\trpc.Register(c)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := coordinatorSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "16e7f6e10a482a3e5b402538433a09d3", "score": "0.539114", "text": "func ListenAndServe(ctx context.Context,\n\tconfig *ServerConfig, kbfsConfig libkbfs.Config) (err error) {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tlibmime.Patch(additionalMimeTypes)\n\n\tserver := &Server{\n\t\tconfig: config,\n\t\tkbfsConfig: kbfsConfig,\n\t\trootLoader: NewDNSRootLoader(config.Logger),\n\t}\n\tserver.siteCache, err = lru.NewWithEvict(fsCacheSize, server.siteCacheEvict)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmanager, err := makeACMEManager(\n\t\tkbfsConfig, config.UseStaging, config.CertStore, server.allowDomain)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif manager.Client == nil || len(manager.Client.DirectoryURL) == 0 {\n\t\tconfig.Logger.Info(\"ListenAndServe\",\n\t\t\tzap.String(\"acme directory url\", autocert.DefaultACMEDirectory))\n\t} else {\n\t\tconfig.Logger.Info(\"ListenAndServe\",\n\t\t\tzap.String(\"acme directory url\", manager.Client.DirectoryURL))\n\t}\n\n\thttpsServer := http.Server{\n\t\tHandler: server,\n\t\tReadHeaderTimeout: httpReadHeaderTimeout,\n\t\tIdleTimeout: httpIdleTimeout,\n\t\tErrorLog: log.New(&logForwarder{\n\t\t\tmsg: \"http error log\",\n\t\t\tlogFunc: config.Logger.Error,\n\t\t}, \"\", 0),\n\t}\n\n\thttpServer := http.Server{\n\t\tAddr: \":80\",\n\t\t// Enable http-01 by calling the HTTPHandler method, and set the\n\t\t// fallback HTTP handler to nil. As described in the autocert doc\n\t\t// (https://github.com/golang/crypto/blob/13931e22f9e72ea58bb73048bc752b48c6d4d4ac/acme/autocert/autocert.go#L248-L251),\n\t\t// this means for requests not for ACME domain verification, a default\n\t\t// fallback handler is used, which redirects all HTTP traffic using GET\n\t\t// and HEAD to HTTPS using 302 Found, and responds with 400 Bad Request\n\t\t// for requests with other methods.\n\t\tHandler: manager.HTTPHandler(nil),\n\t\tReadHeaderTimeout: httpReadHeaderTimeout,\n\t\tIdleTimeout: httpIdleTimeout,\n\t}\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tshutdownCtx, cancel := context.WithTimeout(\n\t\t\tcontext.Background(), gracefulShutdownTimeout)\n\t\tdefer cancel()\n\t\t_ = httpsServer.Shutdown(shutdownCtx)\n\t\t_ = httpServer.Shutdown(shutdownCtx)\n\t}()\n\n\tgo func() {\n\t\terr := httpServer.ListenAndServe()\n\t\tif err != nil {\n\t\t\tconfig.Logger.Error(\"http.ListenAndServe:80\", zap.Error(err))\n\t\t}\n\t}()\n\n\treturn httpsServer.Serve(manager.Listener())\n}", "title": "" }, { "docid": "48f6f2e1d583665b19ac7dd63fa81fda", "score": "0.53872275", "text": "func Init(options Options) Server {\n\tserver := echo.New()\n\tgqlHandler := customNewServer(options.Schema, options.Introspection)\n\tplaygroundHandler := getPlaygroundHandler(options.Playground)\n\n\tserver.Use(middleware.Recover())\n\n\tif options.AntiCSRF {\n\t\tserver.Use(middleware.CSRF())\n\t}\n\n\tserver.GET(graphqlUrl, func(ctx echo.Context) error {\n\t\tif ctx.Request().Header.Get(\"Upgrade\") == \"websocket\" {\n\t\t\tgqlHandler.ServeHTTP(ctx.Response(), ctx.Request())\n\n\t\t\treturn nil\n\t\t}\n\n\t\tif playgroundHandler != nil {\n\t\t\tplaygroundHandler.ServeHTTP(ctx.Response(), ctx.Request())\n\n\t\t\treturn nil\n\t\t}\n\n\t\treturn echo.ErrNotFound\n\t})\n\n\tserver.POST(graphqlUrl, func(ctx echo.Context) error {\n\t\tgqlHandler.ServeHTTP(ctx.Response(), ctx.Request())\n\n\t\treturn nil\n\t})\n\n\treturn Server{\n\t\tEcho: server,\n\t\tPort: options.Port,\n\t}\n}", "title": "" }, { "docid": "2d434c04905597ab2ef9bba28423ada5", "score": "0.5369493", "text": "func init() {\n\tsockPath := os.Getenv(gocsi.EnvVarEndpoint)\n\tsockPath = strings.TrimPrefix(sockPath, UnixSocketPrefix)\n\tif len(sockPath) > 1 { // minimal valid path length\n\t\tos.Remove(sockPath)\n\t}\n}", "title": "" }, { "docid": "6283ed461f6b62671ac48ea351983c8c", "score": "0.53647006", "text": "func endpointScheme(config Config) string {\n\tif config.Listener == \"\" {\n\t\tconfig.Listener = KineSocket\n\t}\n\n\tnetwork, _ := networkAndAddress(config.Listener)\n\tif network != \"unix\" {\n\t\tnetwork = \"http\"\n\t}\n\n\tif config.ServerTLSConfig.CertFile != \"\" && config.ServerTLSConfig.KeyFile != \"\" {\n\t\t// yes, etcd supports the \"unixs\" scheme for TLS over unix sockets\n\t\tnetwork += \"s\"\n\t}\n\n\treturn network\n}", "title": "" }, { "docid": "cf631715f9c204634141608f8b08a83e", "score": "0.535925", "text": "func (srv *Server) initAPI() {\n\tmux := http.NewServeMux()\n\n\t// 404 Calls\n\tsrv.handleHTTPRequest(mux, \"/\", srv.unrecognizedCallHandler)\n\n\t// Daemon API Calls - Unfinished\n\tsrv.handleHTTPRequest(mux, \"/daemon/constants\", srv.daemonConstantsHandler)\n\tsrv.handleHTTPRequest(mux, \"/daemon/version\", srv.daemonVersionHandler)\n\tsrv.handleHTTPRequest(mux, \"/daemon/stop\", srv.daemonStopHandler)\n\tsrv.handleHTTPRequest(mux, \"/daemon/updates/apply\", srv.daemonUpdatesApplyHandler)\n\tsrv.handleHTTPRequest(mux, \"/daemon/updates/check\", srv.daemonUpdatesCheckHandler)\n\n\t// Consensus API Calls\n\tif srv.cs != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/consensus\", srv.consensusHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/consensus/block\", srv.consensusBlockHandler) // GET\n\t}\n\n\t// Explorer API Calls\n\tif srv.explorer != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/explorer\", srv.explorerHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/explorer/\", srv.explorerHandler) // $(hash) GET\n\t\tsrv.handleHTTPRequest(mux, \"/explorer/block\", srv.explorerBlockHandler) // GET\n\t}\n\n\t// Gateway API Calls - Unfinished\n\tif srv.gateway != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/gateway/status\", srv.gatewayStatusHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/gateway/peers/add\", srv.gatewayPeersAddHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/gateway/peers/remove\", srv.gatewayPeersRemoveHandler)\n\t}\n\n\t// Host API Calls\n\tif srv.host != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/host\", srv.hostHandler) // GET, POST\n\t\tsrv.handleHTTPRequest(mux, \"/host/announce\", srv.hostAnnounceHandler) // POST\n\t}\n\n\t// HostDB API Calls - DEPRECATED\n\tif srv.renter != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/hostdb/hosts/active\", srv.renterHostsActiveHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/hostdb/hosts/all\", srv.renterHostsAllHandler)\n\t}\n\n\t// Miner API Calls\n\tif srv.miner != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/miner\", srv.minerHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/miner/header\", srv.minerHeaderHandler) // GET, POST\n\t\tsrv.handleHTTPRequest(mux, \"/miner/start\", srv.minerStartHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/miner/stop\", srv.minerStopHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/miner/headerforwork\", srv.minerHeaderforworkHandler) // COMPATv0.4.8\n\t\tsrv.handleHTTPRequest(mux, \"/miner/submitheader\", srv.minerSubmitheaderHandler) // COMPATv0.4.8\n\t}\n\n\t// Renter API Calls - Unfinished\n\tif srv.renter != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/renter/downloadqueue\", srv.renterDownloadqueueHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/delete\", srv.renterFilesDeleteHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/download\", srv.renterFilesDownloadHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/list\", srv.renterFilesListHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/load\", srv.renterFilesLoadHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/loadascii\", srv.renterFilesLoadAsciiHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/rename\", srv.renterFilesRenameHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/share\", srv.renterFilesShareHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/shareascii\", srv.renterFilesShareAsciiHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/files/upload\", srv.renterFilesUploadHandler)\n\t\tsrv.handleHTTPRequest(mux, \"/renter/status\", srv.renterStatusHandler)\n\t}\n\n\t// TransactionPool API Calls - Unfinished\n\tif srv.tpool != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/transactionpool/transactions\", srv.transactionpoolTransactionsHandler)\n\t}\n\n\t// Wallet API Calls\n\tif srv.wallet != nil {\n\t\tsrv.handleHTTPRequest(mux, \"/wallet\", srv.walletHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/address\", srv.walletAddressHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/addresses\", srv.walletAddressesHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/backup\", srv.walletBackupHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/encrypt\", srv.walletEncryptHandler) // POST - COMPATv0.4.0\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/init\", srv.walletInitHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/load/033x\", srv.walletLoad033xHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/load/seed\", srv.walletLoadSeedHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/load/siag\", srv.walletLoadSiagHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/lock\", srv.walletLockHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/seeds\", srv.walletSeedsHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/siacoins\", srv.walletSiacoinsHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/siafunds\", srv.walletSiafundsHandler) // POST\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/transaction/\", srv.walletTransactionHandler) // $(id) GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/transactions\", srv.walletTransactionsHandler) // GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/transactions/\", srv.walletTransactionsHandler) // $(addr) GET\n\t\tsrv.handleHTTPRequest(mux, \"/wallet/unlock\", srv.walletUnlockHandler) // POST\n\t}\n\n\t// Create graceful HTTP server\n\tsrv.apiServer = &graceful.Server{\n\t\tTimeout: apiTimeout,\n\t\tServer: &http.Server{Handler: mux},\n\t}\n}", "title": "" }, { "docid": "a30da76eac61d143e044919bed91f2d4", "score": "0.5356818", "text": "func InitServer() {\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(6)\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tconfig.GetInstance()\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tconfig := config.GetInstance()\n\t\tdb.InitConnection(\"mysql\", config.StringConnection)\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tdurationdata.RegisterInitDurationData(durationmodel.GetUsersData)\n\t\tdurationdata.InitDurationData()\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\te = echo.New()\n\t\te.Use(middleware.Recover())\n\t\te.Use(middleware.Logger())\n\t\tinitEchoRoutes(e)\n\n\t}()\n\n\tvar file *os.File\n\tdefer file.Close()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif _, err := os.Stat(\"./log\"); os.IsNotExist(err) {\n\t\t\tif err = os.Mkdir(\"./log\", os.ModePerm); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t\tfile, err := os.OpenFile(\"./log/info.log\", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tlog.NewLogBackend(os.Stdout, \"\", 0, logging.DEBUG, log.DefaultLogFormatter)\n\t\tlog.NewLogBackend(file, \"\", 0, logging.WARNING, log.VerboseLogFilePathFormatter)\n\t\tlog.Init(config.GetInstance().AppName)\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tcontrollers.InitCustomHandler()\n\t}()\n\n\twg.Wait()\n\n\tconfig := config.GetInstance()\n\n\tlogger := log.GetLogger()\n\tlogger.Info(\"Applicazione avviata!\")\n\n\te.Logger.Fatal(e.Start(config.AppPort))\n}", "title": "" }, { "docid": "89b5513501da15152f1440e2a36e67c0", "score": "0.53511447", "text": "func (u *Uchiwa) WebServer(publicPath *string, auth auth.Config) {\n\n\t// private endpoints\n\thttp.Handle(\"/aggregates\", auth.Authenticate(http.HandlerFunc(u.aggregatesHandler)))\n\thttp.Handle(\"/checks\", auth.Authenticate(http.HandlerFunc(u.checksHandler)))\n\thttp.Handle(\"/clients\", auth.Authenticate(http.HandlerFunc(u.clientsHandler)))\n\thttp.Handle(\"/datacenters\", auth.Authenticate(http.HandlerFunc(u.datacentersHandler)))\n\thttp.Handle(\"/events\", auth.Authenticate(http.HandlerFunc(u.eventsHandler)))\n\thttp.Handle(\"/results\", auth.Authenticate(http.HandlerFunc(u.resultsHandler)))\n\thttp.Handle(\"/stashes\", auth.Authenticate(http.HandlerFunc(u.stashesHandler)))\n\thttp.Handle(\"/stashes/delete\", auth.Authenticate(http.HandlerFunc(u.stashDeleteHandler)))\n\thttp.Handle(\"/subscriptions\", auth.Authenticate(http.HandlerFunc(u.subscriptionsHandler)))\n\n\thttp.Handle(\"/delete_client\", auth.Authenticate(http.HandlerFunc(u.deleteClientHandler)))\n\thttp.Handle(\"/get_aggregate\", auth.Authenticate(http.HandlerFunc(u.getAggregateHandler)))\n\thttp.Handle(\"/get_aggregate_by_issued\", auth.Authenticate(http.HandlerFunc(u.getAggregateByIssuedHandler)))\n\thttp.Handle(\"/get_client\", auth.Authenticate(http.HandlerFunc(u.getClientHandler)))\n\thttp.Handle(\"/get_config\", auth.Authenticate(http.HandlerFunc(u.getConfigHandler)))\n\thttp.Handle(\"/get_sensu\", auth.Authenticate(http.HandlerFunc(u.getSensuHandler)))\n\thttp.Handle(\"/post_event\", auth.Authenticate(http.HandlerFunc(u.postEventHandler)))\n\n\t// static files\n\thttp.Handle(\"/\", http.FileServer(http.Dir(*publicPath)))\n\n\t// public endpoints\n\thttp.Handle(\"/config/auth\", http.HandlerFunc(u.configAuthHandler))\n\thttp.Handle(\"/health\", http.HandlerFunc(u.healthHandler))\n\thttp.Handle(\"/health/\", http.HandlerFunc(u.healthHandler))\n\thttp.Handle(\"/login\", auth.GetIdentification())\n\n\tlisten := fmt.Sprintf(\"%s:%d\", u.Config.Uchiwa.Host, u.Config.Uchiwa.Port)\n\tlogger.Infof(\"Uchiwa is now listening on %s\", listen)\n\tlogger.Fatal(http.ListenAndServe(listen, nil))\n}", "title": "" }, { "docid": "b345c54798ffdc8489fe813187b30555", "score": "0.53395694", "text": "func (s *Server) Init() {\n\tif os.Getenv(\"PORT\") == \"\" {\n\t\ts.Port = \"8080\"\n\t} else {\n\t\ts.Port = os.Getenv(\"PORT\")\n\t\tlog.Println(\"Got port \" + s.Port)\n\t\tif s.Port == \"\" {\n\t\t\tlog.Fatal(\"PORT must be Set\")\n\t\t}\n\t}\n\ts.Router = gin.Default()\n\ts.Router.Use(cors.Default())\n}", "title": "" }, { "docid": "fd0de28bbd09e12f91ee57b3435a01e6", "score": "0.5333484", "text": "func Run(o *Options) {\n\tlogger := glogr.New().WithName(\"Server\")\n\tlogger.Info(\"Run called\", \"options\", o)\n\n\thost, err := os.Hostname()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tshutdown := make(chan os.Signal, 1)\n\tsignal.Notify(shutdown, syscall.SIGTERM, syscall.SIGINT)\n\n\tserverInfo := serverInfo{\n\t\tHostname: host,\n\t\tStarted: time.Now(),\n\t}\n\n\thandlers := handlerMap{\n\t\t\"/\": &Default{serverInfo: serverInfo},\n\t\t\"/echo\": &Echo{serverInfo: serverInfo, shutdownGracePeriodSeconds: o.ShutdownDelaySeconds - 1},\n\t\t\"/healthcheck\": &HealthCheck{serverInfo: serverInfo},\n\t}\n\n\tmux := http.NewServeMux()\n\thandlers.register(mux)\n\t// mux.Handle(\"/demo\", demoHandler())\n\n\taddr := fmt.Sprintf(\":%d\", o.ListenPort)\n\tserver := &http.Server{\n\t\tAddr: addr,\n\t\tHandler: mux,\n\t}\n\n\tserver.RegisterOnShutdown(func() {\n\t\tlogger.Info(\"Shutdown() called on http.Server\")\n\t})\n\n\tgo func() {\n\t\tlogger.Info(\"Starting server\", \"addr\", addr)\n\n\t\tif err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tlogger.Error(err, \"server exited with error\")\n\t\t}\n\t}()\n\n\tsig := <-shutdown\n\n\tlogger.Info(\"signal received. signaling handlers and disabling keep-alives\", \"signal\", sig.String())\n\tserver.SetKeepAlivesEnabled(false)\n\thandlers.shutdown()\n\n\tlogger.Info(\"shutting down with delay\", \"delay\", o.ShutdownDelaySeconds)\n\t<-time.After(time.Duration(o.ShutdownDelaySeconds) * time.Second)\n\tlogger.Info(\"proceeding with shutdown\")\n\n\tlogger.Info(\"commencing graceful shutdown of web server\")\n\tserver.Shutdown(context.Background())\n\n\tglog.Flush()\n}", "title": "" }, { "docid": "d25fe5b991696eeee6a607484a51b7c3", "score": "0.5293967", "text": "func InitializeServerConfig(logger log.Logger) error {\n\n\t// Load default settings\n\tlogger.Info(\"Loading default server settings\")\n\n\t// CACert sets the certificate authority\n\tviper.SetDefault(\"CACert\", \"ca.crt\")\n\tviper.BindEnv(\"CACert\", \"KAPPA_CA_CERT\")\n\n\t// AdminCert sets the admin certificate\n\tviper.SetDefault(\"AdminCert\", \"admin.crt\")\n\tviper.BindEnv(\"AdminCert\", \"KAPPA_ADMIN_CERT\")\n\n\t// SSHKey sets the private key for the SSH server\n\tviper.SetDefault(\"SSHKey\", \"ssh-identity.key\")\n\tviper.BindEnv(\"SSHKey\", \"KAPPA_SSH_KEY\")\n\n\t// TLSCert sets the certificate for HTTPS\n\tviper.SetDefault(\"TLSCert\", \"tls-identity.crt\")\n\tviper.BindEnv(\"TLSCert\", \"KAPPA_TLS_CERT\")\n\n\t// TLSKey sets the private key for HTTPS\n\tviper.SetDefault(\"TLSKey\", \"tls-identity.key\")\n\tviper.BindEnv(\"TLSKey\", \"KAPPA_TLS_KEY\")\n\n\t// DataPath sets the directory for data storage\n\tviper.SetDefault(\"DataPath\", \"./data\")\n\tviper.BindEnv(\"DataPath\", \"KAPPA_DATA_PATH\")\n\n\t// SSHListen sets the address to listen for SSH traffic\n\tviper.SetDefault(\"SSHListen\", \":9022\")\n\tviper.BindEnv(\"SSHListen\", \"KAPPA_SSH_LISTEN\")\n\n\t// HTTPListen sets the address to listen for HTTP traffic\n\tviper.SetDefault(\"HTTPListen\", \":19022\")\n\tviper.BindEnv(\"HTTPListen\", \"KAPPA_HTTP_LISTEN\")\n\n\t// Serf config\n\t// ClusterNodes is a list of existing cluster nodes\n\tviper.SetDefault(\"ClusterNodes\", \"\")\n\tviper.BindEnv(\"ClusterNodes\", \"KAPPA_CLUSTER_NODES\")\n\n\t// NodeName sets the server's name\n\tviper.SetDefault(\"NodeName\", \"kappa-server\")\n\tviper.BindEnv(\"NodeName\", \"KAPPA_NODE_NAME\")\n\n\t// ClusterName sets the cluster name of this node.\n\tviper.SetDefault(\"ClusterName\", \"kappa\")\n\tviper.BindEnv(\"ClusterName\", \"KAPPA_CLUSTER_NAME\")\n\n\t// Bootstrap sets whether to bootstrap this node.\n\tviper.SetDefault(\"Bootstrap\", false)\n\tviper.BindEnv(\"Bootstrap\", \"KAPPA_BOOTSTRAP\")\n\n\t// BootstrapExpect is an argument used by Serf.\n\tviper.SetDefault(\"BootstrapExpect\", 0)\n\n\t// Memberlist config\n\t// GossipBindAddr sets the Addr for cluster gossip.\n\tviper.SetDefault(\"GossipBindAddr\", \"0.0.0.0\")\n\tviper.BindEnv(\"GossipBindAddr\", \"KAPPA_GOSSIP_BIND_ADDR\")\n\n\t// GossipBindPort sets the port for cluster gossip. The port is used for both UDP and TCP gossip.\n\tviper.SetDefault(\"GossipBindPort\", 7946)\n\tviper.BindEnv(\"GossipBindPort\", \"KAPPA_GOSSIP_BIND_PORT\")\n\n\t// GossipAdvertiseAddr sets what address to advertise to other\n\t// cluster members. Used for nat traversal.\n\tviper.SetDefault(\"GossipAdvertiseAddr\", \"\")\n\tviper.BindEnv(\"GossipAdvertiseAddr\", \"KAPPA_GOSSIP_ADVERTISE_ADDR\")\n\n\t// GossipAdvertisePort sets the port for cluster gossip and can\n\t// be useful for NAT traversal.\n\tviper.SetDefault(\"GossipAdvertisePort\", 7946)\n\tviper.BindEnv(\"GossipAdvertisePort\", \"KAPPA_GOSSIP_ADVERTISE_PORT\")\n\n\t// Set viper flags\n\tif serverCmd.PersistentFlags().Lookup(\"ca-cert\").Changed {\n\t\tlogger.Info(\"\", \"CACert\", CACert)\n\t\tviper.Set(\"CACert\", CACert)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"admin-cert\").Changed {\n\t\tlogger.Info(\"\", \"AdminCert\", AdminCert)\n\t\tviper.Set(\"AdminCert\", AdminCert)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"ssh-key\").Changed {\n\t\tlogger.Info(\"\", \"SSHKey\", SSHKey)\n\t\tviper.Set(\"SSHKey\", SSHKey)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"tls-cert\").Changed {\n\t\tlogger.Info(\"\", \"TLSCert\", TLSCert)\n\t\tviper.Set(\"TLSCert\", TLSCert)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"tls-key\").Changed {\n\t\tlogger.Info(\"\", \"TLSKey\", TLSKey)\n\t\tviper.Set(\"TLSKey\", TLSKey)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"ssh-listen\").Changed {\n\t\tlogger.Info(\"\", \"SSHListen\", SSHListen)\n\t\tviper.Set(\"SSHListen\", SSHListen)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"http-listen\").Changed {\n\t\tlogger.Info(\"\", \"HTTPListen\", HTTPListen)\n\t\tviper.Set(\"HTTPListen\", HTTPListen)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"data\").Changed {\n\t\tlogger.Info(\"\", \"DataPath\", DataPath)\n\t\tviper.Set(\"DataPath\", DataPath)\n\t}\n\n\t// Serf config\n\tif serverCmd.PersistentFlags().Lookup(\"nodes\").Changed {\n\t\tlogger.Info(\"\", \"ClusterNodes\", ClusterNodes)\n\t\tviper.Set(\"ClusterNodes\", ClusterNodes)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"node-name\").Changed {\n\t\tlogger.Info(\"\", \"NodeName\", NodeName)\n\t\tviper.Set(\"NodeName\", NodeName)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"cluster\").Changed {\n\t\tlogger.Info(\"\", \"ClusterName\", ClusterName)\n\t\tviper.Set(\"ClusterName\", ClusterName)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"bootstrap\").Changed {\n\t\tlogger.Info(\"\", \"Bootstrap\", Bootstrap)\n\t\tviper.Set(\"Bootstrap\", Bootstrap)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"bootstrap-expect\").Changed {\n\t\tlogger.Info(\"\", \"BootstrapExpect\", BootstrapExpect)\n\t\tviper.Set(\"BootstrapExpect\", BootstrapExpect)\n\t}\n\n\t// Memberlist Config\n\tif serverCmd.PersistentFlags().Lookup(\"gossip-bind-addr\").Changed {\n\t\tlogger.Info(\"\", \"GossipBindAddr\", GossipBindAddr)\n\t\tviper.Set(\"GossipBindAddr\", GossipBindAddr)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"gossip-bind-port\").Changed {\n\t\tlogger.Info(\"\", \"GossipBindPort\", GossipBindPort)\n\t\tviper.Set(\"GossipBindPort\", GossipBindPort)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"gossip-advert-addr\").Changed {\n\t\tlogger.Info(\"\", \"GossipAdvertiseAddr\", GossipAdvertiseAddr)\n\t\tviper.Set(\"GossipAdvertiseAddr\", GossipAdvertiseAddr)\n\t}\n\tif serverCmd.PersistentFlags().Lookup(\"gossip-advert-port\").Changed {\n\t\tlogger.Info(\"\", \"GossipAdvertisePort\", GossipAdvertisePort)\n\t\tviper.Set(\"GossipAdvertisePort\", GossipAdvertisePort)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e01c4c398fd7606669ab1c1550137860", "score": "0.52885926", "text": "func (c *ConnectionController) Init(){\n\n\thttp.Handle(\"/\", c)\n\n\thttp.ListenAndServe(\":\"+conf.Port(), nil)\n\n}", "title": "" }, { "docid": "1c0265c7f0cc2d568e9938092c922494", "score": "0.5263705", "text": "func (s *Server) initialization() (err error) {\n\terr = syssig.AddSignalsHandler(func() {\n\t\tlog.Info(\"close svr stop chan\")\n\t\tclose(s.stopCh)\n\t}, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM)\n\tif err != nil {\n\t\tlog.Error(\"listen system signal failed\", err)\n\t\treturn\n\t}\n\n\ts.agent, err = serf.Create(s.conf.Config)\n\tif err != nil {\n\t\tlog.Errorf(err, \"Create serf failed, %s\", err)\n\t\treturn\n\t}\n\n\ts.etcd = etcd.NewAgent(s.conf.Etcd)\n\n\ts.tick = ticker.NewTaskTicker(s.conf.TickerInterval, s.tickHandler)\n\n\ts.servicecenter, err = servicecenter.NewServicecenter(s.conf.SC.SCConfigOps()...)\n\tif err != nil {\n\t\tlog.Error(\"create servicecenter failed\", err)\n\t\treturn\n\t}\n\n\ttlsConfig, err := s.conf.TLSConfig.ServerTlsConfig()\n\tif err != nil {\n\t\tlog.Error(\"get grpc server tls config failed\", err)\n\t\treturn\n\t}\n\ts.grpc = grpc.NewServer(s.conf.RPCAddr, s, tlsConfig)\n\treturn nil\n}", "title": "" }, { "docid": "23aef2e3d55b052b55601e3244f639d2", "score": "0.5256735", "text": "func (gs *Server) Serve(listener net.Listener) error {\n\t// Accept a net.Listener to preserve the interface compatibility with the\n\t// standard http.Server. If it is not a GracefulListener then wrap it into\n\t// one.\n\tgracefulListener, ok := listener.(*Listener)\n\tif !ok {\n\t\tgracefulListener = NewListener(listener)\n\t\tlistener = gracefulListener\n\t}\n\tlistenerUnsafePtr := unsafe.Pointer(gs.listener)\n\tatomic.StorePointer(&listenerUnsafePtr, unsafe.Pointer(gracefulListener))\n\n\t// Wrap the server HTTP handler into graceful one, that will close kept\n\t// alive connections if a new request is received after shutdown.\n\tgracefulHandler := newGracefulHandler(gs.Server.Handler)\n\tgs.Server.Handler = gracefulHandler\n\n\t// Start a goroutine that waits for a shutdown signal and will stop the\n\t// listener when it receives the signal. That in turn will result in\n\t// unblocking of the http.Serve call.\n\tgo func() {\n\t\tgs.shutdown <- true\n\t\tclose(gs.shutdown)\n\t\tgracefulHandler.Close()\n\t\tgs.Server.SetKeepAlivesEnabled(false)\n\t\tgracefulListener.Close()\n\t}()\n\n\toriginalConnState := gs.Server.ConnState\n\n\t// s.ConnState is invoked by the net/http.Server every time a connection\n\t// changes state. It keeps track of each connection's state over time,\n\t// enabling manners to handle persisted connections correctly.\n\tgs.ConnState = func(conn net.Conn, newState http.ConnState) {\n\t\tgs.connToPropsMtx.RLock()\n\t\tconnProps := gs.connToProps[conn]\n\t\tgs.connToPropsMtx.RUnlock()\n\n\t\tswitch newState {\n\n\t\tcase http.StateNew:\n\t\t\t// New connection -> StateNew\n\t\t\tconnProps.protected = true\n\t\t\tgs.StartRoutine()\n\n\t\tcase http.StateActive:\n\t\t\t// (StateNew, StateIdle) -> StateActive\n\t\t\tif gracefulHandler.IsClosed() {\n\t\t\t\tconn.Close()\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif !connProps.protected {\n\t\t\t\tconnProps.protected = true\n\t\t\t\tgs.StartRoutine()\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// (StateNew, StateActive) -> (StateIdle, StateClosed, StateHiJacked)\n\t\t\tif connProps.protected {\n\t\t\t\tgs.FinishRoutine()\n\t\t\t\tconnProps.protected = false\n\t\t\t}\n\t\t}\n\n\t\tif gs.stateHandler != nil {\n\t\t\tgs.stateHandler(conn, connProps.state, newState)\n\t\t}\n\t\tconnProps.state = newState\n\n\t\tgs.connToPropsMtx.Lock()\n\t\tif newState == http.StateClosed || newState == http.StateHijacked {\n\t\t\tdelete(gs.connToProps, conn)\n\t\t} else {\n\t\t\tgs.connToProps[conn] = connProps\n\t\t}\n\t\tgs.connToPropsMtx.Unlock()\n\n\t\tif originalConnState != nil {\n\t\t\toriginalConnState(conn, newState)\n\t\t}\n\t}\n\n\t// A hook to allow the server to notify others when it is ready to receive\n\t// requests; only used by tests.\n\tif gs.up != nil {\n\t\tgs.up <- listener\n\t}\n\n\terr := gs.Server.Serve(listener)\n\t// An error returned on shutdown is not worth reporting.\n\tif err != nil && gracefulHandler.IsClosed() {\n\t\terr = nil\n\t}\n\n\t// Wait for pending requests to complete regardless the Serve result.\n\tgs.wg.Wait()\n\tgs.shutdownFinished <- true\n\treturn err\n}", "title": "" }, { "docid": "e2c0981bca3541ed002d04384561cbff", "score": "0.5244808", "text": "func HTTPServer(port int, d *sim.DiagnosticData, g *Grafana) {\n\tvar err error\n\tdiagnosticData = *d\n\thttp.HandleFunc(\"/grafana\", cors(g.handler))\n\thttp.HandleFunc(\"/grafana/\", cors(g.handler))\n\thttp.HandleFunc(\"/\", cors(handler))\n\tvar hostname string\n\tif hostname, err = os.Hostname(); err != nil {\n\t\thostname = \"localhost\"\n\t}\n\tlog.Println(\"HTTP server ready, URL: http://\" + hostname + \":5408/\")\n\tlog.Fatal(http.ListenAndServe(\":\"+strconv.Itoa(port), nil))\n}", "title": "" }, { "docid": "f5748f29b57ba6b82ab0b26b6485b7d2", "score": "0.5242375", "text": "func ServerRun(addr string, handler *Handler) error {\n\treturn ServerRunWithConfig(&http.Server{\n\t\tAddr: addr,\n\t\tHandler: handler,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t})\n}", "title": "" }, { "docid": "bcce33574b87652ade32ed44a0362883", "score": "0.52337843", "text": "func InitWsServer(addr string) error {\n\treturn http.ListenAndServe(addr, http.HandlerFunc(WSHandler))\n}", "title": "" }, { "docid": "4b2e89e569bde7e646f20a0b6d55738d", "score": "0.52288383", "text": "func ServerRunWithConfig(server *http.Server) error {\n\tlog.Printf(\"[INFO] Server running: %+v\", server)\n\treturn server.ListenAndServe()\n}", "title": "" }, { "docid": "9575ccd8bcfc0d0cb03c19390ed29323", "score": "0.52242285", "text": "func (s *server) serve() error {\n\tc := s.air.Config\n\n\ts.Addr = c.Address\n\ts.Handler = s\n\ts.ReadTimeout = c.ReadTimeout\n\ts.WriteTimeout = c.WriteTimeout\n\ts.MaxHeaderBytes = c.MaxHeaderBytes\n\n\tif c.TLSCertFile != \"\" && c.TLSKeyFile != \"\" {\n\t\treturn s.ListenAndServeTLS(c.TLSCertFile, c.TLSKeyFile)\n\t}\n\n\treturn s.ListenAndServe()\n}", "title": "" }, { "docid": "3f603e68859cd6c14be1b3b031b2c848", "score": "0.5223975", "text": "func runServer() (model.Server, http.Server) {\n\tos.Remove(\"./db.db\")\n\tsettings, _ := model.ConfigStorageSettingsFromString(\"file://config.yaml\")\n\tconfigStorage, err := config.InitConfigurationStorage(settings)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to load config with error: %v\", err)\n\t}\n\n\tsrv, err := config.NewServer(configStorage, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"error creating server: %v\", err)\n\t}\n\n\tif err := config.ImportApps(\"data/apps.json\", srv.Storages().App); err != nil {\n\t\tlog.Fatalf(\"error importing apps to server: %v\", err)\n\t}\n\tif err := config.ImportUsers(\"data/users.json\", srv.Storages().User); err != nil {\n\t\tlog.Fatalf(\"error importing users to server: %v\", err)\n\t}\n\n\thttpSrv := &http.Server{\n\t\tAddr: srv.Settings().GetPort(),\n\t\tHandler: srv.Router(),\n\t}\n\n\tgo func() {\n\t\tif err := httpSrv.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"ListenAndServe(): %s\", err)\n\t\t}\n\t}()\n\n\t// maybe move the te\n\treturn srv, *httpSrv\n}", "title": "" }, { "docid": "5b4cbf062aaeff0f2d92881ae04c0b14", "score": "0.5221273", "text": "func (ins *InstanceServer) Init() error {\n\t// listen.\n\tlis, err := net.Listen(\"tcp\", ins.grpcEndpoint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"instance server grpc endpoint listen: %+v\", err)\n\t}\n\tins.lis = lis\n\n\t// gRPC server register.\n\tins.server = grpc.NewServer()\n\tpbsidecar.RegisterInstanceServer(ins.server, ins)\n\n\t// init gateway mux.\n\topt := runtime.WithMarshalerOption(runtime.MIMEWildcard,\n\t\t&runtime.JSONPb{EnumsAsInts: true, EmitDefaults: true, OrigName: true})\n\tins.gwmux = runtime.NewServeMux(opt)\n\n\t// init gateway http server.\n\tins.mux = http.NewServeMux()\n\n\tins.mux.Handle(\"/\", ins.gwmux)\n\tins.mux.HandleFunc(\"/swagger/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, path.Join(\"swagger\", strings.TrimPrefix(r.URL.Path, \"/swagger/\")))\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "7e8e84dc845e62bc5d89cc95a8ae07a0", "score": "0.5220956", "text": "func (s *Server) Start() {\n\tif atomic.AddInt32(&s.Started, 1) != 1 {\n\t\treturn\n\t}\n\trpcServeMux := http.NewServeMux()\n\thttpServer := &http.Server{\n\t\tHandler: rpcServeMux,\n\t\t// Timeout connections which don't complete the initial handshake within the allowed timeframe.\n\t\tReadTimeout: time.Second * RPCAuthTimeoutSeconds,\n\t}\n\trpcServeMux.HandleFunc(\n\t\t\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\tI.Ln(\"handling new connection from\", r.RemoteAddr)\n\t\t\tw.Header().Set(\"Connection\", \"close\")\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tr.Close = true\n\t\t\t// Limit the number of connections to max allowed.\n\t\t\tif s.LimitConnections(w, r.RemoteAddr) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Keep track of the number of connected clients.\n\t\t\ts.IncrementClients()\n\t\t\tdefer s.DecrementClients()\n\t\t\t_, isAdmin, e := s.CheckAuth(r, true)\n\t\t\tif e != nil {\n\t\t\t\tJSONAuthFail(w)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Read and respond to the request.\n\t\t\ts.JSONRPCRead(w, r, isAdmin)\n\t\t},\n\t)\n\t// Websocket endpoint.\n\trpcServeMux.HandleFunc(\n\t\t\"/ws\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\tI.Ln(\"handling new connection from\", r.RemoteAddr)\n\t\t\tauthenticated, isAdmin, e := s.CheckAuth(r, false)\n\t\t\tif e != nil {\n\t\t\t\tJSONAuthFail(w)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Attempt to upgrade the connection to a websocket connection using the default size for read/write buffers.\n\t\t\tws, e := websocket.Upgrade(w, r, nil, 0, 0)\n\t\t\tif e != nil {\n\t\t\t\tif _, ok := e.(websocket.HandshakeError); !ok {\n\t\t\t\t\tE.Ln(\"unexpected websocket error:\", e)\n\n\t\t\t\t}\n\t\t\t\thttp.Error(w, \"400 Bad Request.\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.WebsocketHandler(ws, r.RemoteAddr, authenticated, isAdmin)\n\t\t},\n\t)\n\tfor _, listener := range s.Cfg.Listeners {\n\t\ts.WG.Add(1)\n\t\tgo func(listener net.Listener) {\n\t\t\tI.Ln(\"chain RPC Server listening on \", listener.Addr())\n\t\t\te := httpServer.Serve(listener)\n\t\t\tif e != nil {\n\t\t\t\tD.Ln(e)\n\t\t\t}\n\t\t\tD.Ln(\"chain RPC listener done for\", listener.Addr())\n\t\t\tif e := listener.Close(); E.Chk(e) {\n\t\t\t}\n\t\t\ts.WG.Done()\n\t\t}(listener)\n\t}\n\ts.NtfnMgr.WG.Add(2)\n\ts.NtfnMgr.Start()\n}", "title": "" }, { "docid": "b3cba5de70a7c1d8e6947f7d5d11501f", "score": "0.52193075", "text": "func customNewServer(es graphql.ExecutableSchema, introspection bool) *handler.Server {\n\tserver := handler.New(es)\n\n\tserver.AddTransport(transport.Websocket{\n\t\tKeepAlivePingInterval: 10 * time.Second,\n\t})\n\tserver.AddTransport(transport.Options{})\n\tserver.AddTransport(transport.POST{})\n\n\tserver.SetQueryCache(lru.New(1000))\n\n\tserver.Use(extension.AutomaticPersistedQuery{\n\t\tCache: lru.New(100),\n\t})\n\n\tif introspection {\n\t\tserver.Use(extension.Introspection{})\n\t}\n\n\treturn server\n}", "title": "" }, { "docid": "c1656624d292d4125f941de68e69ebad", "score": "0.5218874", "text": "func httplisten(hub *Hub, conf *serverConfig) {\n\n\t// regist a service for client\n\thttp.HandleFunc(\"/client\", func(w http.ResponseWriter, r *http.Request) {\n\t\thandleClientWebSocket(hub, w, r)\n\t})\n\t// regist a service for server\n\thttp.HandleFunc(\"/server\", func(w http.ResponseWriter, r *http.Request) {\n\t\thandleServerWebSocket(hub, w, r)\n\t})\n\n\thttp.HandleFunc(\"/msg/send\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttpSendMsgHandler(hub, w, r)\n\t})\n\n\thttp.HandleFunc(\"/q/online\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttpQueryClientOnlineHandler(hub, w, r)\n\t})\n\n\thttp.HandleFunc(\"/q/servers\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttpQueryServersHandler(hub, w, r)\n\t})\n\n\tlog.Println(\"listen on \", conf.ListenHost)\n\terr := http.ListenAndServe(conf.ListenHost, nil)\n\tif err != nil {\n\t\tlog.Println(\"ListenAndServe: \", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "9cf5e610cd2bb899a11f20106888a984", "score": "0.52155286", "text": "func main() {\n server := &http.Server{Handler: &SimpleHTTPHandler{}}\n\n listener, error := net.Listen(\"tcp4\", \":1234\")\n \n if error != nil {\n log.Fatal(error)\n }\n\n error = server.Serve(listener)\n\n if error != nil {\n log.Fatal(error)\n }\n}", "title": "" }, { "docid": "83fd22f8cc30017f327383c3ade7b833", "score": "0.52082884", "text": "func (s *Server) serveHttpAPI(port int, stopC <-chan struct{}) {\n\tif s.conf.ProfilePort >= 0 {\n\t\tgo http.ListenAndServe(\":\"+strconv.Itoa(s.conf.ProfilePort), nil)\n\t}\n\ts.initHttpHandler()\n\tsrv := http.Server{\n\t\tAddr: \":\" + strconv.Itoa(port),\n\t\tHandler: s,\n\t}\n\tl, err := common.NewStoppableListener(srv.Addr, stopC)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = srv.Serve(l)\n\t// exit when raft goes down\n\tsLog.Infof(\"http server stopped: %v\", err)\n}", "title": "" }, { "docid": "1ffb82a47b7c55a5a1e98f660c79a632", "score": "0.5205998", "text": "func (app *App) Start() {\n\tif !app.server.Frontend && len(app.acceptors) > 0 {\n\t\tlogger.Log.Fatal(\"acceptors are not allowed on backend servers\")\n\t}\n\n\tif app.server.Frontend && len(app.acceptors) == 0 {\n\t\tlogger.Log.Fatal(\"frontend servers should have at least one configured acceptor\")\n\t}\n\n\tif app.serverMode == Cluster {\n\t\tif reflect.TypeOf(app.rpcClient) == reflect.TypeOf(&cluster.GRPCClient{}) {\n\t\t\tapp.serviceDiscovery.AddListener(app.rpcClient.(*cluster.GRPCClient))\n\t\t}\n\n\t\tif err := app.RegisterModuleBefore(app.rpcServer, \"rpcServer\"); err != nil {\n\t\t\tlogger.Log.Fatal(\"failed to register rpc server module: %s\", err.Error())\n\t\t}\n\t\tif err := app.RegisterModuleBefore(app.rpcClient, \"rpcClient\"); err != nil {\n\t\t\tlogger.Log.Fatal(\"failed to register rpc client module: %s\", err.Error())\n\t\t}\n\t\t// set the service discovery as the last module to be started to ensure\n\t\t// all modules have been properly initialized before the server starts\n\t\t// receiving requests from other pitaya servers\n\t\tif err := app.RegisterModuleAfter(app.serviceDiscovery, \"serviceDiscovery\"); err != nil {\n\t\t\tlogger.Log.Fatal(\"failed to register service discovery module: %s\", err.Error())\n\t\t}\n\t}\n\n\tapp.periodicMetrics()\n\n\tapp.listen()\n\n\tdefer func() {\n\t\ttimer.GlobalTicker.Stop()\n\t\tapp.running = false\n\t}()\n\n\tsg := make(chan os.Signal)\n\tsignal.Notify(sg, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGTERM)\n\n\t// stop server\n\tselect {\n\tcase <-app.dieChan:\n\t\tlogger.Log.Warn(\"the app will shutdown in a few seconds\")\n\tcase s := <-sg:\n\t\tlogger.Log.Warn(\"got signal: \", s, \", shutting down...\")\n\t\tclose(app.dieChan)\n\t}\n\n\tlogger.Log.Warn(\"server is stopping...\")\n\n\tapp.sessionPool.CloseAll()\n\tapp.shutdownModules()\n\tapp.shutdownComponents()\n}", "title": "" }, { "docid": "29996f34ffb8b0e18cca67937efe5417", "score": "0.5195249", "text": "func main() {\n\n\tgracefulStop := make(chan os.Signal)\n\tsignal.Notify(gracefulStop, syscall.SIGTERM)\n\tsignal.Notify(gracefulStop, syscall.SIGINT)\n\tgo func() {\n\t\tsig := <-gracefulStop\n\t\tfmt.Printf(\"\\n\\tcaught sig: %+v\\t\\n\", sig)\n\t\tfmt.Println(\"\\tStopping Http Server\")\n\t\ttime.Sleep(10 * time.Nanosecond)\n\t\tos.Exit(0)\n\t}()\n\n\trouter := routes.GetRoutes()\n\n\t// This will serve files under http://IP:PORT/assets/<filename>\n\trouter.PathPrefix(\"/assets/\").Handler(http.FileServer(http.Dir(\".\")))\n\n\tServer := &http.Server{\n\t\tHandler: handlers.CORS(allowedOrigins, allowedMethods)(router),\n\t\tAddr: \"127.0.0.1:8080\",\n\t}\n\n\tfmt.Println(Server.ListenAndServe())\n}", "title": "" }, { "docid": "60095563f49fd1bef26cf6cff8ba8ab4", "score": "0.5192838", "text": "func (c *Component) Serve() {\n\thandler := gcontext.ClearHandler(\n\t\thttp.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tt := time.Now()\n\t\t\tlw := log.WrapResponseWriter(w)\n\t\t\tdefer func() {\n\t\t\t\tlog.Info(r, lw, time.Now().Sub(t))\n\t\t\t}()\n\n\t\t\tif maint.Active() {\n\t\t\t\thttp.Error(lw, maint.Notice(), http.StatusServiceUnavailable)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// redirect to https if available\n\t\t\tif r.TLS == nil && c.https != nil {\n\t\t\t\tu := r.URL\n\t\t\t\tu.Host = r.Host\n\t\t\t\tu.Scheme = \"https\"\n\t\t\t\thttp.Redirect(w, r, u.String(), http.StatusFound)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// serve static\n\t\t\tstaticPrefix := com.GetString(\"static_path\") + \"/\"\n\t\t\tif strings.HasPrefix(r.URL.Path, staticPrefix) {\n\t\t\t\thttp.StripPrefix(staticPrefix,\n\t\t\t\t\thttp.FileServer(http.Dir(com.GetString(\"static_dir\")))).ServeHTTP(lw, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// serve semantic ui src. TODO: make dev only\n\t\t\tif strings.HasPrefix(r.URL.Path, \"/_semantic/\") {\n\t\t\t\thttp.StripPrefix(\"/_semantic/\",\n\t\t\t\t\thttp.FileServer(http.Dir(\"ui/semantic/src\"))).ServeHTTP(lw, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// serve component\n\t\t\tfor _, handler := range Handlers() {\n\t\t\t\tif handler.MatchHTTP(r) {\n\t\t\t\t\thandler.ServeHTTP(lw, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tr.URL.Fragment = \"NotFound\"\n\t\t\tfor _, handler := range Handlers() {\n\t\t\t\tif handler.MatchHTTP(r) {\n\t\t\t\t\thandler.ServeHTTP(lw, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\thttp.NotFound(lw, r)\n\t\t}),\n\t)\n\n\tc.http = &http.Server{\n\t\tAddr: com.GetString(\"listen_addr\"),\n\t\tHandler: handler,\n\t}\n\tif c.cert != nil {\n\t\tc.https = &http.Server{\n\t\t\tAddr: com.GetString(\"tls_addr\"),\n\t\t\tHandler: handler,\n\t\t\tTLSConfig: &tls.Config{\n\t\t\t\tGetCertificate: c.cert.GetCertificate,\n\t\t\t},\n\t\t}\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\ttime.Sleep(1 * time.Hour)\n\t\t\t\terr := c.cert.Reload()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Info(\"unable to reload cert\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\n\t\tlog.Info(\"http listening on\", c.http.Addr)\n\t\tif err := c.http.ListenAndServe(); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\twg.Done()\n\t}()\n\tif c.https != nil {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tlog.Info(\"https listening on\", c.https.Addr)\n\t\t\tif err := c.https.ListenAndServeTLS(\"\", \"\"); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "c596701ee5fce79d0d8fe6f3ae265a89", "score": "0.51913494", "text": "func (env *Env) serverHandler(w http.ResponseWriter, r *http.Request) {\n\tenableCors(&w)\n\tdomainName := chi.URLParam(r, \"serverName\")\n\n\toneHourAgo := time.Now().Add(-60 * time.Minute).Format(TimestampLayout)\n\tallowCheckChanges := false\n\t// Get domain information from SSLLabs API\n\thostInfo, err := http.Get(\"https://api.ssllabs.com/api/v3/analyze?host=\" + domainName)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer hostInfo.Body.Close()\n\n\tvar hostResponse SslLabsResponse\n\tif err := json.NewDecoder(hostInfo.Body).Decode(&hostResponse); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\ttype ErrorMessage struct {\n\t\tOk bool `json:\"ok\"`\n\t\tStatus string `json:\"status\"`\n\t\tIsDown bool `json:\"is_down\"`\n\t\tMessage string `json:\"message\"`\n\t}\n\tif strings.EqualFold(hostResponse.Status, \"error\") {\n\t\tresp := ErrorMessage{\n\t\t\tOk: false,\n\t\t\tStatus: hostResponse.Status,\n\t\t\tIsDown: true,\n\t\t\tMessage: \"ERROR\",\n\t\t}\n\t\tjs, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(js)\n\t\treturn\n\t}\n\n\tif !strings.EqualFold(hostResponse.Status, \"READY\") {\n\t\tresp := ErrorMessage{\n\t\t\tOk: false,\n\t\t\tStatus: hostResponse.Status,\n\t\t\tMessage: hostResponse.Message,\n\t\t}\n\t\tjs, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(js)\n\t\treturn\n\t}\n\tvar servers []models.Server\n\tfor _, server := range hostResponse.Endpoints {\n\n\t\tserverInfo, err := http.Get(\"http://ip-api.com/json/\" + server.IPAddress)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\tdefer serverInfo.Body.Close()\n\t\tvar details WhoIsIPResponse\n\t\tif err := json.NewDecoder(serverInfo.Body).Decode(&details); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tservers = append(servers, models.Server{\n\t\t\tAddress: server.IPAddress,\n\t\t\tSSLGrade: server.Grade,\n\t\t\tCountry: details.Country,\n\t\t\tOwner: details.As,\n\t\t})\n\t}\n\t// Get HomePage\n\thomePage, err := http.Get(\"http://\" + domainName)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdefer homePage.Body.Close()\n\tdoc, err := goquery.NewDocumentFromReader(homePage.Body)\n\thtmlTitle := \"\"\n\thtmlIcon := \"\"\n\tdoc.Find(\"head\").Each(func(i int, s *goquery.Selection) {\n\t\thtmlTitle = s.Find(\"title\").Text()\n\t})\n\tdoc.Find(\"link\").Each(func(i int, s *goquery.Selection) {\n\t\tif name, _ := s.Attr(\"type\"); strings.EqualFold(name, \"image/x-icon\") {\n\t\t\thtmlIcon, _ = s.Attr(\"href\")\n\t\t}\n\t})\n\tif htmlIcon == \"\" {\n\t\tfmt.Println(\"FINDING OTHER ICON\")\n\t\tdoc.Find(\"link\").Each(func(i int, s *goquery.Selection) {\n\t\t\tif name, _ := s.Attr(\"rel\"); strings.EqualFold(name, \"shortcut icon\") {\n\t\t\t\thtmlIcon, _ = s.Attr(\"href\")\n\t\t\t}\n\t\t})\n\t}\n\n\tsort.Slice(servers, func(i, j int) bool {\n\t\treturn servers[i].SSLGrade < servers[j].SSLGrade\n\t})\n\tdomainFormat := models.DomainInfo{\n\t\tDomain: domainName,\n\t\tServersChanged: false,\n\t\tSSLGrade: servers[len(servers)-1].SSLGrade,\n\t\tPreviousSSLGrade: \"\",\n\t\tLogo: htmlIcon,\n\t\tTitle: htmlTitle,\n\t\tIsDown: false,\n\t\tLastUpdated: time.Now().Format(TimestampLayout),\n\t\tServers: servers,\n\t}\n\n\tdomain, err := env.db.GetDomainInformation(domainName)\n\tdomainFormat.PreviousSSLGrade = domain.SSLGrade\n\n\tif err != nil && err == sql.ErrNoRows {\n\t\terr := env.db.InsertDomain(&domainFormat)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tresp := models.DomainInfo{\n\t\t\tDomain: domainFormat.Domain,\n\t\t\tLastUpdated: domainFormat.LastUpdated,\n\t\t\tServersChanged: false,\n\t\t\tSSLGrade: domainFormat.SSLGrade,\n\t\t\tPreviousSSLGrade: domainFormat.PreviousSSLGrade,\n\t\t\tLogo: domainFormat.Logo,\n\t\t\tTitle: domainFormat.Title,\n\t\t\tIsDown: false,\n\t\t\tServers: domainFormat.Servers,\n\t\t}\n\t\tjs, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(js)\n\t\tfmt.Println(\"CREATE NEW DOMAIN\")\n\t\treturn\n\t} else if err != nil {\n\t\tresp := ErrorMessage{\n\t\t\tOk: false,\n\t\t\tStatus: \"ERROR\",\n\t\t\tIsDown: true,\n\t\t\tMessage: \"ERROR\",\n\t\t}\n\t\tjs, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(js)\n\t\treturn\n\t}\n\tformatedDate, err := time.Parse(\"2006-01-02T15:04:05Z\", domain.LastUpdated)\n\tee, _ := time.Parse(TimestampLayout, oneHourAgo)\n\tif formatedDate.Before(ee) {\n\t\tallowCheckChanges = true\n\t}\n\tserversDB, err := env.db.GetServers(domain.Domain)\n\n\tif err != nil && err != sql.ErrNoRows {\n\t\tlog.Println(err)\n\t}\n\tfor _, serverDB := range serversDB {\n\t\tdomain.Servers = append(domain.Servers, *serverDB)\n\t}\n\tchanged := false\n\tif allowCheckChanges {\n\t\t// Check if are changes to delete\n\t\tfor _, serverDB := range serversDB {\n\t\t\tfoundIP := false\n\t\t\tfor _, newServer := range domainFormat.Servers {\n\t\t\t\tif serverDB.Address == newServer.Address {\n\t\t\t\t\tfoundIP = true\n\t\t\t\t\tif serverDB.Country != newServer.Country || serverDB.Owner != newServer.Country || serverDB.SSLGrade != newServer.SSLGrade {\n\t\t\t\t\t\terr := env.db.UpdateServer(&newServer)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif !changed {\n\t\t\t\t\t\t\tchanged = true\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\tif !foundIP {\n\t\t\t\tfmt.Printf(\"Deleting ip %s...\\n\", serverDB.Address)\n\t\t\t\terr := env.db.DeleteServer(serverDB.Address)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tif !changed {\n\t\t\t\t\tchanged = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tfoundIP = false\n\t\t}\n\t\t// check if there are new IPs to insert\n\t\tfor _, newServer := range domainFormat.Servers {\n\t\t\tfoundNewIP := true\n\t\t\tfor _, serverDB := range serversDB {\n\t\t\t\tif newServer.Address == serverDB.Address {\n\t\t\t\t\tfoundNewIP = false\n\t\t\t\t}\n\t\t\t}\n\t\t\tif foundNewIP {\n\t\t\t\terr := env.db.InsertServer(&newServer, domainFormat.Domain)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tif !changed {\n\t\t\t\t\tchanged = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tfoundNewIP = true\n\t\t}\n\t\tif changed || domain.SSLGrade != domainFormat.SSLGrade || domain.Logo != domainFormat.Logo || domain.Title != domainFormat.Title {\n\t\t\terr := env.db.UpdateDomain(&domainFormat)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\tresp := models.DomainInfo{\n\t\t\tServersChanged: changed,\n\t\t\tDomain: domainFormat.Domain,\n\t\t\tLastUpdated: domainFormat.LastUpdated,\n\t\t\tSSLGrade: domainFormat.SSLGrade,\n\t\t\tPreviousSSLGrade: domain.SSLGrade,\n\t\t\tLogo: domainFormat.Logo,\n\t\t\tTitle: domainFormat.Title,\n\t\t\tIsDown: false,\n\t\t\tServers: domainFormat.Servers,\n\t\t}\n\t\tjs, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(js)\n\t\tfmt.Println(\"DETECTED CHANGES IN DATABASE\")\n\t\treturn\n\t}\n\n\tfmt.Println(\"IGNORE CHANGES IN DATABASE\")\n\tresp := models.DomainInfo{\n\t\tDomain: domain.Domain,\n\t\tLastUpdated: domain.LastUpdated,\n\t\tServersChanged: false,\n\t\tSSLGrade: domain.SSLGrade,\n\t\tPreviousSSLGrade: domain.PreviousSSLGrade,\n\t\tLogo: domain.Logo,\n\t\tTitle: domain.Title,\n\t\tIsDown: false,\n\t\tServers: domain.Servers,\n\t}\n\tjs, err := json.Marshal(resp)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "fc6f8cba63078abf6f34f308cb42a3de", "score": "0.5190862", "text": "func init() {\n\thttp.HandleFunc(\"/\", handler)\n}", "title": "" }, { "docid": "e51581abee47ebdc89604e75cc7e4bba", "score": "0.5190589", "text": "func (s *Server) Run(httpAddr, httpsAddr string) error {\n\ts.pollEvents()\n\n\teventTicker := time.NewTicker(time.Hour * 24)\n\tdefer eventTicker.Stop()\n\tgo func() {\n\t\tfor range eventTicker.C {\n\t\t\ts.pollEvents()\n\t\t}\n\t}()\n\n\terrChan := make(chan error)\n\n\tif s.certFile == \"\" || s.keyFile == \"\" {\n\t\treturn http.ListenAndServe(httpAddr, s.handler)\n\t}\n\n\thttpServer := &http.Server{\n\t\tAddr: httpAddr,\n\t\tHandler: s.handler,\n\t\tReadTimeout: time.Second * 15,\n\t\tReadHeaderTimeout: time.Second * 15,\n\t\tWriteTimeout: time.Second * 15,\n\t\tIdleTimeout: time.Second * 30,\n\t\tMaxHeaderBytes: 4096,\n\t}\n\n\thttpsServer := &http.Server{\n\t\tAddr: httpsAddr,\n\t\tHandler: s.handler,\n\t\tReadTimeout: time.Second * 15,\n\t\tReadHeaderTimeout: time.Second * 15,\n\t\tWriteTimeout: time.Second * 15,\n\t\tIdleTimeout: time.Second * 30,\n\t\tMaxHeaderBytes: 4096,\n\t}\n\n\tgo func() {\n\t\terrChan <- httpServer.ListenAndServe()\n\t}()\n\n\tgo func() {\n\t\terrChan <- httpsServer.ListenAndServeTLS(s.certFile, s.keyFile)\n\t}()\n\n\terr := <-errChan\n\thttpServer.Close()\n\thttpsServer.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "aab1fecf3df7b6b4b104469abbaa77a5", "score": "0.5189824", "text": "func init() {\n\thttp.HandleFunc(\"/\", RootHandler)\n\thttp.Handle(\"/sock\", websocket.Handler(SockServer))\n}", "title": "" }, { "docid": "a027cd9d6492a6786bdb557455a5a591", "score": "0.5184377", "text": "func (f *Factory) New() (*WebServer, error) {\n\tf.fc.BindAddress = f.GetBackendBindHostPort()\n\tf.fc.ExternalAddress = f.GetBackendServeHostPort(true)\n\n\t// if there is no port, and we listen on one securely, use that one\n\tif _, _, err := net.SplitHostPort(f.fc.ExternalAddress); err != nil {\n\t\tif f.fc.BindAddress == \"\" {\n\t\t\tslog.Error(\"cannot derive external address port without listening on a secure port.\", slog_.Error(err))\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t_, port, err := net.SplitHostPort(f.fc.BindAddress)\n\t\tif err != nil {\n\t\t\tslog.Error(\"cannot derive external address from the secure port\", slog_.Error(err))\n\t\t\tos.Exit(1)\n\t\t}\n\t\tf.fc.ExternalAddress = net.JoinHostPort(f.fc.ExternalAddress, port)\n\t}\n\n\topts := grpc_.WithDefault()\n\tif f.fc.NoGrpcProxy {\n\t\topts = append(opts, grpc_.WithGrpcDialOption(grpc.WithNoProxy()))\n\t}\n\t{\n\t\t// 设置GRPC最大消息大小\n\t\topts = append(opts, grpc_.WithGrpcDialOption(grpc.WithNoProxy()))\n\t\t// http -> grpc client -> grpc server\n\t\tif f.fc.MaxReceiveMessageSizeInBytes > 0 {\n\t\t\topts = append(opts, grpc_.WithGrpcServerOption(grpc.MaxRecvMsgSize(f.fc.MaxReceiveMessageSizeInBytes)))\n\t\t\topts = append(opts, grpc_.WithGrpcDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(f.fc.MaxReceiveMessageSizeInBytes))))\n\t\t} else {\n\t\t\topts = append(opts, grpc_.WithGrpcServerOption(grpc.MaxRecvMsgSize(defaultMaxReceiveMessageSize)))\n\t\t\topts = append(opts, grpc_.WithGrpcDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(defaultMaxReceiveMessageSize))))\n\t\t}\n\t\t// http <- grpc client <- grpc server\n\t\tif f.fc.MaxSendMessageSizeInBytes > 0 {\n\t\t\topts = append(opts, grpc_.WithGrpcServerOption(grpc.MaxSendMsgSize(f.fc.MaxSendMessageSizeInBytes)))\n\t\t\topts = append(opts, grpc_.WithGrpcDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(f.fc.MaxSendMessageSizeInBytes))))\n\t\t} else {\n\t\t\topts = append(opts, grpc_.WithGrpcServerOption(grpc.MaxSendMsgSize(defaultMaxSendMessageSize)))\n\t\t\topts = append(opts, grpc_.WithGrpcDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaultMaxSendMessageSize))))\n\t\t}\n\t}\n\t{\n\t\t// recover\n\t\topts = append(opts, grpc_.WithGrpcUnaryServerChain(grpcrecovery.UnaryServerInterceptor(grpcrecovery.WithRecoveryHandler(func(p interface{}) (err error) {\n\t\t\tslog.Error(\"recovered in grpc\", slog_.Error(status.Errorf(codes.Internal, \"%s at %s\", p, debug.Stack())))\n\t\t\t{\n\t\t\t\t_, _ = os.Stderr.Write([]byte(fmt.Sprintf(\"panic: %s\", p)))\n\t\t\t\tdebug.PrintStack()\n\t\t\t\t_, _ = os.Stderr.Write([]byte(\" [recovered]\"))\n\t\t\t\t_, _ = os.Stderr.Write([]byte(\"\\n\"))\n\t\t\t}\n\t\t\treturn status.Errorf(codes.Internal, \"%s\", p)\n\t\t}))))\n\t\topts = append(opts, grpc_.WithGrpcStreamServerChain(grpcrecovery.StreamServerInterceptor(grpcrecovery.WithRecoveryHandler(func(p interface{}) (err error) {\n\t\t\tslog.Error(\"recovered in grpc\", slog_.Error(status.Errorf(codes.Internal, \"%s at %s\", p, debug.Stack())))\n\t\t\t{\n\t\t\t\t_, _ = os.Stderr.Write([]byte(fmt.Sprintf(\"panic: %s\", p)))\n\t\t\t\tdebug.PrintStack()\n\t\t\t\t_, _ = os.Stderr.Write([]byte(\" [recovered]\"))\n\t\t\t\t_, _ = os.Stderr.Write([]byte(\"\\n\"))\n\t\t\t}\n\t\t\treturn status.Errorf(codes.Internal, \"%s\", p)\n\t\t}))))\n\t}\n\t{\n\t\t// handle request timeout\n\t\topts = append(opts, grpc_.WithGrpcUnaryServerChain(\n\t\t\ttimeoutlimit.UnaryServerInterceptor(f.fc.HandledTimeoutUnary)))\n\t\topts = append(opts, grpc_.WithGrpcStreamServerChain(\n\t\t\ttimeoutlimit.StreamServerInterceptor(f.fc.HandledTimeoutStream)))\n\t}\n\t{\n\t\t// burst limit\n\t\topts = append(opts, grpc_.WithGrpcUnaryServerChain(\n\t\t\tburstlimit.UnaryServerInterceptor(f.fc.MaxConcurrencyUnary, f.fc.BurstLimitTimeoutUnary)))\n\t\topts = append(opts, grpc_.WithGrpcStreamServerChain(\n\t\t\tburstlimit.StreamServerInterceptor(f.fc.MaxConcurrencyStream, f.fc.BurstLimitTimeoutStream)))\n\t}\n\n\t// cors\n\topts = append(opts, grpc_.WithHttpWrapper(cors.New(f.fc.Cors).Handler))\n\topts = append(opts, f.fc.GatewayOptions...)\n\topts = append(opts, grpc_.WithSlogLoggerConfig(slog.Default().Handler(), grpc_.ExtractLoggingOptions(opts...))...)\n\tgrpcBackend := grpc_.NewGatewayTLS(f.fc.BindAddress, f.fc.TlsConfig, opts...)\n\tgrpcBackend.ApplyOptions()\n\t{\n\t\tl := slog.NewLogLogger(slog.Default().Handler(), slog.LevelError)\n\t\tl.SetFlags(log.Lshortfile)\n\t\tgrpcBackend.ErrorLog = l\n\t}\n\tginBackend := gin.New()\n\n\t{\n\t\tl := slog.NewLogLogger(slog.Default().Handler(), slog.LevelInfo)\n\t\tl.SetFlags(log.Lshortfile)\n\t\tginBackend.Use(gin.LoggerWithConfig(gin.LoggerConfig{\n\t\t\tFormatter: GinLogFormatter(\"GIN over HTTP\"),\n\t\t\tOutput: l.Writer(),\n\t\t}))\n\t}\n\tginBackend.Use(gin_.RecoveryWithWriter(grpcBackend.ErrorLog.Writer()))\n\tginBackend.Use(gin_.UseHTTPPreflight())\n\tginBackend.Use(f.fc.GinMiddlewares...)\n\n\tdefaultHealthChecks := []healthz.HealthChecker{healthz.PingHealthzCheck, healthz.LogHealthCheck}\n\n\ts := &WebServer{\n\t\tName: f.fc.Name,\n\t\tBindAddress: f.fc.BindAddress,\n\t\tExternalAddress: f.fc.ExternalAddress,\n\t\tPreferRegisterHTTPFromEndpoint: f.fc.PreferRegisterHTTPFromEndpoint,\n\t\tShutdownDelayDuration: f.fc.ShutdownDelayDuration,\n\t\tgrpcBackend: grpcBackend,\n\t\tginBackend: ginBackend,\n\n\t\tpostStartHooks: map[string]postStartHookEntry{},\n\t\tpreShutdownHooks: map[string]preShutdownHookEntry{},\n\t\thealthzChecks: defaultHealthChecks,\n\t\tlivezChecks: defaultHealthChecks,\n\t\treadyzChecks: defaultHealthChecks,\n\t\treadinessStopCh: make(chan struct{}),\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "c152709b13fa6e9ca231f35ec06d9017", "score": "0.51837385", "text": "func Run(port int) {\n\taddress := HttpAddr\n\tif port == 0 {\n\t\tport = HttpPort\n\t}\n\n\tMainRouter = NewRouter(path.Join(BasePath, \"conf\", \"routes\"))\n\tMainTemplateLoader = NewTemplateLoader(TemplatePaths)\n\n\t// The \"watch\" config variable can turn on and off all watching.\n\t// (As a convenient way to control it all together.)\n\tif Config.BoolDefault(\"watch\", true) {\n\t\tMainWatcher = NewWatcher()\n\t}\n\n\t// If desired (or by default), create a watcher for templates and routes.\n\t// The watcher calls Refresh() on things on the first request.\n\tif MainWatcher != nil && Config.BoolDefault(\"watch.templates\", true) {\n\t\tMainWatcher.Listen(MainTemplateLoader, MainTemplateLoader.paths...)\n\t} else {\n\t\tMainTemplateLoader.Refresh()\n\t}\n\n\tif MainWatcher != nil && Config.BoolDefault(\"watch.routes\", true) {\n\t\tMainWatcher.auditor = PluginNotifier{plugins}\n\t\tMainWatcher.Listen(MainRouter, MainRouter.path)\n\t} else {\n\t\tMainRouter.Refresh()\n\t\tplugins.OnRoutesLoaded(MainRouter)\n\t}\n\n\tServer = &http.Server{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", address, port),\n\t\tHandler: http.HandlerFunc(handle),\n\t}\n\n\tplugins.OnAppStart()\n\n\tgo func() {\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\tfmt.Printf(\"Listening on port %d...\\n\", port)\n\t}()\n\n\tERROR.Fatalln(\"Failed to listen:\", Server.ListenAndServe())\n}", "title": "" }, { "docid": "b42d062892a309b0a76acc524b0183f2", "score": "0.5183415", "text": "func (wsv *web) run(tlsConfig *tls.Config) {\n\tdefer wsv.doCloseDone.Done()\n\tdefer wsv.isRun.Store(false)\n\tdefer func() {\n\t\tif wsv.conf.Socket == \"\" {\n\t\t\treturn\n\t\t}\n\t\tswitch wsv.conf.Mode {\n\t\tcase netSystemd:\n\t\t\treturn\n\t\tcase netUnix, netUnixPacket:\n\t\t\t_ = os.Remove(wsv.conf.Socket)\n\t\t}\n\t}()\n\n\t// Configure net/http web server\n\tif wsv.server = wsv.loadConfiguration(tlsConfig); wsv.err != nil {\n\t\treturn\n\t}\n\t// Configure keepalive of web server\n\tif wsv.conf.KeepAliveDisable {\n\t\twsv.server.SetKeepAlivesEnabled(false)\n\t}\n\t// Begin serve\n\tif wsv.conf.TLSPrivateKeyPEM == \"\" || wsv.conf.TLSPublicKeyPEM == \"\" {\n\t\twsv.err = wsv.server.Serve(wsv.listener)\n\t\treturn\n\t}\n\twsv.err = wsv.server.ServeTLS(wsv.listener, wsv.conf.TLSPublicKeyPEM, wsv.conf.TLSPrivateKeyPEM)\n}", "title": "" }, { "docid": "100f28d2fec1eb589a7aa8db1b8d41f3", "score": "0.518287", "text": "func (api *APIServer) Init(url string) {\n\tapi.urlServer = url\n}", "title": "" }, { "docid": "ae582c8c739f5004d8eb5a577225fc46", "score": "0.5169854", "text": "func (s *Server) Run(handler http.Handler) error {\n\tif s.HTTPPort == 0 {\n\t\ts.HTTPPort = httpPort\n\t}\n\tif s.Insecure {\n\t\treturn s.runInsecure(handler)\n\t}\n\tif err := os.MkdirAll(s.CertsDir, os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\treturn s.runSecure(handler)\n}", "title": "" }, { "docid": "2babd11cb308a7141c01b9322dc76857", "score": "0.5165105", "text": "func serve(c *Config) (*http.Server, chan error) {\n\tprometheus.MustRegister(c.processDuration)\n\tprometheus.MustRegister(c.processCurrent)\n\tprometheus.MustRegister(c.errCounter)\n\n\t// Use DefaultServeMux as the handler\n\tsrv := &http.Server{Addr: c.ListenAddr, Handler: nil}\n\thttp.HandleFunc(\"/\", c.handleWebhook)\n\thttp.HandleFunc(\"/_health\", handleHealth)\n\thttp.Handle(\"/metrics\", promhttp.Handler())\n\n\t// Start http server in a goroutine, so that it doesn't block other activities\n\tvar httpSrvResult = make(chan error)\n\tgo func() {\n\t\tcommands := make([]string, len(c.Commands))\n\t\tfor i, e := range c.Commands {\n\t\t\tcommands[i] = e.Cmd\n\t\t}\n\t\tlog.Println(\"Listening on\", c.ListenAddr, \"with commands\", strings.Join(commands, \", \"))\n\t\thttpSrvResult <- srv.ListenAndServe()\n\t}()\n\n\treturn srv, httpSrvResult\n}", "title": "" }, { "docid": "258b08eba5cdd83b1ea0c84f333121f6", "score": "0.51620424", "text": "func initHandlers(){\r\n\r\n\t// Create the static file server.\r\n\tfs := http.FileServer(http.Dir(\"static/\"))\r\n\thttp.Handle(\"/static/\", http.StripPrefix(\"/static/\", fs))\r\n\r\n\t//Creating the handler for the index page\r\n\thttp.HandleFunc(\"/\", index)\r\n\r\n\t//Creating the handler for the game page\r\n\thttp.HandleFunc(\"/game\", gameHandler)\r\n\r\n\t//Creating the handler for the game page\r\n\thttp.HandleFunc(\"/controller\", controllerHandler)\r\n\r\n\t//Handler for the AJAX request for joining room\r\n\thttp.HandleFunc(\"/join\" , joinHandler)\r\n\r\n\t//Handler for the AJAX request for creating a room\r\n\thttp.HandleFunc(\"/create\" , createHandler)\r\n\r\n\t//Handler for Web Socket\r\n\thttp.HandleFunc(\"/ws\", wsHandler)\r\n\r\n\r\n}", "title": "" } ]
cc88581dff542852c63ec70d6ee1e738
PromptYesOrNo prompts the specified string and let the user choose whether they want or don't want to proceed.
[ { "docid": "609e912ba293df76404e5895ef90ed11", "score": "0.8276627", "text": "func PromptYesOrNo(prompt string) (bool, error) {\n\tfor {\n\t\tfmt.Print(prompt + \" (y/N) \")\n\t\tvar resp string\n\t\tfmt.Scanln(&resp)\n\n\t\t// Trim the newline from the input.\n\t\tresp = strings.TrimRight(resp, \"\\n\")\n\t\tswitch resp {\n\t\tcase \"\", \"n\", \"N\":\n\t\t\treturn false, nil\n\t\tcase \"y\", \"Y\":\n\t\t\treturn true, nil\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "4d40069d3cadb49a312e1a776f1ed876", "score": "0.764121", "text": "func AskYesOrNo(promptMsg string, tries int) bool {\n\tr := bufio.NewReader(os.Stdin)\n\tfor ; tries > 0; tries-- {\n\t\tfmt.Printf(\"%s [y/n]: \", promptMsg)\n\n\t\tres, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tklog.Fatal(err)\n\t\t}\n\t\tresponse := strings.ToLower(strings.TrimSpace(res))\n\n\t\tif response == \"y\" || response == \"yes\" {\n\t\t\treturn true\n\t\t} else if response == \"n\" || response == \"no\" {\n\t\t\treturn false\n\t\t} else {\n\t\t\tfmt.Printf(\"Enter a valid input:[yes/no]\\n\")\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c838a72fb3ef54d63c3d935fb1695a14", "score": "0.74276185", "text": "func askYesNo(prompt string) bool {\n\tuInput := strings.TrimSpace(userInput(prompt))\n\tif uInput == \"y\" {\n\t\treturn true\n\t} else if uInput == \"n\" {\n\t\treturn false\n\t}\n\tLogger.Println(\"Wrong input. Expecting either 'y' or 'n'.\")\n\treturn askYesNo(prompt)\n}", "title": "" }, { "docid": "811bec4bc1e19f09ed9f4e153eb00144", "score": "0.7244838", "text": "func (obj *ExpertSystem) askForYesOrNo(scanner *bufio.Scanner) Response {\n\tfor true {\n\t\trawAnswer := receiveInput(scanner)\n\t\tresponse := stringToResponse(rawAnswer)\n\t\tif response == Response(Yes) || response == Response(No) {\n\t\t\treturn response\n\t\t} else {\n\t\t\tobj.writeln(\"Please answer with a \\\"yes\\\" or \\\"no\\\"\")\n\t\t}\n\t}\n\treturn Response(IncorrectResponse)\n}", "title": "" }, { "docid": "ac6476bbfd032714f62d64006aa01493", "score": "0.7244175", "text": "func prompt(msg string, autoConfirm bool) {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Print(msg, \" \")\n\tvar text string\n\tif autoConfirm {\n\t\ttext = \"y\"\n\t\tfmt.Print(\"y\")\n\t} else {\n\t\ttext, _ = reader.ReadString('\\n')\n\t}\n\tfmt.Println()\n\n\ttextLower := strings.ToLower(strings.TrimRight(text, \"\\n\"))\n\tif textLower != \"y\" && textLower != \"yes\" {\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "2961f7438767965f1f7459fd410a2e9d", "score": "0.72346973", "text": "func (prompt *Prompt) AskYesNo(question string) (bool, error) {\n\tprompt.screen.WriteMessage(question)\n\tprompt.screen.Flush()\n\t_, ch := prompt.keyboard.GetKey()\n\tif strings.ToLower(string(ch)) == \"y\" {\n\t\treturn true, nil\n\t} else if strings.ToLower(string(ch)) == \"n\" {\n\t\treturn false, nil\n\t} else {\n\t\treturn false, errors.New(\"Cancel\")\n\t}\n}", "title": "" }, { "docid": "7fb0ea6815d23f3e4b1306aa08b27dc3", "score": "0.7090891", "text": "func AskConfirmation(what string, defaultChoice bool) (bool, error) {\n\treader := bufio.NewReader(os.Stdin)\n\tloop := true\n\n\tdefaultIndicator := \"[Y/n]\"\n\tchoice := defaultChoice\n\tif !defaultChoice {\n\t\tdefaultIndicator = \"[y/N]\"\n\t}\n\n\tfor loop {\n\t\tfmt.Printf(\"%s %s : \", what, defaultIndicator)\n\t\tres, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tres = strings.ToLower(strings.TrimSpace(res))\n\n\t\tif res == \"y\" || res == \"yes\" {\n\t\t\tchoice = true\n\t\t\tloop = false\n\t\t} else if res == \"n\" || res == \"no\" {\n\t\t\tchoice = false\n\t\t\tloop = false\n\t\t} else if res == \"\" {\n\t\t\tloop = false\n\t\t}\n\t}\n\treturn choice, nil\n}", "title": "" }, { "docid": "9f63cbc334f5f8c487a15e9ac4f0a833", "score": "0.7080676", "text": "func askForConfirmation(s string) bool {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfor {\n\t\tfmt.Printf(\"%s [y/n]: \", s)\n\n\t\tresponse, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tresponse = strings.ToLower(strings.TrimSpace(response))\n\n\t\tif response == \"y\" || response == \"yes\" {\n\t\t\treturn true\n\t\t} else if response == \"n\" || response == \"no\" {\n\t\t\treturn false\n\t\t} else {\n\t\t\tfmt.Printf(response + \" make a valid selection\\n\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c8bae864cdcac858a241637ddb387dca", "score": "0.70361394", "text": "func askForConfirmation(s string) bool {\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tfmt.Printf(\"%s [y/n]: \", s)\n\t\tresponse, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tresponse = strings.ToLower(strings.TrimSpace(response))\n\t\tif response == \"y\" || response == \"yes\" {\n\t\t\treturn true\n\t\t} else if response == \"n\" || response == \"no\" {\n\t\t\treturn false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8a314b9f1845a85feafd4fa895edf128", "score": "0.7012942", "text": "func AskForConfirmation(s string) bool {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfor {\n\t\tfmt.Printf(\"%s [y/n]: \", s)\n\n\t\tresponse, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tresponse = strings.ToLower(strings.TrimSpace(response))\n\n\t\tif response == \"y\" || response == \"yes\" {\n\t\t\treturn true\n\t\t} else if response == \"n\" || response == \"no\" {\n\t\t\treturn false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8a314b9f1845a85feafd4fa895edf128", "score": "0.7012942", "text": "func AskForConfirmation(s string) bool {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfor {\n\t\tfmt.Printf(\"%s [y/n]: \", s)\n\n\t\tresponse, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tresponse = strings.ToLower(strings.TrimSpace(response))\n\n\t\tif response == \"y\" || response == \"yes\" {\n\t\t\treturn true\n\t\t} else if response == \"n\" || response == \"no\" {\n\t\t\treturn false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5599aa042e61f6896165769398241ee2", "score": "0.70027906", "text": "func AskYesNo(question string) bool {\n\n\tfmt.Printf(\"%s? [y/N]: \", question)\n\n\tvar response string\n\tfmt.Scanln(&response)\n\n\tyesResponses := []string{\"y\", \"Y\", \"yes\", \"Yes\", \"YES\"}\n\tfor _, elem := range yesResponses {\n\t\tif elem == response {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a3a2743597179e1a231320b457685e57", "score": "0.69863707", "text": "func YesNo(question string, noIsDefault bool) bool {\n\tvar s string\n\talternatives := \"Yn\"\n\tif noIsDefault {\n\t\talternatives = \"yN\"\n\t}\n\tfmt.Printf(question + \" [\" + alternatives + \"] \")\n\tfmt.Scanf(\"%s\", &s)\n\tif noIsDefault {\n\t\t// Anything that isn't yes is \"no\" (false)\n\t\treturn s == \"Y\" || s == \"y\"\n\t}\n\t// Anything that isn't no is \"yes\" (true)\n\treturn !(s == \"N\" || s == \"n\")\n}", "title": "" }, { "docid": "d7e1c2edcd3fca6cfc794cd3c235e426", "score": "0.69674724", "text": "func promptUser(msg string) bool {\n\tif config.Flags.YesToAll {\n\t\treturn true\n\t}\n\n\tprompt := \"Choose 'y' or 'n', then press enter: \"\n\tyesResponses := []string{\"y\", \"yes\"}\n\tnoResponses := []string{\"n\", \"no\"}\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfmt.Println(msg)\n\tfmt.Print(prompt)\n\n\tfor scanner.Scan() {\n\t\tuserInput := strings.ToLower(scanner.Text())\n\n\t\tif tasks.ContainsString(noResponses, userInput) {\n\t\t\treturn false\n\t\t}\n\n\t\tif tasks.ContainsString(yesResponses, userInput) {\n\t\t\treturn true\n\t\t}\n\n\t\t//Repeat prompt if invalid input is provided\n\t\tfmt.Printf(\"%s\", prompt)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6e0a13ef2b40dc9138e6347fbb7a5a0b", "score": "0.6953989", "text": "func AskYes(question string, defaultYes bool) (isYes bool) {\n\tfmt.Print(question)\n\tif defaultYes {\n\t\tfmt.Print(\" [yes]: \")\n\t} else {\n\t\tfmt.Print(\" [no]: \")\n\t}\n\treader := bufio.NewReader(os.Stdin)\n\treply, _ := reader.ReadString('\\n')\n\tDefaultIfEmptyStr(&reply, \"yes\")\n\tif IsEqStr(reply, \"yes\") {\n\t\treturn true\n\t}\n\treturn\n}", "title": "" }, { "docid": "ffcd463c238fc76aa02ad09a88acbf4d", "score": "0.6929092", "text": "func askYesNo(writer io.Writer, reader io.Reader) (bool, error) {\n\tvar s string\n\n\tfmt.Fprintf(writer, \"Do you want to proceed? (y/N): \")\n\t_, err := fmt.Fscan(reader, &s)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\ts = strings.TrimSpace(s)\n\ts = strings.ToLower(s)\n\n\tif s == \"y\" || s == \"yes\" {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "0af217a9982a89a5cebb9c358d13fe85", "score": "0.69290733", "text": "func PromptUser(message string) bool {\n\t// Assume yes if the NoUserPrompt is set\n\tif NoUserPrompt {\n\t\treturn true\n\t}\n\n\tfmt.Println(message)\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tif scanner.Scan() {\n\t\tswitch strings.ToLower(scanner.Text()) {\n\t\tcase \"yes\", \"y\":\n\t\t\treturn true\n\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "541dc2aea5ea26d6892991f14a5947f4", "score": "0.6898441", "text": "func AskForConfirmation() bool {\n\tvar input string\n\t_, err := fmt.Scanln(&input)\n\tif err != nil {\n\t\tfmt.Println(\"fatal: \", err)\n\t}\n\tpositive := []string{\"y\", \"Y\", \"yes\", \"Yes\", \"YES\"}\n\tnegative := []string{\"n\", \"N\", \"no\", \"No\", \"NO\"}\n\tif SliceContains(positive, input) {\n\t\treturn true\n\t} else if SliceContains(negative, input) {\n\t\treturn false\n\t} else {\n\t\tfmt.Println(\"Please type yes or no and then press enter.\")\n\t\treturn AskForConfirmation()\n\t}\n}", "title": "" }, { "docid": "498a8ebdba4479477798f076be801fd5", "score": "0.6888289", "text": "func PromptUser(message string) bool {\n\t// Assume yes if the NoUserPrompt is set\n\tif NoUserPrompt {\n\t\treturn true\n\t}\n\n\tfmt.Printf(message)\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tif scanner.Scan() {\n\t\tswitch strings.ToLower(scanner.Text()) {\n\t\tcase \"yes\", \"y\":\n\t\t\treturn true\n\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d90459d541c4f3e51708ea4a8b5e1bab", "score": "0.68765634", "text": "func askForConfirmation(p string) bool {\n\tfmt.Println(p)\n\tvar response string\n\t_, err := fmt.Scanln(&response)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn false\n\t}\n\tokayResponses := []string{\"y\", \"Y\", \"yes\", \"Yes\", \"YES\"}\n\tnokayResponses := []string{\"n\", \"N\", \"no\", \"No\", \"NO\", \"\\n\"}\n\tquitResponses := []string{\"q\", \"Q\", \"exit\", \"quit\"}\n\tif containsString(okayResponses, response) {\n\t\treturn true\n\t} else if containsString(nokayResponses, response) {\n\t\treturn false\n\t} else if containsString(quitResponses, response) {\n\t\treturn false\n\t} else {\n\t\tfmt.Println(\"\\nNot valid answer, try again. [y/n] [yes/no]\")\n\t\treturn askForConfirmation(p)\n\t}\n}", "title": "" }, { "docid": "eff192991d0f7cae975708094caf8598", "score": "0.6853166", "text": "func prompt(question string) bool {\n\tvar s string\n\tfmt.Printf(question)\n\tif _, err := fmt.Scan(&s); err != nil {\n\t\tlog.Fatal(\"Failed to scan: \", err)\n\t}\n\ts = strings.TrimSpace(strings.ToLower(s))\n\tif s == \"y\" || s == \"yes\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a9310ccf3370d6054a0a9fdba41c0e3a", "score": "0.6845246", "text": "func askForConfirmation() bool {\n\tvar sure string\n\n\tfmt.Printf(\"(y/N): \")\n\t_, err := fmt.Scan(&sure)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsure = strings.TrimSpace(sure)\n\tsure = strings.ToLower(sure)\n\n\tif sure == \"y\" || sure == \"yes\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "05a956eb9785f2dde6f20c0109ac5e54", "score": "0.6772416", "text": "func (c *ConfigureCmd) yesNo(message string) bool {\n\tprompt := promptui.Prompt{\n\t\tLabel: message,\n\t\tIsConfirm: true,\n\t}\n\n\tresult, err := prompt.Run()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn result == \"y\"\n}", "title": "" }, { "docid": "61c68e3602b9a2274ce2a099036b5f25", "score": "0.6688547", "text": "func SelectYesNo(ctx context.Context, label string) (bool, error) {\n\t_, value, err := SelectPrompt(ctx, label, \"yes\", \"no\")\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn value == \"yes\", nil\n}", "title": "" }, { "docid": "28ecb252147bea2e72198ac96353ed63", "score": "0.66081905", "text": "func Confirm(label string) bool {\n\tprompt := promptui.Prompt{\n\t\tLabel: label,\n\t\tIsConfirm: true,\n\t}\n\n\tresult, err := prompt.Run()\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn strings.ToLower(result) == \"y\"\n}", "title": "" }, { "docid": "c1c2553685ae83a4a632edd2a240f15d", "score": "0.6603768", "text": "func UserConfirm(prompt string, defAns defaultAnswer) bool {\n\tif skipConfirmation {\n\t\treturn true\n\t}\n\tif !strings.HasSuffix(prompt, \" \") {\n\t\tprompt = prompt + \" \"\n\t}\n\tvar selector string\n\tswitch defAns {\n\tcase DefaultNone:\n\t\tselector = \"[yes/no]\"\n\tcase DefaultYes:\n\t\tselector = \"[YES/no]\"\n\tcase DefaultNo:\n\t\tselector = \"[yes/NO]\"\n\tdefault:\n\t\tlog.Fatal(\"unknown defaultanswer \" + defAns.String())\n\t}\n\n\tfor {\n\t\tfmt.Printf(\"%s%s: \", prompt, selector)\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tinput, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tfmt.Println(\"invalid input: \" + err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tinput = strings.TrimSuffix(input, \"\\n\")\n\t\tinput = strings.Trim(input, \" \")\n\t\tinput = strings.ToLower(input)\n\t\tswitch input {\n\t\tcase \"n\", \"no\":\n\t\t\treturn false\n\t\tcase \"y\", \"yes\":\n\t\t\treturn true\n\t\tcase \"\":\n\t\t\tif defAns == DefaultYes {\n\t\t\t\treturn true\n\t\t\t} else if defAns == DefaultNo {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\tfmt.Println(\"please enter 'yes' or 'no'\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bbdca9a540be38f70995f9b328aff77f", "score": "0.649756", "text": "func (m *Messenger) PromptUntilYorN() bool {\n\tres, err := m.PromptUntil([]string{\"y\", \"yes\", \"n\", \"no\"})\n\tif err != nil {\n\t\tm.Die(\"Error processing response: %s\", err)\n\t}\n\n\tif res == \"y\" || res == \"yes\" {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7f850a3e54dd5b2e34559562a5dfe9bd", "score": "0.6426453", "text": "func (e *Exec) AskWithConfirmation(question string, attributes ...bool) bool {\n\tscanner := bufio.NewScanner(os.Stdin)\n\n\tvar defaultResponse bool\n\tchoices := map[string]bool{\n\t\t\"y\": true,\n\t\t\"yes\": true,\n\t\t\"n\": false,\n\t\t\"no\": false,\n\t}\n\n\tif len(attributes) == 1 {\n\t\tdefaultResponse = attributes[0]\n\t\tif defaultResponse {\n\t\t\tquestion += fmt.Sprintf(\" [default: Y/n]\")\n\t\t} else {\n\t\t\tquestion += fmt.Sprintf(\" [default: y/N]\")\n\t\t}\n\t}\n\n\tcolor.Green(\"[%s] %s %s\", \"local\", \">\", color.WhiteString(question))\n\tscanner.Scan()\n\tresponse := strings.ToLower(strings.TrimSpace(scanner.Text()))\n\n\tif choice, choiceValue := choices[response]; choiceValue {\n\t\treturn choice\n\t}\n\n\treturn defaultResponse\n}", "title": "" }, { "docid": "78df60462c3bdec1f4668893457f728a", "score": "0.63822484", "text": "func Confirm(message string) (bool, error) {\n\tfmt.Print(message)\n\tvalidOptions := []string{\"yes\", \"y\"}\n\tvar input string\n\t_, err := fmt.Scanln(&input)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tinput = strings.ToLower(input)\n\tfor _, validOption := range validOptions {\n\t\tif input == validOption {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "a7a7502adb3ffcf33c14db559ac54091", "score": "0.6371455", "text": "func InputIsYes(ans string) bool {\n\treturn len(ans) > 0 && (ans[0] == 'y' || ans[0] == 'Y')\n}", "title": "" }, { "docid": "f56ba19f468daa3a7dba622f52b616c9", "score": "0.63706726", "text": "func AskPlayAgain() bool {\n\tfmt.Print(\"TRY AGAIN (YES OR NO) : \")\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Scan()\n\n\tval := strings.ToUpper(scanner.Text())\n\treturn val == \"YES\" || val == \"Y\"\n}", "title": "" }, { "docid": "28a4c644a2dd3d2fdbb0c29decc2e327", "score": "0.6269622", "text": "func TakeInput(promptLabel string, isConfirm bool) string {\n\treader := bufio.NewReader(os.Stdin)\n\tif isConfirm {\n\t\tfor {\n\t\t\tfmt.Print(promptLabel, \" [y/n] \")\n\t\t\ttext, _ := reader.ReadString('\\n')\n\t\t\ttext = strings.TrimSpace(text)\n\t\t\ttext = strings.ToLower(text)\n\t\t\tstrings.ReplaceAll(text, \"yes\", \"y\")\n\t\t\tstrings.ReplaceAll(text, \"no\", \"n\")\n\t\t\tif text == \"y\" || text == \"n\" {\n\t\t\t\treturn text\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Print(promptLabel, \" \")\n\t\ttext, _ := reader.ReadString('\\n')\n\t\ttext = strings.TrimSpace(text)\n\t\treturn text\n\t}\n}", "title": "" }, { "docid": "8076ef314be7be508714a81c25a474b7", "score": "0.62601763", "text": "func Prompt(question, command string, showOutput bool) bool {\n\tfmt.Printf(\"==> %s '%s'? (y/n)\\n\", question, command)\n\ttext := ReadPrompt(os.Stdin)\n\n\tfmt.Println(text)\n\t// convert CRLF to LF\n\ttext = strings.Replace(text, \"\\n\", \"\", -1)\n\n\tif strings.Compare(\"Y\", text) == 0 || strings.Compare(\"y\", text) == 0 {\n\t\t_, _ = ExecBashPipedCommand(command, showOutput)\n\t\tlog.Printf(\"Command '%s' finished\\n\", command)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "51bed886a399fe42d1bf426e5a3fa557", "score": "0.6251764", "text": "func IsResponseYes(mode StdinMode) (bool, error) {\n\tif mode == NoConfirm {\n\t\t// Terminal need to be set to raw mode for NoConfirm mode.\n\t\tfd := int(os.Stdin.Fd())\n\t\tstate, err := terminal.MakeRaw(fd)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tdefer terminal.Restore(fd, state)\n\t}\n\n\treader := bufio.NewReader(os.Stdin)\n\tc, err := reader.ReadByte()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif mode == NoConfirm {\n\t\t// Printing back the pressed character.\n\t\t// Raw mode do not print back the pressed character.\n\t\tfmt.Printf(\"%c\\r\\n\", c)\n\t}\n\n\treturn c == 'y', nil\n}", "title": "" }, { "docid": "cb1dd88c4f6087c4faf5e0c367175005", "score": "0.6215113", "text": "func PromptForRematch(reader *bufio.Reader) string {\n\tfmt.Printf(\"\\n\\nPlay Again [Y]es/[N]o: \")\n\tagain, _ := reader.ReadString('\\n')\n\tagain = strings.Trim(again, \"\\n\")\n\n\tfor again != \"Y\" && again != \"y\" && again != \"Yes\" && again != \"yes\" &&\n\t\tagain != \"N\" && again != \"n\" && again != \"No\" && again != \"no\" {\n\t\tfmt.Printf(\"\\n\\nPlay Again [Y]es/[N]o: \")\n\t\tagain, _ := reader.ReadString('\\n')\n\t\tagain = strings.Trim(again, \"\\n\")\n\t}\n\n\treturn again\n}", "title": "" }, { "docid": "a0ba6c1016b03a76f9c8888c19203e14", "score": "0.6208155", "text": "func AskYesNoQuestion(qh *QuestionModelHelper, question string,\n\tdefaultToYes bool) (string, error) {\n\tdefaultOption := cli.ResponseNo\n\tif defaultToYes {\n\t\tdefaultOption = cli.ResponseYes\n\t}\n\n\tmodel := &SingleSelectList{}\n\terr := qh.Svc.AskQuestion(model, &QuestionInput{\n\t\tQuestionString: question,\n\t\tIndexedOptions: yesNoOptions,\n\t\tDefaultOption: defaultOption,\n\t\tRows: CreateSingleLineRows(yesNoData),\n\t})\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn model.GetChoice(), nil\n}", "title": "" }, { "docid": "7e5a26025a65f0e6c90fbda18bc27b14", "score": "0.620733", "text": "func (p *Prompter) Confirm(label string) bool {\n\n\tprompt := promptui.Prompt{\n\t\tLabel: label,\n\t\tIsConfirm: true,\n\t}\n\n\t_, err := prompt.Run()\n\n\treturn err == nil\n\n}", "title": "" }, { "docid": "3e18ff58d85bb92a222a43b38bf6bdbc", "score": "0.6195587", "text": "func Confirm(question string) error {\n\tfor {\n\t\tfmt.Print(question + \" [y/n]: \")\n\t\tanswer, err := ReadLine(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ta := string(bytes.ToLower(answer))\n\t\tif strings.HasPrefix(a, \"y\") {\n\t\t\treturn nil\n\t\t} else if strings.HasPrefix(a, \"n\") {\n\t\t\treturn ErrAbort\n\t\t} else {\n\t\t\tfmt.Println(\"answer not recognized\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "caee4077e5a2381cafbb0f44e44de401", "score": "0.6176038", "text": "func confirmed(c *cli.Context) bool {\n\tif c.GlobalIsSet(\"non-interactive\") || utils.NeedsFormatting(c) {\n\t\treturn true\n\t} else {\n\t\tresponse := \"\"\n\t\tfor {\n\t\t\tresponse, _ = askForInput(\"Are you sure [y/n]? \", response)\n\t\t\tresponse = strings.ToLower(response)\n\t\t\tif response == \"y\" || response == \"yes\" {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif response == \"n\" || response == \"no\" {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfmt.Printf(\"Please enter \\\"yes\\\" or \\\"no\\\".\\n\")\n\t\t\tresponse = \"\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d91dc7f9f060515fd7b249ed09e21e5", "score": "0.6145595", "text": "func YesNoButtons(title, text string) (bool, error) {\n\tosa, err := exec.LookPath(\"osascript\")\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\to, err := exec.Command(osa, \"-e\", `set T to button returned of (display dialog \"`+text+`\" with title \"`+title+`\" buttons {\"No\", \"Yes\"} default button 2)`).Output()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tout := strings.TrimSpace(string(o))\n\tresult := out == \"Yes\"\n\n\treturn result, nil\n}", "title": "" }, { "docid": "baf99c57e969944f8b2fccdd25e1b444", "score": "0.6112929", "text": "func confirm(s string, tries int) bool {\n\tr := bufio.NewReader(os.Stdin)\n\n\tfor ; tries > 0; tries-- {\n\t\tfmt.Printf(\"%s [y/n]: \", s)\n\n\t\tres, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tlogger.Fatal(err)\n\t\t}\n\n\t\t// Empty input (i.e. \"\\n\")\n\t\tif len(res) < 2 {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn strings.ToLower(strings.TrimSpace(res))[0] == 'y'\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7204c0ac0daf09dcc340c54cee946083", "score": "0.6097092", "text": "func AnswerIsYes(defVal ...bool) bool {\n\tmark := \" [yes|no]: \"\n\tif len(defVal) > 0 {\n\t\tvar defShow string\n\t\tif defVal[0] {\n\t\t\tdefShow = \"yes\"\n\t\t} else {\n\t\t\tdefShow = \"no\"\n\t\t}\n\n\t\tmark = fmt.Sprintf(\" [yes|no](default <cyan>%s</>): \", defShow)\n\t}\n\n\t// _, err := fmt.Scanln(&answer)\n\t// _, err := fmt.Scan(&answer)\n\tfChar, err := ReadFirst(mark)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif len(fChar) > 0 {\n\t\tfChar := strings.ToLower(fChar)\n\t\tif fChar == \"y\" {\n\t\t\treturn true\n\t\t}\n\t\tif fChar == \"n\" {\n\t\t\treturn false\n\t\t}\n\t} else if len(defVal) > 0 { // has default value\n\t\treturn defVal[0]\n\t}\n\n\t_, _ = fmt.Fprint(Output, \"Please try again\")\n\treturn AnswerIsYes()\n}", "title": "" }, { "docid": "e3d7e41e64329098d2ae58d8668b4ac3", "score": "0.60748786", "text": "func (ask *Ask) Confirm() (bool, error) {\n\t_, err := promptuiRun(ask)\n\n\tif err == promptui.ErrAbort {\n\t\treturn false, nil\n\t} else if err == nil {\n\t\treturn true, nil\n\t} else {\n\t\treturn false, err\n\t}\n}", "title": "" }, { "docid": "a5207249e4c53003d656ca312d46bb90", "score": "0.60622805", "text": "func modifyConfirmation(msg string) bool {\n\tvar response string\n\n\tfor !(response == \"yes\" || response == \"no\") {\n\t\tfmt.Println(msg + \"(yes/no):\")\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tresponse, _ = reader.ReadString('\\n')\n\t\tresponse = strings.TrimSuffix(response, \"\\r\\n\")\n\t\tresponse = strings.TrimSuffix(response, \"\\n\")\n\t\tscreen.Clear()\n\t\tscreen.MoveTopLeft()\n\t\tlog.Debugf(\"confirmation response: %v\", response)\n\t}\n\tif response == \"yes\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eb85e03b0eafd92e9430579c95124424", "score": "0.6059591", "text": "func Prompt(question string, defaultAnswer string) string {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfmt.Print(question)\n\ttext, _ := reader.ReadString('\\n')\n\tif text == \"\\n\" {\n\t\treturn defaultAnswer\n\t}\n\n\treturn strings.TrimSuffix(text, \"\\n\")\n}", "title": "" }, { "docid": "52480c4bc173102ecf38c857fb4e5d1d", "score": "0.605667", "text": "func (cp ConfirmAsker) Ask(reader io.Reader) (*Answer, error) {\n\tprefix := \"(y/N) \"\n\tif cp.Default {\n\t\tprefix = \"(Y/n) \"\n\t}\n\n\ttp := TextAsker{\n\t\tQuestion: cp.Question,\n\t\tPrefix: prefix,\n\t\tValidator: func(response string) error {\n\t\t\tif response == \"\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif _, err := strconv.ParseBool(response); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tresponse, err := tp.Ask(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !response.Provided {\n\t\treturn &Answer{\n\t\t\tBoolResponse: cp.Default,\n\t\t\tProvided: false,\n\t\t}, nil\n\t}\n\n\tanswer, err := strconv.ParseBool(response.StringResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Answer{\n\t\tBoolResponse: answer,\n\t\tProvided: true,\n\t}, nil\n}", "title": "" }, { "docid": "e0865f8520aadec8ff475084046031a5", "score": "0.6005791", "text": "func (c *Confirmation) RunPrompt() (bool, error) {\n\ttmpl, err := c.initConfirmationTemplate()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"initializing confirmation template: %w\", err)\n\t}\n\n\tm := NewModel(c)\n\n\tp := tea.NewProgram(m, tea.WithOutput(c.Output), tea.WithInput(c.Input))\n\tif err := p.Start(); err != nil {\n\t\treturn false, fmt.Errorf(\"running prompt: %w\", err)\n\t}\n\n\tvalue, err := m.Value()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"reading value: %w\", err)\n\t}\n\n\tif c.ConfirmationTemplate == \"\" {\n\t\treturn value, nil\n\t}\n\n\tbuffer := &bytes.Buffer{}\n\n\terr = tmpl.Execute(buffer, map[string]interface{}{\n\t\t\"FinalValue\": value,\n\t\t\"FinalValueString\": fmt.Sprintf(\"%v\", value),\n\t\t\"Prompt\": m.Prompt,\n\t\t\"DefaultYes\": m.DefaultValue == Yes,\n\t\t\"DefaultNo\": m.DefaultValue == No,\n\t\t\"DefaultUndecided\": m.DefaultValue == Undecided,\n\t\t\"TerminalWidth\": m.width,\n\t})\n\tif err != nil {\n\t\treturn value, fmt.Errorf(\"execute confirmation template: %w\", err)\n\t}\n\n\t_, err = fmt.Fprint(os.Stdout, promptkit.Wrap(buffer.String(), m.width))\n\n\treturn value, err\n}", "title": "" }, { "docid": "70c3ab1fe4512783fbafd20012c18119", "score": "0.59464556", "text": "func Confirm(tip string, defVal ...bool) bool {\n\tvar defV bool\n\tmark := \" [y/N]: \"\n\n\tif len(defVal) > 0 && defVal[0] {\n\t\tdefV = true\n\t\tmark = \" [Y/n]: \"\n\t}\n\n\treturn ReadAsBool(tip+mark, defV)\n}", "title": "" }, { "docid": "dea759e5e1819558e91961be15cd677a", "score": "0.59247416", "text": "func GetChoice(sql string, skipPrompt bool) (choice string) {\n\tif skipPrompt {\n\t\tchoice = Yes\n\t} else {\n\t\tfmt.Printf(\"%v\\nWant to continue (y/n):\", sql)\n\t\tfmt.Scan(&choice)\n\t\tchoice = strings.ToLower(choice)\n\t\tif choice == Y {\n\t\t\tchoice = Yes\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "41ffcab519a9386eed3afd128317c7c6", "score": "0.5924724", "text": "func (p Prompt) Confirm(message, help string, opts ...ConfirmOption) (bool, error) {\n\tprompt := &survey.Confirm{\n\t\tMessage: message,\n\t\tHelp: help,\n\t}\n\tfor _, option := range opts {\n\t\toption(prompt)\n\t}\n\n\tvar result bool\n\n\terr := p(prompt, &result, stdio(), icons())\n\n\treturn result, err\n}", "title": "" }, { "docid": "a0748f4e7bb8fe3691f7e30cd914e056", "score": "0.58356476", "text": "func (gui *Gui) promptToContinue() error {\n\treturn gui.createConfirmationPanel(gui.g, gui.getFilesView(), true, \"continue\", gui.Tr.SLocalize(\"ConflictsResolved\"), func(g *gocui.Gui, v *gocui.View) error {\n\t\treturn gui.genericMergeCommand(\"continue\")\n\t}, nil)\n}", "title": "" }, { "docid": "2f67b0305bb9ee6330cea4c3b70c116c", "score": "0.5826558", "text": "func (ui *UI) DisplayBoolPrompt(defaultResponse bool, template string, templateValues ...map[string]interface{}) (bool, error) {\n\tui.terminalLock.Lock()\n\tdefer ui.terminalLock.Unlock()\n\n\tresponse := defaultResponse\n\tinteractivePrompt := ui.Interactor.NewInteraction(ui.TranslateText(template, templateValues...))\n\tinteractivePrompt.SetIn(ui.In)\n\tinteractivePrompt.SetOut(ui.OutForInteraction)\n\terr := interactivePrompt.Resolve(&response)\n\tif isInterrupt(err) {\n\t\tui.Exiter.Exit(sigIntExitCode)\n\t}\n\treturn response, err\n}", "title": "" }, { "docid": "a2ddaabde6ceb71c55390f3ea42f43fd", "score": "0.5819576", "text": "func decide() {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Println(\"Would you like to search another Pokemon? (yes/no)\")\n\ttext, _ := reader.ReadString('\\n')\n\ttext = strings.Replace(text, \"\\n\", \"\", -1)\n\tif strings.Compare(\"yes\", text) == 0 {\n\t\tconsole()\n\t} else if strings.Compare(\"no\", text) == 0 {\n\t\tcallClear()\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "c04b3db5c8f6b7bb7de2a383d3b0cda2", "score": "0.57972085", "text": "func (client *Client) BooleanPrompt(request BooleanPromptRequest) (*BooleanPromptResponse, error) {\n\tvar response BooleanPromptResponse\n\tvar err error\n\n\tif err := populateSignatureOptions(&request); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif request.TerminalName != \"\" {\n\t\tvar route TerminalRoute\n\t\troute, err = client.resolveTerminalRoute(request.TerminalName)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, ErrUnknownTerminal) {\n\t\t\t\tresponse.ResponseDescription = ResponseUnknownTerminal\n\t\t\t\treturn &response, err\n\t\t\t}\n\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif route.CloudRelayEnabled {\n\t\t\terr = client.RelayRequest(\"/api/boolean-prompt\", \"POST\", request, &response, request.Test, request.Timeout)\n\t\t} else {\n\t\t\tauthRequest := TerminalBooleanPromptRequest{\n\t\t\t\tAPICredentials: route.TransientCredentials,\n\t\t\t\tRequest: request,\n\t\t\t}\n\t\t\terr = client.terminalRequest(route, \"/api/boolean-prompt\", \"POST\", authRequest, &response, request.Timeout)\n\t\t}\n\t} else {\n\t\terr = client.GatewayRequest(\"/api/boolean-prompt\", \"POST\", request, &response, request.Test, request.Timeout)\n\t}\n\n\tif timeout, ok := err.(net.Error); ok && timeout.Timeout() {\n\t\tresponse.ResponseDescription = ResponseTimedOut\n\t} else if err != nil {\n\t\tresponse.ResponseDescription = err.Error()\n\t}\n\n\tif err := handleSignature(request, &response); err != nil {\n\t\tlog.Printf(\"Failed to write signature: %+v\", err)\n\t}\n\n\treturn &response, err\n}", "title": "" }, { "docid": "cad82c539ea2df0d722be661850c39e4", "score": "0.5795723", "text": "func PromptUntilYorN() bool {\n\treturn Default.PromptUntilYorN()\n}", "title": "" }, { "docid": "bf4c3dba314cc6dd684d1fb2c0fc5f43", "score": "0.5752225", "text": "func (obj *ExpertSystem) askIfGuessIsCorrect(scanner *bufio.Scanner) bool {\n\tresponse := obj.askForYesOrNo(scanner)\n\tswitch response {\n\tcase Response(Yes):\n\t\treturn true\n\tcase Response(No):\n\t\treturn false\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "8fd3ec31f8cd0b321afb56ac612b990c", "score": "0.5738415", "text": "func ask_user() {\n\task = true\n\tfmt.Println(\"Pls enter y if you like to continue if not enter q\")\n\tfor ask == true {\n\t\tfmt.Scanln(&choice)\n\t\tif choice == \"q\" {\n\t\t\tProg3 = false\n\t\t\task = false\n\t\t}\n\t\tif choice == \"y\" {\n\t\t\t//fmt.Println(\"Continue with all the settings\")\n\t\t\task = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6de4fc2a873988d0dcc5d4286d6f940", "score": "0.56969297", "text": "func defaultEnvPrompt(envName string) {\n\tvar answer string\n\tfor {\n\t\tfmt.Printf(\"No environment was specified and no default environment was found. Falling back to %s\\n\", envName)\n\t\tfmt.Print(\"Do you wish to proceed? (y/n) \")\n\t\tfmt.Scanln(&answer)\n\t\tfmt.Println(\"\")\n\t\tif answer != \"y\" && answer != \"n\" {\n\t\t\tfmt.Printf(\"%s is not a valid option. Please enter 'y' or 'n'\\n\", answer)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tif answer == \"n\" {\n\t\tfmt.Println(\"Exiting\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "998d3c364e6c4765d04d78f41a351d8c", "score": "0.56502336", "text": "func switchPrompt(s int) string {\n\tif s > 0 {\n\t\treturn prompt2\n\t}\n\treturn prompt1\n}", "title": "" }, { "docid": "33de44943c76b79a920961ae5cb25791", "score": "0.563968", "text": "func AskUserToConfirm(message string) bool {\n\tresult := true\n\tprompt := &survey.Confirm{\n\t\tMessage: message,\n\t}\n\n\terr := survey.AskOne(prompt, &result)\n\treturn err == nil && result\n}", "title": "" }, { "docid": "7da670b680feb2cc8735a10211c5e7f8", "score": "0.5627988", "text": "func promptOverwrite(dst string) (bool, error) {\n\tfmt.Printf(\"cp: overwrite %q? \", dst)\n\tanswer, err := input.ReadString('\\n')\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif strings.ToLower(answer)[0] != 'y' {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "949cfe04c349b0ea8043fed60c5b9815", "score": "0.5617423", "text": "func PromptForHit(reader *bufio.Reader) string {\n\tfmt.Printf(\"\\n\\nPlease Choose [H]it/[S]tay: \")\n\tchoice, _ := reader.ReadString('\\n')\n\tchoice = strings.Trim(choice, \"\\n\")\n\n\tfor choice != \"H\" && choice != \"h\" && choice != \"Hit\" && choice != \"hit\" &&\n\t\tchoice != \"S\" && choice != \"s\" && choice != \"Stay\" && choice != \"stay\" {\n\t\tfmt.Printf(\"\\n\\nPlease Choose [H]it/[S]tay: \")\n\t\tchoice, _ = reader.ReadString('\\n')\n\t\tchoice = strings.Trim(choice, \"\\n\")\n\t}\n\n\treturn choice\n}", "title": "" }, { "docid": "b55bc9d5045dd2a9422e7772afa04b6b", "score": "0.5594536", "text": "func main() {\n\tvar s string\n\tfmt.Println(\"Please enter a choice: yes or no\")\n\tfmt.Scanf(\"%s\", &s)\n\tfmt.Println(\"you entered:\", s)\n\tfor s == \"yes\" {\n\t\tfmt.Println(\"continuing the transaction\")\n\t\tfmt.Println(\"Please type yes if you wish to continue\")\n\t\tfmt.Scanf(\"%s\", &s)\n\t\tfmt.Println(\"you entered:\", s)\n\t\tif s == \"yes\" {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tfmt.Println(\"we are exiting\")\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f8d6a726093b93ba717dd962d9d15b48", "score": "0.5497196", "text": "func Confirmer(defaultYes bool) Func {\n\treturn func(input string) error {\n\t\tif defaultYes {\n\t\t\tif input == \"\" || input == \"y\" || input == \"N\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn NewValidationError(\"You must specify either 'y' for yes or 'N' for no.\")\n\t\t}\n\n\t\tif input == \"\" || input == \"Y\" || input == \"n\" {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn NewValidationError(\"You must specify either 'Y' for yes or 'n' for no.\")\n\t}\n}", "title": "" }, { "docid": "733002ff1683ee525e63ed13eb3000a7", "score": "0.5463518", "text": "func AreYouSure(i interface{}) bool {\n\tanswer := false\n\tScanner := bufio.NewReader(os.Stdin)\n\tfmt.Printf(\"\\nThis is about to happen:\\n%v\\nARE YOU SURE!?!?! (Y/n)\", i)\n\tresult, err := Scanner.ReadString('\\n')\n\tif err != nil {\n\t\tfmt.Println(\"Something went horribly wrong, try again\")\n\t\tos.Exit(1)\n\t}\n\tresult2 := strings.ToLower(strings.TrimSpace(result))\n\tif result2 == \"y\" || result2 == \"yes\" {\n\t\tanswer = true\n\t}\n\treturn answer\n}", "title": "" }, { "docid": "eab92c02b313952d58f0948b9d84ef3d", "score": "0.54562944", "text": "func waitForConfirmation(skipConfirmation bool, l clog.Logger) {\n\tif skipConfirmation {\n\t\treturn\n\t}\n\tif !confirm(\"Confirm to proceed [y/N]?\", os.Stdout) {\n\t\tl.LogAndFatalf(\"Abort.\")\n\t}\n}", "title": "" }, { "docid": "304dc2185c130a626e12fba41cf01506", "score": "0.54390436", "text": "func confirmPrompt(action, namespace string, info client.Info) error {\n\talert := color.New(color.FgRed, color.Bold).SprintFunc()\n\n\treturn term.Confirm(\n\t\tfmt.Sprintf(`%s namespace '%s' of cluster '%s' at '%s' using context '%s'.`, action,\n\t\t\talert(namespace),\n\t\t\talert(info.Kubeconfig.Cluster.Name),\n\t\t\talert(info.Kubeconfig.Cluster.Cluster.Server),\n\t\t\talert(info.Kubeconfig.Context.Name),\n\t\t),\n\t\t\"yes\",\n\t)\n}", "title": "" }, { "docid": "304dc2185c130a626e12fba41cf01506", "score": "0.54390436", "text": "func confirmPrompt(action, namespace string, info client.Info) error {\n\talert := color.New(color.FgRed, color.Bold).SprintFunc()\n\n\treturn term.Confirm(\n\t\tfmt.Sprintf(`%s namespace '%s' of cluster '%s' at '%s' using context '%s'.`, action,\n\t\t\talert(namespace),\n\t\t\talert(info.Kubeconfig.Cluster.Name),\n\t\t\talert(info.Kubeconfig.Cluster.Cluster.Server),\n\t\t\talert(info.Kubeconfig.Context.Name),\n\t\t),\n\t\t\"yes\",\n\t)\n}", "title": "" }, { "docid": "c69664775a492ee9cf4a0532645d03b7", "score": "0.5424984", "text": "func (t DefaultTerminal) PromptBoolf(msg string, args ...interface{}) bool {\n\tfmt.Fprintln(t.OutOrStdout(), fmt.Sprintf(msg, args...))\n\tt.InOrStdin()\n\n\tprompt := promptui.Prompt{\n\t\tLabel: fmt.Sprintf(msg, args...),\n\t\tIsConfirm: true,\n\t}\n\n\tresult, err := prompt.Run()\n\n\tif err != nil && !errors.Is(err, promptui.ErrAbort) {\n\t\tt.Errorf(err, \"😳 Prompt failed\")\n\t\treturn false\n\t}\n\treturn strings.ToLower(result) == \"y\"\n}", "title": "" }, { "docid": "9b7464ec376ea11413c87d803fc67afa", "score": "0.54197836", "text": "func (frame *Frame) Prompt(options PromptOptions, callback func(res string) error) {\n\tframe.textEntry.Reset()\n\tframe.textEntry.Prompt = options.Prompt\n\tframe.textEntry.CancelOnEmptyBackspace = options.CancelOnEmptyBackspace\n\tframe.textEntry.SetValue(options.InitialValue)\n\n\tframe.textEntry.OnCancel = frame.exitEntryMode\n\tframe.textEntry.OnEntry = func(res string) {\n\t\tframe.exitEntryMode()\n\t\tif err := callback(res); err != nil {\n\t\t\tframe.Error(err)\n\t\t}\n\t}\n\n\tframe.setMode(EntryMode)\n}", "title": "" }, { "docid": "8bf5d790fa9fa61d712b42f1fd2ca1b6", "score": "0.5395211", "text": "func CreateYesNo(questionText string) *Question {\n\tquestion := &Question{question: \"(Y/N) \" + questionText, caseSensitive: false}\n\tquestion.CreateAnswer(-1, \"n\", \"no\")\n\tquestion.CreateAnswer(1, \"y\", \"yes\")\n\treturn question\n}", "title": "" }, { "docid": "f050d98a2d45023acd3fddafc1f6dff4", "score": "0.53822315", "text": "func (c *Client) Prompt(optionSize int) (answer []string, err error) {\n\ttypes, err := c.list()\n\tif err != nil {\n\t\treturn\n\t}\n\tvar defaults []string\n\tvar done bool\n\tfor {\n\t\tif answer, err = multiQs(types, defaults, optionSize); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif done, err = confirm(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif done {\n\t\t\tbreak\n\t\t}\n\t\tdefaults = answer\n\t}\n\treturn\n}", "title": "" }, { "docid": "b7646a28623c46a88130e03e89419666", "score": "0.5379192", "text": "func (recv *ScriptDialog) PromptSetText(text string) {\n\tc_text := C.CString(text)\n\tdefer C.free(unsafe.Pointer(c_text))\n\n\tC.webkit_script_dialog_prompt_set_text((*C.WebKitScriptDialog)(recv.native), c_text)\n\n\treturn\n}", "title": "" }, { "docid": "5b5692df5821d10ab3dc2f4e65f8e8b3", "score": "0.53781", "text": "func (dbc *DeleteBrokerCmd) AskForConfirmation() (bool, error) {\n\tif !dbc.force {\n\t\tmessage := fmt.Sprintf(\"Do you really want to delete broker with name [%s] (Y/n): \", dbc.name)\n\t\treturn cmd.CommonConfirmationPrompt(message, dbc.Context, dbc.input)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "a14e59be816a382e9e35942c48c22a88", "score": "0.5366902", "text": "func (pp PasswordPrompter) Prompt(prompt string) string {\n\tvar rval string\n\twithTerminalResetter(func() {\n\t\tfmt.Print(prompt)\n\t\tbytePwd, err := terminal.ReadPassword(int(os.Stdin.Fd()))\n\t\tif err != nil {\n\t\t\tlogger.Fatal(err)\n\t\t}\n\t\tclearLine()\n\t\trval = string(bytePwd)\n\t})\n\treturn rval\n}", "title": "" }, { "docid": "9308a45227c0149a2a1fb04ae7f42206", "score": "0.530623", "text": "func (ta *TerminalApp) WaitForPrompt() uiauto.Action {\n\twebArea := nodewith.NameRegex(regexp.MustCompile(`\\@penguin\\: `)).Role(role.RootWebArea)\n\tprompt := nodewith.Name(\"$ \").Role(role.StaticText).Ancestor(webArea)\n\treturn ta.ui.WithTimeout(3 * time.Minute).WaitUntilExists(prompt)\n}", "title": "" }, { "docid": "5854c1e03e494457a1f2defbfa32d03d", "score": "0.5301758", "text": "func IsResponseYes(response gtk.ResponseType) bool {\n\treturn response == gtk.RESPONSE_YES\n}", "title": "" }, { "docid": "b56d03b4863b63312a158f289f166e38", "score": "0.5284631", "text": "func Prompt(msg string) (string, error) {\n\tstdin, err := OpenConsole(os.O_RDONLY)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer stdin.Close()\n\n\tfmt.Print(msg)\n\tscanner := bufio.NewScanner(stdin)\n\tscanner.Scan()\n\tif err := scanner.Err(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tinput := scanner.Text()\n\tif input == \"\" {\n\t\treturn \"\", ErrCanceled\n\t}\n\treturn input, nil\n}", "title": "" }, { "docid": "a574ef4b75613f90eb6996a3805bb7b3", "score": "0.5281716", "text": "func prompt(question *pb.Question) *pb.Answer {\n\t// Prepare options, map to slice (random order)\n\titems := []questionOption{}\n\tfor _, option := range question.Options {\n\t\titems = append(items, questionOption{option.Id, option.Text})\n\t}\n\n\tprompt := promptui.Select{\n\t\tLabel: question.Text,\n\t\tItems: items,\n\t\tTemplates: &promptui.SelectTemplates{\n\t\t\tActive: `👉 {{ .Text | cyan }}`,\n\t\t\tInactive: ` {{ .Text | white }}`,\n\t\t\tSelected: `{{ .Text }}`,\n\t\t},\n\t\t//HideSelected: true,\n\t\t//HideHelp: true,\n\t}\n\n\titemId, _, err := prompt.Run()\n\n\tif err != nil {\n\t\tlog.Printf(\"Prompt failed %v\\n\", err)\n\t\treturn nil\n\t}\n\n\treturn &pb.Answer{\n\t\tQuestionId: question.Id,\n\t\tOptionId: int64(question.Options[items[itemId].Id].Id),\n\t}\n}", "title": "" }, { "docid": "9f810f08d15a8b6f191a8eddaa294a09", "score": "0.52566606", "text": "func (p *Prompt) Deny() {\n\tp.status = StatusDenied\n}", "title": "" }, { "docid": "7b201b09090e244d7142dd93cab7c65c", "score": "0.52398175", "text": "func PromptUser(question string, reader io.Reader) string {\n\tscanner := bufio.NewScanner(reader)\n\tfmt.Printf(\"%s\", question)\n\tscanner.Scan()\n\treturn scanner.Text()\n}", "title": "" }, { "docid": "c29a7951e32a2a73fdf477b825ce0c95", "score": "0.5238943", "text": "func PromptInput() string {\n\tinputs := map[string]bool{\n\t\t\"github\": true,\n\t\t\"artifactory\": true,\n\t\t\"concourse\": true,\n\t\t\"confluence\": true,\n\t\t\"jira\": true,\n\t}\n\n\tfmt.Print(\"Please specify which API you would like to log in to: \")\n\treader := bufio.NewReader(os.Stdin)\n\tinput, _ := reader.ReadString('\\n')\n\tinput = strings.TrimSuffix(input, \"\\n\")\n\n\t// Checks if input is in accepted inputs, otherwise, prompts User for input\n\t_, ok := inputs[input]\n\tif ok {\n\t\tfmt.Printf(\"'%v' selected.\\n\", input)\n\t\treturn input\n\t} else {\n\t\tfmt.Printf(\"'%v' is not a valid option. Choose among the following:\\n\\n\", input)\n\t\tfor k := range inputs {\n\t\t\tfmt.Print(\"'\"+k+\"'\", \"\\n\")\n\t\t}\n\t\tfmt.Println(\"\")\n\t\ti := PromptInput()\n\t\treturn i\n\t}\n}", "title": "" }, { "docid": "15af6b9efe3e5f8e92c782518cc51686", "score": "0.5234815", "text": "func (prompt *Prompt) Prompt(windowId string) *dbus.Error {\n\n\tlog.WithFields(log.Fields{\n\t\t\"interface\": \"org.freedesktop.Secret.Prompt\",\n\t\t\"method\": \"Prompt\",\n\t\t\"prompt path\": prompt.ObjectPath,\n\t\t\"windowId\": windowId,\n\t}).Trace(\"Method called by client\")\n\n\tif !CommandExists(\"wmctrl\") {\n\t\tlog.Error(\"Performing prompt needs 'wmctrl' command to be installed on system\")\n\t\treturn ApiErrorNotSupported()\n\t}\n\n\tcmd := exec.Command(\"wmctrl\", \"-ai\", windowId)\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn DbusErrorCallFailed(fmt.Sprintf(\"'wmctrl -ai %s' failed. Error: %v\", windowId, err.Error()))\n\t}\n\n\t// TODO: prompt object on dbus\n\n\treturn nil\n}", "title": "" }, { "docid": "a86fa85b6e68e0c3d9ccea7c3f5a1242", "score": "0.52326214", "text": "func PromptConsent() AuthOption {\n\treturn func(o *authOptions) error {\n\t\to.prompt = \"consent\"\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3b75c21480d0bdc647cf6f48e1154238", "score": "0.5201778", "text": "func HandleYNInput() bool {\n\treader := bufio.NewReader(os.Stdin)\n\tinputBytes, _, err := reader.ReadLine()\n\tif err != nil {\n\t\tfmt.Printf(\"\\nE> Error ERR_READ_USRIN: %s\\n\", err.Error())\n\t}\n\tinput := string(inputBytes)\n\tif strings.EqualFold(input, \"y\") || strings.EqualFold(input, \"yes\") {\n\t\treturn true\n\t}\n\tif strings.EqualFold(input, \"n\") || strings.EqualFold(input, \"no\") {\n\t\treturn false\n\t}\n\tchoice, err := strconv.ParseBool(input)\n\tif err != nil {\n\t\tfmt.Printf(\"\\nE> Error ERR_PARSE_BOOL: %s\\n\", err.Error())\n\t}\n\treturn choice\n}", "title": "" }, { "docid": "7237b9401b93da4fe8a7ec408824cf9c", "score": "0.5194148", "text": "func (ui *UI) DisplayOptionalTextPrompt(defaultValue string, template string, templateValues ...map[string]interface{}) (string, error) {\n\tinteractivePrompt := ui.Interactor.NewInteraction(ui.TranslateText(template, templateValues...))\n\tvar value = defaultValue\n\tinteractivePrompt.SetIn(ui.In)\n\tinteractivePrompt.SetOut(ui.OutForInteraction)\n\terr := interactivePrompt.Resolve(&value)\n\tif isInterrupt(err) {\n\t\tui.Exiter.Exit(sigIntExitCode)\n\t}\n\treturn value, err\n}", "title": "" }, { "docid": "ffdeff70217b2366d7b4ecafaf7100b7", "score": "0.51751393", "text": "func ForceApprovalPrompt(v bool) predicate.AuthRequest {\n\treturn predicate.AuthRequest(sql.FieldEQ(FieldForceApprovalPrompt, v))\n}", "title": "" }, { "docid": "e24be07165f0f168e14545b7815b8b00", "score": "0.5148563", "text": "func (p *Profile) SetPrompt() {\n\tif p.Cli != nil {\n\t\t//p.Cli.SetPrompt(`(?msi:[\\$%#>]$)`)\n\t\tp.Cli.SetPrompt(`([a-zA-Z0-9\\-]+?)#(\\s)?$`)\n\t\t//p.Cli.SetPrompt(`(?msi:^D(E|G|X)S.*#$)`)\n\t}\n}", "title": "" }, { "docid": "185639ac93f288e02e059ece8f252e74", "score": "0.51205385", "text": "func DBGenerateTablesPrompt() {\n\tyonp := func(predicate string) bool {\n\t\tfmt.Print(predicate + \" [y/N]: \")\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tinput, err := reader.ReadByte()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif input == 'y' {\n\t\t\tfmt.Println(\"OK!\")\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif DBHasUserTable() == false {\n\t\tif yonp(\"User table does not exist, create one?\") {\n\t\t\terr := DBCreateUserTable()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Unable to create user table:\", err)\n\t\t\t}\n\t\t}\n\t\tif yonp(\"Add four test users?\") {\n\t\t\terr := DBGenerateTrash(4)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Unable to create test users:\", err)\n\t\t\t}\n\t\t}\n\t}\n\tif DBHasVideoTable() == false {\n\t\tif yonp(\"Video table does not exist, create one?\") {\n\t\t\terr := DBCreateVideoTable()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Unable to create video table:\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8b933b34ba13a004e3da7efc64f09c52", "score": "0.510116", "text": "func (s *Stream) Prompt(username string) (cred Cred, cookies []*http.Cookie, err error) {\n\tif username != \"\" {\n\t\tcred.Type = \"Username\"\n\t\tcred.Ident = username\n\t}\n\treturn s.PromptCred(cred)\n}", "title": "" }, { "docid": "7e620a6664c316e0e16504db5ca5d1f7", "score": "0.50821215", "text": "func PromptNone() AuthOption {\n\treturn func(o *authOptions) error {\n\t\to.prompt = \"none\"\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "602f3c797c5197b688a6f5b5cc741a20", "score": "0.5069643", "text": "func WelcomePrompt(echoRequest *skillserver.EchoRequest) (response *skillserver.EchoResponse) {\n\n\tresponse = skillserver.NewEchoResponse()\n\tflag := false\n\tresponse.OutputSpeech(\"Welcome, would you like to start playing one of you followed streams?\").\n\t\tReprompt(\"Should I start playing a Twitch stream?\").\n\t\tEndSession(&flag)\n\n\treturn\n}", "title": "" }, { "docid": "7a6496c1c1ac66f224391a08e7a9cf3d", "score": "0.5068569", "text": "func PromptAnotherTeam() string {\n\tprompt := promptui.Select{\n\t\tLabel: \"Add another team?\",\n\t\tItems: []string{\"yes\", \"no\"},\n\t}\n\n\t_, result, err := prompt.Run()\n\tif err != nil {\n\t\tlog.Fatalf(\"Prompt failed %v\\n\", err)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "faaab82421d0cf4be868de83a9747f2b", "score": "0.50676876", "text": "func (r *Robot) PromptUserForReply(regexID string, user string, prompt string) (string, RetVal) {\n\tvar rep string\n\tvar ret RetVal\n\tfor i := 0; i < 3; i++ {\n\t\trep, ret = r.promptInternal(regexID, user, \"\", prompt)\n\t\tif ret == RetryPrompt {\n\t\t\tcontinue\n\t\t}\n\t\treturn rep, ret\n\t}\n\tif ret == RetryPrompt {\n\t\treturn rep, Interrupted\n\t}\n\treturn rep, ret\n}", "title": "" }, { "docid": "6ad0f4624b374abdc18cc5fc36852cc4", "score": "0.5044449", "text": "func ForceApprovalPromptEQ(v bool) predicate.AuthRequest {\n\treturn predicate.AuthRequest(sql.FieldEQ(FieldForceApprovalPrompt, v))\n}", "title": "" }, { "docid": "86074e4b6c70faf28927200160fb97f6", "score": "0.5019703", "text": "func Confirm(vals map[string]string) {\n\tvar buf bytes.Buffer\n\tw := tabwriter.NewWriter(&buf, 0, 4, 4, '-', 0)\n\n\tfmt.Fprintln(w)\n\n\tfor key, val := range vals {\n\t\tfmt.Fprintf(w, \"%s \\t %s\\n\", key, val)\n\t}\n\n\tw.Flush()\n\tcmdInfo := strings.Split(buf.String(), \"\\n\")\n\n\tfor _, line := range cmdInfo {\n\t\tfmt.Println(line)\n\t}\n\n\tprompt := promptui.Prompt{\n\t\tLabel: \"Continue\",\n\t\tIsConfirm: true,\n\t}\n\n\tif _, err := prompt.Run(); err != nil {\n\t\tLogger.Warn(\"Abandoning Command...\")\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "a80262b8986a370dfdab1627564b7dac", "score": "0.50164884", "text": "func Prompt(query ...interface{}) (string, error) {\n\tout.Println(query...)\n\tvar response string\n\tif _, err := fmt.Fscanln(os.Stdin, &response); err != nil {\n\t\tif strings.Contains(err.Error(), \"unexpected newline\") {\n\t\t\treturn \"\", nil\n\t\t}\n\t\treturn \"\", err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "2a225e4ad1643dab37134d4cc8a4dcab", "score": "0.50052035", "text": "func Ask(prompt string) string {\n\tfmt.Print(prompt)\n\treturn ReadLn()\n}", "title": "" }, { "docid": "47a35cc08a54b533075a31ec9acc7007", "score": "0.4991142", "text": "func waitForUserToProceed(promptMsg string) {\n\tfmt.Println()\n\tfmt.Printf(\"\\nStep %d: %s\", step, promptMsg)\n\tstep++\n\tif waitForUser {\n\t\tfmt.Println(\"\\nPress ENTER to proceed with this operation...\")\n\t\tvar c string\n\t\t_, _ = fmt.Scanln(&c)\n\t}\n\n}", "title": "" }, { "docid": "496e63a28bc4d09f086d7db2acbfe5bc", "score": "0.49770644", "text": "func PromptLogin() AuthOption {\n\treturn func(o *authOptions) error {\n\t\to.prompt = \"login\"\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "356aece8842d459110ce2166e08abf9d", "score": "0.49754894", "text": "func FmtPrompt(msg string) string {\n\treturn stringf(PromptFormat, msg)\n}", "title": "" } ]
3dfa451ba1d46397344f28926187e215
SaveInString saves the latest encoded string into a string file.
[ { "docid": "e8b6d09bd07118743d6a94913f2213cb", "score": "0.7320257", "text": "func (r *ScreenRecorder) SaveInString(ctx context.Context, filepath string) error {\n\tresult := strings.Split(r.result, \",\")[1]\n\tif err := ioutil.WriteFile(filepath, []byte(result), 0644); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to dump string to %s\", filepath)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "1e81ba45078b678fa22c41fe2454f049", "score": "0.6812812", "text": "func SaveString(key string, data string) error {\n\treturn Store.SaveBytes(key, []byte(data))\n}", "title": "" }, { "docid": "3b8025fbc774b70d0bbc10d50d534db1", "score": "0.6087669", "text": "func (f Fileable) WriteString(str string) error {\n\tfile, err := os.OpenFile(f.Path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata := []byte(str)\n\t_, err = file.Write(data)\n\n\tdefer file.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "37ec705e65e89df0a00e3e71912063c4", "score": "0.5933722", "text": "func (f *DailyRotateFile) WriteString(s string) (int, error) {\n\treturn f.Write([]byte(s))\n}", "title": "" }, { "docid": "a69f796e0fff7c1d81b586db9260cbc8", "score": "0.574384", "text": "func (file *File) WriteString(s string) (ret int, err Error) {\n\tif file == nil {\n\t\treturn 0, EINVAL\n\t}\n\tb := syscall.StringByteSlice(s);\n\tb = b[0 : len(b)-1];\n\treturn file.Write(b);\n}", "title": "" }, { "docid": "478a8ce79319e6f1ebf869dae0f79cb2", "score": "0.5656284", "text": "func (z *encWr) WriteStr(s string) {\n\tif z.bytes {\n\t\tz.wb.writestr(s)\n\t} else {\n\t\tz.wf.writestr(s)\n\t}\n}", "title": "" }, { "docid": "ef7a009e8ff33da356e49d11bba6c41d", "score": "0.562978", "text": "func StringToFile(path string, s string) error {\n\tfo, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t_ = fo.Close()\n\t}()\n\t_, err = io.Copy(fo, strings.NewReader(s))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "821e1ecc89570021748c9e66c5aca617", "score": "0.55850446", "text": "func (this *BinaryEncoder) WriteString(value string) {\n\tthis.WriteInt16(int16(len(value)))\n\tcopy(this.buffer[this.pos:], value)\n\tthis.pos += len(value)\n}", "title": "" }, { "docid": "f0dad580f1c3b4575bc7a0a977b7e5d4", "score": "0.5575848", "text": "func (f *File) WriteString(s string) (n int, err error) {\n\treturn f.File.WriteString(s)\n}", "title": "" }, { "docid": "91e34ce08801b366d235c10174ecc82a", "score": "0.5465849", "text": "func (f *File) WriteString(s string) (n int, err error) {\n\tif f.err != nil {\n\t\treturn 0, f.err\n\t}\n\tn, err = f.File.WriteString(s)\n\treturn n, f.error(err)\n}", "title": "" }, { "docid": "b1024b8b2f51a3d206033d69400da0d3", "score": "0.5417267", "text": "func (fw *fileWriter) String(str string) FileWriter {\n\tfile, err := os.OpenFile(fw.path, fw.flags, fw.mode)\n\tif err != nil {\n\t\tfw.err = err\n\t\treturn fw\n\t}\n\tdefer file.Close()\n\tif fw.finfo, fw.err = file.Stat(); fw.err != nil {\n\t\treturn fw\n\t}\n\n\tif _, err := file.WriteString(str); err != nil {\n\t\tfw.err = err\n\t}\n\treturn fw\n}", "title": "" }, { "docid": "51b7431bc8f8ec7717ca87b97e7440c4", "score": "0.5409663", "text": "func (enc *Encoder) encodeString(s string) {\n\tenc.encodeLen(len(s), String)\n\tenc.buf.WriteString(s)\n}", "title": "" }, { "docid": "de62a25b836af714d42c6a74bbf0636e", "score": "0.5405777", "text": "func (f *File) WriteString(s string) (int, error) {\n\treturn 0, ErrNotImplemented\n}", "title": "" }, { "docid": "83552f597bcdb4761f0959246cda490b", "score": "0.54050106", "text": "func (c *Converter) WriteString(s string) {\n\tc.Buf.WriteString(s)\n}", "title": "" }, { "docid": "487733fc2624de4259871a50453f887f", "score": "0.53702617", "text": "func (w *Writer) WriteString(in string) (int, error) {\n\told := &Writer{\n\t\ts: w.s,\n\t\tfg: w.s.fg,\n\t\tbg: w.s.bg,\n\t\tintensity: w.s.intensity,\n\t}\n\tn, err := w.Write([]byte(in))\n\tif err != nil {\n\t\treturn n, err\n\t}\n\tn2, err := old.Set()\n\treturn n + n2, err\n\n}", "title": "" }, { "docid": "4e4faf0c1bb5bda09ff0a84e2b104640", "score": "0.53497213", "text": "func StringToFile(content string, destination string) error {\n\tif _, err := os.Stat(destination); !os.IsNotExist(err) {\n\t\terr = os.Remove(destination)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr := ioutil.WriteFile(destination, []byte(content), os.FileMode(0644))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "932481a6002dfe0b2fba10da134b061a", "score": "0.5338365", "text": "func (this *SizingEncoder) WriteString(value string) {\n\tthis.WriteInt16(int16(len(value)))\n\tthis.size += len(value)\n}", "title": "" }, { "docid": "27b0ef6c399373fdb0bef3367982d90d", "score": "0.5334146", "text": "func EncodeString(given string) string {\n\treturn base64.StdEncoding.EncodeToString([]byte(given))\n}", "title": "" }, { "docid": "e4a49fc13e24b6684a128b8d9a08967c", "score": "0.5333799", "text": "func (m OsHelperImpl) WriteStringToFile(filename string, contents string) error {\n\terr := ioutil.WriteFile(filename, []byte(contents), 0644)\n\treturn err\n}", "title": "" }, { "docid": "92a55ba69602d79dad6f70c4deebecc7", "score": "0.5327969", "text": "func (e *Encoder) EncodeString(s string) {\n\te.encodeLen(len(s))\n\te.writeString(s)\n}", "title": "" }, { "docid": "7bae8c38326c65b61056ba939e43207a", "score": "0.53087676", "text": "func (f genHelperEncoder) WriteStr(s string) {\n\tf.e.w.writestr(s)\n}", "title": "" }, { "docid": "53efb6557d4d4cebb2098e791820f8bc", "score": "0.5284428", "text": "func WriteStringToFile(input string, filepath string) (err error) {\n\n\tf, err := os.Create(filepath)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer f.Close()\n\n\t_, err = f.Write([]byte(input))\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5a1ca038a70d81ffadd959e9cf66a6b5", "score": "0.52672684", "text": "func (c *RestoreContext) WriteString(s string) {\n\tfmt.Fprint(c.w, \"'\", s, \"'\")\n}", "title": "" }, { "docid": "2a3701f9c1e8b3b379b8e6e316f9973b", "score": "0.5239319", "text": "func SaveToFile(fname string, value string) {\n\t// truncate end of string\n\t/*\n\t if len(value) > 2 {\n\t value = value[0:len(value)-3]\n\t }*/\n\tfileFlags := os.O_CREATE | os.O_WRONLY\n\tfile, err := os.OpenFile(fname, fileFlags, 0777)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer file.Close()\n\n\tif _, err := file.WriteString(value); err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "1f0e842d75b7f6834d4ac32173aec4ba", "score": "0.52354676", "text": "func (wb *WriteBuf) WriteString(data string) *WriteBuf {\n\tif len(data) > wb.space() {\n\t\twb.flush(false)\n\t}\n\tif len(data) >= bufSize {\n\t\t// it would be safer/better to use []byte(s)\n\t\t// but strings are used for large data so we want to avoid copying\n\t\twb.conn.write(wb.id, hacks.Stobs(data), false, false)\n\t} else {\n\t\twb.buf = append(wb.buf, data...)\n\t}\n\treturn wb\n}", "title": "" }, { "docid": "60c7ab2d8e2be7db8fbd0d9bccb64731", "score": "0.5233204", "text": "func WriteStringObj(str string) int {\n\tstrB := encoder.Serialize(str)\n\treturn NewWriteObj(strB)\n}", "title": "" }, { "docid": "d23cc25c0ad9f74dc12ecd2c7092c73d", "score": "0.52312344", "text": "func EncodeString(str string) string {\n\treturn base64.StdEncoding.EncodeToString(bytesconv.Str2Bytes(str))\n}", "title": "" }, { "docid": "c3970fbdcd8b39a4df73cc8ec7e3aba1", "score": "0.52292675", "text": "func (e *Encoding) EncodeString(src string) (string, error) {\n\tif !e.enabled() {\n\t\treturn src, nil\n\t}\n\tbs, err := e.transform(e.enc.NewEncoder(), nil, Slice(src), false)\n\treturn string(bs), err\n}", "title": "" }, { "docid": "eac739fd1c30ea48cd4a9d9a9321c985", "score": "0.52218765", "text": "func (g *ginBrotliWriter) WriteString(s string) (int, error) {\n\treturn g.wrapper.Write([]byte(s))\n}", "title": "" }, { "docid": "a7c43999da55258068175d546222a641", "score": "0.5216897", "text": "func (s *Spec) Save() error {\n\treturn ioutil.WriteFile(s.specFile, []byte(s.String()), 0o600)\n}", "title": "" }, { "docid": "078c39a70436a7348c5a85947a40279a", "score": "0.5213663", "text": "func (self *BitStream) WriteString(s string) {\n\tself.data.WriteByte(TYPE_STRING)\n\tsize := new(bytes.Buffer)\n\tbinary.Write(size, binary.LittleEndian, int32(len(s)))\n\tself.data.Write(size.Bytes())\n\tself.data.WriteString(s)\n}", "title": "" }, { "docid": "a059379692e4ffece5b1f4922f68c661", "score": "0.51735723", "text": "func (s *Serial) WriteString(str string) (int, error) {\n\treturn s.f.Write([]byte(str))\n}", "title": "" }, { "docid": "11fd0cc5a119790f0f48e71338edf7cc", "score": "0.5165272", "text": "func (r *DailyRotator) WriteString(str string) (n int, err error) {\n\treturn r.Write([]byte(str))\n}", "title": "" }, { "docid": "c56ef83ba3c21bdd88eb6a4f95ef56c4", "score": "0.5111787", "text": "func (ow *ObjectsWriter) WriteString(v string) (int, error) {\n\treturn ow.WriteBytes(bytes.StringToByteArray(v))\n}", "title": "" }, { "docid": "fc34f27fc8f0c2d401edbceaa937f7f8", "score": "0.50890505", "text": "func (r *StringConcator) WriteString(s string) (n int, err error) {\n\tr.raw = append(r.raw, s...)\n\treturn len(s), nil\n}", "title": "" }, { "docid": "5c9f0a2d8ec19d6bd63d5225f538892a", "score": "0.50836766", "text": "func EncodeString(textString string, encoding *charmap.Charmap) (data []byte, err error) {\n\tencodedBytes, err := encoding.NewEncoder().Bytes([]byte(textString))\n\tif err != nil {\n\t\treturn []byte{}, WrapErrorf(err, \"cant encode string\")\n\t}\n\n\treturn encodedBytes, nil\n}", "title": "" }, { "docid": "12a5d25d59a31534bf027056761f26c9", "score": "0.5073035", "text": "func (p *Buffer) EncodeString(s string) error {\n\tp.EncodeVarint(uint64(len(s)))\n\tp.buf = append(p.buf, s...)\n\treturn nil\n}", "title": "" }, { "docid": "46cceddb7c278f5d6570cd25fc20e93d", "score": "0.50646096", "text": "func writeString(buf *bytes.Buffer, s string) {\n\tfor i := range s {\n\t\tbinary.Write(buf, binary.BigEndian, s[i])\n\t}\n}", "title": "" }, { "docid": "9f3561bcd851a5d7752b7aac4bd5acd0", "score": "0.50589", "text": "func WriteStringFile(fileName string, data []string) error {\n\n\tos.MkdirAll(filepath.Dir(fileName), os.ModePerm)\n\n\tfile, err := os.OpenFile(\n\t\tfileName,\n\t\tos.O_WRONLY|os.O_TRUNC|os.O_CREATE,\n\t\t0666,\n\t)\n\n\tif err != nil {\n\t\tgolog.Fatal(err)\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tfor _, d := range data {\n\t\t_, writeErr := file.WriteString(fmt.Sprintf(\"%s\\n\", d))\n\n\t\tif writeErr != nil {\n\t\t\tgolog.Fatal(writeErr)\n\t\t\treturn writeErr\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3dc315a6932bd839a0e536b587a491ae", "score": "0.50345665", "text": "func (m *FileImpl) WriteStringAt(src string, offset int64) int {\n\tm.boundaryChecks(offset, 1)\n\treturn copy(m.data[offset:], src)\n}", "title": "" }, { "docid": "21e7c74c46484727e7d55595ac2fb789", "score": "0.50246656", "text": "func (e *Encoder) AddString(s string) error {\n\te.addSeparator()\n\te.buf.AppendByte('\"')\n\tstart := 0\n\n\tfor i := 0; i < len(s); {\n\t\tif b := s[i]; b < utf8.RuneSelf {\n\t\t\tif safeSet[b] {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif start < i {\n\t\t\t\te.buf.AppendString(s[start:i])\n\t\t\t}\n\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\te.buf.AppendByte('\\\\')\n\t\t\t\te.buf.AppendByte(b)\n\n\t\t\tcase '\\n':\n\t\t\t\te.buf.AppendByte('\\\\')\n\t\t\t\te.buf.AppendByte('n')\n\n\t\t\tcase '\\r':\n\t\t\t\te.buf.AppendByte('\\\\')\n\t\t\t\te.buf.AppendByte('r')\n\n\t\t\tcase '\\t':\n\t\t\t\te.buf.AppendByte('\\\\')\n\t\t\t\te.buf.AppendByte('t')\n\n\t\t\tdefault:\n\n\t\t\t\t// This encodes bytes < 0x20 except for \\t, \\n and \\r.\n\t\t\t\t// If escapeHTML is set, it also escapes <, >, and &\n\t\t\t\t// because they can lead to security holes when\n\t\t\t\t// user-controlled strings are rendered into JSON\n\t\t\t\t// and served to some browsers.\n\t\t\t\te.buf.AppendString(`\\u00`)\n\t\t\t\te.buf.AppendByte(hex[b>>4])\n\t\t\t\te.buf.AppendByte(hex[b&0xF])\n\t\t\t}\n\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\n\t\tc, size := utf8.DecodeRuneInString(s[i:])\n\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\te.buf.AppendString(s[start:i])\n\t\t\t}\n\n\t\t\te.buf.AppendString(`\\ufffd`)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\n\t\ti += size\n\t}\n\n\tif start < len(s) {\n\t\te.buf.AppendString(s[start:])\n\t}\n\n\te.buf.AppendByte('\"')\n\treturn nil\n}", "title": "" }, { "docid": "f98f65834c389003ad0bfcea431cd21d", "score": "0.500792", "text": "func EncodeString(s, enc string) ([]byte, error) {\n\treturn EncodeReader(strings.NewReader(s), enc)\n}", "title": "" }, { "docid": "582da295afaa930561c7fcbfe95720ea", "score": "0.49797222", "text": "func (w *Writer) WriteString(s string) (int, error) {\n\treturn w.WriteStringWithTimeContext(context.Background(), time.Now(), s)\n}", "title": "" }, { "docid": "48a6e5bfc6245385e52b521ae68832ba", "score": "0.4964407", "text": "func (w *Writer) WriteString(s string) {\n\tt := len(s)\n\tw.WriteU16(uint16(t))\n\tfor i := 0; i < t; i++ {\n\t\tw.WriteU8(s[i])\n\t}\n}", "title": "" }, { "docid": "857053eb81da6d2b1c79258166b3f9b9", "score": "0.49576092", "text": "func writeStringToFile(filename string, value string) error {\n\t//\tfmt.Printf(\"writing %s to file %s\\n\", value, filename)\n\tf, e := os.OpenFile(filename, os.O_WRONLY|os.O_TRUNC, 0666)\n\tif e != nil {\n\t\treturn e\n\t}\n\tdefer f.Close()\n\n\tf.WriteString(value)\n\treturn nil\n}", "title": "" }, { "docid": "bfdaaf8a25448d7d092408d0c0f4a88e", "score": "0.4953811", "text": "func binaryEncodeString(buf *encbuf, s string) {\n\tbinaryEncodeUint(buf, uint64(len(s)))\n\tbuf.Write([]byte(s))\n}", "title": "" }, { "docid": "99eb0be662befa59e2aca21b8c7a2d61", "score": "0.494686", "text": "func StringEncode(w io.Writer, s string) (int64, error) {\n\treturn BytesEncode(w, []byte(s))\n}", "title": "" }, { "docid": "2db4105bdb187bcae984fd8faf36b518", "score": "0.49323928", "text": "func (s *SecretsFile) Save(passphrase string) error {\n\terr := s.processSecrets(passphrase, encryptValue)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdata, err := json.MarshalIndent(s, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\tioutil.WriteFile(s.filename, data, 0644)\n\terr = s.decrypt(passphrase)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efa5d83c73995c664d18104e6de20a45", "score": "0.49223128", "text": "func (j *Journal) Save(filename string) {\n\t_ = ioutil.WriteFile(filename, []byte(j.String()), 0644)\n}", "title": "" }, { "docid": "7818b457edee3bcc62c11c8b5bb2d0f6", "score": "0.4920878", "text": "func WriteStringToFile(file string, content string) error {\n return ioutil.WriteFile(file, []byte(content), 0444)\n}", "title": "" }, { "docid": "a15072196de63f90def2ff21b2a27603", "score": "0.4910827", "text": "func (b *writeBuffer) WriteString(id int, data string, final bool) {\n\tif len(data) > b.space() {\n\t\tb.flush(id, false)\n\t}\n\tif len(data) >= bufSize {\n\t\t// it would be safer/better to use []byte(s)\n\t\t// but strings are used for large data so we want to avoid copying\n\t\tb.conn.write(id, hacks.Stobs(data), false, final)\n\t} else {\n\t\tb.buf = append(b.buf, data...)\n\t\tif final {\n\t\t\tb.flush(id, true)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b033e9a9dba3a23a59b41184a52b5eca", "score": "0.49073318", "text": "func (d deck) saveToFile(fileName string) {\n ioutil.WriteFile(fileName, []byte(d.toString()), 0666)\n}", "title": "" }, { "docid": "5478fc12f1563a4736216c558f341a89", "score": "0.49017343", "text": "func (d *Driver) WriteString(s string) (n int, err error) {\n\tif len(s) == 0 {\n\t\treturn 0, nil\n\t}\n\td.txdata = s\n\td.txn = 1\n\td.txdone.Clear()\n\td.p.Store(int(s[0])) // there are at least 8 free bytes in Tx FIFO\n\tif !d.txdone.Sleep(d.timeoutTx) {\n\t\td.txdata = d.txdata[:0]\n\t\tfor atomic.LoadUint32(&d.isr) == isrTx {\n\t\t\truntime.Gosched()\n\t\t}\n\t\terr = ErrTimeout\n\t}\n\td.txdata = \"\"\n\treturn d.txn, err\n}", "title": "" }, { "docid": "ef478481577197fe1a015bf0520b4a8d", "score": "0.49002773", "text": "func (d deck) saveToFile (filename string) error {\n return ioutil.WriteFile(filename, [] byte(d.toString()), 0666)\n}", "title": "" }, { "docid": "e72c79eabb87eefe978a337e24d06e8c", "score": "0.48967698", "text": "func (b *writeBuffer) writeString(s string) error {\n\tif _, err := b.WriteString(s); err != nil {\n\t\treturn err\n\t}\n\treturn b.WriteByte(0)\n}", "title": "" }, { "docid": "60400e4f80c013dd7eca02c60170f577", "score": "0.48941132", "text": "func encodeString(input string, override bool) string {\n\tif !override {\n\t\tif IsBase64Encoded(input) {\n\t\t\treturn input\n\t\t}\n\t}\n\n\tif encodeCount(input) == 2 {\n\t\treturn input\n\t}\n\n\treturn base64.StdEncoding.EncodeToString([]byte(input))\n}", "title": "" }, { "docid": "4a0119a05cb694ba2861461ac538e8fa", "score": "0.48842424", "text": "func EncodeString(data interface{}) ([]byte, error) {\n\tif data == nil {\n\t\treturn []byte{}, nil\n\t}\n\n\tif s, ok := data.(string); ok {\n\t\treturn []byte(s), nil\n\t}\n\n\treturn []byte{}, errors.New(\"error while decoding string\")\n}", "title": "" }, { "docid": "460de8a2f993583eb66f385680655ec4", "score": "0.48740554", "text": "func (e *encoder) encodeString(s string) (err error) {\n\tif len(s) > maxlen {\n\t\treturn e.Encode(struct {\n\t\t\tTruncated string\n\t\t\tFullLength int\n\t\t}{\n\t\t\turl.QueryEscape(s[:maxlen]),\n\t\t\tlen(s),\n\t\t})\n\t}\n\n\treturn e.Encode(url.QueryEscape(s))\n}", "title": "" }, { "docid": "d60ccb9344973bc1222cae8b950aa799", "score": "0.48620853", "text": "func (fh *RWFileHandle) WriteString(s string) (n int, err error) {\n\treturn fh.Write([]byte(s))\n}", "title": "" }, { "docid": "99f39a36b02584baf528f81162599269", "score": "0.4857201", "text": "func InsertStringToFile(path, str string, index int) error {\n\tlines, err := File2lines(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfileContent := string('\\uFEFF') // Add BOM for Songbeamer\n\tfor i, line := range lines {\n\t\tif i == index {\n\t\t\tfileContent += str\n\t\t}\n\t\tfileContent += line\n\t\tfileContent += \"\\r\\n\"\n\t}\n\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = fmt.Fprint(f, fileContent)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = f.Close()\n\treturn err\n}", "title": "" }, { "docid": "fe858672c4c91bbed5285cf5e8534216", "score": "0.48539475", "text": "func writeTextString(b *buffer, s string) {\n\tfor i := 0; i < len(s); {\n\t\tif writeTextByte(b, s[i]) {\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tr, size := utf8.DecodeRuneInString(s[i:])\n\t\tif r == utf8.RuneError && size == 1 {\n\t\t\tb.buf = append(b.buf, `\\ufffd`...)\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tb.buf = append(b.buf, s[i:i+size]...)\n\t\ti += size\n\t}\n}", "title": "" }, { "docid": "b75afa0e664f0c1f84b159abd25a918d", "score": "0.48452562", "text": "func encodeString(s string, enc Encoding) ([]byte, error) {\n\tvar b []byte\n\n\tswitch enc {\n\tcase EncodingISO88591:\n\t\tb = make([]byte, 0, len(s))\n\t\tfor _, r := range s {\n\t\t\tif r > 0xff {\n\t\t\t\tr = '.'\n\t\t\t}\n\t\t\tb = append(b, byte(r))\n\t\t}\n\t\treturn b, nil\n\n\tcase EncodingUTF8:\n\t\treturn []byte(s), nil\n\n\tcase EncodingUTF16BOM:\n\t\tb = make([]byte, 0, len(s)*2)\n\t\tb = append(b, []byte{0xfe, 0xff}...)\n\t\tfallthrough\n\n\tcase EncodingUTF16:\n\t\tif b == nil {\n\t\t\tb = make([]byte, 0, len(s)*2)\n\t\t}\n\t\tu := utf16.Encode([]rune(s))\n\t\tfor i, j := 0, 0; i < len(u); i, j = i+1, j+2 {\n\t\t\tb = append(b, []byte{byte(u[i] >> 8), byte(u[i])}...)\n\t\t}\n\t\treturn b, nil\n\n\tdefault:\n\t\treturn nil, ErrInvalidText\n\t}\n}", "title": "" }, { "docid": "68d84f3e64b7666d32c4229596a5ecd2", "score": "0.48418924", "text": "func (z *Fp) SetString(s string) error {\n\tin64, err := setString(s, fpOrder[:])\n\tif err == nil {\n\t\ts := &fpRaw{}\n\t\tcopy(s[:], in64[:FpSize/8])\n\t\tz.toMont(s)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "d40c5c098c8c55a8acda97dbf1993d67", "score": "0.48405075", "text": "func writeFileStr(filepath string, data string) error {\n\treturn ioutil.WriteFile(filepath, []byte(data), os.ModePerm)\n}", "title": "" }, { "docid": "7a819b58deb8081f349d694c2ec82c75", "score": "0.48353738", "text": "func (h *Hash) WriteString(s string) (int, error) {}", "title": "" }, { "docid": "9070dbee19815fd837eabf6f28333dc3", "score": "0.48344997", "text": "func (f ReplacerFunc) WriteString(w io.Writer, s string) (n int, err error) {\n\treturn w.Write([]byte(f(s)))\n}", "title": "" }, { "docid": "7694ae703a1a799ce226817aeed186be", "score": "0.48206872", "text": "func (ctx *Context) WriteString(content string) {\n\tctx.ContentType(\"text/plain; charset=UTF-8\")\n\tctx.Write([]byte(content))\n}", "title": "" }, { "docid": "388019e2d995e76395a01f28bec866e6", "score": "0.48083627", "text": "func (mb SimpleMessageBuffer) WriteString(s string) define.MessageBuffer {\n\tsLen := int32(len(s))\n\tmb.WriteI32(sLen)\n\tmb.Buf.WriteString(s)\n\treturn mb\n}", "title": "" }, { "docid": "904f5c2efa08c6bb99cb5478e6594f09", "score": "0.4805631", "text": "func (w *EWriter) WriteString(s string) (int, error) {\n\tif w.err != nil {\n\t\treturn 0, w.err\n\t}\n\tn, err := w.writer.WriteString(s)\n\tw.err = err\n\treturn n, err\n}", "title": "" }, { "docid": "289051bfc79c44d0e801e1de19fabd0b", "score": "0.4795064", "text": "func WriteString(w Writer, s string) (int, error) {\n\treturn WriteBytes(w, BytesS(s))\n}", "title": "" }, { "docid": "c34f00b463e55b9c1960446bbb601d14", "score": "0.47917238", "text": "func (enc *Encoding) EncodeToString(src []byte) string", "title": "" }, { "docid": "194fc7365c8e7f8eaa6638434f9c60d6", "score": "0.4785263", "text": "func SetString(root, name, value string) error {\n\tk, err := reg.OpenKey(reg.LOCAL_MACHINE, root, reg.WRITE)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer k.Close()\n\treturn k.SetStringValue(name, value)\n}", "title": "" }, { "docid": "2022483b07aaeddcd88d4416a0beec2f", "score": "0.47848514", "text": "func (b *Buffer) WriteString(s string) (n int, err error) {\n\treturn b.Write([]byte(s))\n}", "title": "" }, { "docid": "8224b03a92bed13576673ea882496d86", "score": "0.47786313", "text": "func (coder *BinWriter) String(f *string) {\n\tif coder.err != nil {\n\t\treturn\n\t}\n\tc := []byte(*f)\n\tsize := uint64(len(c))\n\tcoder.VarInt(&size)\n\tcoder.Write(c)\n}", "title": "" }, { "docid": "e2beb8e87723e6d77a95b1aed32a9fbf", "score": "0.47746277", "text": "func WriteToFile(filename string, input string) error {\n\n err := ioutil.WriteFile(filename, []byte( input ), 0744)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "7b6a51b9fb50dc7329bce0febdf70ea4", "score": "0.47729", "text": "func (doc *Document) encodeString(str string) string {\n\treturn doc.Options.UnicodeTranslateFunc(str)\n}", "title": "" }, { "docid": "ecc1668b11c41da6100b93c2796b9faa", "score": "0.4762292", "text": "func (e *Encoding) DecodeString(src string) (string, error) {\n\tif !e.enabled() {\n\t\treturn src, nil\n\t}\n\tbs, err := e.transform(e.enc.NewDecoder(), nil, Slice(src), true)\n\treturn string(bs), err\n}", "title": "" }, { "docid": "d280972ae79d67f25cba44ca8e6340dd", "score": "0.47588584", "text": "func (s *signer) signString(str string) string {\n\th := hmac.New(sha256.New, s.saValue)\n\th.Write([]byte(str))\n\tencodedSig := base64.StdEncoding.EncodeToString(h.Sum(nil))\n\treturn url.QueryEscape(encodedSig)\n}", "title": "" }, { "docid": "a7c03602886a540227d55231bd5c83b4", "score": "0.47575068", "text": "func (conn *Conn) WriteString(b string) (int, error) {\n\treturn conn.Write(s2b(b))\n}", "title": "" }, { "docid": "8a77354af62093f9685f7751ab15b39d", "score": "0.47538266", "text": "func WriteString(w Writer, s string) (int, error) {\n\tvar n int\n\n\t// If s is larger than w's internal buffer, the write has to be\n\t// split into multiple chunks.\n\tfor len(s) > 0 {\n\t\tbuf, err := w.Reserve(len(s))\n\t\tif len(buf) == 0 {\n\t\t\tif err == nil {\n\t\t\t\terr = ErrShortReserve\n\t\t\t}\n\t\t\treturn n, err\n\t\t}\n\n\t\tnc := copy(buf, s)\n\n\t\tif err := w.Commit(nc); err != nil {\n\t\t\treturn n, err\n\t\t}\n\n\t\ts = s[nc:]\n\t\tn += nc\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "07301b849cfecda3bd245aeeb688b05d", "score": "0.47533447", "text": "func (o outputFile) appendString(s string) {\n\tif _, err := o.f.WriteString(s); err != nil {\n\t\tpanic(fmt.Errorf(\"error while writing string: %s: %v\", s, err))\n\t}\n}", "title": "" }, { "docid": "48d851b61a5736f1751a2366e3a0e166", "score": "0.47517824", "text": "func (b *ByteBuffer) WriteString(s string) (int, error) {\n\treturn bb(b).WriteString(s)\n}", "title": "" }, { "docid": "2346aa14140e75c80755eef2651b1c41", "score": "0.474712", "text": "func (e *Enigma) EncodeString(text string) string {\n\tvar result bytes.Buffer\n\tfor i := range text {\n\t\tresult.WriteByte(e.EncodeChar(text[i]))\n\t}\n\treturn result.String()\n}", "title": "" }, { "docid": "da831ef9adad62c13d780524e87741b4", "score": "0.47468784", "text": "func (d deck) saveToFile(filename string) error {\n\t// Writes the file to the current directory with the filename passed in\n\t// Converts the current deck type slice of strings to a string and then to a slice of bytes\n\t// Sets the file permissions\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "title": "" }, { "docid": "90660fd597229a45a66357e20f556f24", "score": "0.47424552", "text": "func (g *Generator) string(s string) error {\n\tif _, err := g.w.Write([]byte(s)); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55c5f794f086d5ef7836d68c6ba29813", "score": "0.4734484", "text": "func (b *Buffer) SaveAs(filename string) error {\n\tb.UpdateRules()\n\terr := ioutil.WriteFile(filename, []byte(b.text), 0644)\n\tif err == nil {\n\t\tb.savedText = b.text\n\t\tb.netInsertions = 0\n\t}\n\treturn err\n}", "title": "" }, { "docid": "9b869c803281cdefe71f8eb4b956cb66", "score": "0.47336724", "text": "func (g *Golden) string(s string) {\n\t// From encoding/json\n\tconst hex = \"0123456789abcdef\"\n\tg.writebyte('\"')\n\tstart := 0\n\tfor i := 0; i < len(s); {\n\t\tif b := s[i]; b < utf8.RuneSelf {\n\t\t\tif b >= ' ' && b != '\"' && b != '\\\\' {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif start < i {\n\t\t\t\tg.write(s[start:i])\n\t\t\t}\n\t\t\tg.writebyte('\\\\')\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\tg.writebyte(b)\n\t\t\tcase '\\n':\n\t\t\t\tg.writebyte('n')\n\t\t\tcase '\\r':\n\t\t\t\tg.writebyte('r')\n\t\t\tcase '\\t':\n\t\t\t\tg.writebyte('t')\n\t\t\tdefault:\n\t\t\t\tg.write(`u00`)\n\t\t\t\tg.writebyte(hex[b>>4])\n\t\t\t\tg.writebyte(hex[b&0xF])\n\t\t\t}\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tc, size := utf8.DecodeRuneInString(s[i:])\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\tg.write(s[start:i])\n\t\t\t}\n\t\t\tg.write(`\\ufffd`)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tif c == '\\u2028' || c == '\\u2029' {\n\t\t\tif start < i {\n\t\t\t\tg.write(s[start:i])\n\t\t\t}\n\t\t\tg.write(`\\u202`)\n\t\t\tg.writebyte(hex[c&0xF])\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\ti += size\n\t}\n\tif start < len(s) {\n\t\tg.write(s[start:])\n\t}\n\tg.writebyte('\"')\n}", "title": "" }, { "docid": "c4178a952cc385042a4dd6942a251e1a", "score": "0.4728423", "text": "func (p *InputFileLocal) String() string {\n\tbytes, err := p.MarshalText()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(bytes)\n}", "title": "" }, { "docid": "d334f39806326fbe900606c95fe3f850", "score": "0.4725263", "text": "func (r *ScreenRecorder) SaveInBytes(ctx context.Context, filepath string) error {\n\tparts := strings.Split(r.result, \",\")\n\tif len(parts) < 2 {\n\t\treturn errors.New(\"no content has been recorded. The recorder might have been stopped too soon\")\n\t}\n\n\t// Decode base64 string.\n\treader := base64.NewDecoder(base64.StdEncoding, strings.NewReader(parts[1]))\n\tbuf := bytes.Buffer{}\n\tif _, err := buf.ReadFrom(reader); err != nil {\n\t\treturn errors.Wrap(err, \"failed to read from decoder\")\n\t}\n\tif err := ioutil.WriteFile(filepath, buf.Bytes(), 0644); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to dump bytes to %s\", filepath)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4757a537d3f7e909b01e73b4c00cf810", "score": "0.47245893", "text": "func Save(path string, v interface{}) error {\n lock.Lock()\n defer lock.Unlock()\n f, err := os.Create(path)\n if err != nil {\n return err\n }\n defer f.Close()\n r, err := Encode(v)\n if err != nil {\n return err\n }\n _, err = io.Copy(f, r)\n return err\n}", "title": "" }, { "docid": "2f67c8feb3cc52718f16fe1f512f7521", "score": "0.47234875", "text": "func (w *BinaryWriter) WriteVarString(s string) {\n\tw.WriteVarBytes([]byte(s))\n}", "title": "" }, { "docid": "fca0bad79f1a33fec4a45d1f7bc368d0", "score": "0.47220322", "text": "func (b *Buffer) writeString(value string) {\n\tif len(value)+b.dataLength > len(b.buffer) {\n\t\tb.buffer = append(b.buffer[:b.dataLength], []byte(value)...)\n\t\tb.dataLength = len(b.buffer)\n\t\treturn\n\t}\n\n\tb.dataLength += copy(b.buffer[b.dataLength:], value)\n}", "title": "" }, { "docid": "89bba2afcf019eb294b84066c056c468", "score": "0.47205088", "text": "func (d Deck) byteSaveToFile(filename string) error {\n\tfmt.Println(\"--[i] byteSaveToFile --\")\n\tfmt.Println(\"[i] Marshal data: \")\n\tbyteOutput, _ := json.Marshal(d)\n\tfmt.Println(\"[i] Writing file: \", filename)\n\treturn ioutil.WriteFile(filename, byteOutput, 0755)\n}", "title": "" }, { "docid": "c4d66fa8bb4376157996ce31de8edf14", "score": "0.47150633", "text": "func saveToFile(jsn []byte){\n\tjsonFile, err := os.Create(fileName)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer jsonFile.Close()\n\n\tjsonFile.Write(jsn)\n\tjsonFile.Close()\n\tfmt.Println(\"JSON data written to \", jsonFile.Name())\n}", "title": "" }, { "docid": "094090fa18d931c3f97abdcada62d347", "score": "0.47118652", "text": "func (exp *Exporter) WriteEscString(str string) {\n\tvar esc []byte\n\n\tif exp.err != nil {\n\t\treturn\n\t}\n\tesc, exp.err = json.Marshal(str)\n\tif exp.err != nil {\n\t\treturn\n\t}\n\t_, exp.err = exp.wr.Write(esc)\n}", "title": "" }, { "docid": "d9f12d7f93445d87ec4241337ca1fd68", "score": "0.47057307", "text": "func (p *InputFile) String() string {\n\tbytes, err := p.MarshalText()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(bytes)\n}", "title": "" }, { "docid": "8da58a97cf4921f73e1cf0175d641f86", "score": "0.47047704", "text": "func EncodeString(x string) []byte {\n\treturn []byte(x)\n}", "title": "" }, { "docid": "b7d12d01961e003d8dfe77c2b8143779", "score": "0.4701415", "text": "func VerifyString(publickey, data, signature string) (err error) {\n\tpublickeyfile, err := ioutil.TempFile(\"\", \"verify\")\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer os.Remove(publickeyfile.Name())\n\tpublickeyfile.WriteString(publickey)\n\terr = publickeyfile.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdatafile, err := ioutil.TempFile(\"\", \"verify\")\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer os.Remove(datafile.Name())\n\tdatafile.WriteString(data)\n\terr = datafile.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tsignaturefile, err := ioutil.TempFile(\"\", \"verify\")\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer os.Remove(signaturefile.Name())\n\tb, err := base64.StdEncoding.DecodeString(signature)\n\tif err != nil {\n\t\treturn\n\t}\n\tsignaturefile.Write(b)\n\terr = signaturefile.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = VerifyFile(publickeyfile.Name(), datafile.Name(), signaturefile.Name())\n\treturn\n}", "title": "" }, { "docid": "bb24bff8dfc2f22a60910106928450d9", "score": "0.46985772", "text": "func WriteStringToFile(file, content string) (writeLen int, err error) {\n\tvar f *os.File\n\tif err = MakeDir(file); err != nil {\n\t\treturn\n\t}\n\tDeleteFile(file)\n\tif CheckFileIsExist(file) {\n\t\tf, err = os.OpenFile(file, os.O_APPEND, 0666)\n\t} else {\n\t\tf, err = os.Create(file)\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\tw := bufio.NewWriter(f)\n\twriteLen, err = w.WriteString(content)\n\tw.Flush()\n\treturn\n}", "title": "" }, { "docid": "85742cbe08df9bfd7a7cb430ee39af46", "score": "0.4695835", "text": "func (p *Buffer) EncodeStringBytes(s string) error {\n\tp.EncodeVarint(uint64(len(s)))\n\tp.WriteString(s)\n\treturn nil\n}", "title": "" }, { "docid": "29face48ed56a206da8eb9c131c047fe", "score": "0.46950445", "text": "func (w *Writer) WriteString(s string) (n int, err error) {\n\treturn w.buf.WriteString(s)\n}", "title": "" } ]
ac924f821bbe7c4f64da7191dc5071e4
StopResponder handles the response to the Stop request. The method always closes the http.Response Body.
[ { "docid": "f97c0cef3a3d792025b5ebf6156a9d67", "score": "0.7450022", "text": "func (client IntegrationRuntimesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" } ]
[ { "docid": "78bda7cd76bc1352afad1a19066183a4", "score": "0.7233439", "text": "func (client RerunTriggersClient) StopResponder(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": "bcd7bd69a589c858897cfca1a18b9994", "score": "0.67680055", "text": "func (c *ConnectorHTTPServer) Stop() {\n\n}", "title": "" }, { "docid": "440074c8af44179efe04a17bd6ffcc4b", "score": "0.6540996", "text": "func (c *Controller) Stop() error {\n\tif c.ssdp != nil {\n\t\terr := c.ssdp.byebye()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not send SSDP byebye message: %v\", err)\n\t\t}\n\t\tc.ssdp = nil\n\t}\n\n\tif c.srv != nil {\n\t\terr := c.srv.Close()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not stop http server: %v\", err)\n\t\t}\n\t\tc.srv = nil\n\t}\n\n\tif c.listener != nil {\n\t\terr := c.listener.Close()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not stop listener: %v\", err)\n\t\t}\n\t\tc.listener = nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5ff0c3b24a7b47593cc76be2bf295d95", "score": "0.64516276", "text": "func (h *htlcOutgoingContestResolver) Stop() {\n\tclose(h.Quit)\n}", "title": "" }, { "docid": "a6f872e7f1beeceb1c34412a10813d72", "score": "0.64245987", "text": "func (wr *bodyWatcher) Stop() {\n\tselect {\n\tcase <-wr.stop:\n\t\treturn\n\tdefault:\n\t\tclose(wr.stop)\n\t\tclose(wr.results)\n\t}\n}", "title": "" }, { "docid": "2797e284e17aa412369c078343edeb9e", "score": "0.6288917", "text": "func (h *htlcIncomingContestResolver) Stop() {\n\tclose(h.Quit)\n}", "title": "" }, { "docid": "f8d0fda7af67a378562ede61fff3e49f", "score": "0.6277512", "text": "func (h *HTTPServer) Stop() error {\n\tif h.isRun {\n\t\th.isRun = false\n\t\tif h.CloseFunc != nil {\n\t\t\th.CloseFunc()\n\t\t}\n\t\treturn h.svr.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c30f0fb8cffefe651adcf34d05d63051", "score": "0.6212623", "text": "func (c *Controller) StopHandler(w http.ResponseWriter, r *http.Request) {\n\thandleManagerError(w, c.manager.Stop())\n}", "title": "" }, { "docid": "8bfd83fcebef9d8909911a740af48134", "score": "0.61543727", "text": "func (s *mockExchangeServer) stop() {\n\ts.httpServer.Close()\n}", "title": "" }, { "docid": "6e5a4e9645753653a25d4383cc329b4b", "score": "0.61157876", "text": "func (o *countLeHandler) Stop() {\n\tlog.Println(\"Stopping countLeHandler agent\")\n\tclose(o.agent.Responses)\n}", "title": "" }, { "docid": "87b65d202dae43d220d7a6a1c0cecafe", "score": "0.608438", "text": "func (s *MockToastServer) Stop() {\n\t_ = s.e.Close()\n}", "title": "" }, { "docid": "ef581a27e1e95e31ebf7b8b992f4e490", "score": "0.6039574", "text": "func stopHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"\\nThe server will stop in 2 seconds\")\n\t// Using a goroutine, to allow response time to be sent ...\n\tgo stopLater(2 * time.Second)\n}", "title": "" }, { "docid": "7b96d48a1112fd59386208734937eeee", "score": "0.6019593", "text": "func (c *client) Stop() {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif !c.started {\n\t\treturn\n\t}\n\tc.started = false\n\tc.heartbeatT.Stop()\n\t// close request types have no body\n\tr := c.newRequest(RequestTypeAppClosing)\n\tc.scheduleSubmit(r)\n\tc.flush()\n}", "title": "" }, { "docid": "97a0486d90ce47225bc22238f7aeea1f", "score": "0.5999067", "text": "func StopHandler(w http.ResponseWriter, r *http.Request) {\n\tdevice := context.Get(r, DeviceCtx).(*Device)\n\tif err := device.Stop(); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "d3a7b50309bdbf3c9a6a84d4e5e492c1", "score": "0.593525", "text": "func (client AzureBareMetalInstancesClient) ShutdownResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "bd3ab2e6858232dc1a5a049da75da8e8", "score": "0.58674854", "text": "func (req Spec) Stop() error {\n\tif s, ok := req.consumer.(Stopper); ok {\n\t\treturn s.Stop()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b386f80d06bc654ad53d36df4838ccf7", "score": "0.5863452", "text": "func (c *Client) Stop() {\n\tc.connection.post(\"stop\", nil)\n}", "title": "" }, { "docid": "f476fabc1361c469c6a70bc5bc062878", "score": "0.58507794", "text": "func (s *LineProtocolServer) Stop() {\n\ts.logger.Log(\"msg\", \"stopping\")\n\tclose(s.doneChan)\n\ts.listener.Close()\n\ts.wg.Wait()\n\ts.logger.Log(\"msg\", \"stopped\")\n}", "title": "" }, { "docid": "78cff7da9a3af027ed4bb6826d60a569", "score": "0.5820001", "text": "func (h *serverHandler) stop() {\n\tclose(h.closeCh)\n\th.wg.Wait()\n}", "title": "" }, { "docid": "36b38958aa26e5b00d21d5d00b80205a", "score": "0.57970226", "text": "func (h *httpServer) Stop(ctx context.Context) error {\n\th.server.Shutdown(ctx)\n\treturn nil\n}", "title": "" }, { "docid": "ac57ea949b365dda1ed95110d135e9be", "score": "0.57880956", "text": "func (s *HTTPServer) Stop(err error) {\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\tlog.Print(\"Stopping HTTP Server\")\n\n\terr = s.server.Shutdown(ctx)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "e19e8707586999ace69fb6ce5cb8ec79", "score": "0.5785344", "text": "func (client BaseClient) DeactivateEndpointResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n }", "title": "" }, { "docid": "4084c946819fb032dec6fb53276e6d88", "score": "0.576873", "text": "func (h *htlcSuccessResolver) Stop() {\n\tclose(h.Quit)\n}", "title": "" }, { "docid": "bfe09dc2a5eca72b9aa0cc284afc89c0", "score": "0.5761276", "text": "func (rh *ResultHandler) Stop() {\n\tlog.Println(\"Stopping ResultHandler\")\n\tclose(rh.stop)\n}", "title": "" }, { "docid": "84b6e825d9c577b3e47e1de01e6d4130", "score": "0.57588625", "text": "func (r *Reaper) Stop() { close(r.stop) }", "title": "" }, { "docid": "2b16b1876ae6de48694cf56f56026aeb", "score": "0.5747985", "text": "func (m *Module) Stop() error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tvar err error\n\tif m.listener != nil {\n\t\t// TODO: Change to use https://tip.golang.org/pkg/net/http/#Server.Shutdown\n\t\t// once we upgrade to Go 1.8\n\t\t// GFM-258\n\t\terr = m.listener.Close()\n\t\tm.listener = nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "067c85b8bf0d5eda4004d4ac43360dff", "score": "0.5744759", "text": "func (c *RecordingHTTPClient) stop() error {\n\turl := fmt.Sprintf(\"%s/%s/stop\", c.options.proxyURL, c.mode)\n\treq, err := http.NewRequest(\"POST\", url, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"there was an error creating a STOP request: %s\", err.Error())\n\t}\n\n\tif c.recID == \"\" {\n\t\treturn errors.New(\"recording ID was never set. Did you call Start?\")\n\t}\n\n\treq.Header.Set(\"x-recording-id\", c.recID) //recTest)\n\tresp, err := defaultHTTPClient.Do(req)\n\tif resp.StatusCode != 200 {\n\t\tb, err := io.ReadAll(resp.Body)\n\t\tdefer resp.Body.Close()\n\t\tif err == nil {\n\t\t\treturn fmt.Errorf(\"proxy did not stop the recording properly: %s\", string(b))\n\t\t}\n\t\treturn fmt.Errorf(\"proxy did not stop the recording properly: %s\", err.Error())\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"there was an error communicating with the test proxy: %s\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c80f1b44a584889fb152e8717d68651", "score": "0.5742277", "text": "func (srv *Server) daemonStopHandler(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {\n\t// can't write after we stop the server, so lie a bit.\n\tapi.WriteSuccess(w)\n\n\t// need to flush the response before shutting down the server\n\tf, ok := w.(http.Flusher)\n\tif !ok {\n\t\tpanic(\"Server does not support flushing\")\n\t}\n\tf.Flush()\n\n\tif err := srv.Close(); err != nil {\n\t\tbuild.Critical(err)\n\t}\n}", "title": "" }, { "docid": "ce07a8c9330473fabb2be46307d5d8ef", "score": "0.5739189", "text": "func (s *Service) Stop() {\n\ts.client.Close()\n\ts.listener.Close()\n}", "title": "" }, { "docid": "60711d26a2e026f9c259b72cc715efee", "score": "0.57266396", "text": "func (client BaseClient) DeactivateDriverMethodResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n }", "title": "" }, { "docid": "cbf16c2ac1c608ebce3c0cba4937ecbc", "score": "0.5726218", "text": "func (a API) Stop(ctx context.Context) error {\n\treturn a.srv.Shutdown(ctx)\n}", "title": "" }, { "docid": "8d4af752e8a4d176e61b72b6e58841a6", "score": "0.57197475", "text": "func Stop() {\n\tsetup().cancel()\n\tsetup().client.Close()\n}", "title": "" }, { "docid": "5d35b2d55c30083a72d0708e3699c079", "score": "0.5713756", "text": "func Stop() {\n\tserver.Close()\n}", "title": "" }, { "docid": "67f5997ac7433522fe8c7d21eddeae1f", "score": "0.5711733", "text": "func (srv *Server) daemonStopHandler(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {\n\t// can't write after we stop the server, so lie a bit.\n\twriteSuccess(w)\n\n\tsrv.Close()\n}", "title": "" }, { "docid": "63fd814b96cd2c3e0a25ec5bad1386c6", "score": "0.57112336", "text": "func (p *Handler) Stop() error {\n\treturn p.quicSrv.Close()\n}", "title": "" }, { "docid": "603ce3a65d250d8ac144baa8610d66c5", "score": "0.5704778", "text": "func (d *Daemon) Stop() error {\n\tforceStop := false\n\n\td.tomb.Kill(errStop)\n\tshared.Log.Info(\"Stopping REST API handler:\")\n\tfor _, socket := range d.Sockets {\n\t\tif socket.CloseOnExit {\n\t\t\tshared.Log.Info(\" - closing socket\", log.Ctx{\"socket\": socket.Socket.Addr()})\n\t\t\tsocket.Socket.Close()\n\t\t} else {\n\t\t\tshared.Log.Info(\" - skipping socket-activated socket\", log.Ctx{\"socket\": socket.Socket.Addr()})\n\t\t\tforceStop = true\n\t\t}\n\t}\n\n\tif n, err := d.numRunningContainers(); err != nil || n == 0 {\n\t\tshared.Log.Debug(\"Unmounting shmounts\")\n\n\t\tsyscall.Unmount(shared.VarPath(\"shmounts\"), syscall.MNT_DETACH)\n\t} else {\n\t\tshared.Debugf(\"Not unmounting shmounts (containers are still running)\")\n\t}\n\n\tshared.Log.Debug(\"Closing the database\")\n\td.db.Close()\n\n\tshared.Log.Debug(\"Stopping /dev/lxd handler\")\n\td.devlxd.Close()\n\n\tif d.IsMock || forceStop {\n\t\treturn nil\n\t}\n\n\terr := d.tomb.Wait()\n\tif err == errStop {\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "8de05a321b9dcdf6a194a1a755c6f89d", "score": "0.5698811", "text": "func (a *AdhocRequestExecutor) Stop() {\n\ta.cancel()\n}", "title": "" }, { "docid": "5695373d579cdbc7870ab16515f3ab37", "score": "0.56729686", "text": "func (s *Server) Stop() {\n\tlog.Info(\"stopping %s...\", httpServer)\n\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif s.server == nil {\n\t\treturn\n\t}\n\n\ts.server.Close()\n\ts.server = nil\n}", "title": "" }, { "docid": "17b3c5922a6bc2bd4ad300a8e0c7d30a", "score": "0.5663648", "text": "func (srv *Server) Stop() {\n\t_ = srv.server.Close()\n}", "title": "" }, { "docid": "45997602157cb4b60595753dde7b3639", "score": "0.5661238", "text": "func (l *UDPListener) Stop() {\n\tl.packetAssembler.Close()\n\tl.packetsBuffer.Close()\n\tl.conn.Close()\n}", "title": "" }, { "docid": "c333def388f7181b95ed9f085b956aa0", "score": "0.5651875", "text": "func (client RerunTriggersClient) CancelResponder(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": "49a2da3b8b67c7e3e8bac259ee2550b9", "score": "0.56517357", "text": "func (h *HTTP) Stop() error {\n\th.log.Info().Msgf(\"Shutting down the server...%s\", h.Name())\n\n\tctx, _ := context.WithTimeout(context.Background(), 25*time.Second)\n\n\terr := h.s.Shutdown(ctx)\n\tclose(h.closing)\n\th.log.Info().Msg(\"Server gracefully stopped\")\n\treturn err\n}", "title": "" }, { "docid": "7bf37664126c9e6c37b3ff8a845c19b0", "score": "0.56434274", "text": "func (s *Service) Stop() {\n\tselect {\n\tcase s.stopServeCh <- false:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "88d8dc53cda030916199386019a7439a", "score": "0.56387293", "text": "func (s *Server) StopSession(resp http.ResponseWriter, req *http.Request) {\n\n}", "title": "" }, { "docid": "b0f4fe0e797cad1207803a3a08d302a3", "score": "0.5626458", "text": "func (srv *Server) daemonStopHandler(w http.ResponseWriter, req *http.Request) {\n\t// can't write after we stop the server, so lie a bit.\n\twriteSuccess(w)\n\n\t// send stop signal\n\tsrv.apiServer.Stop(time.Second)\n}", "title": "" }, { "docid": "ae912145b5da05a8674cffaa1e90adfd", "score": "0.5624782", "text": "func (svc *DataService) Stop() {\n\tsvc.transport.Close()\n}", "title": "" }, { "docid": "234e49708e7843188335adac7eae4c0f", "score": "0.5618878", "text": "func (ba *BatchAcceptor) Stop() {\n\tba.stop <- true\n}", "title": "" }, { "docid": "ac32d9f540ca18b3d158d08017050f1e", "score": "0.5602792", "text": "func (c *Client) Stop() {\n\tc.Lock()\n\tlistener := c.callbackRunning\n\tc.Unlock()\n\tif !listener {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tgo c.listen()\n\t}()\n\truntime.Goexit()\n}", "title": "" }, { "docid": "3dab8d084a0d3bcc0e3ded609b8847f3", "score": "0.560225", "text": "func stop() {\n\tif manners.Close() {\n\t\tlogrus.Info(\"http server stopped\")\n\t}\n}", "title": "" }, { "docid": "6d99a6a4b43898fa672f80acf46b644a", "score": "0.55986565", "text": "func (rm *ResponseManager) Shutdown() {\n\trm.cancelFn()\n}", "title": "" }, { "docid": "a7c2e2206e8c634548a3d3d305ba47f0", "score": "0.55969423", "text": "func (u *udpLivenessClient) Stop() {\n\tu.stopCh <- struct{}{}\n}", "title": "" }, { "docid": "6737f2426f61a497fbc19b6533c45b9c", "score": "0.55754554", "text": "func (s *HTTPServer) Stop() error {\n\tctx, cancel := context.WithTimeout(context.Background(), contextTimeoutDuration)\n\tdefer cancel()\n\tif err := s.server.Shutdown(ctx); err != nil {\n\t\tlog.Error().Err(err).Msg(\"Unable to shutdown API server gracefully\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "988e57c5b8dc1f9d9363fd4536e650e3", "score": "0.55706006", "text": "func (s *Server) Stop() { s.s.Stop() }", "title": "" }, { "docid": "b1034ce3db472c0b7196d0ad6f9a72de", "score": "0.55658454", "text": "func (c *CWSConsumer) Stop() {}", "title": "" }, { "docid": "a43e5cbb81a00643b59c33c1e4bcb57e", "score": "0.5555103", "text": "func (h *htlcTimeoutResolver) Stop() {\n\tclose(h.Quit)\n}", "title": "" }, { "docid": "776b3818106da4cd7b6dae5ca0bb3499", "score": "0.5551623", "text": "func (t *ResponseWriter) Close() error { return nil }", "title": "" }, { "docid": "6e776b7f3f1be7c2c8ddff1b8fe37ec7", "score": "0.5547619", "text": "func (h *scriptOutputHandler) stop() error {\n\treturn nil\n}", "title": "" }, { "docid": "d66ed536a374e1f20e71dfc21e823f40", "score": "0.55398643", "text": "func (service *Service) Stop() {\n\tservice.GrpcServer.GracefulStop()\n\tservice.HttpServer.Close()\n}", "title": "" }, { "docid": "e3ec90da3ec4651061fde06270c7d595", "score": "0.55362594", "text": "func (e *Expector) Close() {\n\tif !e.closed {\n\t\tfor _, resp := range e.responses {\n\t\t\tif resp != nil {\n\t\t\t\tio.Copy(ioutil.Discard, resp.Body)\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t}\n\t\tclose(e.cancel)\n\t\te.closed = true\n\t}\n}", "title": "" }, { "docid": "ff8fea07e22f5f934b7877a7824fc531", "score": "0.5527473", "text": "func (client containerClient) breakLeaseResponder(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 &ContainerBreakLeaseResponse{rawResponse: resp.Response()}, err\n}", "title": "" }, { "docid": "be6aa65628a1f2940f7c6f524c66eb60", "score": "0.5526457", "text": "func (this *Response) Close() {\n\tif this.Response.Body != nil {\n\t\tthis.Response.Body.Close()\n\t}\n}", "title": "" }, { "docid": "eb908cbf0ca7e6e409531e7994a24ebc", "score": "0.55212927", "text": "func (k *K8sAPIServer) Stop() {\n\tif k.cancel != nil {\n\t\tk.cancel()\n\t}\n}", "title": "" }, { "docid": "7d74f3cb0021a96b00c813d1cc799254", "score": "0.552108", "text": "func (tsc *TestServerControl) Stop() {\n\tlog.Printf(\"stopping servers\")\n\tclose(tsc.closer)\n\ttsc.Await()\n}", "title": "" }, { "docid": "7496c969e4f66ccebd4cc36b2def5396", "score": "0.55189025", "text": "func (h *httprunner) stop(rmFromSmap bool) {\n\tif rmFromSmap {\n\t\th.unregisterSelf(true)\n\t}\n\tglog.Warningln(\"Shutting down HTTP\")\n\twg := &sync.WaitGroup{}\n\twg.Add(1)\n\tgo func() {\n\t\ttime.Sleep(time.Second / 2)\n\t\th.stopHTTPServer()\n\t\twg.Done()\n\t}()\n\tentry := xreg.GetRunning(xreg.XactFilter{})\n\tif entry != nil {\n\t\ttime.Sleep(time.Second)\n\t\tentry = xreg.GetRunning(xreg.XactFilter{})\n\t\tif entry != nil {\n\t\t\tglog.Warningf(\"Timed out waiting for %q to finish aborting\", entry.Kind())\n\t\t}\n\t}\n\tif h.si.IsTarget() {\n\t\twg.Wait()\n\t}\n}", "title": "" }, { "docid": "0836e327915e10832668af433d37e314", "score": "0.5509298", "text": "func (kv *KVPaxos) kill() {\n DPrintf(\"Kill(%d): die\\n\", kv.me)\n kv.dead = true\n kv.l.Close()\n kv.px.Kill()\n if StartHTTP{\n println(\"Stopping HTTP...\")\n kv.HTTPListener.Stop()\n println(\"HTTP stopped.\")\n }\n kv.Death<-1\n}", "title": "" }, { "docid": "2980ef63719df7e2d1424974fbbb8968", "score": "0.5508286", "text": "func (server *Server) Stop(ctx context.Context) {\n\tserver.scheduleStopper <- true\n\tserver.http.Shutdown(ctx)\n}", "title": "" }, { "docid": "40d29fdc0bf2ff7324cde4fcec7cfbb9", "score": "0.55039334", "text": "func (r *StreamReader) Stop() {\n\tr.hookConn.Close()\n\t<-r.stopDone\n}", "title": "" }, { "docid": "8128d437d587fbc274f69307837ce814", "score": "0.5503822", "text": "func (p *kataBuiltInProxy) stop(sandbox *Sandbox, pid int) error {\n\tif p.conn != nil {\n\t\tp.conn.Close()\n\t\tp.conn = nil\n\t\tp.sandboxID = \"\"\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60cb6a6334859c9a5e544edaa2971cab", "score": "0.55007315", "text": "func (m *Mercurio) Stop(ctx context.Context) {\n\tlog.Println(\"Stopping Broker\")\n\tm.Broker.Stop()\n\n\tlog.Println(\"Shutting down HTTP server\")\n\tm.HTTPServer.Shutdown(ctx)\n}", "title": "" }, { "docid": "d3c71b786ea4d62b0643484a6e92dfd6", "score": "0.5496921", "text": "func (c *Client) Stop() {\n\tc.blockScanner.Stop()\n}", "title": "" }, { "docid": "dfdef2f3a8dc97a0c1b33e2a5d4cb34d", "score": "0.54965323", "text": "func Stop(timeout time.Duration) error {\n\tslogger.Info(\"Http api server is shutting down\")\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\tif err := server.Shutdown(ctx); err != nil {\n\t\tslogger.Errorw(\"Failed to shutdown http api server\", \"err\", err)\n\t\treturn err\n\t}\n\tslogger.Info(\"Http api server is shut down\")\n\treturn nil\n}", "title": "" }, { "docid": "6217a9bc175e5360e80482e99b8cf507", "score": "0.54943055", "text": "func (b *MockBroker) Close() {\n\tclose(b.responses)\n\t<-b.stopper\n}", "title": "" }, { "docid": "937556c199c35b8c4d7dced8420607d6", "score": "0.5489054", "text": "func (s *TCPServer) Stop() {\n\tlog.Printf(\"Close TCP server\\n\")\n\t_ = s.lis.Close()\n\tlog.Printf(\"Close TCP server -- Done\\n\")\n}", "title": "" }, { "docid": "7fbaed47e10b1b2fed7c7c844c778eae", "score": "0.5488176", "text": "func (rp *ReplProtocol) Stop() {\n\trp.exitedMu.Lock()\n\tdefer rp.exitedMu.Unlock()\n\tif atomic.LoadInt32(&rp.exited) == ReplRuning {\n\t\tif rp.exitC != nil {\n\t\t\tclose(rp.exitC)\n\t\t}\n\t\tatomic.StoreInt32(&rp.exited, ReplExiting)\n\t}\n\n}", "title": "" }, { "docid": "7c1b5454039644703726cbfdf7f42ee1", "score": "0.548022", "text": "func (r *RecordStream) Stop() {\n\tr.c.c.Request(&proto.CorkRecordStream{StreamIndex: r.index, Corked: true}, nil)\n\tr.running = false\n}", "title": "" }, { "docid": "a8239b14ba09694e74c76f7410158aa5", "score": "0.54795516", "text": "func (s *Controller) Stop() {\n\ts.stop <- nil\n}", "title": "" }, { "docid": "64453e79251b499cdbb4391aff1961d8", "score": "0.54669356", "text": "func (c *Client) Stop() {\n\tclose(c.messages)\n\tclose(c.errc)\n}", "title": "" }, { "docid": "2bd2510b601a33d653fa9e83455af294", "score": "0.5465146", "text": "func (r *Response) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "a5a5b8efe8fb149c3fc4ff127222fc96", "score": "0.54646695", "text": "func (client PipelineJobsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "689699d9cb5d60b656efcf809c75f80f", "score": "0.5463337", "text": "func (r *Reporter) Stop() {\n\tclose(r.abort)\n\t<-r.exit\n}", "title": "" }, { "docid": "4356965f6f4455a464c595e1fb7ab4f8", "score": "0.54629683", "text": "func (n *Nozzle) Stop() {\n\tn.server.Stop()\n}", "title": "" }, { "docid": "be3f36038f3206977ef9f4c5b7ed67ad", "score": "0.54473364", "text": "func (s *DefaultServer) Stop() error {\n\treturn s.srv.Close()\n}", "title": "" }, { "docid": "6707bf9de30334a136b8d7963a6ccfd1", "score": "0.54455584", "text": "func (s *Server) Stop(_ error) {\n\tagent.Close()\n\n\tclose(s.done)\n}", "title": "" }, { "docid": "f6760c8d2ce322bcaf67684f9f79f3b9", "score": "0.54388803", "text": "func (m *Manager) Stop() {\n\tm.controlChan <- SigStop\n\tm.expectChanVal(m.finishChan, StopFinish)\n}", "title": "" }, { "docid": "dd9cbd7c873eba50f1aec92c262011c7", "score": "0.5428665", "text": "func (s *Server) Stop() {\n\ts.logger.Debug(\"stop http-tunnel server\")\n\n\tif s.listener != nil {\n\t\ts.listener.Close()\n\t}\n}", "title": "" }, { "docid": "7eae06089a564d86a4acc72a78d29cf1", "score": "0.5421306", "text": "func (s *Server) Stop() error {\n\ts.started = false\n\tif err := s.listener.Close(); err != nil {\n\t\tlog.Errorf(\"error shutting down RPC, %v\\n\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "07d1edce828170154399443b2999d496", "score": "0.54158974", "text": "func (l *CloudFoundryListener) Stop() {\n\tl.stop <- true\n}", "title": "" }, { "docid": "bea5c58774c008e746d266a7e822e0e6", "score": "0.54144365", "text": "func (c *VirtualMachineClient) Stop(ctx context.Context, group string, name string) (err error) {\n\terr = c.internal.Stop(ctx, group, name)\n\treturn\n}", "title": "" }, { "docid": "d45ec325ba620e1d62b25ebe41cef9c8", "score": "0.5409721", "text": "func (a *api) Stop() error {\n\ta.Lock()\n\tdefer a.Unlock()\n\tif !a.started {\n\t\treturn fmt.Errorf(\"web server is already down\")\n\t}\n\tif a.shutdown == nil {\n\t\treturn fmt.Errorf(\"shutdown channel is not defined\")\n\t}\n\tclose(a.shutdown)\n\tctx, cancel := context.WithTimeout(context.Background(), a.ShutdownTimeout)\n\tdefer cancel()\n\treturn a.e.Shutdown(ctx)\n}", "title": "" }, { "docid": "0c6d938733a124659b71f1a2b5ec4133", "score": "0.54092306", "text": "func (h *HTTPFake) Close() {\n\th.started = false\n\n\th.server.Close()\n}", "title": "" }, { "docid": "2cd158380718cab6ef3f7dc916c468a2", "score": "0.5408146", "text": "func (s *FakeIceServer) Stop() {\n\ts.testServer.Close()\n}", "title": "" }, { "docid": "13b16c4ec19fe4bdfe32f7a041915d3c", "score": "0.5407683", "text": "func (r *ResolverClient) Stop() {\n\tr.Lock()\n\tdefer r.Unlock()\n\tr.observers = nil\n}", "title": "" }, { "docid": "c7cdf2df5f349d54c7a03e2a4f40076a", "score": "0.5397101", "text": "func (a *API) Stop() {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*5)\n\tdefer cancel()\n\terr := a.httpSrv.Shutdown(ctx)\n\tif err != nil {\n\t\ta.logger.Error(\"error shutting down\", zap.Error(err))\n\t}\n\ta.logger.Info(\"Stopping ...\")\n\t<-ctx.Done()\n\ta.wg.Wait()\n\ta.logger.Info(\"All Processes Stopped.\")\n}", "title": "" }, { "docid": "caa018c165235b71531c09831da1ca56", "score": "0.53945005", "text": "func (s *Server) Stop(ctx context.Context) error {\n\terrs := make([]string, 0)\n\ts.streams.Range(func(key, value interface{}) bool {\n\t\ts.killStream(ctx, key.(string))\n\n\t\treturn true\n\t})\n\n\tif err := s.httpServer.Shutdown(ctx); err != nil {\n\t\terrs = append(errs, fmt.Sprintf(\"could not stop http server: %v\", err))\n\t}\n\n\tif err := s.apiHttpServer.Shutdown(ctx); err != nil {\n\t\terrs = append(errs, fmt.Sprintf(\"could not stop API http server: %v\", err))\n\t}\n\n\tif err := s.avatarStorage.Close(); err != nil {\n\t\terrs = append(errs, fmt.Sprintf(\n\t\t\t\"could not close connection to avatar storage: %v\", err))\n\t}\n\n\tif err := s.streamStorage.Close(); err != nil {\n\t\terrs = append(errs, fmt.Sprintf(\n\t\t\t\"could not close connection to stream storage: %v\", err))\n\t}\n\n\tif err := s.participantStorage.Close(); err != nil {\n\t\terrs = append(errs, fmt.Sprintf(\n\t\t\t\"could not close connection to participant storage: %v\", err))\n\t}\n\n\tif len(errs) != 0 {\n\t\treturn errors.New(strings.Join(errs, \";\"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "175504970318575f2f08667d4ba29ba1", "score": "0.53938967", "text": "func (resp *AlexaResponse) EndResponse() {\n\tclear(resp)\n\tresp.Version = \"1.0\"\n\tresp.Response.ShouldEndSession = Wrong\n\tvar dtype string\n\tdtype = \"Dialog.Delegate\"\n\td := DialogDirective{\n\t\tType: dtype,\n\t}\n\tresp.Response.Directives = append(resp.Response.Directives, d)\n}", "title": "" }, { "docid": "406fff2bafcd6105e07e879ce67a50ff", "score": "0.53866965", "text": "func KillHandler(resp http.ResponseWriter, req *http.Request) {\n\tif req.Method != \"DELETE\" {\n\t\tresp.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// We need to send a HTTP Status Code 200 (OK)\n\t// to respond that we have accepted the request.\n\t// Here we send a chunked response to the requester.\n\tflusher, ok := resp.(http.Flusher)\n\tif !ok {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tresp.WriteHeader(http.StatusOK)\n\tflusher.Flush()\n\n\t// And we kill the server (like requested)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "169ba03d3453a4589b033f6371b6fc37", "score": "0.53770393", "text": "func (api *API) daemonStopHandler(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {\n\t// can't write after we stop the server, so lie a bit.\n\tWriteSuccess(w)\n\n\t// Shutdown in a separate goroutine to prevent a deadlock.\n\tgo func() {\n\t\tif err := api.Shutdown(); err != nil {\n\t\t\tbuild.Critical(err)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "968b2f2d27f8a082760baed5a424d255", "score": "0.53735167", "text": "func (h *APIServer) Stop() error {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\tif err := h.srv.Shutdown(ctx); err != nil {\n\t\treturn fmt.Errorf(\"failed to shutdown web server: %q\", err)\n\t}\n\tclose(h.sessCleanup)\n\treturn nil\n}", "title": "" }, { "docid": "de16aa1039680dcf0eca3ceffa5c2c16", "score": "0.53676105", "text": "func (s *Server) Stop(ctx context.Context) error {\n\tif err := s.httpServer.Shutdown(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to shutdown HTTP server\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7d15f67da6272696d1e0c2b7ac36ae55", "score": "0.5366544", "text": "func (gtw *Gateway) Stop() {\n\terr := gtw.httpServer.Shutdown(context.Background())\n\tif err != nil {\n\t\tgtw.Logger.Warn(\"HTTP server shutdown failed.\", zap.Error(err))\n\t}\n}", "title": "" } ]
791366ab79a42aacce5a5c044694ca26
ReportTimingFromCtx reports the latency from the context
[ { "docid": "43985d55129cf5338a6b80423615117a", "score": "0.7403077", "text": "func ReportTimingFromCtx(ctx context.Context, reporters []Reporter, typ string, err error) {\n\tif ctx == nil {\n\t\treturn\n\t}\n\tcode := errors.CodeFromError(err)\n\tstatus := \"ok\"\n\tif err != nil {\n\t\tstatus = \"failed\"\n\t}\n\tif len(reporters) > 0 {\n\t\tstartTime := pcontext.GetFromPropagateCtx(ctx, constants.StartTimeKey)\n\t\troute := pcontext.GetFromPropagateCtx(ctx, constants.RouteKey)\n\t\telapsed := time.Since(time.Unix(0, startTime.(int64)))\n\t\ttags := getTags(ctx, map[string]string{\n\t\t\t\"route\": route.(string),\n\t\t\t\"status\": status,\n\t\t\t\"type\": typ,\n\t\t\t\"code\": code,\n\t\t})\n\t\tfor _, r := range reporters {\n\t\t\tr.ReportSummary(ResponseTime, tags, float64(elapsed.Nanoseconds()))\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "ed10555fc7c47086c7177cc0b8a5a18d", "score": "0.6221884", "text": "func Latency(ctx *Context) {\n\t//all except latency to string\n\tvar latency time.Duration\n\tvar startTime, endTime time.Time\n\tstartTime = time.Now()\n\n\tctx.Next()\n\n\t//no time.Since in order to format it well after\n\tendTime = time.Now()\n\tlatency = endTime.Sub(startTime)\n\n\t// no new line, the framework's logger is responsible how to render each log.\n\tline := fmt.Sprintf(\">>> Latency: %4v\", latency)\n\tctx.LogD(line)\n}", "title": "" }, { "docid": "239f7dcf4567b8b6abc6ad1552fc356e", "score": "0.59096336", "text": "func ReportMessageProcessDelayFromCtx(ctx context.Context, reporters []Reporter, typ string) {\n\tif len(reporters) > 0 {\n\t\tstartTime := pcontext.GetFromPropagateCtx(ctx, constants.StartTimeKey)\n\t\telapsed := time.Since(time.Unix(0, startTime.(int64)))\n\t\troute := pcontext.GetFromPropagateCtx(ctx, constants.RouteKey)\n\t\ttags := getTags(ctx, map[string]string{\n\t\t\t\"route\": route.(string),\n\t\t\t\"type\": typ,\n\t\t})\n\t\tfor _, r := range reporters {\n\t\t\tr.ReportSummary(ProcessDelay, tags, float64(elapsed.Nanoseconds()))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fe18de2477f332eae490c27c9f7e6598", "score": "0.5760759", "text": "func reportPerformance(initial time.Time, latency, xferTime,\n\tthinkTime time.Duration, length int64, key string, rc int,\n\top string) {\n\n\tfmt.Printf(\"%s %f %f %f %d %s %d %s\\n\",\n\t\tinitial.Format(\"2006-01-02 15:04:05.000\"),\n\t\tlatency.Seconds(), xferTime.Seconds(), thinkTime.Seconds(),\n\t\tlength, key, rc, op)\n}", "title": "" }, { "docid": "9a3e4af35d07a2891a8f2bd732d33228", "score": "0.56235325", "text": "func ReportHandlerFuncLatency(handler, name, status string, started time.Time) {\n\trequestLatencyHandler.WithLabelValues(handler, name, status).Observe(time.Since(started).Seconds())\n}", "title": "" }, { "docid": "f3f4306fc72b0ab1ffff16f249a13670", "score": "0.539746", "text": "func TraceContext(ctx context.Context, format string, v ...interface{}) {\n\tif getActiveLogLevel() >= logLevel[LogLevelTrace] {\n\t\tmessage := fmt.Sprintf(logPrefix[LogLevelTrace]+\" ReqID \"+extractReqID(ctx)+\" - \"+format, v...)\n\t\tlog.Print(message)\n\t}\n}", "title": "" }, { "docid": "33b62c3a7f68f3d1396dc35f7d505f7f", "score": "0.52270156", "text": "func evaluateLatency(ctx context.Context, params gio.TestParams, eventTimes []int64, perfName string, pv *perf.Values) error {\n\t// Get event received RTC times.\n\tevents, err := gio.PopulateReceivedTimes(ctx, params, numEvents)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not receive event\")\n\t}\n\n\t// Assign event RTC time.\n\tfor i := range events {\n\t\tevents[i].EventTimeNS = eventTimes[i]\n\t}\n\n\tmean, median, stdDev, max, min := inputlatency.CalculateMetrics(events, func(i int) float64 {\n\t\treturn float64(events[i].RecvTimeNS-events[i].EventTimeNS) / 1000000.\n\t})\n\ttesting.ContextLogf(ctx, \"Latency (ms): mean %f median %f std %f max %f min %f\", mean, median, stdDev, max, min)\n\n\tpv.Set(perf.Metric{\n\t\tName: perfName,\n\t\tUnit: \"milliseconds\",\n\t\tDirection: perf.SmallerIsBetter,\n\t}, mean)\n\treturn nil\n}", "title": "" }, { "docid": "34b8a0a041a42fbc8f9d30bb54a9f903", "score": "0.5218668", "text": "func Trace(ctx context.Context, titleFormat string, args ...interface{}) func() {\n\t// TODO(nodir): use actual tracing API.\n\n\tstart := clock.Now(ctx)\n\treturn func() {\n\t\tlogging.Infof(ctx, titleFormat+\" took %s\", append(args, clock.Since(ctx, start))...)\n\t}\n}", "title": "" }, { "docid": "d51a88e51a6a6f610bdc74ceb9c41a7b", "score": "0.52015865", "text": "func TraceRequestTime(method, action, status string, elapsedTime float64) {\n\thisto1.WithLabelValues(method, action, status).Observe(elapsedTime)\n}", "title": "" }, { "docid": "e9d239412e79571b5217444673a6a2e3", "score": "0.50615454", "text": "func testCtx(t *testing.T) context.Context {\n\treturn timeoutCtx(t, defaultTimeout)\n}", "title": "" }, { "docid": "92b8e1574e9784d1e3b4df6f761916ee", "score": "0.50605726", "text": "func Time(ctx *Context) {\n\tstartTime := time.Now()\n\tctx.Next()\n\ttimeElapsed := time.Since(startTime)\n\tlog.Printf(\"%v has passed...\", timeElapsed)\n}", "title": "" }, { "docid": "43b79f40090246f9dae5e9ddc1d2a36f", "score": "0.50448316", "text": "func StartFromContext(ctx context.Context) time.Time {\n\treturn ctx.Value(elapsedKey).(*elapsedRecord).start\n}", "title": "" }, { "docid": "a3a671639d38c1dff9675643a9e109c4", "score": "0.5029863", "text": "func reportScenicPerSessionLatencies(model benchmarking.Model, testSuite string, testResultsFile *benchmarking.TestResultsFile, allApps bool, debugNames []string) {\n\tfmt.Printf(\"\\n=== Scenic Per Session ===\\n\")\n\tlatenciesPerSession := calculatePerSessionLatency(model)\n\n\tessentialLatencies := make(map[string]sessionLatencies)\n\n\tfor session, latencies := range latenciesPerSession {\n\t\tif allApps {\n\t\t\tmetricName := session.debugName + \"_\" + strconv.Itoa(int(session.id))\n\t\t\tessentialLatencies[metricName] = latencies\n\t\t} else if listContainsElement(debugNames, session.debugName) {\n\t\t\tmetricName := session.debugName\n\t\t\tessentialLatencies[metricName] = latencies\n\t\t}\n\t}\n\n\tfor metricName, latencies := range essentialLatencies {\n\n\t\taverageLatency := computeAverage(latencies.requestedPresentationTimeToDisplay)\n\t\tminLatency := computeMin(latencies.requestedPresentationTimeToDisplay)\n\t\tmaxLatency := computeMax(latencies.requestedPresentationTimeToDisplay)\n\t\tavgScheduleToApply := computeAverage(latencies.scheduleUpdateToApplyUpdate)\n\t\tminSchedToApply := computeMin(latencies.scheduleUpdateToApplyUpdate)\n\t\tmaxSchedToApply := computeMax(latencies.scheduleUpdateToApplyUpdate)\n\t\tavgScheduleToDisplay := computeAverage(latencies.applyUpdateToDisplay)\n\t\tminSchedToDisplay := computeMin(latencies.applyUpdateToDisplay)\n\t\tmaxSchedToDisplay := computeMax(latencies.applyUpdateToDisplay)\n\n\t\tfmt.Printf(`%s:\n Latency between requested presentation time and display time:\n \tAvg: %.4g ms\n \tMin: %.4g ms\n \tMax: %.4g ms\n Time from ScheduleUpdate to ApplyUpdate:\n \tAvg: %.4g ms\n \tMin: %.4g ms\n \tMax: %.4g ms\n Time from ApplyUpdate to display:\n \tAvg: %.4g ms\n \tMin: %.4g ms\n \tMax: %.4g ms\n\n`,\n\t\t\tmetricName,\n\t\t\taverageLatency,\n\t\t\tminLatency,\n\t\t\tmaxLatency,\n\t\t\tavgScheduleToApply,\n\t\t\tminSchedToApply,\n\t\t\tmaxSchedToApply,\n\t\t\tavgScheduleToDisplay,\n\t\t\tminSchedToDisplay,\n\t\t\tmaxSchedToDisplay)\n\n\t\ttestResultsFile.Add(&benchmarking.TestCaseResults{\n\t\t\tLabel: metricName + \"_requested_presentation_time_to_display_latency\",\n\t\t\tTestSuite: testSuite,\n\t\t\tUnit: benchmarking.Milliseconds,\n\t\t\tValues: latencies.requestedPresentationTimeToDisplay,\n\t\t})\n\n\t\ttestResultsFile.Add(&benchmarking.TestCaseResults{\n\t\t\tLabel: metricName + \"_schedule_update_to_apply_update_latency\",\n\t\t\tTestSuite: testSuite,\n\t\t\tUnit: benchmarking.Milliseconds,\n\t\t\tValues: latencies.scheduleUpdateToApplyUpdate,\n\t\t})\n\n\t\ttestResultsFile.Add(&benchmarking.TestCaseResults{\n\t\t\tLabel: metricName + \"_apply_update_to_display_latency\",\n\t\t\tTestSuite: testSuite,\n\t\t\tUnit: benchmarking.Milliseconds,\n\t\t\tValues: latencies.applyUpdateToDisplay,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "44d3d47719318865e8b33f929cefd286", "score": "0.5028274", "text": "func ReportAPIRequestMetric(handler string, started time.Time) {\n\trequestLatencyAPI.WithLabelValues(handler).Observe(time.Since(started).Seconds())\n}", "title": "" }, { "docid": "e0d1f1c3cf040039e504f4dd4d9e3b4d", "score": "0.50147647", "text": "func WarnContext(ctx context.Context, format string, v ...interface{}) {\n\tif getActiveLogLevel() >= logLevel[LogLevelWarning] {\n\t\tmessage := fmt.Sprintf(logPrefix[LogLevelWarning]+\" ReqID \"+extractReqID(ctx)+\" - \"+format, v...)\n\t\tlog.Print(message)\n\t}\n}", "title": "" }, { "docid": "8f4c579d8642140848b732db1c4c7c50", "score": "0.49368626", "text": "func measureContextSwitch(ctx context.Context, s *testing.State) (gpu, gpuDec contextSwitchStat, err error) {\n\tif err := testing.Sleep(ctx, stabilizationDuration); err != nil {\n\t\treturn gpu, gpuDec, err\n\t}\n\n\ttesting.ContextLog(ctx, \"Tracing scheduler events\")\n\t// Record system events for |measurementDuration|.\n\tsess, err := tracing.StartSession(ctx, s.DataPath(TraceConfigFile))\n\tif err != nil {\n\t\treturn gpu, gpuDec, errors.Wrap(err, \"failed to start tracing\")\n\t}\n\t// Stop tracing even if context deadline exceeds during sleep.\n\tstopped := false\n\tdefer func() {\n\t\tif !stopped {\n\t\t\tsess.Stop()\n\t\t}\n\t}()\n\n\tif err := testing.Sleep(ctx, measurementDuration); err != nil {\n\t\treturn gpu, gpuDec, errors.Wrap(err, \"failed to sleep to wait for the tracing session\")\n\t}\n\tstopped = true\n\tif err := sess.Stop(); err != nil {\n\t\treturn gpu, gpuDec, errors.Wrap(err, \"failed to stop tracing\")\n\t}\n\tdefer sess.RemoveTraceResultFile()\n\ttesting.ContextLog(ctx, \"Completed tracing events\")\n\n\tresults, err := sess.RunQuery(ctx, s.DataPath(tracing.TraceProcessor()), s.DataPath(GPUThreadSchedSQLFile))\n\tif err != nil {\n\t\treturn gpu, gpuDec, errors.Wrap(err, \"failed in querying\")\n\t}\n\n\tvar switches, runnableCnt, sumRunnableDur uint64 = 0, 0, 0\n\tvar decThreadsSwitches, decThreadsRunnableCnt, decThreadsSumRunnableDur uint64 = 0, 0, 0\n\tfor _, res := range results[1:] { // Skip, the first line, \"ts\",\"dur\",\"state\",\"tid\",\"name\".\n\t\tconst (\n\t\t\ttsIdx = iota\n\t\t\tdurIdx\n\t\t\tstateIdx\n\t\t\ttidIdx\n\t\t\tnameIdx\n\t\t)\n\n\t\tthName := res[nameIdx]\n\t\tisDecoderThread := strings.Contains(thName, \"VDecThread\")\n\t\tswitch res[stateIdx] {\n\t\tcase \"Running\":\n\t\t\tswitches++\n\t\t\tif isDecoderThread {\n\t\t\t\tdecThreadsSwitches++\n\t\t\t}\n\t\tcase \"R\": // Runnable\n\t\t\tdur, err := strconv.Atoi(res[durIdx])\n\t\t\tif err != nil {\n\t\t\t\treturn gpu, gpuDec, errors.Wrapf(err, \"failed to convert to integer, %s\", res[durIdx])\n\t\t\t}\n\t\t\tif dur == -1 {\n\t\t\t\t// dur is -1 if tracing terminates while a thread is in the Runnable state.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trunnableCnt++\n\t\t\tsumRunnableDur += uint64(dur)\n\t\t\tif isDecoderThread {\n\t\t\t\tdecThreadsRunnableCnt++\n\t\t\t\tdecThreadsSumRunnableDur += uint64(dur)\n\t\t\t}\n\t\t}\n\t}\n\n\tgpu.count = switches\n\tgpu.avgDuration = time.Duration(sumRunnableDur/runnableCnt) * time.Microsecond\n\tgpuDec.count = decThreadsSwitches\n\tgpuDec.avgDuration = time.Duration(decThreadsSumRunnableDur/decThreadsRunnableCnt) * time.Microsecond\n\treturn gpu, gpuDec, nil\n}", "title": "" }, { "docid": "dcac9b32a16e891cd9b6f09d27d5a069", "score": "0.49224183", "text": "func (h *httpHandler) recordLatency(start time.Time) {\n\telapsedMS := time.Now().Sub(start).Nanoseconds() / 1E6\n\t_ = h.metricLatency.RecordValue(elapsedMS)\n}", "title": "" }, { "docid": "f2e0bce19299fe0550fc7f52008b567b", "score": "0.4895701", "text": "func (r *reporter) ReportResponseTime(responseCode int, d time.Duration) {\n\tpkgmetrics.Record(metrics.AugmentWithResponse(r.ctx, responseCode), r.latencyMetric.M(float64(d.Milliseconds())))\n}", "title": "" }, { "docid": "9fc6e477853e0e5ca7cc74503e3838a4", "score": "0.48686883", "text": "func LatencyMeasure(pkg string) *stats.Float64Measure {\n\treturn stats.Float64(\n\t\tpkg+\"/latency\",\n\t\t\"Latency of method call\",\n\t\tstats.UnitMilliseconds)\n}", "title": "" }, { "docid": "865ca0f5e1a33cb63ad655f718394847", "score": "0.48190787", "text": "func (r *Result) Latency() string {\n\treturn fmt.Sprintf(\"%.3f sec\", r.Finish.Sub(r.Start).Seconds())\n}", "title": "" }, { "docid": "675e3ec89495bc50e630dd92144ef167", "score": "0.48107094", "text": "func (mock *DynamoDBAPIMock) DescribeTimeToLiveWithContextCalls() []struct {\n\tIn1 context.Context\n\tIn2 *dynamodb.DescribeTimeToLiveInput\n\tIn3 []request.Option\n} {\n\tvar calls []struct {\n\t\tIn1 context.Context\n\t\tIn2 *dynamodb.DescribeTimeToLiveInput\n\t\tIn3 []request.Option\n\t}\n\tlockDynamoDBAPIMockDescribeTimeToLiveWithContext.RLock()\n\tcalls = mock.calls.DescribeTimeToLiveWithContext\n\tlockDynamoDBAPIMockDescribeTimeToLiveWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c3983faf64012b885488ccb6d37b02e6", "score": "0.48103908", "text": "func ContextWithTimeout(ctx context.Context, duration time.Duration) (context.Context, context.CancelFunc) {\n\tdeadline := time.Now().Add(duration)\n\t_, fn, line, _ := runtime.Caller(1)\n\n\tif span := opentracing.SpanFromContext(ctx); span != nil {\n\t\tLogInfo(span, \"Set context deadline\",\n\t\t\t\"deadline\", deadline.Format(time.RFC3339),\n\t\t\t\"source\", fmt.Sprintf(\"%s:%d\", fn, line),\n\t\t)\n\t}\n\n\treturn context.WithTimeout(ctx, duration)\n}", "title": "" }, { "docid": "f56d17b88fb200f61129a949b1feeedb", "score": "0.48049134", "text": "func PollTimingsFromContext(ctx context.Context) (time.Duration, time.Duration) {\n\tif t, ok := ctx.Value(timingsKey{}).(timingsType); ok {\n\t\treturn t.interval, t.timeout\n\t}\n\treturn DefaultPollInterval, DefaultPollTimeout\n}", "title": "" }, { "docid": "28d825c23567c70c49ee5e4b408e522c", "score": "0.47813502", "text": "func sleepWithContext(ctx context.Context, dur time.Duration) error {\n\tt := time.NewTimer(dur)\n\tdefer t.Stop()\n\n\tselect {\n\tcase <-t.C:\n\t\tbreak\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b83cb3edd56f41bb21e9e118fed0bcb5", "score": "0.4730989", "text": "func ReportSamplingRateTiming(bus uint8, device uint8, function uint8,\n\tLaneNum uint, ReceiverNum uint) uint8 {\n\treturn testcases.ReportSamplingRateTiming(bus, device, function,\n\t\tLaneNum, ReceiverNum)\n}", "title": "" }, { "docid": "adb0641f6ed2795f59d4be127230b4b8", "score": "0.47195107", "text": "func ElapsedFromContext(ctx context.Context) time.Duration {\n\telapsed := ctx.Value(elapsedKey).(*elapsedRecord).elapsed\n\tif elapsed > 0 {\n\t\treturn elapsed\n\t}\n\n\treturn time.Since(StartFromContext(ctx))\n}", "title": "" }, { "docid": "ddca8b75b4975063de7cf69a2e00b718", "score": "0.47151214", "text": "func (smc *Client) SendCtx(ctx context.Context, res Response) error {\n\tif smc.debug {\n\t\tjs, err := json.Marshal(res)\n\n\t\t// Log the error so users of `Send` don't see it entirely disappear as that method\n\t\t// does not return an error and used to panic on failure (with or without debug)\n\t\tsmc.Debugf(\"Scheduling Socket Mode response (error: %v) for envelope ID %s: %s\", err, res.EnvelopeID, js)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase smc.socketModeResponses <- &res:\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2d05f00c43b20f3687af3accc6066ccd", "score": "0.46660703", "text": "func (i instrument) Greet(ctx context.Context, req *v0proto.GreetRequest, rsp *v0proto.GreetResponse) error {\n\ttimer := prometheus.NewTimer(prometheus.ObserverFunc(func(v float64) {\n\t\tus := v * 1000000\n\n\t\ti.metrics.Latency.WithLabelValues().Observe(us)\n\t\ti.metrics.Duration.WithLabelValues().Observe(v)\n\t}))\n\n\tdefer timer.ObserveDuration()\n\n\terr := i.next.Greet(ctx, req, rsp)\n\n\tif err == nil {\n\t\ti.metrics.Counter.WithLabelValues().Inc()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "0d2666eac62889d369ecdd54ad22fd36", "score": "0.46648544", "text": "func (r *Request) Latency() time.Duration { return r.timeLatency }", "title": "" }, { "docid": "5d1a0035149130d1f8cdfd796bbc5db6", "score": "0.46495944", "text": "func (prom *PromMonitor) Latency(method, processType string, duration time.Duration) {\n\tprom.ResponseLatency.WithLabelValues(method, processType).Observe(float64(duration))\n}", "title": "" }, { "docid": "0216fea0be96e27605443991a81c75b4", "score": "0.46479297", "text": "func calcPerf() {\n\t/* Compute average */\n\tvar sum int64\n\tfor key := range latencies {\n\t\tsum += latencies[key]\n\t}\n\n\t/* Print latency */\n\tavg := float32(sum) / 1000000 / float32(cnt)\n\tutil.PrintMsg(\"CLIENT\", \"Average latency is (ms): \"+fmt.Sprint(avg))\n}", "title": "" }, { "docid": "94508e9e559d90583dab5b04c5c1f999", "score": "0.46399483", "text": "func sleepContext(ctx context.Context, duration time.Duration) {\n\tselect {\n\tcase <-ctx.Done():\n\tcase <-time.After(duration):\n\t}\n}", "title": "" }, { "docid": "fba23f9bb651695817677ab04d8e7368", "score": "0.4636879", "text": "func (rapl *RAPLValues) ReportWattPerfMetrics(perfValues *perf.Values, prefix string, timeDelta time.Duration) {\n\tinterval := timeDelta.Seconds()\n\tfor _, e := range []struct {\n\t\tname string\n\t\tvalue float64\n\t}{\n\t\t{\"Package0\", rapl.joules[package0] / interval},\n\t\t{\"Core\", rapl.joules[core] / interval},\n\t\t{\"Uncore\", rapl.joules[uncore] / interval},\n\t\t{\"DRAM\", rapl.joules[dram] / interval},\n\t\t{\"Psys\", rapl.joules[psys] / interval},\n\t} {\n\t\tperfValues.Append(perf.Metric{\n\t\t\tName: prefix + e.name,\n\t\t\tUnit: \"Watts\",\n\t\t\tDirection: perf.SmallerIsBetter,\n\t\t\tMultiple: true,\n\t\t}, e.value)\n\t}\n}", "title": "" }, { "docid": "cf00774e0d0e5489e172c9b04899dc6a", "score": "0.46304703", "text": "func PostMetricsLatency(data []byte, sdkVersion string, machineIP string) error {\n\turl := \"/metrics/times\"\n\treturn postMetrics(url, data, sdkVersion, machineIP)\n}", "title": "" }, { "docid": "48206654d37e7ebb060acf59247a3f76", "score": "0.4629377", "text": "func ContextWithPollTimings(ctx context.Context, interval, timeout time.Duration) context.Context {\n\treturn context.WithValue(ctx, timingsKey{}, timingsType{\n\t\tinterval: interval,\n\t\ttimeout: timeout,\n\t})\n}", "title": "" }, { "docid": "7963a0b6aa64d847ddd69a899ea576af", "score": "0.46193558", "text": "func (vtgate *VTGateProxy) PingContext(ctx context.Context) error {\n\tspan, ctx := trace.NewSpan(ctx, \"VTGateProxy.PingContext\")\n\tdefer span.Finish()\n\n\tvtgate.annotateSpan(span)\n\n\treturn vtgate.pingContext(ctx)\n}", "title": "" }, { "docid": "c85cb2163baf4a480c74c4a4374aeb5a", "score": "0.46161062", "text": "func (driver *Driver) ReportContext(instance string) error {\n\tdriver.RLock()\n\tdefer driver.RUnlock()\n\n\tvar triples []*xbospb.Triple\n\n\tfor triple := range driver.brickContext {\n\t\ttriples = append(triples, &xbospb.Triple{\n\t\t\tSubject: &xbospb.URI{Namespace: triple.Subject.Namespace, Value: triple.Subject.Value},\n\t\t\tPredicate: &xbospb.URI{Namespace: triple.Predicate.Namespace, Value: triple.Predicate.Value},\n\t\t\tObject: &xbospb.URI{Namespace: triple.Object.Namespace, Value: triple.Object.Value},\n\t\t})\n\t}\n\n\tmsg := &xbospb.XBOS{\n\t\tXBOSIoTContext: &xbospb.XBOSIoTContext{\n\t\t\tTime: uint64(time.Now().UnixNano()),\n\t\t\tContext: triples,\n\t\t},\n\t}\n\tpo, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := context.WithTimeout(driver.ctx, 1*time.Second)\n\tdefer cancel()\n\n\tresp, err := driver.client.Publish(ctx, &mqpb.PublishParams{\n\t\tPerspective: driver.perspective,\n\t\tNamespace: driver.namespace,\n\t\tUri: fmt.Sprintf(\"context/%s/signal/state\", instance),\n\t\tContent: []*mqpb.PayloadObject{\n\t\t\t{Schema: \"xbosproto/XBOS\", Content: po},\n\t\t},\n\t})\n\tif resp.Error != nil {\n\t\treturn fmt.Errorf(\"Error publishing: %s\", resp.Error.Message)\n\t}\n\treturn err\n\n\treturn nil\n}", "title": "" }, { "docid": "90ff95693de77abd4867b14f23155c15", "score": "0.45742527", "text": "func (dbc *Connection) PingContext(context context.Context) (err error) {\n\tif dbc.tracer != nil {\n\t\ttf := dbc.tracer.Ping(context, dbc)\n\t\tif tf != nil {\n\t\t\tdefer func() {\n\t\t\t\ttf.Finish(err)\n\t\t\t}()\n\t\t}\n\t}\n\n\terr = exception.New(dbc.connection.PingContext(context))\n\treturn\n}", "title": "" }, { "docid": "d54900e2ac2fb78d8699946067e9ecc7", "score": "0.4572658", "text": "func (c ContextImpl) CompleteTrace(name, desc string, begin, end uint64) {\n\tif c.Tracer != nil {\n\t\tc.Tracer.Complete(desc, c.Thread, begin, end)\n\t}\n\tif c.Metrics != nil {\n\t\trealTime := end - begin\n\t\tc.Metrics.SetTimeMetrics(\n\t\t\tsoong_metrics_proto.PerfInfo{\n\t\t\t\tDesc: &desc,\n\t\t\t\tName: &name,\n\t\t\t\tStartTime: &begin,\n\t\t\t\tRealTime: &realTime})\n\t}\n}", "title": "" }, { "docid": "d1495ab3c9ee6cf43d21f860b9aacc17", "score": "0.4571323", "text": "func (r *DeliveryReporter) ReportEventDispatchTime(ctx context.Context, d time.Duration) {\n\tattachments := getSpanContextAttachments(ctx)\n\t// convert time.Duration in nanoseconds to milliseconds.\n\tmetrics.Record(ctx, r.dispatchTimeInMsecM.M(float64(d/time.Millisecond)), stats.WithAttachments(attachments))\n}", "title": "" }, { "docid": "a4edb04d17a2dd7d474f7c5023fbcabb", "score": "0.45586744", "text": "func (l *Limiter) SendTelemetry(timestamp float64, series metrics.SerieSink, hostname string, constTags []string) {\n\tif l == nil {\n\t\treturn\n\t}\n\n\tdroppedTags := append([]string{}, constTags...)\n\tdroppedTags = append(droppedTags, \"reason:too_many_contexts\")\n\n\tseries.Append(&metrics.Serie{\n\t\tName: \"datadog.agent.aggregator.dogstatsd_context_limiter.num_origins\",\n\t\tHost: hostname,\n\t\tTags: tagset.NewCompositeTags(constTags, nil),\n\t\tMType: metrics.APIGaugeType,\n\t\tPoints: []metrics.Point{{Ts: timestamp, Value: float64(len(l.usage))}},\n\t})\n\n\tif l.global < math.MaxInt {\n\t\tseries.Append(&metrics.Serie{\n\t\t\tName: \"datadog.agent.aggregator.dogstatsd_context_limiter.global_limit\",\n\t\t\tHost: hostname,\n\t\t\tTags: tagset.NewCompositeTags(constTags, nil),\n\t\t\tMType: metrics.APIGaugeType,\n\t\t\tPoints: []metrics.Point{{Ts: timestamp, Value: float64(l.global)}},\n\t\t})\n\t}\n\n\tfor _, e := range l.usage {\n\t\tseries.Append(&metrics.Serie{\n\t\t\tName: \"datadog.agent.aggregator.dogstatsd_context_limiter.limit\",\n\t\t\tHost: hostname,\n\t\t\tTags: tagset.NewCompositeTags(constTags, e.telemetryTags),\n\t\t\tMType: metrics.APIGaugeType,\n\t\t\tPoints: []metrics.Point{{Ts: timestamp, Value: float64(l.limit)}},\n\t\t})\n\n\t\tseries.Append(&metrics.Serie{\n\t\t\tName: \"datadog.agent.aggregator.dogstatsd_context_limiter.current\",\n\t\t\tHost: hostname,\n\t\t\tTags: tagset.NewCompositeTags(constTags, e.telemetryTags),\n\t\t\tMType: metrics.APIGaugeType,\n\t\t\tPoints: []metrics.Point{{Ts: timestamp, Value: float64(e.current)}},\n\t\t})\n\n\t\tseries.Append(&metrics.Serie{\n\t\t\tName: \"datadog.agent.aggregator.dogstatsd_samples_dropped\",\n\t\t\tHost: hostname,\n\t\t\tTags: tagset.NewCompositeTags(droppedTags, e.telemetryTags),\n\t\t\tMType: metrics.APICountType,\n\t\t\tPoints: []metrics.Point{{Ts: timestamp, Value: float64(e.rejected)}},\n\t\t})\n\t\te.rejected = 0\n\t}\n}", "title": "" }, { "docid": "9c492cdeb0f8e9be7eff8469e0a5b5e0", "score": "0.45503348", "text": "func createContext(timeout int) context.Context {\n\ttimestr := strconv.Itoa(timeout)\n\ttimestr = timestr + `s`\n\td, _ := time.ParseDuration(timestr)\n\tctx := context.Background()\n\tctx, _ = context.WithTimeout(ctx, d)\n\treturn ctx\n}", "title": "" }, { "docid": "fd50fa4d9c2929c305f510c34dbe0e43", "score": "0.45437074", "text": "func (q QueryString) Context(t time.Time) QueryString {\n\tif !t.IsZero() {\n\t\treturn q.Append(fmt.Sprintf(\".Context(%d)\", common.UnixMillis(t)))\n\t}\n\treturn q\n}", "title": "" }, { "docid": "983ae1c953b610bbf297c1ce8b98bd41", "score": "0.45276612", "text": "func (m *Metrics) RecordBPFMetrics() error {\n\tgo func() {\n\t\tfor range time.Tick(m.MetricsInterval) {\n\t\t\tBPFMetrics, err := m.fetchBPFMetrics()\n\t\t\tif err != nil {\n\t\t\t\tm.Logger.Error().Err(err).Msg(\"error fetching bpf metrics\")\n\t\t\t}\n\t\t\tfor key := range BPFMetrics {\n\t\t\t\tvfsHit := fmt.Sprintf(\"bpf.by_host.%s.%s.kprobe.hit_rate.minutely\", quote(m.Hostname), key)\n\t\t\t\tvfsMiss := fmt.Sprintf(\"bpf.by_host.%s.%s.kprobe.miss_rate.minutely\", quote(m.Hostname), key)\n\t\t\t\tgoMetrics.GetOrRegisterGauge(vfsHit, m.EveryMinuteRegister).Update(BPFMetrics[key].hitRate)\n\t\t\t\tgoMetrics.GetOrRegisterGauge(vfsMiss, m.EveryMinuteRegister).Update(BPFMetrics[key].missedRate)\n\t\t\t\tif m.RoleName != \"\" {\n\t\t\t\t\tvfsHitByRole := fmt.Sprintf(\"bpf.by_role.%s.%s.kprobe.hit_rate.minutely\", quote(m.RoleName), key)\n\t\t\t\t\tvfsMissByRole := fmt.Sprintf(\"bpf.by_role.%s.%s.kprobe.miss_rate.minutely\", quote(m.RoleName), key)\n\t\t\t\t\tgoMetrics.GetOrRegisterGauge(vfsHitByRole, m.EveryMinuteRegister).Update(BPFMetrics[key].hitRate)\n\t\t\t\t\tgoMetrics.GetOrRegisterGauge(vfsMissByRole, m.EveryMinuteRegister).Update(BPFMetrics[key].missedRate)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "ea7334b97e928b94661706cb2ed85b1b", "score": "0.45231783", "text": "func context() c.Context {\n\tx, _ := c.WithTimeout(c.TODO(), 10*time.Second)\n\treturn x\n}", "title": "" }, { "docid": "d8d0c008262cb5157c0886e951f33689", "score": "0.45102307", "text": "func collectPerformanceCounters(ctx context.Context, interval time.Duration) (counters map[string]time.Duration, megaPeriods int64, err error) {\n\tvar perfCounters = []struct {\n\t\tfilePath string\n\t\teventName string\n\t\toutputName string\n\t}{\n\t\t// \"actual-frequency\" is NOT a frequency, but an accumulation of cycles.\n\t\t{\"/sys/devices/i915/events/actual-frequency\", \"i915/actual-frequency/\", \"megaperiod\"},\n\t\t{\"/sys/devices/i915/events/rcs0-busy\", \"i915/rcs0-busy/\", \"rcs\"},\n\t\t{\"/sys/devices/i915/events/vcs0-busy\", \"i915/vcs0-busy/\", \"vcs\"},\n\t\t{\"/sys/devices/i915/events/vecs0-busy\", \"i915/vecs0-busy/\", \"vecs\"},\n\t}\n\n\tvar eventsToCollect []string\n\tfor _, perfCounter := range perfCounters {\n\t\tif _, err := os.Stat(perfCounter.filePath); err == nil {\n\t\t\teventsToCollect = append(eventsToCollect, perfCounter.eventName)\n\t\t} else {\n\t\t\ttesting.ContextLogf(ctx, \"Could not find %s perf event file (error: %v)\", perfCounter.filePath, err)\n\t\t}\n\t}\n\n\tif len(eventsToCollect) == 0 {\n\t\treturn nil, 0, nil\n\t}\n\n\t// Run the command e.g. `perf stat -e i915/vcs0-busy/ -- sleep 2`\n\tcmd := testexec.CommandContext(ctx,\n\t\t\"/usr/bin/perf\", \"stat\", \"-e\", strings.Join(eventsToCollect, \",\"), \"--\", \"sleep\",\n\t\tstrconv.FormatInt(int64(interval/time.Second), 10))\n\t_, stderr, err := cmd.SeparatedOutput()\n\tif err != nil {\n\t\treturn nil, 0, errors.Wrap(err, \"error while measuring perf counters\")\n\t}\n\tperfOutput := string(stderr)\n\n\t// A sample multiple counter output perfOutput could be e.g.:\n\t// Performance counter stats for 'system wide':\n\t//\n\t// 8215 M i915/actual-frequency/\n\t// 17188646693 ns i915/rcs0-busy/\n\t// 11937916640 ns i915/vcs0-busy/\n\t// 12894570939 ns i915/vecs0-busy/\n\t//\n\t// 25.001367738 seconds time elapsed\n\tcounters = make(map[string]time.Duration)\n\n\tregexps := make(map[string]*regexp.Regexp)\n\tfor _, perfCounter := range perfCounters {\n\t\tregexps[perfCounter.outputName] = regexp.MustCompile(`([0-9]+ ns)\\s*` + regexp.QuoteMeta(perfCounter.eventName))\n\t}\n\t// Add and extra regexp for the overall time elapsed.\n\tregexps[\"total\"] = regexp.MustCompile(\"([0-9]+[.][0-9]+ s)econds time elapsed\")\n\n\tperfLines := strings.Split(perfOutput, \"\\n\")\n\tfor _, line := range perfLines {\n\t\tfor name, r := range regexps {\n\t\t\tsubmatch := r.FindStringSubmatch(line)\n\t\t\tif submatch == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// ParseDuration() cannot parse whitespaces in the input string.\n\t\t\tcounters[name], err = time.ParseDuration(strings.Replace(string(submatch[1]), \" \", \"\", -1))\n\t\t\tif err != nil {\n\t\t\t\tdir, ok := testing.ContextOutDir(ctx)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, 0, errors.New(\"failed to retrieve output directory\")\n\t\t\t\t}\n\t\t\t\tconst outFile = \"perf_stat_output.log\"\n\t\t\t\tif err := ioutil.WriteFile(filepath.Join(dir, outFile), stderr, 0644); err != nil {\n\t\t\t\t\ttesting.ContextLogf(ctx, \"Failed to dump perf output to %s: %v\", outFile, err)\n\t\t\t\t}\n\t\t\t\treturn nil, 0, errors.Wrapf(err, \"error parsing perf output, see %s if present\", outFile)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Run and extra regexp pass for the GPU actual-frequency. This information is\n\t// provided as a number-of-accumulated mega cycles over the total time, see\n\t// https://patchwork.freedesktop.org/patch/339667/.\n\tregexpCycles := regexp.MustCompile(`([0-9]+)\\s*M\\s*` + \"i915/actual-frequency/\")\n\tfor _, line := range perfLines {\n\t\tsubmatch := regexpCycles.FindStringSubmatch(line)\n\t\tif submatch == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif megaPeriods, err = strconv.ParseInt(submatch[1], 10, 64); err != nil {\n\t\t\treturn nil, 0, errors.Wrapf(err, \"error parsing perf output (%s)\", perfOutput)\n\t\t}\n\t\tbreak\n\t}\n\n\treturn counters, megaPeriods, nil\n}", "title": "" }, { "docid": "55182a42fc5bb71e2be53360082ef43b", "score": "0.45016533", "text": "func Trace(ctx context.Context, settings *config.Settings) {\n\tprofile(ctx, settings.TraceProfilerSignal, func() error {\n\t\toutputFile := filepath.Join(settings.ProfileDirectory, settings.TraceProfileName)\n\t\treturn generateTrace(ctx, outputFile, settings.TraceProfileDuration)\n\t})\n}", "title": "" }, { "docid": "99bedb1e676cb4e8951a4f212d432c98", "score": "0.44978222", "text": "func (kub *Kubectl) reportMapContext(ctx context.Context, path string, reportCmds map[string]string, ns, selector string) {\n\tfor cmd, logfile := range reportCmds {\n\t\tresults, err := kub.ExecInPods(ctx, ns, selector, cmd, ExecOptions{SkipLog: true})\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorf(\"cannot retrieve command output '%s': %s\", cmd, err)\n\t\t}\n\n\t\tfor name, res := range results {\n\t\t\terr := os.WriteFile(\n\t\t\t\tfmt.Sprintf(\"%s/%s-%s\", path, name, logfile),\n\t\t\t\tres.CombineOutput().Bytes(),\n\t\t\t\tLogPerm)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).Errorf(\"cannot create test results for command '%s' from pod %s\", cmd, name)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dd4db7101ee1f78974126ff1a667f512", "score": "0.44914722", "text": "func TestCtx(t *testing.T) context.Context {\n\tctx, cancel := context.WithTimeout(context.Background(), WaitTimeout(t))\n\tt.Cleanup(cancel)\n\treturn ctx\n}", "title": "" }, { "docid": "7ff998bceec3fb3cd38b3a9118e853da", "score": "0.4490895", "text": "func StartPrintingBenchmarks(period time.Duration, startIndex int32) chan<- Bench {\n\tc := make(chan Bench, 100)\n\n\tcurrentIndex := startIndex\n\tdataMissing := 0\n\n\ttype statTally struct {\n\t\tstartedAt time.Time\n\t\tlatencies []int\n\t\ttotalLatency int\n\t\ttotalBytes int\n\n\t\tTally int `json:\"total\"`\n\t\tMeanLatency int `json:\"mean_latency_ns\"`\n\t\tMeanLatencyStr string `json:\"mean_latency\"`\n\t\tPercentileLatency int `json:\"99%_latency_ns\"`\n\t\tPercentileLatencyStr string `json:\"99%_latency\"`\n\t\tByteRate float64 `json:\"bytes_per_s\"`\n\t\tMessageRate float64 `json:\"msgs_per_s\"`\n\t}\n\n\tpStats := statTally{startedAt: time.Now()}\n\n\tupdateStats := func(bench Bench) {\n\t\tpStats.Tally++\n\t\tpStats.latencies = append(pStats.latencies, bench.Latency)\n\t\tpStats.totalLatency = pStats.totalLatency + bench.Latency\n\t\tpStats.totalBytes = pStats.totalBytes + bench.NBytes\n\t}\n\n\trefreshPStats := func() {\n\t\tpStats = statTally{startedAt: time.Now()}\n\t}\n\n\tcalcStats := func() {\n\t\tif pStats.Tally > 0 {\n\t\t\tpStats.MeanLatency = pStats.totalLatency / pStats.Tally\n\t\t\tpStats.MeanLatencyStr = time.Duration(pStats.MeanLatency).String()\n\t\t\tpStats.ByteRate = float64(pStats.totalBytes) / time.Since(pStats.startedAt).Seconds()\n\t\t\tpStats.MessageRate = float64(pStats.Tally) / time.Since(pStats.startedAt).Seconds()\n\n\t\t\t// Calc 99th percentile\n\t\t\tindex := int(math.Ceil(0.99 * float64(pStats.Tally)))\n\t\t\tsort.Ints(pStats.latencies)\n\t\t\tif index < len(pStats.latencies) {\n\t\t\t\tpStats.PercentileLatency = pStats.latencies[index]\n\t\t\t\tpStats.PercentileLatencyStr = time.Duration(pStats.PercentileLatency).String()\n\t\t\t}\n\t\t}\n\t}\n\n\tgo func() {\n\t\ttimer := time.NewTicker(period)\n\t\tdefer timer.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase bench, open := <-c:\n\t\t\t\tif !open {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif startIndex != -1 {\n\t\t\t\t\tif startIndex == bench.Index {\n\t\t\t\t\t\t// Indicates that the producer index has been restarted.\n\t\t\t\t\t\tdataMissing = 0\n\t\t\t\t\t\tcurrentIndex = bench.Index\n\t\t\t\t\t}\n\t\t\t\t\tif bench.Index == currentIndex {\n\t\t\t\t\t\tcurrentIndex = bench.Index + 1\n\t\t\t\t\t} else if bench.Index < currentIndex {\n\t\t\t\t\t\tdataMissing--\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor i := currentIndex; i < bench.Index; i++ {\n\t\t\t\t\t\t\tdataMissing++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcurrentIndex = bench.Index + 1\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tupdateStats(bench)\n\t\t\tcase <-timer.C:\n\t\t\t\tcalcStats()\n\t\t\t\tblob, err := json.Marshal(pStats)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\t\t\t\tfmt.Println(string(blob))\n\t\t\t\tif dataMissing > 0 {\n\t\t\t\t\tfmt.Printf(\"{\\\"data_missing\\\":%v}\\n\", dataMissing)\n\t\t\t\t}\n\t\t\t\trefreshPStats()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn c\n}", "title": "" }, { "docid": "837ad68b5b8b8c68df3ee643516820f1", "score": "0.4486652", "text": "func timeoutCtx(t *testing.T, timeout time.Duration) context.Context {\n\tctxt, cancel := context.WithTimeout(context.Background(), timeout)\n\tt.Cleanup(cancel)\n\treturn ctxt\n}", "title": "" }, { "docid": "b82b204e5d1721edb65eb1318d885739", "score": "0.44835904", "text": "func TrackContext(success bool) {\n\tif config.RunningInInstaller() {\n\t\treturn\n\t}\n\ttrack(contextEvent, success, nil)\n}", "title": "" }, { "docid": "0f2704003461e780fe9c1b8756392323", "score": "0.44806734", "text": "func addLatencyMetric(p *perf.Values, name string, latencyMS float64) {\n\tm := perf.Metric{\n\t\tName: name,\n\t\tUnit: \"ms\",\n\t\tDirection: perf.SmallerIsBetter,\n\t}\n\tp.Set(m, latencyMS)\n}", "title": "" }, { "docid": "791192b1669ca73299b12ccca973905d", "score": "0.44784242", "text": "func timeTrack(start time.Time, endpoint string) {\n\tconfig := LoadConfig(\"./config.json\")\n\tsession := connect()\n\tdefer session.Close()\n\tcollection := session.DB(\"stats\").C(\"slow_requests\")\n\telapsed := time.Since(start).Seconds()\n\tif elapsed > config.Threshold { // Response time higher than threshold\n\t\te := fmt.Sprintf(\"%.1f\", elapsed) + \"s\"\n\t\t_, err := collection.Upsert(bson.M{\"endpoint\": endpoint}, &Slow{endpoint, e})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tlog.Printf(\"** SLOW REQUEST - [%s] took %s **\", endpoint, e)\n\t}\n}", "title": "" }, { "docid": "e4761c0cd91741770809cd06687f6610", "score": "0.44736066", "text": "func do3SecondsOfWorkWithAContext(ctx context.Context, data string) {\n\tfmt.Printf(\"We're going and doing some work here... work work work\\n\")\n\n\tfmt.Printf(\"We're working with '%s'\\n\", data)\n\tfmt.Printf(\"We're pretending we're making an outbound request\\n\")\n\n\t_ = simulateNetworkRequestWithContext(ctx, time.Second)\n\n\tfmt.Printf(\"Great! we've gotten some data back and doing some work.\\n\")\n\n\tfmt.Printf(\"We're going and making another outbound request, this one will be slower\\n\")\n\n\tok := simulateNetworkRequestWithContext(ctx, time.Second*2)\n\n\tif ok {\n\t\tfmt.Printf(\"Great! we got our data back and we're done!\\n\")\n\t} else {\n\t\tfmt.Printf(\"Sad face! We didn't complete the request in time\\n\")\n\t}\n}", "title": "" }, { "docid": "9cfc86ca6f7e933c65078cdb81be6355", "score": "0.44497454", "text": "func (client *Client) TimingSampled(metric string, val int64, sampleRate float32) {\n\tclient.Send(metric, fmt.Sprintf(\"%d\", val), \"ms\", sampleRate)\n}", "title": "" }, { "docid": "1cfaf4b8dda1b0619e1f97c4fc221893", "score": "0.4433387", "text": "func SleepContext(ctx context.Context, duration time.Duration) error {\n\tif duration == 0 {\n\t\treturn nil\n\t}\n\n\tt := time.NewTimer(duration)\n\tselect {\n\tcase <-t.C:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\tt.Stop()\n\t\treturn ctx.Err()\n\t}\n}", "title": "" }, { "docid": "2d82c5e613cc7e046865693415261f8d", "score": "0.44220918", "text": "func CTimeLog(ctx context.Context, name string, start time.Time, out func(context.Context, string, ...interface{})) {\n\tout(ctx, \"time> %s: %s\", name, time.Since(start))\n}", "title": "" }, { "docid": "c46fb24de0648981b8d2a9682b41e553", "score": "0.44218114", "text": "func (c *contextMetrics) RecordTimer(ctx context.Context, name string, d time.Duration) {\n\tgetScope(ctx, c.scope).Timer(name).Record(d)\n}", "title": "" }, { "docid": "9de584340fa454488f9bff0305abbdbc", "score": "0.43953863", "text": "func (mr *MockForward_SendMetricsV2ServerMockRecorder) Context() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Context\", reflect.TypeOf((*MockForward_SendMetricsV2Server)(nil).Context))\n}", "title": "" }, { "docid": "8848ba477bb8a89542866d112734e554", "score": "0.43499315", "text": "func WithContextTimeout(timeout time.Duration) router.Middleware {\n\treturn func(c *router.Context, next router.Handler) {\n\t\tvar cancel context.CancelFunc\n\t\tc.Context, cancel = clock.WithTimeout(c.Context, timeout)\n\t\tdefer cancel()\n\t\tnext(c)\n\t}\n}", "title": "" }, { "docid": "58e449a4f8803d5f0f4f2e3c18699d10", "score": "0.43487138", "text": "func main() {\n\twg := sync.WaitGroup{} // just to wait the program to finish.\n\twg.Add(1)\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\n\t// The context timeout timer starts running as soon as it is created!\n\t// Not as soon as it is passed to another function.\n\ttime.Sleep(3 * time.Second) // only 1 \"Doing my job\" will be printed to illustrate this.\n\n\tdefer cancel()\n\tgo func(ctx context.Context) {\n\t\tdefer wg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(1 * time.Second):\n\t\t\t\tfmt.Println(\"Doing my job\")\n\t\t\tcase <-ctx.Done():\n\t\t\t\tfmt.Println(\"Context done\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(ctx)\n\n\t<-ctx.Done()\n\twg.Wait()\n}", "title": "" }, { "docid": "6a569ee15b6dda3a5f7a441566562b1c", "score": "0.43476894", "text": "func monitor() {\n\tticker := time.NewTicker(1 * time.Second)\n\tdefer ticker.Stop()\n\n\tvar lastTime time.Time\n\tvar lastN int64\n\tvar lastLatency float64\n\tfor range ticker.C {\n\t\tnow, n := time.Now(), requestCountVar.Value()\n\t\tlatency := requestTotalLatencyVar.Value()\n\n\t\tif !lastTime.IsZero() {\n\t\t\telapsed := lastTime.Sub(now).Seconds()\n\t\t\tif n > 0 {\n\t\t\t\trequestCurrentLatencyVar.Set((lastLatency - latency) / float64(n))\n\t\t\t}\n\t\t\trequestPerSecVar.Set(float64(lastN-n) / elapsed)\n\t\t}\n\t\tlastTime, lastN, lastLatency = now, n, latency\n\t}\n}", "title": "" }, { "docid": "4575424f2e41e40f93b96b7aeacd7ade", "score": "0.43405008", "text": "func (it *insertTask) TraceCtx() context.Context {\n\treturn it.ctx\n}", "title": "" }, { "docid": "903090614cdd0ff5a0c644ac31ed8ee9", "score": "0.43344623", "text": "func reportStats() {\n\tvar oldStats, newStats progStats\n\tlog.Printf(\"Reporting stats every %v seconds\", opts.ReportPeriodSecs)\n\tfor {\n\t\ttime.Sleep(time.Second * time.Duration(opts.ReportPeriodSecs))\n\n\t\toldStats = newStats\n\t\tnewStats = stats\n\t\tlog.Printf(\"STATS success: %d, failures: %d, query_rate: %d/sec\",\n\t\t\tnewStats.Success, newStats.Failures,\n\t\t\t(newStats.Success-oldStats.Success)/uint32(opts.ReportPeriodSecs))\n\t}\n}", "title": "" }, { "docid": "e8dfc387e4d834f0149501c53d537ba7", "score": "0.43210027", "text": "func measureExecTime(h http.HandlerFunc) http.HandlerFunc {\n\t// wrap handlerFunc to add some functionality\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// for measuring time we need start time and stop time\n\t\t// to get duration of action\n\t\tstart := time.Now()\n\t\t// call h which is HandlerFunc\n\t\th(w, r)\n\t\t// print to console execution duration with time.Since(Start))\n\t\tlog.Println(\"handler execution time =>\", time.Since(start))\n\t}\n}", "title": "" }, { "docid": "d3843b5ff9989e236a56ce905d9056b5", "score": "0.43140924", "text": "func traceMiddleware() echo.MiddlewareFunc {\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) (err error) {\n\t\t\treq := c.Request()\n\t\t\tres := c.Response()\n\n\t\t\t// set childCtx so each API request will creates new serverSpan log\n\t\t\tspanCtx, _ := opentracing.GlobalTracer().Extract(\n\t\t\t\topentracing.HTTPHeaders,\n\t\t\t\topentracing.HTTPHeadersCarrier(req.Header),\n\t\t\t)\n\n\t\t\tserverSpan := opentracing.StartSpan(c.Request().URL.Path, ext.RPCServerOption(spanCtx))\n\t\t\tc.Set(\"serverSpan\", serverSpan)\n\n\t\t\tdefer func() {\n\t\t\t\tserverSpan.Finish()\n\t\t\t}()\n\n\t\t\tvar headers []log.Field\n\t\t\tfor k, v := range req.Header {\n\t\t\t\theaders = append(headers, log.String(k, strings.Join(v, \", \")))\n\t\t\t}\n\n\t\t\tserverSpan.LogFields(\n\t\t\t\theaders...,\n\t\t\t)\n\n\t\t\ttraceID := \"no-tracer-id\"\n\t\t\tif sc, ok := serverSpan.Context().(jaeger.SpanContext); ok {\n\t\t\t\ttraceID = sc.String()\n\t\t\t}\n\n\t\t\t// inject to response header\n\t\t\topentracing.GlobalTracer().Inject(\n\t\t\t\tserverSpan.Context(),\n\t\t\t\topentracing.HTTPHeaders,\n\t\t\t\topentracing.HTTPHeadersCarrier(c.Response().Header()),\n\t\t\t)\n\n\t\t\tserverSpan.SetTag(\"endpoint\", req.RequestURI)\n\t\t\tserverSpan.SetTag(\"host\", req.Host)\n\t\t\tserverSpan.SetTag(\"clientIP\", c.RealIP())\n\t\t\tserverSpan.SetTag(\"http.status\", res.Status)\n\t\t\tserverSpan.SetTag(\"userAgent\", req.UserAgent())\n\n\t\t\tstart := time.Now()\n\t\t\t// continue the request\n\t\t\tif errMiddleware := next(c); errMiddleware != nil {\n\t\t\t\tc.Error(errMiddleware)\n\t\t\t\tc.Response().Committed = true\n\t\t\t\treturn errMiddleware\n\t\t\t}\n\n\t\t\tstop := time.Now()\n\n\t\t\tlogger.Debug().\n\t\t\t\tFloat64(\"duration\", float64(stop.Sub(start).Nanoseconds())/float64(time.Millisecond)).\n\t\t\t\tInt(\"status\", res.Status).\n\t\t\t\tStr(\"protocol\", req.Proto).\n\t\t\t\tStr(\"endpoint\", req.RequestURI).\n\t\t\t\tStr(\"host\", req.Host).\n\t\t\t\tStr(\"clientIP\", c.RealIP()).\n\t\t\t\tStr(\"method\", req.Method).\n\t\t\t\tStr(\"tracerID\", traceID).\n\t\t\t\tMsg(\"handle request\")\n\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8bd7c25581bd862c8fd2892fbed66931", "score": "0.43060425", "text": "func (i *Server) withDiagnostics(_ context.Context) error {\n\thealth := i.health\n\ti.HandleFunc(HealthEndpoint, func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t\tif !health() {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tfmt.Fprint(w, `ok`)\n\t})\n\ti.HandleFunc(\"/debug/pprof/\", pprof.Index)\n\ti.HandleFunc(\"/debug/pprof/cmdline\", pprof.Cmdline)\n\ti.HandleFunc(\"/debug/pprof/profile\", pprof.Profile)\n\ti.HandleFunc(\"/debug/pprof/symbol\", pprof.Symbol)\n\ti.HandleFunc(\"/debug/pprof/trace\", pprof.Trace)\n\ti.HandleFunc(\"/debug/pprof/delta_heap\", deltapprof.Heap)\n\ti.HandleFunc(\"/debug/pprof/delta_block\", deltapprof.Block)\n\ti.HandleFunc(\"/debug/pprof/delta_mutex\", deltapprof.Mutex)\n\treturn nil\n}", "title": "" }, { "docid": "f6b668947c6bc11428dc8da424aa32ea", "score": "0.4303033", "text": "func (mr *MockTagsAwareTimerMockRecorder) WithContext(ctx interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"WithContext\", reflect.TypeOf((*MockTagsAwareTimer)(nil).WithContext), ctx)\n}", "title": "" }, { "docid": "351a6cd9937c8f6c01ca18d6bca5ff21", "score": "0.42989275", "text": "func (conn *Conn) PingContext(ctx context.Context) error {\n\tspan := opentracing.SpanFromContext(ctx)\n\tif span != nil {\n\t\tnewSpan := conn.tracer.StartSpan(\n\t\t\tfmt.Sprintf(\"conn.ping\"),\n\t\t\topentracing.ChildOf(span.Context()),\n\t\t)\n\t\text.Component.Set(newSpan, \"database/sql\")\n\t\text.SpanKind.Set(newSpan, \"client\")\n\t\tctx = opentracing.ContextWithSpan(ctx, newSpan)\n\t\tdefer newSpan.Finish()\n\t}\n\treturn conn.Conn.PingContext(ctx)\n}", "title": "" }, { "docid": "20115f8ee5a48195abab164d4319e3e8", "score": "0.42937034", "text": "func DebugContext(ctx context.Context, format string, v ...interface{}) {\n\tif getActiveLogLevel() >= logLevel[LogLevelDebug] {\n\t\tmessage := fmt.Sprintf(logPrefix[LogLevelDebug]+\" ReqID \"+extractReqID(ctx)+\" - \"+format, v...)\n\t\tlog.Print(message)\n\t}\n}", "title": "" }, { "docid": "1aa1c6333aa915c7901979431eed9383", "score": "0.4291876", "text": "func calculatePerSessionLatency(model benchmarking.Model) map[sessionKey]sessionLatencies {\n\tcat := \"gfx\"\n\tscheduleEvents := getEventsPerSession(model, cat, \"Session::ScheduleUpdate\")\n\tapplyEvents := getEventsPerSession(model, cat, \"Session::ApplyScheduledUpdates\")\n\tpresentEventName := \"DisplaySwapchain::DrawAndPresent() present\"\n\tpresentEvents := model.FindEvents(benchmarking.EventsFilter{Cat: &cat, Name: &presentEventName})\n\tstartOfGpuWorkEventName := \"Scenic Compositor\"\n\tstartOfGpuWorkEvents := model.FindEvents(benchmarking.EventsFilter{Cat: &cat, Name: &startOfGpuWorkEventName})\n\tendOfGpuWorkEventName := \"escher::CommandBuffer::Retire::callback\"\n\tendOfGpuWorkEvents := model.FindEvents(benchmarking.EventsFilter{Cat: &cat, Name: &endOfGpuWorkEventName})\n\n\tvsyncName := \"VSYNC\"\n\tvsyncEvents := model.FindEvents(benchmarking.EventsFilter{Cat: &cat, Name: &vsyncName})\n\tsort.Sort(ByStartTime(vsyncEvents))\n\tframeLength := vsyncEvents[1].Start - vsyncEvents[0].Start\n\tframeLength = convertMicrosToMillis([]float64{frameLength})[0]\n\n\tlatencyPerSession := make(map[sessionKey]sessionLatencies)\n\tfor session, scheduleEventsOfSession := range scheduleEvents {\n\t\tlatencyPerSession[session] = calculateSessionLatency(scheduleEventsOfSession, applyEvents[session], presentEvents, startOfGpuWorkEvents, endOfGpuWorkEvents, vsyncEvents, frameLength)\n\t}\n\n\treturn latencyPerSession\n}", "title": "" }, { "docid": "97b47289434e00130c81d070ab12d9b6", "score": "0.42898518", "text": "func InfoContext(ctx context.Context, format string, v ...interface{}) {\n\tif getActiveLogLevel() >= logLevel[LogLevelInfo] {\n\t\tmessage := fmt.Sprintf(logPrefix[LogLevelInfo]+\" ReqID \"+extractReqID(ctx)+\" - \"+format, v...)\n\t\tlog.Print(message)\n\t}\n}", "title": "" }, { "docid": "a86e645a8ff53e9ff15c4d2cbb490899", "score": "0.42896977", "text": "func measureTime(f measuredFunc, expectedMs float64) (okTime, okResult bool, stderr, stdout string, actualMs float64) {\n\tdone := make(chan bool)\n\tt1 := time.Now()\n\n\tgo func() {\n\t\tokResult, stderr, stdout = f()\n\t\tclose(done)\n\t}()\n\n\tselect {\n\tcase <-done:\n\t\tokTime = true\n\tcase <-time.After(time.Duration(expectedMs) * time.Millisecond):\n\t}\n\tactualMs = time.Since(t1).Seconds() * 1000\n\treturn\n}", "title": "" }, { "docid": "c30c95c396e754a09b1787933d1aa741", "score": "0.42872548", "text": "func (s *session) start() error {\n\tctx, cancel := context.WithTimeout(context.Background(), s.timeout)\n\tdefer cancel()\n\t// If the process does not create Diagnostic Server, the next call will\n\t// fail, and a session won't be created.\n\tclient := dotnetdiag.NewClient(waitDiagnosticServer(ctx, s.pid))\n\tns, err := client.CollectTracing(s.config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstream := nettrace.NewStream(ns)\n\ttrace, err := stream.Open()\n\tif err != nil {\n\t\t_ = ns.Close()\n\t\treturn err\n\t}\n\n\tp := profiler.NewSampleProfiler(trace, profilerOptions...)\n\tstream.EventHandler = p.EventHandler\n\tstream.MetadataHandler = p.MetadataHandler\n\tstream.StackBlockHandler = p.StackBlockHandler\n\tstream.SequencePointBlockHandler = p.SequencePointBlockHandler\n\n\ts.session = ns\n\ts.ch = make(chan line)\n\tgo func() {\n\t\tdefer func() {\n\t\t\ts.session = nil\n\t\t\tclose(s.ch)\n\t\t}()\n\t\tfor {\n\t\t\tswitch err = stream.Next(); err {\n\t\t\tdefault:\n\t\t\tcase nil:\n\t\t\t\tcontinue\n\t\t\tcase io.EOF:\n\t\t\t\t// The session is closed by us (on flush or stop call),\n\t\t\t\t// or the target process has exited.\n\t\t\t\tfor k, v := range p.Samples() {\n\t\t\t\t\t// dotnet profiler reports total time v per call stack k.\n\t\t\t\t\t// Meanwhile, pyroscope agent expects number of samples is\n\t\t\t\t\t// reported. Every sample is a time fraction of second\n\t\t\t\t\t// according to sample rate: 1000ms/100 = 10ms by default.\n\t\t\t\t\t// To represent reported time v as a number of samples,\n\t\t\t\t\t// we divide it by sample duration.\n\t\t\t\t\t//\n\t\t\t\t\t// Taking into account that under the hood dotnet spy uses\n\t\t\t\t\t// Microsoft-DotNETCore-SampleProfiler, which captures a\n\t\t\t\t\t// snapshot of each thread's managed callstack every 10 ms,\n\t\t\t\t\t// we cannot manage sample rate from outside.\n\t\t\t\t\ts.ch <- line{\n\t\t\t\t\t\tname: []byte(k),\n\t\t\t\t\t\tval: int(v.Milliseconds()) / 10,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "ab9fab8cca892ce96da2640bed790055", "score": "0.42851245", "text": "func SleepWithContext(ctx context.Context, dur time.Duration) error {\n\tt := time.NewTimer(dur)\n\tdefer t.Stop()\n\n\tselect {\n\tcase <-t.C:\n\t\tbreak\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c074612c7cee1d898452579bc4221fdb", "score": "0.42840537", "text": "func RTCPeerConnectionPerf(ctx context.Context, s *testing.State) {\n\ttestOpt := s.Param().(rtcPerfTest)\n\tif err := peerconnection.RunDecodePerf(ctx, s.PreValue().(*chrome.Chrome), s.DataFileSystem(), s.OutDir(), testOpt.profile, testOpt.enableHWAccel, testOpt.videoGridDimension, testOpt.videoGridFile); err != nil {\n\t\ts.Error(\"Failed to measure performance: \", err)\n\t}\n}", "title": "" }, { "docid": "d7d5c4bf352eb9f708817fe92f8cf76f", "score": "0.42800185", "text": "func timeTrack(start time.Time, name string) {\n elapsed := time.Since(start)\n log.Printf(\"Tiempo %s : %s\", name, elapsed)\n}", "title": "" }, { "docid": "78d627e5a3eff25bb0586ff0ead8b599", "score": "0.42799902", "text": "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tlog.Printf(\"%s took %s\\n\", name, elapsed)\n}", "title": "" }, { "docid": "f5af9d60b4e3cafa5b4b03819945884d", "score": "0.42782873", "text": "func (p PrometheusClient) MeasureDurationMs(\n\tkey MetricName,\n\tlabelValueGetters map[string]func() string,\n) func() {\n\t// Capture start time\n\tstarttime := time.Now()\n\t// Return function to measure and log the duration since start time\n\treturn func() {\n\t\t// Evaluate the labels\n\t\tlabels := map[string]string{}\n\t\tfor key, f := range labelValueGetters {\n\t\t\tlabels[key] = f()\n\t\t}\n\t\t// Log measurement\n\t\tp.MeasureDurationMsSince(key, starttime, labels)\n\t}\n}", "title": "" }, { "docid": "223d8ee2b0066f6794a1474feaa34faa", "score": "0.42781055", "text": "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"'%s' took %.3fs\\n\", name, elapsed.Seconds())\n}", "title": "" }, { "docid": "5ed59056d69f47d5cf2bac76a3553569", "score": "0.42737377", "text": "func timeoutContext() (context.Context, context.CancelFunc) {\n\treturn context.WithTimeout(context.Background(), time.Duration(60)*time.Second)\n}", "title": "" }, { "docid": "4b0818ed8638de56f91dc35a555742eb", "score": "0.427362", "text": "func TimeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tlog.Printf(\"%s took %s\", name, elapsed)\n}", "title": "" }, { "docid": "b0efb8bfa025a071f76c5502b87cda2d", "score": "0.4270943", "text": "func (obj *ServerF) ReportVersionWithContext(tarsCtx context.Context, app string, serverName string, version string, opts ...map[string]string) (ret int32, err error) {\n\tvar (\n\t\tlength int32\n\t\thave bool\n\t\tty byte\n\t)\n\tbuf := codec.NewBuffer()\n\terr = buf.WriteString(app, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = buf.WriteString(serverName, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = buf.WriteString(version, 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar statusMap map[string]string\n\tvar contextMap map[string]string\n\tif len(opts) == 1 {\n\t\tcontextMap = opts[0]\n\t} else if len(opts) == 2 {\n\t\tcontextMap = opts[0]\n\t\tstatusMap = opts[1]\n\t}\n\n\ttarsResp := new(requestf.ResponsePacket)\n\terr = obj.servant.TarsInvoke(tarsCtx, 0, \"reportVersion\", buf.ToBytes(), statusMap, contextMap, tarsResp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\treadBuf := codec.NewReader(tools.Int8ToByte(tarsResp.SBuffer))\n\terr = readBuf.ReadInt32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(opts) == 1 {\n\t\tfor k := range contextMap {\n\t\t\tdelete(contextMap, k)\n\t\t}\n\t\tfor k, v := range tarsResp.Context {\n\t\t\tcontextMap[k] = v\n\t\t}\n\t} else if len(opts) == 2 {\n\t\tfor k := range contextMap {\n\t\t\tdelete(contextMap, k)\n\t\t}\n\t\tfor k, v := range tarsResp.Context {\n\t\t\tcontextMap[k] = v\n\t\t}\n\t\tfor k := range statusMap {\n\t\t\tdelete(statusMap, k)\n\t\t}\n\t\tfor k, v := range tarsResp.Status {\n\t\t\tstatusMap[k] = v\n\t\t}\n\t}\n\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "title": "" }, { "docid": "3058ff93321f7b4f34781371e3eaad99", "score": "0.4270835", "text": "func countSendRespTime(owner, traceSn, funcName string, appid uint16) func() {\n\treturn countResponseTime(owner, traceSn, funcName, appid, requestStat.AtomicAddSendRespTime)\n}", "title": "" }, { "docid": "7ab982dabf50180a03e10cafca7cf6c4", "score": "0.42608404", "text": "func (s *loggingSpan) GetCtx() context.Context { return s.ctx }", "title": "" }, { "docid": "fd9cd5a87a20fc54e924239d2c81abcd", "score": "0.4259113", "text": "func startMeasuring(ctx context.Context, request *http.Request, conn *websocket.Conn, dataDir string) chan model.Measurement {\n\tdst := make(chan model.Measurement)\n\tgo measuringLoop(ctx, request, conn, dataDir, dst)\n\treturn dst\n}", "title": "" }, { "docid": "ad13631210e66b31e5fbf3dd48d3e4cd", "score": "0.42588982", "text": "func AddCtxMetric(ctx context.Context, key string, value string) context.Context {\n\tuntypedMetrics := ctx.Value(MetricsKey)\n\tif untypedMetrics == nil {\n\t\tlogrus.Errorf(\"could not find a value in the provided context at the given key %s\", key)\n\t\treturn ctx\n\t}\n\tmetrics, ok := untypedMetrics.(Metrics)\n\tif !ok {\n\t\tlogrus.Errorf(\"expected the value in the provided context at the given key %s to be of type Metrics\", key)\n\t\treturn ctx\n\t}\n\n\tmetrics.mutex.Lock()\n\tdefer metrics.mutex.Unlock()\n\n\tmetrics.m[key] = value\n\treturn ctx\n}", "title": "" }, { "docid": "a4822b69a0b2670f446a1ac1667e52b5", "score": "0.42574444", "text": "func (o PrometheusSpecOutput) SecurityContext() PrometheusSpecSecurityContextPtrOutput {\n\treturn o.ApplyT(func(v PrometheusSpec) *PrometheusSpecSecurityContext { return v.SecurityContext }).(PrometheusSpecSecurityContextPtrOutput)\n}", "title": "" }, { "docid": "b8f3fcb334a961ffc8ad03d55c327771", "score": "0.42566448", "text": "func countResponseTime(owner, traceSn, funcName string, appid uint16, countFunc func(uint64) uint64) func() {\n\tstart := time.Now()\n\treturn func() {\n\t\telapsed := int64(time.Since(start))\n\t\tif elapsed > netConf().ResponseSlowThreshold {\n\t\t\tLogger.Warn(owner, appid, traceSn, funcName, \"Slow hanlding!\",\n\t\t\t\tfmt.Sprintf(\"used %.3f ms for reuqtest\", float64(elapsed)/float64(time.Millisecond)))\n\t\t}\n\t\tcountFunc(uint64(elapsed))\n\t}\n}", "title": "" }, { "docid": "2a7755d81a413505050fe86639b03b1c", "score": "0.4253566", "text": "func injectContextWithTimeout(ctx context.Context, next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctxWithTimeout, cancel := context.WithTimeout(ctx, REQ_TIMEOUT)\n\n\t\t// defer can to prevent context leaking\n\t\tdefer cancel()\n\n\t\tnext.ServeHTTP(w, r.WithContext(ctxWithTimeout))\n\t})\n}", "title": "" }, { "docid": "992f2dd60b71542e56c2e5325920b2e8", "score": "0.42506084", "text": "func warnOfExpensiveGenericRequest(lg *zap.Logger, warningApplyDuration time.Duration, now time.Time, reqStringer fmt.Stringer, prefix string, resp string, err error) {\n\tlg.Warn(\n\t\t\"apply request took too long\",\n\t\tzap.Duration(\"took\", time.Since(now)),\n\t\tzap.Duration(\"expected-duration\", warningApplyDuration),\n\t\tzap.String(\"prefix\", prefix),\n\t\tzap.String(\"request\", reqStringer.String()),\n\t\tzap.String(\"response\", resp),\n\t\tzap.Error(err),\n\t)\n\tslowApplies.Inc()\n}", "title": "" }, { "docid": "ba84b2fa3660d8d97841d0e0c9703dd9", "score": "0.42504248", "text": "func Timing(id string, value time.Duration, tags Tags) error {\n\treturn DefaultMetricsReporter.Timing(id, value, tags)\n}", "title": "" }, { "docid": "5a705d0ea80ee8b1ac87b947d225343d", "score": "0.42489526", "text": "func (self *TestBranch) Clock(callCtx *TreeCallCtx) {\n\tvar interval int64 //1 second\n\tif len(callCtx.Args) > 0 {\n\t\tif v, err := strconv.ParseInt((callCtx.Args)[0], 10, 64); err == nil {\n\t\t\tinterval = v\n\t\t} else {\n\t\t\tinterval = 1000\n\t\t}\n\n\t} else {\n\t\tinterval = 1000\n\t}\n\n\t/*\n\t\t//method 1\n\t\tfastjob.SetInterval(func(stop *chan bool) {\n\t\t\tif callCtx.IsClosed() {\n\t\t\t\t*stop <- true\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcurrentTime := time.Now().Format(\"15:04:05\")\n\t\t\tfmt.Println(currentTime)\n\t\t\tcallCtx.Notify(&currentTime)\n\t\t}, 100)\n\t*/\n\n\t// Method 2\n\treply := func(s *chan bool) {\n\t\tcurrentTime := time.Now().Format(\"15:04:05.999\")\n\t\tfmt.Println(currentTime)\n\t\tcallCtx.Notify(&currentTime)\n\t}\n\tstop := fastjob.SetInterval(reply, interval)\n\t/*\n\t\tcallCtx.WsCtx.On(\"Close\", \"TokenToRemove\", func() {\n\t\t\t// should \"off\" this callback\n\t\t\tdefer callCtx.WsCtx.Off(\"Close\", \"TokenToRemove\")\n\t\t\tlog.Println(\"Clock() stopped because connection closed\")\n\t\t\t*stop <- true\n\t\t})\n\t*/\n\tcallCtx.On(\"Kill\", func() { //Will be called both on ctx cancelled or ctx's websocket lost connection\n\t\tlog.Println(\"Clock() stopped because of cancell been called\")\n\t\t*stop <- true\n\t})\n\treply(nil)\n\n\t/*\n\t\t//Method 3 by SetTimeout\n\t\ttoken := \"123444\"\n\t\tvar stop *chan bool\n\t\tvar issue func()\n\t\tm := sync.Mutex{}\n\t\tissue = func() {\n\t\t\tm.Lock()\n\t\t\tstop = fastjob.SetTimeout(func() {\n\t\t\t\tcurrentTime := time.Now().Format(\"15:04:05\")\n\t\t\t\tfmt.Println(currentTime)\n\t\t\t\tcallCtx.Notify(&currentTime)\n\t\t\t\tissue()\n\t\t\t}, 100)\n\t\t\tm.Unlock()\n\t\t}\n\t\tcallCtx.WsCtx.On(\"Close\", token, func() {\n\t\t\tdefer callCtx.WsCtx.Off(\"Close\", token)\n\t\t\tlog.Println(\"Clock() called but connection closed\")\n\t\t\tm.Lock()\n\t\t\t*stop <- true\n\t\t\tm.Unlock()\n\t\t})\n\t\tissue()\n\t*/\n}", "title": "" }, { "docid": "b098e8a25e2be9d67590564ac9e90ada", "score": "0.42465323", "text": "func (d *Dialer) DialContext(\n\tctx context.Context, network, address string,\n) (net.Conn, error) {\n\t// this is the same timeout used by Go's net/http.DefaultTransport\n\tctx, cancel := context.WithTimeout(ctx, 30*time.Second)\n\tdefer cancel()\n\tstart := time.Now()\n\tconn, err := d.dialer.DialContext(ctx, network, address)\n\tstop := time.Now()\n\terr = errwrapper.SafeErrWrapperBuilder{\n\t\t// ConnID does not make any sense if we've failed and the error\n\t\t// does not make any sense (and is nil) if we succeded.\n\t\tDialID: d.dialID,\n\t\tError: err,\n\t\tOperation: \"connect\",\n\t}.MaybeBuild()\n\tconnID := safeConnID(network, conn)\n\ttxID := transactionid.ContextTransactionID(ctx)\n\td.handler.OnMeasurement(modelx.Measurement{\n\t\tConnect: &modelx.ConnectEvent{\n\t\t\tConnID: connID,\n\t\t\tDialID: d.dialID,\n\t\t\tDurationSinceBeginning: stop.Sub(d.beginning),\n\t\t\tError: err,\n\t\t\tNetwork: network,\n\t\t\tRemoteAddress: address,\n\t\t\tSyscallDuration: stop.Sub(start),\n\t\t\tTransactionID: txID,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &connx.MeasuringConn{\n\t\tConn: conn,\n\t\tBeginning: d.beginning,\n\t\tHandler: d.handler,\n\t\tID: connID,\n\t}, nil\n}", "title": "" }, { "docid": "17b3250bf9875ae844131ca3eb155285", "score": "0.42438883", "text": "func (conn *Conn) Latency() time.Duration {\n\treturn time.Duration(atomic.LoadUint32(&conn.latency))\n}", "title": "" }, { "docid": "d461a4d7dcff271a2031b31c269b15f2", "score": "0.42434108", "text": "func (m *MockForward_SendMetricsV2Server) Context() context.Context {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Context\")\n\tret0, _ := ret[0].(context.Context)\n\treturn ret0\n}", "title": "" }, { "docid": "9b911faa36d31764463a8d29390dd99e", "score": "0.4243051", "text": "func (t *Timer) Trace() {\n\tif !t.enable {\n\t\treturn\n\t}\n\tnow := time.Now()\n\tif len(t.subs) > 0 {\n\t\tlast := t.subs[len(t.subs)-1]\n\t\tlast.end = now\n\t}\n\tsubInfo := make([]string, len(t.subs))\n\tfor i, sub := range t.subs {\n\t\ttook := sub.end.Sub(sub.start)\n\t\tinfo := fmt.Sprintf(\"%s: %v\", sub.name, took)\n\t\tsubInfo[i] = info\n\t}\n\n\ttotal := time.Since(t.start)\n\tinfo := fmt.Sprintf(\"[%s %v] %s\", t.name,\n\t\ttotal, strings.Join(subInfo, \", \"))\n\tlog.Info(info)\n}", "title": "" }, { "docid": "a42b40c83e715889918bd6ee9dfa3008", "score": "0.42362309", "text": "func SetLabelsWithCtx(ctx context.Context, l Labels) {\n\tpprof.SetGoroutineLabels(pprof.WithLabels(ctx, pprof.Labels(l()...)))\n}", "title": "" }, { "docid": "e8c1b8e509205b075e0524709d30be62", "score": "0.42351848", "text": "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "title": "" }, { "docid": "e8c1b8e509205b075e0524709d30be62", "score": "0.42351848", "text": "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "title": "" } ]
5b81bec7defc73394c075ff98de9ce9a
GetAmplifier retrieves the value with the specified key from the Amplifier map field of OpticalAmplifier. If the receiver is nil, or the specified key is not present in the list, nil is returned such that Get methods may be safely chained.
[ { "docid": "32434f9a5d5fcd35ccf48fc6c57a83bd", "score": "0.7794884", "text": "func (t *OpticalAmplifier) GetAmplifier(Name string) *OpticalAmplifier_Amplifier {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Name\n\n\tif lm, ok := t.Amplifier[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "3e2a6d2435d13b28c6aefcf1f81d9f76", "score": "0.66058946", "text": "func (s *Device) GetOpticalAmplifier() *OpticalAmplifier {\n\tif s != nil && s.OpticalAmplifier != nil {\n\t\treturn s.OpticalAmplifier\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1a7089a93a671dbce9eebb860ae2c11", "score": "0.62389547", "text": "func (t *OpticalAmplifier) GetOrCreateAmplifier(Name string) *OpticalAmplifier_Amplifier {\n\n\tkey := Name\n\n\tif v, ok := t.Amplifier[key]; ok {\n\t\treturn v\n\t}\n\t// Panic if we receive an error, since we should have retrieved an existing\n\t// list member. This allows chaining of GetOrCreate methods.\n\tv, err := t.NewAmplifier(Name)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"GetOrCreateAmplifier got unexpected error: %v\", err))\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3e1cef63be89ac1a3c66559cdfc794a6", "score": "0.60847205", "text": "func (n *OpticalAmplifierPathAny) Amplifier(Name string) *OpticalAmplifier_AmplifierPathAny {\n\treturn &OpticalAmplifier_AmplifierPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"amplifiers\", \"amplifier\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8ef0a5f7be5e098ca1700c33aea26543", "score": "0.59645206", "text": "func (n *OpticalAmplifierPath) Amplifier(Name string) *OpticalAmplifier_AmplifierPath {\n\treturn &OpticalAmplifier_AmplifierPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"amplifiers\", \"amplifier\"},\n\t\t\tmap[string]interface{}{\"name\": Name},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "13068188d63160e91fbaf461086dca59", "score": "0.58273137", "text": "func (n *DevicePath) OpticalAmplifier() *OpticalAmplifierPath {\n\treturn &OpticalAmplifierPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"optical-amplifier\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "93464eb0405c26a4b8de2abf61f3af4e", "score": "0.5819006", "text": "func (t *OpticalAmplifier) NewAmplifier(Name string) (*OpticalAmplifier_Amplifier, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Amplifier == nil {\n\t\tt.Amplifier = make(map[string]*OpticalAmplifier_Amplifier)\n\t}\n\n\tkey := Name\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.Amplifier[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Amplifier\", key)\n\t}\n\n\tt.Amplifier[key] = &OpticalAmplifier_Amplifier{\n\t\tName: &Name,\n\t}\n\n\treturn t.Amplifier[key], nil\n}", "title": "" }, { "docid": "31b45280a8eabe589b821a7030ec9877", "score": "0.54512155", "text": "func (t *OpticalAmplifier) AppendAmplifier(v *OpticalAmplifier_Amplifier) error {\n\tkey := *v.Name\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Amplifier == nil {\n\t\tt.Amplifier = make(map[string]*OpticalAmplifier_Amplifier)\n\t}\n\n\tif _, ok := t.Amplifier[key]; ok {\n\t\treturn fmt.Errorf(\"duplicate key for list Amplifier %v\", key)\n\t}\n\n\tt.Amplifier[key] = v\n\treturn nil\n}", "title": "" }, { "docid": "cb7d4a36657c39886662073a86163886", "score": "0.52819365", "text": "func (s *Device) GetOrCreateOpticalAmplifier() *OpticalAmplifier {\n\tif s.OpticalAmplifier != nil {\n\t\treturn s.OpticalAmplifier\n\t}\n\ts.OpticalAmplifier = &OpticalAmplifier{}\n\treturn s.OpticalAmplifier\n}", "title": "" }, { "docid": "40dc8c909575b6aa3c1f932f64b5f10b", "score": "0.5046441", "text": "func (n *OpticalAmplifierPath) AmplifierAny() *OpticalAmplifier_AmplifierPathAny {\n\treturn &OpticalAmplifier_AmplifierPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"amplifiers\", \"amplifier\"},\n\t\t\tmap[string]interface{}{\"name\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "73b8d6290f6b1605e7398f5cb0f8856c", "score": "0.5022205", "text": "func (n *OpticalAmplifierPathAny) AmplifierAny() *OpticalAmplifier_AmplifierPathAny {\n\treturn &OpticalAmplifier_AmplifierPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"amplifiers\", \"amplifier\"},\n\t\t\tmap[string]interface{}{\"name\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d3b2c72bff6d18202cb4c41539b80f30", "score": "0.4714452", "text": "func (m *Manager) Get(key string) interface{} {\n\t// ensure loaded\n\tif !m.loaded {\n\t\terr := m.load(false)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\topt := m.options.Find(key)\n\tdef := m.defaults.Find(key)\n\tif def == nil {\n\t\treturn opt\n\t} else if opt == nil {\n\t\treturn def\n\t} else if v, err := cast.TryToValue(opt, reflect.TypeOf(def)); err == nil {\n\t\treturn v\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "cb8d3d26f7de1fa2c8b3ad979f0be39f", "score": "0.46701205", "text": "func (m *EducationAssignmentGrade) GetGradedBy()(IdentitySetable) {\n val, err := m.GetBackingStore().Get(\"gradedBy\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(IdentitySetable)\n }\n return nil\n}", "title": "" }, { "docid": "d3ea66c0fcb5bd6307ee1d6b27d54a9c", "score": "0.46209806", "text": "func (m *BeeMap) Get(k interface{}) interface{} {\r\n\tm.lock.RLock()\r\n\tdefer m.lock.RUnlock()\r\n\tif val, ok := m.bm[k]; ok {\r\n\t\treturn val\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "e9ed8e1d16fd3fba303c6ec94fafba91", "score": "0.4615227", "text": "func (m *BeeMap) Get(k interface{}) interface{} {\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\tif val, ok := m.bm[k]; ok {\n\t\treturn val\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3e0532876deb46f5297cfc61a044a169", "score": "0.4591846", "text": "func Get(key string) any {\n\treturn std.Default().Get(key)\n}", "title": "" }, { "docid": "c04c1c391eb0b9cc188006a3d7d79d71", "score": "0.4583505", "text": "func (c *Capabilities) Get(capability string) *Capability {\n\treturn c.m[capability]\n}", "title": "" }, { "docid": "0e7536db9de3c744abd9c8550bdb19d8", "score": "0.45317596", "text": "func (am *AgingMap) Get(key string) string {\n\tif threadSafe {\n\t\tam.rwLock.RLock()\n\t\tdefer am.rwLock.RUnlock()\n\t}\n\telement := am.internalMap[key]\n\tif element == nil {\n\t\treturn \"\"\n\t}\n\n\tkvp := element.Value.(KeyValuePair)\n\treturn kvp.Value\n}", "title": "" }, { "docid": "e53e0f4c32f42ee211c76dc504ea9639", "score": "0.4489667", "text": "func (af *AddonConfig) Get(category, k string) string {\n\tif _, ok := af.Values[category]; !ok {\n\t\treturn \"\"\n\t}\n\treturn af.Values[category][k]\n}", "title": "" }, { "docid": "4d4b1945b3c636d0ced12868d81a204e", "score": "0.44718763", "text": "func (c *Context) Get(key interface{}) interface{} {\n\tif c.m == nil {\n\t\treturn nil\n\t}\n\treturn c.m[key]\n}", "title": "" }, { "docid": "c5e9cb9dd3e62c5e3c7048b13ea233f0", "score": "0.44376278", "text": "func (m Metal) GetAttenuation() Vector3 {\n return m.Attenuation\n}", "title": "" }, { "docid": "3521a45394d0fdb756fc1fedad0419f0", "score": "0.4382168", "text": "func (m *Manager) Get(id string) (ladon.Policy, error) {\n\tp, ok := m.Policies[id]\n\tif !ok {\n\t\treturn nil, errors.New(\"Not found\")\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "b4aa70236fd5ee00f4680ce46467cb6a", "score": "0.4378512", "text": "func (m Manager) Get(key string) (ExchangeProvider, error) {\n\tif m == nil {\n\t\treturn nil, ErrManagerNotInit\n\t}\n\n\texchange, ok := m[key]\n\tif ok == false {\n\t\treturn nil, ErrProviderNotFound\n\t}\n\n\treturn exchange, nil\n}", "title": "" }, { "docid": "6e4bdc0492b00b3739b18529febe8a5c", "score": "0.43627962", "text": "func (a *Adapter) Get(key uint64) ([]byte, bool) {\n\tif response, ok := a.store[key]; ok {\n\t\treturn response, true\n\t}\n\n\treturn nil, false\n}", "title": "" }, { "docid": "ab585c685546bf5f0becc07b4e9500b8", "score": "0.43465036", "text": "func (m updateStrategyMap) get(apiGroup, kind string) *v1alpha1.DecoratorControllerAttachmentUpdateStrategy {\n\treturn m[updateStrategyMapKey(apiGroup, kind)]\n}", "title": "" }, { "docid": "ef463f6280eabd21b8a4661e094cc0af", "score": "0.43447617", "text": "func (choice Choice) Get(key string) interface{} {\n\treturn choice.attributes[key]\n}", "title": "" }, { "docid": "6466fe370c4f5039df048168fbb7d198", "score": "0.43412212", "text": "func (l *Limiters) Get(key string) *rate.Limiter {\n\tif limiter, ok := l.limiters.Load(key); ok {\n\t\treturn limiter.(*rate.Limiter)\n\t}\n\n\treturn l.Add(key)\n}", "title": "" }, { "docid": "9b3b9af2eb1cefd6a110bb31519c0a89", "score": "0.43396214", "text": "func (c *LFUPlugin) Get(key interface{}) (interface{}, error) {\n\tv, err := c.getValue(key)\n\tif err != nil {\n\t\treturn c.getWithLoader(key, true)\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "f28a9d82d32d7f8deb913314587bc298", "score": "0.43189973", "text": "func (c *ModelAdaptor) Get(k model.Key) (*model.KVPair, error) {\n\tswitch kt := k.(type) {\n\tcase model.ProfileKey:\n\t\treturn c.getProfile(k)\n\tcase model.NodeKey:\n\t\treturn c.getNode(kt)\n\tcase model.BlockKey:\n\t\treturn c.getBlock(k)\n\tcase model.GlobalBGPConfigKey:\n\t\tnk := toDatastoreGlobalBGPConfigKey(kt)\n\t\tif kvp, err := c.client.Get(nk); err != nil {\n\t\t\treturn nil, errors.UpdateErrorIdentifier(err, k)\n\t\t} else {\n\t\t\treturn fromDatastoreGlobalBGPConfig(*kvp), nil\n\t\t}\n\tdefault:\n\t\treturn c.client.Get(k)\n\t}\n}", "title": "" }, { "docid": "aa4ffc241038a986d283eb4cf656553b", "score": "0.43081138", "text": "func (m MultiMap) Get(name string) string {\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\tvs := m[name]\n\tif len(vs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "87dcfbd6819687cf45de3356fb4219fc", "score": "0.42799038", "text": "func (ac *AuthClaims) Get(key string) interface{} {\n\tif _, ok := ac.claims[key]; !ok {\n\t\treturn nil\n\t}\n\treturn ac.claims[key]\n}", "title": "" }, { "docid": "fd9d17214031615376faf9cb1c2a60bf", "score": "0.42732966", "text": "func (f AutoParameterConfig) Get(key AutoParameterConfigKey) string {\n\treturn f[key]\n}", "title": "" }, { "docid": "1a3e048002261a5faedf5136d5579990", "score": "0.42717665", "text": "func (k *Ketama) Get(key string) (string, bool) {\n\tif k.Empty() {\n\t\treturn \"\", false\n\t}\n\n\thashs := hash.GenHashInts([]byte(salt+key), 1)\n\thash := hashs[0]\n\n\tk.locker.Lock()\n\tdefer k.locker.Unlock()\n\n\titer := k.m.LowerBound(hash)\n\tif iter.IsValid() {\n\t\treturn iter.Value(), true\n\t}\n\treturn k.m.First().Value(), true\n}", "title": "" }, { "docid": "d0723a1695b8631633ab096988507bb3", "score": "0.42714834", "text": "func (s memcachedAutoscalerNamespaceLister) Get(name string) (*v1alpha1.MemcachedAutoscaler, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"memcachedautoscaler\"), name)\n\t}\n\treturn obj.(*v1alpha1.MemcachedAutoscaler), nil\n}", "title": "" }, { "docid": "37774662a5fdd8a447f3b692eccb4733", "score": "0.4254639", "text": "func (a JobInfo_Extension) Get(fieldName string) (value string, found bool) {\n\tif a.AdditionalProperties != nil {\n\t\tvalue, found = a.AdditionalProperties[fieldName]\n\t}\n\treturn\n}", "title": "" }, { "docid": "3f5cf93ce3cf11646f7fefed9d7f0044", "score": "0.42506102", "text": "func (c *ConsulBackend) Get(ctx context.Context, key string) (*physical.Entry, error) {\n\tdefer metrics.MeasureSince([]string{\"consul\", \"get\"}, time.Now())\n\n\tc.permitPool.Acquire()\n\tdefer c.permitPool.Release()\n\n\tqueryOpts := &api.QueryOptions{}\n\tqueryOpts = queryOpts.WithContext(ctx)\n\n\tif c.consistencyMode == consistencyModeStrong {\n\t\tqueryOpts.RequireConsistent = true\n\t}\n\n\tpair, _, err := c.kv.Get(c.path+key, queryOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif pair == nil {\n\t\treturn nil, nil\n\t}\n\tent := &physical.Entry{\n\t\tKey: key,\n\t\tValue: pair.Value,\n\t}\n\treturn ent, nil\n}", "title": "" }, { "docid": "dec07ba44a838f5178f5ff2e472587ab", "score": "0.42317638", "text": "func (a UserAttributes) Get(name string) string {\n\tif v, ok := a[name]; ok {\n\t\treturn v[0]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e8fb378823bc5d4ae1c506b1ea273bc0", "score": "0.4226437", "text": "func (c *Clairvoyant) Get(key interface{}) (interface{}, bool) {\n\tc.hits[key.(uint64)]++\n\tc.access = append(c.access, key.(uint64))\n\treturn nil, false\n}", "title": "" }, { "docid": "cb778a97e9c7620454c384829bc94c2c", "score": "0.42124426", "text": "func (conf *Config) Get(key string) interface{} {\n\tif conf.data == nil {\n\t\treturn nil\n\t}\n\treturn conf.data[key]\n}", "title": "" }, { "docid": "d05346f589d4e3dbacb5023c76918173", "score": "0.42115974", "text": "func Get(key string) (interface{}, bool) {\n\treturn instance.get(key)\n}", "title": "" }, { "docid": "6bdfd920823daef2503014d79e2d2944", "score": "0.42064488", "text": "func Get(key string) (string, error) {\n\treturn adapter.Get(key)\n}", "title": "" }, { "docid": "30e3148101920ebca05bafdc0a00498f", "score": "0.420015", "text": "func (m AnnotationSelectorsByGK) Get(group, kind string) labels.Selector {\n\treturn m[makeSelectorKeyFromGK(group, kind)]\n}", "title": "" }, { "docid": "30e3148101920ebca05bafdc0a00498f", "score": "0.420015", "text": "func (m AnnotationSelectorsByGK) Get(group, kind string) labels.Selector {\n\treturn m[makeSelectorKeyFromGK(group, kind)]\n}", "title": "" }, { "docid": "2ada125ab966533264bd103a0ae646c0", "score": "0.41922584", "text": "func (m attachmentUpdateStrategies) get(\n\tapiGroup, kind string,\n) *v1alpha1.GenericControllerAttachmentUpdateStrategy {\n\n\treturn m[makeAttachmentUpdateStrategyKey(apiGroup, kind)]\n}", "title": "" }, { "docid": "ce79f42d7056343ba661a34527f5cf33", "score": "0.4177535", "text": "func (h *HMA) Get() float64 {\n\treturn h.wma[2].Get()\n}", "title": "" }, { "docid": "3913b2ae18526a7390e7d52ac1cd5657", "score": "0.41769528", "text": "func (r *DeviceCompliancePolicyAssignmentRequest) Get(ctx context.Context) (resObj *DeviceCompliancePolicyAssignment, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "title": "" }, { "docid": "ffee352f603bf756523e7b3be7221304", "score": "0.41764504", "text": "func (a *Accumulator) Get(measurement string) (*Point, bool) {\n\tfor _, p := range a.Points {\n\t\tif p.Measurement == measurement {\n\t\t\treturn p, true\n\t\t}\n\t}\n\n\treturn nil, false\n}", "title": "" }, { "docid": "0fe155919e5434a5c265f17f4c485f2c", "score": "0.41627008", "text": "func (k Keeper) GetAuthority() string {\n\treturn k.authority\n}", "title": "" }, { "docid": "0fe155919e5434a5c265f17f4c485f2c", "score": "0.41627008", "text": "func (k Keeper) GetAuthority() string {\n\treturn k.authority\n}", "title": "" }, { "docid": "b28ffdaaa4dd0cff8e6c7ab9a55e1044", "score": "0.4156715", "text": "func (p Params) Get(key string) string {\n\treturn p[key]\n}", "title": "" }, { "docid": "d1b3d86196189c4302d676a7f909946a", "score": "0.41452962", "text": "func (b *BackendMgr) Get(addr string) (Backend, error) {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tindex, err := b.getIndex(addr)\n\tif err == nil {\n\t\treturn b.backends[index], nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "d4d45e92b95f067fc7a78c4d60124ba2", "score": "0.41448033", "text": "func (m *InterfaceMap) Get(key string) interface{} {\n\tm.lk.RLock()\n\tdefer m.lk.RUnlock()\n\treturn m._map[key]\n}", "title": "" }, { "docid": "75ec62864ec2deaaa0bb6328a20b3bdc", "score": "0.41436267", "text": "func (m MapOfMap) GetWithCheck(k1, k2 string) interface{} {\n\tif innerMap := m[k1]; innerMap != nil {\n\t\treturn innerMap[k2]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb6f61a2747a8b8d94e4f244aedf938d", "score": "0.4138574", "text": "func (ssm *SafeSpecMap) get(key string, isAlias bool) (s models.Spec, ok bool) {\n\t_sp, _ := ssm.m.Load(key)\n\tsp, ok := _sp.(*models.Spec)\n\tif !ok {\n\t\treturn\n\t}\n\n\tif sp.Use != \"\" {\n\t\tif isAlias {\n\t\t\tok = false\n\t\t\treturn\n\t\t}\n\t\treturn ssm.get(sp.Use, true)\n\t}\n\n\ts = *sp\n\treturn\n}", "title": "" }, { "docid": "25a721023996b770c6702b71261e6b58", "score": "0.41357657", "text": "func (m Attributes) Get(key string) interface{} {\n\tif m == nil {\n\t\tm = map[string]interface{}{}\n\t}\n\treturn m[key]\n}", "title": "" }, { "docid": "84012d7288fc3e88b85307a4e49ae7a9", "score": "0.4131286", "text": "func (u URLParams) Get(key string) string {\n\tvs := u[key]\n\tif len(vs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "debbb30ca1b51577561ba124b7864a91", "score": "0.41307205", "text": "func (r *Request) Get(key string) interface{} {\n\tif r.store == nil {\n\t\treturn nil\n\t}\n\treturn (*r.store)[key]\n}", "title": "" }, { "docid": "ec8c7c27df162afd8dc88fa3d4be36c8", "score": "0.4130506", "text": "func (m M) Get(key string) Any {\n\treturn m[key]\n}", "title": "" }, { "docid": "2e4ffdf9082d3fe0654c52c5686c5946", "score": "0.41266337", "text": "func (m *mapperCache) get(metricName string) (*MapResult, bool) {\n\tif result, ok := m.cache.Get(metricName); ok {\n\t\treturn result, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "4b7742537a13a16203afa910cef1ab74", "score": "0.41223562", "text": "func (s *Subspace) Get(ctx sdk.Context, key []byte, ptr interface{}) {\n\ts.checkType(key, ptr)\n\n\tif s.loadFromCache(key, ptr) {\n\t\t// cache hit\n\t\treturn\n\t}\n\tstore := s.kvStore(ctx)\n\tbz := store.Get(key)\n\n\tif err := s.legacyAmino.UnmarshalJSON(bz, ptr); err != nil {\n\t\tpanic(err)\n\t}\n\ts.cacheValue(key, ptr)\n}", "title": "" }, { "docid": "fd624d68ae0ba9e0a4db3e2d4f3d304a", "score": "0.41204718", "text": "func (m *EducationSynchronizationCustomizations) GetTeacher()(EducationSynchronizationCustomizationable) {\n val, err := m.GetBackingStore().Get(\"teacher\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(EducationSynchronizationCustomizationable)\n }\n return nil\n}", "title": "" }, { "docid": "0f92232f95eca836a82f750a419171ff", "score": "0.41185778", "text": "func NewAmplifier(code []int) (Amplifier, error) {\n\tcomputer, err := day05.NewComputer(code, BaseInstructions...)\n\tif err != nil {\n\t\treturn Amplifier{}, err\n\t}\n\n\tamp := Amplifier { computer: &computer }\n\n\treturn amp, nil\n}", "title": "" }, { "docid": "f4dbc9f292241e39c49f8486f9ca6b61", "score": "0.4114249", "text": "func (aws AWS) Get(key string) any {\n\tif aws == nil {\n\t\treturn nil\n\t}\n\treturn aws[toSnakeCase(key)]\n}", "title": "" }, { "docid": "4173cbe6c19199319bc27e85b070a1ff", "score": "0.4108731", "text": "func (y EngineYard) Get(k string) (Engine, bool) {\n\te, ok := y[k]\n\treturn e, ok\n}", "title": "" }, { "docid": "4173cbe6c19199319bc27e85b070a1ff", "score": "0.4108731", "text": "func (y EngineYard) Get(k string) (Engine, bool) {\n\te, ok := y[k]\n\treturn e, ok\n}", "title": "" }, { "docid": "9215e8f26c4187ddefe34ec270702e37", "score": "0.41054106", "text": "func GetAd(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\tdec := json.NewEncoder(w)\n\tkey := xmux.Param(ctx, \"key\")\n\n\timp, err := suppliers.GetImpression(key, r)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tdec.Encode(struct {\n\t\t\tError error\n\t\t}{\n\t\t\tError: err,\n\t\t})\n\t\treturn\n\t}\n\tmodifyClicks(imp)\n\t// OK push it to broker\n\tjImp := materialize.ImpressionJob(imp)\n\tbroker.Publish(jImp)\n\tnCtx, cnl := context.WithCancel(ctx)\n\tdefer cnl()\n\tads := core.Call(nCtx, imp)\n\tlog(imp).WithField(\"count\", len(ads)).Debug(\"ads is passed the system from exchange calls\")\n\tres := rtb.SelectCPM(imp, ads)\n\tlog(imp).WithField(\"count\", len(res)).Debug(\"ads is passed the system select\")\n\n\tstoreKeys(imp, res)\n\n\terr = imp.Source().Supplier().Renderer().Render(imp, res, w)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tdec.Encode(struct {\n\t\t\tError string\n\t\t}{\n\t\t\tError: err.Error(),\n\t\t})\n\t}\n}", "title": "" }, { "docid": "acd29175ade2abef17e4e96c4b6a6661", "score": "0.4097891", "text": "func (c *FakeCronHorizontalPodAutoscalers) Get(name string, options v1.GetOptions) (result *v1beta1.CronHorizontalPodAutoscaler, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(cronhorizontalpodautoscalersResource, c.ns, name), &v1beta1.CronHorizontalPodAutoscaler{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1beta1.CronHorizontalPodAutoscaler), err\n}", "title": "" }, { "docid": "0acbc601c4f33a018aa0d60b7e977384", "score": "0.4096772", "text": "func (a *App) Get(name string) interface{} {\n\treturn a.getConfig()[name]\n}", "title": "" }, { "docid": "7c233a9ec05a2a5c2d1fe35b86acc985", "score": "0.40855464", "text": "func (l Lambertian) GetAttenuation() Vector3 {\n return l.Attenuation\n}", "title": "" }, { "docid": "1cb2cf44d5cb4b6462dd8d1cae1bae67", "score": "0.40771645", "text": "func (sa SubstitutionAffinities) Get(id int) *Broker {\n\tif b, exists := sa[id]; exists {\n\t\tb.Used++\n\t\treturn b\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3d2a029c0754f080f92506fbe4265a93", "score": "0.40768582", "text": "func (g *GCEAlphaNetworkFirewallPolicies) GetRule(ctx context.Context, key *meta.Key, priority *int64) (*alpha.FirewallPolicyRule, error) {\n\tklog.V(5).Infof(\"GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, %v, ...): called\", ctx, key, priority)\n\n\tif !key.Valid() {\n\t\tklog.V(2).Infof(\"GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, %v, ...): key is invalid (%#v)\", ctx, key, key, priority)\n\t\treturn nil, fmt.Errorf(\"invalid GCE key (%+v)\", key)\n\t}\n\tprojectID := g.s.ProjectRouter.ProjectID(ctx, \"alpha\", \"NetworkFirewallPolicies\")\n\trk := &RateLimitKey{\n\t\tProjectID: projectID,\n\t\tOperation: \"GetRule\",\n\t\tVersion: meta.Version(\"alpha\"),\n\t\tService: \"NetworkFirewallPolicies\",\n\t}\n\tklog.V(5).Infof(\"GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, %v, ...): projectID = %v, rk = %+v\", ctx, key, priority, projectID, rk)\n\n\tif err := g.s.RateLimiter.Accept(ctx, rk); err != nil {\n\t\tklog.V(4).Infof(\"GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, %v, ...): RateLimiter error: %v\", ctx, key, priority, err)\n\t\treturn nil, err\n\t}\n\tcall := g.s.Alpha.NetworkFirewallPolicies.GetRule(projectID, key.Name)\n\tif priority != nil {\n\t\tcall = call.Priority(*priority)\n\t}\n\tcall.Context(ctx)\n\tv, err := call.Do()\n\tklog.V(4).Infof(\"GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, %v, ...) = %+v, %v\", ctx, key, priority, v, err)\n\treturn v, err\n}", "title": "" }, { "docid": "11c69cda4e83af1ba793ec73b59b85da", "score": "0.40734866", "text": "func (t *ComponentType) GetDefault(name string) (interface{}, error) {\n\tattr, exists := t.attributes[name]\n\tif exists {\n\t\treturn attr.Value(), nil\n\t}\n\tattributeNames := make([]string, 0, len(t.attributes))\n\tfor attributeName := range t.attributes {\n\t\tattributeNames = append(attributeNames, attributeName)\n\t}\n\treturn nil, fmt.Errorf(\"Component type %s has no attribute called %s. Attributes it does have: %s\",\n\t\tt.name, name, attributeNames)\n}", "title": "" }, { "docid": "d70812e8b15cdf6504ebe1706c2eef05", "score": "0.40678406", "text": "func (this *LinearAdaptiveProbMap) get(bit int, pr int, ctx int) int {\n\t// Update probability based on error and learning rate\n\tg := (-bit & 65528) + (bit << this.rate)\n\tthis.data[this.index+1] += uint16((g - int(this.data[this.index+1])) >> this.rate)\n\tthis.data[this.index] += uint16((g - int(this.data[this.index])) >> this.rate)\n\n\t// Find index: 65*ctx + quantized prediction in [0..64]\n\tthis.index = (pr >> 6) + 65*ctx\n\n\t// Return interpolated probability\n\tw := pr & 127\n\treturn (int(this.data[this.index+1])*w + int(this.data[this.index])*(128-w)) >> 11\n}", "title": "" }, { "docid": "e64ff039c96730a6b36d1fd9477926a4", "score": "0.40631866", "text": "func (self *Injector) Get(pointerToType interface{}, annotation Annotation) (interface{}, error) {\n\tvalueType := reflect.TypeOf(pointerToType).Elem()\n\tannotationType := reflect.TypeOf(annotation)\n\tkey := providerKey{\n\t\tvalueType: valueType,\n\t\tannotationType: annotationType,\n\t}\n\treturn self.getLocked(key)\n}", "title": "" }, { "docid": "c9c20281d8d6da819c242d46ed4b8bac", "score": "0.4054462", "text": "func (m ValuationMap) Get(denom string) sdk.Dec {\n\treturn m.Usd[denom]\n}", "title": "" }, { "docid": "06aade944282c3ac9f2af7496f84ca58", "score": "0.40528062", "text": "func getWorkload(jmeterconf *JMeterConf, teststrategy string) (*Workload, error) {\n\t// get the entry for the passed strategy\n\tif jmeterconf != nil && jmeterconf.Workloads != nil {\n\t\tfor _, workload := range jmeterconf.Workloads {\n\t\t\tif workload.TestStrategy == teststrategy {\n\t\t\t\treturn workload, nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// if we didnt find it in the config go through the defaults\n\tfor _, workload := range defaultWorkloads {\n\t\tif workload.TestStrategy == teststrategy {\n\t\t\treturn &workload, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"No workload configuration found for teststrategy: \" + teststrategy)\n}", "title": "" }, { "docid": "e8b5d62518a2b5144b6e8d7643022d57", "score": "0.40447983", "text": "func (gm *StringInterfaceMap) Get(key string) interface{} {\n\tgm.mu.RLock()\n\tval, _ := gm.m[key]\n\tgm.mu.RUnlock()\n\treturn val\n}", "title": "" }, { "docid": "be0186c9773baf7f1befd6074f2eb1d8", "score": "0.40440986", "text": "func (r *MobileAppAssignmentRequest) Get(ctx context.Context) (resObj *MobileAppAssignment, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "title": "" }, { "docid": "6582d07db69804927defd3062e1e000d", "score": "0.40411118", "text": "func GetOption(key string) Option {\n\trule, ok := registry[key]\n\tif !ok {\n\t\treturn Option{key, String, EmptyEvent, EmptyEvent, false}\n\t}\n\treturn rule\n}", "title": "" }, { "docid": "de1e961576fc652ab7b0a84ef6129f94", "score": "0.4034783", "text": "func (ssm *SafeSpecMap) Get(key string) (models.Spec, bool) {\n\treturn ssm.get(key, false)\n}", "title": "" }, { "docid": "2a82d73fe84bba6b5f8ca1155b3cb780", "score": "0.4034766", "text": "func (m *ProductMap) Get() (products map[uint64]*Product, nProducts uint64, nFeeds uint64, nCategories uint64) {\n\tif !m.validated {\n\t\terr := m.eval()\n\t\tif err != nil {\n\t\t\treturn m.products, m.nProducts, m.nFeeds, m.nCategories\n\t\t}\n\t}\n\treturn m.products, m.nProducts, m.nFeeds, m.nCategories\n}", "title": "" }, { "docid": "4257d116adfd94a373b82e039c368742", "score": "0.40339413", "text": "func (ctx *Context) Get(name string) string {\n\tiparams := ctx.Value(paramsKey)\n\tif iparams == nil {\n\t\treturn \"\"\n\t}\n\tparams := iparams.(url.Values)\n\treturn params.Get(name)\n}", "title": "" }, { "docid": "ee978faa36eeec1309acd7e5ab7a98e2", "score": "0.40236747", "text": "func (m *AuthenticationStrengthPoliciesItemCombinationConfigurationsAuthenticationCombinationConfigurationItemRequestBuilder) Get(ctx context.Context, requestConfiguration *AuthenticationStrengthPoliciesItemCombinationConfigurationsAuthenticationCombinationConfigurationItemRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AuthenticationCombinationConfigurationable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, 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.CreateAuthenticationCombinationConfigurationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AuthenticationCombinationConfigurationable), nil\n}", "title": "" }, { "docid": "ff48e7c2aef5ebe07feccb58311e5478", "score": "0.40233374", "text": "func (m *JobsManagerImpl) Get(worker boruta.WorkerUUID) (*workers.Job, error) {\n\tm.mutex.RLock()\n\tdefer m.mutex.RUnlock()\n\n\tjob, present := m.jobs[worker]\n\tif !present {\n\t\treturn nil, boruta.NotFoundError(\"Job\")\n\t}\n\treturn job, nil\n}", "title": "" }, { "docid": "22c2b1b57b83eb0a094e7a02c8315c57", "score": "0.40223166", "text": "func (g *ExtHSGetter) Get(k string, ptr interface{}) bool {\n\tb, ok := g.m[k]\n\tif ok == false {\n\t\treturn ok\n\t}\n\n\terr := bencode.Unmarshal(b, ptr)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "22c2b1b57b83eb0a094e7a02c8315c57", "score": "0.40223166", "text": "func (g *ExtHSGetter) Get(k string, ptr interface{}) bool {\n\tb, ok := g.m[k]\n\tif ok == false {\n\t\treturn ok\n\t}\n\n\terr := bencode.Unmarshal(b, ptr)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "fbe639b1731a4d969d9c23546f573501", "score": "0.4020326", "text": "func (nc NamedCaptures) Get(key string) string {\n\tv, ok := nc.m[key]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d6f6eb37da224c22d183cc584d506672", "score": "0.40161926", "text": "func (m *UserExperienceAnalyticsModelScores) GetManufacturer()(*string) {\n val, err := m.GetBackingStore().Get(\"manufacturer\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "f95cd3d308e6cde0d2a7cb364aece5f3", "score": "0.40154505", "text": "func (c *ConfigMap) get(name string) (interface{}, error) {\n\treturn util.GetConfigMap(c.config.kubeClient, c.config.namespace, name)\n}", "title": "" }, { "docid": "7702927bd928f14f9c73d7dada5101c8", "score": "0.4013609", "text": "func (l *Limiter) Get(ctx context.Context, key string) (Context, error) {\n\treturn l.Store.Get(ctx, key, l.Rate)\n}", "title": "" }, { "docid": "499b06c59addaf9e121571e4da65b2f3", "score": "0.39993793", "text": "func (a *Association) Get(key, def string) string {\n\tif v, found := a.values[key]; found {\n\t\treturn v\n\t}\n\treturn def\n}", "title": "" }, { "docid": "af67032eccbc81193bcdf6a457d208b1", "score": "0.39980555", "text": "func (cch *cache) GetActivePolicy() string {\n\treturn cch.PolicyName\n}", "title": "" }, { "docid": "775f03d4755c94b95b4b8fb43fc0be85", "score": "0.39932877", "text": "func (a Energy) Amplified(n float64) Energy {\n\treturn Energy{a.X * n, a.Y * n, a.Z * n}\n}", "title": "" }, { "docid": "e6f81efe89471b8e6a52203dfac411c9", "score": "0.39916098", "text": "func (a *Application) Get(key *ari.Key) *ari.ApplicationHandle {\n\treturn ari.NewApplicationHandle(a.client.stamp(key), a)\n}", "title": "" }, { "docid": "ad7d6ae22be322499e64c6f387dbd4d3", "score": "0.3990875", "text": "func (c *Client) GetCapsule(name string) (*Capsule, error) {\n\tif c.limiter != nil {\n\t\tc.limiter.Take()\n\t}\n\tr, err := http.Get(capsulesEndpoint + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer r.Body.Close()\n\n\tvar target *Capsule\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(data, &target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn target, err\n}", "title": "" }, { "docid": "70bbc35a07264f9020173a03e71f6137", "score": "0.39903295", "text": "func (m *Map) Get(key key.Hash) interface{} {\n\tvar v, _ = m.Load(key)\n\treturn v\n}", "title": "" }, { "docid": "3a8262af62a2e93f702b5863c0b3a72e", "score": "0.3990153", "text": "func Get(key string) interface{} {\n\tcachePtr := GetCacheInstance()\n\tif value, found := cachePtr.Get(key); found {\n\t\treturn value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ca5af34a1492f6685c348839f1f6ad4", "score": "0.39885512", "text": "func (c Claims) Get(k string) (interface{}, bool) {\n\tv, ok := c[k]\n\treturn v, ok\n}", "title": "" }, { "docid": "39da41dd2fe1347a6775d30248a45f85", "score": "0.39875054", "text": "func (m *MinePoolApplyInfo) GetPool(keyid int64) (bool, error) {\r\n\treturn isFound(DBConn.Where(\"keyid = ? and review = ?\", keyid, 2).Last(m))\r\n}", "title": "" }, { "docid": "6a2822a3118f4434eb9a2ea89400cc50", "score": "0.39838827", "text": "func (c *FakeMariaDBAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MariaDBAutoscaler, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(mariadbautoscalersResource, c.ns, name), &v1alpha1.MariaDBAutoscaler{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.MariaDBAutoscaler), err\n}", "title": "" }, { "docid": "90451801e6ac9914e99bd13b202a6504", "score": "0.39835596", "text": "func (loc *LetterOfCredit) Get(ctx *helpers.TransactionContext, letterID string, role string, participantID string) (string, error) {\n\tperson, err := loc.getParticipantByRole(ctx, role, participantID)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tletter, err := ctx.GetLetterOfCredit(letterID)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif !letter.IsParty(person) {\n\t\treturn \"\", fmt.Errorf(\"Participant passed is not a party in the letter of credit\")\n\t}\n\n\tlettersJSON, _ := json.Marshal(letter)\n\n\treturn string(lettersJSON), nil\n}", "title": "" } ]
37a0667475fe23b45b61f745d8dc2177
Run runs a function in a goroutine and calls done when function returns. Please DO NOT use panic in the cb function.
[ { "docid": "9ecdf4bfa474566085480e99532472c0", "score": "0.5561022", "text": "func (w *analyzeResultsNotifyWaitGroupWrapper) Run(exec func()) {\n\told := w.cnt.Inc() - 1\n\tgo func(cnt uint64) {\n\t\tdefer func() {\n\t\t\tw.Done()\n\t\t\tif cnt == 0 {\n\t\t\t\tw.Wait()\n\t\t\t\tclose(w.notify)\n\t\t\t}\n\t\t}()\n\t\texec()\n\t}(old)\n}", "title": "" } ]
[ { "docid": "fd10155f926ea566fd332aba01d4beb1", "score": "0.64274484", "text": "func (g *Group) Run() {\n\tvar wg sync.WaitGroup\n\twg.Add(len(g.fn))\n\n\tstop := make(chan struct{})\n\tresult := make(chan error, len(g.fn))\n\tfor _, fn := range g.fn {\n\t\tgo func(fn func(<-chan struct{})) {\n\t\t\tdefer wg.Done()\n\t\t\tfn(stop)\n\t\t\tresult <- nil\n\t\t}(fn)\n\t}\n\n\t<-result // wait for first goroutine to exit\n\tclose(stop) // ask others to exit\n\twg.Wait() // wait for all goroutines to exit\n}", "title": "" }, { "docid": "f5fafc890aaa1b10d673dbe4bdc0f73f", "score": "0.63949376", "text": "func (f Func) Run(ctx context.Context) {\n\tf.Task(ctx)\n}", "title": "" }, { "docid": "2ccb63aa9bf6095dabdc05b846c0d5c8", "score": "0.5998685", "text": "func Run(routine func()) {\n\tcontextGet(getGID(), gctx).run(routine)\n}", "title": "" }, { "docid": "d87642a3e7b18975b872d0a2dcf981a9", "score": "0.5926896", "text": "func (t *Task) Run(wg *sync.WaitGroup) {\n\tt.Err = t.f()\n\twg.Done()\n}", "title": "" }, { "docid": "80971bc520e96c35be2865e1de470e16", "score": "0.5916287", "text": "func (r RunnerFunc) Run(t *testing.T) { r(t) }", "title": "" }, { "docid": "4b1f6fdbad0fa9557b54699c28db1737", "score": "0.5889383", "text": "func (t *SimpleChaincode) Run(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"run is running \" + function)\n\treturn t.Invoke(stub, function, args)\n}", "title": "" }, { "docid": "4b1f6fdbad0fa9557b54699c28db1737", "score": "0.5889383", "text": "func (t *SimpleChaincode) Run(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"run is running \" + function)\n\treturn t.Invoke(stub, function, args)\n}", "title": "" }, { "docid": "e0600e404852a5460298d7e13f059734", "score": "0.58765393", "text": "func (r *Runner) Run(f func(e *E)) (err error) {\n\t// state := c.state\n\tvar e E\n\te.runner = r.config\n\te.deferred = e.buf[:0]\n\tdefer doRecover(&e, &err)\n\tf(&e)\n\tdoDefers(&e, 0)\n\tif e.err != nil {\n\t\treturn *e.err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b3106e46c07a88245dbb7d573742395", "score": "0.58411336", "text": "func (m *RunQueue) Run(fn func()) {\n\tif atomic.LoadInt32(&m.stopped) == 1 {\n\t\treturn\n\n\t}\n\tm.queue.Push(&funcMessage{fn: fn})\n\tatomic.AddInt32(&m.messageCount, 1)\n\tm.schedule()\n}", "title": "" }, { "docid": "1968e51873044387bdb8088824f68821", "score": "0.58056", "text": "func (t *Task) Run(ctx context.Context) error {\n\terr := t.DoFunc(ctx)\n\tif err != nil {\n\t\tindex := t.errCnt % t.ErrLimit\n\t\tt.Errlist[index] = &taskerr{t: t.Next, errinfo: err.Error()}\n\t\tt.errCnt++\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e772e97a6f62cfd933c4640e3ee3535f", "score": "0.5803549", "text": "func (r *runner) Run(ctx context.Context, task Runnable) (err error) {\n\tgo func() {\n\t\tr.complete <- task.Run(ctx)\n\t}()\n\n\tif r.timeoutDuration > 0 {\n\t\terr = r.runWithTimeout()\n\t\treturn\n\t} else {\n\t\terr = r.runAndWaitForever()\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0e4e7a5346c8b6eaa452835ca578b1a7", "score": "0.57780206", "text": "func (r *OnceRunner) Run() {\n\tif atomic.CompareAndSwapUint32(&r.done, 0, 1) {\n\t\tr.task()\n\t}\n}", "title": "" }, { "docid": "2b48e6c5d19a18b9d39113f779cb7026", "score": "0.57406306", "text": "func (r *Run) Do(f func() error) {\n\tr.limiter <- struct{}{}\n\tr.wg.Add(1)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tr.wg.Done()\n\t\t\t<-r.limiter\n\t\t}()\n\t\tif err := f(); err != nil {\n\t\t\tr.done <- err\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d7f0727d53345ab21d35aa38fd83365f", "score": "0.57337713", "text": "func (f RunnerFunc) Run(h Handler) (Option, error) {\n\treturn f(h)\n}", "title": "" }, { "docid": "f6f56413fc2e2ba95f394b03de041011", "score": "0.56883144", "text": "func (fq *FunctionQueue) run() {\n\tfor {\n\t\tselect {\n\t\tcase <-fq.stopCh:\n\t\t\treturn\n\t\tcase f := <-fq.queue:\n\t\t\tretries := 0\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-fq.stopCh:\n\t\t\t\t\treturn\n\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t\tretries++\n\t\t\t\tif err := f.f(); err != nil {\n\t\t\t\t\tif !f.waitFunc(retries) {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fd638f33d332131b76f8d2eb94f45942", "score": "0.56878436", "text": "func (l *Listener) Run(notifyDone chan struct{}) {\n\t// upon exiting the function, the listener\n\t// will notify that it's quitting and the\n\t// program will terminate itself\n\tdefer func() { notifyDone <- struct{}{} }()\n\n\terr := l.Handshake()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"listening...\")\n\n\tl.Listen(l.conn)\n}", "title": "" }, { "docid": "3c5f0f0d4abe7fafcdeb0243dfbc2929", "score": "0.5666208", "text": "func (c FuncCommand) Run(channel string, args []string) (string, error) {\n\treturn c.Fn(channel, args)\n}", "title": "" }, { "docid": "87405970af6a03e41d6020581de79744", "score": "0.56629544", "text": "func (svc *AsyncService) Run() error {\n\tfor {\n\t\te, open := <-svc.c\n\t\tif open {\n\t\t\t// Call event handler\n\t\t\tsvc.i.HandleEvent(e)\n\t\t} else {\n\t\t\t// Exit runner\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e27f551a1acddae83026ed98b949c60", "score": "0.5645769", "text": "func Run(quit func(), restart func()) {\n\tsigchan = make(chan os.Signal, 1)\n\tdone = make(chan bool, 1)\n\tgo run(quit, restart)\n}", "title": "" }, { "docid": "3d72016960572b57643f55bc64cf5c6a", "score": "0.5626763", "text": "func (a *Authorize) Run(ctx context.Context) error {\n\teg, ctx := errgroup.WithContext(ctx)\n\n\tupdateTypes := make(chan []string)\n\teg.Go(func() error {\n\t\treturn a.runTypesSyncer(ctx, updateTypes)\n\t})\n\n\teg.Go(func() error {\n\t\treturn a.runDataSyncer(ctx, updateTypes)\n\t})\n\n\treturn eg.Wait()\n}", "title": "" }, { "docid": "84e7e53a4836637a83779616c76a4344", "score": "0.5618974", "text": "func (a *Runner) Run() error {\n\tif !atomic.CompareAndSwapUint32(&a.running, 0, 1) {\n\t\treturn ErrRunning\n\t}\n\tdefer atomic.StoreUint32(&a.running, 0)\n\n\tquitCh := make(chan struct{})\n\tdefer func() { close(quitCh) }()\n\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tstopCh := make(chan struct{})\n\tgo func() {\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\tcancel()\n\t\tcase <-ctx.Done():\n\t\t}\n\t}()\n\n\ta.mu.Lock()\n\ta.stopCh = stopCh\n\ta.quitCh = quitCh\n\ta.mu.Unlock()\n\n\ta.Runnable.Run(ctx)\n\n\treturn ErrClosed\n}", "title": "" }, { "docid": "4340330e902028eaaa1b4be066b23463", "score": "0.56148636", "text": "func (t *ManageAgreement) Run(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"run is running \" + function)\n\treturn t.Invoke(stub, function, args)\n}", "title": "" }, { "docid": "4340330e902028eaaa1b4be066b23463", "score": "0.56148636", "text": "func (t *ManageAgreement) Run(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\tfmt.Println(\"run is running \" + function)\n\treturn t.Invoke(stub, function, args)\n}", "title": "" }, { "docid": "51c57d141a1abe75121f47415601a03f", "score": "0.55744165", "text": "func (runner Runner) Run() {\n\tfor {\n\t\tif err := runner.executeRunnables(); err != nil {\n\t\t\t// Need a cleaner way to handle errors.\n\t\t\tlog.Printf(\"RoutineRunner error: '%s'\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa84756f7f40a209612271ff733cf8d6", "score": "0.55685717", "text": "func runCallback(method string, handlerFunc reflect.Value, args dnode.Arguments, tr dnode.Transport) {\n\tkite := tr.Properties()[\"localKite\"].(*Kite)\n\n\tkiteErr := new(Error) // Not used. For recovering the error.\n\tdefer kite.recoverError(&kiteErr)() // Do not panic no matter what.\n\n\trequest, _ := kite.parseRequest(method, args, tr)\n\n\t// Call the callback function.\n\tcallArgs := []reflect.Value{reflect.ValueOf(request)}\n\thandlerFunc.Call(callArgs) // No return value from callback function.\n}", "title": "" }, { "docid": "ada56a078cb3673eae02511d8773099b", "score": "0.55621773", "text": "func (w *notifyErrorWaitGroupWrapper) Run(exec func()) {\n\told := w.cnt.Inc() - 1\n\tgo func(cnt uint64) {\n\t\tdefer func() {\n\t\t\tw.Done()\n\t\t\tif cnt == 0 {\n\t\t\t\tw.Wait()\n\t\t\t\tclose(w.notify)\n\t\t\t}\n\t\t}()\n\t\texec()\n\t}(old)\n}", "title": "" }, { "docid": "6001a3eed52c6542d569f2a59dc97f99", "score": "0.5537671", "text": "func (w *ProviderWatcher) Run(stop <-chan struct{}) {\n\tproviders, eventChan := watchUntilSuccess(w.path, w.conn)\n\tw.syncServices2Istio(w.service, providers)\n\n\tcallback := func() {\n\t\tw.mutex.Lock()\n\t\tdefer w.mutex.Unlock()\n\t\tw.syncServices2Istio(w.service, providers)\n\t}\n\tdebouncer := debounce.New(debounceAfter, debounceMax, callback, stop)\n\tfor {\n\t\tselect {\n\t\tcase <-eventChan:\n\t\t\tw.mutex.Lock()\n\t\t\tproviders, eventChan = watchUntilSuccess(w.path, w.conn)\n\t\t\tw.mutex.Unlock()\n\t\t\tdebouncer.Bounce()\n\t\tcase <-stop:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "932a41c3ccbdc6b98ca5c4757d1c7bb6", "score": "0.5528984", "text": "func (c Case) run(f fs.FS, client Client) CaseResult {\n\treturn CaseResult{}\n}", "title": "" }, { "docid": "be85b37751d4a778c5b2b22e86a96ecc", "score": "0.55238897", "text": "func Run(task Task, waiter *Waiter) { global.Run(task, waiter) }", "title": "" }, { "docid": "58169330c0707820939d8166519911bf", "score": "0.5501311", "text": "func (r *reserveAdapter) Run(stopCh <-chan struct{}) {}", "title": "" }, { "docid": "78a0f495944575020ab204fe161ab66d", "score": "0.54984844", "text": "func (h *handImpl) Done(callback func()) {\n\tif h.running {\n\t\tlog.Print(\"can not setting the `Done()` method after the `Run()` or `RunAll()`\")\n\t\treturn\n\t}\n\n\th.callback = callback\n}", "title": "" }, { "docid": "f692cfa0675fb7b2ffefed25d28da634", "score": "0.5492043", "text": "func (a *Application) Run(setup func()) error {\n\ta.PostWait(setup)\n\treturn a.Wait()\n}", "title": "" }, { "docid": "58ff4c7c9e9c70d8d56b4e4b040fe2aa", "score": "0.5471409", "text": "func(t * Insurance) Run(stub shim.ChaincodeStubInterface, function string, args[] string)([] byte, error) {\n fmt.Println(\"run is running \" + function)\n return t.Invoke(stub, function, args)\n}", "title": "" }, { "docid": "7ce612106e0da3c804feb8be56ed841b", "score": "0.5466237", "text": "func (t *SimpleChaincode) Run(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\r\n fmt.Printf(\"Run(...,'%s',%v)\\n\",function,args)\r\n return t.Invoke(stub, function, args)\r\n}", "title": "" }, { "docid": "758ac2c8846f2cb8bc36a46aff9c879b", "score": "0.54644334", "text": "func (a *Ops) Run(ch chan error) {\n\tgo func() {\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(len(a.ops))\n\t\tfor _, op := range a.ops {\n\t\t\tgo func(op func() error) {\n\t\t\t\tif err := op(); err != nil {\n\t\t\t\t\tch <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\twg.Done()\n\t\t\t}(op)\n\t\t}\n\t\twg.Wait()\n\t\tch <- nil\n\t}()\n}", "title": "" }, { "docid": "aba735401cd627683766ff1aac805816", "score": "0.54336715", "text": "func (g *Group) Run() error {\n\tg.group.Add(func() error {\n\t\t<-g.stop\n\t\treturn nil\n\t}, func(err error) {\n\t\tg.Stop(nil)\n\t})\n\n\terr := g.group.Run()\n\n\treturn err\n}", "title": "" }, { "docid": "4be60b9d5c65b97023cf471c16c99e1b", "score": "0.54317296", "text": "func (t *Timer) run(done chan struct{}) {\n\t// we use a time.Ticker to update the state,\n\t// in many cases, this could be a network access instead.\n\ttick := time.NewTicker(50 * time.Millisecond)\n\tdefer tick.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase now := <-tick.C:\n\t\t\tt.update(now)\n\t\tcase <-done:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9cf6123f0a1162bb5dc865056b289035", "score": "0.541278", "text": "func Call(f func()) {\n\tdone := make(chan struct{})\n\tfuncQ <- func() {\n\t\tdefer func() {\n\t\t\tdone <- struct{}{}\n\t\t}()\n\t\tf()\n\t}\n\t<-done\n}", "title": "" }, { "docid": "f8c078900b7504083481b9c40e8d4029", "score": "0.540763", "text": "func (sd *StaticProvider) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {\n\t// We still have to consider that the consumer exits right away in which case\n\t// the context will be canceled.\n\tselect {\n\tcase ch <- sd.TargetGroups:\n\tcase <-ctx.Done():\n\t}\n\tclose(ch)\n}", "title": "" }, { "docid": "e2a90fe5158260d41073f6431361590f", "score": "0.5395543", "text": "func RunBot(token string, stop <-chan bool) <-chan error {\n\tdoneChan := make(chan error)\n\tgo runBotAsync(token, stop, doneChan)\n\n\treturn doneChan\n}", "title": "" }, { "docid": "343ef7790f05e3e7f1a9c22a825b4350", "score": "0.5375862", "text": "func (c *MemServiceController) Run(<-chan struct{}) {}", "title": "" }, { "docid": "4492730ef14e844f727738710e7ce355", "score": "0.53647596", "text": "func (r *PoolRunner) Run(out chan<- Result, supplier Supplier) {\n\tif out == nil {\n\t\tpanic(\"channel cannot be nil\")\n\t}\n\n\tcurrent := atomic.AddUint64(&r.counter, 1)\n\tindex := r.counter % uint64(r.config.Concurrency)\n\tr.argCh[index] <- argument{\n\t\tOut: out,\n\t\tSupplier: supplier,\n\t\tIndex: current,\n\t\tTimeSubmitted: time.Now().UnixNano(),\n\t}\n}", "title": "" }, { "docid": "a06656510f1bd70477e56f72a15598c1", "score": "0.53558064", "text": "func (c *ExpectedCall) Run(f func(Params)) *ExpectedCall {\n\tc.run = append(c.run, f)\n\treturn c\n}", "title": "" }, { "docid": "3b926e4fa2e7c0667860efeaaedbda53", "score": "0.53535265", "text": "func (ucs *Core) Run() {\n\tucs.ctx, ucs.ctxCancelFunc = context.WithCancel(context.Background())\n\n\tucs.wg.Add(1)\n\tgo ucs.run()\n}", "title": "" }, { "docid": "8e779f230b29478608bee8d94d7f7272", "score": "0.5350935", "text": "func Run(fn func()) { wf.Run(fn) }", "title": "" }, { "docid": "44018c29ffb3be4bc6089d6e7744f5a6", "score": "0.53488404", "text": "func (c *Client) Run() error {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tif err := c.Start(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn c.Wait()\n}", "title": "" }, { "docid": "6455ef975f871735a02dcac73aa391ba", "score": "0.5345594", "text": "func Run(reader Reader) {\n\tgo reader.Run()\n}", "title": "" }, { "docid": "920fcbc6339aeafa8a505c9c2beaadea", "score": "0.5340321", "text": "func (cooldown *Cooldown) Run(ctx context.Context, fn func(ctx context.Context) error) error {\n\tatomic.StoreInt32(&cooldown.runexec, 1)\n\tcooldown.initialize()\n\tdefer close(cooldown.stopped)\n\tfor {\n\t\t// prioritize stopping messages\n\t\tselect {\n\t\tcase <-cooldown.stopping:\n\t\t\treturn nil\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\t// handle trigger message\n\t\tselect {\n\t\tcase <-cooldown.trigger:\n\t\t\t// trigger the function\n\t\t\tif err := fn(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !Sleep(ctx, cooldown.interval) {\n\t\t\t\treturn ctx.Err()\n\t\t\t}\n\n\t\t\t// drain the channel to prevent messages received during sleep from triggering the function again\n\t\t\tselect {\n\t\t\tcase <-cooldown.trigger:\n\t\t\tdefault:\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-cooldown.stopping:\n\t\t\treturn nil\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "31720687930c256e78f1b622cc99911d", "score": "0.53330684", "text": "func (b *B) Run(name string, fn func(c *B)) bool {\n\treturn b.B.Run(name, func(b *testing.B) {\n\t\tfn(NewB(b))\n\t})\n}", "title": "" }, { "docid": "5050b1e1fafdb2ddd2ab89796b219c71", "score": "0.5332371", "text": "func Run() {\n\tcheckCh <- true\n}", "title": "" }, { "docid": "509003e4508c31b64eb7902624e7c941", "score": "0.53209245", "text": "func (r SSERouter) Run(ctx context.Context) error {\n\treturn r.fanOut.Run(ctx)\n}", "title": "" }, { "docid": "d38d92534d02bf014b26bb3019afe9f3", "score": "0.53206795", "text": "func (ctx *Context) Run(f call, timeout time.Duration) error {\n\treq := &f\n\n\tvar err error\n\tvar data []byte\n\n\tif data, err = req.localMarshal(); err != nil {\n\t\treturn err\n\t}\n\n\tctx.calls.Lock()\n\tctx.calls.Elem[req] = make(chan error)\n\tctx.calls.Unlock()\n\n\tdefer func() {\n\t\tctx.calls.Lock()\n\t\tclose(ctx.calls.Elem[req])\n\t\tdelete(ctx.calls.Elem, req)\n\t\tctx.calls.Unlock()\n\t}()\n\n\tvar n int\n\tif n, err = ctx.ufdStub.Write(data); err != nil {\n\t\treturn fmt.Errorf(\"write to stub fd failed, n: %d, err: %s\", n, err)\n\t}\n\n\tif timeout == 0 {\n\t\treturn nil\n\t}\n\n\tif timeout < 0 {\n\t\terr = <-ctx.calls.Elem[req]\n\t} else {\n\t\tt := time.NewTimer(timeout)\n\t\tselect {\n\t\tcase err = <-ctx.calls.Elem[req]:\n\t\t\tbreak\n\t\tcase <-t.C:\n\t\t\terr = fmt.Errorf(\"req: %+v timeout after %s\", req, timeout)\n\t\t}\n\t\tif !t.Stop() {\n\t\t\t<-t.C\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "96d7f6984fef71a09c18ef7e814070bf", "score": "0.5320602", "text": "func (m *funcChannel) RunAll() {\n finished := m.RunNext();\n for finished {\n finished = m.RunNext();\n }\n}", "title": "" }, { "docid": "1f9e964a2794d02a9473c1a5e94a83b2", "score": "0.53149724", "text": "func (m *ResultWriter) Run() error {\n\tdefer m.Ctx.Recover()\n\tdefer func() {\n\t\tclose(m.msgOutCh) // closing output channels is the signal to stop\n\t}()\n\tselect {\n\tcase err := <-m.errCh:\n\t\tu.Errorf(\"got error: %v\", err)\n\t\treturn err\n\tcase <-m.sigCh:\n\t\t// u.Debugf(\"%p got resultwriter.Run() sigquit?\", m)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "516bdd73da61be2091b95a90b7d8d67e", "score": "0.53008497", "text": "func (m *ReduceCallbackManager) RunCallbacks(in interface{}, params ...interface{}) (res interface{}, errs []error) {\n\terrs = m.seqMgr.RunCallbacks(append([]interface{}{&in}, params...)...)\n\tres = in\n\treturn\n}", "title": "" }, { "docid": "cb3ecf49ae0b0b9465e12496edee6886", "score": "0.52955544", "text": "func (c *Complete) Run() bool {\n\tc.AddFlags(nil)\n\tflag.Parse()\n\treturn c.Complete()\n}", "title": "" }, { "docid": "cb3ecf49ae0b0b9465e12496edee6886", "score": "0.52955544", "text": "func (c *Complete) Run() bool {\n\tc.AddFlags(nil)\n\tflag.Parse()\n\treturn c.Complete()\n}", "title": "" }, { "docid": "259252bceaea375de0b3553065d2a1d4", "score": "0.5294627", "text": "func Run() {\n\tfmt.Println(\"before func\")\n\tvar waitGroup sync.WaitGroup\n\twaitGroup.Add(2)\n\tgo func () {\n\t\tfmt.Println(\"func1\")\n\t\twaitGroup.Done();\n\t}()\n\tgo func () {\n\t\tfmt.Println(\"func2\")\n\t\twaitGroup.Done();\n\t}()\n\tfmt.Println(\"after func\")\n\twaitGroup.Wait()\n}", "title": "" }, { "docid": "528a96d985eeaa7dfaa2b258dc959b8b", "score": "0.5291718", "text": "func (r *Runner) run() error {\n\tfor id, task := range r.tasks {\n\t\t//check for interrupt\n\t\tif r.gotInterrupt() {\n\t\t\treturn ErrInterrupt\n\t\t}\n\t\t//Execute the registered task\n\t\ttask(id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86f433ba7a5a396a1508ac8ff902e5ed", "score": "0.52915585", "text": "func (c *ConfigMapController) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {\n\t// When this function completes, mark the go function as done\n\tdefer wg.Done()\n\n\t// Increment wait group as we're about to execute a go function\n\twg.Add(1)\n\n\t// Execute go function\n\n\tgo c.configmapInformer.Run(stopCh)\n\n\t// Wait till we receive a stop signal\n\t<-stopCh\n}", "title": "" }, { "docid": "13087714e8af22e8e532a85f5cc23075", "score": "0.52815026", "text": "func (f ComponentFunc) Run(ctx context.Context) error {\n\treturn f(ctx)\n}", "title": "" }, { "docid": "b69ae61ed4166dd467113ca9122a0909", "score": "0.52701145", "text": "func (s *genericStep) Run(ctx Context) error {\n\terr := s.fn(ctx)\n\tif err != nil {\n\t\tif s.stopOnErr {\n\t\t\treturn err\n\t\t}\n\t\tlogrus.Errorf(\"workflow step failed, but is not terminating (will continue): %s\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f551af69e614c2eb03de5e3308303f24", "score": "0.5259863", "text": "func (g *Async) Go(f func() errors.AppError) {\n\tg.wg.Add(1)\n\n\tgo func() {\n\t\tdefer g.wg.Done()\n\n\t\tif err := f(); err != nil {\n\t\t\tg.errOnce.Do(func() {\n\t\t\t\tg.err = err\n\t\t\t\tif g.cancel != nil {\n\t\t\t\t\tg.cancel()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "5ab671eab6040a66156ff5dce36093cc", "score": "0.5257676", "text": "func Run(onReady func(), onExit func()) {\n\tGetGuiProvider().Run(onReady, onExit)\n}", "title": "" }, { "docid": "6e6274fa1cfbd9354e7be995cad928d9", "score": "0.5253835", "text": "func (self *cor) run(ctx *CoRContext) error {\n\tvar panicError interface{}\n\tfor idx, function := range self.functions {\n\t\terr := func() error {\n\t\t\tdefer func() { if r := recover(); r != nil { panicError = r } }()\n\t\t\treturn function(ctx)\n\t\t}()\n\n\t\tif err != nil { return err }\n\t\tif panicError != nil { return NewStackError(\"CoR panic - chain: %s - index: %d - err: %v\", self.chainId, idx, panicError) }\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5ed24fe439b5187167c6d413ce13cc3", "score": "0.5249642", "text": "func (r *RedisQueue) Run(atShutdown, atTerminate func(context.Context, func())) {\n\tatShutdown(context.Background(), r.Shutdown)\n\tatTerminate(context.Background(), r.Terminate)\n\n\tgo func() {\n\t\t_ = r.pool.AddWorkers(r.workers, 0)\n\t}()\n\n\tgo r.readToChan()\n\n\tlog.Trace(\"RedisQueue: %s Waiting til closed\", r.name)\n\t<-r.closed\n\tlog.Trace(\"RedisQueue: %s Waiting til done\", r.name)\n\tr.pool.Wait()\n\n\tlog.Trace(\"RedisQueue: %s Waiting til cleaned\", r.name)\n\tctx, cancel := context.WithCancel(context.Background())\n\tatTerminate(ctx, cancel)\n\tr.pool.CleanUp(ctx)\n\tcancel()\n}", "title": "" }, { "docid": "df1b392d8909f2bb82f93cd7e350d559", "score": "0.52460194", "text": "func (t *T) Run(name string, fn func(c *T)) bool {\n\treturn t.T.Run(name, func(t *testing.T) {\n\t\tfn(NewT(t))\n\t})\n}", "title": "" }, { "docid": "7c71839c7988cdfb34e608797a5503d4", "score": "0.5244756", "text": "func (this *App) Run(callback AppCallback) error {\n\tthis.Logger.Debug2(\"<App>Run pid=%v\", os.Getpid())\n\n\t// Load the fonts\n\t//if err := this.loadfonts(); err != nil {\n\t//\treturn this.Logger.Error(\"Error loading fonts: %v\",err)\n\t//}\n\n\t// Go routine to wait for signal, and send finish signal in that case\n\tgo func() {\n\t\tsignal := <-this.signal_channel\n\t\tthis.Logger.Debug(\"<App>Run: caught signal: %v\", signal)\n\t\tthis.finish_channel <- true\n\t}()\n\n\t// Mark done flag as false\n\tthis.done = false\n\n\tif err := callback(this); err != nil {\n\t\treturn this.Logger.Error(\"%v\", err)\n\t}\n\n\t// TODO: Remove signal handlers\n\n\treturn nil\n}", "title": "" }, { "docid": "6dbc7c6adcbcd5becaf866b4172a7884", "score": "0.52434134", "text": "func (c *WebConsumer) Run() {\n\tc.Consumer.Consume(true, false)\n}", "title": "" }, { "docid": "9b09a925d0a3c8fa163a86942034d049", "score": "0.5237096", "text": "func (p *DirectConnectedProcess) RunTillDone() {\n\tfor {\n\t\tp.Step() \n\t\ttime.Sleep(10 * time.Millisecond) // yield\n\t}\n\tLog(p.P, \"done\")\n}", "title": "" }, { "docid": "7b9babfbaa00a9fa4c6f6557c696a348", "score": "0.52233857", "text": "func (m *mockRollbackClient) Run(r string) error {\n\treturn m.runFn(r)\n}", "title": "" }, { "docid": "9c77b4eeb11d782a1f3c5cfb5a1da991", "score": "0.52186215", "text": "func (f *fanIn) Run() {\n\tfor {\n\t\tfor _, channel := range f.channelsList {\n\t\t\tselect {\n\t\t\tcase <-f.ctx.Done():\n\t\t\t\tfmt.Println(\"Run: Time to return\")\n\t\t\t\treturn\n\t\t\tcase value, ok := <-channel:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tf.outChannel <- value\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "391312492f42cc499f1e0450e22e433c", "score": "0.5216327", "text": "func (g *Gate) Run(fn func()) {\n\tg.workers++\n\tg.Protect(fn)\n}", "title": "" }, { "docid": "b9b51125154ee49c9ea83f5ba0accf2e", "score": "0.52156055", "text": "func (crPipeline *ChefRunPipeline) Run(run *chef.Run, errc chan<- error) {\n\tchefRun := message.NewChefRun(context.Background(), run, errc)\n\n\tlog.WithFields(log.Fields{\n\t\t\"message_id\": chefRun.ID,\n\t\t\"message\": \"ChefRun\",\n\t\t\"buffer_size\": len(crPipeline.in),\n\t}).Debug(\"Running message through the pipeline\")\n\n\tcrPipeline.in <- chefRun\n}", "title": "" }, { "docid": "5b0749831c4ed2331aefae2fa105c8c0", "score": "0.5214898", "text": "func (t *TimerGen) Run() {\n go timerGenRutine(t)\n}", "title": "" }, { "docid": "7cd22aaeb14e82339ca9d5cbbe2015a4", "score": "0.52089375", "text": "func Run(t *testing.T) {\n\tf.Run(t)\n}", "title": "" }, { "docid": "d33b740fdf7dc22f93a7a44ff82e5cdc", "score": "0.5193847", "text": "func Run(builds []BuildFunc, run RunFunc) (func(), error) {\n\tfor _, build := range builds {\n\t\tif err := build(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif run == nil {\n\t\t//return func() {}, nil\n\t\treturn nil, nil\n\t}\n\n\treturn run()\n}", "title": "" }, { "docid": "77945f4c5079bc95e5156313d7973f72", "score": "0.51898456", "text": "func Run(handler interface{}, bot reddit.Bot, cfg Config) (\n\tfunc(),\n\tfunc() error,\n\terror,\n) {\n\tkill := make(chan bool)\n\terrs := make(chan error)\n\n\tif err := connectAllStreams(\n\t\thandler,\n\t\tbot,\n\t\tcfg,\n\t\tkill,\n\t\terrs,\n\t); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn launch(handler, kill, errs, logger(cfg.Logger))\n}", "title": "" }, { "docid": "659e3d0407b60086574bf3b8a7724263", "score": "0.5187981", "text": "func (g *Gorge) Run() {\n\tg.Start()\n\tfor {\n\t\tselect {\n\t\tcase dt := <-g.tick:\n\t\t\tg.UpdateNow(dt)\n\t\tcase <-g.done:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00f8c17e6d6a9ae5314f6187bedcc8dc", "score": "0.5186435", "text": "func (e *EventTestExecutor) Run(ctx context.Context, actions ...chromedp.Action) error {\n\targs := e.Called(ctx, actions)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "49f70751bf0b0dc254ba699b86be962c", "score": "0.5183074", "text": "func (step TaskStep) Run() error {\n\treturn step.Task()\n}", "title": "" }, { "docid": "88b125a72fcc942195d14c3307e95faa", "score": "0.51808745", "text": "func (t *Ticker) Run() {\n\t// read until done signal is received\n\tfor {\n\t\tselect {\n\t\tcase <-t.Done:\n\t\t\treturn\n\t\tcase <-t.Ticker.C:\n\t\t\ts, err := Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Errs <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Data <- s\n\t\t}\n\t}\n}", "title": "" }, { "docid": "88b125a72fcc942195d14c3307e95faa", "score": "0.51808745", "text": "func (t *Ticker) Run() {\n\t// read until done signal is received\n\tfor {\n\t\tselect {\n\t\tcase <-t.Done:\n\t\t\treturn\n\t\tcase <-t.Ticker.C:\n\t\t\ts, err := Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Errs <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Data <- s\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ce479b81a905719ddaf989449b713e06", "score": "0.5173151", "text": "func (r *ComputationRunner) run() {\n\tr.startTime = time.Now()\n\tfor r.running = true; r.running; {\n\t\tselect {\n\t\tdefault:\n\t\t\tr.runOneComputation()\n\t\t\tif r.maxIteration > 0 {\n\t\t\t\tif r.maxIteration--; r.maxIteration == 0 {\n\t\t\t\t\tr.running = false\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-r.stop:\n\t\t\tlog.Print(\"[INFO] Computation runner received stop signal\\n\")\n\t\t\tr.running = false\n\t\t}\n\t\truntime.Gosched()\n\t}\n\tlog.Print(\"[INFO] Computation runner stopped\\n\")\n\tr.stopTime = time.Now()\n\tr.stop <- true\n}", "title": "" }, { "docid": "3243baa023ed866dd52f66cafc981349", "score": "0.51722056", "text": "func (d *Dealer) Run(ctx context.Context) error {\n\td.shutdownMu.Lock()\n\tshutdownCh := make(chan struct{})\n\td.shutdownCh = shutdownCh\n\td.shutdownMu.Unlock()\n\tfor {\n\t\tselect {\n\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\n\t\t\t// This channel never closes\n\t\tcase msg := <-d.chatInputCh:\n\t\t\terr := d.handleMessage(ctx, msg)\n\t\t\tif err != nil {\n\t\t\t\td.dh.CLogf(ctx, \"Error reading message: %s\", err.Error())\n\t\t\t}\n\n\t\t\t// exit the loop if we've shutdown\n\t\tcase <-shutdownCh:\n\t\t\treturn io.EOF\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b6a311af33afce76811a52337490d50", "score": "0.5160598", "text": "func (cmd *CallbackAuthCommand) Run(c *client.Client) (*http.Response, error) {\n\treturn c.CallbackAuth(cmd.Path)\n}", "title": "" }, { "docid": "cc43d03e4f2ef67ad24d04edbe25f0ee", "score": "0.51603746", "text": "func Run(errchan chan<- error, port int, registerService RegisterService) {\n\tvar err error\n\n\ts := &grpcServer{}\n\ts.port = port\n\n\taddress := fmt.Sprintf(\"0.0.0.0:%d\", port)\n\ts.listen, err = net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\terrchan <- er.Error(err, \"Failed to listen\")\n\t\treturn\n\t}\n\n\tlog.InfoF(\"listen address: %s\", address)\n\n\topts := []grpc_recovery.Option{\n\t\tgrpc_recovery.WithRecoveryHandler(recoveryHandlerFunc),\n\t}\n\n\ts.server = gr.NewServer(\n\t\tgr.StreamInterceptor(mw.ChainStreamServer(\n\t\t\tgrpc_recovery.StreamServerInterceptor(opts...),\n\t\t)),\n\t\tgr.UnaryInterceptor(mw.ChainUnaryServer(\n\t\t\tgrpc_recovery.UnaryServerInterceptor(opts...),\n\t\t)),\n\t)\n\n\tregisterService(s.server)\n\n\tgo s.Run(errchan)\n}", "title": "" }, { "docid": "fe4e4387c828fc8f6dc71e4ea704022c", "score": "0.5157213", "text": "func Run(done chan<- error, rdy chan<- struct{}, sig <-chan struct{}) {\n\n\tLoad()\n\n\ttimeout := time.Now()\n\tlastRun := time.Now()\n\tclose(rdy)\n\tfor {\n\t\tselect {\n\t\tcase <-sig: // stop service loop\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\tfmt.Println(\"\\tServices .. \")\n\n\t\t\t// empty all services\n\t\t\tfor _, srv := range runnableServices {\n\t\t\t\tsrv.Empty()\n\t\t\t}\n\n\t\t\tdone <- nil\n\t\t\treturn\n\n\t\tdefault: // run services\n\t\t\ttime.Sleep(time.Millisecond * 500)\n\n\t\t\t// check if we can run the services\n\t\t\tif !timeout.Before(time.Now().UTC().Add(1 * time.Hour)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// get a timeout, this way it will never be below a timeout\n\t\t\t// if it is below a timeout it will cause unnecesary func calls/checks\n\t\t\t// A service will always have a lower timeout than 1000 hours.\n\t\t\tnextRun := time.Duration(1000 * time.Hour)\n\n\t\t\t// For every service initiate their main action\n\t\t\tfor _, srv := range runnableServices {\n\t\t\t\tif srv.Timeout() == time.Duration(0) {\n\t\t\t\t\tsrv.Run()\n\t\t\t\t} else if nextRun > srv.Timeout() {\n\t\t\t\t\tnextRun = srv.Timeout()\n\t\t\t\t}\n\t\t\t}\n\t\t\tlastRun = time.Now().UTC().Add(1 * time.Hour)\n\t\t\ttimeout = lastRun.Add(nextRun)\n\t\t} // select\n\t} // for\n}", "title": "" }, { "docid": "0a6112f444bed76fa4f316d879ea897d", "score": "0.51553696", "text": "func (awbc *AntriWriteBenchClient) Run(ctx context.Context) {\r\n\t// initialize once\r\n\t// reduce allocation during the test\r\n\ttasks := make([]*proto.NewTask, 0, len(awbc.messages))\r\n\r\n\t// run the function till context is timeout/done\r\n\tfor {\r\n\t\tselect {\r\n\t\tcase <-ctx.Done():\r\n\t\t\treturn\r\n\t\tdefault:\r\n\t\t\tstartTime := time.Now()\r\n\r\n\t\t\t// the main work\r\n\t\t\tfor i := 0; i < len(awbc.messages); i++ {\r\n\t\t\t\ttasks = append(tasks, &proto.NewTask{\r\n\t\t\t\t\tContent: awbc.messages[i],\r\n\t\t\t\t\tSecondsFromNow: awbc.minSecondsFromNow +\r\n\t\t\t\t\t\tuint32(rand.Intn(int(awbc.maxSecondsFromNow-awbc.minSecondsFromNow))),\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t\tresp, err := awbc.c.AddTasks(ctx, &proto.AddTasksRequest{Tasks: tasks})\r\n\r\n\t\t\t// result tracking\r\n\t\t\tawbc.timeTaken = append(awbc.timeTaken, float64(time.Now().Sub(startTime)))\r\n\t\t\tawbc.processedCount++\r\n\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Println(err)\r\n\t\t\t\tawbc.failedCount++\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tif !resp.Result {\r\n\t\t\t\tawbc.failedCount++\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tawbc.successCount++\r\n\t\t\tawbc.messageProcessedCount += len(tasks)\r\n\r\n\t\t\t// reset tasks' content\r\n\t\t\ttasks = tasks[:0]\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "588aa7e8310572bb44727e377d45e975", "score": "0.5154901", "text": "func (g *Group) Go(f func(ctx context.Context) error, callbacks ...func()) {\n\tg.wg.Add(1)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tg.wg.Done()\n\t\t\tfor _, callback := range callbacks {\n\t\t\t\tcallback()\n\t\t\t}\n\t\t}()\n\t\tdefer func() {\n\t\t\tif g.cancel != nil {\n\t\t\t\tg.cancel()\n\t\t\t}\n\t\t}()\n\t\terr := f(g.ctx)\n\t\tg.errOnce.Do(func() {\n\t\t\tg.err = err\n\t\t})\n\t}()\n}", "title": "" }, { "docid": "e133a3c20d8e2698dcad9abea90e70b0", "score": "0.5151644", "text": "func (f *FluxTest) Run() error {\n\tg := errgroup.Group{}\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tchainlinkMap, err := f.mapChainlinkByETHAddress()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Go(func() error {\n\t\treturn f.watchSubmissions(ctx, chainlinkMap)\n\t})\n\n\tif err := f.createChainlinkJobs(); err != nil {\n\t\treturn err\n\t}\n\tfor i := 1; i <= f.TestOptions.NumberOfRounds; i++ {\n\t\tif err := f.adapter.SetVariable(i); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f.waitForAllContractRounds(big.NewInt(int64(i))); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := f.waitForAllSubmissions(cancel); err != nil {\n\t\treturn err\n\t}\n\treturn g.Wait()\n}", "title": "" }, { "docid": "77c6b1376b43cbdcbb3f687c1333f64f", "score": "0.51510656", "text": "func RunWithDeadline(ctx context.Context, deadline time.Time, f func() error) error {\n\tctx, cancel := context.WithDeadline(ctx, deadline)\n\tdefer cancel()\n\n\tch := make(chan error, 1)\n\tgo func() {\n\t\tch <- f()\n\t}()\n\n\tselect {\n\tcase err := <-ch:\n\t\treturn err\n\tcase <-ctx.Done():\n\t\treturn fmt.Errorf(\"Function timed out: %w\", ctx.Err())\n\t}\n}", "title": "" }, { "docid": "0cd382e1a12e1ea5990f3c50f07ae53d", "score": "0.5149521", "text": "func Test_add_done_callback(t *testing.T) {\n\tresult := make(chan string)\n\tfuturepointer := setup_routine(print_something, result)\n\tgo add_done_callback(print_something_new, futurepointer)\n\ttime.Sleep(10 * time.Second)\n}", "title": "" }, { "docid": "c2e826834b1f313d80475bd6d0b75075", "score": "0.5147627", "text": "func (t *testResourceWatcher) run() {\n\tfor {\n\t\tselect {\n\t\tcase event := <-t.watch.ResultChan():\n\t\t\tt.lock.Lock()\n\t\t\tt.events = append(t.events, event)\n\t\t\tt.lock.Unlock()\n\t\tcase <-t.watchClosedCh:\n\t\t\tlog.Info(\"Exiting test watch loop\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7e98b8e6e21399f95139f8388ebba88", "score": "0.5146886", "text": "func (t Task) Run() error {\n\treturn nil\n}", "title": "" }, { "docid": "97f9ca8dbf7600744d20b8a644da43ac", "score": "0.51443684", "text": "func (c *Client) Run(ctx context.Context, chain []string, options [][]string, input io.Reader, output io.Writer) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tctx = metadata.NewOutgoingContext(ctx, metadata.MD{\n\t\t\"chain\": chain,\n\t\t\"options\": buildOptionsForMetadata(options),\n\t})\n\tcli, err := c.client.Run(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdone := make(chan error, 3)\n\tgo func() {\n\t\tdone <- btrfaasgrpc.CopyToStream(ctx, input, cli)\n\t\tdone <- cli.CloseSend()\n\t}()\n\tgo func() {\n\t\tdone <- btrfaasgrpc.CopyFromStream(ctx, cli, output)\n\t}()\n\n\ttodo := 3 // send done, close-send done, read done\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\t{\n\t\t\t\treturn ctx.Err()\n\t\t\t}\n\t\tcase err := <-done:\n\t\t\t{\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttodo--\n\t\t\t\tif todo == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68babde1f9d423d8dcb9c5ef67526f26", "score": "0.5144352", "text": "func (r *Runner) Run() {\n\ttokC, errC := r.read()\n\n\tfor {\n\t\tselect {\n\t\tcase tok := <-tokC:\n\t\t\tgo r.handleReads(tok)\n\n\t\tcase err := <-errC:\n\t\t\terr.Conn.Write(err.json())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "07d3ec6ee886a226572069da6c9fc7b3", "score": "0.51437235", "text": "func Run(server Server, shutdown Shutdown) error {\n\tserve := make(chan error, 1)\n\n\tgo safe.Do(func() error {\n\t\treturn server.ListenAndServe()\n\t}, func(err error) {\n\t\tserve <- errors.Wrap(err, \"tried to listen and serve a connection\")\n\t\tclose(serve)\n\t})\n\n\tselect {\n\tcase callback := <-shutdown:\n\t\tshutdownErr := errors.Wrap(server.Shutdown(callback.Context), \"tried to shutting down the server\")\n\t\tcallback.Result <- shutdownErr\n\t\treturn shutdownErr\n\tcase serveErr := <-serve:\n\t\treturn serveErr\n\t}\n}", "title": "" }, { "docid": "a28de4976204f68b6165694e76607c15", "score": "0.5140925", "text": "func (t *Ticker) Run() {\n\t// ticker\n\tfor {\n\t\tselect {\n\t\tcase <-t.Done:\n\t\t\treturn\n\t\tcase <-t.C:\n\t\t\ts, err := t.Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Errs <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Data <- s\n\t\t}\n\t}\n}", "title": "" }, { "docid": "91de91dbbf6fc9785f9b81998b1abf9b", "score": "0.5135511", "text": "func (t *Ticker) Run() {\n\t// read until done signal is received\n\tfor {\n\t\tselect {\n\t\tcase <-t.Done:\n\t\t\treturn\n\t\tcase <-t.Ticker.C:\n\t\t\tp, err := Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Errs <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Data <- p\n\t\t}\n\t}\n}", "title": "" } ]
9441c6c05ff94aea61ae81390269c0f0
Convert_machine_AzureSubResource_To_v1alpha1_AzureSubResource is an autogenerated conversion function.
[ { "docid": "16fe6e1f7af1f6d70c7e8c5d666559d3", "score": "0.77328944", "text": "func Convert_machine_AzureSubResource_To_v1alpha1_AzureSubResource(in *machine.AzureSubResource, out *AzureSubResource, s conversion.Scope) error {\n\treturn autoConvert_machine_AzureSubResource_To_v1alpha1_AzureSubResource(in, out, s)\n}", "title": "" } ]
[ { "docid": "0f8e40e969325859781266ef66361ece", "score": "0.71873593", "text": "func Convert_v1alpha1_AzureSubResource_To_machine_AzureSubResource(in *AzureSubResource, out *machine.AzureSubResource, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_AzureSubResource_To_machine_AzureSubResource(in, out, s)\n}", "title": "" }, { "docid": "d3b7eb820e2bf27c78fd287fe4ed130e", "score": "0.5795096", "text": "func (in *SubResource_ARM) DeepCopy() *SubResource_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubResource_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "22f6c2ed9b0589791509f81d305cd87f", "score": "0.5450147", "text": "func (in *SubResource) DeepCopy() *SubResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "22f6c2ed9b0589791509f81d305cd87f", "score": "0.5450147", "text": "func (in *SubResource) DeepCopy() *SubResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f4d9c363831a454c3b2825ab3f8e77e4", "score": "0.524648", "text": "func (r *Request) SubResource(s string) *Request {\n\tr.subResource = &s\n\treturn r\n}", "title": "" }, { "docid": "f016579cbca1608e084c5a41cb0c14f2", "score": "0.51996017", "text": "func (n *ProviderNode) SubResource(resource *Resource) error {\n\tif n.Node == nil {\n\t\treturn fmt.Errorf(\"ProviderNode node has not init\")\n\t}\n\tn.Lock()\n\tdefer n.Unlock()\n\tvkResource := ConvertResource(n.Status.Capacity)\n\n\tvkResource.Sub(resource)\n\tvkResource.SetCapacityToNode(n.Node)\n\treturn nil\n}", "title": "" }, { "docid": "7ab3e041d8a9d476e3e79217d8b5e005", "score": "0.5117268", "text": "func (c *MockClient) SubResource(_ string) client.SubResourceClient {\n\treturn &MockSubResourceClient{\n\t\tMockGet: c.MockSubResourceGet,\n\t\tMockCreate: c.MockSubResourceCreate,\n\t\tMockUpdate: c.MockSubResourceUpdate,\n\t\tMockPatch: c.MockSubResourcePatch,\n\t}\n}", "title": "" }, { "docid": "f6d39fcae9629920654f1eb95279e622", "score": "0.504556", "text": "func (in *CustomResourceSubresourceScale) DeepCopy() *CustomResourceSubresourceScale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomResourceSubresourceScale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ee1fdf4512c3887f08d2dbc0c17123fa", "score": "0.5031532", "text": "func (in *SubResource_STATUS_ARM) DeepCopy() *SubResource_STATUS_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubResource_STATUS_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c6403933267a56d71a856517d1fd7a19", "score": "0.48660392", "text": "func (o ResourceAttributesOutput) Subresource() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ResourceAttributes) *string { return v.Subresource }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5f161e6a4ad13cd34df56b9070a6061f", "score": "0.4847341", "text": "func (src *AzureMachine) ConvertTo(dstRaw conversion.Hub) error {\n\tdst := dstRaw.(*infrav1.AzureMachine)\n\tif err := Convert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(src, dst, nil); err != nil {\n\t\treturn err\n\t}\n\n\t// Manually restore data from annotations\n\trestored := &infrav1.AzureMachine{}\n\tif ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {\n\t\treturn err\n\t}\n\n\t// Handle special case for conversion of ManagedDisk to pointer.\n\tif restored.Spec.OSDisk.ManagedDisk == nil && dst.Spec.OSDisk.ManagedDisk != nil {\n\t\tif *dst.Spec.OSDisk.ManagedDisk == (infrav1.ManagedDiskParameters{}) {\n\t\t\t// restore nil value if nothing has changed since conversion\n\t\t\tdst.Spec.OSDisk.ManagedDisk = nil\n\t\t}\n\t}\n\n\tif restored.Spec.Image != nil && restored.Spec.Image.SharedGallery != nil {\n\t\tdst.Spec.Image.SharedGallery.Offer = restored.Spec.Image.SharedGallery.Offer\n\t\tdst.Spec.Image.SharedGallery.Publisher = restored.Spec.Image.SharedGallery.Publisher\n\t\tdst.Spec.Image.SharedGallery.SKU = restored.Spec.Image.SharedGallery.SKU\n\t}\n\n\tif dst.Spec.Image != nil && restored.Spec.Image.ComputeGallery != nil {\n\t\tdst.Spec.Image.ComputeGallery = restored.Spec.Image.ComputeGallery\n\t}\n\n\tif restored.Spec.AdditionalCapabilities != nil {\n\t\tdst.Spec.AdditionalCapabilities = restored.Spec.AdditionalCapabilities\n\t}\n\n\tif len(restored.Spec.DNSServers) > 0 {\n\t\tdst.Spec.DNSServers = restored.Spec.DNSServers\n\t}\n\n\tif len(restored.Spec.VMExtensions) > 0 {\n\t\tdst.Spec.VMExtensions = restored.Spec.VMExtensions\n\t}\n\n\tif restored.Spec.SpotVMOptions != nil && restored.Spec.SpotVMOptions.EvictionPolicy != nil {\n\t\tdst.Spec.SpotVMOptions.EvictionPolicy = restored.Spec.SpotVMOptions.EvictionPolicy\n\t}\n\n\tif restored.Spec.Diagnostics != nil {\n\t\tdst.Spec.Diagnostics = restored.Spec.Diagnostics\n\t}\n\n\tif restored.Spec.NetworkInterfaces != nil {\n\t\tdst.Spec.NetworkInterfaces = restored.Spec.NetworkInterfaces\n\t}\n\n\tif restored.Spec.SystemAssignedIdentityRole != nil {\n\t\tdst.Spec.SystemAssignedIdentityRole = restored.Spec.SystemAssignedIdentityRole\n\t}\n\n\t//nolint:staticcheck // SubnetName is now deprecated, but the v1beta1 defaulting webhook will migrate it to the networkInterfaces field\n\tdst.Spec.SubnetName = restored.Spec.SubnetName\n\n\tdst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates\n\n\treturn nil\n}", "title": "" }, { "docid": "e1422ca787d8bb0c3b0df1429409590e", "score": "0.48091036", "text": "func (auo *AccountUpdateOne) SetSub(s string) *AccountUpdateOne {\n\tauo.mutation.SetSub(s)\n\treturn auo\n}", "title": "" }, { "docid": "8d2dad6bc5afbdaf0bf7c264d76e2e68", "score": "0.47877628", "text": "func (in *AzureSpec) DeepCopy() *AzureSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3bbb2953730382c73f74285c1403996f", "score": "0.47712258", "text": "func (b *Block) Sub(lhs value.Value, rhs value.Value) *instructions.Sub {\n\ti := instructions.NewSub(b, b.nextName(), lhs, rhs)\n\tb.instructions = append(b.instructions, i)\n\treturn i\n}", "title": "" }, { "docid": "458512de9ef2f5ff7f22f709b6a65b20", "score": "0.47584662", "text": "func (in *CustomResourceSubresources) DeepCopy() *CustomResourceSubresources {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomResourceSubresources)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "39ea55fc4f3da5d340ef28e12efb5c95", "score": "0.4726031", "text": "func (in *SubResource_STATUS) DeepCopy() *SubResource_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubResource_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "487979fc15ce58ca1b3a824ba621b1be", "score": "0.47179666", "text": "func (o HostNameResponseOutput) AzureResourceName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HostNameResponse) *string { return v.AzureResourceName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c59be6b8a2a734efe8e3aa54cebbeab4", "score": "0.47064865", "text": "func (p *Poly) Sub(a, b *Poly) {\n\tif cpu.X86.HasAVX2 {\n\t\tsubAVX2(\n\t\t\t(*[N]int16)(p),\n\t\t\t(*[N]int16)(a),\n\t\t\t(*[N]int16)(b),\n\t\t)\n\t} else {\n\t\tp.subGeneric(a, b)\n\t}\n}", "title": "" }, { "docid": "574a3bef1a3f608eab9497b4df0fc5f5", "score": "0.46923977", "text": "func (au *AccountUpdate) SetSub(s string) *AccountUpdate {\n\tau.mutation.SetSub(s)\n\treturn au\n}", "title": "" }, { "docid": "fde5462b5f9e6ef76cceb2db716d20e0", "score": "0.4679322", "text": "func (in *AzureResourceTag) DeepCopy() *AzureResourceTag {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureResourceTag)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "49e5776043b6143624371abe9f4741a3", "score": "0.4677861", "text": "func (in *CustomResourceSubresourceStatus) DeepCopy() *CustomResourceSubresourceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomResourceSubresourceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "45e71ca88e4aa30b7ac4aa8b7cff6848", "score": "0.46742764", "text": "func (r *azureDeploymentReconcilerInstance) ConvertResourceToARMResource(ctx context.Context) (genruntime.ARMResource, error) {\n\tmetaObject := r.Obj\n\tscheme := r.ResourceResolver.Scheme()\n\n\tresult, err := ConvertToARMResourceImpl(ctx, metaObject, scheme, r.ResourceResolver, r.ARMConnection.SubscriptionID())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Run any resource-specific extensions\n\tmodifier := extensions.CreateARMResourceModifier(r.Extension, r.ARMConnection.Client(), r.KubeClient, r.ResourceResolver, r.Log)\n\treturn modifier(ctx, metaObject, result)\n}", "title": "" }, { "docid": "6e0c254fc1607a3cffd93e9fe4871cbe", "score": "0.46571147", "text": "func (params *AzureBackupParams) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif params == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &AzureBackupParams_ARM{}\n\n\t// Set property \"BackupType\":\n\tif params.BackupType != nil {\n\t\tbackupType := *params.BackupType\n\t\tresult.BackupType = &backupType\n\t}\n\n\t// Set property \"ObjectType\":\n\tif params.ObjectType != nil {\n\t\tresult.ObjectType = *params.ObjectType\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ae05ba6cd40565c57c5724e2b80211e2", "score": "0.46566585", "text": "func (r *Request) subResource(subPath string) *Request {\n\tsubPath = strings.TrimLeft(subPath, \"/\")\n\tr.subPath = subPath\n\treturn r\n}", "title": "" }, { "docid": "1ce50bd488136c1220ad21eed5ace6c2", "score": "0.4647348", "text": "func (o ResourceAttributesPatchOutput) Subresource() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ResourceAttributesPatch) *string { return v.Subresource }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d5f3e9da15bbbc07bcce09fec9f6f0ab", "score": "0.4611226", "text": "func (in *ScaleSubresourceStatus) DeepCopy() *ScaleSubresourceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScaleSubresourceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7f831ebee3e4b1dd0d4bd0951c428236", "score": "0.4591356", "text": "func (rule *AzureBackupRule) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif rule == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &AzureBackupRule_ARM{}\n\n\t// Set property \"BackupParameters\":\n\tif rule.BackupParameters != nil {\n\t\tbackupParameters_ARM, err := (*rule.BackupParameters).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbackupParameters := *backupParameters_ARM.(*BackupParameters_ARM)\n\t\tresult.BackupParameters = &backupParameters\n\t}\n\n\t// Set property \"DataStore\":\n\tif rule.DataStore != nil {\n\t\tdataStore_ARM, err := (*rule.DataStore).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdataStore := *dataStore_ARM.(*DataStoreInfoBase_ARM)\n\t\tresult.DataStore = &dataStore\n\t}\n\n\t// Set property \"Name\":\n\tif rule.Name != nil {\n\t\tname := *rule.Name\n\t\tresult.Name = &name\n\t}\n\n\t// Set property \"ObjectType\":\n\tif rule.ObjectType != nil {\n\t\tresult.ObjectType = *rule.ObjectType\n\t}\n\n\t// Set property \"Trigger\":\n\tif rule.Trigger != nil {\n\t\ttrigger_ARM, err := (*rule.Trigger).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttrigger := *trigger_ARM.(*TriggerContext_ARM)\n\t\tresult.Trigger = &trigger\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7cca167e4d8a31148d6b046ed03f1530", "score": "0.45677826", "text": "func (r *Request) SubResourcef(subPath string, args ...interface{}) *Request {\n\tr.subPathArgs = args\n\treturn r.subResource(subPath)\n}", "title": "" }, { "docid": "977f4cb1f408ffff9817227c1074406f", "score": "0.4565274", "text": "func (o HostNameResponseOutput) AzureResourceType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HostNameResponse) *string { return v.AzureResourceType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e940e32b4203b595237f10af5487a225", "score": "0.4514755", "text": "func (a *AzureResourceBase) 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\", a, 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\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e940e32b4203b595237f10af5487a225", "score": "0.4514755", "text": "func (a *AzureResourceBase) 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\", a, 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\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87b7dacdcc46a970a30b8632a7e4d2db", "score": "0.44936782", "text": "func ConvertToARMResourceImpl(\n\tctx context.Context,\n\tmetaObject genruntime.ARMMetaObject,\n\tscheme *runtime.Scheme,\n\tresolver *resolver.Resolver,\n\tsubscriptionID string) (genruntime.ARMResource, error) {\n\tspec, err := genruntime.GetVersionedSpec(metaObject, scheme)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to get spec from %s\", metaObject.GetObjectKind().GroupVersionKind())\n\t}\n\n\tarmTransformer, ok := spec.(genruntime.ARMTransformer)\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"spec was of type %T which doesn't implement genruntime.ArmTransformer\", spec)\n\t}\n\n\tresourceHierarchy, resolvedDetails, err := resolver.ResolveAll(ctx, metaObject)\n\tif err != nil {\n\t\treturn nil, reconcilers.ClassifyResolverError(err)\n\t}\n\n\tarmSpec, err := armTransformer.ConvertToARM(resolvedDetails)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"transforming resource %s to ARM\", metaObject.GetName())\n\t}\n\n\ttypedArmSpec, ok := armSpec.(genruntime.ARMResourceSpec)\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"casting armSpec of type %T to genruntime.ARMResourceSpec\", armSpec)\n\t}\n\n\tarmID, err := resourceHierarchy.FullyQualifiedARMID(subscriptionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := genruntime.NewARMResource(typedArmSpec, nil, armID)\n\treturn result, nil\n}", "title": "" }, { "docid": "b04cdf7f9a486c1736808e3af29d75f1", "score": "0.44879597", "text": "func (parameters *BackupParameters) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif parameters == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &BackupParameters_ARM{}\n\n\t// Set property \"AzureBackupParams\":\n\tif parameters.AzureBackupParams != nil {\n\t\tazureBackupParams_ARM, err := (*parameters.AzureBackupParams).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tazureBackupParams := *azureBackupParams_ARM.(*AzureBackupParams_ARM)\n\t\tresult.AzureBackupParams = &azureBackupParams\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9d8d1fb80b445e0764c08b8ef5d0cc3d", "score": "0.44787964", "text": "func SubResourceGenerator() gopter.Gen {\n\tif subResourceGenerator != nil {\n\t\treturn subResourceGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tsubResourceGenerator = gen.Struct(reflect.TypeOf(SubResource{}), generators)\n\n\treturn subResourceGenerator\n}", "title": "" }, { "docid": "f7bcf9dc5aea9482c6eb1c2affb0b3f5", "score": "0.44775653", "text": "func (s *Scalar) Sub(a, b *Scalar) *Scalar {\n\tvar borrow uint16\n\tfor i := 0; i < 32; i++ {\n\t\tborrow = uint16(a[i]) - uint16(b[i]) - (borrow >> 15)\n\t\ts[i] = uint8(borrow)\n\t}\n\n\t// Add l if underflown\n\tufMask := ((borrow >> 15) ^ 1) - 1\n\tvar carry uint16\n\tfor i := 0; i < 32; i++ {\n\t\tcarry = uint16(s[i]) + (carry >> 8) + (uint16(scL[i]) & ufMask)\n\t\ts[i] = uint8(carry)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "e6e0011948e69f176e5b0ef46725c9aa", "score": "0.44256067", "text": "func (o ResourceAttributesPtrOutput) Subresource() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ResourceAttributes) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subresource\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "21240876aeaa5cb25d0751be9fd371a1", "score": "0.44183415", "text": "func (c AzureMetricClient) GetAzureMetric(metricSelector labels.Selector) (external_metrics.ExternalMetricValue, error) {\n\tazMetricRequest, err := parseAzureMetric(metricSelector, c.defaultSubscriptionID)\n\tif err != nil {\n\t\treturn external_metrics.ExternalMetricValue{}, err\n\t}\n\tmetricResourceURI := azMetricRequest.metricResourceURI()\n\tglog.V(2).Infof(\"resource uri: %s\", metricResourceURI)\n\n\t// make call to azure resource provider with subscription id provided issue #9\n\tc.monitorClient.SubscriptionID = azMetricRequest.subscriptionID\n\tmetricResult, err := c.monitorClient.List(context.Background(), metricResourceURI,\n\t\tazMetricRequest.timespan, nil,\n\t\tazMetricRequest.metricName, azMetricRequest.aggregation, nil,\n\t\t\"\", azMetricRequest.filter, \"\", \"\")\n\tif err != nil {\n\t\treturn external_metrics.ExternalMetricValue{}, err\n\t}\n\n\ttotal := extractValue(metricResult)\n\n\tglog.V(2).Infof(\"found metric value: %s\", total)\n\n\t// TODO set Value based on aggregations type\n\treturn external_metrics.ExternalMetricValue{\n\t\tMetricName: azMetricRequest.resourceName,\n\t\tValue: *resource.NewQuantity(int64(total), resource.DecimalSI),\n\t\tTimestamp: metav1.Now(),\n\t}, nil\n}", "title": "" }, { "docid": "f1b2635dc73a109cf7114a35a66d34da", "score": "0.44025195", "text": "func (src *AzureMachineList) ConvertTo(dstRaw conversion.Hub) error {\n\tdst := dstRaw.(*infrav1.AzureMachineList)\n\treturn Convert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList(src, dst, nil)\n}", "title": "" }, { "docid": "11916e3ffca9325191d512a55a7fcc61", "score": "0.43848544", "text": "func NewSub(address common.Address, backend bind.ContractBackend) (*Sub, error) {\n\tcontract, err := bindSub(address, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Sub{SubCaller: SubCaller{contract: contract}, SubTransactor: SubTransactor{contract: contract}}, nil\n}", "title": "" }, { "docid": "83982681cc21043ea699425c8e7f7067", "score": "0.4366733", "text": "func (r Version1Resource) SubResources() routing.Matcher {\n\treturn routing.Sequence(\n\t\trouting.Prefix(\"/masterkey\", rest.ResourceMatcher(r.masterKeyResource)),\n\t\trest.ResourcesMatcher(\"/identities\", r.identitiesResource),\n\t\trest.ResourcesMatcher(\"/secrets\", r.secretsResource),\n\t\trouting.Prefix(\"/estimate\", rest.ResourceMatcher(r.estimateResource)),\n\t\trouting.Prefix(\"/generate\", rest.ResourceMatcher(r.generateResource)),\n\t)\n}", "title": "" }, { "docid": "37614637326f581dcc5a33a4a2d4a23f", "score": "0.43554944", "text": "func (rule *BasePolicyRule) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif rule == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &BasePolicyRule_ARM{}\n\n\t// Set property \"AzureBackup\":\n\tif rule.AzureBackup != nil {\n\t\tazureBackup_ARM, err := (*rule.AzureBackup).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tazureBackup := *azureBackup_ARM.(*AzureBackupRule_ARM)\n\t\tresult.AzureBackup = &azureBackup\n\t}\n\n\t// Set property \"AzureRetention\":\n\tif rule.AzureRetention != nil {\n\t\tazureRetention_ARM, err := (*rule.AzureRetention).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tazureRetention := *azureRetention_ARM.(*AzureRetentionRule_ARM)\n\t\tresult.AzureRetention = &azureRetention\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6ab9fce828f7f4a396ac161ce9f46158", "score": "0.43554294", "text": "func NewAzure(ctx *pulumi.Context, resourceGroupName pulumi.StringOutput, name, talkPhase string) (*storage.Account, error) {\n\n\t// strip dashes from the name as they're not allowed\n\tname = strings.ReplaceAll(name, \"-\", \"\")\n\t// Create an Azure resource (Storage Account)\n\taccount, err := storage.NewAccount(ctx, name, &storage.AccountArgs{\n\t\tResourceGroupName: resourceGroupName,\n\t\tAccountTier: pulumi.String(\"Standard\"),\n\t\tAccountReplicationType: pulumi.String(\"LRS\"),\n\t\tTags: pulumi.StringMap{\n\t\t\t\"project\": pulumi.String(\"going-serverless-talk\"),\n\t\t\t\"talk-phase\": pulumi.String(talkPhase),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn account, nil\n}", "title": "" }, { "docid": "8732920ecc9e83cff148cc61c4737039", "score": "0.43257964", "text": "func (topic *Namespaces_Topic_Spec) SetAzureName(azureName string) { topic.AzureName = azureName }", "title": "" }, { "docid": "9732f16bf5ee5818cca1571d8bd65765", "score": "0.43248177", "text": "func (c *Complex) Sub(a, b *Complex) {\n\tc[0].Sub(a[0], b[0])\n\tc[1].Sub(a[1], b[1])\n}", "title": "" }, { "docid": "a8782325a0d79359af5c6bf2b721145b", "score": "0.43232214", "text": "func (_BasAsset *BasAssetTransactor) MintSubAsset(opts *bind.TransactOpts, sHash [32]byte, sname []byte, rHash [32]byte, expire *big.Int, owner common.Address) (*types.Transaction, error) {\n\treturn _BasAsset.contract.Transact(opts, \"mintSubAsset\", sHash, sname, rHash, expire, owner)\n}", "title": "" }, { "docid": "aa03cab27c121cb9f0b894966e0a2774", "score": "0.43155095", "text": "func CompositeAlarm_FromCompositeAlarmArn(scope constructs.Construct, id *string, compositeAlarmArn *string) IAlarm {\n\t_init_.Initialize()\n\n\tvar returns IAlarm\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_cloudwatch.CompositeAlarm\",\n\t\t\"fromCompositeAlarmArn\",\n\t\t[]interface{}{scope, id, compositeAlarmArn},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3ab53f8a02d5e26bb68c91e8d8794550", "score": "0.43140528", "text": "func (ss *FileSubStore) CreateSub(sub *spb.SubState) error {\n\t// Check if we can create the subscription (check limits and update\n\t// subscription count)\n\tss.Lock()\n\tdefer ss.Unlock()\n\tif err := ss.createSub(sub); err != nil {\n\t\treturn err\n\t}\n\tif err := ss.writeRecord(nil, subRecNew, sub); err != nil {\n\t\tdelete(ss.subs, sub.ID)\n\t\treturn err\n\t}\n\t// We need to get a copy of the passed sub, we can't hold a reference\n\t// to it.\n\tcsub := *sub\n\ts := &subscription{sub: &csub, seqnos: make(map[uint64]struct{})}\n\tss.subs[sub.ID] = s\n\treturn nil\n}", "title": "" }, { "docid": "a7aec7a9c5000c0f4102c32b1801c54b", "score": "0.42948753", "text": "func NewSubAccount(c *ClientRest) *SubAccount {\n\treturn &SubAccount{c}\n}", "title": "" }, { "docid": "262ca2e80bb65a443fee224138e90934", "score": "0.42903668", "text": "func (a *Server) WithSubResource(\n\tparent resource.Object, subResourcePath string, request runtime.Object) *Server {\n\tgvr := parent.GetGroupVersionResource()\n\tgvr.Resource = gvr.Resource + \"/\" + subResourcePath\n\n\t// reuse the storage if this resource has already been registered\n\tif s, found := a.storage[gvr.GroupResource()]; found {\n\t\t_ = a.forGroupVersionResource(gvr, request, s.Get)\n\t} else {\n\t\ta.errs = append(a.errs, fmt.Errorf(\n\t\t\t\"subresources must be registered with a strategy or handler the first time they are registered\"))\n\t}\n\treturn a\n}", "title": "" }, { "docid": "83129a968b974e4c7b8f8278f6f0178d", "score": "0.42856216", "text": "func (a *ArithUint256) Sub(b *ArithUint256) {\n\ta.Add(b.Neg())\n}", "title": "" }, { "docid": "933a311b994aa8f2ff00c67a6eea64c2", "score": "0.42825383", "text": "func NewAzureBlobScaler(resolvedEnv, metadata, authParams map[string]string, podIdentity string) (Scaler, error) {\n\tmeta, podIdentity, err := parseAzureBlobMetadata(metadata, resolvedEnv, authParams, podIdentity)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing azure blob metadata: %s\", err)\n\t}\n\n\treturn &azureBlobScaler{\n\t\tmetadata: meta,\n\t\tpodIdentity: podIdentity,\n\t}, nil\n}", "title": "" }, { "docid": "ba8340893387eb936b5fa67a4e43257b", "score": "0.42795876", "text": "func (a *AzureBackupJobResource) 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\", a, 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\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &a.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &a.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6faec65d709b343792f9b45786e3247", "score": "0.42700213", "text": "func NewAzureReservationAPIClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureReservationAPIClient, error) {\n\tif options == nil {\n\t\toptions = &arm.ClientOptions{}\n\t}\n\tep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint\n\tif c, ok := options.Cloud.Services[cloud.ResourceManager]; ok {\n\t\tep = c.Endpoint\n\t}\n\tpl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &AzureReservationAPIClient{\n\t\thost: ep,\n\t\tpl: pl,\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "3104f12a5b0abf9270d94bd6c623fa48", "score": "0.42583144", "text": "func (sb *Sub) SaveSub(db *gorm.DB) (*Sub, error) {\n\tvar err error\n\n\tif categ := db.Where(\"id = ?\", sb.CategoryID).First(&Category{}); categ.Error != nil {\n\t\treturn &Sub{}, categ.Error\n\t}\n\n\terr = db.Debug().Model(&Sub{}).Create(&sb).Error\n\tif err != nil {\n\t\treturn &Sub{}, err\n\t}\n\tif sb.ID != 0 {\n\t\terr = db.Debug().Model(&Category{}).Where(\"id = ?\", sb.CategoryID).Take(&sb.Category).Error\n\t\tif err != nil {\n\t\t\treturn &Sub{}, err\n\t\t}\n\t}\n\treturn sb, nil\n}", "title": "" }, { "docid": "4ffd9189aecc2dff355dd333324fa4be", "score": "0.4253028", "text": "func AzureFilterResources(e *State, resources AzureResources, filter string) (r *Results, err error) {\n\tr = new(Results)\n\t// Parse the filter once and then apply it to each item in the loop\n\tbqf, err := boolq.Parse(filter)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tfilteredResources := AzureResources{Prefix: resources.Prefix}\n\tfor _, res := range resources.Resources {\n\t\tmatch, err := boolq.AskParsedExpr(bqf, res)\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\t\tif match {\n\t\t\tfilteredResources.Resources = append(filteredResources.Resources, res)\n\t\t}\n\t}\n\tr.Results = append(r.Results, &Result{Value: filteredResources})\n\treturn\n}", "title": "" }, { "docid": "1dbb157aab167ea845aed3ff06775e67", "score": "0.42469242", "text": "func (p *SubscribePacket) Suback() *SubackPacket {\n\tvar suback SubackPacket\n\tsuback.PacketIdentifier = p.PacketIdentifier\n\tsuback.SubackPayload = make([]ReasonCode, len(p.SubscribePayload))\n\treturn &suback\n}", "title": "" }, { "docid": "4954a30fa0ff0997f595accdcf0f76d9", "score": "0.42398834", "text": "func (m1 *Scale) Sub(m2 MatrixExp) MatrixExp {\n\treturn &Sub{\n\t\tLeft: m1,\n\t\tRight: m2,\n\t}\n}", "title": "" }, { "docid": "dc7c275e858c0b8bd1d95d17f111272b", "score": "0.4234716", "text": "func (c *CPU) sub(value uint8) {\n\ta := c.a\n\tc.a = a - value\n\n\tc.setFlagToCondition(zeroFlag, c.a == 0)\n\tc.setFlag(subFlag)\n\tc.setFlagToCondition(carryFlag, a < value)\n\tc.setFlagToCondition(halfCarryFlag, (int(a)&0xF)-(int(value)&0xF) < 0)\n}", "title": "" }, { "docid": "487e6b273924b82bf2f0990a449f9411", "score": "0.42192", "text": "func NewSubflow(ctx *pulumi.Context,\n\tname string, args *SubflowArgs, opts ...pulumi.ResourceOption) (*Subflow, error) {\n\tif args == nil || args.Alias == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Alias'\")\n\t}\n\tif args == nil || args.ParentFlowAlias == nil {\n\t\treturn nil, errors.New(\"missing required argument 'ParentFlowAlias'\")\n\t}\n\tif args == nil || args.RealmId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'RealmId'\")\n\t}\n\tif args == nil {\n\t\targs = &SubflowArgs{}\n\t}\n\tvar resource Subflow\n\terr := ctx.RegisterResource(\"keycloak:authentication/subflow:Subflow\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "b7620d15342f834d4276a41a540658e4", "score": "0.4203732", "text": "func (s *unpackedScalar) Sub(a, b *unpackedScalar) *unpackedScalar {\n\t// a - b\n\tvar borrow uint32\n\tfor i := 0; i < 9; i++ {\n\t\tborrow = a[i] - (b[i] + (borrow >> 31))\n\t\ts[i] = borrow & low_29_bit_mask\n\t}\n\n\t// conditionally add l if the difference is negative\n\tunderflowMask := ((borrow >> 31) ^ 1) - 1\n\tvar carry uint32\n\tfor i := 0; i < 9; i++ {\n\t\tcarry = (carry >> 29) + s[i] + (constL[i] & underflowMask)\n\t\ts[i] = carry & low_29_bit_mask\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "f6b38d7d3ddc86de96be3f8546b02509", "score": "0.4195126", "text": "func (policy *BaseBackupPolicy) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif policy == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &BaseBackupPolicy_ARM{}\n\n\t// Set property \"BackupPolicy\":\n\tif policy.BackupPolicy != nil {\n\t\tbackupPolicy_ARM, err := (*policy.BackupPolicy).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbackupPolicy := *backupPolicy_ARM.(*BackupPolicy_ARM)\n\t\tresult.BackupPolicy = &backupPolicy\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "acdeab1091f9a70b6cd306ee3f7858a7", "score": "0.41925266", "text": "func (rule *AzureRetentionRule) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif rule == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &AzureRetentionRule_ARM{}\n\n\t// Set property \"IsDefault\":\n\tif rule.IsDefault != nil {\n\t\tisDefault := *rule.IsDefault\n\t\tresult.IsDefault = &isDefault\n\t}\n\n\t// Set property \"Lifecycles\":\n\tfor _, item := range rule.Lifecycles {\n\t\titem_ARM, err := item.ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult.Lifecycles = append(result.Lifecycles, *item_ARM.(*SourceLifeCycle_ARM))\n\t}\n\n\t// Set property \"Name\":\n\tif rule.Name != nil {\n\t\tname := *rule.Name\n\t\tresult.Name = &name\n\t}\n\n\t// Set property \"ObjectType\":\n\tif rule.ObjectType != nil {\n\t\tresult.ObjectType = *rule.ObjectType\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "316c195226cdfb21eed228bd61160c4e", "score": "0.41908404", "text": "func (axis *Axis) Sub(sub Axis) Axis {\n\treturn Axis{X: axis.X - sub.X, Y: axis.Y - sub.Y}\n}", "title": "" }, { "docid": "c7e968facf58737d6217dc77411a0caf", "score": "0.41895348", "text": "func (s *registry) AddSub(test interface{}, subTestName string, max, weight int) {\n\ttstName := fmt.Sprintf(\"%s/%s\", testName(test), subTestName)\n\ts.add(tstName, max, weight)\n}", "title": "" }, { "docid": "5eb65be78152b43ba62d96c8bc9e1771", "score": "0.41812643", "text": "func (m *HostSecurityProfile) SetAzureSubscriptionId(value *string)() {\n err := m.GetBackingStore().Set(\"azureSubscriptionId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4b0cde3b4d3d319c9906542c54eb36e2", "score": "0.41799104", "text": "func (a *AzureResourceDetails) 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\", a, 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\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"source\":\n\t\t\terr = unpopulate(val, \"Source\", &a.Source)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17ce8ae5f582d54682d80b9fd56b2314", "score": "0.41781276", "text": "func azureCreateAIB(namespace, aibName, aiName string) (aibResource connection.APIResource, err error) {\n\n\tresource, createErr := azureK8S.CreateAIB(namespace, aibName, aiName)\n\tif errors.IsStatusCode(409, createErr) { // Already Exists\n\t\t// TODO: Delete and recreate ?\n\t\tcreateErr = nil\n\t}\n\n\terr = createErr\n\taibResource = resource\n\n\treturn\n}", "title": "" }, { "docid": "d9bf50a9528c7e9473a0b6e6914fd7cc", "score": "0.41767532", "text": "func (s *BaselccListener) EnterSubtopic(ctx *SubtopicContext) {}", "title": "" }, { "docid": "35827f8c58ce973e823bd940c7b2ca8e", "score": "0.41752404", "text": "func (dst *AzureMachine) ConvertFrom(srcRaw conversion.Hub) error {\n\tsrc := srcRaw.(*infrav1.AzureMachine)\n\tif err := Convert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(src, dst, nil); err != nil {\n\t\treturn err\n\t}\n\n\t// Preserve Hub data on down-conversion.\n\treturn utilconversion.MarshalData(src, dst)\n}", "title": "" }, { "docid": "bd8070db8119b2241e18e00b63621516", "score": "0.41740438", "text": "func DeserializeResource(resourceRawExtension *runtime.RawExtension, fldPath *field.Path) (resource runtime.Object, allErrs field.ErrorList) {\n\t// 1. check whether resource yaml is empty\n\tif len(resourceRawExtension.Raw) == 0 {\n\t\treturn nil, append(allErrs, field.Invalid(fldPath, resource, \"empty resource is not allowed\"))\n\t}\n\n\t// 2. deserialize resource\n\tresource, _, err := unstructured.UnstructuredJSONScheme.Decode(resourceRawExtension.Raw, nil, nil)\n\tif err != nil {\n\t\tallErrs = append(allErrs, field.InternalError(fldPath, fmt.Errorf(\"failed to deserialize resource, please check your spec.resource, err %v\", err)))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d4eb5c72dda661344fbbdecc734e7a68", "score": "0.41734782", "text": "func (a *AzureEntityResource) 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\", a, 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\", &a.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4eb5c72dda661344fbbdecc734e7a68", "score": "0.41734782", "text": "func (a *AzureEntityResource) 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\", a, 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\", &a.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a7dadec6071b4dbac1f9f90de088127c", "score": "0.41704884", "text": "func (a *AppV3) SetSubKind(sk string) {\n\ta.SubKind = sk\n}", "title": "" }, { "docid": "6b7a266d972052ff10fe2847e539a4b4", "score": "0.4170426", "text": "func (a *AzureResourceIdentifier) 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\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"azureResourceId\":\n\t\t\terr = unpopulate(val, &a.AzureResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := a.ResourceIdentifier.unmarshalInternal(rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87423db4542a472cfb2cc84e677ed01a", "score": "0.4170141", "text": "func Convert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(in *AzureSubnetInfo, out *machine.AzureSubnetInfo, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(in, out, s)\n}", "title": "" }, { "docid": "b8644de3755a3790a43b04d18a714935", "score": "0.4166262", "text": "func azResourceURI(subscription, resourceGrp, Namespace, Resource string) string {\n\treturn fmt.Sprintf(\"/subscriptions/%s/resourceGroups/%s/providers/%s/%s\", subscription, resourceGrp, Namespace, Resource)\n}", "title": "" }, { "docid": "cbb01c50b8c35633211f0c629113264c", "score": "0.41644326", "text": "func (dst *AzureMachineList) ConvertFrom(srcRaw conversion.Hub) error {\n\tsrc := srcRaw.(*infrav1.AzureMachineList)\n\treturn Convert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList(src, dst, nil)\n}", "title": "" }, { "docid": "046eb92c2311d85a9bca7a5434ca1d25", "score": "0.41594717", "text": "func (o ResourceAttributesPatchPtrOutput) Subresource() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ResourceAttributesPatch) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subresource\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "880249bfe901b3a5c76754c6f807c92c", "score": "0.41544697", "text": "func (a V2) Sub(b V2) V2 {\n\treturn V2{a.X - b.X, a.Y - b.Y}\n}", "title": "" }, { "docid": "4d423f4ff3a51570628637d4bf8328e6", "score": "0.41534093", "text": "func (in *ApplicationRestoreResourceInfo) DeepCopy() *ApplicationRestoreResourceInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationRestoreResourceInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c261d33fc3690cf07870fcd58f0d11c5", "score": "0.41532788", "text": "func (subnet *VirtualNetworksSubnet) AzureName() string {\n\treturn subnet.Spec.AzureName\n}", "title": "" }, { "docid": "29ddcce6671dfe62a601acdad1a6f45a", "score": "0.4142834", "text": "func RunJSONSerializationTestForSubResource(subject SubResource) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SubResource\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d0b0e2fa03e39b37532905c99368585d", "score": "0.41323897", "text": "func Sub(f1 qb.Field, i interface{}) qb.Field {\n\treturn useOverride(sub, f1, i)\n}", "title": "" }, { "docid": "f73f545c6c7d2f91882840d0bc8866f7", "score": "0.4119564", "text": "func (c *CPU) SUB(params ...Param) {\n\tn := params[0].(values.Value8)\n\ta := c.A.Read8()\n\tin := n.Read8()\n\n\tresult := a - in\n\tc.F.SetZ(result == 0)\n\tc.F.SetN(true)\n\n\tcarry := a < in\n\thalfCarry := (a & 0xF) < (in & 0xF)\n\tc.F.SetH(halfCarry)\n\tc.F.SetC(carry)\n\n\tc.A.Write8(result)\n}", "title": "" }, { "docid": "38a171a89fba7647634fa5b8640e14ff", "score": "0.41177815", "text": "func (client SubAccountClient) Get(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result MonitorResource, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/SubAccountClient.Get\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"logz.SubAccountClient\", \"Get\", err.Error())\n\t}\n\n\treq, err := client.GetPreparer(ctx, resourceGroupName, monitorName, subAccountName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"logz.SubAccountClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"logz.SubAccountClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"logz.SubAccountClient\", \"Get\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b95d0fb0a840f38cf5cfedbf67ccace9", "score": "0.41147444", "text": "func (z *Complex) Sub(x, y *Complex) *Complex {\n\tz.l.Sub(&x.l, &y.l)\n\tz.r.Sub(&x.r, &y.r)\n\treturn z\n}", "title": "" }, { "docid": "1a917f1da54e8044cc877cce33229b1a", "score": "0.4114254", "text": "func Sub(a, b *Node, broadcastPattern BroadcastPattern) (*Node, error) {\n\tif broadcastPattern == 0 {\n\t\treturn binOpNode(newElemBinOp(subOpType, a, b), a, b)\n\t} else {\n\t\treturn broadcast(subOpType, a, b, broadcastPattern)\n\t}\n}", "title": "" }, { "docid": "92aaba61101bd02d6c3004e3830009fa", "score": "0.41107827", "text": "func (service *StorageAccounts_BlobService_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif service == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &StorageAccounts_BlobService_Spec_ARM{}\n\n\t// Set property \"Name\":\n\tresult.Name = resolved.Name\n\n\t// Set property \"Properties\":\n\tif service.AutomaticSnapshotPolicyEnabled != nil ||\n\t\tservice.ChangeFeed != nil ||\n\t\tservice.ContainerDeleteRetentionPolicy != nil ||\n\t\tservice.Cors != nil ||\n\t\tservice.DefaultServiceVersion != nil ||\n\t\tservice.DeleteRetentionPolicy != nil ||\n\t\tservice.IsVersioningEnabled != nil ||\n\t\tservice.LastAccessTimeTrackingPolicy != nil ||\n\t\tservice.RestorePolicy != nil {\n\t\tresult.Properties = &StorageAccounts_BlobService_Properties_Spec_ARM{}\n\t}\n\tif service.AutomaticSnapshotPolicyEnabled != nil {\n\t\tautomaticSnapshotPolicyEnabled := *service.AutomaticSnapshotPolicyEnabled\n\t\tresult.Properties.AutomaticSnapshotPolicyEnabled = &automaticSnapshotPolicyEnabled\n\t}\n\tif service.ChangeFeed != nil {\n\t\tchangeFeed_ARM, err := (*service.ChangeFeed).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tchangeFeed := *changeFeed_ARM.(*ChangeFeed_ARM)\n\t\tresult.Properties.ChangeFeed = &changeFeed\n\t}\n\tif service.ContainerDeleteRetentionPolicy != nil {\n\t\tcontainerDeleteRetentionPolicy_ARM, err := (*service.ContainerDeleteRetentionPolicy).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcontainerDeleteRetentionPolicy := *containerDeleteRetentionPolicy_ARM.(*DeleteRetentionPolicy_ARM)\n\t\tresult.Properties.ContainerDeleteRetentionPolicy = &containerDeleteRetentionPolicy\n\t}\n\tif service.Cors != nil {\n\t\tcors_ARM, err := (*service.Cors).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcors := *cors_ARM.(*CorsRules_ARM)\n\t\tresult.Properties.Cors = &cors\n\t}\n\tif service.DefaultServiceVersion != nil {\n\t\tdefaultServiceVersion := *service.DefaultServiceVersion\n\t\tresult.Properties.DefaultServiceVersion = &defaultServiceVersion\n\t}\n\tif service.DeleteRetentionPolicy != nil {\n\t\tdeleteRetentionPolicy_ARM, err := (*service.DeleteRetentionPolicy).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdeleteRetentionPolicy := *deleteRetentionPolicy_ARM.(*DeleteRetentionPolicy_ARM)\n\t\tresult.Properties.DeleteRetentionPolicy = &deleteRetentionPolicy\n\t}\n\tif service.IsVersioningEnabled != nil {\n\t\tisVersioningEnabled := *service.IsVersioningEnabled\n\t\tresult.Properties.IsVersioningEnabled = &isVersioningEnabled\n\t}\n\tif service.LastAccessTimeTrackingPolicy != nil {\n\t\tlastAccessTimeTrackingPolicy_ARM, err := (*service.LastAccessTimeTrackingPolicy).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlastAccessTimeTrackingPolicy := *lastAccessTimeTrackingPolicy_ARM.(*LastAccessTimeTrackingPolicy_ARM)\n\t\tresult.Properties.LastAccessTimeTrackingPolicy = &lastAccessTimeTrackingPolicy\n\t}\n\tif service.RestorePolicy != nil {\n\t\trestorePolicy_ARM, err := (*service.RestorePolicy).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trestorePolicy := *restorePolicy_ARM.(*RestorePolicyProperties_ARM)\n\t\tresult.Properties.RestorePolicy = &restorePolicy\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ebda9f611ce88f9d3035054036ab128a", "score": "0.41072318", "text": "func DeploySub(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Sub, error) {\n\tparsed, err := abi.JSON(strings.NewReader(SubABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(SubBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Sub{SubCaller: SubCaller{contract: contract}, SubTransactor: SubTransactor{contract: contract}}, nil\n}", "title": "" }, { "docid": "ee033fb6ad2e51e50fde61bca0cd604a", "score": "0.40934867", "text": "func (i BigInt) Sub(i2 BigInt) (res BigInt) {\n\tres = BigInt{sub(i.i, i2.i)}\n\t// Check overflow\n\tif res.i.BitLen() > 255 {\n\t\tpanic(\"BigInt overflow\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "c06cd7ef70effa1f15a7b16d8ae37fd9", "score": "0.40905115", "text": "func SUB(address *AddressRef) *Instruction {\n\treturn CreateInstruction(OP_SUB, address)\n}", "title": "" }, { "docid": "0863d9827cf201a0f038c3fbdfd195c4", "score": "0.40894538", "text": "func (a V2) SubScalar(b float64) V2 {\n\treturn V2{a.X - b, a.Y - b}\n}", "title": "" }, { "docid": "e45d04f5b1d830c60e32546acb6aa416", "score": "0.4088448", "text": "func (a *AzureResourceEntity) 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\", a, 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\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &a.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &a.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &a.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb21a348d374de92bfa93096d0618481", "score": "0.4084267", "text": "func NewAzureClient() (*AzureClient, error) {\n\n\tsub := os.Getenv(\"AZURE_SUBSCRIPTION_ID\")\n\tif sub == \"\" {\n\t\tsub = defaultSub\n\t}\n\n\trg := os.Getenv(\"AZURE_RESOURCE_GROUP\")\n\tif rg == \"\" {\n\t\trg = defaultRG\n\t}\n\n\tauthorizer, err := auth.NewAuthorizerFromEnvironment()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to init authorizer from environment %s\", err)\n\t}\n\n\treturn &AzureClient{\n\t\tResourceGroup: rg,\n\t\tSubscriptionID: sub,\n\t\tAuthorizer: authorizer,\n\t\tGenerateName: func(objectType string) string {\n\t\t\treturn defaultPrefix + objectType\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "0fff4a7ff616e2e5ef4b30adb4e09a30", "score": "0.40836895", "text": "func (z *E12) Sub(x, y *E12) *E12 {\n\tz.C0.Sub(&x.C0, &y.C0)\n\tz.C1.Sub(&x.C1, &y.C1)\n\treturn z\n}", "title": "" }, { "docid": "6a75141735f566ec73a5f1eaec0f3c59", "score": "0.40797815", "text": "func (d *Deserializer) Sub(ln int) *Deserializer {\n\td.Idx += ln\n\treturn &Deserializer{\n\t\tData: d.Data[d.Idx-ln : d.Idx],\n\t}\n}", "title": "" }, { "docid": "6a75141735f566ec73a5f1eaec0f3c59", "score": "0.40797815", "text": "func (d *Deserializer) Sub(ln int) *Deserializer {\n\td.Idx += ln\n\treturn &Deserializer{\n\t\tData: d.Data[d.Idx-ln : d.Idx],\n\t}\n}", "title": "" }, { "docid": "bbf04f43aced7fc7c401bc842c0d5ac5", "score": "0.40754968", "text": "func (a *AzureResourceIdentifier) 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\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"azureResourceId\":\n\t\t\terr = unpopulate(val, \"AzureResourceID\", &a.AzureResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48b5a62dea57ed3e5051a4f70a31c9fd", "score": "0.4072967", "text": "func (p *NHSVA) SubImage(r image.Rectangle) image.Image {\n\tr = r.Intersect(p.Rect)\n\t// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to\n\t// be inside either r1 or r2 if the intersection is empty. Without\n\t// explicitly checking for this, the Pix[i:] expression below can\n\t// panic.\n\tif r.Empty() {\n\t\treturn &NHSVA{}\n\t}\n\ti := p.PixOffset(r.Min.X, r.Min.Y)\n\treturn &NHSVA{\n\t\tPix: p.Pix[i:],\n\t\tStride: p.Stride,\n\t\tRect: r,\n\t}\n}", "title": "" }, { "docid": "543ccb3b610e321da0e9a60c63bbbd78", "score": "0.4070932", "text": "func (a *Int16Interleaved) SubAudio(offsetSamples, nSamples int) *Int16Interleaved {\n\tret := *a\n\toffset := offsetSamples * a.Size.Channels\n\tn := nSamples * a.Size.Channels\n\tret.Data = ret.Data[offset : offset+n]\n\tret.Size.Len = nSamples\n\treturn &ret\n}", "title": "" } ]
72f545ba353bd2eb1d923edecd135dd6
IsWebsocket returns boolean of this request is in webSocket.
[ { "docid": "25e713fefd2a92c159ed744ffffd1a8a", "score": "0.8442078", "text": "func (ctx *Context) IsWebsocket() bool {\r\n\treturn ctx.HeaderParam(HeaderUpgrade) == \"websocket\"\r\n}", "title": "" } ]
[ { "docid": "8381794a8de400585d39e5b4fcec5551", "score": "0.82962346", "text": "func (input *BeegoInput) IsWebsocket() bool {\n\treturn input.Header(\"Upgrade\") == \"websocket\"\n}", "title": "" }, { "docid": "d52a6712949838b6fa5e247c0b43fc6b", "score": "0.80950147", "text": "func (rc RequestCall) IsWebSocket() bool {\n\treturn wsutil.IsWebSocketRequest(&rc.Request) // TODO: don't like the reference\n}", "title": "" }, { "docid": "5fe26ba5fdc61616eeaa80dc7183cd95", "score": "0.77127826", "text": "func IsWebsocketRequest(req *http.Request) bool {\n\treturn ConstainsHeader(req, \"Connection\", \"upgrade\") && ConstainsHeader(req, \"Upgrade\", \"websocket\")\n}", "title": "" }, { "docid": "a6ada69e3ae78243d6e916e388bf61a5", "score": "0.7674282", "text": "func isWebsocket(r *http.Request) bool {\n\treturn httpguts.HeaderValuesContainsToken(r.Header[\"Connection\"], \"upgrade\") &&\n\t\thttpguts.HeaderValuesContainsToken(r.Header[\"Upgrade\"], \"websocket\")\n}", "title": "" }, { "docid": "b10f28b64286377c918d53a37992312a", "score": "0.74804866", "text": "func IsWebsocketRequest(req *http.Request) bool {\n\tcontainsHeader := func(name, value string) bool {\n\t\titems := strings.Split(req.Header.Get(name), \",\")\n\t\tfor _, item := range items {\n\t\t\tif value == strings.ToLower(strings.TrimSpace(item)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\treturn containsHeader(Connection, \"upgrade\") && containsHeader(Upgrade, \"websocket\")\n}", "title": "" }, { "docid": "11e1cab6b20bf502a27814d738879c67", "score": "0.72442895", "text": "func (b *Base) IsWebsocketAuthenticationSupported() bool {\n\treturn b.API.AuthenticatedWebsocketSupport\n}", "title": "" }, { "docid": "772db649a5ae0de8c103d96842ec603e", "score": "0.6962801", "text": "func (c *Config) GetWebsocketEnable() bool {\n\treturn c.booleans[websocketEnableVar]\n}", "title": "" }, { "docid": "afecf1f49f271f80db8c386c6277af52", "score": "0.633055", "text": "func isWebsocketURL(rawurl string) bool {\n\tu, err := url.Parse(rawurl)\n\tif err != nil {\n\t\tlog.Infof(\"Error while parsing URL: %v\", err)\n\t\treturn false\n\t}\n\treturn u.Scheme == \"ws\" || u.Scheme == \"wss\"\n}", "title": "" }, { "docid": "e86a190109a71d93c9d2aea82755acfd", "score": "0.62361443", "text": "func TestIsWebsocket(t *testing.T) {\n\tr, _ := http.NewRequest(\"GET\", \"/\", nil)\n\n\tassert.False(t, isWebsocket(r))\n\tr.Header.Set(\"upgrade\", \"websocket\")\n\tassert.False(t, isWebsocket(r))\n\tr.Header.Set(\"connection\", \"upgrade\")\n\tassert.True(t, isWebsocket(r))\n\tr.Header.Set(\"connection\", \"upgrade,keep-alive\")\n\tassert.True(t, isWebsocket(r))\n\tr.Header.Set(\"connection\", \" UPGRADE,keep-alive\")\n\tassert.True(t, isWebsocket(r))\n}", "title": "" }, { "docid": "b757308bd942a9f7abd450e1e3357dd2", "score": "0.62055516", "text": "func isWsRequest(r *http.Request) bool {\n\turi := r.URL.Path\n\treturn strings.HasPrefix(uri, \"/ws/\")\n}", "title": "" }, { "docid": "626ed5784846131ffa066a150f10abe5", "score": "0.61102533", "text": "func (c *client) IsConnected() bool {\n\treturn c.connected && c.ws != nil\n}", "title": "" }, { "docid": "b5e906efa7d32d2679dc0d9f10a83166", "score": "0.6000029", "text": "func (c *Connection) IsConnected() bool {\n\treturn c.ws != nil\n}", "title": "" }, { "docid": "619ff70ec6ad1cc1ef24eb2176596996", "score": "0.59518003", "text": "func (k *Kraken) GetWebsocket() (*wshandler.Websocket, error) {\n\treturn k.Websocket, nil\n}", "title": "" }, { "docid": "282e58b7f9c0729a266533d3f8668a05", "score": "0.5947272", "text": "func (m *WebsocketRoutineManager) IsRunning() bool {\n\tif m == nil {\n\t\treturn false\n\t}\n\treturn atomic.LoadInt32(&m.state) == readyState\n}", "title": "" }, { "docid": "45597ff6752327ee5e46dd1d8140f40d", "score": "0.5828568", "text": "func (p *Proxy) IsConnected() <-chan struct{} {\n\tfor p.webSocketClient == nil {\n\t\ttime.Sleep(50 * time.Millisecond)\n\t}\n\treturn p.webSocketClient.Connected()\n}", "title": "" }, { "docid": "7d740cd0d23058f6487cf9c7e66aa6f7", "score": "0.58221453", "text": "func (c *Ctx) WebSocket() *websocket.Conn {\n\treturn c.websocket\n}", "title": "" }, { "docid": "295fad29c4774d7ea885a02c2163bb9f", "score": "0.5689248", "text": "func (p *TSocket) IsOpen() bool {\n\tif p.conn == nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d84355aeb8077d43f8de5b60a33ddcc6", "score": "0.5666377", "text": "func (h *RequestHeader) IsConnect() bool {\n\treturn string(h.Method()) == MethodConnect\n}", "title": "" }, { "docid": "c0855624ff31e5b4d020ffd75fc74f12", "score": "0.56277734", "text": "func (o *ClientConfiguration) GetIsWebScrapingEnabled() bool {\n\tif o == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\n\treturn o.IsWebScrapingEnabled\n}", "title": "" }, { "docid": "68ad484d24b02f84daa38ae3dc894f61", "score": "0.5524426", "text": "func (r *Response) Websocket() *Websocket {\n\topChain := r.chain.enter(\"Websocket()\")\n\tdefer opChain.leave()\n\n\tif opChain.failed() {\n\t\treturn newWebsocket(opChain, r.config, nil)\n\t}\n\n\tif r.websocket == nil {\n\t\topChain.fail(AssertionFailure{\n\t\t\tType: AssertUsage,\n\t\t\tErrors: []error{\n\t\t\t\terrors.New(\n\t\t\t\t\t\"Websocket() requires WithWebsocketUpgrade() to be called on request\"),\n\t\t\t},\n\t\t})\n\t\treturn newWebsocket(opChain, r.config, nil)\n\t}\n\n\treturn newWebsocket(opChain, r.config, r.websocket)\n}", "title": "" }, { "docid": "872f4e461d0afe3b3dc3b20f9e3c6719", "score": "0.55212116", "text": "func (c *client) IsAuthencated() bool {\n\treturn c.authencated && c.ws != nil\n}", "title": "" }, { "docid": "32c58bd4a9db514687e26f51f4bef5cb", "score": "0.55038697", "text": "func (p *Proxy) isListeningHTTP() bool {\n\treturn atomic.LoadInt32(p.numListeningHTTP) > 0\n}", "title": "" }, { "docid": "9c1584ba68b229b3436de12dd6bc2df5", "score": "0.54976887", "text": "func (c *WSClient) IsReconnecting() bool {\n\tc.mtx.RLock()\n\tdefer c.mtx.RUnlock()\n\treturn c.reconnecting\n}", "title": "" }, { "docid": "df7ff71af7e72ea8379dcc1117de63b5", "score": "0.5450735", "text": "func (e *Event) IsUpstream() bool {\n\treturn int32(e.GetType())&int32(EVENT_TYPE_UPSTREAM) != 0\n}", "title": "" }, { "docid": "0e218dbd01ba3c6b2b2a4316312d0b61", "score": "0.5437845", "text": "func (s *Server) IsListeningHTTP() bool {\n\treturn atomic.LoadInt32(s.numListeningHTTP) > 0\n}", "title": "" }, { "docid": "2643f212bb114fd69e5855400a2f1525", "score": "0.5403381", "text": "func (cdp *Client) Websocket(ws Websocketable) *Client {\n\tcdp.ws = ws\n\treturn cdp\n}", "title": "" }, { "docid": "ac890745c696a56fddb70751068cff53", "score": "0.53631824", "text": "func (pipe *PipeWS) IsOpen() bool {\n\treturn pipe.open\n}", "title": "" }, { "docid": "6cca65bbfababd63f414dba3fb287a7c", "score": "0.5341837", "text": "func (e *Event) IsDownstream() bool {\n\treturn int32(e.GetType())&int32(EVENT_TYPE_DOWNSTREAM) != 0\n}", "title": "" }, { "docid": "011fa55358e86b4d0c901bde8889e059", "score": "0.53276825", "text": "func (n *Node) IsWorker() bool {\n\treturn n.Role == WorkerRole\n}", "title": "" }, { "docid": "5c91d7d6e1635c25b22f3f1b7c70be7e", "score": "0.52390033", "text": "func (c *Config) GetWebsocketPort() uint {\n\treturn c.uints[websocketPortVar]\n}", "title": "" }, { "docid": "53b3bfb702a623a5fc8a9befdfb31f75", "score": "0.52094996", "text": "func (u *Upstream) IsConnectedTo(serverPublicKey []byte) bool {\n\treturn u.client.IsConnectedTo(serverPublicKey)\n}", "title": "" }, { "docid": "e27e16429ab34b3f94ce8113b44b9eb0", "score": "0.5190601", "text": "func (b *Bot) IsWatchChannel(memberJoin *types.MemberJoinedChannel) bool {\n\t// get channel list\n\tb.GetChannelList()\n\n\tchannels := map[string]string{}\n\tfor _, channel := range b.Channels.Channels {\n\t\tchannels[channel.ID] = channel.Name\n\t}\n\n\tchannelName, ok := channels[memberJoin.Channel]\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// if watching channels is no in slack channels, will be return false\n\twatches := map[string]bool{}\n\tfor _, name := range b.Config.WatchChannels {\n\t\twatches[name] = true\n\t}\n\n\treturn watches[channelName]\n}", "title": "" }, { "docid": "a195b3cba7ef7d1bbeb4331ff15229f5", "score": "0.51904976", "text": "func (ctx *Context) IsIframe() bool {\n\treturn ctx.Query(constant.IframeKey) == \"true\" || ctx.Headers(constant.IframeKey) == \"true\"\n}", "title": "" }, { "docid": "3a82795ecc27ad2f7e90d71b9838517e", "score": "0.51866376", "text": "func (o *WebSocketClient) IsVerifySslEnabled() gdnative.Bool {\n\t//log.Println(\"Calling WebSocketClient.IsVerifySslEnabled()\")\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(\"WebSocketClient\", \"is_verify_ssl_enabled\")\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": "cb5d26ea6269dec6b8fe41891327fcef", "score": "0.5173335", "text": "func (o *ChannelOutbound) IsRunning() bool {\n\treturn o.once.IsRunning()\n}", "title": "" }, { "docid": "4745cf4d7f527d1b14a134dd17657770", "score": "0.51719856", "text": "func (e *connectionedEndpoint) isBound() bool {\n\treturn e.path != \"\" && e.acceptedChan == nil\n}", "title": "" }, { "docid": "91a3c3633922b59a63537a36dac2ea33", "score": "0.51580876", "text": "func (env *Env) IsHeartbeatAllowed () bool {\n return env.session.IsHeartbeatAllowed()\n}", "title": "" }, { "docid": "78c334ac62aa7662db1f9f92e783eb68", "score": "0.5123428", "text": "func (o *Outbound) IsRunning() bool {\n\treturn o.once.IsRunning()\n}", "title": "" }, { "docid": "84215fe37722de8f090d7fc63f680d1e", "score": "0.512198", "text": "func (transporter *Transporter) IsConnected() bool {\n\treturn transporter.isConnected && transporter.isHandling && !transporter.isConnecting\n}", "title": "" }, { "docid": "4c350bc75b02beb9a91ff2235bb6feac", "score": "0.51075715", "text": "func (c *Client) Websocket(path string) (*websocket.Conn, error) {\n\treturn c.websocket(path)\n}", "title": "" }, { "docid": "a8170ebbefad7ebfb8a805c0caaeee24", "score": "0.5107166", "text": "func (r *Router) IsRunning() bool {\n\tselect {\n\tcase <-r.running:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "f82985e2276d1e80ab474f4a44eea87d", "score": "0.50936145", "text": "func (tqsc *Controller) IsServing() bool {\n\ttqsc.mu.Lock()\n\tdefer tqsc.mu.Unlock()\n\n\treturn tqsc.queryServiceEnabled\n}", "title": "" }, { "docid": "ed4159d45c6b462e1acf8bb5c77901c6", "score": "0.5082547", "text": "func (j *jws) IsJWT() bool {\n\treturn j.isJWT\n}", "title": "" }, { "docid": "efdd5887c39e48f7d0d1ab2c997dde69", "score": "0.5061498", "text": "func (t *thing) IsConnected() bool {\n\treturn t.client != nil && t.client.IsConnected()\n}", "title": "" }, { "docid": "44c1611d16fd5a3d25727fbbbda3902e", "score": "0.5053661", "text": "func wsRequest(t *testing.T, url, browserOrigin string) error {\n\tt.Helper()\n\tt.Logf(\"checking WebSocket on %s (origin %q)\", url, browserOrigin)\n\n\theaders := make(http.Header)\n\tif browserOrigin != \"\" {\n\t\theaders.Set(\"Origin\", browserOrigin)\n\t}\n\tconn, _, err := websocket.DefaultDialer.Dial(url, headers)\n\tif conn != nil {\n\t\tconn.Close()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cb127c7649dbb1e111e839a9ae885ec4", "score": "0.50481516", "text": "func (o *ClientConfiguration) GetIsWebScrapingEnabledOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsWebScrapingEnabled, true\n}", "title": "" }, { "docid": "4a27a401fc2b470937264dfae4e4fdc2", "score": "0.5048084", "text": "func (n *Node) IsWorker() bool {\n\treturn n.Role() == constants.WorkerNodeRoleValue\n}", "title": "" }, { "docid": "0db43d2c0b06d0b93a271d3a528fac34", "score": "0.5014641", "text": "func (i *Inbound) IsRunning() bool {\n\treturn i.once.IsRunning()\n}", "title": "" }, { "docid": "0d012a372e3ec503cd205375d1f9eab7", "score": "0.50024474", "text": "func (kt *SharedKeybaseTransport) IsConnected() bool {\n\tkt.mutex.Lock()\n\tdefer kt.mutex.Unlock()\n\treturn kt.transport != nil && kt.transport.IsConnected()\n}", "title": "" }, { "docid": "a935d13eb053bbc1af45d035ae58150c", "score": "0.499012", "text": "func IsWatchRunning() error {\n\t// This is connecting locally and it is very unlikely watch is overloaded,\n\t// set the timeout *super* short to make it easier on the users when they\n\t// forgot to start watch.\n\twithTimeout, _ := context.WithTimeout(context.TODO(), 100*time.Millisecond)\n\n\tconn, err := grpc.DialContext(\n\t\twithTimeout,\n\t\tfmt.Sprintf(\"127.0.0.1:%d\", viper.GetInt(\"port\")),\n\t\t[]grpc.DialOption{\n\t\t\tgrpc.WithBlock(),\n\t\t\tgrpc.WithInsecure(),\n\t\t}...)\n\n\tif err != nil {\n\t\t// The assumption is that the only real error here is because watch isn't\n\t\t// running\n\t\tlog.Debug(err)\n\t\treturn errWatchNotRunning\n\t}\n\n\tclient := pb.NewKsyncClient(conn)\n\talive, err := client.IsAlive(context.Background(), &empty.Empty{})\n\tif err != nil {\n\t\tlog.Debug(err)\n\t\treturn errWatchNotResponding\n\t}\n\n\tif !alive.Alive {\n\t\treturn errSyncthingNotRunning\n\t}\n\n\tif err := conn.Close(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d3bb44b1e1e8358bfa87173ee2bae145", "score": "0.49890488", "text": "func (c *Client) IsConnected() bool {\n\treturn c.isConnected\n}", "title": "" }, { "docid": "6f003d5e786ca7aa0fcbbe31f32a3ee5", "score": "0.49827918", "text": "func (transporter *IPCTransporter) IsConnected() bool {\n\treturn true\n}", "title": "" }, { "docid": "dc8c5279ce33003776df736f48b7ce18", "score": "0.4968942", "text": "func (client *client) IsConnected() bool {\n\treturn \"\" != client.address\n}", "title": "" }, { "docid": "e69990ed9e1c07b6a527994c366cbad5", "score": "0.49642015", "text": "func (conn *Conn) IsConnected() bool {\n\treturn conn.isConnected\n}", "title": "" }, { "docid": "df0e7461c5911ee0ba4036561fa4e472", "score": "0.49348998", "text": "func (mr *MockOperationMockRecorder) GetWebsocket(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetWebsocket\", reflect.TypeOf((*MockOperation)(nil).GetWebsocket), arg0)\n}", "title": "" }, { "docid": "6731aa9144dc2112bda88965ff886ec1", "score": "0.49221158", "text": "func (c *clientWrapper) isWatchedNamespace(ns string) bool {\n\tif c.isNamespaceAll {\n\t\treturn true\n\t}\n\tfor _, watchedNamespace := range c.watchedNamespaces {\n\t\tif watchedNamespace == ns {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d8c112eb759dea6d189219e964728ef3", "score": "0.49135795", "text": "func (c *Client) IsHub() bool {\n\treturn c.isHub\n}", "title": "" }, { "docid": "64e31e62e947e7a61459f43a92f5b59e", "score": "0.491128", "text": "func (user *ChatUser) IsOnline() bool {\n\treturn len(user.ChatConnections) > 0\n}", "title": "" }, { "docid": "ae8f8b7a59294ed39f680763ab402955", "score": "0.49049926", "text": "func (ctx *Context) IsAjax() bool {\r\n\treturn ctx.HeaderParam(HeaderXRequestedWith) == \"XMLHttpRequest\"\r\n}", "title": "" }, { "docid": "a07ed25bbbc602589d659833e0c48e4b", "score": "0.49020845", "text": "func (c *webSocketWillSendHandshakeRequestClient) GetStream() rpcc.Stream { return c.Stream }", "title": "" }, { "docid": "9fbf0082655bf1deebe1f036e16565d4", "score": "0.4895612", "text": "func (s *Server) IsStarted() bool {\n\tif s.listener != nil {\n\t\treturn true\n\t}\n\n\tif len(s.clientsGroup) > 0 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9fbf0082655bf1deebe1f036e16565d4", "score": "0.4895612", "text": "func (s *Server) IsStarted() bool {\n\tif s.listener != nil {\n\t\treturn true\n\t}\n\n\tif len(s.clientsGroup) > 0 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1197ee2135d77abe27b71a4e4a6d15f5", "score": "0.48934782", "text": "func (d *segmentationDescriptor) SetIsWebDeliveryAllowed(value bool) {\n\td.webDeliveryAllowedFlag = value\n}", "title": "" }, { "docid": "893cf2c11db789a8f707f9e52fe0d71b", "score": "0.48911712", "text": "func (c *Client) isReconnecting() bool {\n\treturn c.reconnecting.Load()\n}", "title": "" }, { "docid": "5966075d130bc6159a428696f1720014", "score": "0.4890881", "text": "func (me TxsdActuate) IsOnRequest() bool { return me == \"onRequest\" }", "title": "" }, { "docid": "306d9a6b82b553d650673929539a6b93", "score": "0.48893827", "text": "func Websocket(w websocket.Service) Option {\n\treturn func(o *Options) {\n\t\to.Websocket = w\n\t}\n}", "title": "" }, { "docid": "d36618b097528bdb4055cfedc7e60584", "score": "0.48891386", "text": "func (c *Client) isConnected() bool {\n\treturn c.connected.Load()\n}", "title": "" }, { "docid": "3f590481582bb2bdff6714e3e5e1b6da", "score": "0.4883518", "text": "func (client *RPCConnection) IsConnected() bool {\n\treturn client.isConnected\n}", "title": "" }, { "docid": "2ce499992b9f37c6dc741aac3bdd9280", "score": "0.4883426", "text": "func (this *RequestStatus) IsStop() bool {\n\tif !this.WaitingQuene.IsEmpty() {\n\t\treturn false\n\t}\n\tfor _, requestMap := range this.CrawlingMap {\n\t\tif len(requestMap) > 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c384424a4eba8f943c79c89215dfbf5d", "score": "0.4881858", "text": "func (c *Client) isConnecting() bool {\n\treturn c.connecting.Load()\n}", "title": "" }, { "docid": "bdaac81cb87faff832594267888e194e", "score": "0.48799", "text": "func (c *Client) Connected() bool {\n\treturn c.ws.Connected()\n}", "title": "" }, { "docid": "7df10c4033a4cfcbedcac01f3b6bdfe7", "score": "0.48789698", "text": "func (ctn *Connection) IsConnected() bool {\n\treturn ctn.conn != nil\n}", "title": "" }, { "docid": "7df10c4033a4cfcbedcac01f3b6bdfe7", "score": "0.48789698", "text": "func (ctn *Connection) IsConnected() bool {\n\treturn ctn.conn != nil\n}", "title": "" }, { "docid": "cd0b45ca3603b05b1c634888b5434f88", "score": "0.48722276", "text": "func IsWebhookEnabled() bool {\n\treturn os.Getenv(\"ENABLE_WEBHOOKS\") != \"false\"\n}", "title": "" }, { "docid": "32a7c625d6c1d5479fa34209447127d1", "score": "0.48705566", "text": "func (r *Runtime) IsConnected() bool { return r.isConnected }", "title": "" }, { "docid": "a8ae4c05fdeefaf4a1eb7a3496b8443a", "score": "0.48618197", "text": "func upgradable(header http.Header) bool {\n\tif header == nil {\n\t\treturn false\n\t}\n\tupgrade, ok := header[\"Upgrade\"]\n\tif !ok {\n\t\treturn false\n\t}\n\tfor _, s := range upgrade {\n\t\tif s == \"websocket\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "57b1e4979aa5bd0701201f7fcb6ed054", "score": "0.48593497", "text": "func Ws(w http.ResponseWriter, r *http.Request) {\n\tvar res bool\n\tc, err := client.NewWebSocketUpgrader(w, r)\n\tif err != nil {\n\t\tlog.Print(\"upgrade:\", err)\n\t\treturn\n\t}\n\tdefer c.Close()\n\t_, message, err := c.ReadMessage()\n\tif err != nil {\n\t\tlog.Print(\"upgrade:\", err)\n\t}\n\tcheck := jwttoken.Parse(string(message))\n\tif check {\n\t\tfor {\n\t\t\tres = scn.СheckRun()\n\t\t\tif res {\n\t\t\t\terr := websocket.WriteJSON(c, scn.GetState)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Error: \", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr := websocket.WriteJSON(c, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Error: \", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "246ffb74a2d713519574efd543c383f8", "score": "0.485506", "text": "func (p *peer) IsOutbound() bool {\r\n\treturn p.peerConn.outbound\r\n}", "title": "" }, { "docid": "17da2556704c9622e577a60f6e5151be", "score": "0.48485833", "text": "func (p *TBufferedReadTransport) IsOpen() bool {\n\treturn true\n}", "title": "" }, { "docid": "bbcb8ff6b1bfed4509e5c99a346cab57", "score": "0.48461208", "text": "func (me TNotificationTransport) IsSoap() bool { return me.String() == \"SOAP\" }", "title": "" }, { "docid": "7095bac611c5703750aa3ad5fb2edb28", "score": "0.48444927", "text": "func (b *BTCC) WebsocketClient() {\n\tevents := make(map[string]func(message []byte, output chan socketio.Message))\n\tevents[\"grouporder\"] = b.OnGroupOrder\n\tevents[\"ticker\"] = b.OnTicker\n\tevents[\"trade\"] = b.OnTrade\n\n\tBTCCSocket = &socketio.SocketIO{\n\t\tVersion: 1,\n\t\tOnConnect: b.OnConnect,\n\t\tOnEvent: events,\n\t\tOnError: b.OnError,\n\t\tOnMessage: b.OnMessage,\n\t\tOnDisconnect: b.OnDisconnect,\n\t}\n\n\tfor b.Enabled && b.Websocket {\n\t\terr := socketio.ConnectToSocket(btccSocketioAddress, BTCCSocket)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s Unable to connect to Websocket. Err: %s\\n\", b.GetName(), err)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Printf(\"%s Disconnected from Websocket.\\n\", b.GetName())\n\t}\n}", "title": "" }, { "docid": "5a4fe0aec7db23cd8554d565fe4db242", "score": "0.48374614", "text": "func (c *Connection) IsConnected() bool {\n\treturn c.clientConn != nil\n}", "title": "" }, { "docid": "c1988c09466b444b01abcd9565cbac65", "score": "0.48348337", "text": "func (s *SrvSession) IsStarted() bool {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.isStarted\n}", "title": "" }, { "docid": "66f61c553d1bd6f37c12e99f91fa270c", "score": "0.48333317", "text": "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsStreaming() bool {\n\treturn me.String() == \"streaming\"\n}", "title": "" }, { "docid": "54b15eaa6948b6e730e3624713affb1a", "score": "0.48263508", "text": "func (w Webhooks) Enabled() bool {\n\treturn w.URL != \"\"\n}", "title": "" }, { "docid": "ed196eb1b1bc9814b4beae44d34576fa", "score": "0.48224655", "text": "func (c *Client) IsConnected() bool {\n\t// TODO: auto-select transport based on BMC capabilities\n\treturn c.isConnected()\n}", "title": "" }, { "docid": "d8c0378b924e7b615f25823b33490ec4", "score": "0.48148695", "text": "func (e *Event) IsWrite() bool {\n\treturn e.Op&WRITE == WRITE\n}", "title": "" }, { "docid": "b80fdca71f3a61da4889cc189daacb17", "score": "0.48148113", "text": "func (w *WSConn) IsClose(err error) bool {\n\treturn WSIsClose(err)\n}", "title": "" }, { "docid": "9343c0b7d2a9d8611fb1afdfdc74a8b4", "score": "0.4809578", "text": "func (c *apiConsumers) IsConsuming() bool {\n\treturn c.consuming\n}", "title": "" }, { "docid": "0c6182a081e39fdec7d0bb5b146d1c36", "score": "0.4807217", "text": "func (c *Client) IsConnected() bool {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn c.Client != nil\n}", "title": "" }, { "docid": "d74f72ff7d6a0a951a8167bf0b74ad9a", "score": "0.48026872", "text": "func (socket *Socket) IsClosed() bool {\n\tsocket.Lock()\n\tdefer socket.Unlock()\n\treturn socket.closed\n}", "title": "" }, { "docid": "a3c1fac8e3dbed955524057d18562780", "score": "0.48022115", "text": "func (w *worker) isRunning() bool {\n\treturn atomic.LoadInt32(&w.running) == 1\n}", "title": "" }, { "docid": "5768cf916cbbab03b9e70f66ca3a5388", "score": "0.4800063", "text": "func UseWebSocket(use bool) ConnectOption {\n\treturn useWebSocketOption(use)\n}", "title": "" }, { "docid": "5883f095b7f44de84ca6c1a254515050", "score": "0.47979236", "text": "func (sd *ServiceData) HasStreamingEndpoint() bool {\n\tfor _, ed := range sd.Endpoints {\n\t\tif ed.ServerStream != nil {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3c29ea13e7347657301f1e3146ebb37b", "score": "0.47945455", "text": "func (c *Controller) IsAjax() bool {\n\treturn c.Ctx.Input.IsAjax()\n}", "title": "" }, { "docid": "f4023f4114fe0cb14ff044a9f8a2f83b", "score": "0.47928375", "text": "func (conn *Connection) IsConnected() bool {\n\tif conn.done() {\n\t\treturn false\n\t}\n\tconn.wGroup.Add(1)\n\tdefer func() {\n\t\tconn.wGroup.Done()\n\t}()\n\treturn conn.Disconnected() == false\n}", "title": "" }, { "docid": "ab81721ec5c0794e2070730e4260b8a9", "score": "0.47786877", "text": "func (conn *Conn) IsConnected() bool {\n\tconn.mux.Lock()\n\tconnected := conn.buf.conn != nil\n\tconn.mux.Unlock()\n\n\treturn connected\n}", "title": "" }, { "docid": "ad0ed20d22104f00d8cad3ddc648adcf", "score": "0.47778496", "text": "func (w *Worker) Online() bool {\n\treturn w.s != nil\n}", "title": "" }, { "docid": "20a0433fa88e0dc70f990e17d9669ca7", "score": "0.47513083", "text": "func (c *connState) IsConnected() bool {\n\treturn c.isConnected > 0\n}", "title": "" }, { "docid": "fb3b3e2c1954e34841ed8b8e56b3a8e0", "score": "0.47470868", "text": "func (c *Notification2Client) IsConnected() bool {\n\tc.mtx.RLock()\n\tisConnected := c.connected\n\tc.mtx.RUnlock()\n\treturn isConnected\n}", "title": "" } ]
998c2f31936c6b8dec9c53ed4597421c
AddTagStatusObserver adds obs as a status observer.
[ { "docid": "be1295f4fd6c7bde6314930c170fe07d", "score": "0.8158071", "text": "func (e *ObservableEditableBuffer) AddTagStatusObserver(obs TagStatusObserver) {\n\tif e.statusobservers == nil {\n\t\te.statusobservers = make(map[TagStatusObserver]struct{})\n\t}\n\te.statusobservers[obs] = struct{}{}\n}", "title": "" } ]
[ { "docid": "2c871b4f633b938462171bba0faaeb35", "score": "0.60923314", "text": "func (n *StatusChangeNotifier) AddObserver(obs *Observer) {\n\tfor _, evt := range obs.Events {\n\t\texists := false\n\t\tnilIdx := -1\n\t\tfor i, observer := range n.observers[evt] {\n\t\t\tif observer == nil {\n\t\t\t\tnilIdx = i\n\t\t\t} else if obs.Id == observer.Id {\n\t\t\t\texists = true\n\t\t\t}\n\t\t}\n\t\tif !exists {\n\t\t\tobs.Conn.SetCloseHandler(n.CloseHandler(obs))\n\t\t\tif nilIdx >= 0 {\n\t\t\t\tn.observers[evt][nilIdx] = obs\n\t\t\t} else {\n\t\t\t\tn.observers[evt] = append(n.observers[evt], obs)\n\t\t\t}\n\t\t\tlog.Println(\"added observer:\", obs)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6ff6fa27bec95e3c8ad71549b9f1f566", "score": "0.60710216", "text": "func (e *ObservableEditableBuffer) DelTagStatusObserver(obs TagStatusObserver) {\n\tif _, exists := e.statusobservers[obs]; exists {\n\t\tdelete(e.statusobservers, obs)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e276ed51f4ed4a54f9df7e29c874b760", "score": "0.5915802", "text": "func (e *ObservableEditableBuffer) notifyTagObservers(before TagStatus) {\n\tafter := e.getTagStatus()\n\tif e.filtertagobservers && before == after {\n\t\treturn\n\t}\n\te.filtertagobservers = true\n\n\tfor t := range e.statusobservers {\n\t\tt.UpdateTag(after)\n\t}\n}", "title": "" }, { "docid": "49efcfc8ee7780b85913c3de4c941b27", "score": "0.52371037", "text": "func (s ServiceUtils) AddStatus(requestId string, value interface{}) {\n\ts.RequestIdToStatus[requestId] = value\n\tts := time.Now().Unix()\n\ts.RequestIdToTimestamp[requestId] = ts\n}", "title": "" }, { "docid": "ec940a8af03c261e909c984a2ba7f4e8", "score": "0.5042396", "text": "func (oiu *OrderInfoUpdate) AddStatus(i int8) *OrderInfoUpdate {\n\toiu.mutation.AddStatus(i)\n\treturn oiu\n}", "title": "" }, { "docid": "a922868de93a3ae0870e3c638ff3f319", "score": "0.49865428", "text": "func (oiuo *OrderInfoUpdateOne) AddStatus(i int8) *OrderInfoUpdateOne {\n\toiuo.mutation.AddStatus(i)\n\treturn oiuo\n}", "title": "" }, { "docid": "b4dba7c490892903badc3a2de6ca7ed4", "score": "0.49127537", "text": "func AddStatus(status func(*editarea.EditArea) string) {\n\tstatuses = append(statuses, status)\n}", "title": "" }, { "docid": "97b3045c7fdaed5638b5293c6fccbf81", "score": "0.4771586", "text": "func (e *ObservableEditableBuffer) getTagStatus() TagStatus {\n\treturn TagStatus{\n\t\tUndoableChanges: e.HasUndoableChanges(),\n\t\tRedoableChanges: e.HasRedoableChanges(),\n\t\tSaveableAndDirty: e.SaveableAndDirty(),\n\t}\n}", "title": "" }, { "docid": "1f993eea3b8ff7eaa6f15744225772df", "score": "0.47233784", "text": "func AddIndependentPropertyGeneratorsForTagFilter_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"Name\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Op\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Value\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "0a0efa7a9903b2f0b79bfb8ef00febd8", "score": "0.46534646", "text": "func (app *App) tagsHandler(w http.ResponseWriter, r *http.Request, logger *zap.Logger) {\n\tapiMetrics.Requests.Add(1)\n\tapp.prometheusMetrics.Requests.Inc()\n\tdefer func() {\n\t\tapiMetrics.Responses.Add(1)\n\t\tapp.prometheusMetrics.Responses.WithLabelValues(strconv.Itoa(http.StatusOK), \"tags\", \"false\").Inc()\n\t}()\n}", "title": "" }, { "docid": "67b10f3780a0e5b9868c1970d025b60a", "score": "0.4650425", "text": "func (puo *PostUpdateOne) AddStatus(i int8) *PostUpdateOne {\n\tpuo.mutation.AddStatus(i)\n\treturn puo\n}", "title": "" }, { "docid": "1d64142fa450d383d75508cd556ae668", "score": "0.46407786", "text": "func (pu *PostUpdate) AddStatus(i int8) *PostUpdate {\n\tpu.mutation.AddStatus(i)\n\treturn pu\n}", "title": "" }, { "docid": "db3c9d8d0440fd1229fa6e4d2f43c608", "score": "0.46256986", "text": "func (l *LabelStatistics) Observe(region *core.RegionInfo, stores []*core.StoreInfo, labels []string) {\n\tregionID := region.GetID()\n\tregionIsolation := GetRegionLabelIsolation(stores, labels)\n\tl.Lock()\n\tdefer l.Unlock()\n\tif label, ok := l.regionLabelStats[regionID]; ok {\n\t\tif label == regionIsolation {\n\t\t\treturn\n\t\t}\n\t\tl.labelCounter[label]--\n\t}\n\tl.regionLabelStats[regionID] = regionIsolation\n\tl.labelCounter[regionIsolation]++\n}", "title": "" }, { "docid": "6f8c980bde399e51ecdb996fa04ee2ad", "score": "0.46102744", "text": "func (e *etcdCacheEntry) AddObserver(c *EtcdConfig, observer etcdObserver) {\n e.Lock()\n defer e.Unlock()\n e.observers = append(e.observers, observer)\n e.startWatching(c)\n}", "title": "" }, { "docid": "31d93f2adf2c7e61885b34025c0154b8", "score": "0.45576245", "text": "func (db *DB) AddStatus(u bson.ObjectId, text string) (*models.Status, error) {\n\tp := &models.Status{}\n\tp.Id = bson.NewObjectId()\n\tp.Text = text\n\tp.Time = time.Now()\n\tp.User = u\n\n\tif err := db.statuses.Insert(p); err != nil {\n\t\treturn nil, err\n\t}\n\n\tupdate := mgo.Change{Update: bson.M{\"$set\": bson.M{\"statusupdate\": p.Time, \"status\": text}}}\n\t_, err := db.users.FindId(u).Apply(update, &models.User{})\n\n\treturn p, err\n}", "title": "" }, { "docid": "0ceb3e4d967bb722e54dd5abdde853d8", "score": "0.45488074", "text": "func (e *ObservableEditableBuffer) AddObserver(observer BufferObserver) {\n\tif e.observers == nil {\n\t\te.observers = make(map[BufferObserver]struct{})\n\t}\n\te.observers[observer] = struct{}{}\n\te.currobserver = observer\n}", "title": "" }, { "docid": "8f0eda0bf84128d266980a02df5959a5", "score": "0.4542191", "text": "func EventListenerStatus(ops ...EventListenerStatusOp) EventListenerOp {\n\treturn func(e *v1alpha1.EventListener) {\n\t\tfor _, op := range ops {\n\t\t\top(&e.Status)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8f0eda0bf84128d266980a02df5959a5", "score": "0.4542191", "text": "func EventListenerStatus(ops ...EventListenerStatusOp) EventListenerOp {\n\treturn func(e *v1alpha1.EventListener) {\n\t\tfor _, op := range ops {\n\t\t\top(&e.Status)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7bc3dfb351a4c0124a5dd748aed8168", "score": "0.45141837", "text": "func (room *Room) addObserver(conn *Connection) bool {\n\tif room.done() {\n\t\treturn false\n\t}\n\troom.wGroup.Add(1)\n\tdefer func() {\n\t\troom.wGroup.Done()\n\t}()\n\n\tif room.lobby.Metrics() {\n\t\tmetrics.Players.WithLabelValues(room.ID, conn.User.Name).Inc()\n\t}\n\n\t// if we havent a place\n\tif !room.Observers.EnoughPlace() {\n\t\tconn.debug(\"Room cant execute request \")\n\t\treturn false\n\t}\n\tconn.debug(\"addObserver\")\n\troom.MakeObserver(conn, true)\n\n\tgo room.addAction(conn.ID(), ActionConnectAsObserver)\n\tgo room.sendObserverEnter(*conn, room.AllExceptThat(conn))\n\troom.lobby.sendRoomUpdate(*room, All)\n\n\treturn true\n}", "title": "" }, { "docid": "a7bc3dfb351a4c0124a5dd748aed8168", "score": "0.45141837", "text": "func (room *Room) addObserver(conn *Connection) bool {\n\tif room.done() {\n\t\treturn false\n\t}\n\troom.wGroup.Add(1)\n\tdefer func() {\n\t\troom.wGroup.Done()\n\t}()\n\n\tif room.lobby.Metrics() {\n\t\tmetrics.Players.WithLabelValues(room.ID, conn.User.Name).Inc()\n\t}\n\n\t// if we havent a place\n\tif !room.Observers.EnoughPlace() {\n\t\tconn.debug(\"Room cant execute request \")\n\t\treturn false\n\t}\n\tconn.debug(\"addObserver\")\n\troom.MakeObserver(conn, true)\n\n\tgo room.addAction(conn.ID(), ActionConnectAsObserver)\n\tgo room.sendObserverEnter(*conn, room.AllExceptThat(conn))\n\troom.lobby.sendRoomUpdate(*room, All)\n\n\treturn true\n}", "title": "" }, { "docid": "7866100fea70ade83f11772eb48307e4", "score": "0.44621632", "text": "func (p *Progress) AddStatus(status Status) {\n\tp.mutex.Lock()\n\n\tvar found bool\n\tfor _, projectStatus := range p.projectStatuses {\n\t\tif projectStatus.Project.Name == status.Project.Name {\n\t\t\t// We found an existing project status to update.\n\t\t\tprojectStatus.State = status.State\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif !found {\n\t\t// We didn't find an existing status for the project.\n\t\tp.projectStatuses = append(p.projectStatuses, &status)\n\t}\n\n\tp.mutex.Unlock()\n}", "title": "" }, { "docid": "183464cf8cdbe2cbbe90d3b83abc472b", "score": "0.44234812", "text": "func updateTagHistory(repo *api.ImageRepository) {\n\t// add new tags\n\tfor tag, imageRef := range repo.Tags {\n\t\t_, ok := repo.Status.Tags[tag]\n\t\tif !ok {\n\t\t\trepo.Status.Tags[tag] = api.TagEventList{}\n\t\t}\n\n\t\tvar pullSpec string\n\t\tif strings.Contains(imageRef, \":\") {\n\t\t\t// v2 registry with pull by digest\n\t\t\tpullSpec = fmt.Sprintf(\"%s@%s\", repo.Status.DockerImageRepository, imageRef)\n\t\t} else {\n\t\t\t// v1 registry with fake pull by id\n\t\t\tpullSpec = fmt.Sprintf(\"%s:%s\", repo.Status.DockerImageRepository, imageRef)\n\t\t}\n\n\t\tentry := repo.Status.Tags[tag]\n\t\tif len(entry.Items) == 0 || entry.Items[0].DockerImageReference != pullSpec {\n\t\t\tnewTagEvent := api.TagEvent{\n\t\t\t\tCreated: util.Now(),\n\t\t\t\tImage: imageRef,\n\t\t\t\tDockerImageReference: pullSpec,\n\t\t\t}\n\n\t\t\tentry.Items = append([]api.TagEvent{newTagEvent}, entry.Items...)\n\t\t}\n\t\trepo.Status.Tags[tag] = entry\n\t}\n\n\t// TODO should we remove tags deleted from repo.Tags from repo.Status.Tags?\n}", "title": "" }, { "docid": "3aaf64cc0df5f319659c73ea2730f9ca", "score": "0.4421765", "text": "func (_RandomBeacon *RandomBeaconFilterer) WatchOperatorStatusUpdated(opts *bind.WatchOpts, sink chan<- *RandomBeaconOperatorStatusUpdated, stakingProvider []common.Address, operator []common.Address) (event.Subscription, error) {\n\n\tvar stakingProviderRule []interface{}\n\tfor _, stakingProviderItem := range stakingProvider {\n\t\tstakingProviderRule = append(stakingProviderRule, stakingProviderItem)\n\t}\n\tvar operatorRule []interface{}\n\tfor _, operatorItem := range operator {\n\t\toperatorRule = append(operatorRule, operatorItem)\n\t}\n\n\tlogs, sub, err := _RandomBeacon.contract.WatchLogs(opts, \"OperatorStatusUpdated\", stakingProviderRule, operatorRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RandomBeaconOperatorStatusUpdated)\n\t\t\t\tif err := _RandomBeacon.contract.UnpackLog(event, \"OperatorStatusUpdated\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "807f0e78da883a151c7ec1a13f0e0343", "score": "0.44169936", "text": "func (in *TagObservation) DeepCopy() *TagObservation {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TagObservation)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3ad886bf6b66ed2b88969dd713b621f6", "score": "0.4399661", "text": "func (tqsc *Controller) AddStatusHeader() {\n}", "title": "" }, { "docid": "cda3c7605e7055dfa67d5d6dfefedfdd", "score": "0.43804917", "text": "func (wt *WatchTower) Add(observer handler.Observer) {\n\twt.observer.Store(observer, struct{}{})\n}", "title": "" }, { "docid": "fd4b0ed7dbf521d16f3557e8bf5f51b7", "score": "0.43600816", "text": "func (m *ccMetric) AddTag(key, value string) {\n\tm.tags[key] = value\n}", "title": "" }, { "docid": "c8b1492544b5cbd49a3d536c7376cfde", "score": "0.43588924", "text": "func (app *App) tagsHandler(w http.ResponseWriter, r *http.Request, logger *zap.Logger) {\n\tapp.ms.Requests.Inc()\n\tdefer func() {\n\t\tapp.ms.Responses.WithLabelValues(strconv.Itoa(http.StatusOK), \"tags\", \"false\").Inc()\n\t}()\n}", "title": "" }, { "docid": "35737df6e9f55278575a6c70e538de01", "score": "0.43434504", "text": "func InfoStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"ℹ️ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "7849d8e7dda82e2c9b5ee706acd5d7aa", "score": "0.43419984", "text": "func AddIndependentPropertyGeneratorsForIPTag_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"IpTagType\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Tag\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "ff8f83ef2363f113565cff01facef168", "score": "0.4317283", "text": "func AddIndependentPropertyGeneratorsForVirtualMachineIpTag_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"IpTagType\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Tag\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "a27699d800a4ee07f0f10c18b3edfcb6", "score": "0.43010205", "text": "func (c *etcdCache) AddObserver(key string, observer etcdObserver) {\n c.Lock()\n defer c.Unlock()\n e, _ := c.getOrCreate(key)\n e.AddObserver(c.config, observer)\n}", "title": "" }, { "docid": "edd60527cd0cf867cd9878b89d48f045", "score": "0.4279741", "text": "func AddStatusPart(banner, frag string, f func(context.Context) interface{}) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tsecs := append(sections, section{\n\t\tBanner: banner,\n\t\tFragment: frag,\n\t\tF: func() interface{} { return f(context.Background()) },\n\t})\n\n\tvar err error\n\ttmpl, err = reparse(secs)\n\tif err != nil {\n\t\tsecs[len(secs)-1] = section{\n\t\t\tBanner: banner,\n\t\t\tFragment: \"<code>bad status template: {{.}}</code>\",\n\t\t\tF: func() interface{} { return err },\n\t\t}\n\t}\n\ttmpl, _ = reparse(secs)\n\tsections = secs\n}", "title": "" }, { "docid": "c3556b50cfad85a7349f2a1575375af8", "score": "0.425105", "text": "func (l *ObserverList) Subscribe(obs Observer) {\n\tl.Lock()\n\tl.Observers = append(l.Observers, obs)\n\tl.Unlock()\n}", "title": "" }, { "docid": "eab7741302c7245447f42d16db623284", "score": "0.42202955", "text": "func (n *StatusChangeNotifier) RemoveObserver(obs *Observer) {\n\tfor _, evt := range obs.Events {\n\t\tfor i, observer := range n.observers[evt] {\n\t\t\tif observer != nil && obs.Id == observer.Id {\n\t\t\t\tn.observers[evt][i] = nil\n\t\t\t\tlog.Println(\"removed observer:\", obs.Id)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "57f89eaf377ecb322972372b0419af2c", "score": "0.4201749", "text": "func (n *node) Observe(observer Observer) {\n\tn.observers = append(n.observers, observer)\n}", "title": "" }, { "docid": "25c15419924d73c233b5d84c91bee804", "score": "0.4201396", "text": "func (f OrdStatusField) Tag() quickfix.Tag { return tag.OrdStatus }", "title": "" }, { "docid": "2fe5c53e96c9d0ca48a695f34e03031f", "score": "0.41937587", "text": "func (client ThreatIntelligenceIndicatorClient) AppendTagsResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "dbd07acc681a77ab6d5fd919a0212408", "score": "0.41537192", "text": "func (tqsc *Controller) AddStatusPart() {\n}", "title": "" }, { "docid": "9c8fe1167e4bdd328465f6aa3de60f86", "score": "0.41470808", "text": "func registered(src *v1alpha1.AWSSNSSource) {\n\tsrc.Status.Conditions = append(src.Status.Conditions, apis.Condition{\n\t\tType: v1alpha1.AWSSNSConditionHandlerRegistered,\n\t\tStatus: corev1.ConditionTrue,\n\t\tSeverity: apis.ConditionSeverityInfo,\n\t\t// LastTransitionTime can be omitted, it is excluded from the\n\t\t// comparison if the above fields already match\n\t})\n}", "title": "" }, { "docid": "58fc02f870c31cdb92f419ac52e6a63b", "score": "0.41286093", "text": "func (basic *BasicMessage) AddTag(value string) {\n\tbasic.Tags = append(basic.Tags, value)\n}", "title": "" }, { "docid": "21eead34d1e22104cabec5c7ae98bc57", "score": "0.4124089", "text": "func AddPoliciesStatusController(mgr ctrl.Manager, transport transport.Transport, syncInterval time.Duration,\n\tleafHubName string, hubOfHubsConfig *configv1.Config) error {\n\tcreateObjFunction := func() bundle.Object { return &policiesv1.Policy{} }\n\n\t// clusters per policy (base bundle)\n\tclustersPerPolicyTransportKey := fmt.Sprintf(\"%s.%s\", leafHubName, datatypes.ClustersPerPolicyMsgKey)\n\tclustersPerPolicyBundle := bundle.NewClustersPerPolicyBundle(leafHubName, helpers.GetBundleGenerationFromTransport(\n\t\ttransport, clustersPerPolicyTransportKey, datatypes.StatusBundle))\n\n\t// compliance status bundle\n\tcomplianceStatusTransportKey := fmt.Sprintf(\"%s.%s\", leafHubName, datatypes.PolicyComplianceMsgKey)\n\tcomplianceStatusBundle := bundle.NewComplianceStatusBundle(leafHubName, clustersPerPolicyBundle,\n\t\thelpers.GetBundleGenerationFromTransport(transport, complianceStatusTransportKey, datatypes.StatusBundle))\n\n\t// minimal compliance status bundle\n\tminComplianceStatusTransportKey := fmt.Sprintf(\"%s.%s\", leafHubName, datatypes.MinimalPolicyComplianceMsgKey)\n\tminComplianceStatusBundle := bundle.NewMinimalComplianceStatusBundle(leafHubName,\n\t\thelpers.GetBundleGenerationFromTransport(transport, minComplianceStatusTransportKey, datatypes.StatusBundle))\n\n\tfullStatusPredicate := func() bool { return hubOfHubsConfig.Spec.AggregationLevel == configv1.Full }\n\tminStatusPredicate := func() bool { return hubOfHubsConfig.Spec.AggregationLevel == configv1.Minimal }\n\n\tbundleCollection := []*generic.BundleCollectionEntry{ // multiple bundles for policy status\n\t\tgeneric.NewBundleCollectionEntry(clustersPerPolicyTransportKey, clustersPerPolicyBundle, fullStatusPredicate),\n\t\tgeneric.NewBundleCollectionEntry(complianceStatusTransportKey, complianceStatusBundle, fullStatusPredicate),\n\t\tgeneric.NewBundleCollectionEntry(minComplianceStatusTransportKey, minComplianceStatusBundle,\n\t\t\tminStatusPredicate),\n\t}\n\n\thohNamespacePredicate := predicate.NewPredicateFuncs(func(meta metav1.Object, object runtime.Object) bool {\n\t\treturn meta.GetNamespace() == datatypes.HohSystemNamespace\n\t})\n\townerRefAnnotationPredicate := predicate.NewPredicateFuncs(func(meta metav1.Object, object runtime.Object) bool {\n\t\treturn helpers.HasAnnotation(meta, datatypes.OriginOwnerReferenceAnnotation)\n\t})\n\n\t// initialize policy status controller (contains multiple bundles)\n\tif err := generic.NewGenericStatusSyncController(mgr, policiesStatusSyncLog, transport, policyCleanupFinalizer,\n\t\tbundleCollection, createObjFunction, syncInterval,\n\t\tpredicate.And(hohNamespacePredicate, ownerRefAnnotationPredicate)); err != nil {\n\t\treturn fmt.Errorf(\"failed to add controller to the manager - %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c7266c69fd093a224a10bededeeba6c3", "score": "0.4120265", "text": "func PendingStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"⌛ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "d69fa2e4e9864876ddf18cfd6ea1f835", "score": "0.41195893", "text": "func NewIstioStatusUpdater(instance *iop.IstioOperator) helmreconciler.RenderingListener {\n\treturn &IstioStatusUpdater{\n\t\tDefaultRenderingListener: &helmreconciler.DefaultRenderingListener{},\n\t\tinstance: instance,\n\t}\n}", "title": "" }, { "docid": "a1e70bcccc08294ef402a7de42522aa8", "score": "0.41186452", "text": "func onAdd(obj interface{}) {\n\t// Cast the obj as node\n\tpod := obj.(*corev1.Pod)\n\tlabel, ok := pod.GetLabels()[SOME_LABEL]\n\tif ok {\n\t\tfmt.Printf(\"onAdd\\n\")\n\t\tfmt.Printf(\"It has the label: %s\\n\", label)\n\t}\n}", "title": "" }, { "docid": "db13dbd274dd6ec98b702951d79f0d4c", "score": "0.41120827", "text": "func NewStatusHandler(services []string) status.StatusHandler {\n\tsvcs := defaultServices\n\tif len(services) > 0 {\n\t\tsvcs = services\n\t}\n\treturn &Status{monitoredServices: svcs}\n}", "title": "" }, { "docid": "a21fec950655366a3cee4a9a49f05303", "score": "0.41024977", "text": "func (mgr *ClientMgr) add2tag(tag string, c *Client) {\n\t_, isok := mgr.Tags[tag]\n\tif !isok {\n\t\tmgr.Tags[tag] = []*Client{}\n\t}\n\n\tmgr.Tags[tag] = append(mgr.Tags[tag], c)\n}", "title": "" }, { "docid": "e54b387bdf30f86248687a5a48dc8386", "score": "0.40996632", "text": "func (lg *logger) Tag(k, v string) {\n\n\tlg.buffer.Tags[k] = v\n\n}", "title": "" }, { "docid": "5921d52b032be3fc9e09adae92044289", "score": "0.40868056", "text": "func (in *IpTag_STATUS) DeepCopy() *IpTag_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpTag_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e30a02aee3fdabbdf83204e79766c1c3", "score": "0.40763098", "text": "func WriteStatus(status []byte, buf *goetty.ByteBuf) {\r\n\tbuf.WriteByte('+')\r\n\tbuf.Write(status)\r\n\tbuf.Write(Delims)\r\n}", "title": "" }, { "docid": "f86cf805b848bb834934a84e1818a064", "score": "0.4071466", "text": "func (m *Manager) AddTag(tags tag.Tags) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tadded := false\n\tfor _, tag := range tags {\n\t\tadded = added || m.tags.Add(tag)\n\t}\n\tif !added {\n\t\treturn nil\n\t}\n\treturn m.self.WriteTag(m.tags)\n}", "title": "" }, { "docid": "ff5b8aa1f25b46629f73d173005acdb6", "score": "0.4071018", "text": "func (tb *TextBuf) AddTag(ln, st, ed int, tag token.Tokens) {\n\tif !tb.IsValidLine(ln) {\n\t\treturn\n\t}\n\ttr := lex.NewLex(token.KeyToken{Tok: tag}, st, ed)\n\ttr.Time.Now()\n\tif len(tb.Tags[ln]) == 0 {\n\t\ttb.Tags[ln] = append(tb.Tags[ln], tr)\n\t} else {\n\t\ttb.Tags[ln] = tb.AdjustedTags(ln) // must re-adjust before adding new ones!\n\t\ttb.Tags[ln].AddSort(tr)\n\t}\n\ttb.MarkupLinesLock(ln, ln)\n}", "title": "" }, { "docid": "b933e513c13862f3cc52b7a4e0994440", "score": "0.40640473", "text": "func NotifyStatus(ac *atmi.ATMICtx, id int64, flags string) {\n\n\tif MStatussvc == \"\" {\n\t\treturn\n\t}\n\n\tbuf, err := ac.NewUBF(1024)\n\tif nil != err {\n\t\tac.TpLogError(\"Failed to allocate buffer: [%s] - dropping incoming message\",\n\t\t\terr.Error())\n\t\treturn\n\t}\n\n\tif err = buf.BChg(u.EX_NETGATEWAY, 0, MGateway); err != nil {\n\t\tac.TpLogError(\"Failed to set EX_NETGATEWAY %d: %s\", err.Code(), err.Message())\n\t\treturn\n\t}\n\n\tif err = buf.BChg(u.EX_NETCONNID, 0, id); err != nil {\n\t\tac.TpLogError(\"Failed to set EX_NETCONNID %d: %s\", err.Code(), err.Message())\n\t\treturn\n\t}\n\n\tif err = buf.BChg(u.EX_NETFLAGS, 0, flags); err != nil {\n\t\tac.TpLogError(\"Failed to set EX_NETFLAGS %d: %s\", err.Code(), err.Message())\n\t\treturn\n\t}\n\n\tbuf.TpLogPrintUBF(atmi.LOG_DEBUG, \"Sending notification\")\n\n\t//Call the service for status notification\n\tif _, err = ac.TpACall(MStatussvc, buf, atmi.TPNOREPLY|atmi.TPNOBLOCK); nil != err {\n\t\tac.TpLogError(\"Failed to call [%s]: %s\", MStatussvc, err.Error())\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "b0d1513dacff225e886d3791f038f767", "score": "0.40611097", "text": "func (p *Poly) AddTag(key, value string) {\n\tp.Tags[key] = value\n}", "title": "" }, { "docid": "dc3359ed74ad4c32ac4a3b07eb67c4f9", "score": "0.40597132", "text": "func TestIsTagged(t *testing.T) {\n\n\tstatus := statusHandler(404)\n\tts := httptest.NewServer(&status)\n\tdefer ts.Close()\n\n\tif isTagged(ts.URL) {\n\t\tt.Error(\"isTagged returned true, want false\")\n\t}\n\n\tstatus = 200\n\n\tif !isTagged(ts.URL) {\n\t\tt.Error(\"isTagged returned false, want true\")\n\t}\n\n}", "title": "" }, { "docid": "d2a9c8d5a3877d5ea047380fdbd98fe5", "score": "0.40565622", "text": "func WarningStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {\n\tif runtime.GOOS == windowsOS {\n\t\tfmt.Fprintf(w, \"%s\\n\", fmt.Sprintf(fmtstr, a...))\n\t} else {\n\t\tfmt.Fprintf(w, \"⚠ %s\\n\", fmt.Sprintf(fmtstr, a...))\n\t}\n}", "title": "" }, { "docid": "2980f7026b0584b17523fd8a23d29886", "score": "0.40466708", "text": "func WithSvcStatusTraffic(targets ...v1.TrafficTarget) ServiceOption {\n\treturn func(r *v1.Service) {\n\t\t// Automatically inject URL into TrafficTarget status\n\t\tfor _, tt := range targets {\n\t\t\ttt.URL = domains.URL(domains.HTTPScheme, tt.Tag+\".example.com\")\n\t\t}\n\t\tr.Status.Traffic = targets\n\t}\n}", "title": "" }, { "docid": "f009ca0a29ff31309993c2dc62d929b2", "score": "0.4040332", "text": "func TagSpan(ctx context.Context, key, value string) error {\n\tspan := opentracing.SpanFromContext(ctx)\n\tlog.Println(\"status\")\n\tif span == nil {\n\t\treturn errors.New(\"the span is nil\")\n\t}\n\tspan.SetTag(key, value)\n\treturn nil\n}", "title": "" }, { "docid": "74b1b91ef41ef2ccc90f70b2ae65b20f", "score": "0.40081027", "text": "func (_RandomBeacon *RandomBeaconFilterer) ParseOperatorStatusUpdated(log types.Log) (*RandomBeaconOperatorStatusUpdated, error) {\n\tevent := new(RandomBeaconOperatorStatusUpdated)\n\tif err := _RandomBeacon.contract.UnpackLog(event, \"OperatorStatusUpdated\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "title": "" }, { "docid": "f58b019ab55099152599d5702aa49626", "score": "0.39967906", "text": "func (r *tagRecord) addListener(listener func(TagSize)) {\n\tr.listeners = append(r.listeners, listener)\n}", "title": "" }, { "docid": "334d85b4e46941e8faa27bcf68dafbfb", "score": "0.39962807", "text": "func NewObs(config Config) (*Obs, error) {\n\tlog, err := NewLogrus(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobs := &Obs{\n\t\tLogger: log,\n\t\tloggedHeaders: config.LoggedHeaders,\n\t}\n\n\tif config.MetricsURL == \"\" {\n\t\treturn obs, nil\n\t}\n\n\tmetrics := NewPrometheusMetrics(config.MetricsURL, config.AppName, config.MetricsFlushInterval, log)\n\tobs.Metrics = metrics\n\treturn obs, nil\n}", "title": "" }, { "docid": "62864f4a8af8bcb44a4bc4e97814173e", "score": "0.39735118", "text": "func (m *InspectionResultMutation) AddStatusofIDs(ids ...int) {\n\tif m.statusof == nil {\n\t\tm.statusof = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.statusof[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "8e22754be611dff3cfd1e27aa97a8b9d", "score": "0.39711326", "text": "func (e *Exporter) AddStatusPart(banner, frag string, f func() any) {\n\tif e.name == \"\" {\n\t\tAddStatusPart(banner, frag, f)\n\t\treturn\n\t}\n\te.sp.addStatusPart(banner, frag, f)\n}", "title": "" }, { "docid": "972db587277ba0c1286fd4f98af289d3", "score": "0.39610285", "text": "func AppendVersionTag(tags *map[string]string) {\n\tif tags == nil {\n\t\treturn\n\t}\n\n\tif *tags == nil {\n\t\t*tags = make(map[string]string)\n\t}\n\n\tif version.Version != \"\" {\n\t\t(*tags)[\"lokoctl-version\"] = version.Version\n\t}\n}", "title": "" }, { "docid": "df3d80169463d43816a5a7bc51b9b066", "score": "0.39606595", "text": "func (ds *DataSubject) registerObserver(o DataListener) {\n\n}", "title": "" }, { "docid": "4c18960ffc6380623824fb41ddf07e38", "score": "0.39573652", "text": "func AddIndependentPropertyGeneratorsForInstanceViewStatus_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"Code\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"DisplayStatus\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Level\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Message\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Time\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "9d7d70cd3457c5cf87f0de0a835c20e4", "score": "0.395282", "text": "func (p *RoundRobinPool) updateStatus(serverUrl *url.URL, alive bool) {\n\tfor _, b := range p.servers {\n\t\tif b.URL.String() == serverUrl.String() {\n\t\t\tb.SetAlive(alive)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d0819e5c00820fa50b38db87241a8cfa", "score": "0.39459193", "text": "func (e *Enumerate) AddMatchTag(tag string) (err error) {\n\te.lock()\n\tdefer e.unlock()\n\tt := C.CString(tag)\n\tdefer freeCharPtr(t)\n\tif C.udev_enumerate_add_match_tag(e.ptr, t) != 0 {\n\t\terr = errors.New(\"udev: udev_enumerate_add_match_tag failed\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "c52d7a1269abce7140848ee1bf4adada", "score": "0.39424336", "text": "func (wou *WorkOrderUpdate) SetStatus(s string) *WorkOrderUpdate {\n\twou.status = &s\n\treturn wou\n}", "title": "" }, { "docid": "70cc7111fcaadae8001ca14b5632502f", "score": "0.3931053", "text": "func AddOrUpdateStatusConditions(conditions []toolchainv1alpha1.Condition, newConditions ...toolchainv1alpha1.Condition) ([]toolchainv1alpha1.Condition, bool) {\n\tvar atLeastOneUpdated bool\n\tvar updated bool\n\tfor _, cond := range newConditions {\n\t\tconditions, updated = addOrUpdateStatusCondition(conditions, cond)\n\t\tatLeastOneUpdated = atLeastOneUpdated || updated\n\t}\n\n\treturn conditions, atLeastOneUpdated\n}", "title": "" }, { "docid": "fa8ba30e9ad009629b0efb8961119121", "score": "0.39196572", "text": "func NewStatus(userID int, status, deskripsiStatus, keteranganStatus, lastUpdate string) (*Status, error) {\n\tparsedDate, err := time.Parse(\"2006-01-02 15:04\", lastUpdate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstats := &Status{\n\t\tUserID: userID,\n\t\tStatus: status,\n\t\tDeskripsiStatus: deskripsiStatus,\n\t\tKeteranganStatus: keteranganStatus,\n\t\tLastUpdate: parsedDate,\n\t}\n\n\tif err := Dbm.Insert(stats); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn stats, err\n}", "title": "" }, { "docid": "afc3b597aa0317c54bfd55fb7d6e9d58", "score": "0.39192006", "text": "func ObserveCount(mType, provider string, success, timeCritical bool) {\n\tmessageCounter.WithLabelValues(mType, provider, strconv.FormatBool(success), strconv.FormatBool(timeCritical)).Inc()\n}", "title": "" }, { "docid": "0c4e87b26d3665671891e9257e21965a", "score": "0.39010662", "text": "func (m *StatusdMutation) AddStatusdIDs(ids ...int) {\n\tif m.statusds == nil {\n\t\tm.statusds = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.statusds[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "75b78e6c5c8eac0e5d8f49b08c0a17a5", "score": "0.38992372", "text": "func (c *MockedHTTPContext) AddTag(tag string) {\n\tif c.MockedAddTag != nil {\n\t\tc.MockedAddTag(tag)\n\t}\n}", "title": "" }, { "docid": "dfcb03d23f4bf947e8b3d508910025b0", "score": "0.38986683", "text": "func (m *Metric) Observe(labelValues []string, value float64) error {\n\tif m.Type == 0 {\n\t\treturn errors.Errorf(\"metric '%s' not existed.\", m.Name)\n\t}\n\tif m.Type != Histogram && m.Type != Summary {\n\t\treturn errors.Errorf(\"metric '%s' not Histogram or Summary type\", m.Name)\n\t}\n\tswitch m.Type {\n\tcase Histogram:\n\t\tm.vec.(*prometheus.HistogramVec).WithLabelValues(labelValues...).Observe(value)\n\t\tbreak\n\tcase Summary:\n\t\tm.vec.(*prometheus.SummaryVec).WithLabelValues(labelValues...).Observe(value)\n\t\tbreak\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "487a5d59f60ed32e167ce562c44691fa", "score": "0.38918376", "text": "func (e *Event) AddTag(tag string) {\n\tdata := e.Data()\n\ttags := data[\"tags\"].(Tags)\n\tlength := len(tags)\n\tidx := sort.SearchStrings(tags, tag)\n\tif idx >= length {\n\t\tdata[\"tags\"] = append(tags, tag)\n\t} else if tags[idx] != tag && length < 1024 {\n\t\t// Max 1024 tags - this also prevents CWE-190 from CodeQL (Size computation for allocation may overflow) due to length+1 without bound check\n\t\tif length+1 > cap(tags) {\n\t\t\toldTags := tags\n\t\t\ttags = make(Tags, length+1)\n\t\t\tcopy(tags, oldTags[:idx])\n\t\t\tcopy(tags[idx+1:], oldTags[idx:])\n\t\t} else {\n\t\t\ttags = tags[:length+1]\n\t\t\tcopy(tags[idx+1:], tags[idx:])\n\t\t}\n\t\ttags[idx] = tag\n\t\tdata[\"tags\"] = tags\n\t}\n}", "title": "" }, { "docid": "94562c40250c3dabb8bb46a5ed390554", "score": "0.38906932", "text": "func (mc *openStackMetric) Observe(err error) error {\n\trequestMetrics.duration.WithLabelValues(mc.attributes...).Observe(\n\t\ttime.Since(mc.start).Seconds())\n\trequestMetrics.total.WithLabelValues(mc.attributes...).Inc()\n\tif err != nil {\n\t\trequestMetrics.errors.WithLabelValues(mc.attributes...).Inc()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "62f2a9a0d9f693fe7574325910a47073", "score": "0.38869587", "text": "func AddIndependentPropertyGeneratorsForNamespaces_Topics_Subscription_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"AccessedAt\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"AutoDeleteOnIdle\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"CreatedAt\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"DeadLetteringOnFilterEvaluationExceptions\"] = gen.PtrOf(gen.Bool())\n\tgens[\"DeadLetteringOnMessageExpiration\"] = gen.PtrOf(gen.Bool())\n\tgens[\"DefaultMessageTimeToLive\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"DuplicateDetectionHistoryTimeWindow\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"EnableBatchedOperations\"] = gen.PtrOf(gen.Bool())\n\tgens[\"ForwardDeadLetteredMessagesTo\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"ForwardTo\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Id\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"LockDuration\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"MaxDeliveryCount\"] = gen.PtrOf(gen.Int())\n\tgens[\"MessageCount\"] = gen.PtrOf(gen.Int())\n\tgens[\"Name\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"RequiresSession\"] = gen.PtrOf(gen.Bool())\n\tgens[\"Status\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"Type\"] = gen.PtrOf(gen.AlphaString())\n\tgens[\"UpdatedAt\"] = gen.PtrOf(gen.AlphaString())\n}", "title": "" }, { "docid": "b02363f5e7e3ba8066fe06b6dcb7b52d", "score": "0.38860828", "text": "func (h *Histogram) Observe(labels map[string]string, values []float64) error {\n\tm, err := h.metric.GetMetricWith(labels)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, value := range values {\n\t\tm.Observe(value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1775a854dde7f2f14ff3fbb12470ae08", "score": "0.3883634", "text": "func (s *Subject) Add(o *Observer) bool {\n\t// check is o already exists\n\ts.mu.RLock()\n\tif s.observerIDs[o.ID] {\n\t\treturn false\n\t}\n\ts.mu.RUnlock()\n\n\t// if not exists, add to list\n\ts.mu.Lock()\n\ts.observers = append(s.observers, o)\n\ts.observerIDs[o.ID] = true\n\ts.mu.Unlock()\n\treturn true\n}", "title": "" }, { "docid": "41731970df299074e172d5ff884f1e51", "score": "0.38803264", "text": "func AddRelatedPropertyGeneratorsForVirtualMachineExtensionHandlerInstanceView_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"Status\"] = gen.PtrOf(InstanceViewStatus_STATUSGenerator())\n}", "title": "" }, { "docid": "01e4c72ce30d85a31da8e5b1accfe545", "score": "0.38743976", "text": "func (r *rawHist) Observe(value float64) {\n\tif r.compat_inner != nil {\n\t\tr.compat_inner.Observe(value)\n\t}\n\tr.record(r.now(), value)\n}", "title": "" }, { "docid": "85f7b474e070e3fbf48798ce88a9c72b", "score": "0.38733697", "text": "func onAdd(obj interface{}) {\n\t// Cast the obj as node\n\tgpod := obj.(*corev1.Pod)\n\t_, ok := gpod.GetLabels()[DiffusionPodLabel]\n\tif ok {\n\t\tlog.Printf(\"in Add!\")\n\t}\n}", "title": "" }, { "docid": "6edcd00d4c689ccd1af1763ddc950280", "score": "0.38721403", "text": "func (wouo *WorkOrderUpdateOne) SetStatus(s string) *WorkOrderUpdateOne {\n\twouo.status = &s\n\treturn wouo\n}", "title": "" }, { "docid": "14662ea83774d83f55a550aee68d36aa", "score": "0.3870527", "text": "func (t *Status) Add() (*StatusResponse, error) {\n\tapi := fmt.Sprintf(\"api/v2/projects/%s/statuses\", t.projectKey)\n\n\tcli := NewClient(t.space, t.apiKey)\n\tbody, err := cli.Post(api, t.request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar r StatusResponse\n\tif err = json.Unmarshal(body, &r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &r, nil\n}", "title": "" }, { "docid": "3a63f1db99d062bf28a4a36743bcc9d5", "score": "0.3862938", "text": "func (t *Timeline) RecordStatus(ctx context.Context, status *pb.NodeStatus) error {\n\tevents := history.DiffNode(t.clock, t.lastStatus, status)\n\tif len(events) == 0 {\n\t\treturn nil\n\t}\n\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tt.addEvents(events)\n\tt.filterDuplicates()\n\tt.lastStatus = status\n\treturn nil\n}", "title": "" }, { "docid": "0328d0c0321b4fef8540052faaa376e6", "score": "0.38520315", "text": "func AddStatusSection(banner string, f func(context.Context) string) {\n\tAddStatusPart(banner, `{{.}}`, func(ctx context.Context) interface{} { return f(ctx) })\n}", "title": "" }, { "docid": "c44cc0013376146ba1f02050c4bb3cc9", "score": "0.38393155", "text": "func NewStatusRecorder(w http.ResponseWriter) *StatusRecorder {\n\treturn &StatusRecorder{ResponseWriter: w, status: http.StatusOK}\n}", "title": "" }, { "docid": "f37c3a0d6c34b49a4b67e2f15a8c11f4", "score": "0.38369563", "text": "func (t *Tuner) WatchStatus(handler func(Status)) watch.Watch {\n\treturn t.status.Watch(handler)\n}", "title": "" }, { "docid": "96cd2241a3f84883c56f96532512d767", "score": "0.38196695", "text": "func (tr *Service) SetObservation(obs map[string]interface{}) error {\n\tp, err := json.TFParser.Marshal(obs)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.TFParser.Unmarshal(p, &tr.Status.AtProvider)\n}", "title": "" }, { "docid": "55525154ff80f863076049a14ed69d36", "score": "0.3816845", "text": "func (tr *MongoCollection) SetObservation(obs map[string]interface{}) error {\n\tp, err := json.TFParser.Marshal(obs)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.TFParser.Unmarshal(p, &tr.Status.AtProvider)\n}", "title": "" }, { "docid": "27219f93be8163590b227135100aa4c2", "score": "0.38144013", "text": "func NewStatusAdmitter(plugin router.Plugin, client client.RoutesGetter, name, hostName string, lease writerlease.Lease, tracker ContentionTracker) *StatusAdmitter {\n\treturn &StatusAdmitter{\n\t\tplugin: plugin,\n\t\tclient: client,\n\t\trouterName: name,\n\t\trouterCanonicalHostname: hostName,\n\n\t\ttracker: tracker,\n\t\tlease: lease,\n\t}\n}", "title": "" }, { "docid": "9840f76880d4799a225a2db7c8745f01", "score": "0.38100278", "text": "func NewStatusTracker() *StatusTracker {\n\tsuccesses := make([]bool, 10)\n\tfor i := range successes {\n\t\tsuccesses[i] = true\n\t}\n\n\treturn &StatusTracker{\n\t\t0,\n\t\tsuccesses,\n\t\tdefaultHalfOpenThreshold,\n\t\tdefaultOpenThreshold,\n\t\tClosed,\n\t\tsync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "e3663b5434a9cac48a3f8283c9fc7f2d", "score": "0.379843", "text": "func (f *Controller) AddTag(indexName string, objectID, value interface{}) error {\n\treturn f.tagAction(\"Add\", indexName, objectID, value)\n}", "title": "" }, { "docid": "a79885284750ebf5a26231a7d6d191d7", "score": "0.37944868", "text": "func (_RandomBeacon *RandomBeaconFilterer) FilterOperatorStatusUpdated(opts *bind.FilterOpts, stakingProvider []common.Address, operator []common.Address) (*RandomBeaconOperatorStatusUpdatedIterator, error) {\n\n\tvar stakingProviderRule []interface{}\n\tfor _, stakingProviderItem := range stakingProvider {\n\t\tstakingProviderRule = append(stakingProviderRule, stakingProviderItem)\n\t}\n\tvar operatorRule []interface{}\n\tfor _, operatorItem := range operator {\n\t\toperatorRule = append(operatorRule, operatorItem)\n\t}\n\n\tlogs, sub, err := _RandomBeacon.contract.FilterLogs(opts, \"OperatorStatusUpdated\", stakingProviderRule, operatorRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &RandomBeaconOperatorStatusUpdatedIterator{contract: _RandomBeacon.contract, event: \"OperatorStatusUpdated\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "681138849f3b30024ce39bb4c0a65a61", "score": "0.37898847", "text": "func AddRelatedPropertyGeneratorsForVirtualMachineExtensionInstanceView_STATUS(gens map[string]gopter.Gen) {\n\tgens[\"Statuses\"] = gen.SliceOf(InstanceViewStatus_STATUSGenerator())\n\tgens[\"Substatuses\"] = gen.SliceOf(InstanceViewStatus_STATUSGenerator())\n}", "title": "" }, { "docid": "dd29032a9e0377f3706eea7d8b8fadb1", "score": "0.37896585", "text": "func (s *AutoMLCandidate) SetObjectiveStatus(v string) *AutoMLCandidate {\n\ts.ObjectiveStatus = &v\n\treturn s\n}", "title": "" }, { "docid": "92ab285ca72ab1dbafe48002786ae944", "score": "0.37847593", "text": "func StatusHandler(w http.ResponseWriter, r *http.Request) {\n\tstatus_requests_cnt.Inc()\n\n\tw.Write([]byte(\"API is up and running\"))\n}", "title": "" }, { "docid": "e70d4f883408e4301ec2bf823cd1685e", "score": "0.37846282", "text": "func (o *NetworkElementSummaryAllOf) SetStatus(v string) {\n\to.Status = &v\n}", "title": "" }, { "docid": "ae3ca41e9866c60b73029e7e4a0b6238", "score": "0.37832442", "text": "func NewStatus(w io.Writer) *Status {\n\tspin := fidget.NewSpinner(w)\n\ts := &Status{\n\t\tspinner: spin,\n\t\twriter: w,\n\t}\n\treturn s\n}", "title": "" } ]
47557470665e16dafc4e6640d7fa233d
DefaultTarget returns of target of this event.
[ { "docid": "d0b0d601c7f4f4ccbf70f7ad30d8aa89", "score": "0.75936717", "text": "func (m *GetDelegate) DefaultTarget() *insolar.Reference {\n\treturn &m.Head\n}", "title": "" } ]
[ { "docid": "8529ccee279fc6e977c1dc9fbecbd6fa", "score": "0.7590817", "text": "func (m *AbandonedRequestsNotification) DefaultTarget() *insolar.Reference {\n\treturn insolar.NewReference(m.Object)\n}", "title": "" }, { "docid": "0dd35006ea39e50cdf3580ebc9aeece4", "score": "0.72501886", "text": "func (m *GetCode) DefaultTarget() *insolar.Reference {\n\treturn &m.Code\n}", "title": "" }, { "docid": "91c00aee211b5e08669540fdf962da14", "score": "0.7249127", "text": "func (m *GetPendingRequests) DefaultTarget() *insolar.Reference {\n\treturn &m.Object\n}", "title": "" }, { "docid": "94bac63a0b61e0d286c9947bef83ae5f", "score": "0.72340125", "text": "func (m *RegisterChild) DefaultTarget() *insolar.Reference {\n\treturn &m.Parent\n}", "title": "" }, { "docid": "63ca46601dc95df73100d5ced681d8dd", "score": "0.7226572", "text": "func (m *GetChildren) DefaultTarget() *insolar.Reference {\n\treturn &m.Parent\n}", "title": "" }, { "docid": "0c500fb17a190a0b8fceadfbfcd5903d", "score": "0.7200149", "text": "func (er *ExecutorResults) DefaultTarget() *insolar.Reference {\n\treturn &er.RecordRef\n}", "title": "" }, { "docid": "e2f7f4f01cc41af524b86d612ddd4dde", "score": "0.71967494", "text": "func (m *UpdateObject) DefaultTarget() *insolar.Reference {\n\treturn &m.Object\n}", "title": "" }, { "docid": "9a390f346e2df171b3b2531e4ca47c2a", "score": "0.7194082", "text": "func (m *GetOpenRequests) DefaultTarget() *insolar.Reference {\n\treturn insolar.NewReference(m.ObjID)\n}", "title": "" }, { "docid": "27e293ad15ad8484d5e3ae49eab5d47e", "score": "0.7136647", "text": "func (m *SetBlob) DefaultTarget() *insolar.Reference {\n\treturn &m.TargetRef\n}", "title": "" }, { "docid": "179c06f9ed2fe955b5de6f3097e75444", "score": "0.7119493", "text": "func (m *SetRecord) DefaultTarget() *insolar.Reference {\n\treturn &m.TargetRef\n}", "title": "" }, { "docid": "2fe2d8a34ed251d6bb8b6c18dc69c469", "score": "0.7014037", "text": "func (m *ValidateRecord) DefaultTarget() *insolar.Reference {\n\treturn &m.Object\n}", "title": "" }, { "docid": "c8c33dc3d0a59c0a411901ba3106e0fc", "score": "0.6949615", "text": "func (cm *CallMethod) DefaultTarget() *insolar.Reference {\n\tswitch cm.CallType {\n\tcase record.CTSaveAsChild:\n\t\treturn genRequest(cm.PulseNum, MustSerializeBytes(cm))\n\tcase record.CTSaveAsDelegate:\n\t\treturn cm.Base\n\tdefault:\n\t\treturn cm.Object\n\t}\n}", "title": "" }, { "docid": "2a1d40f3bddb1343dda6ab437aed9a30", "score": "0.6935985", "text": "func (m *GetPendingRequestID) DefaultTarget() *insolar.Reference {\n\treturn insolar.NewReference(m.ObjectID)\n}", "title": "" }, { "docid": "5a13809e45480e4483fee65875849714", "score": "0.6904203", "text": "func (m *GetObject) DefaultTarget() *insolar.Reference {\n\treturn &m.Head\n}", "title": "" }, { "docid": "6e59b03a05e8735afde4d9a4db5a01ff", "score": "0.6868354", "text": "func (vcb *ValidateCaseBind) DefaultTarget() *insolar.Reference {\n\treturn &vcb.RecordRef\n}", "title": "" }, { "docid": "3591983582c124e9484b189dd27b0317", "score": "0.6859603", "text": "func (m *GetObjectIndex) DefaultTarget() *insolar.Reference {\n\treturn &m.Object\n}", "title": "" }, { "docid": "b9cb1ed48e166981460cf699bf836e93", "score": "0.68293256", "text": "func (m *GetJet) DefaultTarget() *insolar.Reference {\n\treturn insolar.NewReference(m.Object)\n}", "title": "" }, { "docid": "5453ca7dd95704c0afcbfae4d0fd1ace", "score": "0.6806845", "text": "func (vr *ValidationResults) DefaultTarget() *insolar.Reference {\n\treturn &vr.RecordRef\n}", "title": "" }, { "docid": "5453ca7dd95704c0afcbfae4d0fd1ace", "score": "0.6806845", "text": "func (vr *ValidationResults) DefaultTarget() *insolar.Reference {\n\treturn &vr.RecordRef\n}", "title": "" }, { "docid": "3d40b526e404c19940001ad69fd1466d", "score": "0.6724774", "text": "func (cm *CallMethod) DefaultTarget() *insolar.Reference {\n\treturn record.CalculateRequestAffinityRef(&cm.IncomingRequest, cm.PulseNum, pcs)\n}", "title": "" }, { "docid": "ad25292408e3b1377990563c1caa68c3", "score": "0.6136595", "text": "func (s *Status) Target() ObjectI {\n\treturn s.target\n}", "title": "" }, { "docid": "bcad297d93333aed3b8fa03883be17b1", "score": "0.6004779", "text": "func (fd FileDef) Target() TargetDef {\n\treturn fd.target\n}", "title": "" }, { "docid": "f26f58909545937754fc0ee1e727b9cc", "score": "0.5990508", "text": "func (msg *Message) Target() NodeID {\n\treturn msg.target\n}", "title": "" }, { "docid": "426d1f1d0cb293bfd4baf2dd25dda7d1", "score": "0.5973133", "text": "func (d *Dalibo) Target() string {\n\treturn d.postURL\n}", "title": "" }, { "docid": "dee65b91da08cbe3266a41cdfe6b8ea2", "score": "0.58307344", "text": "func NewDefaultTargetGroupManager(elbv2Client services.ELBV2, logger logr.Logger) *defaultTargetGroupManager {\n\treturn &defaultTargetGroupManager{\n\t\telbv2Client: elbv2Client,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "188befe4cb12e1a04c56b064063bf281", "score": "0.57847756", "text": "func (ev *EventCollision) Target() Collider {\n\treturn ev.target\n}", "title": "" }, { "docid": "901aa00429d130ed5d67ad66f22d2b3e", "score": "0.5760127", "text": "func (c *CallbackContext) Target() interface{} {\n\treturn c.target.Interface()\n}", "title": "" }, { "docid": "dcc1a62abe4af5a39f07c8585964f02f", "score": "0.57282025", "text": "func (f *FlowNetwork) Target() graph.NodeID {\n\treturn f.target\n}", "title": "" }, { "docid": "dff061f95edae0fed4020c6c7bbda01c", "score": "0.57092303", "text": "func NewDefaultEventSender(\n\thttpClient *http.Client,\n\teventsURI string,\n\tdiagnosticURI string,\n\theaders http.Header,\n\tloggers ldlog.Loggers,\n) EventSender {\n\treturn &defaultEventSender{httpClient, eventsURI, diagnosticURI, headers, loggers, 0}\n}", "title": "" }, { "docid": "45741c3816514063c926c441c356bd33", "score": "0.5698256", "text": "func (rs AWSRegions) SetDefaultTarget() {\n\trs.SetTarget(func(r *AWSRegion) {\n\t\tr.Target = &AWSTarget{\n\t\t\tHTTPS: r.CheckType == CheckTypeHTTPS,\n\t\t\tCode: r.Code,\n\t\t\tService: r.Service,\n\t\t\tRnd: mkRandomString(13),\n\t\t}\n\t})\n}", "title": "" }, { "docid": "5eb054cd8978e5371012c3bcb94281bd", "score": "0.5674319", "text": "func (Close) Target() State {\n\treturn nil\n}", "title": "" }, { "docid": "1c785acd35d6ad38efc3b70cf9018af7", "score": "0.5672194", "text": "func (ts *Set) Target() string {\n\treturn ts.target\n}", "title": "" }, { "docid": "2dd53dde038c823d6f248bf71b88e4c8", "score": "0.5630473", "text": "func (msg *TCPMessage) Target() string {\n\tif msg.spec == nil {\n\t\treturn \"<none>\"\n\t}\n\treturn \"tcp://\" + msg.Addr()\n}", "title": "" }, { "docid": "c0c6027ac66c2c6a710edaa6de792b88", "score": "0.5615712", "text": "func (o EventContentResponseOutput) Target() TargetResponsePtrOutput {\n\treturn o.ApplyT(func(v EventContentResponse) *TargetResponse { return v.Target }).(TargetResponsePtrOutput)\n}", "title": "" }, { "docid": "7c61140620e60081c8d07402d42897fe", "score": "0.5615644", "text": "func (m *ParcelMock) MinimockDefaultTargetInspect() {\n\tfor _, e := range m.DefaultTargetMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\tm.t.Error(\"Expected call to ParcelMock.DefaultTarget\")\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.DefaultTargetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDefaultTargetCounter) < 1 {\n\t\tm.t.Error(\"Expected call to ParcelMock.DefaultTarget\")\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcDefaultTarget != nil && mm_atomic.LoadUint64(&m.afterDefaultTargetCounter) < 1 {\n\t\tm.t.Error(\"Expected call to ParcelMock.DefaultTarget\")\n\t}\n}", "title": "" }, { "docid": "1bdd7281c979ad0068938e29b969d73c", "score": "0.55791634", "text": "func (link *Link) Target() string {\n\treturn link.target\n}", "title": "" }, { "docid": "38325baa5ed48a25bee4e022e0ddfcf1", "score": "0.55664825", "text": "func (c *Config) Target() *engine.NameSpace {\n\treturn &engine.NameSpace{\n\t\tType: \"module\",\n\t\tModule: \"logger\",\n\t}\n}", "title": "" }, { "docid": "f69b1ef99002c86c9369e7c9687879d3", "score": "0.5557391", "text": "func (o EventContentResponsePtrOutput) Target() TargetResponsePtrOutput {\n\treturn o.ApplyT(func(v *EventContentResponse) *TargetResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(TargetResponsePtrOutput)\n}", "title": "" }, { "docid": "f8b34cc76f97d1eb19e6f17e0ade3a31", "score": "0.55552113", "text": "func (actorSelf *ActorDef[T]) GetDefault() *ActorDef[interface{}] {\n\treturn defaultActor\n}", "title": "" }, { "docid": "a1e4495d000d4471f63e2acc9d7a045c", "score": "0.5538246", "text": "func (s *StarType) Target() Definition {\n\treturn s.def\n}", "title": "" }, { "docid": "d3cbae983fcf6a552ed6258dd8971943", "score": "0.5536615", "text": "func (cc *ClientConn) Target() string {\n\treturn cc.target\n}", "title": "" }, { "docid": "017fa99aff39585d42e3d81f91520ca3", "score": "0.55296814", "text": "func (u *UserAgentParser) GetTarget() string {\n\tif u == nil || u.Target == nil {\n\t\treturn \"\"\n\t}\n\treturn *u.Target\n}", "title": "" }, { "docid": "ff790d82f9226405004dbd8b68ebad12", "score": "0.5520121", "text": "func (d *Deployment) Target() target.Target {\n\treturn d.target\n}", "title": "" }, { "docid": "d1cb8ae1ff4e23f02859789b4ccbc79f", "score": "0.55068386", "text": "func (o *LogsURLParser) GetTarget() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn o.Target\n}", "title": "" }, { "docid": "628d73087222fc21510c052b563b4a9f", "score": "0.54990965", "text": "func (p *Plugger) Target(msg *Message) Target {\n\taddr := msg.Address()\n\tfor i := range p.targets {\n\t\tif p.targets[i].Address().Contains(addr) {\n\t\t\treturn p.targets[i]\n\t\t}\n\t}\n\treturn Target{}\n}", "title": "" }, { "docid": "402a0c617119ffb54c1bd0abf78b9b88", "score": "0.5496756", "text": "func (o EventTargetOutput) HttpTarget() EventTargetHttpTargetPtrOutput {\n\treturn o.ApplyT(func(v *EventTarget) EventTargetHttpTargetPtrOutput { return v.HttpTarget }).(EventTargetHttpTargetPtrOutput)\n}", "title": "" }, { "docid": "7e5608c57bf76a40e63b1daf40d158dd", "score": "0.54882115", "text": "func (rt RawTarget) TargetName() string {\n\treturn rt.Name\n}", "title": "" }, { "docid": "6adaab8070f320925003d817e69b266b", "score": "0.54870373", "text": "func (f SAMClientForwarder) Target() string {\n\treturn f.TargetHost + \":\" + f.TargetPort\n}", "title": "" }, { "docid": "6c8774bcf3711163565c67b245c639a8", "score": "0.5481259", "text": "func (m *Message) Target() *string {\n if len(m.Parameters) > 0 {\n return &m.Parameters[0]\n }\n return nil\n}", "title": "" }, { "docid": "6eeffa5353a9ecafc6cbfc43e782fa5e", "score": "0.5473506", "text": "func (e DiscoveryError) Target() string {\n\treturn e.target\n}", "title": "" }, { "docid": "b598ab8516fb037a28fff422cfa36773", "score": "0.5465526", "text": "func (q Query) Target() Target {\n\tif q.Files != \"\" {\n\t\tif q.Tests != \"\" {\n\t\t\tif q.Cases != \"\" {\n\t\t\t\treturn Cases\n\t\t\t}\n\t\t\treturn Tests\n\t\t}\n\t\treturn Files\n\t}\n\treturn Suite\n}", "title": "" }, { "docid": "1a7d6daa1449ee5ec0365c2b7788d64b", "score": "0.54473275", "text": "func (p *PeerTracker) Target() peer.ID {\n\treturn p.target\n}", "title": "" }, { "docid": "e7bf39d79bca7e9e24bc5bc89c25080d", "score": "0.544616", "text": "func (g *Graph) Target(name string) Target {\n\tg.mu.Lock()\n\ttarget := g.target(name)\n\tg.mu.Unlock()\n\treturn target\n}", "title": "" }, { "docid": "26cbf76e994aac77ffc4c57c5926774d", "score": "0.5405807", "text": "func (o ClfsTargetPtrOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ClfsTarget) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4b1ac2d62c6abfb41e6e98c90a621999", "score": "0.53973305", "text": "func (e *Event) PreventingDefault() EventI {\n\te.preventDefault = true\n\treturn e\n}", "title": "" }, { "docid": "b6e2ac26d54d649330a961c49ef15214", "score": "0.5394482", "text": "func (o Nfs3TargetPtrOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Nfs3Target) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9978fdb3a8a1c8f1b8d485e4237bf60a", "score": "0.53814965", "text": "func Target(target string) func(Element) {\n\treturn func(f Element) { f.AddAttribute(\"target\", target) }\n}", "title": "" }, { "docid": "93195b03cb1cb0fcfef9d1860705323a", "score": "0.5375597", "text": "func (Run) Target() State {\n\treturn Ready\n}", "title": "" }, { "docid": "8ad7f532d92e644019c228219f48df3c", "score": "0.5369524", "text": "func (s *State) CurrentTarget() types.Target {\n\tid := s.mu.RLock()\n\tdefer s.mu.RUnlock(id)\n\treturn s.currentBlockNode().target\n}", "title": "" }, { "docid": "885f9fdc2b86d6d72da878dc85367cdd", "score": "0.5351044", "text": "func (a *ArithmeticProcessor) GetTarget() string {\n\tif a == nil || a.Target == nil {\n\t\treturn \"\"\n\t}\n\treturn *a.Target\n}", "title": "" }, { "docid": "77a48eec971c02f02b91ea7ac19e9411", "score": "0.5340514", "text": "func (c *Conn) Target() [16]byte {\n\treturn c.target\n}", "title": "" }, { "docid": "a8d9e571e055a40f45489a5615e7ba9c", "score": "0.5326031", "text": "func (o ClfsTargetOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClfsTarget) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "733b7743210346b8953ffbacf3f207f0", "score": "0.5324944", "text": "func (o BindingOutput) Target() ObjectReferenceOutput {\n\treturn o.ApplyT(func(v *Binding) ObjectReferenceOutput { return v.Target }).(ObjectReferenceOutput)\n}", "title": "" }, { "docid": "536e4679290ee6c8bbf96d3a01df1c1b", "score": "0.53201336", "text": "func (b *ItemsBuilder) Default(v interface{}) *ItemsBuilder {\n\tb.lock.Lock()\n\tdefer b.lock.Unlock()\n\tif b.target == nil {\n\t\treturn b\n\t}\n\tb.target.defaultValue = v\n\treturn b\n}", "title": "" }, { "docid": "54bd1191000754cb13c396e6a50a94b5", "score": "0.5317145", "text": "func (p *Plugger) Target(msg *Message) *PluginTarget {\n\taddr := msg.Address()\n\tfor i := range p.targets {\n\t\tif p.targets[i].address.Contains(addr) {\n\t\t\treturn &p.targets[i]\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "079d79cc68f846c75247a849f17f1977", "score": "0.5301569", "text": "func (u *UrlParser) GetTarget() string {\n\tif u == nil || u.Target == nil {\n\t\treturn \"\"\n\t}\n\treturn *u.Target\n}", "title": "" }, { "docid": "608417e3a3e862d5ed86e331dac9535c", "score": "0.5299769", "text": "func NewDeleteLogTargetDefault(code int) *DeleteLogTargetDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &DeleteLogTargetDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "010e3228fd86ca5f73af1778cd58a45a", "score": "0.52858037", "text": "func (o Nfs3TargetOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Nfs3Target) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "243b9f1501fe183cd4d859be56ea257c", "score": "0.5282411", "text": "func Target(target string) Option {\n\treturn func(g *Generator) {\n\t\tg.Target = target\n\t}\n}", "title": "" }, { "docid": "1d36462872644f6b11f561e33a71b757", "score": "0.52816343", "text": "func (b *AccessPackageAssignmentRequestBuilder) Target() *AccessPackageSubjectRequestBuilder {\n\tbb := &AccessPackageSubjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/target\"\n\treturn bb\n}", "title": "" }, { "docid": "baf5fe8d5badd7d05dc9e549429abfe4", "score": "0.5276204", "text": "func (o EventTargetOutput) TargetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EventTarget) pulumi.StringOutput { return v.TargetId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "56693551112a78eb17d73e2ac73c58f9", "score": "0.5270047", "text": "func (actorSelf *ActorDef) GetDefault() *ActorDef {\n\treturn defaultActor\n}", "title": "" }, { "docid": "3ffd8edbe539d04744ee63a8bc5e8e01", "score": "0.526935", "text": "func (l *Link) Target() *Context {\n\treturn l.target\n}", "title": "" }, { "docid": "48a30f8c3d9331a9d763ec99ec0755d6", "score": "0.52566856", "text": "func (r Result) Target() *url.URL {\n\treturn r.options.Target\n}", "title": "" }, { "docid": "c242e06699943544b8d64d5a0b9728cb", "score": "0.52480644", "text": "func (o BindingTypeOutput) Target() ObjectReferenceOutput {\n\treturn o.ApplyT(func(v BindingType) ObjectReference { return v.Target }).(ObjectReferenceOutput)\n}", "title": "" }, { "docid": "98c689c6b0d3b3c48373987d40272288", "score": "0.5243929", "text": "func (sr SynthesizedResolver) Target(ctx context.Context, target rpcinfo.EndpointInfo) string {\n\tif sr.TargetFunc == nil {\n\t\treturn \"\"\n\t}\n\treturn sr.TargetFunc(ctx, target)\n}", "title": "" }, { "docid": "cadd88db385ee90bf1b7942c4229fae0", "score": "0.52286774", "text": "func NewCreateLogTargetDefault(code int) *CreateLogTargetDefault {\n\treturn &CreateLogTargetDefault{\n\t\t_statusCode: code,\n\t\tConfigurationVersion: 0,\n\t}\n}", "title": "" }, { "docid": "76766b5fae8bd7f3edc3a0a3ae8f5653", "score": "0.52156544", "text": "func (m *ParcelMock) MinimockDefaultTargetDone() bool {\n\tfor _, e := range m.DefaultTargetMock.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.DefaultTargetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDefaultTargetCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcDefaultTarget != nil && mm_atomic.LoadUint64(&m.afterDefaultTargetCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "800b45c0f02f0f3b439b60c56b41b6af", "score": "0.52087146", "text": "func Default() *Agent {\n\treturn _default\n}", "title": "" }, { "docid": "cd5bf566fbc4f236d7a26d099398daa5", "score": "0.52026165", "text": "func (o *OdataErrorMain) GetTarget() string {\n\tif o == nil || o.Target == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Target\n}", "title": "" }, { "docid": "c4ffa8dd8aaa938e32d4fc801a07cf17", "score": "0.52025115", "text": "func (o EventTargetOutput) SqsTarget() EventTargetSqsTargetPtrOutput {\n\treturn o.ApplyT(func(v *EventTarget) EventTargetSqsTargetPtrOutput { return v.SqsTarget }).(EventTargetSqsTargetPtrOutput)\n}", "title": "" }, { "docid": "104f6742862e99813c44da4dfa2a9f72", "score": "0.518622", "text": "func (o ServiceLevelObjectivePtrOutput) Target() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *ServiceLevelObjective) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Target\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "a4fb82e0f07115b8b38543db5863564f", "score": "0.51805145", "text": "func (Test) Default() {\n\tmg.Deps(\n\t\ttest,\n\t)\n}", "title": "" }, { "docid": "24f03ef0391f7295c22862f3df29c804", "score": "0.5164839", "text": "func (k HeartbeatMonitorTarget) TargetID() string { return string(k) }", "title": "" }, { "docid": "f2112318ebcd7de74f9d5b260bb9611c", "score": "0.5161205", "text": "func (c *CategoryProcessor) GetTarget() string {\n\tif c == nil || c.Target == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.Target\n}", "title": "" }, { "docid": "1b9fbf4c7736ca878de5bc064b487818", "score": "0.5142954", "text": "func (group *ContainerGroup) Default() {\n\tgroup.defaultImpl()\n\tvar temp any = group\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "8a4781748b706e04880e82fe4dea0c54", "score": "0.51381963", "text": "func (Pause) Target() State {\n\treturn Paused\n}", "title": "" }, { "docid": "8b01af424ade26802ad817d1a479d7c0", "score": "0.5126057", "text": "func (target WebhookTarget) ID() event.TargetID {\n\treturn target.id\n}", "title": "" }, { "docid": "35b2b95a6b8ac206008c95ee58991611", "score": "0.5125934", "text": "func (o EventhubNamespaceSpecNetworkRuleOutput) DefaultAction() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventhubNamespaceSpecNetworkRule) *string { return v.DefaultAction }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7e7163d7ea73b5be16875f6d3afc9a3f", "score": "0.5103073", "text": "func (s *StringBuilderProcessor) GetTarget() string {\n\tif s == nil || s.Target == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Target\n}", "title": "" }, { "docid": "429013dee0e703d8975fd5317fd44ffd", "score": "0.50950336", "text": "func (o Nfs3TargetResponsePtrOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Nfs3TargetResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "121971a12c921987f9509e5428c0172d", "score": "0.5094613", "text": "func NewDefaultSource(g Generator, stackLevel int) *Source {\n\treturn NewSource(event.DefaultBus, g, stackLevel)\n}", "title": "" }, { "docid": "b28f68aefce57af98ada20d830014a5e", "score": "0.5092898", "text": "func (h *Target) Name() string {\n\treturn \"minio-kafka-audit\"\n}", "title": "" }, { "docid": "6ec6a5ad14977b319282fbb3efd70b3a", "score": "0.5092556", "text": "func (c *GrpcClient) Target() string {\n\treturn c.pushEndpoint\n}", "title": "" }, { "docid": "f1cb0b3097f77e60e65b2531181b303c", "score": "0.5084929", "text": "func (o NetworkRuleSetOutput) DefaultAction() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkRuleSet) string { return v.DefaultAction }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5770258cf4804fad2df5a943ee0b0092", "score": "0.5082709", "text": "func (o EventhubNamespaceSpecNetworkRulePtrOutput) DefaultAction() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EventhubNamespaceSpecNetworkRule) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DefaultAction\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d50a34cf83c928d09f6e19ce5b996d43", "score": "0.5080764", "text": "func (k UserOverrideTarget) TargetID() string { return string(k) }", "title": "" }, { "docid": "ef4e511118b760683e0ad3d03120ac0c", "score": "0.5076189", "text": "func (o ConnectionStatusDefinitionOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ConnectionStatusDefinition) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9def098f4303bb7115a33165cb2e9f26", "score": "0.5074116", "text": "func NewDefaultResponder() elton.Handler {\n\treturn NewResponder(ResponderConfig{})\n}", "title": "" }, { "docid": "23d46830ae30da4fb13137a1d0872d1b", "score": "0.50709075", "text": "func (o CmdkeySetupOutput) TargetName() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CmdkeySetup) interface{} { return v.TargetName }).(pulumi.AnyOutput)\n}", "title": "" } ]
4a40ce9877d674a83b5cba4452735b5e
generateCacheKey is a super basic keygen that just hashes the request method and URL.
[ { "docid": "80649a7a04a68cc204792cc7ca35505d", "score": "0.8507548", "text": "func generateCacheKey(req *http.Request) ([]byte, error) {\n\tvar b bytes.Buffer\n\tb.WriteString(req.Method)\n\tb.WriteString(\" \")\n\tb.WriteString(req.URL.String())\n\n\thash := sha1.New()\n\tif _, err := b.WriteTo(hash); err != nil {\n\t\treturn nil, err\n\t}\n\treturn hash.Sum(nil), nil\n}", "title": "" } ]
[ { "docid": "fe21d6a91d89e1b38e1f197cd2d31f9d", "score": "0.7555512", "text": "func GenCacheKey(addr string, task string) string {\n\treturn addr + \":cache+\" + task\n}", "title": "" }, { "docid": "8e955ef0b6b574495b70b6087c44e200", "score": "0.7253363", "text": "func generateCacheKey(data flightpath.LazyJackRequest) (string, error) {\n\t// add schedules to the key as well\n\tschedulesJSON, err := json.Marshal(data.Schedules)\n\tif err != nil {\n\t\tlogger.Warn(literals.LazyJack, \"error while marshalling schedules for generating key\", err, nil)\n\t\treturn \"\", err\n\t}\n\n\tkey := data.TripPlan.StartCity + \"_\" + data.TripPlan.EndCity + \"_\" + strconv.FormatInt(data.PreferredTime, 10) + string(schedulesJSON)\n\tbase64key := base64.StdEncoding.EncodeToString([]byte(key))\n\treturn base64key + flightPathSuffix, nil\n}", "title": "" }, { "docid": "4c1342ae37eeb660cdf58af4d641fc02", "score": "0.7160369", "text": "func (l cacheKeyLimits) GenerateCacheKey(userID string, r queryrange.Request) string {\n\tsplit := l.QuerySplitDuration(userID)\n\tcurrentInterval := r.GetStart() / int64(split/time.Millisecond)\n\t// include both the currentInterval and the split duration in key to ensure\n\t// a cache key can't be reused when an interval changes\n\treturn fmt.Sprintf(\"%s:%s:%d:%d:%d\", userID, r.GetQuery(), r.GetStep(), currentInterval, split)\n}", "title": "" }, { "docid": "0d989c0a0069482a56ac6d79a76f831e", "score": "0.69838977", "text": "func cacheKey(req *http.Request) string {\n\tif req.Method == http.MethodGet {\n\t\treturn req.URL.String()\n\t} else {\n\t\treturn req.Method + \" \" + req.URL.String()\n\t}\n}", "title": "" }, { "docid": "611c531438b783d18d22949ac4b9177c", "score": "0.66867054", "text": "func getCacheKey(req *http.Request) ([]byte, error) {\n\t// Use custom cache key from context if available.\n\tctx := martian.NewContext(req)\n\tif keyRaw, ok := ctx.Get(CustomKey); ok && keyRaw != nil {\n\t\treturn keyRaw.([]byte), nil\n\t}\n\tkey, err := generateCacheKey(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"generateCacheKey(): %v\", err)\n\t}\n\treturn key, nil\n}", "title": "" }, { "docid": "422cec50595ae99bd98873871c0d5614", "score": "0.6674553", "text": "func (r *Resizer) GetCacheKey(up utils.URLParams) cache.Key {\n\th := sha512.New()\n\tstr := fmt.Sprintf(\"%s/%dx%d\", up.ExternalURL, up.Width, up.Height)\n\t_, _ = io.WriteString(h, str)\n\tresult := cache.Key([]rune(fmt.Sprintf(\"%x\", h.Sum(nil)))[0:64])\n\n\treturn result\n}", "title": "" }, { "docid": "144e19e8346592b006ec45e9b36ad4d6", "score": "0.6575118", "text": "func generateRequestKey(r *http.Request) string {\n\treturn r.URL.RequestURI() + r.URL.RawQuery\n}", "title": "" }, { "docid": "7968fe65d57c76abb6ff7a9b9d8ae837", "score": "0.64509946", "text": "func GenKey(tpl string, keys ...interface{}) string {\n\t// return prefix + fmt.Sprintf(tpl, keys...)\n\t// 初始化缓存时已经设置了前缀了\n\treturn fmt.Sprintf(tpl, keys...)\n}", "title": "" }, { "docid": "21cf06dfda0f2139e6abe8470f418c8d", "score": "0.62008053", "text": "func cacheKey(key string) string {\n\treturn \"link-\" + key\n}", "title": "" }, { "docid": "11ea83947d056e174f46a190417d626e", "score": "0.6136678", "text": "func (rctx *requestContext) generateStartKey(requestPath string) string {\n\tbucketRootPrefixKey := rctx.targetCfg.Bucket.GetRootPrefix()\n\t// Key must begin by bucket prefix\n\tkey := bucketRootPrefixKey\n\t// Trim first / if exists\n\tkey += strings.TrimPrefix(requestPath, \"/\")\n\n\treturn key\n}", "title": "" }, { "docid": "a3cf1a7d940503142c475ba3bb9f19b0", "score": "0.61294603", "text": "func (v ViewEntry) GenerateKey() string {\n\tdateString := strconv.FormatInt(v.Date, 10)\n\tuniqueString := fmt.Sprintf(\"%s%s%s\", v.Stb, v.Title, dateString)\n\thash := fnv.New64a()\n\thash.Write([]byte(uniqueString))\n\treturn fmt.Sprintf(\"%x\", hash.Sum64())\n}", "title": "" }, { "docid": "09e996312aeae178d70237005a82fd1b", "score": "0.6118216", "text": "func (r *Request) CacheKey() (string, error) {\n\tb, err := jsoniter.Marshal(r)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\th := md5.New()\n\t_, err = h.Write(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn \"iam:\" + hex.EncodeToString(h.Sum(nil)), nil\n}", "title": "" }, { "docid": "f1af2202d8cf0a88c7a2b5507d855e53", "score": "0.5969687", "text": "func (c *Consistent) genKey(s string, idx int) string {\n\treturn strconv.Itoa(idx) + s\n}", "title": "" }, { "docid": "381449692b3568f13fd933d6b0722fb7", "score": "0.58347845", "text": "func (f *Factory) Gen(uri string) (key string, err error) {\n\t// we don't return the parsed url because #hash are converted to uri-compatible\n\t// and we don't want to encode/decode all the time, there is no need for that,\n\t// we save the url as the user expects if the uri validation passed.\n\t_, err = url.ParseRequestURI(uri)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tkey = f.generator(len(uri))\n\t// Make sure that the key is unique\n\tfor {\n\t\tif v := f.store.Get(key); v == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tkey = f.generator((len(uri) / 2) + 1)\n\t}\n\n\treturn key, nil\n}", "title": "" }, { "docid": "75090e70a9f42cefa30693c1b5ab60be", "score": "0.5820495", "text": "func (a *Aggregate) GenKey(service tools.TypeSERVICE, theme tools.TypeTHEME) string {\n\tkeyStr := fmt.Sprintf(`%s/%s`, string(service), string(theme))\n\treturn keyStr\n}", "title": "" }, { "docid": "94e19880fc21ff916d946858e62da073", "score": "0.57322246", "text": "func CacheKey(tenantID, clientID string) string {\n\treturn fmt.Sprintf(\"%s:%s\", tenantID, clientID)\n}", "title": "" }, { "docid": "ad3bbc8304d61764ef4c9f3456c94a63", "score": "0.5713515", "text": "func createKey(\n\tmeta *Metadata,\n\tmethod,\n\tprefix string,\n\tstringKey,\n\targ []byte,\n\tentryMeta StorageEntryMetadata,\n) (StorageKey, error) {\n\thasher, err := entryMeta.Hasher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif meta.Version <= 8 {\n\t\t_, err := hasher.Write(append(stringKey, arg...))\n\t\treturn hasher.Sum(nil), err\n\t}\n\n\treturn append(createPrefixedKey(method, prefix), arg...), nil\n}", "title": "" }, { "docid": "a8b6dd2db835f92c7ef85c3cdad2582f", "score": "0.5707803", "text": "func (this *BaseRateLimiter) GenerateCacheKeys(request *pb.RateLimitRequest,\n\tlimits []*config.RateLimit, hitsAddend uint32,\n\tipFilter filter.Filter,\n\tuidFilter filter.Filter,\n) []CacheKey {\n\tassert.Assert(len(request.Descriptors) == len(limits))\n\tcacheKeys := make([]CacheKey, len(request.Descriptors))\n\tnow := this.timeSource.UnixNow()\n\tfor i := 0; i < len(request.Descriptors); i++ {\n\t\t// generateCacheKey() returns an empty string in the key if there is no limit\n\t\t// so that we can keep the arrays all the same size.\n\t\tcacheKeys[i] = this.cacheKeyGenerator.GenerateCacheKey(request.Domain, request.Descriptors[i], limits[i], now, ipFilter, uidFilter)\n\t\t// Increase statistics for limits hit by their respective requests.\n\t\tif limits[i] != nil {\n\t\t\tlimits[i].Stats.TotalHits.Add(uint64(hitsAddend))\n\t\t}\n\t}\n\treturn cacheKeys\n}", "title": "" }, { "docid": "f8cdb095c9e1c3bab9d1e1e0e6722d9e", "score": "0.56933975", "text": "func GenerateKey(containerID string) string {\n\tmaxLen := 12\n\tif len(containerID) < maxLen {\n\t\tmaxLen = len(containerID)\n\t}\n\n\treturn prefix + \"/\" + containerID[:maxLen]\n}", "title": "" }, { "docid": "d2e86353728be0633a02e84b2dccf8e4", "score": "0.5692471", "text": "func (store *Store) getCacheKey(key string) string {\n\tbuffer := strings.Builder{}\n\tbuffer.WriteString(store.Prefix)\n\tbuffer.WriteString(\":\")\n\tbuffer.WriteString(key)\n\treturn buffer.String()\n}", "title": "" }, { "docid": "df794bf159dd8242add3d3631c9dcbae", "score": "0.56664723", "text": "func MD5RequestKey(c relax.Context) string {\n\th := md5.New()\n\thost, _ := SplitPort(c.Request.RemoteAddr)\n\th.Write([]byte(host))\n\th.Write([]byte(c.Request.UserAgent()))\n\treturn \"quota:\" + hex.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "26778b9af6808b57f372a4872ff1eefc", "score": "0.56585765", "text": "func cacheKey(u *iiif.URL) string {\n\tif tileCache != nil && u.Format == iiif.FmtJPG && u.Size.W > 0 && u.Size.W <= 1024 && u.Size.H <= 1024 {\n\t\treturn u.Path\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "268d4f654b57c0be5a65ba098fc39809", "score": "0.5650512", "text": "func generateKey(cID, taskID string) (string, error) {\n\tif stringutils.IsEmptyStr(cID) {\n\t\treturn \"\", errors.Wrapf(errortypes.ErrEmptyValue, \"cID\")\n\t}\n\n\tif stringutils.IsEmptyStr(taskID) {\n\t\treturn \"\", errors.Wrapf(errortypes.ErrEmptyValue, \"taskID\")\n\t}\n\n\treturn fmt.Sprintf(\"%s%s%s\", cID, keyJoinChar, taskID), nil\n}", "title": "" }, { "docid": "de32026a3a772e446e49bb986c7ab88b", "score": "0.56459326", "text": "func (k ResourceExpressionCacheKey) Key() string {\n\treturn k.signature\n}", "title": "" }, { "docid": "52c770c292bdd113772961a89ed93d7c", "score": "0.5628643", "text": "func GetCacheKey(k *datastore.Key) string {\n\treturn fmt.Sprintf(\"datastore.%s\", k.Encode())\n}", "title": "" }, { "docid": "44ddf3ba586209a7b8b670fc41612546", "score": "0.56083775", "text": "func createKeyMap(method, prefix string, args [][]byte, entryMeta StorageEntryMetadata) (StorageKey, error) {\n\thashers, err := entryMeta.Hashers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey := createPrefixedKey(method, prefix)\n\n\tfor i, arg := range args {\n\t\t_, err := hashers[i].Write(arg)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to hash args[%d]: %s Error: %v\", i, arg, err)\n\t\t}\n\t\tkey = append(key, hashers[i].Sum(nil)...)\n\t}\n\n\treturn key, nil\n}", "title": "" }, { "docid": "964bc47d5b85350bc4bb0c271fa41781", "score": "0.56023103", "text": "func formatKey(rdCache *redisCache) {\n\trdCache.key = fmt.Sprintf(\"%x-%x-\", md5.Sum([]byte(rdCache.route)), md5.Sum([]byte(rdCache.args)))\n\tfor _, val := range rdCache.awsAccount {\n\t\trdCache.key = fmt.Sprintf(\"%v%v-\", rdCache.key, val)\n\t}\n}", "title": "" }, { "docid": "8b1503a635047772e59378cbc3431d9a", "score": "0.5594253", "text": "func URLKey(r *http.Request) string {\n\tadminPrefix := \"admin!!\"\n\tkey := strings.TrimPrefix(r.URL.String(), adminPrefix) // prevents attach with fake url to get admin view\n\tif user, err := rest.GetUserInfo(r); err == nil && user.Admin {\n\t\tkey = adminPrefix + key // make separate cache key for admins\n\t}\n\treturn key\n}", "title": "" }, { "docid": "ef00a1c01d37519983d5523791ce2582", "score": "0.5585826", "text": "func RequestKey(r *http.Request) string {\n\treturn r.Header.Get(keyHeader) + keySep + r.URL.String()\n}", "title": "" }, { "docid": "9168250234cc2ce51a25914a91f5ef80", "score": "0.55816334", "text": "func HashGenerator(includeBody bool) Generator {\n\treturn func(w http.ResponseWriter, r *http.Request) string {\n\t\tw.Header().Set(xRequestIDHeaderKey, Hash(r, includeBody))\n\t\treturn DefaultGenerator(w, r)\n\t}\n}", "title": "" }, { "docid": "64fb595f264c42c4216e32029a2f0aea", "score": "0.5561177", "text": "func CreateKey(u string) string {\n\treturn urlEscape(PageCachePrefix, u)\n}", "title": "" }, { "docid": "6fb7b24fc49d3cd5aef90fdaf35e5880", "score": "0.55119044", "text": "func GenMcisKey(nsId string, mcisId string, vmId string) string {\n\n\tif vmId != \"\" {\n\t\treturn \"/ns/\" + nsId + \"/mcis/\" + mcisId + \"/vm/\" + vmId\n\t} else if mcisId != \"\" {\n\t\treturn \"/ns/\" + nsId + \"/mcis/\" + mcisId\n\t} else if nsId != \"\" {\n\t\treturn \"/ns/\" + nsId\n\t} else {\n\t\treturn \"\"\n\t}\n\n}", "title": "" }, { "docid": "d18ed1971993b261721c20cd3ba3859f", "score": "0.5510367", "text": "func KeyGen(q Question) string {\n\th := md5.New()\n\th.Write([]byte(q.String()))\n\tx := h.Sum(nil)\n\tkey := fmt.Sprintf(\"%x\", x)\n\treturn key\n}", "title": "" }, { "docid": "1b2132e0030d4f091fad2dd5163c8851", "score": "0.55017287", "text": "func ResourceCacheKey(filename string) string {\n\tfilename = filepath.ToSlash(filename)\n\treturn path.Join(resourceKeyPartition(filename), filename)\n}", "title": "" }, { "docid": "f395287a80b0caf6fda6408c8f863520", "score": "0.5489069", "text": "func (c *FakeContext) makeKey(key []byte) string {\n\treturn string(util.PrefixKey(c.address.Bytes(), key))\n}", "title": "" }, { "docid": "e63818b28222e13d8287fe197f8253c6", "score": "0.54747087", "text": "func keyFunc(name, namespace string) string {\n\tif len(namespace) == 0 {\n\t\treturn name\n\t}\n\treturn namespace + \"/\" + name\n}", "title": "" }, { "docid": "5dc82dfdca008f825038d09eff909f89", "score": "0.54561996", "text": "func (rc *ResponseCache) makeKey(cmdID proto.ClientCmdID) engine.Key {\n\t// Key specifics: range ID & HLC timestamp.\n\tb := append([]byte{}, engine.KeyLocalRangeResponseCachePrefix...)\n\tb = encoding.EncodeInt(b, rc.rangeID)\n\tb = encoding.EncodeInt(b, cmdID.WallTime) // wall time helps sort for locality\n\tb = encoding.EncodeInt(b, cmdID.Random) // TODO(spencer): encode as Fixed64\n\treturn b\n}", "title": "" }, { "docid": "8b13619ee1592227bbeee04438479be2", "score": "0.542101", "text": "func makeKey(pKey string, h abi.ChainEpoch) string {\n\treturn fmt.Sprintf(\"p-%s h-%d\", pKey, h)\n}", "title": "" }, { "docid": "3535b7f709861ed71d2ddedf665702c4", "score": "0.54095197", "text": "func GenStateKey(addr string, task string) string {\n\treturn addr + \"+\" + task\n}", "title": "" }, { "docid": "ad1e85fdb60afb2e09ab85c8a6b3c3ac", "score": "0.54091847", "text": "func createKey(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"starting creatKey server\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvar newUrl urlFormat\n\n\tfmt.Println(\"decoding newUrl\")\n\terr := json.NewDecoder(r.Body).Decode(&newUrl)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Println(`{\"Error\": \"400: Failed to encode json\"}`)\n\t\treturn\n\t}\n\t_, error := url.ParseRequestURI(newUrl.Url)\n\tif error != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, `{\"Error\": \"406: Not an Acceptable URL\"}`)\n\t\treturn\n\t}\n\n\t//implimented mutexes for no creation overlaps\n\tmutex.Lock()\n\n\tnewString := RandomString(8)\n\turlMap[newString] = newUrl.Url\n\n\tmutex.Unlock()\n\n\tw.WriteHeader(http.StatusCreated)\n\tfmt.Fprintf(w, `{\"short_url\": \"http://127.0.0.1:8080/%s\"}`, newString)\n\tlog.Println(urlMap)\n\treturn\n}", "title": "" }, { "docid": "c7e4116f563086345c790fcb15adf723", "score": "0.5401129", "text": "func keyOf() string {\n md := md5.New()\n\tio.WriteString(md, fmt.Sprintf(\"%u\", time.Nanoseconds()))\n\treturn fmt.Sprintf(\"%x\", string(md.Sum()))\n}", "title": "" }, { "docid": "a52f1bba42920c6b1cc9a9132a0dfdcb", "score": "0.5397164", "text": "func genKey(n int) string {\n\tif n == 0 {\n\t\treturn string(keyChar[0])\n\t}\n\n\tl := len(keyChar)\n\t// turn a decimal number n to a l-system number\n\t// max-length -> 20\n\ts := make([]byte, 20)\n\ti := len(s)\n\n\tfor n > 0 && i >= 0 {\n\t\ti--\n\t\ts[i] = keyChar[n%l]\n\t\tn = n / l\n\t}\n\treturn string(s[i:])\n}", "title": "" }, { "docid": "13a6edf47206ef4058c23a905d9d087e", "score": "0.5390507", "text": "func (cb *CacheBuster) generateHash(filepath string) (string, error) {\n\tfile, err := os.Open(strings.TrimPrefix(filepath, \"/\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\n\thash := md5.New()\n\t_, err = io.Copy(hash, file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"%x\", hash.Sum(nil)), nil\n}", "title": "" }, { "docid": "f644581fc0bc0c7e1eea2614255a3b53", "score": "0.53691775", "text": "func (c *Cache) Key(rl *ResourceLocator) (string, error) {\n\thost := strings.ToLower(rl.Host)\n\tif strings.HasPrefix(rl.Host, \"raw.\") {\n\t\tif rl.Host == \"raw.githubusercontent.com\" {\n\t\t\thost = \"github.com\"\n\t\t} else {\n\t\t\thost = rl.Host[len(\"raw.\"):]\n\t\t}\n\t} else if host == \"api.github.com\" {\n\t\thost = \"github.com\"\n\t}\n\n\tu, err := url.Parse(rl.Path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.ToLower(fmt.Sprintf(\"%s:%s:%s:%s:%s\", host, rl.Owner, rl.Repo, rl.SHAAlias, u.Path)), nil\n}", "title": "" }, { "docid": "498ef7b451b6faf30b56e72e60fc1428", "score": "0.5351177", "text": "func (c *objectCache) key(namespace, name string) string {\n\tif len(namespace) > 0 {\n\t\treturn namespace + \"/\" + name\n\t}\n\treturn name\n}", "title": "" }, { "docid": "f3245724712ba91c22c7f65ee781f885", "score": "0.53379625", "text": "func BuildKey(s string) map[string]string {\n\treturn map[string]string{\n\t\t\"sha512\": GenerateSHA512(s),\n\t\t//\"sha256\": GenerateSHA256(s), - holding off on supporting multiple hashing types for now\n\t}\n}", "title": "" }, { "docid": "2cfa835f3e4246c7cbb7917f97c24a83", "score": "0.5328653", "text": "func keygen(key string, length int) string {\n\n\tif(len(key) < length) {\n\t\tvar pad string\n\t\tfor j := 0; j < len(key) ; j++ {\n\t\t\tpad += string(key[j])\n\t\t}\n\t\t/*In a circular fashion, we add the contents\n\t\tof the key from front to the end, till the\n\t\tlength of the key becomes equal to the length\n\t\tof the plaintext.*/\n\t\tfor i := 0; i < (length - len(key)); i++ {\n\t\t\tpad += string(key[i % len(key)])\n\t\t}\n\t\treturn pad\n\t}\n\t// Return the final key to be used\n\treturn key\n}", "title": "" }, { "docid": "34689fe93a637e1786a9887523aa6c94", "score": "0.53231543", "text": "func makeKey(rlsname string, version int) string {\n\treturn fmt.Sprintf(\"%s.%s.v%d\", storage.HelmStorageType, rlsname, version)\n}", "title": "" }, { "docid": "62b2d9899be8d3dfb276ac1c3ea7286d", "score": "0.5306634", "text": "func GenResourceKey(nsId string, resourceType string, resourceId string) string {\n\n\tif resourceType == StrImage ||\n\t\tresourceType == StrCustomImage ||\n\t\tresourceType == StrSSHKey ||\n\t\tresourceType == StrSpec ||\n\t\tresourceType == StrVNet ||\n\t\tresourceType == StrSecurityGroup ||\n\t\tresourceType == StrDataDisk {\n\t\t//resourceType == \"subnet\" ||\n\t\t//resourceType == \"publicIp\" ||\n\t\t//resourceType == \"vNic\" {\n\t\treturn \"/ns/\" + nsId + \"/resources/\" + resourceType + \"/\" + resourceId\n\t} else {\n\t\treturn \"/invalidKey\"\n\t}\n}", "title": "" }, { "docid": "97ced302648aaf2da47d518d21d32693", "score": "0.52915674", "text": "func signingKey(t time.Time, secretKey, regionName, svcName string) []byte {\n\n\tkSecret := secretKey\n\tkDate := hmacHasher([]byte(\"AWS4\"+kSecret), t.Format(ISO8601BasicFormatShort))\n\tkRegion := hmacHasher(kDate, regionName)\n\tkService := hmacHasher(kRegion, svcName)\n\tkSigning := hmacHasher(kService, \"aws4_request\")\n\n\treturn kSigning\n}", "title": "" }, { "docid": "275c1b7eabed0c0981605cea3ef4d308", "score": "0.5286448", "text": "func keyFunc(fp fingerprint) func(\nunverified *jwt.Token) (interface{}, error) {\n\treturn func (unverified *jwt.Token) (interface{}, error) {\n\t\t// require token alg to match the set signing method, do not allow none\n\t\tif meth := unverified.Method; meth == nil || meth.Alg() != fp.method.Alg() {\n\t\t\treturn nil, jwt.ErrHashUnavailable\n\t\t}\n\t\treturn fp.key, nil\n\t}\n}", "title": "" }, { "docid": "84f571024d21c0be5fe37d025566b587", "score": "0.52742803", "text": "func (c *Calltable) MakeKey(i int) string {\n\tc.ID = *c.Caller + *c.Callee\n\treturn c.ID\n}", "title": "" }, { "docid": "a6f5c6b0445a76fcc5c866193da8ee58", "score": "0.52607614", "text": "func (this *Url) generateId() {\n\tcount, _ := redis.Incr(\"zurl:counter\")\n\tthis.Id = fmt.Sprintf(\"%x\", count)\n}", "title": "" }, { "docid": "30d0bc05eb0cda6ead2ec940560d37a9", "score": "0.5233877", "text": "func (s FileSystem) BuildKey(r Request) string {\n\tchecksum := r.Checksum\n\tfiletype := r.Types[0]\n\tfilename := strconv.Itoa(r.Resolution.Dx()) + \"x\" + strconv.Itoa(r.Resolution.Dy()) + \".\" + filetype\n\n\treturn filepath.Join(checksum[:2], checksum[2:4], checksum[4:], filename)\n}", "title": "" }, { "docid": "1b53b1860c11c92b5176a063b1496388", "score": "0.52334374", "text": "func GenerateNodeTunnelInterfaceKey(nodeName string) string {\n\treturn fmt.Sprintf(\"node/%s\", nodeName)\n}", "title": "" }, { "docid": "617b9efed61bf0e3f58f4f4890905a27", "score": "0.52312905", "text": "func (s *FileSystem) BuildKey(r Request) string {\n\tetag := r.ETag\n\tfiletype := r.Types[0]\n\tfilename := r.Resolution.String() + \".\" + filetype\n\n\treturn filepath.Join(etag[:2], etag[2:4], etag[4:], filename)\n}", "title": "" }, { "docid": "2fbe37b2d12d9d7cbc1fdc005167e767", "score": "0.52231413", "text": "func GenHash(key string) string {\n\thasher := md5.New()\n\thasher.Write([]byte(key))\n\treturn hex.EncodeToString(hasher.Sum(nil))\n}", "title": "" }, { "docid": "502098affa49d6df08cac66b2ff40bf2", "score": "0.52145565", "text": "func URLKeyWithUser(r *http.Request) string {\n\tadminPrefix := \"admin!!\"\n\tkey := strings.TrimPrefix(r.URL.String(), adminPrefix) // prevents attach with fake url to get admin view\n\tif user, err := rest.GetUserInfo(r); err == nil {\n\t\tif user.Admin {\n\t\t\tkey = adminPrefix + user.ID + \"!!\" + key // make separate cache key for admins\n\t\t} else {\n\t\t\tkey = user.ID + \"!!\" + key // make separate cache key for authed users\n\t\t}\n\t}\n\treturn key\n}", "title": "" }, { "docid": "bda355844ada755f95454ca71335fa52", "score": "0.52111244", "text": "func (kg KeyGenerator) GenerateKey() string {\n\trecord := kg.recordToHash()\n\th := sha256.New()\n\th.Write([]byte(record))\n\thashed := h.Sum(nil)\n\treturn hex.EncodeToString(hashed)\n}", "title": "" }, { "docid": "e8538cbe502e62150b272d5ece08c21c", "score": "0.52035105", "text": "func KeyGen(aspects ...dom.Aspect) dom.Aspect {\n\treturn dom.Element(\"keygen\", aspects...)\n}", "title": "" }, { "docid": "e7edeb2ec5bec664b226b0eb77e799e1", "score": "0.51601166", "text": "func (pkc *PublicKeyCache) Keyfunc(ctx context.Context) jwt.Keyfunc {\n\treturn func(token *jwt.Token) (interface{}, error) {\n\t\tif token == nil {\n\t\t\treturn nil, Error(\"invalid jwt; token is unset\")\n\t\t}\n\t\tkid, ok := token.Header[\"kid\"]\n\t\tif !ok {\n\t\t\treturn nil, Error(\"invalid jwt header; `kid` missing\")\n\t\t}\n\t\ttypedKid, ok := kid.(string)\n\t\tif !ok {\n\t\t\treturn nil, Error(\"invalid jwt header; `kid` not a string\")\n\t\t}\n\t\treturn pkc.Get(ctx, typedKid)\n\t}\n}", "title": "" }, { "docid": "6d6da81ec33c1ac57d59d1266e41f527", "score": "0.5152881", "text": "func generateKey(string str, string key) string {\n\tx := len(str)\n\ty := len(key)\n\n\tfor i := 0; ; i++ {\n\t\tif x == i {\n\t\t\ti := 0\n\t\t} else if x == y {\n\t\t\tbreak\n\t\t}\n\t\tkey = append(key, key[i])\n\t}\n\treturn key\n}", "title": "" }, { "docid": "5a1ff87b50782cbf3fac22bc6875ea3e", "score": "0.51406175", "text": "func GenKeypair(this js.Value, inputs []js.Value) (interface{}, error) {\n\tissuer, err := credentials.NewAttester(SysParams, inputs[0].Int(), int64(inputs[1].Int()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn map[string]interface{}{\n\t\t\"privateKey\": issuer.PrivateKey,\n\t\t\"publicKey\": issuer.PublicKey,\n\t}, nil\n}", "title": "" }, { "docid": "83e6d9a26be3d149fcedd79f51a75919", "score": "0.51354057", "text": "func idKey(prefix string, key *api.TaskID) string {\n\treturn prefix + key.Uuid\n}", "title": "" }, { "docid": "fef53bbbe027fd4382aba8fdbe7d3735", "score": "0.5135392", "text": "func HashKeygen() []byte {\n\tout := make([]byte, HashKeyBytes)\n\tC.hydro_hash_keygen((*C.uint8_t)(&out[0]))\n\treturn out\n}", "title": "" }, { "docid": "f193a6af4bfca19362a3402dc26dc827", "score": "0.512194", "text": "func buildKey(key string) string {\n\treturn storePrefix + key\n}", "title": "" }, { "docid": "a692d29cc577d7bf9f95c16be4fa6aac", "score": "0.51189226", "text": "func GenerateHash(username string) string {\n\treturn simplifyHash(usernameHash(username))\n}", "title": "" }, { "docid": "161414541cfb4180e2898d3ad5b34a4a", "score": "0.5108483", "text": "func createHash(key string) string {\r\n\thasher := md5.New()\r\n\thasher.Write([]byte(key))\r\n\treturn hex.EncodeToString(hasher.Sum(nil))\r\n}", "title": "" }, { "docid": "b04afd4b28c11d40deb2bf0dbbde3005", "score": "0.50994205", "text": "func createKey(host string, port int) string {\n\treturn host + \"_\" + strconv.Itoa(port)\n}", "title": "" }, { "docid": "8b6480b07cbd8eeaadc242e9677f291e", "score": "0.509372", "text": "func cacheGetHash(node nodeDefinition, data *sessionData) string {\n\n\t// find file in mirror\n\tinMirror, path := findTemplateInMirror(node, data)\n\n\tif inMirror {\n\t\treturn hashTemplate(path, data) // generate the hash for the local mirror file\n\t}\n\n\treturn ckmGetHash(node.NodeCID, data)\n\n}", "title": "" }, { "docid": "f223e1da0e4093a716c0125cda76f397", "score": "0.508239", "text": "func (r *LogstashRequest) CacheKey() string {\n\treturn r.Source.Source().(string)\n}", "title": "" }, { "docid": "0c3c04292b7c45d021d36d4e250fe16a", "score": "0.5080758", "text": "func reqStrKey(reqRef *requestpb.RequestRef) string {\n\treturn fmt.Sprintf(\"%d-%d.%v\", reqRef.ClientId, reqRef.ReqNo, reqRef.Digest)\n}", "title": "" }, { "docid": "0c3c04292b7c45d021d36d4e250fe16a", "score": "0.5080758", "text": "func reqStrKey(reqRef *requestpb.RequestRef) string {\n\treturn fmt.Sprintf(\"%d-%d.%v\", reqRef.ClientId, reqRef.ReqNo, reqRef.Digest)\n}", "title": "" }, { "docid": "0dbf42e6f7699fbba162ac6bbaf84794", "score": "0.5078103", "text": "func createHash(key string) string {\n\thasher := md5.New()\t\t\t\t//crypto/md5\n\thasher.Write([]byte(key))\t\t\t//os\n\treturn hex.EncodeToString(hasher.Sum(nil))\t//encoding/hex\n}", "title": "" }, { "docid": "3c83af202da49ec984176045ae276077", "score": "0.50732803", "text": "func MakeSnapshotKey(id DatasetID, prefix string) string {\n\tsnapshotStr := fmt.Sprintf(\"%s-%s\", id.pool, id.dataset)\n\tif prefix != \"\" {\n\t\tsnapshotStr = prefix + snapshotStr\n\t}\n\treturn fmt.Sprintf(\"%s/%s@%s\", id.pool, id.dataset, snapshotStr)\n}", "title": "" }, { "docid": "b3d4b67065286f8e1d89db7d9c7c2241", "score": "0.5071876", "text": "func (c *Catalog) routeKey(dbId, tId, gId uint64) []byte {\n\treturn codec.EncodeKey(cPrefix, defaultCatalogId, cRoutePrefix, dbId, tId, gId)\n}", "title": "" }, { "docid": "adcd47c21f93e961663077e7941adf89", "score": "0.5070293", "text": "func (rs *RadixStore) generateSessionKeyName(id string) string {\n\treturn rs.Options.KeyPrefix + id\n}", "title": "" }, { "docid": "c400e77930319d564572add5428eef6f", "score": "0.50616616", "text": "func hashKey(b []byte) string {\n\th := sha1.New() // #nosec G401 Used only to generate random value to be used to generate hash string\n\t_, err := h.Write(b)\n\n\tif err != nil {\n\t\tklog.Error(\"Failed to hash key with error:\", err)\n\t}\n\n\treturn string(h.Sum(nil))\n}", "title": "" }, { "docid": "c590c445c2b9902a47f153daefd0c1f8", "score": "0.50481737", "text": "func (route *Route) GetKey() string {\n\treturn \"id\"\n}", "title": "" }, { "docid": "b590ff1742f19ea7b84eb987abc38dd9", "score": "0.50474733", "text": "func builderKey(builder string) string {\n\tif len(builderMasterKey) == 0 {\n\t\treturn \"\"\n\t}\n\th := hmac.New(md5.New, builderMasterKey)\n\tio.WriteString(h, builder)\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "ed5e37ec2c9622e5ceff5835c8fdbd5a", "score": "0.5044753", "text": "func createHash(key string) string {\n hasher := md5.New()\n hasher.Write([]byte(key))\n return hex.EncodeToString(hasher.Sum(nil))\n}", "title": "" }, { "docid": "b0d5752a383913d4de1e29b8bd507a33", "score": "0.5027929", "text": "func (m *CommitAction) MakeKey(prefix string) string {\n\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", prefix, \"/\", \"buffers/\", m.Tenant, \"/\", m.Name)\n}", "title": "" }, { "docid": "f83885e21c07ee533069f0a261627f83", "score": "0.50247675", "text": "func createHash(key string) string {\n\thasher := md5.New()\n\thasher.Write([]byte(key))\n\treturn hex.EncodeToString(hasher.Sum(nil))\n}", "title": "" }, { "docid": "fd25fd9224a1d12cd9d0f3acb896d818", "score": "0.5022932", "text": "func GenTimeKey() []byte {\n\tt := time.Now().UnixNano()\n\th := md5.New()\n\tbinary.Write(h, binary.LittleEndian, t)\n\treturn h.Sum(nil)\n}", "title": "" }, { "docid": "d3cc6ed412a6697b9b1bb82516860490", "score": "0.5021073", "text": "func (m *Buffer) MakeKey(prefix string) string {\n\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", prefix, \"/\", \"buffers/\", m.Tenant, \"/\", m.Name)\n}", "title": "" }, { "docid": "1713fc20d065108105e186dbc0821d48", "score": "0.50201064", "text": "func GenerateKey(request *specs.CertificateKeyRequest) (specs.Key, error) {\n\tif err := request.Algorithm.ValidKeySize(request.Size); err != nil {\n\t\treturn nil, err\n\t}\n\tswitch request.Algorithm {\n\tcase specs.ECDSAKey:\n\t\treturn generateECDSAKey(request.Size)\n\tcase specs.RSAKey:\n\t\treturn generateRSAKey(request.Size)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported key algorithm %s\", request.Algorithm)\n\t}\n}", "title": "" }, { "docid": "739cb7b3636d9023b09d46ef3c39297d", "score": "0.50158525", "text": "func KeyGen(public, secret *Key) {\n\tvar P fourq.Point\n\tP.ScalarBaseMult((*[Size]byte)(secret))\n\tP.Marshal((*[Size]byte)(public))\n}", "title": "" }, { "docid": "e58952150c1e91e296a03dfc88ddd983", "score": "0.50077325", "text": "func (r Request) Key() []byte {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(r.Method + \" \")\n\tbuf.WriteString(r.URL + \"?\" + r.Form.Encode())\n\tfor _, c := range r.Cookies {\n\t\tbuf.WriteString(fmt.Sprintf(\"+cookie=%s\", c.String()))\n\t}\n\tif r.Referrer != \"\" {\n\t\tbuf.WriteString(fmt.Sprintf(\"+ref=%s\", r.Referrer))\n\t}\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "7f383ebe5fa1d32f68af939dc5a826fc", "score": "0.50065035", "text": "func genhash(t *types.Type) *obj.LSym {\n\tswitch algtype(t) {\n\tdefault:\n\t\t// genhash is only called for types that have equality\n\t\tFatalf(\"genhash %v\", t)\n\tcase AMEM0:\n\t\treturn sysClosure(\"memhash0\")\n\tcase AMEM8:\n\t\treturn sysClosure(\"memhash8\")\n\tcase AMEM16:\n\t\treturn sysClosure(\"memhash16\")\n\tcase AMEM32:\n\t\treturn sysClosure(\"memhash32\")\n\tcase AMEM64:\n\t\treturn sysClosure(\"memhash64\")\n\tcase AMEM128:\n\t\treturn sysClosure(\"memhash128\")\n\tcase ASTRING:\n\t\treturn sysClosure(\"strhash\")\n\tcase AINTER:\n\t\treturn sysClosure(\"interhash\")\n\tcase ANILINTER:\n\t\treturn sysClosure(\"nilinterhash\")\n\tcase AFLOAT32:\n\t\treturn sysClosure(\"f32hash\")\n\tcase AFLOAT64:\n\t\treturn sysClosure(\"f64hash\")\n\tcase ACPLX64:\n\t\treturn sysClosure(\"c64hash\")\n\tcase ACPLX128:\n\t\treturn sysClosure(\"c128hash\")\n\tcase AMEM:\n\t\t// For other sizes of plain memory, we build a closure\n\t\t// that calls memhash_varlen. The size of the memory is\n\t\t// encoded in the first slot of the closure.\n\t\tclosure := typeLookup(fmt.Sprintf(\".hashfunc%d\", t.Width)).Linksym()\n\t\tif len(closure.P) > 0 { // already generated\n\t\t\treturn closure\n\t\t}\n\t\tif memhashvarlen == nil {\n\t\t\tmemhashvarlen = sysfunc(\"memhash_varlen\")\n\t\t}\n\t\tot := 0\n\t\tot = dsymptr(closure, ot, memhashvarlen, 0)\n\t\tot = duintptr(closure, ot, uint64(t.Width)) // size encoded in closure\n\t\tggloblsym(closure, int32(ot), obj.DUPOK|obj.RODATA)\n\t\treturn closure\n\tcase ASPECIAL:\n\t\tbreak\n\t}\n\n\tclosure := typesymprefix(\".hashfunc\", t).Linksym()\n\tif len(closure.P) > 0 { // already generated\n\t\treturn closure\n\t}\n\n\t// Generate hash functions for subtypes.\n\t// There are cases where we might not use these hashes,\n\t// but in that case they will get dead-code eliminated.\n\t// (And the closure generated by genhash will also get\n\t// dead-code eliminated, as we call the subtype hashers\n\t// directly.)\n\tswitch t.Etype {\n\tcase types.TARRAY:\n\t\tgenhash(t.Elem())\n\tcase types.TSTRUCT:\n\t\tfor _, f := range t.FieldSlice() {\n\t\t\tgenhash(f.Type)\n\t\t}\n\t}\n\n\tsym := typesymprefix(\".hash\", t)\n\tif Debug['r'] != 0 {\n\t\tfmt.Printf(\"genhash %v %v %v\\n\", closure, sym, t)\n\t}\n\n\tlineno = autogeneratedPos // less confusing than end of input\n\tdclcontext = PEXTERN\n\n\t// func sym(p *T, h uintptr) uintptr\n\ttfn := nod(OTFUNC, nil, nil)\n\ttfn.List.Set2(\n\t\tnamedfield(\"p\", types.NewPtr(t)),\n\t\tnamedfield(\"h\", types.Types[TUINTPTR]),\n\t)\n\ttfn.Rlist.Set1(anonfield(types.Types[TUINTPTR]))\n\n\tfn := dclfunc(sym, tfn)\n\tnp := asNode(tfn.Type.Params().Field(0).Nname)\n\tnh := asNode(tfn.Type.Params().Field(1).Nname)\n\n\tswitch t.Etype {\n\tcase types.TARRAY:\n\t\t// An array of pure memory would be handled by the\n\t\t// standard algorithm, so the element type must not be\n\t\t// pure memory.\n\t\thashel := hashfor(t.Elem())\n\n\t\tn := nod(ORANGE, nil, nod(ODEREF, np, nil))\n\t\tni := newname(lookup(\"i\"))\n\t\tni.Type = types.Types[TINT]\n\t\tn.List.Set1(ni)\n\t\tn.SetColas(true)\n\t\tcolasdefn(n.List.Slice(), n)\n\t\tni = n.List.First()\n\n\t\t// h = hashel(&p[i], h)\n\t\tcall := nod(OCALL, hashel, nil)\n\n\t\tnx := nod(OINDEX, np, ni)\n\t\tnx.SetBounded(true)\n\t\tna := nod(OADDR, nx, nil)\n\t\tcall.List.Append(na)\n\t\tcall.List.Append(nh)\n\t\tn.Nbody.Append(nod(OAS, nh, call))\n\n\t\tfn.Nbody.Append(n)\n\n\tcase types.TSTRUCT:\n\t\t// Walk the struct using memhash for runs of AMEM\n\t\t// and calling specific hash functions for the others.\n\t\tfor i, fields := 0, t.FieldSlice(); i < len(fields); {\n\t\t\tf := fields[i]\n\n\t\t\t// Skip blank fields.\n\t\t\tif f.Sym.IsBlank() {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Hash non-memory fields with appropriate hash function.\n\t\t\tif !IsRegularMemory(f.Type) {\n\t\t\t\thashel := hashfor(f.Type)\n\t\t\t\tcall := nod(OCALL, hashel, nil)\n\t\t\t\tnx := nodSym(OXDOT, np, f.Sym) // TODO: fields from other packages?\n\t\t\t\tna := nod(OADDR, nx, nil)\n\t\t\t\tcall.List.Append(na)\n\t\t\t\tcall.List.Append(nh)\n\t\t\t\tfn.Nbody.Append(nod(OAS, nh, call))\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Otherwise, hash a maximal length run of raw memory.\n\t\t\tsize, next := memrun(t, i)\n\n\t\t\t// h = hashel(&p.first, size, h)\n\t\t\thashel := hashmem(f.Type)\n\t\t\tcall := nod(OCALL, hashel, nil)\n\t\t\tnx := nodSym(OXDOT, np, f.Sym) // TODO: fields from other packages?\n\t\t\tna := nod(OADDR, nx, nil)\n\t\t\tcall.List.Append(na)\n\t\t\tcall.List.Append(nh)\n\t\t\tcall.List.Append(nodintconst(size))\n\t\t\tfn.Nbody.Append(nod(OAS, nh, call))\n\n\t\t\ti = next\n\t\t}\n\t}\n\n\tr := nod(ORETURN, nil, nil)\n\tr.List.Append(nh)\n\tfn.Nbody.Append(r)\n\n\tif Debug['r'] != 0 {\n\t\tdumplist(\"genhash body\", fn.Nbody)\n\t}\n\n\tfuncbody()\n\n\tfn.Func.SetDupok(true)\n\tfn = typecheck(fn, ctxStmt)\n\n\tCurfn = fn\n\ttypecheckslice(fn.Nbody.Slice(), ctxStmt)\n\tCurfn = nil\n\n\tif debug_dclstack != 0 {\n\t\ttestdclstack()\n\t}\n\n\tfn.Func.SetNilCheckDisabled(true)\n\tfunccompile(fn)\n\n\t// Build closure. It doesn't close over any variables, so\n\t// it contains just the function pointer.\n\tdsymptr(closure, 0, sym.Linksym(), 0)\n\tggloblsym(closure, int32(Widthptr), obj.DUPOK|obj.RODATA)\n\n\treturn closure\n}", "title": "" }, { "docid": "4c0306f736334301032b9480bc5eeaa5", "score": "0.5004255", "text": "func computeIndexID(req *SendRequest) (string, error) {\n\tvar b bytes.Buffer\n\n\t// Serialze the request\n\tif err := req.Request.Write(&b); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to serialize request: %v\", err)\n\t}\n\n\t// Reset the request body after it has been closed by Write\n\treq.Request.Body = ioutil.NopCloser(bytes.NewReader(req.RequestBody))\n\n\t// Append req.Token into the byte slice. This is needed since auto-auth'ed\n\t// requests sets the token directly into SendRequest.Token\n\tb.Write([]byte(req.Token))\n\n\treturn hex.EncodeToString(cryptoutil.Blake2b256Hash(string(b.Bytes()))), nil\n}", "title": "" }, { "docid": "fb8b7a800af1cd016e4ea1296f3ee816", "score": "0.49983287", "text": "func (s *StakeAddress) KeyGen(\n\tverificationKeyFileName string,\n\tsigningKeyFileName string,\n) {\n\t_, err := exec.Command(\n\t\t\"cardano-cli\", \"stake-address\", \"key-gen\",\n\t\t\"--verification-key-file\", verificationKeyFileName,\n\t\t\"--signing-key-file\", signingKeyFileName,\n\t).Output()\n\tif err != nil {\n\t\tlog.Printf(\"error: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "910cdc5bc9cfba96121a7eaa5535d439", "score": "0.4996631", "text": "func GenerateS3KeyName(keypfx string, repo string, commitsha string) string {\n\treturn fmt.Sprintf(\"%v%v/%v.tar.gz\", keypfx, repo, commitsha)\n}", "title": "" }, { "docid": "29fba27a1b8a04b43ca67af02787924b", "score": "0.4987885", "text": "func GenKey() Key {\n\treturn Key{uuid.NewUUID().String()}\n}", "title": "" }, { "docid": "c5a75f3deae7453624435d49afdaac5d", "score": "0.4987475", "text": "func genFilename(uri string) string {\n\treturn hash([]byte(uri)) + \".png\"\n}", "title": "" }, { "docid": "a2a39753b64ae528dbb541479c87e3fc", "score": "0.49823928", "text": "func (m *Manager) generate() (string, error) {\n\tkey := make([]byte, m.keySize)\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn base64.StdEncoding.EncodeToString(key), nil\n}", "title": "" }, { "docid": "b19379a8ec0a0c25e500da70ac9c9149", "score": "0.49747384", "text": "func (s *Store) makeKey(prefix []byte, id string) (key []byte) {\n\tbuf := []byte(id)\n\tkey = make([]byte, 0, len(prefix)+len(buf))\n\tkey = append(key, prefix...)\n\tkey = append(key, buf...)\n\treturn key\n}", "title": "" }, { "docid": "4289b040a9a1bb779423545e5b0f5bc6", "score": "0.4965054", "text": "func GenKey(c ctl.Control, p interface{}) error {\n\tflags := ensureGenKeyFlags(p.(*GenKeyFlags))\n\n\tcryptoprov := c.(*cli.Cli).CryptoProv()\n\n\tif !*flags.Force && *flags.Output != \"\" && fileutil.FileExists(*flags.Output) == nil {\n\t\treturn errors.Errorf(\"%q file exists, specify --force flag to override\", *flags.Output)\n\t}\n\n\tcrypto := cryptoprov.Default()\n\tcsr := csrprov.New(cryptoprov.Default())\n\n\tpurpose := csrprov.Signing\n\tswitch *flags.Purpose {\n\tcase \"s\", \"sign\", \"signing\":\n\t\tpurpose = csrprov.Signing\n\tcase \"e\", \"encrypt\", \"encryption\":\n\t\tpurpose = csrprov.Encryption\n\tdefault:\n\t\treturn errors.Errorf(\"unsupported purpose: %q\", *flags.Purpose)\n\t}\n\n\treq := csr.NewKeyRequest(prefixKeyLabel(*flags.Label), *flags.Algo, *flags.Size, purpose)\n\tprv, err := req.Generate()\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tkeyID, _, err := crypto.IdentifyKey(prv)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\turi, key, err := crypto.ExportKey(keyID)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif key == nil {\n\t\tkey = []byte(uri)\n\t}\n\n\tif *flags.Output == \"\" {\n\t\tcfsslcli.PrintCert(key, nil, nil)\n\t} else {\n\t\terr = cli.WriteFile(*flags.Output, key, 0600)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "23a5eecb38976ebd97949858fdabf317", "score": "0.49637198", "text": "func name2key(name string) string {\n\th := md5.New()\n\tio.WriteString(h, name)\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "67725546b325b994625008be807d1eb6", "score": "0.4962131", "text": "func generateNewDataKey(url string) ([]byte, error) {\n\tplaintextDataKey := make([]byte, 32)\n\t_, err := rand.Read(plaintextDataKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkeeper, err := openKeeper(context.Background(), url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn keeper.Encrypt(context.Background(), plaintextDataKey)\n}", "title": "" }, { "docid": "90ddb8da6120d35b252fd05212cd78f6", "score": "0.49587214", "text": "func key(fileID string) string {\n\treturn toPDFPrefix + fileID\n}", "title": "" } ]
677d18ff6950217a200a451b2defed02
UnmarshalJSON sets the object from the provided JSON representation
[ { "docid": "5646cadfddfbec2976ec62c75662ba75", "score": "0.0", "text": "func (l *AppFlowConnectorProfileAmplitudeConnectorProfileCredentialsList) UnmarshalJSON(buf []byte) error {\n\t// Cloudformation allows a single object when a list of objects is expected\n\titem := AppFlowConnectorProfileAmplitudeConnectorProfileCredentials{}\n\tif err := json.Unmarshal(buf, &item); err == nil {\n\t\t*l = AppFlowConnectorProfileAmplitudeConnectorProfileCredentialsList{item}\n\t\treturn nil\n\t}\n\tlist := []AppFlowConnectorProfileAmplitudeConnectorProfileCredentials{}\n\terr := json.Unmarshal(buf, &list)\n\tif err == nil {\n\t\t*l = AppFlowConnectorProfileAmplitudeConnectorProfileCredentialsList(list)\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" } ]
[ { "docid": "c3f12e68083c78344146463225c26a1e", "score": "0.6966297", "text": "func (j *JSON) UnmarshalJSON(b []byte) error {\n\tresult := json.RawMessage{}\n\terr := result.UnmarshalJSON(b)\n\t*j = JSON(result)\n\treturn err\n}", "title": "" }, { "docid": "d303b1521582b051e8f214d5d6bfd4b4", "score": "0.65437204", "text": "func (container *Container) UnmarshalJSON(data []byte) error {\n\tvar input map[string]interface{}\n\terr := json.Unmarshal(data, &input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif input[\"productName\"] != nil {\n\t\treturn errors.New(\"Not a Container\")\n\t}\n\n\t// Prevent circular reference\n\ttype Alias Container\n\tvar output Alias\n\terr = json.Unmarshal(data, &output)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc := Container(output)\n\t*container = c\n\n\treturn nil\n}", "title": "" }, { "docid": "11b96df63d57a4e30cd69442d1e197ab", "score": "0.6490958", "text": "func (c *JSONValue) UnmarshalJSON(b []byte) error {\n\tresult := json.RawMessage{}\n\terr := result.UnmarshalJSON(b)\n\t*c = JSONValue(result)\n\treturn err\n}", "title": "" }, { "docid": "504c5c77db5921e46b977bd06cb7f339", "score": "0.6484501", "text": "func (m *JsonHelperScannable) UnmarshalJSON(data []byte) error {\n\tif m == nil {\n\t\treturn errors.New(\"JsonHelperScannable must not be nil\")\n\t}\n\tjh := make(u.JsonHelper)\n\tif err := json.Unmarshal(data, &jh); err != nil {\n\t\treturn err\n\t}\n\t*m = JsonHelperScannable(jh)\n\treturn nil\n}", "title": "" }, { "docid": "64a1bda4c551b5b349f87ee33a3a1ab1", "score": "0.64732075", "text": "func (s *Sub) UnmarshalJSON(data []byte) error {\n\ttype sub Sub\n\tvar ss sub\n\terr := json.Unmarshal(data, &ss)\n\tif err == nil {\n\t\t*s = Sub(ss)\n\t} else {\n\t\t// the id is surrounded by \"\\\" characters, so strip them\n\t\ts.ID = string(data[1 : len(data)-1])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db7a6d6cbbf229da18c5723838e70dc9", "score": "0.64678234", "text": "func (t *Transfer) UnmarshalJSON(data []byte) error {\n\tif id, ok := ParseID(data); ok {\n\t\tt.ID = id\n\t\treturn nil\n\t}\n\n\ttype transfer Transfer\n\tvar v transfer\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\t*t = Transfer(v)\n\treturn nil\n}", "title": "" }, { "docid": "ee194e7eb54b1689fde5daf2c511d54a", "score": "0.64430845", "text": "func (t *TomatesJSONGen) UnmarshalJSON(b []byte) error {\n\tvar embed *TomatesGen\n\tif err := json.Unmarshal(b, &embed); err != nil {\n\t\treturn err\n\t}\n\tt.embed = embed\n\treturn nil\n}", "title": "" }, { "docid": "d44b0f940d2744a0a78f90c1abf4596a", "score": "0.64239526", "text": "func (v *object) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonE453ad8fDecodeGithubComFpapadopouGoEncodingBenchmarkEncoding(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "db980174b542c99dae6f985c281c3f21", "score": "0.6423323", "text": "func (j *Json) UnmarshalJSON(p []byte) error {\n\tj.l.Lock()\n\tdefer j.l.Unlock()\n\treturn j.sj.UnmarshalJSON(p)\n}", "title": "" }, { "docid": "71b6436d519fa8cb534c62c9af26d40a", "score": "0.6397721", "text": "func (j *Bid) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "c1734e54e523e5e9522a80ecfd4f5591", "score": "0.6374967", "text": "func (v *NewsSet) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson315f7a6DecodeGithubComGoParkMailRu20201GitBreakersInternalPkgModels5(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a6385353b98ef63f0c64faf3d4eab026", "score": "0.6346431", "text": "func (t *Test) UnmarshalJSON(b []byte) error {\n\ttemp := &TestJSON{}\n\n\tif err := json.Unmarshal(b, &temp); err != nil {\n\t\treturn err\n\t}\n\n\tt.fieldA = temp.FieldA\n\tt.FieldB = temp.FieldB\n\tt.FieldC = temp.FieldC\n\n\treturn nil\n}", "title": "" }, { "docid": "6918e4e8e6adea2e73ae03155509ec50", "score": "0.6343264", "text": "func UnmarshalJSON(jsonData []byte, v interface{}) error {\n\tparsedData := quotedBigIntRegex.ReplaceAll(jsonData, []byte(`$1`))\n\terr := json.Unmarshal(parsedData, v)\n\tif err != nil {\n\t\tglog.Errorf(\"Could not unmarshal the data: %s\\n\", err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "c265f5365f0d300b44e473cb48e4b795", "score": "0.6306596", "text": "func (t *Transfer) UnmarshalJSON(data []byte) error {\n\ttype transfer Transfer\n\tvar tb transfer\n\terr := json.Unmarshal(data, &tb)\n\tif err == nil {\n\t\t*t = Transfer(tb)\n\t} else {\n\t\t// the id is surrounded by \"\\\" characters, so strip them\n\t\tt.ID = string(data[1 : len(data)-1])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a02eeb44d1658990a6345124019227b2", "score": "0.6306201", "text": "func (e *Entity) UnmarshalJSON(data []byte) error {\n\tvar tmpEntity map[string]interface{}\n\n\tif err := json.Unmarshal(data, &tmpEntity); err != nil {\n\t\treturn err\n\t}\n\tent := processUnmarshaledEntity(&tmpEntity)\n\t(*e).Clone(ent)\n\treturn nil\n}", "title": "" }, { "docid": "f07cd3187f0ed7356ee6d6fa66a9bd26", "score": "0.6302341", "text": "func (i *Item) UnmarshalJSON(b []byte) error {\n\tif err := json.Unmarshal(b, i); err != nil {\n\t\treturn err\n\t}\n\ti.Cooldown *= time.Second\n\treturn nil\n}", "title": "" }, { "docid": "b596dec5466865f5e0f966788a24c275", "score": "0.62930113", "text": "func (j *NewsModel) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "a8bbc7f7820c221f5d9509d0e8974f34", "score": "0.6287793", "text": "func (c *Metadata) UnmarshalJSON(data []byte) error {\n\tversioned := &versionedMetadata{}\n\tif err := json.Unmarshal(data, versioned); err != nil {\n\t\treturn err\n\t}\n\t// Handle old version after upgrade.\n\tswitch versioned.Version {\n\tcase metadataVersion:\n\t\t*c = Metadata(versioned.Metadata)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unsupported version: %q\", versioned.Version)\n}", "title": "" }, { "docid": "0f4fc93db9473f6e941ca55f8c6932e7", "score": "0.62852854", "text": "func (v *UserSet) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson9e1087fdDecodeGithubComGoParkMailRu20201GitBreakersInternalPkgModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f1fce059f9975ec946d2f2ca12cd511f", "score": "0.62826777", "text": "func (tag *Tag) UnmarshalJSON(b []byte) (err error) {\n\tvar s string\n\tif err = json.Unmarshal(b, &s); err == nil {\n\t\t*tag = Tag(s)\n\t} else {\n\t\tvar n json.RawMessage\n\t\tif err = json.Unmarshal(b, &n); err == nil {\n\t\t\t*tag = Tag(n)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c40245912bfb52d3d50d40fd3b19cbdc", "score": "0.6278362", "text": "func (a *Amount) UnmarshalJSON(data []byte) error {\n\tvar s string\n\terr := json.Unmarshal(data, &s)\n\tif err != nil {\n\t\treturn errAmountNotValid(err, string(data))\n\t}\n\ta2, err := Parse(s)\n\tif err != nil {\n\t\treturn errAmountNotValid(err, s)\n\t}\n\t*a = a2\n\n\treturn nil\n}", "title": "" }, { "docid": "3cc70ce02fa803dd9400a44f19dacac4", "score": "0.62770456", "text": "func (r *SetResponse) UnmarshalJSON(data []byte) error {\n\ttype response SetResponse\n\treturn unmarshalKernelResponse(data, (*response)(r))\n}", "title": "" }, { "docid": "127c5f50606e942b4ff0e961a1402697", "score": "0.6265898", "text": "func (v *DistributionPointsContentEncoding) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = DistributionPointsContentEncoding(value)\n\treturn nil\n}", "title": "" }, { "docid": "8ba9bbfaa7c696c957e3f23ca9be5041", "score": "0.62641263", "text": "func (as *Asset) UnmarshalJSON(data []byte) error {\n\ttype alias Asset\n\ttmp := alias(Asset{\n\t\tVersion: \"2.0\",\n\t})\n\terr := json.Unmarshal(data, &tmp)\n\tif err == nil {\n\t\t*as = Asset(tmp)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7f4d098488852d39e99a61b38f82ec9a", "score": "0.62618506", "text": "func (obj *StandalonePriceValidFromSetMessage) UnmarshalJSON(data []byte) error {\n\ttype Alias StandalonePriceValidFromSetMessage\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tif obj.Resource != nil {\n\t\tvar err error\n\t\tobj.Resource, err = mapDiscriminatorReference(obj.Resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ddf72692d0d17f3f611115364ec42574", "score": "0.6261006", "text": "func (encoding *Encoding) UnmarshalJSON(data []byte) error {\n\ttype EncodingBis Encoding\n\tvar x EncodingBis\n\tif err := json.Unmarshal(data, &x); err != nil {\n\t\treturn err\n\t}\n\t_ = json.Unmarshal(data, &x.Extensions)\n\tdelete(x.Extensions, \"contentType\")\n\tdelete(x.Extensions, \"headers\")\n\tdelete(x.Extensions, \"style\")\n\tdelete(x.Extensions, \"explode\")\n\tdelete(x.Extensions, \"allowReserved\")\n\t*encoding = Encoding(x)\n\treturn nil\n}", "title": "" }, { "docid": "45d4d48c1aa7c679c6d63f2382d4185b", "score": "0.6257992", "text": "func (obj *StandalonePriceTiersSetMessage) UnmarshalJSON(data []byte) error {\n\ttype Alias StandalonePriceTiersSetMessage\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tif obj.Resource != nil {\n\t\tvar err error\n\t\tobj.Resource, err = mapDiscriminatorReference(obj.Resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "92713308bfc8b1e4b2d69c2f5ce622cf", "score": "0.62402636", "text": "func (obj *StagedQuoteValidToSetMessage) UnmarshalJSON(data []byte) error {\n\ttype Alias StagedQuoteValidToSetMessage\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tif obj.Resource != nil {\n\t\tvar err error\n\t\tobj.Resource, err = mapDiscriminatorReference(obj.Resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0fd17173ef3f8cd6e3184274731dc992", "score": "0.62367374", "text": "func (s *Stack) UnmarshalJSON(b []byte) error {\n\tvar sr stack\n\terr := json.Unmarshal(b, &sr)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.imports(&sr)\n\treturn nil\n}", "title": "" }, { "docid": "99852d74a8adf9113ffd16ede3c96fbe", "score": "0.62297267", "text": "func (t *Topup) UnmarshalJSON(data []byte) error {\n\tif id, ok := ParseID(data); ok {\n\t\tt.ID = id\n\t\treturn nil\n\t}\n\n\ttype topup Topup\n\tvar v topup\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\t*t = Topup(v)\n\treturn nil\n}", "title": "" }, { "docid": "c8cee4e25877fa711b2f74c7a7b156ed", "score": "0.6225696", "text": "func (a *Amount) UnmarshalJSON(j []byte) error {\n\ts := string(j)\n\n\tif s == `null` || s == `\"\"` {\n\t\t*a = 0\n\t\treturn nil\n\t}\n\n\t// Strip quotes\n\tif l := len(s); l > 2 && s[0] == '\"' && s[l-1] == '\"' {\n\t\ts = s[1 : l-1]\n\t}\n\n\tamount, err := ParseAmount(s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't unmarshal JSON(%s) as money.Amount because of: %w\", j, err)\n\t}\n\n\t*a = amount\n\treturn nil\n}", "title": "" }, { "docid": "7ebd1d6af1afbba3aac65052f470309e", "score": "0.62093353", "text": "func (pTypeDef *Test) UnmarshalJSON(b []byte) error {\n\tvar r rawTest\n\terr := json.Unmarshal(b, &r)\n\tif err == nil {\n\t\to := Test(r)\n\t\t*pTypeDef = *((&o).Init())\n\t\terr = pTypeDef.Validate()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f1fdcf993e6b6358858b1a4ec2ecbbfd", "score": "0.6208585", "text": "func (i *LockStatuses) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"LockStatuses should be a string, got %s\", data)\n\t}\n\n\tvar err error\n\t*i, err = LockStatusesString(s)\n\treturn err\n}", "title": "" }, { "docid": "3f0ddddf7f7a537c8d5860156a004394", "score": "0.6205585", "text": "func (c *Claims) UnmarshalJSON(b []byte) error {\n\tif b == nil {\n\t\treturn nil\n\t}\n\n\tb, err := jose.DecodeEscaped(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Since json.Unmarshal calls UnmarshalJSON,\n\t// calling json.Unmarshal on *p would be infinitely recursive\n\t// A temp variable is needed because &map[string]interface{}(*p) is\n\t// invalid Go. (Address of unaddressable object and all that...)\n\n\ttmp := map[string]interface{}(*c)\n\tif err = json.Unmarshal(b, &tmp); err != nil {\n\t\treturn err\n\t}\n\t*c = Claims(tmp)\n\treturn nil\n}", "title": "" }, { "docid": "cbe715a47d087565a60564075495be52", "score": "0.62041986", "text": "func (j *Json) UnmarshalJSON(p []byte) error {\n\tdec := json.NewDecoder(bytes.NewBuffer(p))\n\tdec.UseNumber()\n\treturn dec.Decode(&j.data)\n}", "title": "" }, { "docid": "c81a0c4e5e16b673471dd0d3560e09e7", "score": "0.61999416", "text": "func (b *B) UnmarshalJSON(data []byte) error {\n\tv := []byte{}\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\t*b = v\n\treturn nil\n}", "title": "" }, { "docid": "07d98dd8a1c718f24cc224a73b05fa7c", "score": "0.61927974", "text": "func FromJSON(t *testing.T, data []byte, thing any) {\n\tt.Helper()\n\terr := json.Unmarshal(data, thing)\n\tassert.NilError(t, err)\n}", "title": "" }, { "docid": "092c4fb7ee2d308c100a17ad56f1d3f6", "score": "0.6191525", "text": "func (i *ID) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\tif s == \"\" || s == \"null\" {\n\t\treturn nil\n\t}\n\tvar n json.Number\n\tif err := json.Unmarshal(b, &n); err != nil {\n\t\treturn err\n\t}\n\tid, err := n.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\t*i = ID(id)\n\treturn nil\n}", "title": "" }, { "docid": "21851e51ec98d50b9f3bed40fb2abccb", "score": "0.61900026", "text": "func (v *User_obj) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson54c8071dDecodeGotestJsondataUser(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a432590bfd28a969d9505299eaffc08f", "score": "0.61858654", "text": "func (v *ObjectMeta) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonB82328ecDecodeGitBetfavoritCfVadimTsurkovKuberwebKubDomain2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5044b5b3d039b26c4eaf36ea735c781f", "score": "0.61851233", "text": "func (v *Post) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeSubdModels8(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3b26fc072cda8e79ce04bbaa700f60bc", "score": "0.6178362", "text": "func (v *ArticleInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeGeekband25(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "36af6d79dd4942b5c038f6f818665473", "score": "0.61709136", "text": "func (s *Sampler) UnmarshalJSON(data []byte) error {\n\ttype alias Sampler\n\ttmp := alias(*NewSampler())\n\terr := json.Unmarshal(data, &tmp)\n\tif err == nil {\n\t\t*s = Sampler(tmp)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8d83fb6d4ffefaf16dda12e63fae5ce7", "score": "0.6168669", "text": "func (m *PostTransactionOKBodyAllOf1Data) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 ResponseObject\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\tm.ResponseObject = aO0\n\n\treturn nil\n}", "title": "" }, { "docid": "d6ba14847d3ec5d0268793a9f3cc781b", "score": "0.6167149", "text": "func (i *ID) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\treturn i.Parse(s)\n}", "title": "" }, { "docid": "45b3e81142a777ddca9f7295516cc615", "score": "0.6166845", "text": "func (a *Accessor) UnmarshalJSON(data []byte) error {\n\ttype alias Accessor\n\ttmp := alias(*NewAccessor())\n\terr := json.Unmarshal(data, &tmp)\n\tif err == nil {\n\t\t*a = Accessor(tmp)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "054adb95420ec85c3278e2417add6555", "score": "0.61553067", "text": "func (v *embedded) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonE453ad8fDecodeGithubComFpapadopouGoEncodingBenchmarkEncoding1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3767eb5fa3be79f031e0072736972884", "score": "0.6149823", "text": "func (e *OrderType) UnmarshalJSON(buffer []byte) error {\n var result byte\n err := fbe.Json.Unmarshal(buffer, &result)\n if err != nil {\n return err\n }\n *e = OrderType(result)\n return nil\n}", "title": "" }, { "docid": "9d69198914cb874055c2a8aa3c441314", "score": "0.61479056", "text": "func (v *Card) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1b92225fDecodeGithubComGoParkMailRu20202ExtraSafeInternalModels6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "23b4ab146e320b2c030dcfa9a0d15611", "score": "0.6144119", "text": "func (o *DataItems0) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 models.PhotoObject\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\to.PhotoObject = aO0\n\n\t// AO1\n\tvar aO1 models.RecognizeObject\n\tif err := swag.ReadJSON(raw, &aO1); err != nil {\n\t\treturn err\n\t}\n\to.RecognizeObject = aO1\n\n\treturn nil\n}", "title": "" }, { "docid": "e50722dbaedf1a505c435d1a1e026efe", "score": "0.6142278", "text": "func (x *EntityDTO_ApplicationServiceData_Sku) 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 = EntityDTO_ApplicationServiceData_Sku(num)\n\treturn nil\n}", "title": "" }, { "docid": "78ccac22bc4e906a41eff3b81f5a673a", "score": "0.614077", "text": "func FromJSON(i interface{}, r io.Reader) error {\n\td := json.NewDecoder(r)\n\treturn d.Decode(i)\n}", "title": "" }, { "docid": "8e82b03b0b61beb1e35331eeab93220f", "score": "0.6139262", "text": "func (v *ScUser) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson91a2f4f5DecodeModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "4b8d2483c3c533c2f198a5a8d5433ce1", "score": "0.6138473", "text": "func (v *Chat) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeAvitoChatModels6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f2a029fcbab2fb97c17d8926086f52f2", "score": "0.6136092", "text": "func (m *Mode) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\tswitch strings.ToLower(s) {\n\tcase \"spinner\", \"running\": // keep \"spinner\" for compatiability\n\t\t*m = ModeSpinner\n\tcase \"progress\":\n\t\t*m = ModeProgress\n\tcase \"done\":\n\t\t*m = ModeDone\n\tcase \"error\":\n\t\t*m = ModeError\n\tdefault:\n\t\tpanic(\"unknown mode\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d2d4e3dc65ff4aa2c3fadf8b64da29e3", "score": "0.613373", "text": "func (v *CategoryItem) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson773a3cfDecodeAvitoTest2CategoryItem1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3a600b19e1e7ad001cd641c35c26a8a4", "score": "0.61319685", "text": "func (v *ID) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeGeekband13(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "719354b9668d2c6e31437aaf4d972240", "score": "0.6130968", "text": "func (s *Skin) UnmarshalJSON(data []byte) error {\n\ttype alias Skin\n\ttmp := alias(*NewSkin())\n\terr := json.Unmarshal(data, &tmp)\n\tif err == nil {\n\t\t*s = Skin(tmp)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4271d6278414fc0c64c1cf2a8895b389", "score": "0.61251384", "text": "func (t *JSONDate) UnmarshalJSON(data []byte) (err error) {\n\t// Fractional seconds are handled implicitly by Parse.\n\ts := string(data)\n\tif s == \"null\" {\n\t\treturn\n\t}\n\n\ttt, err := time.Parse(`\"`+time.RFC3339+`\"`, s)\n\t*t = JSONDate{&tt}\n\treturn\n}", "title": "" }, { "docid": "5b335ed50901e45669b9fc344fb358ee", "score": "0.6124849", "text": "func (obj *BusinessUnitAssociatesSetMessage) UnmarshalJSON(data []byte) error {\n\ttype Alias BusinessUnitAssociatesSetMessage\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tif obj.Resource != nil {\n\t\tvar err error\n\t\tobj.Resource, err = mapDiscriminatorReference(obj.Resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f1c751934ff7c97b872955c900da1520", "score": "0.6122614", "text": "func (j *Inventory) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "17c423ab62393a244c255a656600e641", "score": "0.6122131", "text": "func (j *Impression) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "da0ad831ac161124a111a20e065f323d", "score": "0.6119405", "text": "func (v *CheckedObjectText) UnmarshalJSON(data []byte) error {\n\tresult, err := remarshalJSON(data)\n\tif nil != err {\n\t\treturn err\n\t}\n\t*v = (CheckedObjectText)(result)\n\treturn nil\n}", "title": "" }, { "docid": "372347dd24e052ce84ad4660d651b855", "score": "0.6119376", "text": "func (obj *CustomerTitleSetMessage) UnmarshalJSON(data []byte) error {\n\ttype Alias CustomerTitleSetMessage\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tif obj.Resource != nil {\n\t\tvar err error\n\t\tobj.Resource, err = mapDiscriminatorReference(obj.Resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "54d5abba03c0500fd240e7afd6825880", "score": "0.61182487", "text": "func (t *Int) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\tval, err := strconv.Atoi(strings.Trim(s, `\"`))\n\t*t = Int(val)\n\treturn err\n}", "title": "" }, { "docid": "9d31191665dfb512f89919f7ad4a2743", "score": "0.61141396", "text": "func (imp *Imposter) UnmarshalJSON(b []byte) error {\n\tdto := imposterResponseDTO{}\n\tif err := json.Unmarshal(b, &dto); err != nil {\n\t\treturn err\n\t}\n\timp.Port = dto.Port\n\timp.Proto = dto.Proto\n\timp.Name = dto.Name\n\timp.RequestCount = dto.RequestCount\n\tif len(dto.Stubs) > 0 {\n\t\timp.Stubs = make([]Stub, 0, len(dto.Stubs))\n\t\tfor _, v := range dto.Stubs {\n\t\t\tstub, err := v.unmarshalProto(imp.Proto)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\timp.Stubs = append(imp.Stubs, stub)\n\t\t}\n\t}\n\tif len(dto.Requests) > 0 {\n\t\timp.Requests = make([]interface{}, 0, len(dto.Requests))\n\n\t\tfor _, b := range dto.Requests {\n\t\t\treq, err := unmarshalRequest(imp.Proto, b)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\timp.Requests = append(imp.Requests, req)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e54258078978b7e110cc5fc56c3dfba", "score": "0.6108719", "text": "func (v *Example_obj) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson54c8071dDecodeGotestJsondataExample(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "25fd95d0392a110e7e17ac104a2317df", "score": "0.6107234", "text": "func (future *CreateOrUpdateFuture) 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": "0aa1af0ea905ec1399a6c786ebdea4ba", "score": "0.6107111", "text": "func (c *ClaimSet) UnmarshalJSON(b []byte) error {\n\tpc := make(map[string]interface{})\n\tif err := json.Unmarshal(b, &pc); err != nil {\n\t\treturn err\n\t}\n\tc.PrivateClaims = make(map[string]interface{})\n\tfor k, v := range pc {\n\t\tswitch val := v.(type) {\n\t\tcase string:\n\t\t\tc.setStringValues(k, val)\n\t\tcase float64:\n\t\t\tc.setNumericValues(k, val)\n\t\tdefault:\n\t\t\tc.PrivateClaims[k] = v\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d8d715d86dac12eab44c54ea0269e7e", "score": "0.6107007", "text": "func (x *InteractiveResponseMessage_Body_Format) 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 = InteractiveResponseMessage_Body_Format(num)\n\treturn nil\n}", "title": "" }, { "docid": "02b8528c35c7d696e704b919b793d167", "score": "0.6104413", "text": "func FromJSON(unmarshallable string) (interface{}, error) {\n\tlogrus.Debug(\"unmarshallable: \", unmarshallable)\n\tresult, err := json2.ToInterface(strings.NewReader(unmarshallable))\n\tlogrus.Debug(\"result: \", result)\n\treturn result, err\n}", "title": "" }, { "docid": "25a01aa842f8bc31e17780816c2a8976", "score": "0.61022186", "text": "func (set *StringSet) UnmarshalJSON(data []byte) error {\n\tsl := []string{}\n\tvar err error\n\tif err = json.Unmarshal(data, &sl); err == nil {\n\t\t*set = make(StringSet)\n\t\tfor _, s := range sl {\n\t\t\tset.Add(s)\n\t\t}\n\t} else {\n\t\tvar s string\n\t\tif err = json.Unmarshal(data, &s); err == nil {\n\t\t\t*set = make(StringSet)\n\t\t\tset.Add(s)\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "25a01aa842f8bc31e17780816c2a8976", "score": "0.61022186", "text": "func (set *StringSet) UnmarshalJSON(data []byte) error {\n\tsl := []string{}\n\tvar err error\n\tif err = json.Unmarshal(data, &sl); err == nil {\n\t\t*set = make(StringSet)\n\t\tfor _, s := range sl {\n\t\t\tset.Add(s)\n\t\t}\n\t} else {\n\t\tvar s string\n\t\tif err = json.Unmarshal(data, &s); err == nil {\n\t\t\t*set = make(StringSet)\n\t\t\tset.Add(s)\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "8873fb24a6f7ba3cd5315d68ff0eaae0", "score": "0.6102022", "text": "func FromJSON(i interface{}, r io.Reader) error {\n\tdecoder := json.NewDecoder(r)\n\t// This one is quite confusing tbh.\n\treturn decoder.Decode(i)\n}", "title": "" }, { "docid": "063665664f986be1c9af6481dd26e8e5", "score": "0.6098964", "text": "func (j *SeatBid) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "aa9c445857ade761dabb9bc8f8bee40e", "score": "0.609871", "text": "func (u *Unlit) UnmarshalJSON(data []byte) error {\n\tif len(*u) == 0 {\n\t\t*u = make(Unlit)\n\t}\n\tvar raw map[string]json.RawMessage\n\terr := json.Unmarshal(data, &raw)\n\tif err == nil {\n\t\tfor key, value := range raw {\n\t\t\t(*u)[key] = value\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "be3738fdfb92d9313a19d83dcb613e24", "score": "0.60885626", "text": "func (v *User) UnmarshalJSON(data []byte) error {\n r := jlexer.Lexer{Data: data}\n easyjson9e1087fdDecodeTemp(&r, v)\n return r.Error()\n}", "title": "" }, { "docid": "c6466cce95377975befcdf08b05deeaf", "score": "0.60837895", "text": "func (v *ScCategory) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson91a2f4f5DecodeModels6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "4513efc96a09fec0ed3fefb37f134dab", "score": "0.6083098", "text": "func (v *TsingCenter) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonA8649303DecodeLocalDiscoverTsingCenter(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "0a8f4401a4d86bf376a181cf627f9831", "score": "0.60827476", "text": "func (s *JSONMapItem) UnmarshalJSON(data []byte) error {\n\tl := jlexer.Lexer{Data: data}\n\ts.UnmarshalEasyJSON(&l)\n\treturn l.Error()\n}", "title": "" }, { "docid": "3010a72f4ad567f927bd4f166187759e", "score": "0.60772794", "text": "func (v *ScRecommend) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson91a2f4f5DecodeModels3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "fb61bc9cbeb9ae5d936698902c0b1f2a", "score": "0.6075466", "text": "func (s *Status) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = toID[j]\n\treturn nil\n}", "title": "" }, { "docid": "e6fd2d91c58c57054c7c7f7f55ec74da", "score": "0.60697323", "text": "func (s *Script) UnmarshalJSON(b []byte) (err error) {\n\tcmds, err := parseJSONCommands(b)\n\tif err != nil {\n\t\treturn\n\t}\n\t*s = Script(cmds)\n\treturn\n}", "title": "" }, { "docid": "dd7934a7210c81e7e69a3335e9e4d694", "score": "0.60657245", "text": "func (obj *InventoryEntryQuantitySetMessage) UnmarshalJSON(data []byte) error {\n\ttype Alias InventoryEntryQuantitySetMessage\n\tif err := json.Unmarshal(data, (*Alias)(obj)); err != nil {\n\t\treturn err\n\t}\n\tif obj.Resource != nil {\n\t\tvar err error\n\t\tobj.Resource, err = mapDiscriminatorReference(obj.Resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8629847ceff0ec0dd00c89d94e8de243", "score": "0.6064848", "text": "func (t *RecipientTransfer) UnmarshalJSON(data []byte) error {\n\tif id, ok := ParseID(data); ok {\n\t\tt.ID = id\n\t\treturn nil\n\t}\n\n\ttype recipientTransfer RecipientTransfer\n\tvar v recipientTransfer\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\t*t = RecipientTransfer(v)\n\treturn nil\n}", "title": "" }, { "docid": "02e337e3f937e47eb28f23c8d7c6e94c", "score": "0.606184", "text": "func (v *ArticlesResp) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeGeekband21(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "835f9122bea0ad64aa38ee5bb503c265", "score": "0.6059024", "text": "func (v *Gamer) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeModels10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7e2e5757ae4bf5f37d31286f7c1a6bb8", "score": "0.6058601", "text": "func (m *Macaroon) UnmarshalJSON(data []byte) error {\n\tvar err C.enum_macaroon_returncode\n\tcm := C.macaroon_deserialize_json(cbuf(data), C.size_t(len(data)), &err)\n\tif cm == nil {\n\t\treturn macaroonError(err)\n\t}\n\tm.m = cm\n\treturn nil\n}", "title": "" }, { "docid": "cb021d090cbc8bd721a22993c4ab1cd6", "score": "0.60580915", "text": "func (i *JSONString) UnmarshalJSON(data []byte) error {\n\t// If this method was called, the value was set.\n\ti.Set = true\n\n\tif data == nil {\n\t\t// The key was set to null\n\t\ti.Null = true\n\t\treturn nil\n\t}\n\n\t// The key isn't set to null\n\tvar temp string\n\tif err := json.Unmarshal(data, &temp); err != nil {\n\t\tfmt.Printf(\"error decoding sakura response: %v\", err)\n\t\tif e, ok := err.(*json.SyntaxError); ok {\n\t\t\tfmt.Printf(\"syntax error at byte offset %d\", e.Offset)\n\t\t}\n\t\tfmt.Printf(\"sakura response: %q\", data)\n\t\treturn err\n\t}\n\ti.Value = temp\n\treturn nil\n}", "title": "" }, { "docid": "5e47918c4f2cc5929f21eba8caef65bc", "score": "0.60558677", "text": "func (u *UnstructuredTypedObject) UnmarshalJSON(data []byte) error {\n\ttypedObj := ObjectType{}\n\tif err := json.Unmarshal(data, &typedObj); err != nil {\n\t\treturn err\n\t}\n\n\tobj := UnstructuredTypedObject{\n\t\tObjectType: typedObj,\n\t}\n\tif err := obj.setRaw(data); err != nil {\n\t\treturn err\n\t}\n\t*u = obj\n\treturn nil\n}", "title": "" }, { "docid": "d62c8cc7542302be7e6476d9c3efc1f6", "score": "0.6051566", "text": "func (v *UncheckObjectText) UnmarshalJSON(data []byte) error {\n\ts := string(data)\n\tif s == emptyJSONObjectText {\n\t\t*v = \"\"\n\t\treturn nil\n\t} else if s == \"null\" {\n\t\treturn nil\n\t}\n\t*v = (UncheckObjectText)(s)\n\treturn nil\n}", "title": "" }, { "docid": "f8126754695bff66dd48238993382095", "score": "0.60492593", "text": "func (v *CategoryItems) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson773a3cfDecodeAvitoTest2CategoryItem(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "da9ee78b6ee45775269f1049555239ae", "score": "0.6048774", "text": "func (t *CompositeTags) UnmarshalJSON(b []byte) error {\n\tt.tags2 = nil\n\treturn json.Unmarshal(b, &t.tags1)\n}", "title": "" }, { "docid": "913d3933aa7fccca7cbf842cc0aeda82", "score": "0.60486734", "text": "func (v *FullPost) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeSubdModels10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "8dc114d26e9abe6b5849db75c08e6842", "score": "0.60450065", "text": "func (v *Response) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeModels5(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "062dd596a60100a0898677733a2513cc", "score": "0.60449165", "text": "func (v *NewMobileInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeOtcControllers28(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5faba8789e3018e9459d63c3b6ad62ec", "score": "0.6044505", "text": "func (v *ScRelease) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson91a2f4f5DecodeModels2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "c5eda01feec3cef46f873c6f534a8d8b", "score": "0.60418415", "text": "func (ct *JSONTime) UnmarshalJSON(b []byte) (err error) {\n s := strings.Trim(string(b), \"\\\"\")\n if s == \"null\" {\n ct.Time = time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)\n return\n }\n\n i, err := strconv.ParseInt(s, 10, 64)\n if err != nil {\n panic(err)\n }\n\n i = i/1000\n\n ct.Time = time.Unix(i,0)\n return\n}", "title": "" }, { "docid": "0f6a2c7afae7ee59242b8f523c45a31d", "score": "0.60402393", "text": "func (j *Attachment) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "d9e060ef0112abe03c419aa11d7fb618", "score": "0.60394466", "text": "func (e *OrderSide) UnmarshalJSON(buffer []byte) error {\n var result byte\n err := fbe.Json.Unmarshal(buffer, &result)\n if err != nil {\n return err\n }\n *e = OrderSide(result)\n return nil\n}", "title": "" }, { "docid": "1cfda25099df4a3a5ee23a912fa62b08", "score": "0.60359055", "text": "func (pTypeDef *MapTest) UnmarshalJSON(b []byte) error {\n\tvar r rawMapTest\n\terr := json.Unmarshal(b, &r)\n\tif err == nil {\n\t\to := MapTest(r)\n\t\t*pTypeDef = *((&o).Init())\n\t\terr = pTypeDef.Validate()\n\t}\n\treturn err\n}", "title": "" } ]
8ceffc3b2b710ec16b847f9cdb3038f4
Update the specified long field for the given member.
[ { "docid": "0c064ee1562fecb45c4734c53e9d9aa9", "score": "0.62411654", "text": "func (m *CassandraDB) SetLongValue(\n\tctx context.Context, id string, field string, value uint64) error {\n\tvar member *membersys.MembershipAgreement = new(membersys.MembershipAgreement)\n\tvar batch *gocql.Batch\n\tvar encodedProto []byte\n\tvar stmt *gocql.Query\n\tvar err error\n\n\t// Retrieve the protobuf with all data from Cassandra. Use a quorum read\n\t// to make sure we aren't missing any recent updates.\n\tstmt = m.sess.Query(\n\t\t\"SELECT pb_data FROM members WHERE key = ?\",\n\t\tappend([]byte(memberPrefix), []byte(id)...)).WithContext(ctx).\n\t\tConsistency(gocql.Quorum)\n\tdefer stmt.Release()\n\n\terr = stmt.Scan(&encodedProto)\n\tif err == gocql.ErrNotFound {\n\t\treturn grpc.Errorf(codes.NotFound, \"No member found for %s: %s\", id,\n\t\t\terr.Error())\n\t}\n\tif err != nil {\n\t\treturn grpc.Errorf(codes.Internal, \"Error running query: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Decode the protobuf which was written to the column.\n\terr = proto.Unmarshal(encodedProto, member)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif field == \"payments_caught_up_to\" {\n\t\tmember.MemberData.PaymentsCaughtUpTo = proto.Uint64(value)\n\t} else {\n\t\treturn grpc.Errorf(codes.NotFound, \"Unknown field specified: %s\",\n\t\t\tfield)\n\t}\n\n\tencodedProto, err = proto.Marshal(member)\n\tif err != nil {\n\t\treturn grpc.Errorf(codes.Internal,\n\t\t\t\"Error parsing stored membership data: %s\", err.Error())\n\t}\n\n\t// Write data columns and pb_data back.\n\tbatch = m.sess.NewBatch(gocql.LoggedBatch).WithContext(ctx)\n\tbatch.SetConsistency(gocql.Quorum)\n\tbatch.Query(\n\t\t\"UPDATE members SET \"+field+\" = ?, pb_data = ? WHERE key = ?\",\n\t\tvalue, encodedProto, append([]byte(memberPrefix), []byte(id)...))\n\tbatch.Query(\n\t\t\"UPDATE member_agreements SET pb_data = ? WHERE key = ?\",\n\t\tencodedProto, append([]byte(memberPrefix), []byte(id)...))\n\terr = m.sess.ExecuteBatch(batch)\n\tif err != nil {\n\t\treturn grpc.Errorf(codes.Internal,\n\t\t\t\"Error writing back membership data: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f58f0f75cf48205820a8c192a271b3cc", "score": "0.6642911", "text": "func SetLongField(env *C.JNIEnv, obj C.jobject, fieldID C.jfieldID, val C.jlong) {\n\tC._GoJniSetLongField(env, obj, fieldID, val)\n}", "title": "" }, { "docid": "91a2965e65669c0bb5082b028a618c53", "score": "0.60345656", "text": "func SetStaticLongField(env *C.JNIEnv, clazz C.jclass, fieldID C.jfieldID, value C.jlong) {\n\tC._GoJniSetStaticLongField(env, clazz, fieldID, value)\n}", "title": "" }, { "docid": "917600941f8352c79c545938132125ba", "score": "0.5836519", "text": "func (obj *Value) SetLong(v int64) {\n\tobj.Candy().Guify(\"g_value_set_long\", obj, v)\n}", "title": "" }, { "docid": "b1a56016a102c531cfb3c2e43911e836", "score": "0.56782794", "text": "func (inst *Instance) fieldUpdate(t time.Time) {\n\tinst.lifePool.Update(t)\n}", "title": "" }, { "docid": "8b09c5e70e5b00733c70fc9565137b04", "score": "0.5561332", "text": "func UpdateNumField(key string, value int64) UpdateOption {\n\treturn func() string {\n\t\treturn fmt.Sprintf(\"%s = %d\", key, value)\n\t}\n}", "title": "" }, { "docid": "3dc300f9337d99c1146fd6ceeec1179e", "score": "0.5537372", "text": "func (entry *Entry) SetUintField(name string, value uint64) {\n\tentry.SetField(name, strconv.FormatUint(uint64(value), 10))\n}", "title": "" }, { "docid": "2c87909bd50dc059191e86b606b80207", "score": "0.54335135", "text": "func (obj *Value) SetUlong(v uint64) {\n\tobj.Candy().Guify(\"g_value_set_ulong\", obj, v)\n}", "title": "" }, { "docid": "649613fa05ac8678bfb8d5536ec1dcae", "score": "0.5433122", "text": "func (recv *Value) SetLong(vLong int64) {\n\tc_v_long := (C.glong)(vLong)\n\n\tC.g_value_set_long((*C.GValue)(recv.native), c_v_long)\n\n\treturn\n}", "title": "" }, { "docid": "fb44048c7e5b17dcea13a03adca1e8b5", "score": "0.5334495", "text": "func (r *Record) SetInt64Field(d *Db, number uint16, data int64) error {\n\tif C.wg_set_int_field(d.db, r.rec, C.wg_int(number), C.wg_int(data)) != 0 {\n\t\treturn WDBError(\"Could not set field\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef1d0ec4b6aeeec157bc6e7bed353207", "score": "0.53031904", "text": "func (k *RawMetaKey) UpdateField(field []byte) {\n\tk.Field = field\n}", "title": "" }, { "docid": "808099fad216db1730f490e3bf4893d1", "score": "0.5302863", "text": "func (instance *Instance) SetUint64(fieldName string, value uint64) error {\n\tfieldNameCStr := C.CString(fieldName)\n\tdefer C.free(unsafe.Pointer(fieldNameCStr))\n\n\tretcode := int(C.RTI_Connector_set_number_into_samples(unsafe.Pointer(instance.output.connector.native), instance.output.nameCStr, fieldNameCStr, C.double(value)))\n\treturn checkRetcode(retcode)\n}", "title": "" }, { "docid": "1c6be3f27c1c096b9ef0efa166bd21ce", "score": "0.5266068", "text": "func update(arg argument, value string) error {\n\tswitch arg.Type {\n\tcase \"string\":\n\t\targ.field.SetString(value)\n\tcase \"int\":\n\t\ti, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to convert value %q to int\", value)\n\t\t}\n\t\targ.field.SetInt(int64(i))\n\tcase \"Duration\":\n\t\td, err := time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to convert value %q to duration\", value)\n\t\t}\n\t\targ.field.SetInt(int64(d))\n\tdefault:\n\t\treturn fmt.Errorf(\"type not supported %q\", arg.Type)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ef0396baa58de81552877755e97ed174", "score": "0.52137387", "text": "func (z *Int) SetUint64(x uint64) *Int {}", "title": "" }, { "docid": "c9fa400606461704e6b5cf8c57fa7c2b", "score": "0.51715535", "text": "func Uint64(name string, val uint64) Field {\n\treturn Field(zap.Uint64(name, val))\n}", "title": "" }, { "docid": "eaabf7c0e31d83f8415c28c8ce5c15ef", "score": "0.5160521", "text": "func putLong(log log.T, byteArray []byte, offset int, value int64) (err error) {\n\tbyteArrayLength := len(byteArray)\n\tif offset > byteArrayLength-1 || offset+8 > byteArrayLength || offset < 0 {\n\t\tlog.Error(\"putInteger failed: Offset is invalid.\")\n\t\treturn errors.New(\"Offset is outside the byte array.\")\n\t}\n\n\tmbytes, err := longToBytes(log, value)\n\tif err != nil {\n\t\tlog.Error(\"putInteger failed: getBytesFromInteger Failed.\")\n\t\treturn err\n\t}\n\n\tcopy(byteArray[offset:offset+8], mbytes)\n\treturn nil\n}", "title": "" }, { "docid": "962a603f500ce4e071c3a5a367f188de", "score": "0.5152391", "text": "func (feature Feature) SetFieldInteger64(index int, value int64) {\n\tC.OGR_F_SetFieldInteger64(feature.cval, C.int(index), C.GIntBig(value))\n}", "title": "" }, { "docid": "84930793a2a5903ce6936ec158b08f71", "score": "0.5138837", "text": "func (z *Float) SetUint64(x uint64) *Float {}", "title": "" }, { "docid": "5681118fc4d6f1f38c88792b1eaec9bd", "score": "0.511836", "text": "func (b *raftBadger) SetUint64(key []byte, val uint64) error {\n\treturn b.SetRaw(u64KeyOf(key), uint64ToBytes(val))\n}", "title": "" }, { "docid": "38191227a143fcddda1a20ac51738d1d", "score": "0.510648", "text": "func (r *raftLog) SetUint64(k []byte, v uint64) error {\n\treturn r.setUint64(confBucket, k, v)\n}", "title": "" }, { "docid": "bbbc898cecd5397ab8e43673d95d89ab", "score": "0.50983363", "text": "func (e *EtcdBackoffAdapter) MemberUpdate(ctx context.Context, id uint64, peerURLs []string) (*clientv3.MemberUpdateResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, e.Timeout)\n\tdefer cancel()\n\tvar response *clientv3.MemberUpdateResponse\n\terr := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {\n\t\tresp, err := e.EtcdClient.MemberUpdate(ctx, id, peerURLs)\n\t\tif err != nil {\n\t\t\tLog.Info(\"failed to update etcd member\", \"etcd client error\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tresponse = resp\n\t\treturn true, nil\n\t})\n\treturn response, err\n}", "title": "" }, { "docid": "31a521a4871701fbd1c51e9b945200ac", "score": "0.5074035", "text": "func (b *MessagesEditBuilder) Long(v float64) *MessagesEditBuilder {\n\tb.Params[\"long\"] = v\n\treturn b\n}", "title": "" }, { "docid": "2a0fb76a840d4216f7a2a04cdb0f3ce8", "score": "0.5071173", "text": "func (i *InmemStore) SetUint64(key []byte, val uint64) error {\n\ti.l.Lock()\n\tdefer i.l.Unlock()\n\ti.kvInt[string(key)] = val\n\treturn nil\n}", "title": "" }, { "docid": "7dcb56db4fbbc1b9561e2d9902ad417c", "score": "0.5057099", "text": "func (c *TRandomLong) UpdateLong(value int64, interval int64) int64 {\n\tif interval <= 0 {\n\t\tinterval = int64(math.Trunc(0.1 * float64(value)))\n\t}\n\tminValue := value - interval\n\tmaxValue := value + interval\n\treturn c.NextLong(minValue, maxValue)\n}", "title": "" }, { "docid": "5806fb665e0f2ad5b988046bc6170277", "score": "0.5042667", "text": "func (obj *Value) SetUint64(v uint64) {\n\tobj.Candy().Guify(\"g_value_set_uint64\", obj, v)\n}", "title": "" }, { "docid": "3ac566f9ad4fe1e3cb75528c91507e28", "score": "0.5039459", "text": "func GetLongField(env *C.JNIEnv, obj C.jobject, fieldID C.jfieldID) C.jlong {\n\treturn C._GoJniGetLongField(env, obj, fieldID)\n}", "title": "" }, { "docid": "bf3b5f1ca7862eb586c0192000204ce5", "score": "0.5039214", "text": "func (m *OrgUnitMemberMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase orgunitmember.FieldCreateByUser:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetCreateByUser(v)\n\t\treturn nil\n\tcase orgunitmember.FieldUpdateByUser:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetUpdateByUser(v)\n\t\treturn nil\n\tcase orgunitmember.FieldCreateTime:\n\t\tv, ok := value.(time.Time)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetCreateTime(v)\n\t\treturn nil\n\tcase orgunitmember.FieldUpdateTime:\n\t\tv, ok := value.(time.Time)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetUpdateTime(v)\n\t\treturn nil\n\tcase orgunitmember.FieldIsAdditional:\n\t\tv, ok := value.(bool)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetIsAdditional(v)\n\t\treturn nil\n\tcase orgunitmember.FieldUserID:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetUserID(v)\n\t\treturn nil\n\tcase orgunitmember.FieldOrgUnitID:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetOrgUnitID(v)\n\t\treturn nil\n\tcase orgunitmember.FieldOrgUnitPositionID:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetOrgUnitPositionID(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown OrgUnitMember field %s\", name)\n}", "title": "" }, { "docid": "42dbd39e89efab5500ac8f2e86ffaf8a", "score": "0.5027835", "text": "func (recv *Value) SetUlong(vUlong uint64) {\n\tc_v_ulong := (C.gulong)(vUlong)\n\n\tC.g_value_set_ulong((*C.GValue)(recv.native), c_v_ulong)\n\n\treturn\n}", "title": "" }, { "docid": "584bd50e31296ff4cc77f1aeeb7b6344", "score": "0.50134057", "text": "func (b *BadgerStore) SetUint64(key []byte, val uint64) error {\n\treturn b.Set(key, uint64ToBytes(val))\n}", "title": "" }, { "docid": "584bd50e31296ff4cc77f1aeeb7b6344", "score": "0.50134057", "text": "func (b *BadgerStore) SetUint64(key []byte, val uint64) error {\n\treturn b.Set(key, uint64ToBytes(val))\n}", "title": "" }, { "docid": "549d87d743a7b4965d64d9f7fef50c65", "score": "0.5005744", "text": "func (m *CassandraDB) SetMemberFee(\n\tctx context.Context, id string, fee uint64, yearly bool) error {\n\tvar member *membersys.MembershipAgreement = new(membersys.MembershipAgreement)\n\tvar batch *gocql.Batch\n\tvar encodedProto []byte\n\tvar stmt *gocql.Query\n\tvar err error\n\n\t// Retrieve the protobuf with all data from Cassandra. Use a quorum read to make sure we aren't\n\t// missing any recent updates.\n\tstmt = m.sess.Query(\n\t\t\"SELECT pb_data FROM members WHERE key = ?\",\n\t\tappend([]byte(memberPrefix), []byte(id)...)).WithContext(ctx).\n\t\tConsistency(gocql.Quorum)\n\tdefer stmt.Release()\n\n\terr = stmt.Scan(&encodedProto)\n\tif err == gocql.ErrNotFound {\n\t\treturn grpc.Errorf(codes.NotFound, \"No member found for %s: %s\", id,\n\t\t\terr.Error())\n\t}\n\tif err != nil {\n\t\treturn grpc.Errorf(codes.Internal, \"Error running query: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Decode the protobuf which was written to the column.\n\terr = proto.Unmarshal(encodedProto, member)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmember.MemberData.Fee = &fee\n\tmember.MemberData.FeeYearly = &yearly\n\n\tencodedProto, err = proto.Marshal(member)\n\tif err != nil {\n\t\treturn grpc.Errorf(codes.DataLoss,\n\t\t\t\"Error parsing stored membership data: %s\", err.Error())\n\t}\n\n\t// Write data columns and pb_data back.\n\tbatch = m.sess.NewBatch(gocql.LoggedBatch).WithContext(ctx)\n\tbatch.SetConsistency(gocql.Quorum)\n\tbatch.Query(\n\t\t\"UPDATE members SET pb_data = ?, fee = ?, fee_yearly = ? WHERE key = ?\",\n\t\tencodedProto, fee, yearly, append([]byte(memberPrefix),\n\t\t\t[]byte(id)...))\n\tbatch.Query(\n\t\t\"UPDATE member_agreements SET pb_data = ? WHERE key = ?\",\n\t\tencodedProto, append([]byte(memberPrefix), []byte(id)...))\n\terr = m.sess.ExecuteBatch(batch)\n\tif err != nil {\n\t\treturn grpc.Errorf(codes.Internal,\n\t\t\t\"Error writing back membership data: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9e039be72a1730ce130754bd470cb039", "score": "0.5002889", "text": "func (z *Element22) SetUint64(v uint64) *Element22 {\n\tz[0] = v\n\tz[1] = 0\n\tz[2] = 0\n\tz[3] = 0\n\tz[4] = 0\n\tz[5] = 0\n\tz[6] = 0\n\tz[7] = 0\n\tz[8] = 0\n\tz[9] = 0\n\tz[10] = 0\n\tz[11] = 0\n\tz[12] = 0\n\tz[13] = 0\n\tz[14] = 0\n\tz[15] = 0\n\tz[16] = 0\n\tz[17] = 0\n\tz[18] = 0\n\tz[19] = 0\n\tz[20] = 0\n\tz[21] = 0\n\treturn z.ToMont()\n}", "title": "" }, { "docid": "fe6db4c74e1494f57743675ea76cac90", "score": "0.4977577", "text": "func (r *HashJsonCodecRedisController) SetSomeUint64(key string, someUint64 uint64) (err error) {\n\t// redis conn\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t// set SomeUint64 field\n\tr.m.SomeUint64 = someUint64\n\t_, err = conn.Do(\"HSET\", key, \"SomeUint64\", someUint64)\n\n\treturn\n}", "title": "" }, { "docid": "062d087f4acbc8b7ce6718daabb22bc2", "score": "0.4965126", "text": "func Uint64(k string, v uint64) Field {\n\treturn Field{Key: k, Value: valf.Uint64(v)}\n}", "title": "" }, { "docid": "0653bf656a389969e1318bb0eec7e4cb", "score": "0.494504", "text": "func (f *FlagSet) Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\tp := new(uint64)\n\tf.Uint64Var(p, name, alias, value, usage, fn)\n\treturn p\n}", "title": "" }, { "docid": "bac99d9162f692e3432f3ce7bb60457d", "score": "0.49383503", "text": "func (m *Message) putUint64(v uint64) {\n\tb := m.bufferForPut(8)\n\tdefer b.Advance(8)\n\n\tbinary.LittleEndian.PutUint64(b.Bytes[b.Offset:], v)\n}", "title": "" }, { "docid": "d08e13183aac7930989727ef5b2a3a63", "score": "0.4929811", "text": "func (entry *Entry) IntField64(name string) (value int64, err error) {\n\ttmp, err := entry.Field(name)\n\tif err == nil {\n\t\tvalue, err = strconv.ParseInt(tmp, 0, 64)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c0ee806b4bdf8cf88eca971e1551ab8f", "score": "0.492947", "text": "func (client PrimitiveClient) PutLong(complexBody LongWrapper) (result autorest.Response, err error) {\n req, err := client.PutLongPreparer(complexBody)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"complexgroup.PrimitiveClient\", \"PutLong\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.PutLongSender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"complexgroup.PrimitiveClient\", \"PutLong\", resp, \"Failure sending request\")\n }\n\n result, err = client.PutLongResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"complexgroup.PrimitiveClient\", \"PutLong\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "4012a9d70e7d529845c7492b0a86d4de", "score": "0.48956698", "text": "func UInt64Put(p []byte, n uint64) {\n\tbinary.LittleEndian.PutUint64(p, n)\n}", "title": "" }, { "docid": "3a7d4076e7b82e32ab36bb795ed8c0bb", "score": "0.48870608", "text": "func UpdateMember(m *Member) (err error) {\n\to := orm.NewOrm()\n\tv := Member{Id: m.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.Update(m); err == nil {\n\t\t\tfmt.Println(\"Number of records updated in database:\", num)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "03d3fdd115eeb1fa67aa5d65eb4f8a50", "score": "0.48639455", "text": "func Uint64(key string, val uint64) Field {\n\treturn Field{Key: key, Type: core.Uint64Type, Integer: int64(val)}\n}", "title": "" }, { "docid": "e6102a57e4a105dc71cc1efe4802c58e", "score": "0.48600185", "text": "func (m Measurement) AddUInt64(name string, value uint64) Measurement {\n\tm.fieldSet[name] = value\n\treturn m\n}", "title": "" }, { "docid": "1cd4083e05ab5606a7530eee158b3a66", "score": "0.484118", "text": "func (o *LongProperty) SetValue(v int64) {\n\to.Value = &v\n}", "title": "" }, { "docid": "91f093ba4f0432888247fd08d7f5d268", "score": "0.4839073", "text": "func (n *Uint256) SetUint64(n2 uint64) *Uint256 {\n\tn.n[0] = n2\n\tn.n[1] = 0\n\tn.n[2] = 0\n\tn.n[3] = 0\n\treturn n\n}", "title": "" }, { "docid": "0b6377ded6a46a7b5bc0a6d46cc60aa7", "score": "0.48329872", "text": "func (b *MessagesSendBuilder) Long(v float64) *MessagesSendBuilder {\n\tb.Params[\"long\"] = v\n\treturn b\n}", "title": "" }, { "docid": "556c1e82f1a5c04a481c3888eee83477", "score": "0.4830556", "text": "func (m *TeamworkTag) SetMemberCount(value *int32)() {\n err := m.GetBackingStore().Set(\"memberCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5f6a845831dc7ab44e500e34765df5b3", "score": "0.48269224", "text": "func (service *ContrailService) UpdateLoadbalancerMember(\n\tctx context.Context,\n\trequest *models.UpdateLoadbalancerMemberRequest) (*models.UpdateLoadbalancerMemberResponse, error) {\n\tmodel := request.LoadbalancerMember\n\tif model == nil {\n\t\treturn nil, common.ErrorBadRequest(\"Update body is empty\")\n\t}\n\tif err := common.DoInTransaction(\n\t\tservice.DB,\n\t\tfunc(tx *sql.Tx) error {\n\t\t\treturn db.UpdateLoadbalancerMember(ctx, tx, request)\n\t\t}); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err,\n\t\t\t\"resource\": \"loadbalancer_member\",\n\t\t}).Debug(\"db update failed\")\n\t\treturn nil, common.ErrorInternal\n\t}\n\treturn &models.UpdateLoadbalancerMemberResponse{\n\t\tLoadbalancerMember: model,\n\t}, nil\n}", "title": "" }, { "docid": "0509479fbaea194093e594e073f65af6", "score": "0.48038378", "text": "func (m *MailTips) SetExternalMemberCount(value *int32)() {\n err := m.GetBackingStore().Set(\"externalMemberCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9fb313a2fd170bb52e22e88344969c27", "score": "0.48011395", "text": "func UpdateTeamMember(cmd *models.UpdateTeamMemberCommand) error {\n\treturn inTransaction(func(sess *DBSession) error {\n\t\tmember, err := getTeamMember(sess, cmd.OrgId, cmd.TeamId, cmd.UserId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif cmd.ProtectLastAdmin {\n\t\t\t_, err := isLastAdmin(sess, cmd.OrgId, cmd.TeamId, cmd.UserId)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif cmd.Permission != models.PERMISSION_ADMIN { // make sure we don't get invalid permission levels in store\n\t\t\tcmd.Permission = 0\n\t\t}\n\n\t\tmember.Permission = cmd.Permission\n\t\t_, err = sess.Cols(\"permission\").Where(\"org_id=? and team_id=? and user_id=?\", cmd.OrgId, cmd.TeamId, cmd.UserId).Update(member)\n\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "1ce01ec27e1242672d7e57fbab254d88", "score": "0.47926924", "text": "func (recv *Value) SetUint64(vUint64 uint64) {\n\tc_v_uint64 := (C.guint64)(vUint64)\n\n\tC.g_value_set_uint64((*C.GValue)(recv.native), c_v_uint64)\n\n\treturn\n}", "title": "" }, { "docid": "74d66c4db889ef1b77bcb14c4fe93fd1", "score": "0.4764969", "text": "func Uint(key string, val uint) Field {\n\treturn Uint64(key, uint64(val))\n}", "title": "" }, { "docid": "aa8055f1d3b56fa2ac13c163e7e8d5f7", "score": "0.47597793", "text": "func (z *Rat) SetUint64(x uint64) *Rat {}", "title": "" }, { "docid": "6fcd6a37fbbe1ead028d261cc4052d6f", "score": "0.47523984", "text": "func (s *DB) UpdateField(data interface{}, fieldName string, value interface{}) error {\n\treturn s.root.UpdateField(data, fieldName, value)\n}", "title": "" }, { "docid": "b082bd7cd4ad15a24dfc5c2c0782947e", "score": "0.47485998", "text": "func (m *OrgUnitMemberMutation) ResetField(name string) error {\n\tswitch name {\n\tcase orgunitmember.FieldCreateByUser:\n\t\tm.ResetCreateByUser()\n\t\treturn nil\n\tcase orgunitmember.FieldUpdateByUser:\n\t\tm.ResetUpdateByUser()\n\t\treturn nil\n\tcase orgunitmember.FieldCreateTime:\n\t\tm.ResetCreateTime()\n\t\treturn nil\n\tcase orgunitmember.FieldUpdateTime:\n\t\tm.ResetUpdateTime()\n\t\treturn nil\n\tcase orgunitmember.FieldIsAdditional:\n\t\tm.ResetIsAdditional()\n\t\treturn nil\n\tcase orgunitmember.FieldUserID:\n\t\tm.ResetUserID()\n\t\treturn nil\n\tcase orgunitmember.FieldOrgUnitID:\n\t\tm.ResetOrgUnitID()\n\t\treturn nil\n\tcase orgunitmember.FieldOrgUnitPositionID:\n\t\tm.ResetOrgUnitPositionID()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown OrgUnitMember field %s\", name)\n}", "title": "" }, { "docid": "98b0cdf27d8b6fda62ed31db19c82b79", "score": "0.47444332", "text": "func SetUint64(z *big.Int, x uint64) *big.Int {\n\treturn z.SetUint64(x)\n}", "title": "" }, { "docid": "ab2e23e08d4cd17b6c6ca6cd4d4854a4", "score": "0.4718215", "text": "func UpdateListMember(w http.ResponseWriter, r *http.Request) {\r\n\r\n}", "title": "" }, { "docid": "bd4d0e6ebc739a3ecd186aedd1896177", "score": "0.470506", "text": "func (c *Client) UpdateOrgMember(name string, username string, in *api.UpdateOrgMemberRequest) (*api.OrgMember, error) {\n\tout := &api.OrgMember{}\n\trawURL := fmt.Sprintf(pathOrgMember, c.base.String(), name, username)\n\terr := c.post(rawURL, true, http.StatusOK, in, out)\n\treturn out, errio.Error(err)\n}", "title": "" }, { "docid": "657ab6622cb6a83c8b625c90907aeda2", "score": "0.469272", "text": "func (z *Big) SetUint64(x uint64) *Big {\n\tz.compact = x\n\tif x == c.Inflated {\n\t\tz.unscaled.SetUint64(x)\n\t}\n\tz.precision = arith.Length(x)\n\tz.exp = 0\n\tz.form = finite\n\treturn z\n}", "title": "" }, { "docid": "d505f2ef146a6ecee0d6c514ba8aff62", "score": "0.46879756", "text": "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn ex.FlagSet.Uint64(name, value, usage)\n}", "title": "" }, { "docid": "c66e0853d79c7d9f6a49bfa24726e06f", "score": "0.46834558", "text": "func (w *Writer) Uint64(n uint64) {\n\tw.buf = strconv.AppendUint(w.buf, uint64(n), 10)\n}", "title": "" }, { "docid": "a6cab261f467098b4828862d992fe1fd", "score": "0.46746236", "text": "func (db *DB) PutUint64(key string, value uint64) (err error) {\n\ts := strconv.FormatUint(value, 10)\n\treturn db.PutStr(key, s)\n}", "title": "" }, { "docid": "0cee2c3759b5ad6b799351e28e1ed54a", "score": "0.46729934", "text": "func (b *PhotosSearchBuilder) Long(v float64) *PhotosSearchBuilder {\n\tb.Params[\"long\"] = v\n\treturn b\n}", "title": "" }, { "docid": "83985754695b0effd77dbcd5f64a6d2e", "score": "0.4672842", "text": "func (s *Streamer) Uint64(v uint64) *Streamer {\n\tif s.Error != nil {\n\t\treturn s\n\t}\n\ts.onVal()\n\ts.buffer = appendUint64(s.buffer, v)\n\treturn s\n}", "title": "" }, { "docid": "b8a4b1f00a60a0225878d5e4e52e3f73", "score": "0.46585858", "text": "func (tracker *InMemoryTracker) SetMember(ms *dstate.MemberState) {\n\tshard := tracker.getGuildShard(ms.GuildID)\n\tif shard == nil {\n\t\tpanic(\"unknown shard\")\n\t}\n\n\tshard.mu.Lock()\n\tdefer shard.mu.Unlock()\n\n\tshard.innerHandleMemberUpdate(ms, false)\n}", "title": "" }, { "docid": "6375ff45d211410941c389c6fd8584ce", "score": "0.46563646", "text": "func (m *LengthtimeMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase lengthtime.FieldLengthtime:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetLengthtime(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Lengthtime field %s\", name)\n}", "title": "" }, { "docid": "23a40abe272de83aba2219eab80b3919", "score": "0.46559042", "text": "func (service *ContrailService) RESTUpdateLoadbalancerMember(c echo.Context) error {\n\t//id := c.Param(\"id\")\n\trequest := &models.UpdateLoadbalancerMemberRequest{}\n\tif err := c.Bind(request); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err,\n\t\t\t\"resource\": \"loadbalancer_member\",\n\t\t}).Debug(\"bind failed on update\")\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"Invalid JSON format\")\n\t}\n\tctx := c.Request().Context()\n\tresponse, err := service.UpdateLoadbalancerMember(ctx, request)\n\tif err != nil {\n\t\treturn common.ToHTTPError(err)\n\t}\n\treturn c.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "8c178e3c61d6ee32c5689f7f9a44ca05", "score": "0.4655186", "text": "func UpdateMemberStatus(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"content-type\", \"application/json\")\n\n\torg_collection, member_collection := \"organizations\", \"members\"\n\n\t// Validate the user ID\n\torgId := mux.Vars(r)[\"id\"]\n\tmember_Id := mux.Vars(r)[\"mem_id\"]\n\n\tpMemId, err := primitive.ObjectIDFromHex(member_Id)\n\tif err != nil {\n\t\tutils.GetError(errors.New(\"invalid member id\"), http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\tpOrgId, err := primitive.ObjectIDFromHex(orgId)\n\tif err != nil {\n\t\tutils.GetError(errors.New(\"invalid organization id\"), http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\trequestData := make(map[string]string)\n\tif err := utils.ParseJsonFromRequest(r, &requestData); err != nil {\n\t\tutils.GetError(err, http.StatusUnprocessableEntity, w)\n\t\treturn\n\t}\n\n\tmember_status := requestData[\"status\"]\n\n\torgDoc, _ := utils.GetMongoDbDoc(org_collection, bson.M{\"_id\": pOrgId})\n\tif orgDoc == nil {\n\t\tfmt.Printf(\"org with id doesn't exist!\", orgId)\n\t\tutils.GetError(errors.New(\"org with id %s doesn't exist!\"), http.StatusBadRequest, w)\n\t\treturn\n\t}\n\n\tmemberDoc, _ := utils.GetMongoDbDoc(member_collection, bson.M{\"_id\": pMemId, \"org_id\": orgId})\n\tif memberDoc == nil {\n\t\tfmt.Printf(\"member with id %s doesn't exist!\", member_Id)\n\t\tutils.GetError(errors.New(\"member with id doesn't exist!\"), http.StatusBadRequest, w)\n\t\treturn\n\n\t}\n\n\tresult, err := utils.UpdateOneMongoDbDoc(member_collection, member_Id, bson.M{\"status\": member_status})\n\tif err != nil {\n\t\tutils.GetError(err, http.StatusInternalServerError, w)\n\t\treturn\n\t}\n\n\tutils.GetSuccess(\"status updated\", result, w)\n}", "title": "" }, { "docid": "30f1cec96bf660c25998273dac41cfc7", "score": "0.46522582", "text": "func SetShortField(env *C.JNIEnv, obj C.jobject, fieldID C.jfieldID, val C.jshort) {\n\tC._GoJniSetShortField(env, obj, fieldID, val)\n}", "title": "" }, { "docid": "d51f2770fb3517d095ae2b3ac48c16e3", "score": "0.4631304", "text": "func (i *UInt64) Set(v uint64) {\n\t*i = UInt64(v)\n}", "title": "" }, { "docid": "e21c868a3668e12d2a15b1703d8269f1", "score": "0.46266988", "text": "func (a *api) SetInt64(raw bool) {\n\ta.Commentf(\"%s constructs a field element from an integer.\", rawname(\"SetInt64\", raw))\n\ta.rawcomment(raw)\n\ta.Printf(\"func (x %s) %s(y int64) %s\", a.PointerType(), rawname(\"SetInt64\", raw), a.PointerType())\n\ta.EnterBlock()\n\ta.Linef(\"x.%s(big.NewInt(y))\", rawname(\"SetInt\", raw))\n\ta.Linef(\"return x\")\n\ta.LeaveBlock()\n}", "title": "" }, { "docid": "fa6339a858b2ad2d01bf23498f2bcf30", "score": "0.4625968", "text": "func (m *MemberMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase member.FieldMEMBERID:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetMEMBERID(v)\n\t\treturn nil\n\tcase member.FieldMEMBERNAME:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetMEMBERNAME(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Member field %s\", name)\n}", "title": "" }, { "docid": "9182f861a8ec40d46cb8f33639db72d8", "score": "0.4622402", "text": "func (_m *TeamStore) UpdateMember(member *model.TeamMember) (*model.TeamMember, error) {\n\tret := _m.Called(member)\n\n\tvar r0 *model.TeamMember\n\tif rf, ok := ret.Get(0).(func(*model.TeamMember) *model.TeamMember); ok {\n\t\tr0 = rf(member)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*model.TeamMember)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*model.TeamMember) error); ok {\n\t\tr1 = rf(member)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "b480636952a5b339c6611aaa17fd56bf", "score": "0.46209624", "text": "func (d *DBRepository) updateField(ctx context.Context, id, field string, value interface{}) error {\n\tobjectID, _ := primitive.ObjectIDFromHex(id)\n\tfilter := bson.M{\"_id\": objectID}\n\tupdate := bson.D{{\n\t\t\"$set\", bson.D{{\n\t\t\tfield, value,\n\t\t}},\n\t}}\n\tif _, err := d.Collection.ReplaceOne(ctx, filter, update); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39fead0cc72733f1df5c2980c257cda7", "score": "0.46143883", "text": "func (m *SalaryMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase salary.FieldSALARY:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetSALARY(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Salary field %s\", name)\n}", "title": "" }, { "docid": "59cb0019dd4680f07d3111bd4ff9f182", "score": "0.46142045", "text": "func (fw *Writer) PutFloat64Field(addr biopb.Coord, v float64) {\n\twb := fw.buf\n\twb.updateAddrBounds(addr)\n\twb.defaultBuf.PutFloat64(v)\n}", "title": "" }, { "docid": "5d2167723abd9f4d278685006c3816ba", "score": "0.46133518", "text": "func (oumuo *OrgUnitMemberUpdateOne) Save(ctx context.Context) (*OrgUnitMember, error) {\n\tvar (\n\t\terr error\n\t\tnode *OrgUnitMember\n\t)\n\tif err := oumuo.defaults(); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(oumuo.hooks) == 0 {\n\t\tif err = oumuo.check(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnode, err = oumuo.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*OrgUnitMemberMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tif err = oumuo.check(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toumuo.mutation = mutation\n\t\t\tnode, err = oumuo.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(oumuo.hooks) - 1; i >= 0; i-- {\n\t\t\tif oumuo.hooks[i] == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"ent: uninitialized hook (forgotten import ent/runtime?)\")\n\t\t\t}\n\t\t\tmut = oumuo.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, oumuo.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "title": "" }, { "docid": "7dc60534b43791452c7408aa2b5708cd", "score": "0.4611119", "text": "func (m *Mmap) AppendUint64(val uint64) error {\n\tif err := m.checkFilePointerOutOfRange(8); err != nil {\n\t\treturn err\n\t}\n\tbinary.LittleEndian.PutUint64(m.MmapBytes[m.FilePointer:m.FilePointer+8], val)\n\tm.FilePointer += 8\n\treturn nil\n}", "title": "" }, { "docid": "b01165e776b44bf0df57cbf65f90887f", "score": "0.46005386", "text": "func (hb *Heartbeat) RenewMemberLease(ctx context.Context) error {\n\tif hb.k8sClient == nil {\n\t\treturn &errors.EtcdError{\n\t\t\tMessage: \"nil clientset passed\",\n\t\t}\n\t}\n\t//Fetch lease associated with member\n\tmemberLease := &v1.Lease{}\n\terr := hb.k8sClient.Get(ctx, client.ObjectKey{\n\t\tNamespace: hb.podNamespace,\n\t\tName: hb.podName,\n\t}, memberLease)\n\tif err != nil {\n\t\treturn &errors.EtcdError{\n\t\t\tMessage: fmt.Sprintf(\"Could not fetch member lease: %v\", err),\n\t\t}\n\t}\n\n\t//Create etcd client to get etcd ID\n\tetcdClient, err := etcdutil.GetTLSClientForEtcd(hb.etcdConfig)\n\tif err != nil {\n\t\treturn &errors.EtcdError{\n\t\t\tMessage: fmt.Sprintf(\"Failed to create etcd client: %v\", err),\n\t\t}\n\t}\n\tdefer etcdClient.Close()\n\tresponse, err := etcdClient.Status(ctx, hb.etcdConfig.Endpoints[0])\n\tif err != nil {\n\t\treturn &errors.EtcdError{\n\t\t\tMessage: fmt.Sprintf(\"Failed to get status of etcd endPoint [ %v ] with error: %v\", hb.etcdConfig.Endpoints[0], err),\n\t\t}\n\t}\n\tmemberID := strconv.FormatUint(response.Header.MemberId, 16)\n\tif response.Header.MemberId == response.Leader {\n\t\tmemberID += \":Leader\"\n\t} else {\n\t\tmemberID += \":Member\"\n\t}\n\n\t//Change HolderIdentity and RenewTime of lease\n\trenewedMemberLease := memberLease.DeepCopy()\n\trenewedMemberLease.Spec.HolderIdentity = &memberID\n\trenewedTime := time.Now()\n\trenewedMemberLease.Spec.RenewTime = &metav1.MicroTime{Time: renewedTime}\n\n\terr = hb.k8sClient.Patch(ctx, renewedMemberLease, client.MergeFrom(memberLease))\n\tif err != nil {\n\t\treturn &errors.EtcdError{\n\t\t\tMessage: fmt.Sprintf(\"Failed to renew member lease: %v\", err),\n\t\t}\n\t}\n\n\thb.logger.Info(\"Renewed member lease for etcd at \", renewedTime)\n\n\treturn nil\n}", "title": "" }, { "docid": "8bbb0803a6e195d432e8377202e3eaa1", "score": "0.45951492", "text": "func (e Entry) Uint64(key string, value uint64) (entry Entry) {\n\tif e.o.enc != nil {\n\t\te.o.Uint64(key, value)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "0b25756bd9b1bbff8746304e1307c6e1", "score": "0.4595048", "text": "func (r *Record) SetField(d *Db, field uint16, data int64) error {\n\tif C.wg_set_field(d.db, r.rec, C.wg_int(field), C.wg_int(data)) != 0 {\n\t\treturn WDBError(\"Could not set field\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "188962f69edc108b02ddad49887f97a4", "score": "0.4593784", "text": "func (m *EndWorkMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase endwork.FieldEndWork:\n\t\tv, ok := value.(time.Time)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetEndWork(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown EndWork field %s\", name)\n}", "title": "" }, { "docid": "b22ed675065b3541f2083d60b9a2146f", "score": "0.4578251", "text": "func (f *FlagSet) Uint64Var(p *uint64, name string, alias rune, value uint64, usage string, fn Callback) {\n\tf.Var(newUint64Value(value, p), name, alias, usage, fn)\n}", "title": "" }, { "docid": "f3d329275718d9a7a486b52bc08c4b9e", "score": "0.45720488", "text": "func (_e *MockWriteBufferJsonBased_Expecter) WriteUint64(logicalName interface{}, bitLength interface{}, value interface{}, writerArgs ...interface{}) *MockWriteBufferJsonBased_WriteUint64_Call {\n\treturn &MockWriteBufferJsonBased_WriteUint64_Call{Call: _e.mock.On(\"WriteUint64\",\n\t\tappend([]interface{}{logicalName, bitLength, value}, writerArgs...)...)}\n}", "title": "" }, { "docid": "56e43283d9f8e104e80589aef3e9b2ce", "score": "0.4568097", "text": "func GetStaticLongField(env *C.JNIEnv, clazz C.jclass, fieldID C.jfieldID) C.jlong {\n\treturn C._GoJniGetStaticLongField(env, clazz, fieldID)\n}", "title": "" }, { "docid": "07423edbbe573d6f862b7b4fd1b7427d", "score": "0.45647323", "text": "func (a *Meta_Longitude) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "title": "" }, { "docid": "d3534caab3d5f72999d56200617e413b", "score": "0.45602915", "text": "func (m *LeaseMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase lease.FieldAddedtime:\n\t\tv, ok := value.(time.Time)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetAddedtime(v)\n\t\treturn nil\n\tcase lease.FieldTenant:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetTenant(v)\n\t\treturn nil\n\tcase lease.FieldNumbtenant:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetNumbtenant(v)\n\t\treturn nil\n\tcase lease.FieldIdtenant:\n\t\tv, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetIdtenant(v)\n\t\treturn nil\n\tcase lease.FieldAgetenant:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetAgetenant(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Lease field %s\", name)\n}", "title": "" }, { "docid": "ff6b64f2d00cb6dcb328f3c3c25e7c5d", "score": "0.45591503", "text": "func (n *node) UpdateField(data interface{}, fieldName string, value interface{}) error {\n\treturn n.update(data, func(ref *reflect.Value, current *reflect.Value, info *modelInfo) error {\n\t\tf := current.FieldByName(fieldName)\n\t\tif !f.IsValid() {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\ttf, _ := current.Type().FieldByName(fieldName)\n\t\tif tf.PkgPath != \"\" {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\tv := reflect.ValueOf(value)\n\t\tif v.Kind() != f.Kind() {\n\t\t\treturn ErrIncompatibleValue\n\t\t}\n\t\tf.Set(v)\n\t\tidxInfo, ok := info.Indexes[fieldName]\n\t\tif ok {\n\t\t\tidxInfo.Value = &f\n\t\t\tidxInfo.IsZero = idxInfo.isZero()\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "98d84b1690e30d0ce4a31b4f7b0205f5", "score": "0.45488486", "text": "func (feature Feature) SetFieldFloat64(index int, value float64) {\n\tC.OGR_F_SetFieldDouble(feature.cval, C.int(index), C.double(value))\n}", "title": "" }, { "docid": "719a52123209cd8a90f2ce862be6f5c4", "score": "0.4547691", "text": "func Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\treturn CommandLine.Uint64(name, alias, value, usage, fn)\n}", "title": "" }, { "docid": "45f808a756df040c038d2c6b41062e79", "score": "0.45407635", "text": "func (b *Buffer) AppendUint64(v uint64) {\n\t//str := strconv.FormatUint(v, 10)\n\t//b.AppendString(str)\n\tb.buf = strconv.AppendUint(b.buf, v, 10)\n}", "title": "" }, { "docid": "7c47986c2709dd236e68ca0418e36916", "score": "0.45381716", "text": "func (u *GuildMemberUpdateEvent) UpdateMember(m *discord.Member) {\n\tm.RoleIDs = u.RoleIDs\n\tm.User = u.User\n\tm.Nick = u.Nick\n\tm.Avatar = u.Avatar\n\tm.IsPending = u.IsPending\n\tm.CommunicationDisabledUntil = u.CommunicationDisabledUntil\n}", "title": "" }, { "docid": "f7cfc4c923116992ca09905a88560b7b", "score": "0.45354384", "text": "func (v *Uint64) Set(s string) error {\n\tx, err := ParseUint64(s)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\t*v = x\n\treturn nil\n}", "title": "" }, { "docid": "a31886bd6fcb0423dcaa87a66a8d0fe5", "score": "0.45353562", "text": "func (m *MemberMutation) ResetField(name string) error {\n\tswitch name {\n\tcase member.FieldMEMBERID:\n\t\tm.ResetMEMBERID()\n\t\treturn nil\n\tcase member.FieldMEMBERNAME:\n\t\tm.ResetMEMBERNAME()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Member field %s\", name)\n}", "title": "" }, { "docid": "61c5246b432d5ad9e16057d8429ba3a8", "score": "0.4528631", "text": "func (m *OrgUnitMemberMutation) AddField(name string, value ent.Value) error {\n\tswitch name {\n\t}\n\treturn fmt.Errorf(\"unknown OrgUnitMember numeric field %s\", name)\n}", "title": "" }, { "docid": "c5797b950916af29cd6b5eddf3a5f65e", "score": "0.45211148", "text": "func (v *Value) SetUInt64(val uint64) {\n\tC.g_value_set_uint64(v.Native(), C.guint64(val))\n}", "title": "" }, { "docid": "7c83a259bf55b2d0976839771b6e2eb1", "score": "0.45149845", "text": "func (m *NumberTokenMutation) SetField(name string, value ent.Value) error {\n\tswitch name {\n\tcase numbertoken.FieldValue:\n\t\tv, ok := value.(int)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected type %T for field %s\", value, name)\n\t\t}\n\t\tm.SetValue(v)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown NumberToken field %s\", name)\n}", "title": "" }, { "docid": "c4d7df78b1af0ef24604b7e9120db8a4", "score": "0.45127237", "text": "func UpdateAlias(tok *structToken, field, alias string) string {\n\tlog.Printf(\"update alias field %s original alias %s\\n\", field, alias)\n\tif !strings.Contains(field, \".\") {\n\t\treturn alias\n\t}\n\tprts := strings.Split(field, \".\")\n\tlookup := strings.TrimPrefix(prts[0], \"proxy\")\n\tvar result string\n\tif result = lookUpAlias(tok.relations, lookup, prts); result != \"\" {\n\t\treturn result\n\t}\n\treturn alias\n}", "title": "" }, { "docid": "d0c46e2ed41d67efd164e5b3ee0c2d76", "score": "0.45077392", "text": "func (game *Game) SetOneField(fieldNr int, symbol string) bool {\n\tif !game.GameStarted() {\n\t\tglog.Warningf(\"Executed UpdateField before game started fieldNr %v, symbol %v\", fieldNr, symbol)\n\t\treturn false\n\t}\n\tif game.turn != symbol {\n\t\tglog.Warningf(\"Exectued UpdateField with symbol where it is not its turn(%v) %v\", game.turn, symbol)\n\t\treturn false\n\t}\n\tif game.field[fieldNr] != \"\" {\n\t\tglog.Warningf(\"Exectued UpdateField with already used field(%v) %v\", game.turn, symbol)\n\t\treturn false\n\t}\n\tgame.ToogleTurn()\n\tgame.field[fieldNr] = symbol\n\treturn true\n}", "title": "" }, { "docid": "f8187c84b47b60bbb131995385093ca6", "score": "0.45049918", "text": "func withOrgUnitMemberID(id int) orgunitmemberOption {\n\treturn func(m *OrgUnitMemberMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *OrgUnitMember\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*OrgUnitMember, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().OrgUnitMember.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "title": "" }, { "docid": "ebc858965acdb34afb5d48f56539e3de", "score": "0.45026517", "text": "func (c *C) LongLong() Type {\n\treturn IntT(8)\n}", "title": "" }, { "docid": "abc5e17b207403c491d9995f4a2f8a7c", "score": "0.45004088", "text": "func (w *Packer) PutUint64(v uint64) {\n\tbinary.LittleEndian.PutUint64(w.scratch[:], v)\n\t_, _ = w.buf.Write(w.scratch[:8])\n}", "title": "" } ]
eb7dc7a01b8ebfc57ce763363c6245e4
Send marshals and sends the ResetInstanceAttribute API request.
[ { "docid": "28bbcbaaa7406e66cbd18f1abdfc6f79", "score": "0.73900676", "text": "func (r ResetInstanceAttributeRequest) Send(ctx context.Context) (*ResetInstanceAttributeResponse, 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 := &ResetInstanceAttributeResponse{\n\t\tResetInstanceAttributeOutput: r.Request.Data.(*ResetInstanceAttributeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" } ]
[ { "docid": "407093795bea99edb525210e49720c31", "score": "0.635919", "text": "func (r ResetImageAttributeRequest) Send(ctx context.Context) (*ResetImageAttributeResponse, 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 := &ResetImageAttributeResponse{\n\t\tResetImageAttributeOutput: r.Request.Data.(*ResetImageAttributeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ad8455ffe07f2e4b3f70acb1310d4f52", "score": "0.5152128", "text": "func ResetAttrs() {\n\temitEscape(\"m\")\n}", "title": "" }, { "docid": "714899c5cb879d4c02345911670c7d76", "score": "0.51373965", "text": "func (as *Server) Reset(w http.ResponseWriter, r *http.Request) {\n\tswitch {\n\tcase r.Method == \"POST\":\n\t\tu := ctx.Get(r, \"user\").(models.User)\n\t\tu.ApiKey = auth.GenerateSecureKey(auth.APIKeyLength)\n\t\terr := models.PutUser(&u)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Error setting API Key\", http.StatusInternalServerError)\n\t\t} else {\n\t\t\tJSONResponse(w, models.Response{Success: true, Message: \"API Key successfully reset!\", Data: u.ApiKey}, http.StatusOK)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31c7345fc705dc4845a420455c79e51a", "score": "0.50955933", "text": "func (a *Client) Reset(params *ResetParams) (*ResetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewResetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Reset\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/predict/reset\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ResetReader{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.(*ResetOK), nil\n\n}", "title": "" }, { "docid": "112ec486f3fd9fb254f589a6dd00d414", "score": "0.5009558", "text": "func (r DeregisterManagedInstanceRequest) Send() (*DeregisterManagedInstanceOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*DeregisterManagedInstanceOutput), nil\n}", "title": "" }, { "docid": "df49d7a9f1b6aac84e2c9b3931eb7028", "score": "0.49945015", "text": "func (e *ExternalInterface) ResetSecureBoot(ctx context.Context, req *systemsproto.SecureBootRequest, pc *PluginContact, taskID string) {\r\n\tvar resp response.RPC\r\n\tvar targetURI = \"/redfish/v1/Systems/\" + req.SystemID + \"/Actions/SecureBoot.ResetKeys\"\r\n\r\n\ttaskInfo := &common.TaskUpdateInfo{Context: ctx, TaskID: taskID, TargetURI: targetURI,\r\n\t\tUpdateTask: pc.UpdateTask, TaskRequest: string(req.RequestBody)}\r\n\r\n\t// spliting the uuid and system id\r\n\trequestData := strings.SplitN(req.SystemID, \".\", 2)\r\n\tif len(requestData) <= 1 {\r\n\t\terrorMessage := \"error: SystemUUID not found\"\r\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage,\r\n\t\t\t[]interface{}{\"System\", req.SystemID}, taskInfo)\r\n\t\treturn\r\n\t}\r\n\r\n\tuuid := requestData[0]\r\n\ttarget, gerr := e.DB.GetTarget(uuid)\r\n\tif gerr != nil {\r\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound,\r\n\t\t\tgerr.Error(), []interface{}{\"System\", uuid}, taskInfo)\r\n\t\treturn\r\n\t}\r\n\r\n\tvar reset smodel.ResetSecureBoot\r\n\t// unmarshalling the volume\r\n\terr := json.Unmarshal(req.RequestBody, &reset)\r\n\tif err != nil {\r\n\t\terrorMessage := \"Error while unmarshaling the create volume request: \" + err.Error()\r\n\t\tif StringContain(err.Error(), \"smodel.OdataIDLink\") {\r\n\t\t\terrorMessage = \"Error processing create volume request: @odata.id key(s) is missing in Drives list\"\r\n\t\t}\r\n\t\tl.LogWithFields(ctx).Error(errorMessage)\r\n\t\tcommon.GeneralError(http.StatusBadRequest, response.MalformedJSON, errorMessage, []interface{}{}, taskInfo)\r\n\t\treturn\r\n\t}\r\n\r\n\t// Validating the request JSON properties for case sensitive\r\n\tinvalidProperties, err := RequestParamsCaseValidatorFunc(req.RequestBody, reset)\r\n\tif err != nil {\r\n\t\terrMsg := \"error while validating request parameters for volume creation: \" + err.Error()\r\n\t\tl.LogWithFields(ctx).Error(errMsg)\r\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\r\n\t\treturn\r\n\t} else if invalidProperties != \"\" {\r\n\t\terrorMessage := \"error: one or more properties given in the request body are not valid, ensure properties are listed in uppercamelcase \"\r\n\t\tl.LogWithFields(ctx).Error(errorMessage)\r\n\t\tcommon.GeneralError(http.StatusBadRequest, response.PropertyUnknown, errorMessage, []interface{}{invalidProperties}, taskInfo)\r\n\t\treturn\r\n\t}\r\n\r\n\tdecryptedPasswordByte, err := e.DevicePassword(target.Password)\r\n\tif err != nil {\r\n\t\terrorMessage := \"error while trying to decrypt device password: \" + err.Error()\r\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\r\n\t\treturn\r\n\t}\r\n\ttarget.Password = decryptedPasswordByte\r\n\t// Get the Plugin info\r\n\tplugin, gerr := e.DB.GetPluginData(target.PluginID)\r\n\tif gerr != nil {\r\n\t\terrorMessage := \"error while trying to get plugin details\"\r\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\r\n\t\treturn\r\n\t}\r\n\r\n\tvar contactRequest scommon.PluginContactRequest\r\n\tcontactRequest.ContactClient = e.ContactClient\r\n\tcontactRequest.Plugin = plugin\r\n\tcontactRequest.GetPluginStatus = e.GetPluginStatus\r\n\r\n\tif StringsEqualFold(plugin.PreferredAuthType, \"XAuthToken\") {\r\n\t\tvar err error\r\n\t\tcontactRequest.HTTPMethodType = http.MethodPost\r\n\t\tcontactRequest.DeviceInfo = map[string]interface{}{\r\n\t\t\t\"UserName\": plugin.Username,\r\n\t\t\t\"Password\": string(plugin.Password),\r\n\t\t}\r\n\t\tcontactRequest.OID = \"/ODIM/v1/Sessions\"\r\n\t\t_, token, _, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while creating session with the plugin: \")\r\n\r\n\t\tif err != nil {\r\n\t\t\tcommon.GeneralError(getResponse.StatusCode, getResponse.StatusMessage, err.Error(), nil, taskInfo)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tcontactRequest.Token = token\r\n\t} else {\r\n\t\tcontactRequest.BasicAuth = map[string]string{\r\n\t\t\t\"UserName\": plugin.Username,\r\n\t\t\t\"Password\": string(plugin.Password),\r\n\t\t}\r\n\r\n\t}\r\n\ttarget.PostBody = req.RequestBody\r\n\r\n\tcontactRequest.HTTPMethodType = http.MethodPost\r\n\tcontactRequest.DeviceInfo = target\r\n\tcontactRequest.OID = fmt.Sprintf(\"/ODIM/v1/Systems/%s/SecureBoot/Actions/SecureBoot.ResetKeys\", requestData[1])\r\n\r\n\tbody, location, pluginIP, getResponse, err := ContactPluginFunc(ctx, contactRequest, \"error while resetting secure boot: \")\r\n\tif err != nil {\r\n\t\tresp.StatusCode = getResponse.StatusCode\r\n\t\tjson.Unmarshal(body, &resp.Body)\r\n\t\terrMsg := \"error while resetting secure boot: \" + err.Error()\r\n\t\tl.LogWithFields(ctx).Error(errMsg)\r\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\r\n\t\t\tcommon.Completed, common.Warning, 100, http.MethodPost)\r\n\t\tpc.UpdateTask(ctx, task)\r\n\t\treturn\r\n\t}\r\n\tif getResponse.StatusCode == http.StatusAccepted {\r\n\t\terr = pc.SavePluginTaskInfo(ctx, pluginIP, plugin.IP, taskID, location)\r\n\t\tif err != nil {\r\n\t\t\tl.LogWithFields(ctx).Error(err)\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\r\n\tresp.StatusCode = http.StatusOK\r\n\tresp.StatusMessage = response.Success\r\n\terr = JSONUnmarshalFunc(body, &resp.Body)\r\n\tif err != nil {\r\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, err.Error(), nil, taskInfo)\r\n\t\treturn\r\n\t}\r\n\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\r\n\t\tcommon.Completed, common.OK, 100, http.MethodPost)\r\n\tpc.UpdateTask(ctx, task)\r\n}", "title": "" }, { "docid": "755f7378fc6f66ebd9b98d8d50e38ae9", "score": "0.4933436", "text": "func (r ModifyVpcAttributeRequest) Send(ctx context.Context) (*ModifyVpcAttributeResponse, 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 := &ModifyVpcAttributeResponse{\n\t\tModifyVpcAttributeOutput: r.Request.Data.(*ModifyVpcAttributeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "8a1343e593ac9877a80e0cff055b3e49", "score": "0.49042544", "text": "func (r ResetDBParameterGroupRequest) Send(ctx context.Context) (*ResetDBParameterGroupResponse, 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 := &ResetDBParameterGroupResponse{\n\t\tResetDBParameterGroupOutput: r.Request.Data.(*ResetDBParameterGroupOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ca9a7ac977af862531988100229b212f", "score": "0.47658768", "text": "func (client *Client) ModifyInstanceAttributeWithOptions(request *ModifyInstanceAttributeRequest, runtime *util.RuntimeOptions) (_result *ModifyInstanceAttributeResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.InstanceId)) {\n\t\tquery[\"InstanceId\"] = request.InstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.InstanceName)) {\n\t\tquery[\"InstanceName\"] = request.InstanceName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.InstanceReleaseProtection)) {\n\t\tquery[\"InstanceReleaseProtection\"] = request.InstanceReleaseProtection\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.NewPassword)) {\n\t\tquery[\"NewPassword\"] = request.NewPassword\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"ModifyInstanceAttribute\"),\n\t\tVersion: tea.String(\"2015-01-01\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &ModifyInstanceAttributeResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "09ed2d4dbb12fe2156debc416539e1d1", "score": "0.47626358", "text": "func (v *ConstructionDeriveRequest) Reset() {\n\tv.Metadata = v.Metadata[:0]\n\tv.PublicKey.Reset()\n}", "title": "" }, { "docid": "a147c5eb22dba01ff1d70d26ef10ff1f", "score": "0.47245726", "text": "func (v *NetworkRequest) Reset() {\n\tv.Metadata = v.Metadata[:0]\n}", "title": "" }, { "docid": "f891e41ae7f9ad748351779aecbc34d6", "score": "0.4696806", "text": "func (r *ProjectsLocationsInstancesService) Reset(name string, resetinstancerequest *ResetInstanceRequest) *ProjectsLocationsInstancesResetCall {\n\tc := &ProjectsLocationsInstancesResetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.resetinstancerequest = resetinstancerequest\n\treturn c\n}", "title": "" }, { "docid": "75ffe361c909cca3b97fa3cc3204bd92", "score": "0.46896267", "text": "func (r PutAttributesRequest) Send(ctx context.Context) (*PutAttributesResponse, 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 := &PutAttributesResponse{\n\t\tPutAttributesOutput: r.Request.Data.(*PutAttributesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "6c9130ae9186e14809143e1a055c1291", "score": "0.4682925", "text": "func (v *ConstructionPayloadsRequest) Reset() {\n\tv.Metadata = v.Metadata[:0]\n\tv.Operations = v.Operations[:0]\n\tv.PublicKeys = v.PublicKeys[:0]\n}", "title": "" }, { "docid": "cb8139e8d26992108b77eed172cb334d", "score": "0.46824846", "text": "func (r ModifyDBSnapshotAttributeRequest) Send(ctx context.Context) (*ModifyDBSnapshotAttributeResponse, 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 := &ModifyDBSnapshotAttributeResponse{\n\t\tModifyDBSnapshotAttributeOutput: r.Request.Data.(*ModifyDBSnapshotAttributeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "4d81adc071f4c76f3878375370f79706", "score": "0.4668391", "text": "func (r DeregisterPatchBaselineForPatchGroupRequest) Send(ctx context.Context) (*DeregisterPatchBaselineForPatchGroupResponse, 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 := &DeregisterPatchBaselineForPatchGroupResponse{\n\t\tDeregisterPatchBaselineForPatchGroupOutput: r.Request.Data.(*DeregisterPatchBaselineForPatchGroupOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "bac76c5f364ce9a116bd1da28f5670be", "score": "0.46644375", "text": "func ModelResetHandler(w http.ResponseWriter, r *http.Request) {\n model.GetModel().Reset()\n}", "title": "" }, { "docid": "3703c4b18d92c550e5f61337a89fabe1", "score": "0.4634932", "text": "func Reset(svc ec2iface.EC2API, writer io.Writer, name string, dryRun bool) error {\n\t// query the ec2 api, filtering by name tag\n\toutput, err := svc.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"tag:Name\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(strings.Join([]string{\"*\", name, \"*\"}, \"\")),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\n\t// bubble up any errors\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// verify we have a non nil output\n\tif output == nil {\n\t\treturn nil\n\t}\n\n\t// initialize a slice to hold the ids for the reboot\n\tids := []*string{}\n\n\t// write out the private ip addresses, and store instance ids for reboot\n\tfor _, r := range output.Reservations {\n\t\tif r.Instances == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, i := range r.Instances {\n\t\t\tvar buf bytes.Buffer\n\n\t\t\tif i.PrivateIpAddress != nil {\n\t\t\t\tbuf.WriteString(*i.PrivateIpAddress)\n\t\t\t\tbuf.WriteRune('\\n')\n\t\t\t\tbuf.WriteTo(writer)\n\t\t\t}\n\n\t\t\tif i.InstanceId != nil {\n\t\t\t\tids = append(ids, i.InstanceId)\n\t\t\t}\n\t\t}\n\t}\n\n\t// reboot instances\n\tif dryRun == false {\n\t\tsvc.RebootInstances(&ec2.RebootInstancesInput{InstanceIds: ids})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e06e5383589266a41d132525f5d7cbfe", "score": "0.46254557", "text": "func (v *MempoolTransactionRequest) Reset() {\n\tv.TransactionIdentifier.Reset()\n}", "title": "" }, { "docid": "5a979a47838b574c09d9036908f47214", "score": "0.4621362", "text": "func (wAPI WalletAPI) Reset(scanHeight uint64) error {\n\t_, _, err := wAPI.sendRequest(\n\t\t\"PUT\",\n\t\twAPI.Host+\":\"+wAPI.Port+\"/reset\",\n\t\tmakeJSONString(map[string]interface{}{\n\t\t\t\"scanHeight\": scanHeight,\n\t\t}),\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "034cf6f1eee83061de7620762d5cc637", "score": "0.46183223", "text": "func (c *Client) RebootInstance(instanceId string, forceStop bool) error {\n\targs := &StopInstanceArgs{\n\t\tForceStop: forceStop,\n\t}\n\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn RebootInstance(c, instanceId, body)\n}", "title": "" }, { "docid": "999ea384041010dfdfe1ad3eef6322b2", "score": "0.46054617", "text": "func (r UpdateManagedInstanceRoleRequest) Send() (*UpdateManagedInstanceRoleOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*UpdateManagedInstanceRoleOutput), nil\n}", "title": "" }, { "docid": "6ef39c4fc78071785f9306fb9d5e20ad", "score": "0.45798257", "text": "func (r ModifyFpgaImageAttributeRequest) Send(ctx context.Context) (*ModifyFpgaImageAttributeResponse, 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 := &ModifyFpgaImageAttributeResponse{\n\t\tModifyFpgaImageAttributeOutput: r.Request.Data.(*ModifyFpgaImageAttributeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "03066473f6e808c293e05da92c7d171d", "score": "0.4573432", "text": "func (v *ConstructionMetadataRequest) Reset() {\n\tv.Options = v.Options[:0]\n\tv.PublicKeys = v.PublicKeys[:0]\n}", "title": "" }, { "docid": "040adde4e38a2d4039c25b7f93e20ff0", "score": "0.4546032", "text": "func Reset(serviceUrl string) error {\n\n\t// Send request to service\n\tres, err := http.Post(serviceUrl+\"/reset\",\n\t\t\"application/x-www-form-urlencoded\", nil)\n\tres.Body.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to reset memberlist (%v): %v\\n\", serviceUrl, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9137fcae8b6ab540c4039fdc3a9d48e4", "score": "0.45401728", "text": "func (v *ConstructionPreprocessRequest) Reset() {\n\tv.MaxFee = v.MaxFee[:0]\n\tv.Metadata = v.Metadata[:0]\n\tv.Operations = v.Operations[:0]\n\tv.SuggestedFeeMultiplier.Value = 0\n\tv.SuggestedFeeMultiplier.Set = false\n}", "title": "" }, { "docid": "9ab3926336c594f8c313227b248ee623", "score": "0.45384583", "text": "func (v *BlockRequest) Reset() {\n\tv.BlockIdentifier.Reset()\n}", "title": "" }, { "docid": "de71587d5611159773f1ac954418b101", "score": "0.4526277", "text": "func (r DeleteInstanceRequest) Send(ctx context.Context) (*DeleteInstanceResponse, 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 := &DeleteInstanceResponse{\n\t\tDeleteInstanceOutput: r.Request.Data.(*DeleteInstanceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "de71587d5611159773f1ac954418b101", "score": "0.4526277", "text": "func (r DeleteInstanceRequest) Send(ctx context.Context) (*DeleteInstanceResponse, 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 := &DeleteInstanceResponse{\n\t\tDeleteInstanceOutput: r.Request.Data.(*DeleteInstanceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a4200e4ded026cf48a60d3adb150de4c", "score": "0.45041257", "text": "func marshalUpdateInstanceUpdateInstanceRequest(c *Client, m map[string]interface{}) ([]byte, error) {\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "51a162c83179a9a2bc8a136b705f2084", "score": "0.45018607", "text": "func (r UpdateIPSetRequest) Send(ctx context.Context) (*UpdateIPSetResponse, 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 := &UpdateIPSetResponse{\n\t\tUpdateIPSetOutput: r.Request.Data.(*UpdateIPSetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "a271e6ce4caf6a75c7d8d446ef28d3e1", "score": "0.44890857", "text": "func (v *BlockTransactionRequest) Reset() {\n\tv.BlockIdentifier.Reset()\n\tv.TransactionIdentifier.Reset()\n}", "title": "" }, { "docid": "12ba245262be0d877f70dca1ba4ae681", "score": "0.4463619", "text": "func (v *AccountBalanceRequest) Reset() {\n\tv.AccountIdentifier.Reset()\n\tv.BlockIdentifier.Value.Reset()\n\tv.BlockIdentifier.Set = false\n\tv.Currencies = v.Currencies[:0]\n}", "title": "" }, { "docid": "75cc122c407a2f23c8d4b75d1a68b558", "score": "0.4453678", "text": "func (r UpdateRegexPatternSetRequest) Send(ctx context.Context) (*UpdateRegexPatternSetResponse, 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 := &UpdateRegexPatternSetResponse{\n\t\tUpdateRegexPatternSetOutput: r.Request.Data.(*UpdateRegexPatternSetOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "278385313296e3a7729bff6587d8f89e", "score": "0.4447561", "text": "func (v *ConstructionDeriveResponse) Reset() {\n\tv.AccountIdentifier.Value.Reset()\n\tv.AccountIdentifier.Set = false\n\tv.Address.Value = \"\"\n\tv.Address.Set = false\n\tv.Metadata = v.Metadata[:0]\n}", "title": "" }, { "docid": "47fdd62d43743ca4263b2adf9ad64abf", "score": "0.44447806", "text": "func (v *CallRequest) Reset() {\n\tv.Method = \"\"\n\tv.Parameters = v.Parameters[:0]\n}", "title": "" }, { "docid": "c10b425ea2afed3e1facc5dbec8364d2", "score": "0.44382977", "text": "func (a *Address) reset() {\n\ta.Host = a.Host[:0]\n\tfor i := range a.IP {\n\t\ta.IP[i] = 0\n\t}\n\ta.Type = AddressIPv4\n}", "title": "" }, { "docid": "d7a90be91c6c4d52a4b7d83a64462451", "score": "0.44375372", "text": "func (v *SigningPayload) Reset() {\n\tv.AccountIdentifier.Value.Reset()\n\tv.AccountIdentifier.Set = false\n\tv.Address.Value = \"\"\n\tv.Address.Set = false\n\tv.Bytes = v.Bytes[:0]\n\tv.SignatureType.Value = \"\"\n\tv.SignatureType.Set = false\n}", "title": "" }, { "docid": "73dc491a13a3e467792a79f35ae776f6", "score": "0.44259557", "text": "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsTeInterfaceAttributes(ctx context.Context, name 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-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:te-interface-attributes/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -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": "bfd74387d526615d3fe9e189821f34f5", "score": "0.44247139", "text": "func (c *Client) Reset() (*http.Response, error) {\n\treturn c.post(\"/reset\", nil)\n}", "title": "" }, { "docid": "55e55232f8b9d98a47537cfd42a3322d", "score": "0.44030854", "text": "func (v *NullableNotebookCellUpdateRequestAttributes) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "5f7329d6c592fab52fc036d7bb97b4ad", "score": "0.43974692", "text": "func TestMarshalAssignIPAddressRequest(t *testing.T) {\n\trequest := AssignIPAddressRequest{\n\t\tAccess: upcloud.IPAddressAccessPublic,\n\t\tFamily: upcloud.IPAddressFamilyIPv4,\n\t\tServerUUID: \"009d64ef-31d1-4684-a26b-c86c955cbf46\",\n\t}\n\n\tbyteXml, err := xml.Marshal(&request)\n\tassert.Nil(t, err)\n\texpectedXML := \"<ip_address><access>public</access><family>IPv4</family><server>009d64ef-31d1-4684-a26b-c86c955cbf46</server></ip_address>\"\n\tactualXML := string(byteXml)\n\tassert.Equal(t, expectedXML, actualXML)\n\n\t// Omit family\n\trequest = AssignIPAddressRequest{\n\t\tAccess: upcloud.IPAddressAccessPublic,\n\t\tServerUUID: \"009d64ef-31d1-4684-a26b-c86c955cbf46\",\n\t}\n\n\tbyteXml, err = xml.Marshal(&request)\n\tassert.Nil(t, err)\n\n\texpectedXML = \"<ip_address><access>public</access><server>009d64ef-31d1-4684-a26b-c86c955cbf46</server></ip_address>\"\n\tactualXML = string(byteXml)\n\tassert.Equal(t, expectedXML, actualXML)\n\n}", "title": "" }, { "docid": "0cecb018203a3eca10eefef9624d12c6", "score": "0.43805525", "text": "func (c *Candidate) Reset() {\n\tc.ConnectionAddress.reset()\n\tc.RelatedAddress.reset()\n\tc.RelatedPort = 0\n\tc.NetworkCost = 0\n\tc.Generation = 0\n\tc.Transport = ct.ProtocolUnknown\n\tc.TransportValue = c.TransportValue[:0]\n\tc.Attributes = c.Attributes[:0]\n}", "title": "" }, { "docid": "8d614d5afd56de482760141097fa17c1", "score": "0.4375217", "text": "func (w *Wire) Reset(id uint32) {\n\tw.SetOutput(false)\n\tw.SetValue(Unknown)\n\tw.SetID(id)\n\tw.input = nil\n\tw.DisconnectOutputs()\n}", "title": "" }, { "docid": "94ae72a3a99d06d91cb2068ec477f0de", "score": "0.4365183", "text": "func (r ModifyDBInstanceRequest) Send(ctx context.Context) (*ModifyDBInstanceResponse, 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 := &ModifyDBInstanceResponse{\n\t\tModifyDBInstanceOutput: r.Request.Data.(*ModifyDBInstanceOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "dfb33a6cf0966c227d0af12ff9f241e6", "score": "0.43595132", "text": "func (v *NetworkOptionsResponse) Reset() {\n\tv.Allow.Reset()\n\tv.Version.Reset()\n}", "title": "" }, { "docid": "f8d40032148d4104fc8417f233ad8fa9", "score": "0.43588233", "text": "func (c RouterClient) Reboot() error {\n\ttype RebootRequest struct {\n\t\tXMLName xml.Name `xml:\"request\"`\n\t\tControl int `xml:\"Control\"`\n\t}\n\n\trebootRequest := RebootRequest{\n\t\tControl: 1,\n\t}\n\n\treboot, err := xml.Marshal(rebootRequest)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", c.routerURL+controlURL, bytes.NewReader(reboot))\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\")\n\treq.Header.Add(\"Content-Length\", strconv.Itoa(len(reboot)))\n\treq.Header.Add(requestVerificationToken, c.requestVerificationToken)\n\tresponse, err := c.client.Do(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttype ErrorReponse struct {\n\t\tXMLName xml.Name `xml:\"error\"`\n\t\tCode int `xml:\"code\"`\n\t\tMessage string `xml:\"message\"`\n\t}\n\n\tresponseData, _ := ioutil.ReadAll(response.Body)\n\te := ErrorReponse{}\n\terr = xml.Unmarshal(responseData, &e)\n\n\tif err == nil {\n\t\treturn fmt.Errorf(\"error rebooting router, response %v\", e)\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "765df870b0f8fcea3d86e5857c3b147e", "score": "0.43527633", "text": "func (m *RebootInstanceRequest) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "10b9aee4b4bf4fd2563b322011530a17", "score": "0.43527144", "text": "func (input *BeegoInput) Reset(ctx *Context) {\n\tinput.Context = ctx\n\tinput.CruSession = nil\n\tinput.pnames = input.pnames[:0]\n\tinput.pvalues = input.pvalues[:0]\n\tinput.dataLock.Lock()\n\tinput.data = nil\n\tinput.dataLock.Unlock()\n\tinput.RequestBody = []byte{}\n}", "title": "" }, { "docid": "2ee72eb2626c29ef6ebf662b582a61df", "score": "0.43441895", "text": "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceEncapsulation(ctx context.Context, name 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-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:encapsulation/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -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": "73fde14e6bb5e01c01ad11e2382497a1", "score": "0.43415228", "text": "func (client BaseClient) DisableFeatureInstanceSender(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": "d6fc288060af93df68a625967f582cc7", "score": "0.43414894", "text": "func (v *ConstructionSubmitRequest) Reset() {\n\tv.SignedTransaction = \"\"\n}", "title": "" }, { "docid": "0c23e378ea7207b9504ceea23888f39f", "score": "0.4330663", "text": "func (s *Service) Reset(id int64) *ResetCall {\n\tc := &ResetCall{s: s, urlParams_: make(gensupport.URLParams)}\n\tc.id = id\n\treturn c\n}", "title": "" }, { "docid": "77121983a1be252ba6de8e61835190ef", "score": "0.43279615", "text": "func (r RevokeInvitationRequest) Send(ctx context.Context) (*RevokeInvitationResponse, 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 := &RevokeInvitationResponse{\n\t\tRevokeInvitationOutput: r.Request.Data.(*RevokeInvitationOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "9e256793c1c9a4e24811461666a58b9a", "score": "0.43236586", "text": "func (self *SinglePad) Reset() {\n self.Object.Call(\"reset\")\n}", "title": "" }, { "docid": "acfbbd4576346ee55e47f32743c01f75", "score": "0.43218833", "text": "func (r UpdateDeviceStateRequest) Send(ctx context.Context) (*UpdateDeviceStateResponse, 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 := &UpdateDeviceStateResponse{\n\t\tUpdateDeviceStateOutput: r.Request.Data.(*UpdateDeviceStateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "ac4449a2c858221ce5722fe7760c5535", "score": "0.4320179", "text": "func (tm *Motor) Reset() error {\n\treturn writeAttrString(tm.Descriptor.Path, \"command\", commandReset)\n}", "title": "" }, { "docid": "efc4a53fb8b975d950bc95f675d8e6d8", "score": "0.4318967", "text": "func (im InputMethod) ResetSettings(tconn *chrome.TestConn) action.Action {\n\treturn im.SetSettings(tconn, map[string]interface{}{})\n}", "title": "" }, { "docid": "d2c244570a8b87df0fb73e629e868aef", "score": "0.43175915", "text": "func (v *ConstructionHashRequest) Reset() {\n\tv.SignedTransaction = \"\"\n}", "title": "" }, { "docid": "ee44a182aee0b1831a5f87ac456c874c", "score": "0.430934", "text": "func (r UpdateMLModelRequest) Send(ctx context.Context) (*UpdateMLModelResponse, 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 := &UpdateMLModelResponse{\n\t\tUpdateMLModelOutput: r.Request.Data.(*UpdateMLModelOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "4481c7286ca8f1cfdb11968386ff1bc5", "score": "0.43091625", "text": "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsTeGlobalAttributes(ctx context.Context, name 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-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:te-global-attributes/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -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": "ab77d73f0d7acf7c4cc1c2abf52153e8", "score": "0.4301042", "text": "func ResetWithAttr(sb *strings.Builder) {\n\tsb.WriteString(string(AttrReset))\n\tsb.WriteString(string(BgDefault))\n\tsb.WriteString(string(FgDefault))\n}", "title": "" }, { "docid": "970caba8f3d584aab34b7bccaf6d70a1", "score": "0.430028", "text": "func (m Miner) Reboot() error {\n\tclient, err := jsonrpc.Dial(\"tcp\", m.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer client.Close()\n\targs.psw = m.Password\n\treturn client.Call(methodReboot, args, nil)\n}", "title": "" }, { "docid": "41036b3593f47cc26bf980ee2de26816", "score": "0.42987004", "text": "func (sb *spdkBackend) reset(req storage.BdevPrepareRequest, vmdDetect vmdDetectFn) (*storage.BdevPrepareResponse, error) {\n\tresp := &storage.BdevPrepareResponse{}\n\n\t// Update request if VMD has been explicitly enabled and there are VMD endpoints configured.\n\tif err := updatePrepareRequest(sb.log, &req, vmdDetect); err != nil {\n\t\treturn resp, errors.Wrapf(err, \"update prepare request\")\n\t}\n\tresp.VMDPrepared = req.EnableVMD\n\n\treturn resp, errors.Wrap(sb.script.Reset(&req), \"unbinding nvme devices from userspace drivers\")\n}", "title": "" }, { "docid": "a8fba64012e6f184237c814c17f2a6ec", "score": "0.42976126", "text": "func Reset(c *fiber.Ctx) error {\n\tvar data map[string]string\n\n\terr := c.BodyParser(&data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif data[\"password\"] != data[\"password_confirm\"] {\n\t\tc.Status(400)\n\t\treturn c.JSON(fiber.Map{\n\t\t\t\"messgae\": \"Passwords do not match\",\n\t\t})\n\t}\n\n\tvar passwordReset = models.PasswordReset{}\n\n\tif err := database.DB.Where(\"token = ?\", data[\"token\"]).Last(&passwordReset); err.Error != nil {\n\t\tc.Status(400)\n\t\treturn c.JSON(fiber.Map{\n\t\t\t\"messgae\": \"Invalid Token!\",\n\t\t})\n\t}\n\n\tpassword, _ := bcrypt.GenerateFromPassword([]byte(data[\"password\"]), 14)\n\n\tdatabase.DB.Model(&models.User{}).Where(\"email = ?\", passwordReset.Email).Update(\"password\", password)\n\n\treturn c.JSON(fiber.Map{\n\t\t\"message\": \"Password reset successful\",\n\t})\n\n}", "title": "" }, { "docid": "76ff3c7a307f5e6dc5f9bcd28de567e3", "score": "0.4297002", "text": "func (a *DefaultApiService) RebootVM(ctx _context.Context) (*_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\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vm.reboot\"\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{}\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\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "597170104c8af07247dbf84ce3d37520", "score": "0.42877063", "text": "func (v *MempoolTransactionResponse) Reset() {\n\tv.Metadata = v.Metadata[:0]\n\tv.Transaction.Reset()\n}", "title": "" }, { "docid": "031da3b223ce85594a2002ab309b20be", "score": "0.42820075", "text": "func (O *Object) ResetAttributes() error {\n\tvar data Data\n\tfor _, attr := range O.Attributes {\n\t\tdata.reset()\n\t\tdata.NativeTypeNum = attr.NativeTypeNum\n\t\tdata.ObjectType = attr.ObjectType\n\t\tif attr.NativeTypeNum == C.DPI_NATIVE_TYPE_BYTES && attr.OracleTypeNum == C.DPI_ORACLE_TYPE_NUMBER {\n\t\t\ta := make([]byte, attr.Precision)\n\t\t\tC.dpiData_setBytes(&data.dpiData, (*C.char)(unsafe.Pointer(&a[0])), C.uint32_t(attr.Precision))\n\t\t}\n\t\tif C.dpiObject_setAttributeValue(O.dpiObject, attr.dpiObjectAttr, data.NativeTypeNum, &data.dpiData) == C.DPI_FAILURE {\n\t\t\treturn O.getError()\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "168aadeaa0cb0fe3ca7b11d2e74b943d", "score": "0.42768353", "text": "func (r DeleteInstanceBackupRuleRequest) Send(ctx context.Context) (*DeleteInstanceBackupRuleResponse, 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 := &DeleteInstanceBackupRuleResponse{\n\t\tDeleteInstanceBackupRuleOutput: r.Request.Data.(*DeleteInstanceBackupRuleOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "640e0c245dc19dbd86c6fae99ccc55c7", "score": "0.42765605", "text": "func (o *ProcessorSignalDecisionReportRequest) UnsetAmountInstantlyAvailable() {\n\to.AmountInstantlyAvailable.Unset()\n}", "title": "" }, { "docid": "5816a59fb632dd48587377e315137f33", "score": "0.42729264", "text": "func (instance *Host) ResetLabel(ctx context.Context, labelInstance resources.Label) (ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tif instance == nil || valid.IsNil(instance) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif ctx == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"ctx\")\n\t}\n\tif labelInstance == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"tag\")\n\t}\n\n\tdefaultValue, xerr := labelInstance.DefaultValue(ctx)\n\tif xerr != nil {\n\t\treturn xerr\n\t}\n\n\treturn instance.UpdateLabel(ctx, labelInstance, defaultValue)\n}", "title": "" }, { "docid": "cce768a798d316ccd6863a5df2d65300", "score": "0.42682144", "text": "func (r DisassociateSkillFromUsersRequest) Send(ctx context.Context) (*DisassociateSkillFromUsersResponse, 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 := &DisassociateSkillFromUsersResponse{\n\t\tDisassociateSkillFromUsersOutput: r.Request.Data.(*DisassociateSkillFromUsersOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "740fa71699cd51bc377ad528659c4bc4", "score": "0.42671642", "text": "func (device *ServoBrick) Reset() (err error) {\n\tvar buf bytes.Buffer\n\n\tresultBytes, err := device.device.Set(uint8(FunctionReset), 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": "9845a3e43cb02b75e732367fda7f4418", "score": "0.4265011", "text": "func (v *Allow) Reset() {\n\tv.BalanceExemptions = v.BalanceExemptions[:0]\n\tv.CallMethods = v.CallMethods[:0]\n\tv.Errors = v.Errors[:0]\n\tv.HistoricalBalanceLookup = false\n\tv.MempoolCoins = false\n\tv.OperationStatuses = v.OperationStatuses[:0]\n\tv.OperationTypes = v.OperationTypes[:0]\n\tv.TimestampStartIndex.Value = 0\n\tv.TimestampStartIndex.Set = false\n}", "title": "" }, { "docid": "ded97b214b5ee39f9ca5454dfaaf316a", "score": "0.42608076", "text": "func (r UpdateNetworkProfileRequest) Send(ctx context.Context) (*UpdateNetworkProfileResponse, 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 := &UpdateNetworkProfileResponse{\n\t\tUpdateNetworkProfileOutput: r.Request.Data.(*UpdateNetworkProfileOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "affc45fc13ea08d34d0fec7a0e0620d5", "score": "0.42515287", "text": "func (device *SilentStepperBrick) Reset() (err error) {\n\tvar buf bytes.Buffer\n\n\tresultBytes, err := device.device.Set(uint8(FunctionReset), 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": "229850f0eecafae16ada905a0623be33", "score": "0.42450273", "text": "func (client *Client) FlushInstanceWithOptions(request *FlushInstanceRequest, runtime *util.RuntimeOptions) (_result *FlushInstanceResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.InstanceId)) {\n\t\tquery[\"InstanceId\"] = request.InstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"FlushInstance\"),\n\t\tVersion: tea.String(\"2015-01-01\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &FlushInstanceResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "066374a3043f60516ffa84c793570697", "score": "0.4239989", "text": "func (c *Client) ResetBMC(ctx context.Context, resetType string) (ok bool, err error) {\n\tok, metadata, err := bmc.ResetBMCFromInterfaces(ctx, resetType, c.Registry.GetDriverInterfaces())\n\tc.setMetadata(metadata)\n\treturn ok, err\n}", "title": "" }, { "docid": "abb4820d3a0416994dc5c865e478173a", "score": "0.4238377", "text": "func (r ChangePasswordRequest) Send(ctx context.Context) (*ChangePasswordResponse, 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 := &ChangePasswordResponse{\n\t\tChangePasswordOutput: r.Request.Data.(*ChangePasswordOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "3dcd96f8130bcaf9611bdc6e14e4aece", "score": "0.4238013", "text": "func (m *RebootInstanceResponse) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "d92b01dc9c859e06a757a05389bddbd8", "score": "0.42351076", "text": "func (m *AuditLogMutation) ResetIPAddress() {\n\tm.ip_address = nil\n}", "title": "" }, { "docid": "482f2149c769e1acdb30da35ce683ca5", "score": "0.42341068", "text": "func (s ResetInstanceAttributeInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2e5c1298c55cc80cdd4593cf36848d68", "score": "0.423082", "text": "func (v *MempoolResponse) Reset() {\n\tv.TransactionIdentifiers = v.TransactionIdentifiers[:0]\n}", "title": "" }, { "docid": "6947ff06435767b4c6ae22462f7de22c", "score": "0.4226041", "text": "func (device *DCV2Bricklet) Reset() (err error) {\n\tvar buf bytes.Buffer\n\n\tresultBytes, err := device.device.Set(uint8(FunctionReset), 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": "85b80f366dec7382a4c0bfc7fe88fac2", "score": "0.42254138", "text": "func (client *Client) FlushInstance(request *FlushInstanceRequest) (_result *FlushInstanceResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &FlushInstanceResponse{}\n\t_body, _err := client.FlushInstanceWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "title": "" }, { "docid": "80ac1a1d7fb3dcc9adab15dea28f1129", "score": "0.42237315", "text": "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsGlobalInterfaceAttributes(ctx context.Context, name 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-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:interface-attributes/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -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": "127bf682d8301e07a5335f023c33cd86", "score": "0.4220253", "text": "func (r UpdateVTLDeviceTypeRequest) Send(ctx context.Context) (*UpdateVTLDeviceTypeResponse, 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 := &UpdateVTLDeviceTypeResponse{\n\t\tUpdateVTLDeviceTypeOutput: r.Request.Data.(*UpdateVTLDeviceTypeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "67c361f0f6ecc2ae2b5bd7a55532cf01", "score": "0.42162678", "text": "func (m *Marshaler) reset() {\n\tm.b = m.b[:0]\n}", "title": "" }, { "docid": "c55ac5877e2b980009a8feb64b2131f8", "score": "0.42144242", "text": "func (my *Queue) ResetBloomFilterInstance() {\n\tmy.bloomFilterMutex.Lock()\n\tdefer my.bloomFilterMutex.Unlock()\n\n\tif my.bloomFilterInstance == nil {\n\t\treturn\n\t}\n\n\t//save\n\tmy.BlSave(false)\n\n\t//main\n\tmy.bloomFilterInstance = nil\n\n\t//new once\n\tmy.bloomFilterInstanceDoOnce = new(sync.Once)\n\n\tlog.Println(\"Reset: \" + my.GetKey())\n}", "title": "" }, { "docid": "9f0146f61f7787958f7d126f622aaf8c", "score": "0.4207899", "text": "func (r DeleteMultiplexRequest) Send(ctx context.Context) (*DeleteMultiplexResponse, 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 := &DeleteMultiplexResponse{\n\t\tDeleteMultiplexOutput: r.Request.Data.(*DeleteMultiplexOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "0207207443571fd183956fd4d5307a6b", "score": "0.42057815", "text": "func (v *Peer) Reset() {\n\tv.Metadata = v.Metadata[:0]\n\tv.PeerID = \"\"\n}", "title": "" }, { "docid": "f06b7298ab844dd914390a648c6db0fa", "score": "0.42035776", "text": "func (r ModifyTrafficMirrorFilterNetworkServicesRequest) Send(ctx context.Context) (*ModifyTrafficMirrorFilterNetworkServicesResponse, 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 := &ModifyTrafficMirrorFilterNetworkServicesResponse{\n\t\tModifyTrafficMirrorFilterNetworkServicesOutput: r.Request.Data.(*ModifyTrafficMirrorFilterNetworkServicesOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "7971aed528584346ed2c9a3e08636511", "score": "0.41990846", "text": "func (u *UsersController) Reset(ctx *gin.Context) {\n\tvar userJSON userResetJSON\n\tctx.Bind(&userJSON)\n\tvar userIn tat.User\n\tuserIn.Username = strings.TrimSpace(userJSON.Username)\n\tuserIn.Email = strings.TrimSpace(userJSON.Email)\n\tcallback := strings.TrimSpace(userJSON.Callback)\n\n\tif len(userIn.Username) < 3 || len(userIn.Email) < 7 {\n\t\terr := fmt.Errorf(\"Invalid username (%s) or email (%s)\", userIn.Username, userIn.Email)\n\t\tAbortWithReturnError(ctx, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\ttokenVerify, err := userDB.AskReset(&userIn)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while AskReset %s\", err)\n\t\tctx.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tgo userDB.SendAskResetEmail(userIn.Username, userIn.Email, tokenVerify, callback)\n\tctx.JSON(http.StatusCreated, gin.H{\"info\": \"please check your mail to validate your account\"})\n}", "title": "" }, { "docid": "34fd6cc89984c12762d305cb1b99284c", "score": "0.41985062", "text": "func SimulateMsgUpdateAttribute(k keeper.Keeper, ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, nk namekeeper.Keeper) simtypes.Operation {\n\treturn func(\n\t\tr *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,\n\t) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {\n\t\tvar attributes []types.Attribute\n\t\tif err := k.IterateRecords(ctx, types.AttributeKeyPrefix, func(attribute types.Attribute) error {\n\t\t\tattributes = append(attributes, attribute)\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUpdateAttribute, \"iterator of existing attributes failed\"), nil, err\n\t\t}\n\n\t\tif len(attributes) == 0 {\n\t\t\treturn simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUpdateAttribute, \"no attributes available to delete\"), nil, nil\n\t\t}\n\n\t\trandomAttribute := attributes[r.Intn(len(attributes))]\n\n\t\t// the name associated with this attribute may no longer exist so use the attribute account as a backup account for \"owner\"\n\t\tvar ownerAddress string\n\t\tnr, err := nk.GetRecordByName(ctx, randomAttribute.Name)\n\t\tif err == nil {\n\t\t\townerAddress = nr.Address\n\t\t} else {\n\t\t\townerAddress = randomAttribute.Address\n\t\t}\n\n\t\tt := types.AttributeType(r.Intn(9))\n\t\tsimAccount, _ := simtypes.FindAccount(accs, mustGetAddress(ownerAddress))\n\t\tmsg := types.NewMsgUpdateAttributeRequest(\n\t\t\tmustGetAddress(randomAttribute.GetAddress()),\n\t\t\tmustGetAddress(ownerAddress),\n\t\t\trandomAttribute.Name,\n\t\t\trandomAttribute.Value,\n\t\t\tgetRandomValueOfType(r, t),\n\t\t\trandomAttribute.AttributeType,\n\t\t\tt,\n\t\t)\n\n\t\treturn Dispatch(r, app, ctx, ak, bk, simAccount, chainID, msg)\n\t}\n}", "title": "" }, { "docid": "ab289808e9cf5ded2f46260ef1de46e3", "score": "0.41968638", "text": "func (i *InstanceServiceHandler) MassReboot(ctx context.Context, instanceList []string) error {\n\turi := fmt.Sprintf(\"%s/reboot\", instancePath)\n\n\treqBody := RequestBody{\"instance_ids\": instanceList}\n\treq, err := i.client.NewRequest(ctx, http.MethodPost, uri, reqBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn i.client.DoWithContext(ctx, req, nil)\n}", "title": "" }, { "docid": "71e344b7893033c25734a7fd3ce71fa7", "score": "0.419512", "text": "func (v *NetworkStatusResponse) Reset() {\n\tv.CurrentBlockIdentifier.Reset()\n\tv.CurrentBlockTimestamp = 0\n\tv.GenesisBlockIdentifier.Reset()\n\tv.OldestBlockIdentifier.Value.Reset()\n\tv.OldestBlockIdentifier.Set = false\n\tv.Peers = v.Peers[:0]\n\tv.SyncStatus.Value.Reset()\n\tv.SyncStatus.Set = false\n}", "title": "" }, { "docid": "9ff5ac240df27d9837781e055e039739", "score": "0.4193641", "text": "func (sb *spdkBackend) Reset(req storage.BdevPrepareRequest) (*storage.BdevPrepareResponse, error) {\n\tsb.log.Debugf(\"spdk backend reset (script call): %+v\", req)\n\treturn sb.reset(req, DetectVMD)\n}", "title": "" }, { "docid": "f75d92e101a92752458f77a6d9bac128", "score": "0.41923928", "text": "func (v *ConstructionPayloadsResponse) Reset() {\n\tv.Payloads = v.Payloads[:0]\n\tv.UnsignedTransaction = \"\"\n}", "title": "" }, { "docid": "0e36ff944fdc27b1e2859d64800ad97c", "score": "0.41916227", "text": "func (self *SinglePad) ResetI(args ...interface{}) {\n self.Object.Call(\"reset\", args)\n}", "title": "" }, { "docid": "45b9c2fea90a33b6b50aa7eafe169989", "score": "0.4190185", "text": "func (v *MetadataRequest) Reset() {\n\tv.Metadata = v.Metadata[:0]\n}", "title": "" } ]
94b7ef07d42308d32d483d3e912703fa
Normalize normalizes the vector. Normalization is (1/|v|)v, making this equivalent to v.Scale(1/v.Len()). If the len is 0.0, this function will return an infinite value for all elements due to how floating point division works in Go (n/0.0 = math.Inf(Sign(n))). Normalization makes a vector's Len become 1.0 (within the margin of floating point error), while maintaining its directionality. (Can be seen here: )
[ { "docid": "d35e4eb5396f312c4a843f8684a0bdd1", "score": "0.69377005", "text": "func (v1 Vec4) Normalize() Vec4 {\n\tl := 1.0 / v1.Len()\n\treturn Vec4{v1[0] * l, v1[1] * l, v1[2] * l, v1[3] * l}\n}", "title": "" } ]
[ { "docid": "a8db312fa7f94b4dfce2b509739e9114", "score": "0.77712035", "text": "func (v Vector) Normalize() Vector {\n\tif !v.IsZero() {\n\t\tv.Div(v.Length())\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "acee93c50e3060f26ea9a5d8bb980bca", "score": "0.7595602", "text": "func (a Vector) Normalize() Vector {\n\treturn a.MultiplyByScalar(1. / a.Length())\n}", "title": "" }, { "docid": "490f9a4509ad142d274c76a43d4b968c", "score": "0.7583316", "text": "func Normalize(vec []float64) []float64 {\n norm := Norm(vec)\n return []float64{vec[0]/norm,vec[1]/norm,vec[2]/norm}\n}", "title": "" }, { "docid": "32b6c8c11a2566ad3f93ad3f20cb81fa", "score": "0.756483", "text": "func (vector Vector) Normalize() Vector {\n\td := vector.Len()\n\treturn Vector{vector.X / d, vector.Y / d}\n}", "title": "" }, { "docid": "ebf43db822c7bf46e91524ff43e29b5b", "score": "0.74845195", "text": "func (v Vector) Normalize() Vector {\n\tif v.X == 0 && v.Y == 0 {\n\t\treturn ZeroVector\n\t}\n\treturn v.Mult(1 / v.Length())\n}", "title": "" }, { "docid": "dd9d4f4c27dea224a6ff893c94fb35d1", "score": "0.7460254", "text": "func (v *Vector) Normalize() {\n\ts := 1.0 / v.Length()\n\tv.x *= s\n\tv.y *= s\n\tv.z *= s\n}", "title": "" }, { "docid": "1e96434cafaa34a49ba3dd6b1e94102d", "score": "0.7350878", "text": "func (vec *T) Normalize() *T {\n\tsl := vec.LengthSqr()\n\tif sl == 0 || sl == 1 {\n\t\treturn vec\n\t}\n\treturn vec.Scale(1 / math.Sqrt(sl))\n}", "title": "" }, { "docid": "47028fa15be50808dccec24afebe80fb", "score": "0.73467565", "text": "func (vec *Vec2) Normalize() error {\n\tlength := vec.Length()\n\tif length == 0.0 {\n\t\treturn fmt.Errorf(\"Tried to normalize a vector with length zero: %v\", *vec)\n\t}\n\n\tvec[0] = vec[0] / length\n\tvec[1] = vec[1] / length\n\n\treturn nil\n}", "title": "" }, { "docid": "420bfc261348e0c7a2e33996676c8414", "score": "0.73414665", "text": "func Normalized(v Vector) Vector {\n\tv.Normalize()\n\treturn v\n}", "title": "" }, { "docid": "4537a46e548d252051e8537be4ca0a97", "score": "0.7292321", "text": "func (v1 Vector) Normalize() Vector {\n\tmag := v1.Magnitude()\n\tif mag == 0 {\n\t\treturn Vector(make([]float64, len(v1))) // Return a vector of zeroes if the magnitude is zero.\n\t}\n\treturn v1.Scale(float64(1.0) / mag)\n}", "title": "" }, { "docid": "647119e42986c3dfda60eade7c3abb17", "score": "0.7286883", "text": "func normalize(v []float64, size int) {\n\tscale := 1 / float64(size)\n\tfor i := range v {\n\t\tv[i] = v[i] * scale\n\t}\n}", "title": "" }, { "docid": "fbd5825adbda5bc52c2254b9fee15082", "score": "0.72536546", "text": "func (a *Vector) Normalize() Vector {\n\td := a.Length()\n\treturn Vector{a.X / d, a.Y / d}\n}", "title": "" }, { "docid": "8ccb4aa168762b3e1c93161da2e767a1", "score": "0.70104903", "text": "func normalizeGradientVector(vector []float64) {\n\tvectorsLength := countVectorsLength(vector)\n\tfor i, element := range vector {\n\t\tvector[i] = element / vectorsLength\n\t}\n}", "title": "" }, { "docid": "02a693db72a29fb3a3779584f2fe84c3", "score": "0.6995616", "text": "func (v *Vec2) Normalise() *Vec2 {\n\th := v.Norm()\n\tif h == 0 {\n\t\tv[0] = math.NaN()\n\t\tv[1] = math.NaN()\n\t\treturn v\n\t}\n\n\th1 := 1/h\n\n\tv[0] *= h1\n\tv[1] *= h1\n\n\treturn v\n}", "title": "" }, { "docid": "e91f2055056f9f58517bf8e243227405", "score": "0.6985378", "text": "func (v *OpVector2f) NormalizeVector() {\n\tm := Magnitude(*v)\n\tif m != 0 {\n\t\tv.MulForce(1 / m) //dunno if it not better to v.X /= m && v.Y /= m\n\t}\n}", "title": "" }, { "docid": "369553a3c2ea48830927a45b84708766", "score": "0.6973331", "text": "func (v1 Vec3) Normalize() Vec3 {\n\tl := 1.0 / v1.Len()\n\treturn Vec3{v1[0] * l, v1[1] * l, v1[2] * l}\n}", "title": "" }, { "docid": "66da80926e00966318a4b0f9761e18f5", "score": "0.6891318", "text": "func norm(v geom.Point) float64 { return math.Sqrt(dot(v, v)) }", "title": "" }, { "docid": "e2b6f4b68fda38bead0bfb424b9238bd", "score": "0.6843334", "text": "func (v1 Vec2) Normalize() Vec2 {\n\tl := 1.0 / v1.Len()\n\treturn Vec2{v1[0] * l, v1[1] * l}\n}", "title": "" }, { "docid": "a546446a22049485063a8cccc1be00dc", "score": "0.67941713", "text": "func (v *Vec4) Normalise() *Vec4 {\n\th := v.Norm()\n\tif h == 0 {\n\t\tv[0] = math.NaN()\n\t\tv[1] = math.NaN()\n\t\tv[2] = math.NaN()\n\t\tv[3] = math.NaN()\n\t\treturn v\n\t}\n\n\th1 := 1/h\n\n\tv[0] *= h1\n\tv[1] *= h1\n\tv[2] *= h1\n\tv[3] *= h1\n\n\treturn v\n}", "title": "" }, { "docid": "0f9c681ac70d2b32b329c4de6e00bb28", "score": "0.6787436", "text": "func (v *Vec3) Normalise() *Vec3 {\n\th := v.Norm()\n\tif h == 0 {\n\t\tv[0] = math.NaN()\n\t\tv[1] = math.NaN()\n\t\tv[2] = math.NaN()\n\t\treturn v\n\t}\n\n\th1 := 1/h\n\n\tv[0] *= h1\n\tv[1] *= h1\n\tv[2] *= h1\n\n\treturn v\n}", "title": "" }, { "docid": "325900a0453d1a39bf4ae4c8f202c349", "score": "0.66334", "text": "func Normalize(v mgl64.Vec3, dir vec3Dir, sign float64) mgl64.Vec3 {\n\tlen := v.Len()\n\tif mgl64.FloatEqual(len, 0.0) {\n\t\tv := mgl64.Vec3{}\n\t\tv[dir] = math.Copysign(1.0, sign)\n\t\treturn v\n\t}\n\treturn mgl64.Vec3{v.X() / len, v.Y() / len, v.Z() / len}\n}", "title": "" }, { "docid": "c001eb0d63612541ff9ac7658f633f4e", "score": "0.66207606", "text": "func (v *Vector2) Normalize() Vector2 {\n\n\tconst EPSILON = 0.0001\n\n\tlen := v.Length()\n\tif len < EPSILON {\n\n\t\tv.X = 0\n\t\tv.Y = 0\n\t} else {\n\n\t\tv.X /= len\n\t\tv.Y /= len\n\t}\n\n\treturn NewVector2(v.X, v.Y)\n}", "title": "" }, { "docid": "43d7b9bcaf4dc20513066bc2211b351c", "score": "0.6589702", "text": "func (v Vec3) Normalize() {\n\td := 1.0 / math32.Sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2])\n\tv[0] *= d\n\tv[1] *= d\n\tv[2] *= d\n}", "title": "" }, { "docid": "81a7090f1527769acd2014214e820ec8", "score": "0.6539455", "text": "func (vec *T) Normalized() T {\n\tv := *vec\n\tv.Normalize()\n\treturn v\n}", "title": "" }, { "docid": "0e7a45c92645d72d9e299ec40149e470", "score": "0.64897496", "text": "func (a *Vector2f) Normalize() {\n\ta.Scale(1.0 / a.Magnitude())\n}", "title": "" }, { "docid": "6e7ec359dc04b6c0037b5d7d3af50b08", "score": "0.6426323", "text": "func Normalize(p pixel.Vec) pixel.Vec {\n\treturn p.Scaled(1 / math.Sqrt(p.X*p.X+p.Y*p.Y))\n}", "title": "" }, { "docid": "d8f6ac03cc71bb860eb5695e927bfae4", "score": "0.6369711", "text": "func (lhs *Vec3) Normalize() *Vec3 {\n\tlhs.Div(lhs.Len())\n\treturn lhs\n}", "title": "" }, { "docid": "d9aac8f11e7ec5dea3c3aa189ef43b61", "score": "0.6360453", "text": "func (v *Vec) Norm() float64 {\n\treturn math.Sqrt(v.Dot(v))\n}", "title": "" }, { "docid": "b6482c7442297ce8e1feac8b9183a517", "score": "0.6313004", "text": "func NormVec(v1 [3]float64) (res float64) {\n\tfor i := 0; i < 3; i++ {\n\t\tres += v1[i] * v1[i]\n\t}\n\tres = math.Sqrt(res)\n\treturn\n}", "title": "" }, { "docid": "c29e6a8090310cc172874984da4e392c", "score": "0.62942815", "text": "func norm(v *Matrix) (*Matrix, string) {\n normsquared, e := dot(v, v);\n if (e != \"\") {\n return nil, e;\n }\n\n factor, e2 := sqrt(normsquared);\n if (e2 != \"\") {\n return nil, e2;\n }\n\n unitVector := scaleMatrix(v, 1/factor);\n round(unitVector);\n return unitVector, \"\";\n}", "title": "" }, { "docid": "46ed4e6e705938f4640d1a8afa9281e2", "score": "0.6286864", "text": "func Vec2Normalize(out, a []float64) []float64 {\n\tlen := Vec2Length(a)\n\tif 0 < len {\n\t\tlen = 1. / len\n\t}\n\tout[0] = a[0] * len\n\tout[1] = a[1] * len\n\treturn out\n}", "title": "" }, { "docid": "3bc0de88e58e9e55f0607f111e9cfa00", "score": "0.6286815", "text": "func (v *Vec3) Normalize(x *Vec3) *Vec3 {\n\treturn v.Scale(x, 1.0/x.Length())\n}", "title": "" }, { "docid": "86257d7563fbebd92707eaf50085f5f7", "score": "0.62776613", "text": "func (V *Vector) Norm() float64 {\n\ts := 0.\n\tfor _, elem := range V.Comp {\n\t\ts += math.Pow(elem, 2.)\n\t}\n\treturn math.Sqrt(s)\n}", "title": "" }, { "docid": "89b669c11a17a2d8bd6e204ae0069f9b", "score": "0.6211442", "text": "func (v Vec3) Norm() Vec3 {\n\treturn v.Div(v.Len())\n}", "title": "" }, { "docid": "aa76c9f25f937cf7c175fe088068fee3", "score": "0.6150953", "text": "func Normalize(x float64, avg float64, stdev float64) float64 {\n\treturn (x - avg) / stdev\n}", "title": "" }, { "docid": "9926fdff6d0a8d839e1d546d956a7d4a", "score": "0.6094828", "text": "func (k *Kernel) Normalize() *Kernel {\n\tnormalized, _ := NewKernel(k.Width, k.Height)\n\tsum := k.AbSum()\n\tif sum == 0 {\n\t\tsum = 1\n\n\t}\n\tfor x := 0; x < k.Height; x++ {\n\t\tfor y := 0; y < k.Width; y++ {\n\t\t\tnormalized.Set(x, y, k.At(x, y)/sum)\n\t\t}\n\t}\n\treturn normalized\n}", "title": "" }, { "docid": "2bf05abf20803ada91c6e82a667133ff", "score": "0.60928136", "text": "func (v Vec2) Normalised() (normalised Vec2) {\n\tnormalised = v\n\tnormalised.Normalise()\n\treturn normalised\n}", "title": "" }, { "docid": "36c6c23cad908e8caf8b0a09ab7227c9", "score": "0.60895246", "text": "func (v Vec4) Normalised() (normalised Vec4) {\n\tnormalised = v\n\tnormalised.Normalise()\n\treturn normalised\n}", "title": "" }, { "docid": "fd78c9310863ef76b670f0326815ad26", "score": "0.6036203", "text": "func (a *Point) Normalize() {\n\tlen := a.Length()\n\ta.X = a.X / len\n\ta.Y = a.Y / len\n\ta.Z = a.Z / len\n}", "title": "" }, { "docid": "7b67740b9aeda01f3e732fec85cb3bec", "score": "0.59924805", "text": "func (v F2) Norm() float64 { return math.Sqrt(v.Dot(v)) }", "title": "" }, { "docid": "f15274834142a2d9460f4c4fcbd75e8b", "score": "0.59889287", "text": "func cmplxNormalize(v []complex128, size int) {\n\tscale := 1 / float64(size)\n\tfor i := range v {\n\t\tv[i] = complex(real(v[i])*scale, 0)\n\t}\n}", "title": "" }, { "docid": "4aed0bd9f1b078ae40cac8221de215a4", "score": "0.59885305", "text": "func normalise(input []float64) []float64 {\n\tif len(input) <= 1 {\n\t\treturn input\n\t}\n\tmin := input[0]\n\tfor _, y := range input {\n\t\tif y < min {\n\t\t\tmin = y\n\t\t}\n\t}\n\tfor index := 0; index < len(input); index++ {\n\t\tinput[index] = input[index] - min\n\t}\n\treturn input\n}", "title": "" }, { "docid": "007d9210b3516f0ab92041ab1e8a136e", "score": "0.598281", "text": "func Norm(x []float64, pow float64) float64 {\n\ts := 0.0\n\n\tfor _, xval := range x {\n\t\ts += math.Pow(xval, pow)\n\t}\n\n\treturn math.Pow(s, 1 / pow)\n}", "title": "" }, { "docid": "d2521b37bf1173abd7cc68f074c8bb03", "score": "0.5976074", "text": "func (u Vertex) Normalize() Vertex {\n\treturn u.Divide(u.Magn())\n}", "title": "" }, { "docid": "0da0e67972f92c5765e7fc100e457373", "score": "0.5945462", "text": "func (v *Vec3) Normalize() *Vec3 {\n\tnorm := v.Length()\n\treturn &Vec3{v.X / norm, v.Y / norm, v.Z / norm}\n}", "title": "" }, { "docid": "7cd622724a8f711f10f5992fd04aaf98", "score": "0.5942835", "text": "func (v Vec3) Normalised() (normalised Vec3) {\n\tnormalised = v\n\tnormalised.Normalise()\n\treturn normalised\n}", "title": "" }, { "docid": "eafeca42fba7126af232fa7f8d8372c0", "score": "0.5909722", "text": "func Normalize(n float64) float64 {\n\tif n > 1.00000000 || n < -1.00000000 {\n\t\tfmt.Println(\"normalizing...\")\n\t\treturn Normalize(n / 100)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "590c4aa61a324f4c451ec05f793bd24c", "score": "0.58728474", "text": "func normalizeSum(x []float64, z float64) {\n\tscale := floats.Sum(x)\n\tif scale < 1e-10 {\n\t\tfor j := range x {\n\t\t\tx[j] = z\n\t\t}\n\t\treturn\n\t}\n\tfloats.Scale(1/scale, x)\n}", "title": "" }, { "docid": "79a85e7ac7b8eb19f03fd485b9c52108", "score": "0.58311486", "text": "func (q *Quat) Normalize() {\n\tl := q.Length()\n\tif l == 0 {\n\t\tq.X = 0\n\t\tq.Y = 0\n\t\tq.Z = 0\n\t\tq.W = 1\n\t} else {\n\t\tl = 1 / l\n\t\tq.X *= l\n\t\tq.Y *= l\n\t\tq.Z *= l\n\t\tq.W *= l\n\t}\n}", "title": "" }, { "docid": "d1bd05cbc04cbd46c7e1b7b10600b2f0", "score": "0.57850707", "text": "func normalize(x Natural) Natural {\n\tn := len(x);\n\tfor n > 0 && x[n-1] == 0 {\n\t\tn--\n\t}\n\treturn x[0:n];\n}", "title": "" }, { "docid": "c224490e8e3d1a78f5f2c20c8915e943", "score": "0.575925", "text": "func (q1 Quat) Normalize() Quat {\n\tlength := q1.Len()\n\n\tabsDelta := 1 - length\n\tif absDelta < 0 {\n\t\tabsDelta = -absDelta\n\t}\n\n\tif absDelta < floatCmpEpsilon {\n\t\treturn q1\n\t}\n\tif length == 0 {\n\t\treturn QuatIdent()\n\t}\n\tif length == float32(math.Inf(1)) {\n\t\tlength = math.MaxFloat32\n\t}\n\n\treturn Quat{q1.V.Mul(1 / length), q1.W * 1 / length}\n}", "title": "" }, { "docid": "1ae3d9f3ddfb7e8e6d61bd0a60018640", "score": "0.5749303", "text": "func (vec *T) Normal() T {\n\tn := *vec\n\tn[0], n[1] = n[1], -n[0]\n\treturn *n.Normalize()\n}", "title": "" }, { "docid": "f49e57a035215d13d1e7c24174c8751b", "score": "0.5745136", "text": "func (k Kernel) Normalised() Kernel {\n\ttotal := 0.0\n\tfor y := 0; y < k.Height(); y++ {\n\t\tfor x := 0; x < k.Width(); x++ {\n\t\t\ttotal += k[y][x]\n\t\t}\n\t}\n\n\tnk := make([][]float64, k.Height())\n\n\tfor y := 0; y < k.Height(); y++ {\n\t\tnk[y] = make([]float64, k.Width())\n\t\tfor x := 0; x < k.Width(); x++ {\n\t\t\tnk[y][x] = k[y][x] / total\n\t\t}\n\t}\n\n\treturn nk\n}", "title": "" }, { "docid": "761297b9b62e137af83b6cd584218a23", "score": "0.5692673", "text": "func (r *Ray) Normalize() {\n\tr.Direction.Normalize()\n}", "title": "" }, { "docid": "924d6e342f88b361808df5a46dc50623", "score": "0.56772214", "text": "func (v *Vector3) Normalize() *Vector3 {\n\tv.p.Call(\"normalize\")\n\treturn v\n}", "title": "" }, { "docid": "2d2b4fe3d7b3b9e4c540fff176fcabf3", "score": "0.5640867", "text": "func (o *SetNodeOptions) Normalize(node *Node) {\n\to.DeltaStorage += o.DeltaVolume.Total()\n\tfor volID, size := range o.DeltaVolume {\n\t\tif size == 0 {\n\t\t\to.DeltaStorage -= node.InitVolume[volID]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4ba044ff57a333bf10ed8bdae0291238", "score": "0.5602114", "text": "func (p *Profile) Normalize(pb *Profile) error {\n\n\tif err := p.compatible(pb); err != nil {\n\t\treturn err\n\t}\n\n\tbaseVals := make([]int64, len(p.SampleType))\n\tfor _, s := range pb.Sample {\n\t\tfor i, v := range s.Value {\n\t\t\tbaseVals[i] += v\n\t\t}\n\t}\n\n\tsrcVals := make([]int64, len(p.SampleType))\n\tfor _, s := range p.Sample {\n\t\tfor i, v := range s.Value {\n\t\t\tsrcVals[i] += v\n\t\t}\n\t}\n\n\tnormScale := make([]float64, len(baseVals))\n\tfor i := range baseVals {\n\t\tif srcVals[i] == 0 {\n\t\t\tnormScale[i] = 0.0\n\t\t} else {\n\t\t\tnormScale[i] = float64(baseVals[i]) / float64(srcVals[i])\n\t\t}\n\t}\n\tp.ScaleN(normScale)\n\treturn nil\n}", "title": "" }, { "docid": "e83a1ee3480aafd77fd4b300e00a43cb", "score": "0.55455565", "text": "func (cf *CollaborativeFilter) Normalize() (normRatings [][]float64) {\n\tif len(cf.Means) == 0 {\n\t\tcf.CalcMeans()\n\t}\n\twidth := len(cf.Ratings[0])\n\tnormRatings = make([][]float64, len(cf.Ratings))\n\tfor i := 0; i < len(cf.Ratings); i++ {\n\t\tnormRatings[i] = make([]float64, width)\n\t\tfor j := 0; j < width; j++ {\n\t\t\tif cf.AvailableRatings[i][j] == 1 {\n\t\t\t\tnormRatings[i][j] = cf.Ratings[i][j] - cf.Means[i]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e238ed637a21e9d9fa75e0e8601bdb19", "score": "0.551584", "text": "func Normalize(mean []float32, stddev []float32) *NormalizeTransformer {\n\tvar meanT torch.Tensor\n\tvar stddevT torch.Tensor\n\tif len(mean) == 1 {\n\t\tmeanT = torch.NewTensor([][][]float32{{{mean[0]}}})\n\t} else if len(mean) == 3 {\n\t\tmeanT = torch.NewTensor([][][]float32{{{mean[0]}}, {{mean[1]}}, {{mean[2]}}})\n\t} else {\n\t\tpanic(fmt.Sprintf(\"len(Mean) should be 1 or 3.\"))\n\t}\n\tif len(stddev) == 1 {\n\t\tstddevT = torch.NewTensor([][][]float32{{{stddev[0]}}})\n\t} else if len(stddev) == 3 {\n\t\tstddevT = torch.NewTensor([][][]float32{{{stddev[0]}}, {{stddev[1]}}, {{stddev[2]}}})\n\t} else {\n\t\tpanic(fmt.Sprintf(\"len(Stddev) should be 1 or 3.\"))\n\t}\n\treturn &NormalizeTransformer{meanT, stddevT}\n}", "title": "" }, { "docid": "b394a70789b885c10f9f69bf0d35f77d", "score": "0.54481596", "text": "func Div(v Vector, a float64) Vector {\n\tif a == 0 {\n\t\treturn v\n\t}\n\tw := NewVector(Dim(v))\n\tf := 1.0 / a\n\tfor i := range v {\n\t\tw[i] = v[i] * f\n\t}\n\treturn w\n}", "title": "" }, { "docid": "5dc66802f66994956d95d4876f55e6e6", "score": "0.5408235", "text": "func (t Tuple) Normalize() Tuple {\n\treturn t.DivideBy(t.Magnitude())\n}", "title": "" }, { "docid": "5baee7084ef179c1357463d54eda730e", "score": "0.5401487", "text": "func normalise(dx float64, ydata []float64) []float64 {\n\tA := 0.0 // Normalisation constant\n\tf := len(ydata) - 2 // Last index for Simpsons'\n\n\t// Use Simpsons' Rule to integrate\n\tfor i := 0; i < f; i += 2 {\n\t\tA += ydata[i] + 4.0*ydata[i+1] + ydata[i+2]\n\t}\n\n\tif A == 0 {\n\t\treturn ydata\n\t}\n\tA *= dx / 3.0\n\t// println(A)\n\n\t// Normalise\n\tfor i, _ := range ydata {\n\t\tydata[i] /= A\n\t}\n\n\treturn ydata\n}", "title": "" }, { "docid": "bf42f6cc5148f7dcd1f2a0afa98f5427", "score": "0.5377352", "text": "func (t *Tuple) Normalize() *Tuple {\n\tif magnitude := t.Magnitude(); magnitude != 0 {\n\t\treturn t.Divide(magnitude)\n\t}\n\n\treturn t\n}", "title": "" }, { "docid": "0357a8f7bf74a8143ff1224e99b85ddd", "score": "0.5375701", "text": "func (v Vec2i) NormalVec(onLeft bool) Vec2i {\n\tif onLeft {\n\t\treturn Vec2i{-v[1], v[0]}\n\t}\n\treturn Vec2i{v[1], -v[0]}\n}", "title": "" }, { "docid": "b2c7a9ac42f3e5926bfdd386fd29ad3a", "score": "0.53738403", "text": "func (tr *Triangle) Normalize() {\n\tnormal, _ := tr.normal.Normalize()\n\ttr.normal = normal\n}", "title": "" }, { "docid": "6e206802cd55a30f80e87336f55910c2", "score": "0.5347948", "text": "func (r Rational) Normalize() Rational {\n\tif r.Numerator == 0 || r.Denominator == 0 {\n\t\treturn r\n\t}\n\tfactor := gcd(r.Numerator, r.Denominator)\n\tif factor != 0 {\n\t\treturn Rational{\n\t\t\tNumerator: r.Numerator / factor,\n\t\t\tDenominator: r.Denominator / factor,\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "db3f8ff5db742d7151f6307a70c2d7d0", "score": "0.53348494", "text": "func (v1 Vector) Scale(scalar float64) Vector {\n\top := make([]float64, len(v1))\n\tfor i := 0; i < len(v1); i++ {\n\t\top[i] = v1[i] * scalar\n\t}\n\treturn Vector(op)\n}", "title": "" }, { "docid": "084bc1d8f570985419718108181be624", "score": "0.53097993", "text": "func (c Coord) Normalize() Coord {\n\tlength := float32(math.Sqrt(float64((c.X * c.X) + (c.Y * c.Y) + (c.Z * c.Z))))\n\tif length < 0.00001 {\n\t\treturn c\n\t}\n\n\treturn Coord{\n\t\tX: c.X / length,\n\t\tY: c.Y / length,\n\t\tZ: c.Z / length,\n\t}\n}", "title": "" }, { "docid": "169312d1987a4cb93cfe4ba9228f406f", "score": "0.52740914", "text": "func (o *ImageOptions) Normalize() {\n\tif o.Step < 1 {\n\t\to.Step = 1\n\t}\n}", "title": "" }, { "docid": "346a5d792eba6723412fc8dd67e46587", "score": "0.5273447", "text": "func Normal(a, b, c, optionalTarget *Vector3) *Vector3 {\r\n\r\n\tvar v0 Vector3\r\n\tvar result *Vector3\r\n\tif optionalTarget != nil {\r\n\t\tresult = optionalTarget\r\n\t} else {\r\n\t\tresult = NewVector3(0, 0, 0)\r\n\t}\r\n\r\n\tresult.SubVectors(c, b)\r\n\tv0.SubVectors(a, b)\r\n\tresult.Cross(&v0)\r\n\r\n\tresultLengthSq := result.LengthSq()\r\n\tif resultLengthSq > 0 {\r\n\t\treturn result.MultiplyScalar(1 / Sqrt(resultLengthSq))\r\n\t}\r\n\treturn result.Set(0, 0, 0)\r\n}", "title": "" }, { "docid": "abd31c2f3a0142da6e7c29cf3c90a48a", "score": "0.52714705", "text": "func (ts *TimeSeries) Normalized() (*TimeSeries) {\n mean := ts.Mean() // cache series mean\n stdev := ts.Stdev() // cache series standard deviation\n\n znormal := make(TimeSeries, ts.Length())\n\n for index, value := range *ts {\n znormal[index] = (value - mean) / stdev\n }\n\n return &znormal\n}", "title": "" }, { "docid": "5f418ae5c97f6627a80ad2550963ec8e", "score": "0.5266594", "text": "func (v Vector) Normal() Vector {\n\treturn Vector{-v.Y, v.X}\n}", "title": "" }, { "docid": "52e31a43ab1cc2d89353094d5c0a0aab", "score": "0.5251677", "text": "func Normalise(data [][]float64, verbose bool) ([][]float64, []float64, []float64) {\n\n\tmin := make([]float64, len(data[0]), len(data[0]))\n\tmax := make([]float64, len(data[0]), len(data[0]))\n\n\tfor column := range data[0] {\n\t\tmin[column] = data[0][column]\n\t\tmax[column] = data[0][column]\n\t}\n\n\tfor column := range data[0] {\n\t\tfor row := range data {\n\t\t\tif min[column] > data[row][column] {\n\t\t\t\tmin[column] = data[row][column]\n\t\t\t}\n\t\t\tif max[column] < data[row][column] {\n\t\t\t\tmax[column] = data[row][column]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn NormaliseByDomain(data, min, max, verbose), min, max\n}", "title": "" }, { "docid": "79d01f54ebd8b53d96ab5edbc9310b13", "score": "0.5248877", "text": "func (m *MessageHdlr) Normalize(i interface{}) interface{} {\n\tif m.normalizer != nil {\n\t\treturn m.normalizer(i)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "3f4e26a7ec61b0145b9b7ed03b23aad5", "score": "0.5235051", "text": "func (d Direction) Norm() float64 {\n\treturn 1.0\n}", "title": "" }, { "docid": "d161ee4e34ff307fef0d6e6a9e5579ba", "score": "0.5196986", "text": "func normalize(bins []Bin) []Bin {\n\tbinsByIndex := make(map[int]float64)\n\tfor _, bin := range bins {\n\t\tif bin.count <= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tbinsByIndex[bin.index] += bin.count\n\t}\n\tnormalizedBins := make([]Bin, 0, len(bins))\n\tfor index, count := range binsByIndex {\n\t\tnormalizedBins = append(normalizedBins, Bin{index: index, count: count})\n\t}\n\tsort.Slice(normalizedBins, func(i, j int) bool { return normalizedBins[i].index < normalizedBins[j].index })\n\treturn normalizedBins\n}", "title": "" }, { "docid": "8d5b94c104b8d300728d7d1181ffb4d7", "score": "0.5189415", "text": "func Normal(x float64) float64 {\n return math.Exp( -x*x/2.0 ) / k\n}", "title": "" }, { "docid": "5d83f49238074e5c14b9bab3ee292cd0", "score": "0.5162988", "text": "func NormDiff(v1, v2 *[3]float64) (res float64) {\n\tfor i := 0; i < 3; i++ {\n\t\tres += (v1[i] - v2[i]) * (v1[i] - v2[i])\n\t}\n\tres = math.Sqrt(res)\n\treturn\n}", "title": "" }, { "docid": "e7389efe8a5134af98563ced7ad1efae", "score": "0.5150347", "text": "func (r SignedRational) Normalize() SignedRational {\n\tif r.Numerator == 0 || r.Denominator == 0 {\n\t\treturn r\n\t}\n\tn := abs(r.Numerator)\n\tcommonDivisor := gcds(n, r.Denominator)\n\t// if r.Denominator%n == 0 || n%r.Denominator == 0 {\n\tif commonDivisor != 0 {\n\t\treturn SignedRational{\n\t\t\tNumerator: r.Numerator / commonDivisor,\n\t\t\tDenominator: r.Denominator / commonDivisor,\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "6018630ea7a1b01f37f1e1e215fcf690", "score": "0.5148926", "text": "func (s *Spline) Normalize() {\n\tl := len(s.Nodes)\n\tif l < 2 {\n\t\tpanic(\"too few spline nodes for normalization\")\n\t}\n\tt1 := s.Nodes[0].T\n\tdt := s.Nodes[l-1].T - t1\n\tfinv := 1.0 / dt\n\tfor i := 0; i < l; i++ {\n\t\ts.Nodes[i].T -= t1\n\t\ts.Nodes[i].T *= finv\n\t}\n\ts.t1, s.t2 = 0.0, 1.0\n}", "title": "" }, { "docid": "ca9476dbb2dce209f84218d014c640fd", "score": "0.5108181", "text": "func (d *Dense) Norm(pow float64) float64 {\n\ts := 0.0\n\tfor _, x := range d.data {\n\t\ts += math.Pow(x, pow)\n\t}\n\treturn math.Pow(s, 1/pow)\n}", "title": "" }, { "docid": "ff1b82d5edffed18b5226dc63f07d5a5", "score": "0.5085849", "text": "func Unit(v Vec) Vec {\n\treturn Scale(v, 1/Mag(v))\n}", "title": "" }, { "docid": "18e1a00a126fc3c1605a4b1be1493f95", "score": "0.5071109", "text": "func (v Vec) Len() float64 {\n\treturn math.Sqrt(v.LenSq())\n}", "title": "" }, { "docid": "18e1a00a126fc3c1605a4b1be1493f95", "score": "0.5071109", "text": "func (v Vec) Len() float64 {\n\treturn math.Sqrt(v.LenSq())\n}", "title": "" }, { "docid": "2f7be6aeea4b9e524e3087432133f5d7", "score": "0.50595266", "text": "func Norm(z complex128) float64", "title": "" }, { "docid": "abcfe75ee1a6ad581db12feff68c52e1", "score": "0.50462586", "text": "func (node Node) Normalize() {\n\tnode.value.Call(\"normalize\")\n}", "title": "" }, { "docid": "1536576cc138402cabdd5f847bb23308", "score": "0.5023401", "text": "func NormFloat64() float64 { return globalRand.NormFloat64() }", "title": "" }, { "docid": "392e74378940b0857581e86db562cb96", "score": "0.5011569", "text": "func UnityBasedNormalization(x, xMin, xMax, a, b float64) float64 {\n\treturn a + ((x-xMin)*(b-a))/(xMax-xMin)\n}", "title": "" }, { "docid": "371b9099542407ed71aa1e3fbc8e414d", "score": "0.5010971", "text": "func Normalize2f(a *Vector2f) *Vector2f {\n\treturn Scale2f(a, 1.0/a.Magnitude())\n}", "title": "" }, { "docid": "7c921b96b4cf6d4b665285bbbd305a48", "score": "0.49965128", "text": "func (z *E4) norm(x *E2) {\n\tvar tmp E2\n\ttmp.Square(&z.B1).MulByNonResidue(&tmp)\n\tx.Square(&z.B0).Sub(x, &tmp)\n}", "title": "" }, { "docid": "c2db19618476dcd73362ab15cf809b91", "score": "0.49695754", "text": "func zNormalize(ts []float64) ([]float64, error) {\n\tvar i int\n\n\tif len(ts) == 0 {\n\t\treturn nil, fmt.Errorf(\"slice does not have any data\")\n\t}\n\n\tm := stat.Mean(ts, nil)\n\n\tout := make([]float64, len(ts))\n\tfor i = 0; i < len(ts); i++ {\n\t\tout[i] = ts[i] - m\n\t}\n\n\tvar std float64\n\tfor _, val := range out {\n\t\tstd += val * val\n\t}\n\tstd = math.Sqrt(std / float64(len(out)))\n\n\tif std == 0 {\n\t\treturn out, fmt.Errorf(\"standard deviation is zero\")\n\t}\n\n\tfor i = 0; i < len(ts); i++ {\n\t\tout[i] = out[i] / std\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "9f64628607176dd9e4d41b39b7261ce1", "score": "0.49595374", "text": "func Mean(input []float64) float64 {\n\tif len(input) == 0 {\n\t\treturn 0\n\t}\n\n\tsum := Sum(input...)\n\treturn sum / float64(len(input))\n}", "title": "" }, { "docid": "f798b97a9aa9aff5ad1111a2b1cd1baa", "score": "0.4955365", "text": "func (m *Dense) Norm(norm float64) float64 {\n\tif m.IsEmpty() {\n\t\tpanic(ErrZeroLength)\n\t}\n\tlnorm := normLapack(norm, false)\n\tif lnorm == lapack.MaxColumnSum {\n\t\twork := getFloat64s(m.mat.Cols, false)\n\t\tdefer putFloat64s(work)\n\t\treturn lapack64.Lange(lnorm, m.mat, work)\n\t}\n\treturn lapack64.Lange(lnorm, m.mat, nil)\n}", "title": "" }, { "docid": "835db6faaff1d9800ec70abd232a0ae3", "score": "0.49529827", "text": "func Relativize(vector Vector) Vector {\r\n\tnv := NewVector(len(vector) - 1)\r\n\tfor i := 1; i < len(vector); i++ {\r\n\t\tnv[i-1] = (vector[i] - vector[i-1]) / vector[i-1]\r\n\t}\r\n\treturn nv\r\n}", "title": "" }, { "docid": "300bfd91e0265caa7b100659a8ee318b", "score": "0.49520254", "text": "func normT(t float64) float64 {\n\tt = t - float64(int(t))\n\tif t < 0 {\n\t\treturn 1 + t\n\t}\n\treturn t\n}", "title": "" }, { "docid": "8675aee09103f56557ef685dfe5c5575", "score": "0.495201", "text": "func (v Vector) SetLength(d float64) Vector {\n\tif v.X == 0 && v.Y == 0 {\n\t\treturn ZeroVector\n\t}\n\treturn v.Mult(d / v.Length())\n}", "title": "" }, { "docid": "2e85fda289456d6d9a75bf132f7afb75", "score": "0.49242634", "text": "func NormVar(loc float64, scale float64) float64 {\n\treturn math.Pow(scale, 2)\n}", "title": "" }, { "docid": "97bd739e36dca1c845dac29583cf13fd", "score": "0.4924172", "text": "func NormaliseByDomain(data [][]float64, min, max []float64, verbose bool) [][]float64 {\n\n\tif verbose == true {\n\t\tminStr := \"\"\n\t\tmaxStr := \"\"\n\t\tfor i := range min {\n\t\t\tminStr = fmt.Sprintf(\"%s %f\", minStr, min[i])\n\t\t\tmaxStr = fmt.Sprintf(\"%s %f\", maxStr, max[i])\n\t\t}\n\t}\n\n\tr := make([][]float64, len(data), len(data))\n\n\tfor row := range data {\n\t\tr[row] = make([]float64, len(data[0]), len(data[0]))\n\t\tfor column := range data[0] {\n\t\t\tif math.Abs(min[column]-max[column]) > 0.000001 {\n\t\t\t\tvalue := data[row][column]\n\t\t\t\tif value > max[column] {\n\t\t\t\t\tvalue = max[column]\n\t\t\t\t}\n\t\t\t\tif value < min[column] {\n\t\t\t\t\tvalue = min[column]\n\t\t\t\t}\n\t\t\t\tr[row][column] = (value - min[column]) / (max[column] - min[column])\n\t\t\t}\n\t\t}\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "62a2999962e0dcae478fadc62ee3d3d1", "score": "0.49198368", "text": "func (o *AddNodeOptions) Normalize() {\n\to.Storage += o.Volume.Total()\n}", "title": "" }, { "docid": "dcfeb131cd1f28c3945263278d6b9842", "score": "0.4911738", "text": "func (hist *Histogram) NormalizedBins(area float64) []float64 {\n\tif !hist.init {\n\t\tpanic(\"stats.Histogram.NormalizedBins called on unitinitalized struct.\")\n\t}\n\n\tvalueArea := area / float64(hist.ValueCount)\n\t\n\tnormedBins := make([]float64, len(hist.Bins))\n\tfor i := 0; i < len(hist.Bins); i++ {\n\t\tnormedBins[i] = float64(hist.Bins[i]) * valueArea\n\t}\n\n\treturn normedBins\n}", "title": "" } ]
a45489023a79da795f1a5fc388416663
GetAll returns all highlight images
[ { "docid": "153b4b0de3bf41e8e6f5ac9cda7dcda7", "score": "0.79903233", "text": "func (h *HighlightImage) GetAll(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tconn, err := db.Connect()\n\tdefer conn.Close()\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\tsession := conn.NewSession(nil)\n\tdefer session.Close()\n\n\tif request.QueryStringParameters == nil {\n\t\trequest.QueryStringParameters = map[string]string{\n\t\t\t\"highlight_id\": request.PathParameters[\"id\"],\n\t\t}\n\t} else {\n\t\trequest.QueryStringParameters[\"highlight_id\"] = request.PathParameters[\"id\"]\n\t}\n\n\tresult, err := db.Select(session, db.TableHighlightImage, request.QueryStringParameters, HighlightImage{})\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\treturn common.APIResponse(result, http.StatusOK)\n}", "title": "" } ]
[ { "docid": "d8911e8ff6ef743a35226d966d7be709", "score": "0.62067604", "text": "func (q imageQuery) All(ctx context.Context, exec boil.ContextExecutor) (ImageSlice, error) {\n\tvar o []*Image\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 Image slice\")\n\t}\n\n\tif len(imageAfterSelectHooks) != 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": "57b9f38514f7c779658aee927702d995", "score": "0.59348196", "text": "func GetAllImages() []dto.ImageStruct {\n\tlogfile, er := os.OpenFile(utils.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)\n\tif er != nil {\n\t\tpanic(er.Error())\n\t}\n\tdefer logfile.Close()\n\t// Initalize DB Connection\n\tsql, sqlErr := utils.DBInit()\n\tif sqlErr != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(sqlErr)\n\t}\n\t// Close DB connection at the end.\n\tdefer sql.Close()\n\t// SQL syntax\n\tgetImages := `SELECT \n\t\t\t\t\t\tphoto_url, \n\t\t\t\t\t\tuser_id, \n\t\t\t\t\t\tarticle_id \n\t\t\t\t\tFROM \n\t\t\t\t\t\tphoto_table;`\n\n\trow, err := sql.Query(getImages)\n\n\tif err != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(err)\n\t}\n\t// Prepare an array which save JSON results.\n\tvar imageArray []dto.ImageStruct\n\n\tfor row.Next() {\n\t\tposts := dto.ImageStruct{}\n\t\tif err := row.Scan(&posts.ImageURL, &posts.UserID, &posts.ArticleID); err != nil {\n\t\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Appending JSON in array.\n\t\timageArray = append(imageArray, posts)\n\t}\n\treturn imageArray\n}", "title": "" }, { "docid": "a8b380ea640d2e0a1cb36dd72b63d70c", "score": "0.5808142", "text": "func (p ImageService) FindAll(image models.Image, keyword string) (*[]models.Image, int64, error) {\n\treturn p.repository.FindAll(image, keyword)\n}", "title": "" }, { "docid": "8bf3e625d06b74c5cfadf534f108ea2d", "score": "0.5683415", "text": "func getAll() cli.ActionFunc {\n\treturn func(ctx *cli.Context) error {\n\t\tcreds := gobaclient.Credentials{\n\t\t\tUsername: ctx.Parent().Parent().GlobalString(\"username\"),\n\t\t\tPassword: ctx.Parent().Parent().GlobalString(\"password\"),\n\t\t}\n\n\t\turi, err := url.Parse(ctx.Parent().Parent().GlobalString(\"uri\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttyp := goba.DatabaseType(ctx.Parent().Parent().GlobalString(\"database-type\"))\n\n\t\timages, err := gobaclient.GetAllImages(*uri, creds, typ)\n\t\tif err == nil {\n\t\t\tprintImageNames(images...)\n\t\t}\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "92e45ca6ae7109626d0386069d1d6a51", "score": "0.5675227", "text": "func FindAll() Images {\n\t// let a slice of Cat, the struct Cats, hold values\n\tvar tmp Cats\n\n\t// connect to the database\n\tc := RedisConnect()\n\tdefer c.Close()\n\n\t// get all the data with a key like cat:% ... every cat key value pair\n\t// TODO: use SCAN instead. see https://redis.io/commands/keys\n\tkeys, err := c.Do(\"KEYS\", \"cat:*\")\n\tHandleError(err)\n\n\t// loop though the returned data and load it into an Images structure\n\tfor _, k := range keys.([]interface{}) {\n\n\t\t// for storing Cat specific data\n\t\tvar cat Cat\n\n\t\t// get the value for this key\n\t\treply, err := c.Do(\"GET\", k.([]byte))\n\t\tHandleError(err)\n\n\t\t// load the data into a Cat structure\n\t\tif err := json.Unmarshal(reply.([]byte), &cat); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// add the cat data to the slice\n\t\ttmp = append(tmp, cat)\n\t}\n\t// add the slice to the Images struct and return all the data as Images\n\treturn Images{tmp}\n}", "title": "" }, { "docid": "f4329ed52b697ecd4664868ab057b82a", "score": "0.5655925", "text": "func (imgDao *ImagesDAO) FindAll() ([]Image, error) {\n\tvar images []Image\n\terr := db.C(COLLECTION).Find(bson.M{}).All(&images)\n\treturn images, err\n}", "title": "" }, { "docid": "a6b694fd37c5b2a3c8505a854156e0df", "score": "0.5630423", "text": "func (i *Images) List() ([]compute.Image, error) {\n\tvar r []compute.Image\n\tresponse, err := request(i.provider, \"GET\", \"/images\", nil)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tvar results iResults\n\terr = json.Unmarshal(response, &results)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tif results.Status != \"OK\" {\n\t\treturn r, errors.New(results.Error_message)\n\t}\n\timages := make([]compute.Image, 0)\n\tfor _, v := range results.Images {\n\t\timages = append(images, v.toImage())\n\t}\n\treturn images, nil\n}", "title": "" }, { "docid": "e429847effc5d7e1aab6ec3e2316ba73", "score": "0.56254727", "text": "func (client *Client) ListImages(all bool) ([]model.Image, error) {\n\tif !all {\n\t\treturn nil, fmt.Errorf(\"all==False not implemented yet\")\n\t}\n\n\tjsonFile, err := os.Open(imagesJsonPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to open %s : \", imagesJsonPath, err.Error())\n\t}\n\tdefer jsonFile.Close()\n\n\tbyteValue, err := ioutil.ReadAll(jsonFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read %s : \", imagesJsonPath, err.Error())\n\t}\n\n\tvar result map[string]interface{}\n\tjson.Unmarshal([]byte(byteValue), &result)\n\n\timagesJson := result[\"images\"].([]interface{})\n\timages := []model.Image{}\n\tfor _, imageJson := range imagesJson {\n\t\timage := model.Image{\n\t\t\timageJson.(map[string]interface{})[\"imageID\"].(string),\n\t\t\timageJson.(map[string]interface{})[\"imageName\"].(string),\n\t\t}\n\t\timages = append(images, image)\n\t}\n\n\treturn images, nil\n}", "title": "" }, { "docid": "0618f02b6acf0e5721ed1d868efb8a0f", "score": "0.5625224", "text": "func FindAll(q *query.Query) ([]*Image, error) {\n\n\t// Fetch query.Results from query\n\tresults, err := q.Results()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return an array of images constructed from the results\n\tvar images []*Image\n\tfor _, cols := range results {\n\t\tp := NewWithColumns(cols)\n\t\timages = append(images, p)\n\t}\n\n\treturn images, nil\n}", "title": "" }, { "docid": "a6fee5f13feed744123f1ea791a970d4", "score": "0.5558562", "text": "func (p *pgsql) GetAllImages(registry, repo, tag, digest, dateStart, dateEnd, limit string) (*[]*datastore.Image, error) {\n\tvar images []*datastore.Image\n\tquery := \"SELECT id, top_layer, registry, repo, tag, digest, manifest_v2, manifest_v1, metadata, first_seen, last_seen FROM image_pa WHERE registry LIKE '%' || $1 || '%' AND repo LIKE '%' || $2 || '%' AND tag LIKE '%' || $3 || '%' AND digest LIKE '%' || $4 || '%'\"\n\n\t// Regex conditionals should prevent possible SQL injection from unescaped\n\t// concatenation to query string.\n\tif isDate, _ := regexp.MatchString(`^[\\d]{4}-[\\d]{2}-[\\d]{2}$`, dateStart); isDate {\n\t\tquery += \" AND last_seen>='\" + dateStart + \"'::date\"\n\t}\n\n\tif isDate, _ := regexp.MatchString(`^[\\d]{4}-[\\d]{2}-[\\d]{2}$`, dateEnd); isDate {\n\t\tquery += \" AND (last_seen<'\" + dateEnd + \"'::date + '1 day'::interval)\"\n\t}\n\n\tif isInt, _ := regexp.MatchString(`^[\\d]{1,}$`, limit); isInt {\n\t\tquery += \" LIMIT \" + limit\n\t}\n\n\trows, err := p.Query(query, registry, repo, tag, digest)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase sql.ErrNoRows:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\treturn nil, errors.Wrap(err, \"error querying for images\")\n\t\t}\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar image datastore.Image\n\t\terr = rows.Scan(&image.ID, &image.TopLayer, &image.Registry, &image.Repo, &image.Tag, &image.Digest, &image.ManifestV2, &image.ManifestV1, &image.Metadata, &image.FirstSeen, &image.LastSeen)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error scanning images\")\n\t\t}\n\t\timages = append(images, &image)\n\t}\n\t// Get any error encountered during iteration\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error scanning images\")\n\t}\n\treturn &images, nil\n}", "title": "" }, { "docid": "6b61df37f489d29d24e0ea7f426ced3f", "score": "0.5549279", "text": "func getLaboImages(s *goquery.Selection, l *Labo) {\n\tconst (\n\t\tCSS string = \"#main-content #product-thumbs img\"\n\t)\n\tvar (\n\t\tok bool\n\t)\n\ts = s.Find(CSS)\n\tok = (s.Length() > 0)\n\tif !ok {\n\t\treturn\n\t}\n\tl.Images = newImages(s)\n}", "title": "" }, { "docid": "525cd8cc242a70d86d6d6aeefb240258", "score": "0.5544723", "text": "func (r *DefaultImagesRepo) FindAll() (t types.Images, err error) {\n\terr = r.coll.Find(nil).All(&t)\n\treturn t, err\n}", "title": "" }, { "docid": "e4f2d5d51be1891ae0e4bd0ac8ce3862", "score": "0.5403697", "text": "func (s *Service) FindAll(ctx context.Context) ([]*Url, error) { \n return s.s.FindAll(ctx)\n}", "title": "" }, { "docid": "8758b18f8e95abbe73c66d2bc30b4ec5", "score": "0.5403025", "text": "func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) {\n\tdecoder := r.Context().Value(\"decoder\").(*schema.Decoder)\n\truntime := r.Context().Value(\"runtime\").(*libpod.Runtime)\n\tquery := struct {\n\t\t//all bool # all is currently unused\n\t\tfilters []string\n\t\t//digests bool # digests is currently unused\n\t}{\n\t\t// This is where you can override the golang default value for one of fields\n\t}\n\tif err := decoder.Decode(&query, r.URL.Query()); err != nil {\n\t\treturn nil, err\n\t}\n\tfilters := query.filters\n\tif len(filters) < 1 {\n\t\tfilters = append(filters, fmt.Sprintf(\"reference=%s\", \"\"))\n\t}\n\treturn runtime.ImageRuntime().GetImagesWithFilters(filters)\n}", "title": "" }, { "docid": "6d0ededc8c48d9353803cd2841a4822d", "score": "0.5399669", "text": "func (d *Dao) Images() (images []*model.Image, err error) {\n\terr = pkgerr.WithStack(d.db.Where(\"status = ?\", model.AliveImageStatus).Find(&images).Error)\n\treturn\n}", "title": "" }, { "docid": "b6fc26d59efbe05d759247c1f65ab4c1", "score": "0.5396371", "text": "func (svc service) ListImages(all bool) ([]abstract.Image, fail.Error) {\n\tif svc.IsNull() {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\timgs, err := svc.Provider.ListImages(all)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn svc.reduceImages(imgs), nil\n}", "title": "" }, { "docid": "994902e9f8940cac9a85ccb56b8d15b8", "score": "0.5336409", "text": "func GetAll(entity interface{}) error {\n\t// if err := dbContext.Preload(\"EntityUrls\").Find(entity).Error; err != nil {\n\tif err := dbContext.Find(entity).Error; err != nil {\n\t\treturn fmt.Errorf(\"No records could be found. Error: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d61fdc1205cea82a2237d1eb609e6f7", "score": "0.5326629", "text": "func (svc *HighlightService) List(bookmarkID int) ([]Highlight, error) {\n\tpath := fmt.Sprintf(\"/bookmarks/%d/highlights\", bookmarkID)\n\tres, err := svc.Client.Call(path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyBytes, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, &APIError{\n\t\t\tStatusCode: res.StatusCode,\n\t\t\tMessage: err.Error(),\n\t\t\tErrorCode: ErrHTTPError,\n\t\t\tWrappedError: err,\n\t\t}\n\t}\n\tvar highlightList []Highlight\n\terr = json.Unmarshal(bodyBytes, &highlightList)\n\tif err != nil {\n\t\treturn nil, &APIError{\n\t\t\tStatusCode: res.StatusCode,\n\t\t\tMessage: err.Error(),\n\t\t\tErrorCode: ErrUnmarshalError,\n\t\t\tWrappedError: err,\n\t\t}\n\t}\n\treturn highlightList, nil\n}", "title": "" }, { "docid": "4d338e91f1c7b8a19a98678481c2a3e9", "score": "0.52939445", "text": "func (b *ImageFinder) AllImages() *AllImages {\n\treturn &AllImages{\n\t\tContainerImages: b.AllContainerImages(),\n\t}\n}", "title": "" }, { "docid": "fa4a9851fd6c64f3fdd7c244896ef30d", "score": "0.5266656", "text": "func GetFavoriteListImage(userID int) []dto.PostImage {\n\tlogfile, er := os.OpenFile(utils.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)\n\tif er != nil {\n\t\tpanic(er.Error())\n\t}\n\tdefer logfile.Close()\n\t// Initalize DB Connection\n\tsql, sqlErr := utils.DBInit()\n\tif sqlErr != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(sqlErr)\n\t}\n\t// Close DB connection at the end.\n\tdefer sql.Close()\n\t// SQL syntax\n\tgetImages := `SELECT \n\t\t\t\t\t\tphoto_table.photo_url, \n\t\t\t\t\t\tfavorite_table.user_id, \n\t\t\t\t\t\tfavorite_table.article_id \n\t\t\t\t\tFROM \n\t\t\t\t\t\tphoto_table \n\t\t\t\t\tINNER JOIN \n\t\t\t\t\t\tfavorite_table \n\t\t\t\t\tON \n\t\t\t\t\t\tphoto_table.article_id = favorite_table.article_id \n\t\t\t\t\tWHERE favorite_table.user_id = ?;`\n\n\trow, err := sql.Query(getImages, userID)\n\n\tif err != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(err)\n\t}\n\t// Prepare an array which save JSON results.\n\tvar imageArray []dto.PostImage\n\n\tfor row.Next() {\n\t\tposts := dto.PostImage{}\n\t\tif err := row.Scan(&posts.ImageURL, &posts.UserID, &posts.ArticleID); err != nil {\n\t\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Appending JSON in array.\n\t\timageArray = append(imageArray, posts)\n\t}\n\treturn imageArray\n}", "title": "" }, { "docid": "a54a851e1c1610e364e4e731e2d4a6d1", "score": "0.52588147", "text": "func (s *imageLister) List(selector labels.Selector) (ret []*v1alpha1.Image, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Image))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "5f6b29dc453fb65ba5491cd06dbd55f8", "score": "0.5254162", "text": "func (s *StackEbrc) ListImages(all bool) ([]abstract.Image, fail.Error) {\n\tlogrus.Debug(\">>> stacks.ebrc::ListImages()\")\n\tdefer logrus.Debug(\"<<< stacks.ebrc::ListImages()\")\n\n\tvar empty []abstract.Image\n\n\torg, err := govcd.GetOrgByName(s.EbrcService, s.AuthOptions.ProjectName)\n\tif err != nil {\n\t\treturn empty, fail.Wrap(err, fmt.Sprintf(\"Error listing images\"))\n\t}\n\n\tcatalogName := \"\"\n\tfor _, item := range org.Org.Link {\n\t\t// Retrieve the first catalog name for further usage\n\t\tif item.Type == \"application/vnd.vmware.vcloud.catalog+xml\" {\n\t\t\tcatalogName = item.Name\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\n\t\tif catalogName != \"\" {\n\t\t\tcat, err := org.FindCatalog(catalogName)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !all && !strings.Contains(catalogName, \"Linux\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, item := range cat.Catalog.CatalogItems {\n\t\t\t\tfor _, deepItem := range item.CatalogItem {\n\t\t\t\t\tempty = append(empty, abstract.Image{ID: deepItem.ID, Name: deepItem.Name})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn empty, nil\n}", "title": "" }, { "docid": "448424e0fc1015b209f02d768a490829", "score": "0.52342653", "text": "func Images(ctx *gin.Context) {\n\tres := ImagesResponse{}\n\tres.Status = http.StatusOK\n\tdockerClient := DockerClient()\n\timageList, _ := dockerClient.ImageList(context.Background(), types.ImageListOptions{})\n\tres.Images = imageList\n\tctx.JSON(http.StatusOK, res)\n}", "title": "" }, { "docid": "0603ec1a21728692a7a3e2b75cb98f55", "score": "0.52301323", "text": "func (t *TextView) GetHighlights() (regionIDs []string) {\n\tfor id := range t.highlights {\n\t\tregionIDs = append(regionIDs, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a49854b34eb8786b7525700ca8fba5e2", "score": "0.5215371", "text": "func getPictures(client *http.Client) ([]Picture, error) {\n\n\trequest, err := http.NewRequest(http.MethodGet, DatabaseAPI+\"/db/retrieve/recognizer/\"+strconv.Itoa(NbOfImagesToSend), nil)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] Create GET request to DB: %v\", err.Error())\n\t\treturn nil, err\n\t}\n\n\trequest.Header.Set(\"Authorization\", DatabasePassword)\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] Execute GET request to DB: %v\", err.Error())\n\t\treturn nil, err\n\t}\n\n\t// check that received body isn't empty\n\tif response.Body == nil {\n\t\tlog.Printf(\"[ERROR] Database: received body is empty\")\n\t\treturn nil, err\n\t}\n\n\t// check whether there was an error during request\n\tif response.StatusCode != http.StatusOK {\n\t\tvar body, _ = ioutil.ReadAll(response.Body)\n\t\tlog.Printf(\"[ERROR] Error during GET request to DB: %d, %v\", response.StatusCode, string(body))\n\t\treturn nil, errors.New(\"bad status\")\n\t}\n\n\t// get body of returned data\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] Couldn't read received data: %v\", err.Error())\n\t\treturn nil, err\n\t}\n\n\t// transform json into struct\n\tvar pictures []Picture\n\terr = json.Unmarshal(body, &pictures)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] Database: unmarshal data: %v\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn pictures, nil\n}", "title": "" }, { "docid": "68a9544aeca619f08839a5580f4f8950", "score": "0.52111465", "text": "func (i *GetImageInput) GetAllImage(con aws.EstablishConnectionInput) ([]ImageResponse, error) {\n\n\tec2, seserr := con.EstablishConnection()\n\tif seserr != nil {\n\t\treturn nil, seserr\n\t}\n\n\t// desribing image to check if image exists\n\tresult, err := ec2.DescribeAllImages(\n\t\t&aws.DescribeComputeInput{},\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\timageResponse := make([]ImageResponse, 0)\n\tfor _, img := range result.Images {\n\t\tif i.GetRaw == true {\n\t\t\timageResponse = append(imageResponse, ImageResponse{GetImageRaw: img})\n\t\t} else {\n\t\t\tresp := new(ImageResponse)\n\t\t\tresp.Name = *img.Name\n\t\t\tresp.ImageId = *img.ImageId\n\t\t\tresp.CreationDate = *img.CreationDate\n\t\t\tresp.State = *img.State\n\t\t\tresp.IsPublic = *img.Public\n\n\t\t\tsnap := new(SnapshotDetails)\n\t\t\tsnap.SnapshotId = *img.BlockDeviceMappings[0].Ebs.SnapshotId\n\t\t\tsnap.VolumeType = *img.BlockDeviceMappings[0].Ebs.VolumeType\n\t\t\tsnap.VolumeSize = *img.BlockDeviceMappings[0].Ebs.VolumeSize\n\t\t\tresp.SnapShot = *snap\n\t\t\timageResponse = append(imageResponse, *resp)\n\t\t}\n\t}\n\treturn imageResponse, nil\n}", "title": "" }, { "docid": "ee88d5694fed50d12bdb79e629bc71ec", "score": "0.5195177", "text": "func GetColors(c *gin.Context) {\n\tdb := db.GetDB()\n\n\tvar results []m.Color\n\tif err := db.Find(&results).Error; err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tc.JSON(200, results)\n}", "title": "" }, { "docid": "73b60eb3e3349dc9204c89a5d82dc666", "score": "0.51864666", "text": "func ImageList(name string, pageIndex, pageSize int) (images []*model.ImageListInfo, totalCount int, err error) {\n\tctx, cli, err := mgr.Client()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\topts := types.ImageListOptions{}\n\tif name != \"\" {\n\t\topts.Filters = filters.NewArgs()\n\t\topts.Filters.Add(\"reference\", name)\n\t}\n\tsummaries, err := cli.ImageList(ctx, opts)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\t//sort.Slice(images, func(i, j int) bool {\n\t//\treturn images[i].ID < images[j].ID\n\t//})\n\n\ttotalCount = len(summaries)\n\tstart, end := misc.Page(totalCount, pageIndex, pageSize)\n\tsummaries = summaries[start:end]\n\tif length := len(summaries); length > 0 {\n\t\timages = make([]*model.ImageListInfo, length)\n\t\tfor i, summary := range summaries {\n\t\t\timages[i] = model.NewImageListInfo(summary)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9bc87c50c0e4fc4b4d94d06cf1c563b6", "score": "0.5175851", "text": "func (p provider) ListImages(all bool) ([]abstract.Image, fail.Error) {\n\tif p.IsNull() {\n\t\treturn []abstract.Image{}, fail.InvalidInstanceError()\n\t}\n\treturn p.Stack.(api.ReservedForProviderUse).ListImages()\n}", "title": "" }, { "docid": "417b297c511e23b52651c08ae0cc5bcb", "score": "0.5156734", "text": "func baseImages(node *parser.Node) []string {\n\tvar images []string\n\tfor _, pos := range FindAll(node, command.From) {\n\t\tif node.Children[pos].Next == nil {\n\t\t\tcontinue\n\t\t}\n\t\timages = append(images, node.Children[pos].Next.Value)\n\t}\n\treturn images\n}", "title": "" }, { "docid": "e821ff8911697698ecfab7e9f7dda184", "score": "0.51454186", "text": "func (s *Server) getImages() []*Image {\n\tpath := \"/images/json?all=0\"\n\tc, err := s.newDockerClient()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error connecting to Docker: %s\", err)\n\t}\n\tdefer c.Close()\n\treq, err := http.NewRequest(\"GET\", path, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error requesting images from Docker: %s\", err)\n\t}\n\n\tresp, err := c.Do(req)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error requesting images from Docker: %s\", err)\n\t}\n\n\tvar images []*Image\n\tif resp.StatusCode == http.StatusOK {\n\t\td := json.NewDecoder(resp.Body)\n\t\tif err = d.Decode(&images); err != nil {\n\t\t\tlog.Fatalf(\"Erroring decoding image JSON: %s\", err)\n\t\t}\n\t}\n\tresp.Body.Close()\n\treturn images\n}", "title": "" }, { "docid": "45f33a75db3cfac3b39bc0b6ad99a913", "score": "0.51338863", "text": "func getImages() Image {\n\n\t//Note: The actual image links (ENV, hardcoded, etc.) MUST be https, and not http\n\timages := &Image{\n\t\tSmallImageURL: os.Getenv(\"SmallImg\"),\n\t\tLargeImageURL: os.Getenv(\"LargeImg\"),\n\t}\n\n\treturn *images\n}", "title": "" }, { "docid": "7b40c860e1dfd5d9d4ca5e1e0cb9e956", "score": "0.51316303", "text": "func (*PhotoDataAccessObject) FindAll() []Photo {\n\tphotos := make([]Photo, 0)\n\terr := orm.Table(PhotoDAO.TableName()).Find(&photos)\n\tlogger.LogIfError(err)\n\treturn photos\n}", "title": "" }, { "docid": "beb312c2557b97aba75475da594df45e", "score": "0.5126241", "text": "func (v *Vsphere) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error) {\n\tvar cimages []lepton.CloudImage\n\n\tf := find.NewFinder(v.client, true)\n\tds, err := f.DatastoreOrDefault(context.TODO(), v.datastore)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tb, err := ds.Browser(context.TODO())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tspec := vmwareTypes.HostDatastoreBrowserSearchSpec{\n\t\tMatchPattern: []string{\"*\"},\n\t}\n\n\tsearch := b.SearchDatastore\n\n\ttask, err := search(context.TODO(), ds.Path(\"\"), &spec)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tinfo, err := task.WaitForResult(context.TODO(), nil)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tswitch r := info.Result.(type) {\n\tcase vmwareTypes.HostDatastoreBrowserSearchResults:\n\t\tres := []vmwareTypes.HostDatastoreBrowserSearchResults{r}\n\t\tfor i := 0; i < len(res); i++ {\n\t\t\tfor _, f := range res[i].File {\n\t\t\t\tif f.GetFileInfo().Path[0] == '.' {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tcimages = append(cimages, lepton.CloudImage{\n\t\t\t\t\tName: f.GetFileInfo().Path,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\tcase vmwareTypes.ArrayOfHostDatastoreBrowserSearchResults:\n\t\tlog.Warn(\"un-implemented\")\n\t}\n\n\treturn cimages, nil\n}", "title": "" }, { "docid": "671a08a9adfb6da35c2f01ded11cc6d2", "score": "0.5119648", "text": "func GetImages(pid string, image_id string) (*schema.DBImages, error) {\n return getImagesByCeph(pid, image_id)\n}", "title": "" }, { "docid": "00389b174dea4d58f8dc52114410e1d0", "score": "0.5103001", "text": "func (o *ImageSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := ImageSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), imagePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `image`.* FROM `image` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, imagePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in ImageSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "d7655993a4e3b9088f7891deb177d597", "score": "0.51018494", "text": "func GetImages(objs []models.EryObject) []models.EryObject {\n\tif len(objs) == 0 {\n\t\treturn objs\n\t}\n\tvar err error\n\tfor i, object := range objs {\n\t\tobjs[i].Path, err = photo.GetImageFromS3(object.Path)\n\t\tif err != nil {\n\t\t\tutils.Debug(false, \"catched error\", err.Error())\n\t\t}\n\t}\n\treturn objs\n}", "title": "" }, { "docid": "06286aa9a48abe64c4755bc5afa32451", "score": "0.50680107", "text": "func GetAll(ctx *routing.Context) error {\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\tdata := []models.RestaurantListModel{}\n\tdb.Model(&dbmodels.Restaurant{}).Select(\"restaurants.id, restaurants.title,restaurants.lang, restaurants.long,restaurants,address, images.image_url as logo\").Joins(\"join images on restaurants.id = images.restaurant_id\").Where(\"images.type = 2 and images.deleted_at is null\").Scan(&data)\n\n\tres := models.NewResponse(true, data, \"OK\")\n\n\treturn ctx.WriteData(res.MustMarshal())\n}", "title": "" }, { "docid": "bab3a703e616948ea88187de0df537d5", "score": "0.5060741", "text": "func GetSiglePostImages(articleID int) []string {\n\tlogfile, er := os.OpenFile(utils.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)\n\tif er != nil {\n\t\tpanic(er.Error())\n\t}\n\tdefer logfile.Close()\n\t// Initalize DB Connection\n\tsql, sqlErr := utils.DBInit()\n\tif sqlErr != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(sqlErr)\n\t}\n\t// Close DB connection at the end.\n\tdefer sql.Close()\n\t// SQL syntax\n\tgetImages := `SELECT \n\t\t\t\t\t\tphoto_url \n\t\t\t\t\tFROM \n\t\t\t\t\t\tphoto_table \n\t\t\t\t\tWHERE \n\t\t\t\t\t\tarticle_id = ?`\n\n\trow, err := sql.Query(getImages, articleID)\n\n\tif err != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(err)\n\t}\n\t// Prepare an array which save JSON results.\n\tvar imageArray []string\n\n\tfor row.Next() {\n\t\tvar image string\n\t\tif err := row.Scan(&image); err != nil {\n\t\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Appending JSON in array.\n\t\timageURL := os.Getenv(\"S3_URL\") + image\n\t\timageArray = append(imageArray, imageURL)\n\t}\n\treturn imageArray\n}", "title": "" }, { "docid": "61e88e85dc0ef52b2f9897c91844c977", "score": "0.5047762", "text": "func (s *ImageServiceOp) List(accountID int) (*ImageList, error) {\n\taccountIDMap := make(map[string]interface{})\n\taccountIDMap[\"accountId\"] = accountID\n\taccountIDJson, err := json.Marshal(accountIDMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", s.client.ServerURL+\"/cloudapi/images/list\", bytes.NewBuffer(accountIDJson))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbody, err := s.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar images = new(ImageList)\n\terr = json.Unmarshal(body, &images)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn images, nil\n}", "title": "" }, { "docid": "4c134bc2475a69efa35ed0334c630652", "score": "0.5047681", "text": "func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\trows, _ := DB.Query(\"SELECT id,url,flagged,created_at,updated_at FROM images\")\n\tdefer rows.Close()\n\n\tvar images []Image\n\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar flagged bool\n\t\tvar url string\n\t\tvar createdAt, updatedAt time.Time\n\n\t\terr := rows.Scan(&id, &url, &flagged, &createdAt, &updatedAt)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\timage := Image{\n\t\t\tID: id,\n\t\t\tFlagged: flagged,\n\t\t\tURL: url,\n\t\t\tCreatedAt: createdAt,\n\t\t\tUpdatedAt: updatedAt,\n\t\t}\n\n\t\timages = append(images, image)\n\t}\n\n\theader := w.Header()\n\theader.Set(\"Content-Type\", \"application/json\")\n\theader.Set(\"Access-Control-Allow-Methods\", header.Get(\"Allow\"))\n\theader.Set(\"Access-Control-Allow-Origin\", \"http://localhost:3000\")\n\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(images)\n}", "title": "" }, { "docid": "b75ee22b4220955fb9eda7f6ed4e30ee", "score": "0.50332063", "text": "func (client *APIClient) ImageList(ctx context.Context) ([]types.ImageInfo, error) {\n\tresp, err := client.get(ctx, \"/images/json\", nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\timageList := []types.ImageInfo{}\n\n\terr = decodeBody(&imageList, resp.Body)\n\tensureCloseReader(resp)\n\n\treturn imageList, err\n\n}", "title": "" }, { "docid": "ff90a0f805ab31e3698c95cd511caed1", "score": "0.50275517", "text": "func (srv *server) Images(ctx context.Context, filter *pop.Filter) (*pop.ImageList, error) {\n\t// filter for an image with the given ID or name\n\tif filter.Options != nil {\n\t\timg, err := srv.getSingleImageInfo(ctx, filter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &pop.ImageList{\n\t\t\tList: []*pop.Image{img},\n\t\t}, nil\n\t}\n\n\treturn &pop.ImageList{\n\t\tList: imgs,\n\t}, nil\n}", "title": "" }, { "docid": "377b85019fe9b6094e33952a2bf22108", "score": "0.50215244", "text": "func LookupImageList(connConfig string) (SpiderImageList, error) {\n\n\tif connConfig == \"\" {\n\t\tcontent := SpiderImageList{}\n\t\terr := fmt.Errorf(\"LookupImage() called with empty connConfig.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn content, err\n\t}\n\n\turl := common.SpiderRestUrl + \"/vmimage\"\n\n\t// Create Req body\n\ttempReq := common.SpiderConnectionName{}\n\ttempReq.ConnectionName = connConfig\n\n\tclient := resty.New().SetCloseConnection(true)\n\tclient.SetAllowGetMethodPayload(true)\n\n\tresp, err := client.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(tempReq).\n\t\tSetResult(&SpiderImageList{}). // or SetResult(AuthSuccess{}).\n\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\tGet(url)\n\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\tcontent := SpiderImageList{}\n\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\treturn content, err\n\t}\n\n\tfmt.Println(string(resp.Body()))\n\n\tfmt.Println(\"HTTP Status code: \" + strconv.Itoa(resp.StatusCode()))\n\tswitch {\n\tcase resp.StatusCode() >= 400 || resp.StatusCode() < 200:\n\t\terr := fmt.Errorf(string(resp.Body()))\n\t\tcommon.CBLog.Error(err)\n\t\tcontent := SpiderImageList{}\n\t\treturn content, err\n\t}\n\n\ttemp := resp.Result().(*SpiderImageList)\n\treturn *temp, nil\n\n}", "title": "" }, { "docid": "cdca74c48f324847a7fe921d0e168ef8", "score": "0.500703", "text": "func (c *Client) ListImages(all bool) ([]APIImages, error) {\n\tpath := \"/images/json?all=\"\n\tif all {\n\t\tpath += \"1\"\n\t} else {\n\t\tpath += \"0\"\n\t}\n\tbody, _, err := c.do(\"GET\", path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar images []APIImages\n\terr = json.Unmarshal(body, &images)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn images, nil\n}", "title": "" }, { "docid": "27c258d01877a341ad8fd64f0c7231ce", "score": "0.5002368", "text": "func (a *ImageByNameApiService) GetGeneralImages(ctx _context.Context) ([]ImageByNameInfo, *_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 []ImageByNameInfo\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Images/General\"\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\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\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": "088e31b00ffe8a20f923e749d86d9a69", "score": "0.49939936", "text": "func List(ctx context.Context, client *containerd.Client, filters, nameAndRefFilter []string) ([]images.Image, error) {\n\tvar imageStore = client.ImageService()\n\timageList, err := imageStore.List(ctx, nameAndRefFilter...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(filters) > 0 {\n\t\tf, err := imgutil.ParseFilters(filters)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif f.Dangling != nil {\n\t\t\timageList = imgutil.FilterDangling(imageList, *f.Dangling)\n\t\t}\n\n\t\timageList, err = imgutil.FilterByLabel(ctx, client, imageList, f.Labels)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\timageList, err = imgutil.FilterByReference(imageList, f.Reference)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar beforeImages []images.Image\n\t\tif len(f.Before) > 0 {\n\t\t\tbeforeImages, err = imageStore.List(ctx, f.Before...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tvar sinceImages []images.Image\n\t\tif len(f.Since) > 0 {\n\t\t\tsinceImages, err = imageStore.List(ctx, f.Since...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\timageList = imgutil.FilterImages(imageList, beforeImages, sinceImages)\n\t}\n\treturn imageList, nil\n}", "title": "" }, { "docid": "a225f5584059f850763199b7f568ffa0", "score": "0.49874464", "text": "func GetAll(c *gin.Context) {\n\tc.JSON(http.StatusOK, \"Implement GetAll categories please\")\n}", "title": "" }, { "docid": "950fa9ae9ea75be470a57cf9e4112ea5", "score": "0.49824882", "text": "func (bs *BoltService) refreshImages() {\n\tvar err error\n\n\t// Refresh images\n\terr = bs.boltDb.View(func(tx *bolt.Tx) (e error) {\n\t\tvar bucket *bolt.Bucket\n\t\tvar v, k []byte\n\n\t\tbucket = tx.Bucket(bs.settings.boltBucket)\n\t\tif bucket == nil {\n\t\t\te = fmt.Errorf(\"Bolt bucket %s not found\", bs.settings.boltBucket)\n\t\t\treturn\n\t\t}\n\t\tk = []byte(\"images\")\n\n\t\tv = bucket.Get(k)\n\t\tif v == nil {\n\t\t\te = fmt.Errorf(\"Bolt key %s not found\", k)\n\t\t\treturn\n\t\t}\n\n\t\tb := bytes.NewBuffer(v)\n\t\tdec := gob.NewDecoder(b)\n\n\t\te = dec.Decode(&bs.ImageMap)\n\t\tif e != nil {\n\t\t\te = fmt.Errorf(\"Parse ImageMap gob from Bolt: %v\", e)\n\t\t\treturn\n\t\t}\n\t\treturn\n\t})\n\n\tif err != nil {\n\t\tLog.Error.Printf(\"Refresh Images: %v\\n\", err)\n\t}\n\n\tLog.Info.Printf(\"Refresh Images: %d entries loaded from Bolt\\n\", len(bs.ImageMap))\n}", "title": "" }, { "docid": "efad371c7d625e0e9dd6d96456ea1fbc", "score": "0.4977098", "text": "func (ic *ImagesController) Index(w http.ResponseWriter, r *http.Request) {\n\tparams := r.URL.Query()\n\tq, err := NewRequest(\"GET\", \"/images/json\", params.Get(\"host\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tq.Query(indexOptions{\n\t\tAll: params.Get(\"all\"),\n\t\tFilters: params.Get(\"filters\"),\n\t})\n\tb, err := q.Do()\n\tif !q.ValidateStatusCode(200, 404, 500) && err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(q.StatusCode)\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\tio.Copy(w, b)\n}", "title": "" }, { "docid": "46417ead48f320fd7815405cbb6e4392", "score": "0.49674776", "text": "func ListImages() Images {\n\tpath := image_col_path()\n\turl := mk_url(path) + `?depth=` + Depth\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Add(\"Content-Type\", FullHeader)\n\tresp := do(req)\n\treturn toImages(resp)\n}", "title": "" }, { "docid": "110d955d0da7e2a556715f8b8fc2f060", "score": "0.49560586", "text": "func ReturnImageLinks(w http.ResponseWriter, r *http.Request) {\n\thelpers.EnableCors(w)\n\n\tparams := mux.Vars(r)\n\tk := strings.Replace(params[\"ids\"], \" \", \"\", -1)\n\ts := strings.Split(k, \",\")\n\tvar imageLinks []string\n\tfor _, element := range s {\n\t\titemID, err := strconv.Atoi(element)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t}\n\t\terr = helpers.CheckID(&itemID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t}\n\n\t\tpath := \"http://localhost:3348/api/image/return/\" + strconv.Itoa(itemID)\n\t\timageLinks = append(imageLinks, path)\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(imageLinks)\n}", "title": "" }, { "docid": "7f0c87e0eba168dff3ad294975175253", "score": "0.4951138", "text": "func (cln *Client) Images(ctx context.Context) ([]*catalogue.NFVImage, error) {\n\treturn cln.fetchImages(ctx, nil)\n}", "title": "" }, { "docid": "619496d8abafb3bb39c35f99937d9e58", "score": "0.4948568", "text": "func (client *APIClient) ImageList(ctx context.Context, filter filters.Args) ([]types.ImageInfo, error) {\n\tquery := url.Values{}\n\n\tif filter.Len() > 0 {\n\t\tfiltersJSON, err := filters.ToParam(filter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tquery.Set(\"filters\", filtersJSON)\n\t}\n\n\tresp, err := client.get(ctx, \"/images/json\", query, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\timageList := []types.ImageInfo{}\n\n\terr = decodeBody(&imageList, resp.Body)\n\tensureCloseReader(resp)\n\n\treturn imageList, err\n}", "title": "" }, { "docid": "0d2ceb9135595b53a87bf138f7e8cd09", "score": "0.49469098", "text": "func (s *EmojisService) All() (emojis map[string]string, result *Result) {\n\tresult = s.client.get(s.URL, &emojis)\n\treturn\n}", "title": "" }, { "docid": "93c1a649c0499c365a74d782b26efac9", "score": "0.49389505", "text": "func (mgr *ImageManager) List() ([]api.Image, api.ListImageError) {\n\tl, err := mgr.list()\n\treturn l, api.NewListImageError(err)\n}", "title": "" }, { "docid": "6eae7f01ee2fbb49c9d43f84b06739f9", "score": "0.49267337", "text": "func (engine *DockerEngineImpl) GetImages() ([]map[string]interface{}, error) {\n\t\n\tvar uri = \"/images/json?all=1\"\n\tvar response *http.Response\n\tvar err error\n\tresponse, err = engine.SendBasicGet(uri)\n\tif err != nil { return nil, err }\n\terr = utilities.GenerateError(response.StatusCode, response.Status)\n\tif err != nil { return nil, err }\n\tvar imageMaps []map[string]interface{}\n\timageMaps, err = rest.ParseResponseBodyToMaps(response.Body)\n\tif err != nil { return nil, err }\n\treturn imageMaps, nil\n}", "title": "" }, { "docid": "ab5ccae620391801078c29c15665b18a", "score": "0.4923636", "text": "func getPhotoList() ([]api.PhotoSummary, error) {\n\tgetPage := 1\n\tvar ps []api.PhotoSummary\n\n\tfor {\n\t\tp, err := api.GetPhotoSearchPage(getPage, apiKey, userId)\n\t\tif err != nil {\n\t\t\treturn ps, err\n\t\t}\n\t\tps = append(ps, p.Photos...)\n\t\tfmt.Printf(\"Got page %v of %v photos\\n\", getPage, len(p.Photos))\n\n\t\tif p.Pages == getPage {\n\t\t\tbreak\n\t\t}\n\t\tgetPage++\n\t}\n\n\treturn ps, nil\n}", "title": "" }, { "docid": "e7f48cc5371d456461070b390cbb74df", "score": "0.49202594", "text": "func ImagesSearch(ctx *gin.Context) {\n\tterm := ctx.Query(\"term\")\n\tres := ImagesSearchResponse{}\n\tres.Status = http.StatusOK\n\tres.Term = term\n\tdockerClient := DockerClient()\n\timageSearch, _ := dockerClient.ImageSearch(context.Background(), term, types.ImageSearchOptions{\n\t\tLimit: 100,\n\t})\n\tres.Images = imageSearch\n\tctx.JSON(http.StatusOK, res)\n}", "title": "" }, { "docid": "34bbb9de1a5359ac453a6e4067114ff0", "score": "0.4917055", "text": "func Images(session, namespace, id string) ([]Image, error) {\n\tresty.SetCookie(cookie(session))\n\tresp, err := resty.R().\n\t\tSetResult(&ImagesResult{}).\n\t\tGet(fmt.Sprintf(\"/v2/org/%s/repos/%s/images\", namespace, id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult, ok := resp.Result().(*ImagesResult)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Parse error\")\n\t}\n\treturn result.Images, nil\n}", "title": "" }, { "docid": "b09036b6a26cc013ac22812d38d11ca2", "score": "0.4917032", "text": "func (s stack) ListImages(ctx context.Context, _ bool) (imgList []*abstract.Image, ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\t// FIXME: context must NOT be ignored.\n\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\topts := images.ListOpts{\n\t\tStatus: images.ImageStatusActive,\n\t\tSort: \"name=asc,updated_at:desc\",\n\t}\n\n\t// Retrieve a pager (i.e. a paginated collection)\n\tpager := images.List(s.ComputeClient, opts)\n\n\t// Define an anonymous function to be executed on each page's iteration\n\timgList = []*abstract.Image{}\n\terr := pager.EachPage(\n\t\tfunc(page pagination.Page) (bool, error) {\n\t\t\timageList, err := images.ExtractImages(page)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\tfor _, img := range imageList {\n\t\t\t\timgList = append(imgList, &abstract.Image{ID: img.ID, Name: img.Name})\n\t\t\t}\n\t\t\treturn true, nil\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, NormalizeError(err)\n\t}\n\treturn imgList, nil\n}", "title": "" }, { "docid": "d0c2d847f0b7e2cdce533befe49eefca", "score": "0.49117273", "text": "func GetImageList(searchString string, startIndex int) (*PaginatedImageList, error) {\n\t// constants\n\tcustomSearchURL := config.GET(\"customSearchURL\")\n\tkey := \"key\"\n\tcx := \"cx\"\n\tq := \"q\"\n\tsafe := \"safe\"\n\tsearchType := \"searchType\"\n\tstart := \"start\"\n\t// initializing query params\n\tqueryParams := make(map[string]string)\n\tqueryParams[key] = config.GET(\"customSearchKey\")\n\tqueryParams[cx] = config.GET(\"customSearchClient\")\n\tqueryParams[q] = getImageSearchString(searchString)\n\tqueryParams[safe] = \"active\"\n\tqueryParams[searchType] = \"image\"\n\tqueryParams[start] = getImageStartIndex(startIndex)\n\t// make call\n\tvar data CustomImageSearch\n\terr := httpclient.GET(customSearchURL, nil, queryParams, true, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn parseImageSearchResponse(data), nil\n}", "title": "" }, { "docid": "709791b6a07176a86f29344171568199", "score": "0.49083203", "text": "func (p *provider) ListImages(ctx context.Context, all bool) ([]*abstract.Image, fail.Error) {\n\timages, xerr := p.Stack.(api.ReservedForProviderUse).ListImages(ctx, all)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tif !all {\n\t\tfilter := imagefilters.NewFilter(isWindowsImage).Not().And(imagefilters.NewFilter(isBMSImage).Not())\n\t\timages = imagefilters.FilterImages(images, filter)\n\t}\n\treturn images, nil\n}", "title": "" }, { "docid": "b1e9e2d1f6b855e8536cea06c4d0c7b1", "score": "0.4904535", "text": "func (c *ImagesController) Index(w http.ResponseWriter, r *http.Request) {\n\timageList, err := docker.DockerConn.ImageList(context.Background(), types.ImageListOptions{})\n\tif c.CheckError(err, http.StatusInternalServerError, w) {\n\t\treturn\n\t}\n\tc.SendJSON(\n\t\tw,\n\t\tr,\n\t\timageList,\n\t\thttp.StatusOK,\n\t)\n}", "title": "" }, { "docid": "759567d59c8a03ecc69801e3ad4d63a8", "score": "0.48998734", "text": "func (c *CrashLog) getImages() error {\n\tre := regexp.MustCompile(`^(?P<start>\\w+)\\s-\\s(?P<end>\\w+)\\s+(?P<name>.+)\\s+(?P<arch>rmv[4-8][tfsk]?|arm64\\S*|i386|x86_64\\S)\\s+\\<?(?P<uuid>[[:xdigit:]]{32})?\\>?\\s* (?P<path>\\/.*)\\s*$`)\n\tfound := false\n\tfor _, line := range c.lines {\n\t\tif strings.HasPrefix(line, \"Binary Images\") {\n\t\t\tfound = true\n\t\t\tcontinue\n\t\t}\n\t\tif found {\n\t\t\tif len(line) == 0 || strings.EqualFold(line, \"EOF\") {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif re.MatchString(line) {\n\t\t\t\tmatches := re.FindStringSubmatch(line)\n\t\t\t\tstart, err := utils.ConvertStrToInt(matches[re.SubexpIndex(\"start\")])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tend, err := utils.ConvertStrToInt(matches[re.SubexpIndex(\"end\")])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tc.Images = append(c.Images, image{\n\t\t\t\t\tName: matches[re.SubexpIndex(\"name\")],\n\t\t\t\t\tStart: start,\n\t\t\t\t\tEnd: end,\n\t\t\t\t\tArch: matches[re.SubexpIndex(\"arch\")],\n\t\t\t\t\tUUID: matches[re.SubexpIndex(\"uuid\")],\n\t\t\t\t\tPath: matches[re.SubexpIndex(\"path\")],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "807737471a6ac91347487f615206316c", "score": "0.48917443", "text": "func (v UsersImagesResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn fmt.Errorf(\"no transaction found\")\n\t}\n\n\tUsersImages := &models.UsersImages{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all UsersImages from the DB\n\tif err := q.All(UsersImages); err != nil {\n\t\treturn err\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\treturn c.Render(200, r.Auto(c, UsersImages))\n}", "title": "" }, { "docid": "a59ed3d8f4bcfef63b8113dfb330426e", "score": "0.4889219", "text": "func images(b []byte) []string {\n\turls := []string{}\n\tr := bytes.NewReader(b)\n\ttz := html.NewTokenizer(r)\n\tfor {\n\t\ttok := tz.Next()\n\t\tswitch {\n\t\tcase tok == html.ErrorToken:\n\t\t\treturn urls\n\t\tcase tok == html.StartTagToken:\n\t\t\tt := tz.Token()\n\t\t\tif t.Data == \"img\" {\n\t\t\t\tfor _, a := range t.Attr {\n\t\t\t\t\tif a.Key == \"src\" {\n\t\t\t\t\t\turls = append(urls, a.Val)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase tok == html.SelfClosingTagToken:\n\t\t\tt := tz.Token()\n\t\t\tif t.Data == \"img\" {\n\t\t\t\tfor _, a := range t.Attr {\n\t\t\t\t\tif a.Key == \"src\" {\n\t\t\t\t\t\turls = append(urls, a.Val)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "127b51bc4dcd8de25bb8eecdfc86cc7d", "score": "0.48835286", "text": "func FindAllPictures() ([]*Picture, error) {\n\tavatars := []*Picture{}\n\tresult, err := db.Query(\"SELECT id, id_account, path, path_blured, origin, size, created_at, updated_at FROM tbl_pictures\")\n\tif err != nil {\n\t\treturn avatars, err\n\t}\n\tdefer result.Close()\n\tfor result.Next() {\n\t\tpicture := Picture{}\n\t\terr := result.Scan(&picture.ID, &picture.IDAccount, &picture.Path, &picture.PathBlured, &picture.Origin, &picture.Size, &picture.CreatedAt, &picture.UpdatedAt)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tavatars = append(avatars, &picture)\n\t}\n\treturn avatars, nil\n}", "title": "" }, { "docid": "5535ee9d98c6ebcde5f936c0bf18ddce", "score": "0.48771915", "text": "func (vm *VM) GetImageList() ([]Image, error) {\n\tsvc, err := getService(vm.Region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get AWS service: %v\", err)\n\t}\n\n\tfilters := getFilters(vm.Filters)\n\n\tinput := &ec2.DescribeImagesInput{}\n\tif filters != nil && len(filters) > 0 {\n\t\tinput.Filters = filters\n\t}\n\n\timageListOutput, err := svc.DescribeImages(input)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get Image list: %v\", err)\n\t}\n\n\tresponse := make([]Image, 0)\n\tfor _, image := range imageListOutput.Images {\n\t\timg := getVMAWSImage(image)\n\t\tresponse = append(response, img)\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "71f118c1ed7994c3a9e9befb66ab81f4", "score": "0.48735037", "text": "func (d *PgDatastore) listImages() ([]models.Image, error) {\n\tvar images []models.Image\n\tresult := d.client.Find(&images)\n\tif result.Error != nil {\n\t\td.logger.Error(\n\t\t\t\"Error encountered listing images\",\n\t\t\tzap.Error(result.Error),\n\t\t)\n\t\treturn nil, result.Error\n\t}\n\treturn images, nil\n}", "title": "" }, { "docid": "f59f9c12d91e996ea7363a0458dda6cf", "score": "0.48704645", "text": "func (d DefaultImageMetadataService) List() ([]imageutils.ImageMetadata, error) {\n\timageMetadataMap, err := imageutils.GetImageMetadataMap()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar imageMetadataList []imageutils.ImageMetadata\n\tfor _, imageMetadata := range imageMetadataMap {\n\t\timageMetadataList = append(imageMetadataList, imageMetadata)\n\t}\n\tsort.Slice(imageMetadataList, func(i, j int) bool {\n\t\treturn imageMetadataList[i].Name < imageMetadataList[j].Name\n\t})\n\treturn imageMetadataList, nil\n}", "title": "" }, { "docid": "debee33dc055b0a563489b5816cd9816", "score": "0.4869007", "text": "func ListImages(p layout.Path) (map[string]string, error) {\n\tii, err := p.ImageIndex()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tindex, err := ii.IndexManifest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames := map[string]string{}\n\tfor _, i := range index.Manifests {\n\t\tif i.Annotations == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif name, ok := i.Annotations[imagespec.AnnotationRefName]; ok {\n\t\t\tnames[name] = i.Digest.String()\n\t\t}\n\t}\n\treturn names, nil\n}", "title": "" }, { "docid": "a8ad97e9412a972377633071ce21144a", "score": "0.48655006", "text": "func (r *Repo) GetAll() []Item {\n\treturn r.Items\n}", "title": "" }, { "docid": "dafbfee29483598260f94b5372e42c91", "score": "0.4865074", "text": "func (d *PgDatastore) ListImages() ([]*entities.Image, error) {\n\tmodelImages, err := d.listImages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar entityImages = make([]*entities.Image, len(modelImages))\n\tfor i, image := range modelImages {\n\t\tentityImages[i] = image.ToDomain()\n\t}\n\n\treturn entityImages, nil\n}", "title": "" }, { "docid": "fb6fa92cbe9f58c1b5ce0d59fa00266b", "score": "0.48622093", "text": "func (registry *DockerHubRegistry) Images(user string) ([]string, error) {\n\turl := registry.url(\"/v2/repositories/%s/\", user)\n\tregistry.Print( \"Searching %s for Seed images...\\n\", url)\n\trepos := make([]string, 0, 10)\n\tvar err error //We create this here, otherwise url will be rescoped with :=\n\tvar response repositoriesResponse\n\tfor err == nil {\n\t\tresponse.Next = \"\"\n\t\turl, err = registry.getDockerHubPaginatedJson(url, &response)\n\t\tfor _, r := range response.Results {\n\t\t\tif !strings.HasSuffix(r.Name, \"-seed\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Add all tags if found\n\t\t\tif rs, _ := registry.Tags(user, r.Name); len(rs) > 0 {\n\t\t\t\tfor _, tag := range rs {\n\t\t\t\t\trepos = append(repos, r.Name+\":\"+tag)\n\t\t\t\t}\n\t\t\t\t// No tags found - so just add the repo name\n\t\t\t} else {\n\t\t\t\trepos = append(repos, r.Name)\n\t\t\t}\n\t\t}\n\t}\n\tif err != ErrNoMorePages {\n\t\treturn nil, err\n\t}\n\treturn repos, nil\n}", "title": "" }, { "docid": "e7de02df714829e8f4df0a5232d42883", "score": "0.48586622", "text": "func (ser *MediaService) GetAll(first *int, skip *int, tx db.Tx) ([]*models.Media, error) {\n\tvlist, err := tx.Database().GetAll(first, skip, ser, tx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist, err := ser.mapFromModel(vlist)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to map db.Models to Media: %w\", err)\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "13c550449e03c740fbb40b02c7b8cb77", "score": "0.48525253", "text": "func (a *AccountService) Images(page int) {\n\tpath := fmt.Sprintf(\"/account/me/images/%d\", page)\n\tresp, err := a.client.Get(path, NoOptions)\n\n\tif err != nil {\n\t\trespError(path)\n\n\t}\n\n\tdefer resp.Body.Close()\n\n\tprintBytes(resp.Body, a.client)\n}", "title": "" }, { "docid": "63dcc1ffdf0979ba2e05ad0a8b28677b", "score": "0.4842821", "text": "func (c *Client) Search(query string) ([]Gif, error) {\n u := fmt.Sprintf(\"%s/v1/gifs/search?q=%s&api_key=%s\", Endpoint, url.QueryEscape(query), c.Key)\n c.log(\"search '%s' -> GET %s\", query, u)\n res, err := http.Get(u)\n if err != nil {\n return nil, err\n }\n defer res.Body.Close()\n body, err := ioutil.ReadAll(res.Body)\n if err != nil {\n return nil, err\n }\n if res.StatusCode != 200 {\n c.log(\"error response '%d' -> %s\", res.StatusCode, string(body))\n }\n var s SearchResponse\n if err := json.Unmarshal(body, &s); err != nil {\n return nil, err\n }\n return s.Data, nil\n}", "title": "" }, { "docid": "b17fd4b880071f9c42a3f011b040c64a", "score": "0.48398027", "text": "func detectAll(ctx context.Context, detectors ...Detector) (*Resource, error) {\n\tvar res *Resource\n\tfor _, d := range detectors {\n\t\tr, err := d(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres = merge(res, r)\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "01d36982e00348bbe870a8ae173837c4", "score": "0.4833798", "text": "func QueryImage() []CRImage {\n\tvar image []CRImage\n\t_, err := dbmap.Select(&image, \"select * from cr_image\")\n\tcheckErr(err, \"Select failed\")\n\treturn image\n}", "title": "" }, { "docid": "ee7a89d92703c420204295078ad1a830", "score": "0.48312244", "text": "func GetUserPostImageList(userID int) []dto.PostImage {\n\tlogfile, er := os.OpenFile(utils.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)\n\tif er != nil {\n\t\tpanic(er.Error())\n\t}\n\tdefer logfile.Close()\n\t// Initalize DB Connection\n\tsql, sqlErr := utils.DBInit()\n\tif sqlErr != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(sqlErr)\n\t}\n\t// Close DB connection at the end.\n\tdefer sql.Close()\n\t// SQL syntax\n\tgetImages := `SELECT \n\t\t\t\t\t\tphoto_url, \n\t\t\t\t\t\tuser_id, \n\t\t\t\t\t\tarticle_id \n\t\t\t\t\tFROM \n\t\t\t\t\t\tphoto_table\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tuser_id = ?;`\n\n\trow, err := sql.Query(getImages, userID)\n\n\tif err != nil {\n\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\tlog.Fatal(err)\n\t}\n\t// Prepare an array which save JSON results.\n\tvar imageArray []dto.PostImage\n\n\tfor row.Next() {\n\t\tposts := dto.PostImage{}\n\t\tif err := row.Scan(&posts.ImageURL, &posts.UserID, &posts.ArticleID); err != nil {\n\t\t\tlog.SetOutput(io.MultiWriter(logfile, os.Stdout))\n\t\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Appending JSON in array.\n\t\timageArray = append(imageArray, posts)\n\t}\n\treturn imageArray\n}", "title": "" }, { "docid": "6e510074839f8094a0ffe14c6549a604", "score": "0.4825698", "text": "func GetAllImages(query map[string]string, fields []string, sortby []string, order []string,\n\toffset int64, limit int64) (ml []interface{}, err error) {\n\to := orm.NewOrm()\n\tqs := o.QueryTable(new(Images))\n\t// query k=v\n\tfor k, v := range query {\n\t\t// rewrite dot-notation to Object__Attribute\n\t\tk = strings.Replace(k, \".\", \"__\", -1)\n\t\tif strings.Contains(k, \"isnull\") {\n\t\t\tqs = qs.Filter(k, (v == \"true\" || v == \"1\"))\n\t\t} else {\n\t\t\tqs = qs.Filter(k, v)\n\t\t}\n\t}\n\t// order by:\n\tvar sortFields []string\n\tif len(sortby) != 0 {\n\t\tif len(sortby) == len(order) {\n\t\t\t// 1) for each sort field, there is an associated order\n\t\t\tfor i, v := range sortby {\n\t\t\t\torderby := \"\"\n\t\t\t\tif order[i] == \"desc\" {\n\t\t\t\t\torderby = \"-\" + v\n\t\t\t\t} else if order[i] == \"asc\" {\n\t\t\t\t\torderby = v\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, errors.New(\"Error: Invalid order. Must be either [asc|desc]\")\n\t\t\t\t}\n\t\t\t\tsortFields = append(sortFields, orderby)\n\t\t\t}\n\t\t\tqs = qs.OrderBy(sortFields...)\n\t\t} else if len(sortby) != len(order) && len(order) == 1 {\n\t\t\t// 2) there is exactly one order, all the sorted fields will be sorted by this order\n\t\t\tfor _, v := range sortby {\n\t\t\t\torderby := \"\"\n\t\t\t\tif order[0] == \"desc\" {\n\t\t\t\t\torderby = \"-\" + v\n\t\t\t\t} else if order[0] == \"asc\" {\n\t\t\t\t\torderby = v\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, errors.New(\"Error: Invalid order. Must be either [asc|desc]\")\n\t\t\t\t}\n\t\t\t\tsortFields = append(sortFields, orderby)\n\t\t\t}\n\t\t} else if len(sortby) != len(order) && len(order) != 1 {\n\t\t\treturn nil, errors.New(\"Error: 'sortby', 'order' sizes mismatch or 'order' size is not 1\")\n\t\t}\n\t} else {\n\t\tif len(order) != 0 {\n\t\t\treturn nil, errors.New(\"Error: unused 'order' fields\")\n\t\t}\n\t}\n\n\tvar l []Images\n\tqs = qs.OrderBy(sortFields...)\n\tif _, err = qs.Limit(limit, offset).Filter(\"deleted_at__isnull\", true).RelatedSel().All(&l, fields...); err == nil {\n\t\tif len(fields) == 0 {\n\t\t\tfor _, v := range l {\n\t\t\t\tml = append(ml, v)\n\t\t\t}\n\t\t} else {\n\t\t\t// trim unused fields\n\t\t\tfor _, v := range l {\n\t\t\t\tm := make(map[string]interface{})\n\t\t\t\tval := reflect.ValueOf(v)\n\t\t\t\tfor _, fname := range fields {\n\t\t\t\t\tm[fname] = val.FieldByName(fname).Interface()\n\t\t\t\t}\n\t\t\t\tml = append(ml, m)\n\t\t\t}\n\t\t}\n\t\treturn ml, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "c214f75dbcf68f938f59ee9972cd5b18", "score": "0.48176917", "text": "func (s *imageTagMirrorSetLister) List(selector labels.Selector) (ret []*v1.ImageTagMirrorSet, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.ImageTagMirrorSet))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "0ad650a6e63253fc4fd5f66be0edbe66", "score": "0.48151264", "text": "func (client *Client) ListImages(all bool) ([]api.Image, error) {\n\topts := images.ListOpts{}\n\n\t// Retrieve a pager (i.e. a paginated collection)\n\tpager := images.List(client.Compute, opts)\n\n\tvar imgList []api.Image\n\n\t// Define an anonymous function to be executed on each page's iteration\n\terr := pager.EachPage(func(page pagination.Page) (bool, error) {\n\t\timageList, err := images.ExtractImages(page)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, img := range imageList {\n\t\t\timgList = append(imgList, api.Image{ID: img.ID, Name: img.Name})\n\n\t\t}\n\t\treturn true, nil\n\t})\n\tif len(imgList) == 0 {\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error listing images: %s\", ProviderErrorToString(err))\n\t\t}\n\t}\n\treturn imgList, nil\n}", "title": "" }, { "docid": "9ae90fce752c979e261bcf97feb84411", "score": "0.48117697", "text": "func (o GetImagesFilterOutput) All() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GetImagesFilter) *bool { return v.All }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "615241d07173e4af5fb453739e6e8154", "score": "0.47910854", "text": "func (a *ImageByNameApiService) GetRatingImages(ctx _context.Context) ([]ImageByNameInfo, *_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 []ImageByNameInfo\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Images/Ratings\"\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\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\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": "13bcfccf1bb67013f4bc94b6114f8f88", "score": "0.47865978", "text": "func (e *entStorage) Query(ctx context.Context, param ImageFilterParams) ([]*ent.Image, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "9401f9d635854d93026754d5728bf2ec", "score": "0.47616774", "text": "func (q blobQuery) All(exec boil.Executor) (BlobSlice, error) {\n\tvar o []*Blob\n\n\terr := q.Bind(nil, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"db: failed to assign all query results to Blob slice\")\n\t}\n\n\tif len(blobAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(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": "b1898fb6e2ae718e10e28b0d4c1bf42c", "score": "0.47610125", "text": "func GetAllTags(db *sql.DB) []TagDB {\n\trows, err := db.Query(`SELECT ID, NAME FROM Tags`)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\tvar tags = scanTags(rows)\n\treturn tags\n}", "title": "" }, { "docid": "d00484117399ed70a4c62bdc5082d88e", "score": "0.4759533", "text": "func getPhotoNames(ctx context.Context, client *storage.Client) []string {\n\n\tquery := &storage.Query{\n\t\tMaxResults: 4, // Limiting the end result to 4 images.\n\t\tDelimiter: \"/\",\n\t\tPrefix: \"photos/\",\n\t}\n\tobjs, err := client.Bucket(BUCKET_NAME).List(ctx, query)\n\tlogError(err)\n\n\tvar names []string\n\tfor _, result := range objs.Results {\n\t\tnames = append(names, result.Name)\n\t}\n\treturn names\n}", "title": "" }, { "docid": "3bb0065edde6dac59ce1ec98865dbcb0", "score": "0.4754298", "text": "func (b *IodBing) GetImages() ([]DisplayImage, error) {\n\tb.LogInfo(\"Getting latest list of images from Bing.\")\n\n\tl := []DisplayImage{}\n\t// Get the data from the Bing web site\n\tresp, err := http.Get(fmt.Sprintf(\"http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=%d&mkt=za\", b.Config.ImgCount))\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\t\tresp.Close = true\n\t}\n\tif err == nil {\n\t\tj, err := ioutil.ReadAll(resp.Body)\n\t\tif err == nil {\n\t\t\tbd := bingdata{}\n\t\t\terr = json.Unmarshal(j, &bd)\n\t\t\tif err == nil {\n\t\t\t\tl, err = b.downloadImages(&bd)\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\t// Check to see if we already have the last response cached\n\t\tfn := \"lastiodbing.json\"\n\t\tif _, err := os.Stat(fn); !os.IsNotExist(err) {\n\t\t\t// Deserialize the last cached list\n\t\t\tb, err := ioutil.ReadFile(fn)\n\t\t\tif err == nil {\n\t\t\t\terr = json.Unmarshal(b, &l)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn l, err\n}", "title": "" }, { "docid": "704d8eceab36ecbcc1acf6d6f17dc738", "score": "0.4747613", "text": "func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) {\n\tvar images []types.ImageSummary\n\tquery := url.Values{}\n\n\toptionFilters := options.Filters\n\treferenceFilters := optionFilters.Get(\"reference\")\n\tif versions.LessThan(cli.version, \"1.25\") && len(referenceFilters) > 0 {\n\t\tquery.Set(\"filter\", referenceFilters[0])\n\t\tfor _, filterValue := range referenceFilters {\n\t\t\toptionFilters.Del(\"reference\", filterValue)\n\t\t}\n\t}\n\tif optionFilters.Len() > 0 {\n\t\t//nolint:staticcheck // ignore SA1019 for old code\n\t\tfilterJSON, err := filters.ToParamWithVersion(cli.version, optionFilters)\n\t\tif err != nil {\n\t\t\treturn images, err\n\t\t}\n\t\tquery.Set(\"filters\", filterJSON)\n\t}\n\tif options.All {\n\t\tquery.Set(\"all\", \"1\")\n\t}\n\tif options.SharedSize && versions.GreaterThanOrEqualTo(cli.version, \"1.42\") {\n\t\tquery.Set(\"shared-size\", \"1\")\n\t}\n\n\tserverResp, err := cli.get(ctx, \"/images/json\", query, nil)\n\tdefer ensureReaderClosed(serverResp)\n\tif err != nil {\n\t\treturn images, err\n\t}\n\n\terr = json.NewDecoder(serverResp.body).Decode(&images)\n\treturn images, err\n}", "title": "" }, { "docid": "8b405946228c758daa5ebde810e7c736", "score": "0.4746048", "text": "func (r *BookmarkRepository) GetAll() ([]*Bookmark, error) {\n\t// TODO\n}", "title": "" }, { "docid": "b958845e8e9d78833643e2ef1a11ddbd", "score": "0.4737668", "text": "func getJpegImgs(imagesUrl []Url) ([]ImageInfo, error) {\n\timages := make([]ImageInfo, len(imagesUrl))\n\tfor i, img := range imagesUrl {\n\t\timgurl := img.Url\n\t\tresp, err := http.Get(imgurl)\n\t\tif err != nil {\n \treturn nil, err\n }\n\t\tdefer resp.Body.Close()\n\t\t\n\t\timg, err := jpeg.Decode(resp.Body)\n if err != nil {\n \treturn nil, err\n }\n images[i].img = img\n err, images[i].name = nameFromUrl(imgurl)\n if err != nil {\n\t\t\treturn nil, err\t\n\t\t}\n }\n return images, nil\n}", "title": "" }, { "docid": "771e15fca71a91b17c1fc876621f972b", "score": "0.47360343", "text": "func GetIcons() error {\n\tfmt.Println(\"Getting clan icons...\")\n\tclans, err := db.GetCurrentClansData()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\timgAndID := []imageAndIDType{}\n\n\tvar waitForImgs sync.WaitGroup\n\twaitForImgs.Add(len(clans))\n\n\tfor _, clan := range clans {\n\t\tgo func(clan db.ClanStats) {\n\t\t\tdefer waitForImgs.Done()\n\n\t\t\ticonToGet, ok := clan.Emblems[\"X195.Portal\"]\n\t\t\tif !ok || len(iconToGet) == 0 {\n\t\t\t\ticonToGet, ok = clan.Emblems[\"X256.Wowp\"]\n\t\t\t\tif !ok || len(iconToGet) == 0 {\n\t\t\t\t\t// No error reporting here because this happends to often\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !strings.Contains(iconToGet, \"http://\") && !strings.Contains(iconToGet, \"https://\") {\n\t\t\t\tapiErr(\"GetIcons\", errors.New(\"image is not a valid url\"), \"Check if the image url contains http(s)// : \"+iconToGet)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tout, err := RawGet(iconToGet)\n\t\t\tif err != nil {\n\t\t\t\tapiErr(\"GetIcons\", err, \"Can't fetch image: \"+iconToGet)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\timg, _, err := image.Decode(bytes.NewReader(out))\n\t\t\tif err != nil {\n\t\t\t\tapiErr(\"GetIcons\", err, \"Can't decode image: \"+iconToGet)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\timgAndID = append(imgAndID, imageAndIDType{\n\t\t\t\tID: clan.ID,\n\t\t\t\tImage: img,\n\t\t\t})\n\t\t}(clan)\n\t}\n\n\twaitForImgs.Wait()\n\n\tif len(imgAndID) > 0 {\n\t\timgSize := 60\n\t\timgsInARow := 30\n\n\t\tids := [][]string{[]string{}}\n\t\toutputImg := image.NewRGBA(image.Rectangle{image.Point{0, 0}, image.Point{0, 0}})\n\n\t\tfor _, imgObj := range imgAndID {\n\n\t\t\tid := imgObj.ID\n\t\t\tif len(ids[len(ids)-1]) == imgsInARow {\n\t\t\t\tids = append(ids, []string{})\n\t\t\t}\n\t\t\tfrom := struct {\n\t\t\t\ttop int\n\t\t\t\tside int\n\t\t\t}{\n\t\t\t\ttop: len(ids),\n\t\t\t\tside: len(ids[len(ids)-1]),\n\t\t\t}\n\n\t\t\tinsertImg := imaging.Resize(imgObj.Image, imgSize, imgSize, imaging.Lanczos)\n\t\t\toffset := image.Point{imgSize * from.side, imgSize * (from.top - 1)}\n\t\t\twhereToInsert := image.Rectangle{offset, offset.Add(insertImg.Bounds().Size())}\n\t\t\tmaxSize := image.Point{(len(ids[0]) + 1) * imgSize, len(ids) * imgSize}\n\n\t\t\tcanvas := image.NewRGBA(image.Rectangle{image.Point{0, 0}, maxSize})\n\t\t\tdraw.Draw(canvas, outputImg.Bounds(), outputImg, image.Point{0, 0}, draw.Src)\n\t\t\tdraw.Draw(canvas, whereToInsert, insertImg, image.Point{0, 0}, draw.Src)\n\t\t\toutputImg = canvas\n\n\t\t\tids[len(ids)-1] = append(ids[len(ids)-1], id)\n\t\t}\n\n\t\tfile, err := os.Create(\"./icons/allIcons.png\")\n\t\tif err != nil {\n\t\t\tapiErr(\"GetIcons\", err, \"Can't create allIcons.png\")\n\t\t\treturn err\n\t\t}\n\t\tpng.Encode(file, outputImg)\n\t\tfile.Close()\n\n\t\tdoesNotSupportWebPBin := false\n\t\tif runtime.GOARCH == \"arm\" {\n\t\t\tdoesNotSupportWebPBin = true\n\t\t} else if runtime.GOOS == \"linux\" {\n\t\t\toutput, err := ioutil.ReadFile(\"/etc/issue\")\n\t\t\tif err == nil && bytes.Contains(bytes.ToLower(output), []byte(\"alpine\")) {\n\t\t\t\tdoesNotSupportWebPBin = true\n\t\t\t}\n\t\t}\n\n\t\twebpbin.DetectUnsupportedPlatforms()\n\t\tif doesNotSupportWebPBin {\n\t\t\twebpbin.Dest(\"vendor/webp\")\n\t\t}\n\n\t\terr = webpbin.NewCWebP().\n\t\t\tQuality(50).\n\t\t\tInputFile(\"./icons/allIcons.png\").\n\t\t\tOutputFile(\"./icons/allIcons.webp\").\n\t\t\tRun()\n\n\t\tif err != nil {\n\t\t\tapiErr(\"GetIcons\", err, \"Can't create allIcons.webp\")\n\t\t\treturn err\n\t\t}\n\n\t\tdata, err := json.Marshal(ids)\n\t\tif err != nil {\n\t\t\tapiErr(\"GetIcons\", err, \"Can't transform clan id's into json\")\n\t\t\treturn err\n\t\t}\n\n\t\terr = ioutil.WriteFile(\"./icons/allIcons.json\", data, 0666)\n\t\tif err != nil {\n\t\t\tapiErr(\"GetIcons\", err, \"Can't create allIcons.json\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bec6fae63e8e190a5f92793175231704", "score": "0.47310138", "text": "func (v *Vsphere) ListImages(ctx *lepton.Context) error {\n\timages, err := v.GetImages(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Status\", \"Created\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, image := range images {\n\t\tvar row []string\n\t\trow = append(row, image.Name)\n\t\trow = append(row, \"\")\n\t\trow = append(row, \"\")\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "title": "" }, { "docid": "f52697aee125d149bb6fc35151fa63ae", "score": "0.47159186", "text": "func getImages(c echo.Context) error {\n\tdb := c.Get(\"DB\").(*storage.Docktor)\n\tdaemon, err := db.Daemons().FindByID(c.Param(types.DAEMON_ID_PARAM))\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"daemonID\": c.Param(types.DAEMON_ID_PARAM),\n\t\t\t\"error\": err,\n\t\t}).Error(\"Error when retrieving daemon\")\n\t\treturn c.JSON(http.StatusBadRequest, err.Error())\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"daemon\": daemon.Name,\n\t}).Info(\"Daemon retrieved\")\n\n\tim, err := daemon.GetDockerImages()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"daemon\": daemon.Name,\n\t\t\t\"error\": err,\n\t\t}).Error(\"Error when retrieving docker images\")\n\t\treturn c.JSON(http.StatusBadRequest, err.Error())\n\t}\n\n\tlog.Info(\"Docker images retrieved\")\n\n\treturn c.JSON(http.StatusOK, im)\n}", "title": "" }, { "docid": "f1e6217e3250fedf3a0ab882ae1edc22", "score": "0.4713908", "text": "func List(args ...interface{}) (photos []Photo, err error) {\n\terr = db.Select(&photos, \"SELECT * FROM photos ORDER BY id DESC\")\n\treturn\n}", "title": "" }, { "docid": "010bf672c190d745bc244ad1abf7d05d", "score": "0.47113973", "text": "func getImagesFromJSONFile(filePath string) (ImagesReference, error) {\n\tdata, err := ioutil.ReadFile(filepath.Clean(filePath))\n\tif err != nil {\n\t\treturn ImagesReference{}, err\n\t}\n\n\ti := ImagesReference{}\n\tif err := json.Unmarshal(data, &i); err != nil {\n\t\treturn ImagesReference{}, err\n\t}\n\treturn i, nil\n}", "title": "" }, { "docid": "99244252a0ed38be1af6d2897ca22f85", "score": "0.4710311", "text": "func (r *DefaultImagesRepo) Find(image string) (t types.Images, err error) {\n\t// err = r.coll.Find(bson.JavaScript{Code: fmt.Sprintf(\"return this.image.test('%s');\", image)}).All(&t)\n\terr = r.coll.Find(nil).All(&t)\n\treturn t, err\n}", "title": "" } ]
def4383df80b4dd3b9782533a9d5ac9b
Create a new grid of given dimensions
[ { "docid": "65384510885cf9d81a2953ac83f916c5", "score": "0.7160679", "text": "func NewGrid(width int, height int) Grid {\n\tcells := make([][]bool, height)\n\tfor y := range cells {\n\t\tcells[y] = make([]bool, width)\n\t}\n\treturn Grid{cells: cells, Width: width, Height: height}\n}", "title": "" } ]
[ { "docid": "c1b369ce86422c6ab434a3c5a23e960c", "score": "0.7278724", "text": "func NewGrid (w, h int) *Grid {\n\tg := make(Grid, h)\n\tfor i := range g {\n\t\tg[i] = make([]bool, w)\n\t}\n\treturn &g\n}", "title": "" }, { "docid": "43119e4104b68ecce4b40db68e0b5387", "score": "0.72679204", "text": "func NewGrid(rows, cols int) *Grid {\n\tb := [][]*Cell{}\n t := []*Cell{}\n\n for j := 0; j < rows; j++ {\n\t\tt = []*Cell{}\n\t\tfor i := 0; i < cols; i++ {\n\t\t\tc := NewCell(pixel.V(float64(i * CELL_W), float64(j * CELL_H)))\n\t\t\tt = append(t, c)\n\t\t}\n\t\tb = append(b, t)\n\t}\n\n return &Grid{\n \tb: b,\n \tsettingUp: true,\n\t}\n\n}", "title": "" }, { "docid": "bebc65934c77b480a8c67179c7e856a8", "score": "0.71594316", "text": "func NewGrid(h, size int) *Grid {\n\tcells := make([][]bool, h)\n\tfor i := 0; i < h; i++ {\n\t\tcells[i] = make([]bool, h)\n\t}\n\treturn &Grid{h: h, cellSize: size, Cells: cells}\n}", "title": "" }, { "docid": "4bb45dea08a364df710af00c70763177", "score": "0.7052424", "text": "func NewGrid(numRows, numCols int) Grid {\n\tgrid := make([][]State, numRows)\n\tfor i := 0; i < numRows; i++ {\n\t\tgrid[i] = make([]State, numCols)\n\t}\n\treturn Grid{\n\t\tRows: numRows,\n\t\tCols: numCols,\n\t\tState: grid,\n\t}\n}", "title": "" }, { "docid": "d45fcddaece5eedaad664d390b56475d", "score": "0.6903365", "text": "func MakeGrid(width int, height int) Screen {\n grid := make([][][]int , height)\n zbuffer := make([][]float64,height)\n\tfor i := range grid {\n\t\tgrid[i] = make([][]int, width)\n zbuffer[i] = make([]float64, width)\n\t\tfor j := range grid[i] {\n\t\t\tgrid[i][j] = make([]int, 3)\n zbuffer[i][j] = math.MaxFloat64 * -1\n\t\t}\n\t}\n\treturn Screen{grid,zbuffer}\n}", "title": "" }, { "docid": "43bec3c0adcca53425086fdb0d0b8ded", "score": "0.6712594", "text": "func NewGrid(width, height int) Grid {\n\tvar cells [][]*Cell\n\tvar allCells []*Cell\n\tgrid := Grid{Width: width, Height: height, Cells: cells}\n\tfor x := 0; x < width; x++ {\n\t\tvar row []*Cell\n\t\tfor y := 0; y < height; y++ {\n\t\t\tcell := grid.newCell(x, y)\n\t\t\trow = append(row, &cell)\n\t\t\tallCells = append(allCells, &cell)\n\t\t}\n\t\tcells = append(cells, row)\n\t}\n\tgrid.Cells = cells\n\tgrid.AllCells = allCells\n\treturn grid\n}", "title": "" }, { "docid": "e621b47512bfa3d6d8442f52ad46c871", "score": "0.65653867", "text": "func makeGrid(cols int, rows int) [][]int {\n\n\tgrid := make([][]int, rows)\n\n\tfor i := 0; i < rows; i++ {\n\n\t\tgrid[i] = make([]int, cols)\n\n\t\tfor j := 0; j < cols; j++ {\n\n\t\t\tgrid[i][j] = rand.Intn(2)\n\t\t}\n\t}\n\n\treturn grid\n}", "title": "" }, { "docid": "2f918979816574f7d1d2b5d29b9ff976", "score": "0.6484991", "text": "func NewGrid(vals []int) (g *Grid, err error) {\n\n\tif vals == nil || len(vals) != 81 {\n\t\terr = fmt.Errorf(\"Board initialization error. Board is nil or values less than 81\")\n\t\treturn\n\t}\n\n\trep := make(map[int][]Cell)\n\n\t//read row based array\n\t//row 1 starts array index 0, row 2 at index 11\n\tfor i, row, col := 0, 1, 1; i < len(vals); i++ {\n\t\trep[row] = append(rep[row], NewCell(row, col, vals[i]))\n\t\tcol++\n\n\t\tif (i+1)%9 == 0 {\n\t\t\trow++\n\t\t\tcol = 1\n\t\t}\n\t}\n\n\tvar keys []int\n\tfor k := range rep {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Ints(keys)\n\n\tg = &Grid{nums: rep, sortedKeys: keys}\n\n\tg.computeAllConstraints()\n\treturn\n}", "title": "" }, { "docid": "0522eb0849db003b5ef9e0b63792fab0", "score": "0.6475616", "text": "func createCells () [][]int {\n // Allocate the top-level slice.\n cells := make([][]int, GRID_HEIGHT) // One row per unit of y.\n // Loop over the rows, allocating the slice for each row.\n for i := range cells {\n cells[i] = make([]int, GRID_WIDTH)\n }\n return cells\n}", "title": "" }, { "docid": "0522eb0849db003b5ef9e0b63792fab0", "score": "0.6475616", "text": "func createCells () [][]int {\n // Allocate the top-level slice.\n cells := make([][]int, GRID_HEIGHT) // One row per unit of y.\n // Loop over the rows, allocating the slice for each row.\n for i := range cells {\n cells[i] = make([]int, GRID_WIDTH)\n }\n return cells\n}", "title": "" }, { "docid": "d71c5f360ee23afc208db28880fd3529", "score": "0.647523", "text": "func NewGrid(cols, rows int) *Grid {\n\treturn &Grid{\n\t\tcols: cols,\n\t\trows: rows,\n\t\tcells: make(map[image.Point]Widget),\n\t\tcolumnStretch: make(map[int]int),\n\t\trowStretch: make(map[int]int),\n\t}\n}", "title": "" }, { "docid": "27248d61b508767f2c018144ef58c210", "score": "0.6438097", "text": "func (g *grid) create(width, height int, cellType bool) {\n\tgridWidth, gridHeight := g.validateSize(width), g.validateSize(height)\n\tg.cells = make([][]*cell, gridWidth)\n\tfor x, _ := range g.cells {\n\t\tg.cells[x] = make([]*cell, gridHeight)\n\t\tfor y, _ := range g.cells[x] {\n\t\t\tg.cells[x][y] = &cell{x, y, cellType}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "05f989088ef3df51a625752662db626e", "score": "0.6426827", "text": "func GetNewGrid(size int) [][]int {\n\tnewGrid := [][]int{}\n\tfor i := 0; i < size; i++ {\n\t\tnewGrid = append(newGrid, []int{})\n\t\tfor j := 0; j < size; j++ {\n\t\t\tnewGrid[i] = append(newGrid[i], 0)\n\t\t}\n\t}\n\treturn newGrid\n}", "title": "" }, { "docid": "c4a9354c091b62c369793588218449d8", "score": "0.6421574", "text": "func NewGrid(r, c int, open bool) *Grid {\n\tstates := make([]bool, r*c)\n\tif open {\n\t\tfor i := range states {\n\t\t\tstates[i] = true\n\t\t}\n\t}\n\treturn &Grid{\n\t\topen: states,\n\t\tr: r,\n\t\tc: c,\n\t}\n}", "title": "" }, { "docid": "3d6a4152c0b6262cb844da9385f712f1", "score": "0.6378403", "text": "func New() *Grid {\n\tg := &Grid{}\n\tg._m = make([]uint16, W*H)\n\treturn g\n}", "title": "" }, { "docid": "7b4da57862ec961f0d95a37123136fae", "score": "0.6367084", "text": "func NewGrid(cols, rows int, glyphs *font.Font) (g *Grid) {\n\twidth, height := glyphs.Size()\n\twidth *= 2 * cols\n\theight *= 2 * rows\n\tg = &Grid{\n\t\tfont: glyphs,\n\t\timg: ebiten.NewImage(width, height),\n\t}\n\treturn\n}", "title": "" }, { "docid": "27413befa3672b2220ad39699beaa484", "score": "0.6108279", "text": "func newGridRect(x1, y1, x2, y2 int) gridRect {\n\treturn gridRect{gridPoint(x1), gridPoint(y1), gridPoint(x2), gridPoint(y2)}\n}", "title": "" }, { "docid": "880031eafaa8d7a3e90561bad62f8cb3", "score": "0.6048958", "text": "func CreateBoard(size, pile int) Board {\n\tvar rownum int = size\n\tvar columnnum int = size\n\tvar newvalue [][]int = make([][]int, size)\n\tfor row := range newvalue {\n\t\tnewvalue[row] = make([]int, size)\n\t}\n\tnewvalue[size/2][size/2] = pile\n\treturn Board{rownum, columnnum, newvalue}\n\n}", "title": "" }, { "docid": "c659828a08bc7d9a9466992d52d6a05b", "score": "0.6032879", "text": "func (svg *SVG) Grid(x float64, y float64, w float64, h float64, n float64, s ...string) {\n\n\tif len(s) > 0 {\n\t\tsvg.Gstyle(s[0])\n\t}\n\tfor ix := x; ix <= x+w; ix += n {\n\t\tsvg.Line(ix, y, ix, y+h)\n\t}\n\n\tfor iy := y; iy <= y+h; iy += n {\n\t\tsvg.Line(x, iy, x+w, iy)\n\t}\n\tif len(s) > 0 {\n\t\tsvg.Gend()\n\t}\n\n}", "title": "" }, { "docid": "dee4b1c7621cfb79c3a1cf782846f3c3", "score": "0.6007451", "text": "func New(tiles []tile.Tile, height int, width int) *Board {\n\tboard := &Board{}\n\tboard.dimension.Height = height\n\tboard.dimension.Width = width\n\tboard.Size = board.dimension.Height * board.dimension.Width\n\tboard.Tiles = tiles\n\n\tfor i := 0; i < height; i++ {\n\t\tfor j := 0; j < width; j++ {\n\t\t\tidx := (i * width) + j\n\t\t\tboard.Tiles[idx].Coordinate.X = j\n\t\t\tboard.Tiles[idx].Coordinate.Y = i\n\t\t\tboard.Tiles[idx].SetPaths(board.dimension, board.Tiles)\n\t\t}\n\t}\n\treturn board\n}", "title": "" }, { "docid": "1369b8eeddc9452d611da9f778bd13f4", "score": "0.5980119", "text": "func New(m image.Image) Grid {\n\tb := m.Bounds()\n\tc := make([]*color.RGBA, b.Max.X*b.Max.Y)\n\tfor y := 0; y < b.Max.Y; y++ {\n\t\tfor x := 0; x < b.Max.X; x++ {\n\t\t\ti := y*b.Max.X + x\n\t\t\trgba := color.RGBAModel.Convert(m.At(x, y)).(color.RGBA)\n\t\t\tc[i] = &rgba\n\t\t}\n\t}\n\treturn gridarray{width: b.Max.X, height: b.Max.Y, colours: c}\n}", "title": "" }, { "docid": "a32b0ae157f77da812340046df05a569", "score": "0.59624815", "text": "func NewGrid() *Grid {\n\tg := &Grid{\n\t\tvalues: make(map[Point]rune),\n\t\truneColor: make(map[rune]*color.Color),\n\t\tblank: '.',\n\t}\n\treturn g\n}", "title": "" }, { "docid": "7930d0d4f6e67ce02922fd1cc227bc22", "score": "0.59058344", "text": "func NewGridFrom(rows ...string) *Grid {\n\tif len(rows) == 0 {\n\t\treturn nil\n\t}\n\tfor i, r := range rows[:len(rows)-1] {\n\t\tif len(r) != len(rows[i+1]) {\n\t\t\tpanic(\"grid: unequal row lengths\")\n\t\t}\n\t}\n\tstates := make([]bool, 0, len(rows)*len(rows[0]))\n\tfor _, r := range rows {\n\t\tfor _, b := range r {\n\t\t\tswitch b {\n\t\t\tcase Closed:\n\t\t\t\tstates = append(states, false)\n\t\t\tcase Open:\n\t\t\t\tstates = append(states, true)\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"grid: invalid state: %q\", r))\n\t\t\t}\n\t\t}\n\t}\n\treturn &Grid{\n\t\topen: states,\n\t\tr: len(rows),\n\t\tc: len(rows[0]),\n\t}\n}", "title": "" }, { "docid": "62912d51d9b5a84d1757e7142395a2be", "score": "0.5881759", "text": "func GenNewGrid(g Game, grid [][]int) [][]int {\n\tnewGrid := BlankGrid(g)\n\tfor y := range grid {\n\t\tfor x := range grid[y] {\n\t\t\tnewGrid[y][x] = Generation(grid, y, x)\n\t\t}\n\t}\n\treturn newGrid\n}", "title": "" }, { "docid": "f1d3a2beb5589299371aa6215ad52260", "score": "0.5871198", "text": "func NewBoard(length, width int) Board {\n\tboard := make([][]Cell, 0, length)\n\tfor i := 0; i < length; i++ {\n\t\trow := make([]Cell, width, width)\n\t\tboard = append(board, row)\n\t}\n\treturn board\n}", "title": "" }, { "docid": "5c05eef8d83499c50f6dd4d311724eeb", "score": "0.58557993", "text": "func CreatePrismGrid(dimensionLengths []int) *GridDefinition {\n\n\t/*\n\t\tCreate the size of each dimension.\n\t\tUse this value to index and un-index things.\n\t*/\n\ttotalCells := 1\n\tdimensionSizes := []int{}\n\tfor _, l := range dimensionLengths {\n\t\tdimensionSizes = append(dimensionSizes, totalCells)\n\t\ttotalCells *= l\n\t}\n\n\t// Generate the connections array first\n\tconnections := [][]int{}\n\tfor i := 0; i < totalCells; i++ {\n\t\tlocation := getLocation(dimensionSizes, i)\n\n\t\t// Generate each of the modified locations based on the current location\n\t\tconnectionLocations := []int{}\n\t\tfor i, x := range location {\n\n\t\t\t// Move in the negative direction along an axis\n\t\t\tif x > 0 {\n\t\t\t\tnewLocation := make([]int, len(location))\n\t\t\t\tcopy(newLocation, location)\n\t\t\t\tnewLocation[i] = x - 1\n\t\t\t\tconnectionLocations = append(connectionLocations, getIndex(dimensionSizes, newLocation))\n\t\t\t}\n\n\t\t\t// Move in the positive direction along an axis\n\t\t\tif x < dimensionLengths[i]-1 {\n\t\t\t\tnewLocation := make([]int, len(location))\n\t\t\t\tcopy(newLocation, location)\n\t\t\t\tnewLocation[i] = x + 1\n\t\t\t\tconnectionLocations = append(connectionLocations, getIndex(dimensionSizes, newLocation))\n\t\t\t}\n\n\t\t}\n\n\t\t// Add the generated locations for this cell to connections\n\t\tconnections = append(connections, connectionLocations)\n\n\t}\n\n\t// Generate all the symettries. First we need the base symmetry\n\tsymmetryHashes := map[string]bool{}\n\tsymmetries := [][]int{}\n\n\t// Now apply all the other ones by dimension\n\tfor _, dimensionInformation := range GetBinaryArrays(len(dimensionLengths)) {\n\n\t\torder := GetOrderedLocations(dimensionLengths, dimensionInformation)\n\t\tindexOrder := []int{}\n\t\tfor _, location := range order {\n\t\t\tindexOrder = append(indexOrder, getIndex(dimensionSizes, location))\n\t\t}\n\n\t\thash := hashSymmetry(indexOrder)\n\t\tif _, exists := symmetryHashes[hash]; !exists {\n\t\t\tsymmetryHashes[hash] = true\n\t\t\tsymmetries = append(symmetries, indexOrder)\n\t\t}\n\n\t}\n\n\treturn &GridDefinition{\n\t\tConnections: connections,\n\t\tSymmetries: symmetries,\n\t}\n}", "title": "" }, { "docid": "03ac14c5b5bcccf2ea520cebfc7eed1b", "score": "0.5845518", "text": "func NewGrid() *Grid {\n\treturn &Grid{grid: make(map[string]map[string]map[string]*Mapped), maxx: 0, maxy: 0}\n}", "title": "" }, { "docid": "8c4909dd0445422fa725c720d0f9fb33", "score": "0.58299667", "text": "func CreateLinearGrid(n int) *GridDefinition {\n\n\t// First create the connections\n\tconnections := [][]int{}\n\tfor i := 0; i < n; i += 1 {\n\t\tnode := []int{}\n\t\tif i > 0 {\n\t\t\tnode = append(node, i-1)\n\t\t}\n\t\tif i < n-1 {\n\t\t\tnode = append(node, i+1)\n\t\t}\n\t\tconnections = append(connections, node)\n\t}\n\n\t// Then create the symettries\n\tforward, backward := []int{}, []int{}\n\tfor i := 0; i < n; i += 1 {\n\t\tforward = append(forward, i)\n\t\tbackward = append(backward, n-i-1)\n\t}\n\tsymmetries := [][]int{forward, backward}\n\n\treturn &GridDefinition{\n\t\tConnections: connections,\n\t\tSymmetries: symmetries,\n\t}\n\n}", "title": "" }, { "docid": "1549b29e842bf1ad131afa0f2d2e93f1", "score": "0.5824979", "text": "func NewGrid(model GridModel) *Grid {\n\treturn &Grid{model, 0, 0, 0, 0, -1, -1}\n}", "title": "" }, { "docid": "d5da26881707d0d9031c75851599dbbc", "score": "0.581858", "text": "func NewGrid(max int, f func(x, y int) Celler) (*Grid, error) {\n\tg := &Grid{\n\t\tValues: make(map[string]Celler),\n\t\tmax: max,\n\t\tblockWidth: int(math.Sqrt(float64(max))),\n\t}\n\n\tif float64(g.blockWidth) != math.Sqrt(float64(max)) {\n\t\treturn nil, ErrInvalidSquare\n\t}\n\n\tfor i := 0; i < max; i++ {\n\t\tfor j := 0; j < max; j++ {\n\t\t\tv := f(i, j)\n\t\t\tg.Values[v.Key()] = v\n\t\t}\n\t}\n\treturn g, nil\n}", "title": "" }, { "docid": "58191c35810ceb832d69c66f3118b9b3", "score": "0.5811067", "text": "func SetGridSize(customCols, customRows int) {\n\n\tnextGen = makeGrid(customCols, customRows)\n}", "title": "" }, { "docid": "16d454f5a980cc3bebe23ef76811fbd9", "score": "0.5681682", "text": "func createNewWorld(width int, height int) [][]byte {\n\t// Create the 2D slice to store the world.\n\tworld := make([][]byte, height)\n\tfor i := range world {\n\t\tworld[i] = make([]byte, width)\n\t}\n\treturn world\n}", "title": "" }, { "docid": "dbf11ab0a6b73a084679803d33b62de9", "score": "0.5647631", "text": "func makeBoard(n int) *ttt_board {\n\tvar B ttt_board\n\tB.size = n\n\tB.xcount = 0\n\tB.ycount = 0\n\n\tfor i := 0; i < n; i++ {\n\t\trow := []int{}\n\t\tfor j := 0; j < n; j++ {\n\t\t\trow = append(row, 0)\n\t\t}\n\n\t\t// B.board[i] = row\n\t\tB.board = append(B.board, row)\n\t}\n\n\treturn &B\n}", "title": "" }, { "docid": "fd210e9452a13b1cc37d4fab358025d4", "score": "0.56327474", "text": "func complex4x4Grid() *maze.Grid {\n\tg := maze.NewGrid(4, 4)\n\t//0>\n\tg.Cell(0, 0).Link(g.Cell(0, 1))\n\tg.Cell(0, 1).Link(g.Cell(0, 2))\n\tg.Cell(0, 2).Link(g.Cell(0, 3))\n\t//0V\n\tg.Cell(0, 0).Link(g.Cell(1, 0))\n\tg.Cell(0, 1).Link(g.Cell(1, 1))\n\tg.Cell(0, 3).Link(g.Cell(1, 3))\n\t//1>\n\tg.Cell(1, 1).Link(g.Cell(1, 2))\n\t//1V\n\tg.Cell(1, 2).Link(g.Cell(2, 2))\n\t//2>\n\tg.Cell(2, 0).Link(g.Cell(2, 1))\n\tg.Cell(2, 1).Link(g.Cell(2, 2))\n\tg.Cell(2, 2).Link(g.Cell(2, 3))\n\t//2V\n\tg.Cell(2, 0).Link(g.Cell(3, 0))\n\tg.Cell(2, 2).Link(g.Cell(3, 2))\n\tg.Cell(2, 3).Link(g.Cell(3, 3))\n\t//3>\n\tg.Cell(3, 0).Link(g.Cell(3, 1))\n\t//3V\n\treturn g\n}", "title": "" }, { "docid": "ddf4822b2a799c9e092d836bd79dda4d", "score": "0.5590165", "text": "func NewBoard(size int) *Board {\n\tvar b [][]int\n\t// initialize the board\n\tb = make([][]int, size)\n\tfor i := 0; i < size; i++ {\n\t\tb[i] = make([]int, size)\n\t}\n\treturn &Board{b, size}\n}", "title": "" }, { "docid": "d82cc2cbcad41f233e20bdd73073d3f9", "score": "0.5565111", "text": "func newBlocks(width, height int) [][]Block {\n\tblocks := make([][]Block, width)\n\n\tfor i, _ := range blocks {\n\t\t// blocks[i] = make([]Block, height+1)\n\t\tblocks[i] = make([]Block, height)\n\t}\n\treturn blocks\n}", "title": "" }, { "docid": "8ea68540a92070f16be6c1d6924460e1", "score": "0.5557877", "text": "func (g *game) makeGrid() {\n\trand.Seed(time.Now().UTC().UnixNano())\n\toccupiedCells := 0\n\tg.maxFlags = g.numMines\n\n\tfor occupiedCells < g.maxFlags {\n\t\trandRow := rand.Intn(g.Height)\n\t\trandColumn := rand.Intn(g.Width)\n\t\tif g.grid[randRow][randColumn] == EmptyRune {\n\t\t\tg.grid[randRow][randColumn] = MineRune\n\t\t\tg.mines = append(g.mines, point{Row: randRow, Column: randColumn})\n\t\t\toccupiedCells++\n\t\t}\n\t}\n\n\tg.removeUntouchableRunes()\n\tg.precomputeSurroundingMines()\n}", "title": "" }, { "docid": "6ebf9249bc90cd2ea69d2687911d9e51", "score": "0.5544823", "text": "func (m *Maze) prepareGrid() error {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tif m.columns <= 0 || m.rows <= 0 {\n\t\treturn fmt.Errorf(\"invalid maze dimensions: %v, %v\", m.columns, m.rows)\n\t}\n\n\tz := int64(0)\n\tm.cells = make([][]*Cell, m.columns)\n\n\tfor x := int64(0); x < m.columns; x++ {\n\t\tm.cells[x] = make([]*Cell, m.rows)\n\n\t\tfor y := int64(0); y < m.rows; y++ {\n\t\t\tm.cells[x][y] = NewCell(x, y, z, m.config)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4f3d0d104e7aee85a09f82044e52fbb7", "score": "0.55265075", "text": "func NewBoard(size int) *Board {\n\n\ttempCells := make([][]*cell.Cell, size)\n\n\tfor i := range tempCells {\n\t\ttempCells[i] = make([]*cell.Cell, size)\n\t\tfor j := range tempCells[i] {\n\t\t\ttempCell := cell.NewCell()\n\t\t\ttempCells[i][j] = tempCell\n\t\t}\n\t}\n\n\tvar boardTest = &Board{\n\t\tcells: tempCells,\n\t\tsize: size,\n\t}\n\treturn boardTest\n}", "title": "" }, { "docid": "5412f5ec734dd5d3ae2f047618fe9f00", "score": "0.548651", "text": "func New(width, height, numMines int) (g game) {\n\tg.firstMove = true\n\tg.flaggedCells = 0\n\tg.shownCells = 0\n\tg.numMines = numMines\n\tg.Width = width\n\tg.Height = height\n\tg.initGrids()\n\treturn\n}", "title": "" }, { "docid": "be3850ad1964f958c3046de76131a965", "score": "0.5482667", "text": "func (g *Grid) prepareGrid() {\n\tcells := [][]*Cell{}\n\tfor i := 0; i < g.rows; i++ {\n\t\tcells = append(cells, []*Cell{})\n\t\tfor j := 0; j < g.columns; j++ {\n\t\t\tcells[i] = append(cells[i], newCell(i, j))\n\t\t}\n\t}\n\tg.cells = cells\n}", "title": "" }, { "docid": "06ebfd4d5d76bae7f5785783700bfe25", "score": "0.5477748", "text": "func Grid(x, y int) string {\n\tvar sb strings.Builder\n\tchars := []byte{'x', 'o'}\n\tcharIdx := 0\n\tfor i := 0; i < y; i++ {\n\t\tfor j := 0; j < x; j++ {\n\t\t\tsb.WriteByte(chars[charIdx])\n\t\t\tcharIdx = 1 - charIdx // alternates between 0 and 1\n\t\t}\n\t\tsb.WriteByte('\\n')\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "1c06203855710ff5f764a33084895b5c", "score": "0.5476046", "text": "func NewVoxelGrid(width, height, depth float32, resolution uint) *VoxelGrid {\n\tw := uint(math32.Ceil(math32.Abs(width * float32(resolution))))\n\th := uint(math32.Ceil(math32.Abs(height * float32(resolution))))\n\td := uint(math32.Ceil(math32.Abs(depth * float32(resolution))))\n\n\treturn &VoxelGrid{\n\t\tresolution: resolution,\n\t\tcounts: [3]uint{w, h, d},\n\t\tvoxels: make([]Voxel, w*h*d),\n\t}\n}", "title": "" }, { "docid": "4bbad1d80f9dc5afde5ec90edab1527f", "score": "0.5459908", "text": "func newBoard(n int) Board {\n\tb := make([][]uint8, n)\n\tfor i := range b {\n\t\tb[i] = make([]uint8, n)\n\t}\n\treturn Board{b}\n}", "title": "" }, { "docid": "90c496a3c96f7bfc34c618eca7c8cbb5", "score": "0.5447511", "text": "func NewCells(n int, bounds pixel.Rect) Cells {\n\tnewcells := Cells{\n\t\tbounds: bounds,\n\t\tboundsMinX: int(bounds.Min.X),\n\t\tboundsMaxX: int(bounds.Max.X),\n\t\tboundsMinY: int(bounds.Min.Y),\n\t\tboundsMaxY: int(bounds.Max.Y),\n\t\tcells: make([]Cell, n),\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tx := rand.Intn(newcells.boundsMaxX-newcells.boundsMinX) + newcells.boundsMinX\n\t\ty := rand.Intn(newcells.boundsMaxY-newcells.boundsMinY) + newcells.boundsMinY\n\t\tnewcells.cells[i] = NewCell(x, y)\n\t}\n\treturn newcells\n}", "title": "" }, { "docid": "284a2f0663dab6916d7fa00b956bbc02", "score": "0.54443043", "text": "func queensGrids(gridSize int) int {\r\n\tcolumnsUsed := make([]int, gridSize)\r\n\r\n\treturn Helper(gridSize, columnsUsed, 0)\r\n}", "title": "" }, { "docid": "9de060f863122b660f8c024356856344", "score": "0.54324925", "text": "func NewArea(h, w int) (*Area, Coord, Coord) {\n\tnIts := 4 // quantity of iterations, will be a parameter or calculation based on size of area\n\tvar ry, rx Coord\n\try, rx = 0, 0\n\tt := make([][]Tile, nIts)\n\tSetPad(h, w) // set engines pad\n\tfor it := 0; it < nIts; it++ {\n\t\tt[it] = make([]Tile, w*h)\n\t\tfor y := 0; y < h; y++ {\n\t\t\tfor x := 0; x < w; x++ {\n\n\t\t\t\t// On first iteration, place random tiles.\n\t\t\t\tif it == 0 {\n\t\t\t\t\tt[it][x+y*w] = placeRandomTile()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Otherwise check for wall placement.\n\t\t\t\tif mapBorders(y, x) || adjacentWalls(y, x, w, t[it-1]) >= 4 {\n\t\t\t\t\tt[it][x+y*w] = Tile{'#', true, true}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Or draw ground.\n\t\t\t\tt[it][x+y*w] = Tile{'.', false, false}\n\n\t\t\t\t// If we are at last Iteration\n\t\t\t\tif it == nIts-1 {\n\t\t\t\t\t// Select random tile, and explode it with tiles of same type.\n\t\t\t\t\t/*\n\t\t\t\t\t yy,xx := selectRandomTile(h,w)\n\t\t\t\t\t if !t[it][xx+yy*w].BlockMove { explodeTile(yy,xx,w,&t[it]) }\n\t\t\t\t\t*/\n\t\t\t\t\t// Find the first ground tile, and flood it with a region tile.\n\t\t\t\t\t//yy, xx := firstGroundTile(&t[it])\n\t\t\t\t\t//floodFill(yy, xx, &t[it])\n\t\t\t\t\t//set the spawn coords\n\t\t\t\t\try = Coord(y)\n\t\t\t\t\trx = Coord(x)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/* Debug */ /*\n\t\t if it == 0 { GetInput() }\n\t\t DrawMap(&Area{t[it],h,w})\n\t\t Write(50,2,fmt.Sprintf(\"Iteration: %d\", it))\n\t\t RefreshPad(int(ry),int(rx))\n\t\t GetInput()\n\t\t /**/\n\t\tWrite(51, 2, fmt.Sprint(\"Done\"))\n\t}\n\treturn &Area{t[nIts-1], nil, nil, h, w}, ry, rx\n}", "title": "" }, { "docid": "b4b09da717e4ba3e227566061d08fc64", "score": "0.54255766", "text": "func CreateGrid(opts GridOptions, app *Application) *Grid {\n\tvar finalRows []int\n\n\tif opts.HasHeaderRow {\n\t\tfinalRows = []int{1}\n\t}\n\n\tfinalRows = append(finalRows, opts.Rows...)\n\n\treturn &Grid{\n\t\tInner: tview.NewGrid().\n\t\t\tSetRows(finalRows...).\n\t\t\tSetColumns(opts.Columns...).\n\t\t\tSetBorders(opts.HasBorders),\n\t\tParent: app.Inner,\n\t}\n}", "title": "" }, { "docid": "5a85ec278cd2155bdf6a54584e7da50b", "score": "0.5398262", "text": "func NewFixedGrid(maxWidth int, widgets []model.Widget) (*Grid, error) {\n\tmaxHeight := 0\n\tfor _, w := range widgets {\n\t\tif maxHeight < w.GridPos.Y+1 {\n\t\t\tmaxHeight = w.GridPos.Y + 1\n\t\t}\n\t}\n\n\tg := &Grid{\n\t\tMaxHeight: maxHeight,\n\t\tMaxWidth: maxWidth,\n\t\tRows: []*Row{},\n\t}\n\n\tg.fillFixedGrid(widgets)\n\n\treturn g, nil\n}", "title": "" }, { "docid": "92255f09ae683c2dc6fb58d90e36ed6c", "score": "0.5385401", "text": "func NewGridFromInput(in string) *Grid {\n\tg := NewGrid()\n\tfor y, line := range strings.Split(in, \"\\n\") {\n\t\tfor x, r := range line {\n\t\t\tp := Point{X: x, Y: y}\n\t\t\tg.SetPoint(p, r)\n\t\t}\n\t}\n\treturn g\n}", "title": "" }, { "docid": "fa965ce6803d298157c1822e09a833f6", "score": "0.5376282", "text": "func Grid(in *C.VipsImage, tileHeight int, across int, down int, options ...*Option) (*C.VipsImage, error) {\n\tvar out *C.VipsImage\n\tvar err error\n\toptions = append(options,\n\t\tInputImage(\"in\", in),\n\t\tInputInt(\"tile-height\", tileHeight),\n\t\tInputInt(\"across\", across),\n\t\tInputInt(\"down\", down),\n\t\tOutputImage(\"out\", &out),\n\t)\n\tincOpCounter(\"grid\")\n\terr = vipsCall(\"grid\", options)\n\treturn out, err\n}", "title": "" }, { "docid": "6d1da9c53c5e985a913c567f94da4385", "score": "0.53736925", "text": "func NewBoard(g Grid) Board {\n\n\trowMap := make(map[uint8]Dim, 9)\n\tcolMap := make(map[uint8]Dim, 9)\n\n\tvar i uint8\n\tfor i = 0; i < 9; i++ {\n\t\trowMap[i] = getRow(i)\n\t\tcolMap[i] = getColumn(i)\n\t}\n\n\treturn Board{\n\t\trowIdx: rowMap,\n\t\tcolIdx: colMap,\n\t\tcells: g,\n\t}\n}", "title": "" }, { "docid": "6839a7139069edbc12cc5c3fdfe30f9e", "score": "0.53595424", "text": "func New(height, width int) Matrice {\n\ttable := make([][]string, height)\n\tfor i := range table {\n\t\ttable[i] = make([]string, width)\n\t}\n\tmatrix := Matrice{\n\t\ttable: table,\n\t}\n\treturn matrix\n}", "title": "" }, { "docid": "b01a0a27e9023c9019f4c25f13122ae0", "score": "0.53543043", "text": "func NewWorld(noRooms int, roomSize int) World {\n\tvar w World\n\tfor noRow := 0; noRow < noRooms/2; noRow++ {\n\t\tfor noColumn := 0; noColumn < 2; noColumn++ {\n\t\t\troom := NewRoom(\n\t\t\t\tDimensions{\n\t\t\t\t\tX1: (roomSize * noRow),\n\t\t\t\t\tY1: (roomSize * noColumn),\n\t\t\t\t\tX2: roomSize + (roomSize * noRow),\n\t\t\t\t\tY2: roomSize + (roomSize * noColumn),\n\t\t\t\t},\n\t\t\t)\n\t\t\tw.rooms = append(w.rooms, room)\n\t\t}\n\t}\n\treturn w\n}", "title": "" }, { "docid": "eec8f372fb3cedd110fdaf04a99eec5a", "score": "0.53434604", "text": "func newSpanGrid(h *Header, cols []*Col) spanGrid {\n\tspans := make([][]span, h.headerRowCount)\n\tfor i := range spans {\n\t\tspans[i] = make([]span, 0, len(cols))\n\t}\n\treturn spanGrid{\n\t\tspans: spans,\n\t\tcols: cols,\n\t}\n}", "title": "" }, { "docid": "960f33f275ed78320eb1b7aee880bfed", "score": "0.5317326", "text": "func initialiseGrid(sandPower int, pattern, startOnPattern string) *grid {\n\tsand := int(math.Pow(2.0, float64(sandPower)))\n\tsideLength := int(math.Sqrt(float64(sand)) * 0.7)\n\n\t// Some patterns spill over the default grid size\n\tlargerPatterns := []string{\"x\", \"o+++\", \"+o\", \"A\"}\n\tfor _, p := range largerPatterns {\n\t\tif pattern == p {\n\t\t\tsideLength = int(float64(sideLength) * 1.5)\n\t\t\tbreak\n\t\t}\n\t}\n\tif sideLength < 10 {\n\t\tsideLength = 10\n\t}\n\n\tif sideLength%2 == 0 {\n\t\tsideLength += 1\n\t}\n\n\tcentre := int(sideLength / 2)\n\n\tcells := make([][]int, sideLength)\n\tfor i := 0; int(i) < sideLength; i++ {\n\t\tcells[i] = make([]int, sideLength)\n\t}\n\tif startOnPattern != \".\" {\n\t\tfor _, o := range neighbourOffsets[startOnPattern] {\n\t\t\tperCell := len(neighbourOffsets[startOnPattern])\n\t\t\tcells[centre+o.x][centre+o.y] = sand / perCell\n\t\t}\n\t} else {\n\t\tcells[centre][centre] = sand\n\t}\n\n\tg := grid{\n\t\tstartingSand: sand,\n\t\ttopplePattern: pattern,\n\t\toffsets: neighbourOffsets[pattern],\n\t\tmaxBeforeTopple: int(len(neighbourOffsets[pattern])),\n\t\tcells: cells,\n\t}\n\n\treturn &g\n}", "title": "" }, { "docid": "9c559563d5df3df88cb3b50949bb5caa", "score": "0.5316706", "text": "func CreateNeighborhood(x, y int) [][]int {\n\n\tvar neighborhood = make([][]int, x)\n\n\tfor i := range neighborhood {\n\t\tneighborhood[i] = make([]int, y)\n\t}\n\n\treturn neighborhood\n}", "title": "" }, { "docid": "dc7dfe60944afbef9d6f5d33538a6a74", "score": "0.53132737", "text": "func GridHelper(size int, app *application.Application){\n\tgridHelp := graphic.NewGridHelper(float32(size), 1, math32.NewColor(\"LightGrey\"))\n\tgridHelp.SetPosition(float32(size/2), -0.2, float32(size/2))\n\tapp.Scene().Add(gridHelp)\n}", "title": "" }, { "docid": "0826068e6c72af811c46dd2682e0f236", "score": "0.5309144", "text": "func newGrid(parent *gridState) gridState {\n\tvar n gridState\n\treturn n\n}", "title": "" }, { "docid": "8e818089b76557b8392cf0f6fbd32dd5", "score": "0.5309075", "text": "func (g *grid) gen(r, c int) error {\n\n\t// check for negative inputs\n\tif r < 1 || c < 1 {\n\t\treturn fmt.Errorf(\"can't build a grid of negative or zero size, got %v x %v\", r, c)\n\t}\n\n\t// set our attributes\n\tg.rows = r\n\tg.columns = c\n\tg.capacity = r * c\n\n\t// build our grid\n\tg.points = make([][]point, g.rows)\n\tfor y := range g.points {\n\t\tg.points[y] = make([]point, g.columns)\n\t\tfor x := range g.points[y] {\n\t\t\tg.points[y][x].x = x\n\t\t\tg.points[y][x].y = y\n\t\t}\n\t}\n\n\t//fmt.Printf(\"Grid generated: %+v\\n\", g)\n\treturn nil\n}", "title": "" }, { "docid": "e967b512f93565daff8ba1049faab8c4", "score": "0.5308236", "text": "func NewDimension(newWidth uint, newHeight uint) *Dimension {\n\treturn &Dimension{Width: newWidth, Height: newHeight}\n}", "title": "" }, { "docid": "d56baa4ab60ab08562c385f60a73f79e", "score": "0.52937144", "text": "func newGraph(size int) *graph {\n\tmatrix := make([][]int, size)\n\tfor i := range matrix {\n\t\tmatrix[i] = make([]int, size)\n\t}\n\treturn &graph{matrix: matrix, size: size}\n}", "title": "" }, { "docid": "ca1fb8dcbb4465ca2878a2fd8165ee3b", "score": "0.5278679", "text": "func NewPanelGridLayout() *PanelGridLayout {\n\treturn &PanelGridLayout{X: 0, Y: 0, Count: 0}\n}", "title": "" }, { "docid": "49a2ef95cc4a77ceb778561f3ed29427", "score": "0.5268717", "text": "func DrawGridLayout(images []image.Image, width int) image.Image {\n\tif len(images) == 0 {\n\t\treturn nil\n\t}\n\tl := gridLayout{}\n\torientation, node := l.compose(images)\n\theight := l.getHeight(orientation, width)\n\treturn node.Draw(width, height)\n}", "title": "" }, { "docid": "e50c3220635692920c2f73bd88bca3b2", "score": "0.52543414", "text": "func CreateGameBoard(boardSize int) *Board {\n\tlog.Debug().Msgf(\"Creating a new game board with %d rows and cols...\", boardSize)\n\n\tk := 0\n\n\t// initializes slices\n\temptyBoard := make([][]string, boardSize)\n\tfor i := range emptyBoard {\n\t\temptyBoard[i] = make([]string, boardSize)\n\t}\n\n\t// fills slice dynamically\n\tfor i := range emptyBoard {\n\t\tfor j := range emptyBoard[i] {\n\n\t\t\t// single digit numbers require especial treatment\n\t\t\tif k <= 9 {\n\t\t\t\temptyBoard[i][j] = \"0\" + strconv.FormatInt(int64(k), 10)\n\t\t\t} else {\n\t\t\t\temptyBoard[i][j] = strconv.FormatInt(int64(k), 10)\n\t\t\t}\n\t\t\tk++\n\t\t}\n\t}\n\n\t// free spots\n\tfreeFields := make([]int, 0)\n\tfor i := 0; i < boardSize*boardSize; i++ {\n\t\tfreeFields = append(freeFields, i)\n\t}\n\n\tlog.Debug().Msgf(\"Initialized board. Returning board...\")\n\treturn &Board{fields: emptyBoard, freeFields: freeFields}\n}", "title": "" }, { "docid": "4f62ea17280c354219fee77a29375bc4", "score": "0.5223871", "text": "func allocate(height, width int) *[][]int{\n\tres := make([][]int, height)\n\tfor i, _ := range res{\n\t\tres[i] = make([]int, width)\n\t}\n\treturn &res\n}", "title": "" }, { "docid": "8e2230d8260844c56dfae7eb729c37ba", "score": "0.5221755", "text": "func NewBackgroundGrid(context *render.Context) *BackgroundGrid {\n\tgl := context.OpenGL\n\tprogram, programErr := opengl.LinkNewStandardProgram(gl, gridVertexShaderSource, gridFragmentShaderSource)\n\n\tif programErr != nil {\n\t\tpanic(fmt.Errorf(\"BackgroundGrid shader failed: %v\", programErr))\n\t}\n\tgrid := &BackgroundGrid{\n\t\tcontext: context,\n\t\tprogram: program,\n\t\tvao: opengl.NewVertexArrayObject(gl, program),\n\t\tvertexPositionBuffer: gl.GenBuffers(1)[0],\n\t\tvertexPositionAttrib: gl.GetAttribLocation(program, \"vertexPosition\"),\n\t\tviewMatrixUniform: opengl.Matrix4Uniform(gl.GetUniformLocation(program, \"viewMatrix\")),\n\t\tprojectionMatrixUniform: opengl.Matrix4Uniform(gl.GetUniformLocation(program, \"projectionMatrix\"))}\n\n\t{\n\t\ttilesPerMapSide := float32(64.0)\n\n\t\tgl.BindBuffer(opengl.ARRAY_BUFFER, grid.vertexPositionBuffer)\n\t\thalf := fineCoordinatesPerTileSide / float32(2.0)\n\t\tlimit := fineCoordinatesPerTileSide*tilesPerMapSide + half\n\t\tvar vertices = []float32{\n\t\t\t-half, -half, 0.0,\n\t\t\tlimit, -half, 0.0,\n\t\t\tlimit, limit, 0.0,\n\n\t\t\tlimit, limit, 0.0,\n\t\t\t-half, limit, 0.0,\n\t\t\t-half, -half, 0.0}\n\t\tgl.BufferData(opengl.ARRAY_BUFFER, len(vertices)*4, vertices, opengl.STATIC_DRAW)\n\t\tgl.BindBuffer(opengl.ARRAY_BUFFER, 0)\n\t}\n\tgrid.vao.WithSetter(func(gl opengl.OpenGL) {\n\t\tgl.EnableVertexAttribArray(uint32(grid.vertexPositionAttrib))\n\t\tgl.BindBuffer(opengl.ARRAY_BUFFER, grid.vertexPositionBuffer)\n\t\tgl.VertexAttribOffset(uint32(grid.vertexPositionAttrib), 3, opengl.FLOAT, false, 0, 0)\n\t\tgl.BindBuffer(opengl.ARRAY_BUFFER, 0)\n\t})\n\n\treturn grid\n}", "title": "" }, { "docid": "e2d35cf8c4521f0a9470b1c1754cb43f", "score": "0.521119", "text": "func GridSample(rows, cols int, gen func() *neuralnet.Tensor3) image.Image {\n\tif rows == 0 && cols == 0 {\n\t\treturn image.NewRGBA(image.Rect(0, 0, GridSpacing, GridSpacing))\n\t}\n\n\ttensors := make([]*neuralnet.Tensor3, rows*cols)\n\tfor i := range tensors {\n\t\ttensors[i] = gen()\n\t}\n\n\tnewWidth := tensors[0].Width*cols + (cols+1)*GridSpacing\n\tnewHeight := tensors[0].Height*rows + (rows+1)*GridSpacing\n\timg := image.NewRGBA(image.Rect(0, 0, newWidth, newHeight))\n\tfor y := 0; y < newHeight; y++ {\n\t\tfor x := 0; x < newWidth; x++ {\n\t\t\timg.Set(x, y, GridSpaceColor)\n\t\t}\n\t}\n\n\tvar idx int\n\tfor y := 0; y < rows; y++ {\n\t\ttileY := GridSpacing + y*(tensors[0].Height+GridSpacing)\n\t\tfor x := 0; x < cols; x++ {\n\t\t\ttileX := GridSpacing + x*(tensors[0].Width+GridSpacing)\n\t\t\ttensor := tensors[idx]\n\t\t\tidx++\n\t\t\tfor j := 0; j < tensor.Height; j++ {\n\t\t\t\tfor k := 0; k < tensor.Width; k++ {\n\t\t\t\t\tif tensor.Depth == 3 {\n\t\t\t\t\t\timg.SetRGBA(tileX+k, tileY+j, color.RGBA{\n\t\t\t\t\t\t\tR: uint8(tensor.Get(k, j, 0)*0xff + 0.5),\n\t\t\t\t\t\t\tG: uint8(tensor.Get(k, j, 1)*0xff + 0.5),\n\t\t\t\t\t\t\tB: uint8(tensor.Get(k, j, 2)*0xff + 0.5),\n\t\t\t\t\t\t\tA: 0xff,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\timg.Set(tileX+k, tileY+j, color.Gray{\n\t\t\t\t\t\t\tY: uint8(tensor.Get(k, j, 0)*0xff + 0.5),\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 img\n}", "title": "" }, { "docid": "5ae3356f56f34eeb34ef8068bb1137f4", "score": "0.521002", "text": "func NewGrid() *plotter.Grid {\n\treturn plotter.NewGrid()\n}", "title": "" }, { "docid": "583a0fa8412a4e89e41d194a0c6d1856", "score": "0.5202665", "text": "func createBoard(size int, dark, light color.RGBA) *image.RGBA {\n\timg := createImage(size, size, dark, light)\n\tsquareWidth := size / 8\n\tfor x := 0; x < 8; x += 2 {\n\t\tfor y := 0; y < 8; y += 2 {\n\t\t\tbounds := image.Rect(x*squareWidth, y*squareWidth, x*squareWidth+squareWidth, y*squareWidth+squareWidth)\n\t\t\tc := light\n\t\t\tdraw.Draw(img, bounds, &image.Uniform{c}, image.ZP, draw.Src)\n\t\t}\n\t}\n\tfor x := 1; x < 8; x += 2 {\n\t\tfor y := 1; y < 8; y += 2 {\n\t\t\tbounds := image.Rect(x*squareWidth, y*squareWidth, x*squareWidth+squareWidth, y*squareWidth+squareWidth)\n\t\t\tc := light\n\t\t\tdraw.Draw(img, bounds, &image.Uniform{c}, image.ZP, draw.Src)\n\t\t}\n\t}\n\treturn img\n}", "title": "" }, { "docid": "b0ae54ab31c05519381fd2a3d4a1bb68", "score": "0.51906013", "text": "func New(width, height int) *World {\n\tcells := make([][]bool, height)\n\tfor i := range cells {\n\t\tcells[i] = make([]bool, width)\n\t}\n\treturn &World{cells, width, height, 0}\n}", "title": "" }, { "docid": "fe7bdc1dbe975d425f330925d0fa58b9", "score": "0.51880544", "text": "func NewBoard(size int) (*Board, error) {\n\tb := &Board{\n\t\tsize: size,\n\t\ttiles: map[*Tile]struct{}{},\n\t}\n\tfor i := 0; i < 2; i++ {\n\t\tif err := addRandomTile(b.tiles, b.size); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "f719f9e8ea2166488aa3a2e024847379", "score": "0.517835", "text": "func NewWorld(size int) *World {\n\tslice := [][]int{}\n\tfor i := 0; i < size; i++ {\n\t\tline := []int{}\n\t\tfor k := 0; k < size; k++ {\n\t\t\tline = append(line, 0)\n\t\t}\n\t\tslice = append(slice, line)\n\t}\n\treturn &World{\n\t\tSize: size,\n\t\tmatrix: slice,\n\t}\n}", "title": "" }, { "docid": "f3f25b3f6f036d23413c5dea1e29e55b", "score": "0.5175932", "text": "func (md ExternMetadata) ElemGridSize(n, dev int) (gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ int) {\n\tif dev > len(md.warp) {\n\t\t// error\n\t}\n\n\tmaxThreads := md.mtpb[dev]\n\tmaxGridX := md.mgdx[dev]\n\tmaxGridY := md.mgdy[dev]\n\tmaxGridZ := md.mgdz[dev]\n\n\tblockDimX = 1\n\tblockDimY = 1\n\tblockDimZ = 1\n\tgridDimX = 1\n\tgridDimY = 1\n\tgridDimZ = 1\n\n\tblocks := calcBlocks(n, maxThreads)\n\tswitch {\n\tcase blocks == 1:\n\t\tblockDimX = n\n\tcase blocks >= maxGridX*maxGridY*maxGridZ:\n\t\t// what kind of monstrosity is this??!\n\tcase blocks >= maxGridX*maxGridY:\n\t\tgridDimX = maxGridX\n\t\tgridDimY = maxGridY\n\t\tgridDimZ = calcBlocks(blocks%(maxGridX*maxGridY), maxGridZ)\n\t\tblockDimX = maxThreads\n\tcase blocks >= maxGridX:\n\t\tgridDimX = maxGridX\n\t\tgridDimY = calcBlocks(blocks%(maxGridX), maxGridY)\n\t\tblockDimX = maxThreads\n\tdefault:\n\t\tgridDimX = blocks\n\t\tblockDimX = maxThreads\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d500aab62be3ced120f2c8028f969fd4", "score": "0.51652026", "text": "func MakeBoard(size int) *Board {\n\tboard := &Board{\n\t\t// generally 9 for normal puzzles\n\t\tGridSize: size,\n\t\t// generally 3 for normal puzzles\n\t\tBoxSize: int(math.Sqrt(float64(size))),\n\t\tNumbers: make([][]byte, size),\n\t\tSticky: make([][]bool, size),\n\t}\n\n\tfor i := 0; i < size; i++ {\n\t\tboard.Numbers[i] = make([]byte, size)\n\t\tboard.Sticky[i] = make([]bool, size)\n\t}\n\n\treturn board\n}", "title": "" }, { "docid": "ec3b76516d7bf7f6770748b205d06f18", "score": "0.516266", "text": "func createBoard() *Board{\n\tvar axisX, axisY, valid int\n\tfor valid==0{\n\t\tfmt.Printf(\"Dimensions? (X by X) 3 Min, 10 Max: \")\n\t\tfmt.Scanf(\"%d\\n\", &axisX)\n\t\taxisY = axisX\n\t\tif axisX>=3 && axisX<=10 {\n\t\t\tvalid = 1\n\t\t} else {\n\t\t\tfmt.Println(\"Invalid value for the board! Try again\")\n\t\t\ttime.Sleep(2000*time.Millisecond)\n\t\t}\n\t}\n\treturn NewBoard(axisX, axisY)\n}", "title": "" }, { "docid": "434b8fef822ee52b9674c02ec9f7a6b7", "score": "0.5161959", "text": "func New(width, height int) (Board, error) {\n\tvar err error\n\tm := Board{Width: width, Height: height}\n\tif width < 0 || height < 0 { // Didn't bother to enforce an upper limit\n\t\terr = errors.New(fmt.Sprintf(\"invalid board width (%d) or height (%d)\", width, height))\n\t} else {\n\t\tcells := make([][]bool, width)\n\t\tfor i := range cells {\n\t\t\tcells[i] = make([]bool, height)\n\t\t\tfor j := 0; j < height; j++ {\n\t\t\t\tcells[i][j] = true\n\t\t\t}\n\n\t\t}\n\t\tm.Cells = cells\n\t}\n\treturn m, err\n}", "title": "" }, { "docid": "115f192b6ea2985e6c1a8275f79ce77a", "score": "0.5147079", "text": "func NewAdaptiveGrid(maxWidth int, widgets []model.Widget) (*Grid, error) {\n\td := &Grid{\n\t\tMaxWidth: maxWidth,\n\t}\n\n\td.fillAdaptiveGrid(widgets)\n\treturn d, nil\n}", "title": "" }, { "docid": "d1a113cd659cb2ebee085abfcde7d919", "score": "0.5140797", "text": "func NewBoard(width, height uint8) (Board, error) {\n\tif height%2 != 0 {\n\t\treturn nil, errors.New(\"height must be even\")\n\t}\n\tif width%2 != 0 {\n\t\treturn nil, errors.New(\"width must be even\")\n\t}\n\tboard := make([][]ID, width)\n\tfor w := uint8(0); w < width; w++ {\n\t\tboard[w] = make([]ID, height)\n\t\tfor h := uint8(0); h < height; h++ {\n\t\t\tboard[w][h] = blank\n\t\t}\n\t}\n\treturn board, nil\n}", "title": "" }, { "docid": "2f0fdf2146642684df745cb3080e7d57", "score": "0.5123522", "text": "func NewGridFromString(s string) (Grid, error) {\n\tgrid := Grid{}\n\tr := []rune(s)\n\tfor i := 0; i < 81; i++ {\n\t\tvalue, err := strconv.Atoi(string(r[i]))\n\t\tif err != nil {\n\t\t\treturn grid, fmt.Errorf(\"could not convert %s to integer\", string(r[i]))\n\t\t}\n\t\tgrid[i] = value\n\t}\n\treturn grid, nil\n}", "title": "" }, { "docid": "e4e0cbda445a22398d71d7d98a635fce", "score": "0.5121932", "text": "func (g *game) initGrids() {\n\tg.userGrid = make(GridType, g.Height)\n\tfor i := 0; i < g.Height; i++ {\n\t\tg.userGrid[i] = make(GridRow, g.Width)\n\t\tfor j := 0; j < g.Width; j++ {\n\t\t\tg.userGrid[i][j] = UncheckedRuneUser\n\t\t}\n\t}\n\tg.grid = make(GridType, g.Height)\n\tfor i := 0; i < g.Height; i++ {\n\t\tg.grid[i] = make(GridRow, g.Width)\n\t\tfor j := 0; j < g.Width; j++ {\n\t\t\tg.grid[i][j] = EmptyRune\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f8122680c1ab5c12b236bc4986953245", "score": "0.5115787", "text": "func New(x, y int, rowHints, colHints [][]int) (*Board, error) {\n\tif len(rowHints) != y {\n\t\treturn nil, ErrRowMismatch\n\t}\n\tif len(colHints) != x {\n\t\treturn nil, ErrColMismatch\n\t}\n\treturn &Board{\n\t\tGrid: newGrid(x, y),\n\t\tRowHints: rowHints,\n\t\tColHints: colHints,\n\t}, nil\n}", "title": "" }, { "docid": "a74c720b091f399f22cf229dd36fe848", "score": "0.51146466", "text": "func New(size int) *window {\n\treturn &window{\n\t\tin: &stack{data: make([]int, 0, size), max: make([]int, 0, size)},\n\t\tout: &stack{data: make([]int, 0, size), max: make([]int, 0, size)},\n\t\tsize: size,\n\t}\n}", "title": "" }, { "docid": "c11507a7fcec010de12821e599e17e9f", "score": "0.5114394", "text": "func New(width int, height int) *SnakeGame {\n\tu := unit{x: 0, y: 0}\n\tgrid := make([][]Entity, height)\n\n\tfor i := range grid {\n\t\tgrid[i] = make([]Entity, width)\n\n\t\tfor j := range grid[i] {\n\t\t\tgrid[i][j] = Cell\n\t\t}\n\t}\n\n\tgrid[u.y][u.x] = Snake\n\n\tgame := &SnakeGame{\n\t\tgen: rand.New(rand.NewSource(time.Now().UnixNano())),\n\t\twidth: width,\n\t\theight: height,\n\t\tqueue: []unit{u},\n\t\tgrid: grid,\n\t\tscore: 0,\n\t\tdirection: Right,\n\t}\n\n\tgame.generateFood()\n\n\treturn game\n}", "title": "" }, { "docid": "08430012d8eed514843fab869aebdc3a", "score": "0.5100921", "text": "func getBigColorGrid() [][][4]uint8 {\n\tgridColors := [][][4]uint8{}\n\n\tred := [4]uint8{235, 0, 0, 0}\n\tyellow := [4]uint8{235, 235, 0, 0}\n\tblue := [4]uint8{0, 0, 220, 0}\n\tgreen := [4]uint8{0, 180, 60, 0}\n\n\t// Left Rectangle\n\tfor colX := 0; colX < 6; colX++ {\n\t\tnextCol := [][4]uint8{}\n\t\tfor rowY := 0; rowY < 12; rowY++ {\n\t\t\tnextCol = append(nextCol, red)\n\t\t}\n\t\tgridColors = append(gridColors, nextCol)\n\t}\n\n\t// Middle polygons\n\tfor colX := 6; colX < 12; colX++ {\n\t\tnextCol := [][4]uint8{}\n\t\tfor rowY := 0; rowY < 12; rowY++ {\n\t\t\tif rowY < 2+colX-6 {\n\t\t\t\tnextCol = append(nextCol, yellow)\n\t\t\t} else {\n\t\t\t\tnextCol = append(nextCol, blue)\n\t\t\t}\n\t\t}\n\t\tgridColors = append(gridColors, nextCol)\n\t}\n\n\t// Right Rectangle\n\tfor colX := 12; colX < 18; colX++ {\n\t\tnextCol := [][4]uint8{}\n\t\tfor rowY := 0; rowY < 12; rowY++ {\n\t\t\tnextCol = append(nextCol, green)\n\t\t}\n\t\tgridColors = append(gridColors, nextCol)\n\t}\n\n\t// Add rectangle in middle of Right Rectangle\n\tfor colX := 14; colX < 16; colX++ {\n\t\tfor rowY := 4; rowY < 8; rowY++ {\n\t\t\tgridColors[colX][rowY] = red\n\t\t}\n\t}\n\n\t// Add a line in middle of Left Rectangle\n\tfor rowY := 4; rowY < 8; rowY++ {\n\t\tgridColors[3][rowY] = blue\n\t}\n\n\treturn gridColors\n}", "title": "" }, { "docid": "39882f40c2b5d76e3e3a8541cd178755", "score": "0.5093849", "text": "func New(aggregator Aggregator, widths ...int) *Window {\n\tw := Window{\n\t\taggregator: aggregator,\n\t\trows: make([]row, len(widths)),\n\t}\n\n\tfor i := range widths {\n\t\tif widths[i] <= 0 {\n\t\t\tpanic(\"Widths must be >= 0\")\n\t\t}\n\t\tw.rows[i] = row{points: make([]Point, widths[i])}\n\t}\n\n\treturn &w\n}", "title": "" }, { "docid": "7c7236205ffa828ddc19dc005fabe16e", "score": "0.5079583", "text": "func Grid(nextSlide func()) (title string, content tview.Primitive) {\n\tmodalShown := false\n\tpages := tview.NewPages()\n\n\tnewPrimitive := func(text string) tview.Primitive {\n\t\treturn tview.NewFrame(nil).\n\t\t\tSetBorders(0, 0, 0, 0, 0, 0).\n\t\t\tAddText(text, true, tview.AlignCenter, tcell.ColorWhite)\n\t}\n\n\tmenu := newPrimitive(\"Menu\")\n\tmain := newPrimitive(\"Main content\")\n\tsideBar := newPrimitive(\"Side Bar\")\n\n\tgrid := tview.NewGrid().\n\t\tSetRows(3, 0, 3).\n\t\tSetColumns(0, -4, 0).\n\t\tSetBorders(true).\n\t\tAddItem(newPrimitive(\"Header\"), 0, 0, 1, 3, 0, 0, true).\n\t\tAddItem(newPrimitive(\"Footer\"), 2, 0, 1, 3, 0, 0, false)\n\tgrid.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {\n\t\tif modalShown {\n\t\t\tnextSlide()\n\t\t\tmodalShown = false\n\t\t} else {\n\t\t\tpages.ShowPage(\"modal\")\n\t\t\tmodalShown = true\n\t\t}\n\t\treturn event\n\t})\n\n\t// Layout for screens narrower than 100 cells (menu and side bar are hidden).\n\tgrid.AddItem(menu, 0, 0, 0, 0, 0, 0, false).\n\t\tAddItem(main, 1, 0, 1, 3, 0, 0, false).\n\t\tAddItem(sideBar, 0, 0, 0, 0, 0, 0, false)\n\n\t// Layout for screens wider than 100 cells.\n\tgrid.AddItem(menu, 1, 0, 1, 1, 0, 100, false).\n\t\tAddItem(main, 1, 1, 1, 1, 0, 100, false).\n\t\tAddItem(sideBar, 1, 2, 1, 1, 0, 100, false)\n\n\tmodal := tview.NewModal().\n\t\tSetText(\"Resize the window to see how the grid layout adapts\").\n\t\tAddButtons([]string{\"Ok\"}).SetDoneFunc(func(buttonIndex int, buttonLabel string) {\n\t\tpages.HidePage(\"modal\")\n\t})\n\n\tpages.AddPage(\"grid\", grid, true, true).\n\t\tAddPage(\"modal\", modal, false, false)\n\n\treturn \"Grid\", pages\n}", "title": "" }, { "docid": "fbc5f354f2bee450547f1f502c263dc6", "score": "0.5079418", "text": "func (g *Grid) Dims() (r, c int) {\n\treturn g.r, g.c\n}", "title": "" }, { "docid": "c81051f832e421ca341d91f01f1518a4", "score": "0.5079411", "text": "func make_chunk(chunkid, chunkSize, col int) data {\n\tnewchunk := data{}\n\tnewchunk.chunkSize = chunkSize //middle rows (need to work with how may rows)\n\tnewchunk.chunkid = chunkid\n\tnewchunk.splitBoard = make([][]int, (chunkSize + 2))\n\tfor i, _ := range newchunk.splitBoard {\n\t\tnewchunk.splitBoard[i] = make([]int, col)\n\t}\n\treturn newchunk\n}", "title": "" }, { "docid": "71f6e56b7e39ba641ec0f1c5c3b1dc9b", "score": "0.5078554", "text": "func (g *GameMap) CreateHTunnel(x1, x2, y int) {\n\tfor x := goro.MinInt(x1, x2); x <= goro.MaxInt(x1, x2); x++ {\n\t\tif g.InBounds(x, y) {\n\t\t\tg.Tiles[x][y] = Tile{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31866428252c94331ad49f941e1358a7", "score": "0.50739044", "text": "func construct2DArray(original []int, m int, n int) [][]int {\n\tl := len(original)\n\tif l != m*n {\n\t\treturn nil\n\t}\n\n\tr := make([][]int, m)\n\tfor i := range r {\n\t\tstart := n * i\n\t\tend := start + n\n\t\tr[i] = original[start:end]\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "96be3d6ed8bf933c92ae6c1daf4b4319", "score": "0.5072988", "text": "func InitializeGrid(grid *[][]int, game Game, i int) {\n\tif i%20 == 0 {\n\t\tInitialCells(grid, game.Start)\n\t}\n}", "title": "" }, { "docid": "6561f17a4c1c267d80f42324ff362f9a", "score": "0.507257", "text": "func GridNew() *Grid {\n\tc := C.gtk_grid_new()\n\treturn wrapGrid(unsafe.Pointer(c))\n}", "title": "" }, { "docid": "86447e8eb3b3c4792cd421eda703d6f0", "score": "0.5066327", "text": "func NewUniverse(w, h int) *Universe {\n\tgrid := make([][]bool, h)\n\tfor i := range grid {\n\t\tgrid[i] = make([]bool, w)\n\t}\n\treturn &Universe{grid: grid, width: w, height: h}\n}", "title": "" }, { "docid": "e6abcb21573167b2b298ce62581d12e9", "score": "0.5056", "text": "func buildInitialGrid(initialGridSize int) [][]rune {\n\tgrid := make([][]rune, initialGridSize*2)\n\tfor idx := range grid {\n\t\tgrid[idx] = make([]rune, initialGridSize*2)\n\t\tfor innerIdx := range grid[idx] {\n\t\t\tgrid[idx][innerIdx] = ' '\n\t\t}\n\t}\n\n\treturn grid\n}", "title": "" }, { "docid": "ae2d0869383f3d8d76404101207b2ecf", "score": "0.50535405", "text": "func CreateGame(x int, y int, s [][]int) Game {\n\trows := x + 2\n\tcols := y + 2\n\tgame := Game{rows, cols, s}\n\treturn game\n}", "title": "" }, { "docid": "2e1f0e985238d732228fbe8e17799a08", "score": "0.50530785", "text": "func NewDistanceGrid(rows, cols int) Grid {\n\treturn &DistanceGrid{\n\t\tGrid: NewNormalGrid(rows, cols),\n\t}\n}", "title": "" }, { "docid": "aaacf86ac8ee5159845e11b0ec275b04", "score": "0.5039844", "text": "func initBoard(dimension int, initialStateProbability float32) [][]Cell {\n\tcells := make([][]Cell, dimension)\n\n\t// Seed the random number generator to get a different initial state every time\n\trand.Seed(time.Now().UTC().UnixNano())\n\n\tfor row := 0; row < dimension; row++ {\n\t\tcells[row] = make([]Cell, dimension)\n\n\t\tfor col := 0; col < dimension; col++ {\n\t\t\tcells[row][col] = Cell{\n\t\t\t\trow: row,\n\t\t\t\tcol: col,\n\t\t\t\tstate: rand.Float32() < initialStateProbability,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cells\n}", "title": "" }, { "docid": "2cb6bd008f296438bdefd9a770bb0aec", "score": "0.50366646", "text": "func BuildLattice(dimensions [][]float64) []State { \n\t// calculate the total number of states and init some memory for them\n\tn := 1 \n\tfor i := range dimensions { \n\t\tn *= len(dimensions[i]) \n\t} \n\tstates := make([]State, n)\n\tpartial := list.New()\n\n\t// create some temp storage for partially constructed states\n\tfor i := 0; i < len(dimensions[0]); i++ {\n\t\ts := new(State)\n\t\ts.Vals = make([]float64, 0)\n\t\ts.Vals = append(s.Vals, dimensions[0][i])\n\t\tpartial.PushBack(*s)\n\t}\n\n\tindex := uint(0)\n\tfor partial.Len() > 0 {\n\t\tp := partial.Front()\n\t\ts := p.Value.(State)\n\t\tpartial.Remove(p)\n\t\t\n\t\t// if the newly grabbed state is finally constructed, push\n\t\t// it onto the states array. otherwise, make enough copies\n\t\t// to append all possible values of the next dimension and\n\t\t// put them back onto the partial array.\n\t\tif len(s.Vals) == len(dimensions) {\n\t\t\ts.Id = index\n\t\t\tstates[index] = s\n\t\t\tindex++\n\t\t} else {\n\t\t\tfor i := 0; i < len(dimensions[len(s.Vals)]); i++ {\n\t\t\t\tsp := new(State)\n\t\t\t\tsp.Vals = make([]float64, len(s.Vals))\n\t\t\t\tcopy(sp.Vals, s.Vals)\n\t\t\t\tsp.Vals = append(sp.Vals, dimensions[len(sp.Vals)][i])\n\t\t\t\tpartial.PushBack(*sp)\n\t\t\t}\n\t\t}\n\t}\n\treturn states\n}", "title": "" }, { "docid": "55caab0e1651cbed5ddc411ea7a6701f", "score": "0.5016209", "text": "func BlankGrid(g Game) [][]int {\n\tgrid := [][]int{}\n\tfor i := 0; i < g.Cols; i++ {\n\t\tgrid = append(grid, []int{})\n\t\tfor j := 0; j < g.Rows; j++ {\n\t\t\tgrid[i] = append(grid[i], 0)\n\t\t}\n\t}\n\treturn grid\n}", "title": "" } ]
168c0ff5aebc92d1b3efa06c98fc25a9
IsYANGGoStruct ensures that NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.
[ { "docid": "556911f67db344b703ab4425a2c76529", "score": "0.8891745", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi) IsYANGGoStruct() {}", "title": "" } ]
[ { "docid": "160787aa39df0165ccce8f47159be704", "score": "0.86450297", "text": "func (*Bgp_Neighbor_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "160787aa39df0165ccce8f47159be704", "score": "0.86450297", "text": "func (*Bgp_Neighbor_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "d014854e1a4e208bfe67ebb4aae1012e", "score": "0.86183923", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "d014854e1a4e208bfe67ebb4aae1012e", "score": "0.86183923", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "d014854e1a4e208bfe67ebb4aae1012e", "score": "0.86179197", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e053cd2253e365c506419e6d92ee1b8", "score": "0.8429252", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e053cd2253e365c506419e6d92ee1b8", "score": "0.8429197", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "8e053cd2253e365c506419e6d92ee1b8", "score": "0.84279823", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "c56494f427469bd35d5e79dff7079a2a", "score": "0.83728373", "text": "func (*Bgp_Global_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "c56494f427469bd35d5e79dff7079a2a", "score": "0.83728373", "text": "func (*Bgp_Global_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "9d9db9692bf4aeb87d2f77f3ec046423", "score": "0.8342783", "text": "func (*Bgp_PeerGroup_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "9d9db9692bf4aeb87d2f77f3ec046423", "score": "0.8342783", "text": "func (*Bgp_PeerGroup_AfiSafi) IsYANGGoStruct() {}", "title": "" }, { "docid": "97835e8acb44d85b7183f8cc672d533f", "score": "0.79621416", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_ApplyPolicy) IsYANGGoStruct() {}", "title": "" }, { "docid": "97835e8acb44d85b7183f8cc672d533f", "score": "0.7961804", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_ApplyPolicy) IsYANGGoStruct() {}", "title": "" }, { "docid": "97835e8acb44d85b7183f8cc672d533f", "score": "0.79608005", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_ApplyPolicy) IsYANGGoStruct() {}", "title": "" }, { "docid": "4e846b22854498536c7571f628209df3", "score": "0.79507196", "text": "func (*Bgp_Neighbor_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "4e846b22854498536c7571f628209df3", "score": "0.79500926", "text": "func (*Bgp_Neighbor_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "53bbd7e26e070c2265aceb5f24eb80f2", "score": "0.79150635", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "53bbd7e26e070c2265aceb5f24eb80f2", "score": "0.79147613", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "53bbd7e26e070c2265aceb5f24eb80f2", "score": "0.79147613", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "48f5d655c5a35d77fa481597b328aad4", "score": "0.7912149", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "48f5d655c5a35d77fa481597b328aad4", "score": "0.7911385", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "48f5d655c5a35d77fa481597b328aad4", "score": "0.7910302", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "fa76cce55728a9e14d9b2b53144e8795", "score": "0.7794577", "text": "func (*Bgp_Neighbor_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "fa76cce55728a9e14d9b2b53144e8795", "score": "0.779281", "text": "func (*Bgp_Neighbor_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "570c53394dff0d0c848e42c544e6e435", "score": "0.7792541", "text": "func (*Bgp_Neighbor_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "570c53394dff0d0c848e42c544e6e435", "score": "0.77917594", "text": "func (*Bgp_Neighbor_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "d11daafaa115a3b5822e5c8a9ab53a11", "score": "0.7782331", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "d11daafaa115a3b5822e5c8a9ab53a11", "score": "0.7781869", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "d11daafaa115a3b5822e5c8a9ab53a11", "score": "0.7781239", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "83850756c8454e9e8ba021c1e74eece0", "score": "0.7766749", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "56075d137e6d20857e45d04f5b681535", "score": "0.7765734", "text": "func (*Bgp_Neighbor_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "83850756c8454e9e8ba021c1e74eece0", "score": "0.77656263", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "56075d137e6d20857e45d04f5b681535", "score": "0.7765037", "text": "func (*Bgp_Neighbor_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "0d67cebbbc8ef8a72cdd378e509965f6", "score": "0.77637786", "text": "func (*Bgp_Neighbor_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "0d67cebbbc8ef8a72cdd378e509965f6", "score": "0.77636254", "text": "func (*Bgp_Neighbor_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "83850756c8454e9e8ba021c1e74eece0", "score": "0.7763546", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "554868141d63f57e2cc0e682329bb9a6", "score": "0.7749906", "text": "func (*Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "554868141d63f57e2cc0e682329bb9a6", "score": "0.77495563", "text": "func (*Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "823e0bde9f420db4f7d022ac630c4c7f", "score": "0.7747398", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) IsYANGGoStruct() {}", "title": "" }, { "docid": "3af0d88bc2c3ace72866baf85760b29f", "score": "0.7746266", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Bfd) IsYANGGoStruct() {}", "title": "" }, { "docid": "823e0bde9f420db4f7d022ac630c4c7f", "score": "0.7745972", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) IsYANGGoStruct() {}", "title": "" }, { "docid": "3af0d88bc2c3ace72866baf85760b29f", "score": "0.77456355", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Bfd) IsYANGGoStruct() {}", "title": "" }, { "docid": "3af0d88bc2c3ace72866baf85760b29f", "score": "0.77456355", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Bfd) IsYANGGoStruct() {}", "title": "" }, { "docid": "2eab829598327f697744d8a43a700789", "score": "0.77451074", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "823e0bde9f420db4f7d022ac630c4c7f", "score": "0.77449435", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Prefixes) IsYANGGoStruct() {}", "title": "" }, { "docid": "2eab829598327f697744d8a43a700789", "score": "0.77439225", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "2eab829598327f697744d8a43a700789", "score": "0.7740287", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "e3ac1b663d6f4abee010834085813e83", "score": "0.77365613", "text": "func (*Bgp_Global_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "e3ac1b663d6f4abee010834085813e83", "score": "0.773446", "text": "func (*Bgp_Global_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "414f2d9dfb0cf02efa20c32acc86450f", "score": "0.7715958", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_SrtePolicyIpv6) IsYANGGoStruct() {}", "title": "" }, { "docid": "d6d1c181477bb3fda19a1772495803b2", "score": "0.7714383", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "d6d1c181477bb3fda19a1772495803b2", "score": "0.7713733", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "d6d1c181477bb3fda19a1772495803b2", "score": "0.7713694", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "b54248079b9b21a0b964b28174c14c74", "score": "0.7712942", "text": "func (*Bgp_Global_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "b54248079b9b21a0b964b28174c14c74", "score": "0.7712071", "text": "func (*Bgp_Global_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "c0b4cccafa5d8bf9ae6d06f9b8ab6762", "score": "0.77029526", "text": "func (*Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "c0b4cccafa5d8bf9ae6d06f9b8ab6762", "score": "0.7702628", "text": "func (*Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "6193ff7aabc7d9b90453c2d8c5b8afbc", "score": "0.7700893", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "6193ff7aabc7d9b90453c2d8c5b8afbc", "score": "0.77006155", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "6193ff7aabc7d9b90453c2d8c5b8afbc", "score": "0.7699848", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_L3VpnIpv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "f8fc56332c44ac8ed934c81536da134c", "score": "0.7687933", "text": "func (*Bgp_Neighbor_AfiSafi_ApplyPolicy) IsYANGGoStruct() {}", "title": "" }, { "docid": "f8fc56332c44ac8ed934c81536da134c", "score": "0.7687933", "text": "func (*Bgp_Neighbor_AfiSafi_ApplyPolicy) IsYANGGoStruct() {}", "title": "" }, { "docid": "bd397129bbac7fe8a9a2b4c4a6e98e07", "score": "0.7681106", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "bd397129bbac7fe8a9a2b4c4a6e98e07", "score": "0.7681106", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "bd397129bbac7fe8a9a2b4c4a6e98e07", "score": "0.76807535", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_Ipv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "dccaa19af77e3609da4ab7409f65fec3", "score": "0.76757705", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "dccaa19af77e3609da4ab7409f65fec3", "score": "0.76757705", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "dccaa19af77e3609da4ab7409f65fec3", "score": "0.767299", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_L2VpnEvpn) IsYANGGoStruct() {}", "title": "" }, { "docid": "bfa70c0344657a4b9b2fce5f4378b81d", "score": "0.76729804", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "bfa70c0344657a4b9b2fce5f4378b81d", "score": "0.7670883", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "bfa70c0344657a4b9b2fce5f4378b81d", "score": "0.7670883", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_Ipv4Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "0a600a4130152b22c35b875c1ca58412", "score": "0.7648802", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_SrtePolicyIpv6) IsYANGGoStruct() {}", "title": "" }, { "docid": "addfd82cca454f7cb781ed5c8f3fd21a", "score": "0.7637068", "text": "func (*Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "addfd82cca454f7cb781ed5c8f3fd21a", "score": "0.7635935", "text": "func (*Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "a70176379c4e5481f7264680b5a7a289", "score": "0.7629997", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "a70176379c4e5481f7264680b5a7a289", "score": "0.7629997", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "a70176379c4e5481f7264680b5a7a289", "score": "0.7627854", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_Af) IsYANGGoStruct() {}", "title": "" }, { "docid": "df9ffe6d36f7942218f07117638aebaf", "score": "0.7624339", "text": "func (*Bgp_Global_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "df9ffe6d36f7942218f07117638aebaf", "score": "0.76237124", "text": "func (*Bgp_Global_AfiSafi_L3VpnIpv6Unicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "ce1e2ad3e03fbb3f9ad69ab829bbba33", "score": "0.761932", "text": "func (*Afts_NextHop_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "606b00369bd24843d9ec52825cdc7547", "score": "0.7612169", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "606b00369bd24843d9ec52825cdc7547", "score": "0.7612169", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "606b00369bd24843d9ec52825cdc7547", "score": "0.7612169", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd13749034ff833768750c2debd18a78", "score": "0.7610101", "text": "func (*Bgp_Neighbor_AfiSafi_Prefixes) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd13749034ff833768750c2debd18a78", "score": "0.7610101", "text": "func (*Bgp_Neighbor_AfiSafi_Prefixes) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d5437447ce3d4276c174a03fe38b607", "score": "0.7596359", "text": "func (*Bgp_Global_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "1d5437447ce3d4276c174a03fe38b607", "score": "0.759528", "text": "func (*Bgp_Global_AfiSafi_L2VpnVpls) IsYANGGoStruct() {}", "title": "" }, { "docid": "306d119784961a66885c95c3b19db91d", "score": "0.75947446", "text": "func (*NetworkInstance_Protocol_Pim_Interface_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.7592177", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.7592177", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.7592177", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "415283b544418313c85a74fd616ddd4b", "score": "0.75792414", "text": "func (*Bgp_Global_AfiSafi_Ipv6LabeledUnicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "415283b544418313c85a74fd616ddd4b", "score": "0.75772905", "text": "func (*Bgp_Global_AfiSafi_Ipv6LabeledUnicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "66cb86e65b9d6606a705800cdcd98054", "score": "0.7576382", "text": "func (*Bgp_Neighbor_AfiSafi_Ipv6LabeledUnicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "66cb86e65b9d6606a705800cdcd98054", "score": "0.7572636", "text": "func (*Bgp_Neighbor_AfiSafi_Ipv6LabeledUnicast) IsYANGGoStruct() {}", "title": "" }, { "docid": "199d5520c4c600e482e4a9fca6e1b8d1", "score": "0.75702316", "text": "func (*Lldp_Interface_Neighbor) IsYANGGoStruct() {}", "title": "" }, { "docid": "199d5520c4c600e482e4a9fca6e1b8d1", "score": "0.7569895", "text": "func (*Lldp_Interface_Neighbor) IsYANGGoStruct() {}", "title": "" } ]
2de0a23912cdbe019b2a3e4af726e76c
RetrieveByID retrieves a user by ID
[ { "docid": "ed7fe8691bacd916f459bc6b5a949425", "score": "0.7485644", "text": "func (db *User) RetrieveByID(id *uuid.UUID) (users.User, error) {\n\tidAsString := id.String()\n\tif oneUsr, ok := db.usrs[idAsString]; ok {\n\t\treturn oneUsr, nil\n\t}\n\n\tstr := fmt.Sprintf(\"the user (ID: %s) could not be found\", idAsString)\n\treturn nil, errors.New(str)\n}", "title": "" } ]
[ { "docid": "c8b52757ae381d6b129a8a331413f984", "score": "0.803273", "text": "func (s Service) GetByID(id string) (User, error) {\n\tdb := db.GetDB()\n\tvar u User\n\n\tif err := db.Where(\"id = ?\", id).First(&u).Error; err != nil {\n\t\treturn u, err\n\t}\n\n\treturn u, nil\n}", "title": "" }, { "docid": "30af5b8c2d9194b37725faaf2ebec616", "score": "0.801516", "text": "func GetByID(id int) *User {\n\tvar usr User\n\tdb.Get().First(&usr, id)\n\treturn &usr\n}", "title": "" }, { "docid": "d6e5bf5d9742c26eaa94b94d720f49d6", "score": "0.79278076", "text": "func GetUserByID(user *User, id string) (err error) {\n\tif err = app.DB.Where(\"id = ?\", id).First(user).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c9be97298241b49ff31bcc25611c747", "score": "0.792418", "text": "func (u UserRepository) GetByID(id uint) (User, error) {\n\tvar user User\n\treturn user, u.db.Where(\"ID = ?\", id).First(&user).Error\n}", "title": "" }, { "docid": "66f7b7f2c55cec04a914dcf398d2d4b6", "score": "0.7901189", "text": "func (s *usersService) GetByID(idRequested, idClaimed uint) (User, error) {\n\n\tusr, err := s.repo.GetByID(idRequested)\n\tif err != nil {\n\t\tlog.Printf(\"error getting user: %s\\n\", err)\n\t\treturn User{}, err\n\t}\n\n\tif idRequested != idClaimed {\n\t\tusr = User{\n\t\t\tFirstName: usr.FirstName,\n\t\t\tLastName: usr.LastName,\n\t\t}\n\t}\n\n\treturn usr, nil\n}", "title": "" }, { "docid": "bb1211f5a87ac06c8becdad7949ad373", "score": "0.78804326", "text": "func GetUserByID(user *model.User, id string) (err error) {\n\tif err = config.Db.Where(\"id = ?\", id).First(user).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1068dea30a69d21328b9a4c8dd7ff79e", "score": "0.7864585", "text": "func GetUserByID(w http.ResponseWriter, r *http.Request) {\n\tres := New(w)\n\n\tid := chi.URLParam(r, \"id\")\n\n\tnumID, err := strconv.ParseInt(id, 10, 64)\n\tif err != nil {\n\t\tlog.WithField(\"ID\", numID).Error(\"unable to convert ID param\")\n\t\tres.Render(http.StatusInternalServerError, map[string]interface{}{\"error\": \"unable to convert ID param\"})\n\t\treturn\n\t}\n\n\tuser, err := models.GetUserByID(numID)\n\tif err != nil {\n\t\tlog.WithField(\"ID\", numID).Error(\"unable to get user by ID from database\")\n\t\tres.Render(http.StatusInternalServerError, map[string]interface{}{\"error\": \"unable to get user by ID from database\"})\n\t\treturn\n\t}\n\n\tlog.WithField(\"USER ID\", user.ID).Infof(\"user %d found\", user.ID)\n\tres.Render(http.StatusOK, user)\n}", "title": "" }, { "docid": "97060b81d8d2674a2ee82c65eea1411b", "score": "0.7779591", "text": "func GetUserByID(id uuid.UUID) *User {\n\n\t// Get the db connection\n\tdb := GetDB()\n\tuser := &User{}\n\n\t// Lookup the user\n\tdb.Table(\"users\").Where(\"ID = ?\", id).First(user)\n\t// If user doesn't exist\n\tif user.Email == \"\" {\n\t\treturn nil\n\t}\n\n\treturn user\n}", "title": "" }, { "docid": "6d85b4b91a8601f407ed9327f9484369", "score": "0.7776803", "text": "func (uc *userUsecase) GetByID(id int64) (res domain.User, err error) {\n\tres, err = uc.userRepository.GetByID(id)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "6b3cf15d76ff5d8732e5ec7e49dd6754", "score": "0.7775017", "text": "func (uh *UserHandler) GetUserByID(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tuserID := vars[\"id\"]\n\tuser := &model.User{}\n\tuser, err := uh.dao.GetUserByID(userID)\n\tif err != nil {\n\t\tlogrus.WithField(\"err\", err).Warn(\"Error while fetching user\")\n\t\tutils.JSONWithHTTPCode(w, utils.MsgBadParameter, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlogrus.Info(\"Fetched a user\")\n\tutils.JSONWithHTTPCode(w, user, http.StatusOK)\n}", "title": "" }, { "docid": "e16d5d715911c8dcf60f2ba29d8c62e4", "score": "0.776801", "text": "func GetUserById(w http.ResponseWriter, r *http.Request) {\r\n\tvars := mux.Vars(r)\r\n\tid, _ := strconv.ParseInt(vars[\"id\"], 10, 32)\r\n\tuser := model.User{}\r\n\tdata, err := user.FindById(int32(id))\r\n\tif err != nil {\r\n\t\tresponses.ErrorJson(w, http.StatusInternalServerError, err)\r\n\t}\r\n\tresponses.SuccessJson(w, http.StatusFound, data)\r\n}", "title": "" }, { "docid": "66b6fbf41900ee81a5c2dcf70982b726", "score": "0.77637255", "text": "func (db *DBORM) GetUserByID(id int) (user User, err error) {\n\terr = db.Find(&user, id).Error\n\n\treturn user.GetUser(), err\n}", "title": "" }, { "docid": "599ee2c77630a2bdb74057ffa8587d69", "score": "0.7756571", "text": "func GetByID(id string) (*User, error) {\n\tobjID, err := model.ToObjectID(id)\n\tif err != nil {\n\t\treturn &User{}, err\n\t}\n\n\treturn getOneByFilter(bson.M{\"_id\": objID})\n}", "title": "" }, { "docid": "1b4092deec3bb3dbdefcf218c5d3c79e", "score": "0.77471703", "text": "func (ur *UserRepository) GetByID(ID string) (*models.User, error) {\n\tdb := ur.db\n\tudb := db.Unsafe()\n\n\tquery, _ := selectUsers.Where(\"users.ID = $1\").Limit(1).MustSql()\n\n\tuser := models.User{}\n\terr := udb.Get(&user, query, ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &user, err\n}", "title": "" }, { "docid": "f03966fe781198cf1405c5333e5a6945", "score": "0.7746329", "text": "func (t *User) GetByID(db *gorm.DB) (err error) {\n\tif err = db.First(t, \"id = ?\", t.ID).Error; err != nil {\n\n\t\terr = ErrGetUser\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "bdfbd2e9cfb372050cea1ffec1aa0910", "score": "0.77452475", "text": "func (s *MySQLStore) GetByID(id int64) (*User, error) {\n\t// Process request and return correct output\n\n\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "af200bef1b9da38fc2333dda6e256b1e", "score": "0.7735041", "text": "func (u *UserModel) GetUserByID(id string) (user User, err error) {\n\tcollection := dbConnect.Use(databaseName, \"user\")\n\n\terr = collection.Find(bson.M{\"_id\": id}).One(&user)\n\n\treturn user, err\n}", "title": "" }, { "docid": "172390a74698789f5f658c70f0ce6095", "score": "0.7730548", "text": "func (repo *UserMySQLRepository) GetByID(id string) (*model.User, error) {\n\tuser := &model.User{}\n\tfmt.Printf(\"%s\", id)\n\tif err := repo.db.Where(\"id = ?\", id).First(user).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "56ef2b75d8cf5c40661465dfd9fe9418", "score": "0.7717521", "text": "func (repo *Repo) GetByID(ID string) (*User, error) {\n\tuser := &User{}\n\terr := repo.DB.\n\t\tQueryRow(\"SELECT id, username, admin, passwordHash, token FROM users WHERE id = ?\", ID).\n\t\tScan(&user.ID, &user.Username, &user.Admin, &user.PasswordHash, &user.Token)\n\tif err != nil {\n\t\treturn nil, ErrNoUser\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "cb68acb941db35d30b3abfe2d94cb33f", "score": "0.77152205", "text": "func (uc *userUseCase) GetUserByID(id string) (auth.User, error) {\n\treturn uc.userRepo.GetUserByID(id)\n}", "title": "" }, { "docid": "ccebd3257bda8c9d6a004e800f96d36f", "score": "0.77148765", "text": "func (h UserController) GetByID(w http.ResponseWriter, req *http.Request) {\n\tre := reply.NewHTTPReplier(reply.Options{\n\t\tResponseWriter: w,\n\t\tContentType: \"application/json\",\n\t\tAccept: []string{\"application/json\"},\n\t})\n\tsetupResponse(&w, req)\n\n\t// get id url parameter\n\tuserID, err := strconv.ParseInt(mux.Vars(req)[\"id\"], 10, 64)\n\tif err != nil {\n\t\tre.Error(err.Error(), http.StatusInternalServerError, true)\n\t\treturn\n\t}\n\n\t// get user by id\n\tuser, err := h.UserModel.Get(userID)\n\tif err == sql.ErrNoRows { // user by id not exist\n\t\tre.Reply(http.StatusText(http.StatusNotFound), http.StatusNotFound, false)\n\t\treturn\n\t}\n\tif err != nil {\n\t\terr := errors.New(\"get user by id controller: \" + err.Error())\n\t\tre.Error(err.Error(), http.StatusInternalServerError, true)\n\t\treturn\n\t}\n\n\tre.Reply(*user, http.StatusOK, false)\n}", "title": "" }, { "docid": "1bf7d47d588914a76c341f50753f3360", "score": "0.77115405", "text": "func (r *UserRepository) GetUserByID(id string) (User, error) {\n\tcollection := r.database.Database(\"api\").Collection(\"users\")\n\tctx, _ := context.WithTimeout(context.Background(), 5*time.Second)\n\n\tobjectID, _ := primitive.ObjectIDFromHex(id)\n\tfilter := bson.M{\n\t\t\"_id\": objectID,\n\t}\n\n\tvar u User\n\terr := collection.FindOne(ctx, filter).Decode(&u)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn u, err\n}", "title": "" }, { "docid": "9bd27c927965c28c0e51bc837adbe7c1", "score": "0.77050346", "text": "func (mss *MySQLStore) GetByID(id int64) (*User, error) {\n\tsqlcmd := \"select * from users where id=?\"\n\tuser := User{}\n\terr := mss.Client.QueryRow(sqlcmd, id).Scan(&user.ID, &user.Email, &user.PassHash, &user.UserName, &user.FirstName, &user.LastName, &user.PhotoURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user, nil\n}", "title": "" }, { "docid": "dce3b9e3e3a453ae6c535c9a301f911d", "score": "0.7690116", "text": "func GetUserByID(context interface{}, db *db.DB, id string) (*User, error) {\n\tlog.Dev(context, \"GetUserById\", \"Started : Id[%s]\", id)\n\n\tvar user User\n\tf := func(c *mgo.Collection) error {\n\t\tq := bson.M{\"_id\": id}\n\t\tlog.Dev(context, \"GetUserById\", \"MGO : db.%s.findOne(%s)\", userCollection, mongo.Query(q))\n\t\treturn c.Find(q).One(&user)\n\t}\n\n\tif err := db.ExecuteMGO(context, userCollection, f); err != nil {\n\t\tlog.Error(context, \"GetUserById\", err, \"Completed\")\n\t\treturn nil, err\n\t}\n\n\tlog.Dev(context, \"GetUserById\", \"Completed\")\n\treturn &user, nil\n}", "title": "" }, { "docid": "2fde200bb7ed5c3cc5bd064f5cfcb127", "score": "0.7680981", "text": "func (u *User) GetUserByID(id int64) (*User, error) {\n\taccount := &User{}\n\tif err := db.Client.Debug().Table(\"users\").Where(\"id = ?\", id).First(account).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn account, nil\n}", "title": "" }, { "docid": "e47928cd8866ab3097f4d945ee919954", "score": "0.76684767", "text": "func (s *Server) GetUserByID(ctx context.Context, req *GetUserByIDRequest) (*GetUserByIDResponse, error) {\n\tvar user models.User\n\tclient := config.Database\n\tcollection := client.Database(\"egnite\").Collection(\"users\")\n\tid, err := primitive.ObjectIDFromHex(req.Id)\n\tif err != nil {\n\t\treturn &GetUserByIDResponse{Success: false, Err: \"id_not_valid\"}, err\n\t}\n\tdocumentReturned := collection.FindOne(context.TODO(), bson.M{\"_id\": id})\n\terr = documentReturned.Decode(&user)\n\tif err != nil {\n\t\treturn &GetUserByIDResponse{Success: false, Err: \"user_not_found\"}, nil\n\t}\n\n\treturn &GetUserByIDResponse{Success: true, User: &User{Id: user.ID.Hex(), Name: user.Name, Email: user.Email, Username: user.Username, Phone: user.Phone, Role: user.Role}}, nil\n}", "title": "" }, { "docid": "e6415f59c17e963c9010f6406bbdea04", "score": "0.76647127", "text": "func GetUserByID(id int64) (*User, error) {\n\tvar user User\n\tif g.First(&user, id).RecordNotFound() {\n\t\treturn nil, errUserNotExist\n\t}\n\n\treturn &user, nil\n}", "title": "" }, { "docid": "f290e06ab5e9b921ed2b1eab78e5b33b", "score": "0.7661324", "text": "func (r *SQLRepository) GetByID(id int) (*User, error) {\n\trow := r.db.QueryRow(selectByID, id)\n\treturn scanUser(row)\n}", "title": "" }, { "docid": "31b874037b5acce6920b90eedf4e3652", "score": "0.7654045", "text": "func (r *Repository) GetByID(id string) (*User, error) {\n\tq := \"SELECT * FROM %s WHERE id = ? LIMIT 1\"\n\tq = fmt.Sprintf(q, r.tableName)\n\tq = r.db.Rebind(q)\n\tu := &User{}\n\tif err := r.db.Get(u, q, id); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, ErrNotFound\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"get user by id\")\n\t}\n\treturn u, nil\n}", "title": "" }, { "docid": "35cf6ddab86afdbcddb2ed42a9a5870f", "score": "0.76261973", "text": "func (d *DB) GetUserByID(id int) (*models.User, error) {\n\treturn models.Users(qm.Where(\"user_id=?\", id)).One(d.ctx, d)\n}", "title": "" }, { "docid": "44403c745a00132a09682bbaaf7b8c0b", "score": "0.7610221", "text": "func (m *testDBrepo) GetUserByID(id int) (models.User, error) {\n\n\treturn models.User{}, nil\n}", "title": "" }, { "docid": "7aed613baa9171ad99c1d01d839f7a7b", "score": "0.7594231", "text": "func (db *Mongo) GetUserByID(id string) (models.User, error) {\n\tvar user models.User\n\terr := db.Users().FindId(bson.ObjectIdHex(id)).One(&user)\n\treturn user, err\n}", "title": "" }, { "docid": "f9921eb7ed97236abaee6737ebded9d1", "score": "0.75908697", "text": "func (u UsersOp) GetUserByID(id int) (*types.User, error) {\n\tconst query = `\n SELECT *\n FROM users\n WHERE id = $1`\n\n\tdb, _ := ConnectDB()\n\tuser := types.User{}\n\terr := db.Get(&user, query, id)\n\tif err != nil {\n\t\treturn &user, err\n\t}\n\tdb.Close()\n\treturn &user, nil\n}", "title": "" }, { "docid": "2e7fb199a9959eaf4b6b33bca815d358", "score": "0.75887716", "text": "func getUserByID(req *restful.Request, resp *restful.Response) {\n\tid := req.PathParameter(\"id\")\n\tif id == \"\" {\n\t\tutils.WriteError(resp, errors.CreateError(400, \"invalid_data\"))\n\t\treturn\n\t}\n\n\tvar claims = utils.GetClaims(req)\n\tuser, err := GetService().GetUser(id, claims.Permissions, utils.GetUserID(req))\n\n\tif err != nil {\n\t\tutils.WriteError(resp, err)\n\t\treturn\n\t}\n\n\tresp.WriteHeaderAndEntity(200, user)\n}", "title": "" }, { "docid": "74f36cbe0b5e995af0e521c0076999f6", "score": "0.7584637", "text": "func (store *dbStore) GetByID(id int64) (*users.User, error) {\n\tc := users.User{}\n\tif id < 0 {\n\t\treturn nil, errors.New(\"invalid primary key\")\n\t}\n\trows := store.DB.QueryRow(\"SELECT * FROM Users WHERE id=?\", id)\n\n\tif err := rows.Scan(&c.ID, &c.Email, &c.PassHash, &c.UserName,\n\t\t&c.FirstName, &c.LastName, &c.Chips); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, fmt.Errorf(\"%s\", \"User not found\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error scanning row: %v\", err)\n\t}\n\n\treturn &c, nil\n}", "title": "" }, { "docid": "995ddc6da90b9c0524052f4f321c10f5", "score": "0.75791335", "text": "func (u *User) GetByID(id string) (models.User, error) {\r\n\tvar err error\r\n\terr = u.utils.ValidateObjectID(id)\r\n\tif err != nil {\r\n\t\treturn models.User{}, err\r\n\t}\r\n\r\n\tsessionCopy := databases.Database.MgDbSession.Copy()\r\n\tdefer sessionCopy.Close()\r\n\r\n\t// Get a collection to execute the query against.\r\n\tcollection := sessionCopy.DB(databases.Database.Databasename).C(common.ColUsers)\r\n\r\n\tvar user models.User\r\n\terr = collection.FindId(bson.ObjectIdHex(id)).One(&user)\r\n\treturn user, err\r\n}", "title": "" }, { "docid": "fafb9abefceac724a06f6312ed6100f3", "score": "0.7566943", "text": "func (u *MyUserModel) GetById(id interface{}) error {\n\n\trow, err := rethink.Table(\"user\").Get(id).RunRow(dbSession)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !row.IsNil() {\n\t\tif err := row.Scan(&u); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "407d533aad7f6dadd0946fa0c968f917", "score": "0.75641125", "text": "func (service UserService) GetUserByID(id string) (entity.DataUserEntity, error) {\n\tuserData, err := service.Repository.GetUserByID(id)\n\treturn userData, err\n}", "title": "" }, { "docid": "ab83b7cf944729f37cd4693815776a11", "score": "0.75623465", "text": "func GetUserById(id uint) *User {\n\n\tu := &User{}\n\n\tdb.Where(\"id = ?\", id).First(u)\n\tif *u == (User{}) {\n\t\treturn nil\n\t}\n\n\treturn u\n}", "title": "" }, { "docid": "d3c201d8caa7893ad504b98154e7d792", "score": "0.75619876", "text": "func UserGetByID(id int) (*User, error) {\n\tr := new(User)\n\terr := orm.NewOrm().QueryTable(TableName(\"user\")).Filter(\"ID\", id).One(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "7fb0cc2c6e0db30da0005241765b87b6", "score": "0.7515372", "text": "func GetUserById(id int) (v *User, err error) {\n\to := orm.NewOrm()\n\tv = &User{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "d44d5d9dda44889ae7b38c0994fbfd07", "score": "0.75079614", "text": "func (e *UserHandler) GetUserByID(w http.ResponseWriter, r *http.Request) {\n\tuserID, err := ParseUserID(w, r)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tuser, err := e.db.GetUser(userID)\n\tif err != nil {\n\t\tWriteHTTPErrorCode(w, err, http.StatusNotFound)\n\t\treturn\n\t}\n\trender.JSON(w, r, user)\n}", "title": "" }, { "docid": "1ebd670ed5c2e5973689568dff361948", "score": "0.750339", "text": "func (m *testDBRepo) GetUserByID(id int) (models.User, error) {\n\tvar user models.User\n\n\treturn user, nil\n}", "title": "" }, { "docid": "95e9ca45b4077a0afc202e6f350c4e35", "score": "0.74956745", "text": "func GetUser(db *gorm.DB, User *User, id string) (err error) {\n\terr = db.Where(\"id = ?\", id).First(User).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3e61430ee18620086cd77efe795f0c61", "score": "0.748085", "text": "func (u *UserHandler) GetByID(c echo.Context) error {\n\tidP, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusNotFound, \"Not found\")\n\t}\n\tid := int64(idP)\n\n\tctx := c.Request().Context()\n\tdata, err := u.UserUcase.GetByID(ctx, id)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusNotFound, ResponseError{Message: err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, data)\n\n}", "title": "" }, { "docid": "d1ea7f4e974ab7f281b5b27d2fb94ddb", "score": "0.74808407", "text": "func (ms *MySQLStore) GetByID(id int64) (*User, error) {\n\tuser := User{}\n\trow := ms.Db.QueryRow(\"select * from users where id = ?\", id)\n\terr := row.Scan(&user.ID, &user.PassHash, &user.UserName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user, nil\n}", "title": "" }, { "docid": "ede27dc108aaf929a71535784e3a5dbd", "score": "0.74807864", "text": "func GetUserByID(id string) models.User {\n\tdb, err := bolt.Open(database, fileMode, nil)\n\n\tif err != nil {\n\t\tfmt.Println(\"could not open db\")\n\t}\n\n\tdefer db.Close()\n\n\tvar userData models.User\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"users\"))\n\t\tuser := b.Get([]byte(id))\n\t\tif err := json.Unmarshal(user, &userData); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn userData\n}", "title": "" }, { "docid": "14fcf0ee6fe6beaccbf50417380698e5", "score": "0.74799657", "text": "func GetUserByID(c *gin.Context) {\n\tid := c.Param(\"id\")\n\n\tuser, err := services.GetUserById(id)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\"error\": fmt.Sprintf(\"No user with id %s found\", id)})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, user)\n\treturn\n}", "title": "" }, { "docid": "f171c71dfb1e994a302b6891640a3662", "score": "0.747486", "text": "func GetUserByID(userID string) (*User, *errors.RestError) {\n\tresult := usersDB[userID]\n\n\tif result == nil {\n\t\treturn nil, errors.NewNotFoundError(fmt.Sprintf(\"User %s not found\", userID))\n\t}\n\n\treturn &User{\n\t\tID: result.ID,\n\t\tFirstName: result.FirstName,\n\t\tLastName: result.LastName,\n\t\tEmail: result.Email,\n\t}, nil\n}", "title": "" }, { "docid": "509d63140faf22dd9fa69ad6e2a3b834", "score": "0.7451531", "text": "func (ms *MySQLStore) GetByID(id int64) (*User, error) {\n\treturn ms.getByProvidedType(\"ID\", id)\n}", "title": "" }, { "docid": "35db5d40494b815f086560c7652449b7", "score": "0.74485457", "text": "func (u *userPGRepository) GetByID(ctx context.Context, userID uuid.UUID) (*models.UserResponse, error) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"userPGRepository.GetByID\")\n\tdefer span.Finish()\n\n\tvar res models.UserResponse\n\tif err := u.db.QueryRow(ctx, getUserByIDQuery, userID).Scan(\n\t\t&res.UserID,\n\t\t&res.FirstName,\n\t\t&res.LastName,\n\t\t&res.Email,\n\t\t&res.Avatar,\n\t\t&res.Role,\n\t\t&res.UpdatedAt,\n\t\t&res.CreatedAt,\n\t); err != nil {\n\t\treturn nil, errors.Wrap(err, \"Scan\")\n\t}\n\n\treturn &res, nil\n}", "title": "" }, { "docid": "4c47c61de89ef6741dbc75520f6dc5ca", "score": "0.744671", "text": "func GetUserById(id string) (*models.User, error) {\n\tuser, err := repositories.GetUserById(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "70b177c16fe41240aeee10a5b8bde119", "score": "0.7427381", "text": "func (repo *DbUserRepository) GetUserByID(sqlRunner database.SQLRunner, id int16) (*User, error) {\n\trow := sqlRunner.QueryRow(GetUserByIDQuery, id)\n\treturn convertUser(row)\n}", "title": "" }, { "docid": "a7fe9572fa853cf7ebf6534dc682caed", "score": "0.7425324", "text": "func (h *Handler) GetByID(response http.ResponseWriter, request *http.Request) {\n\n\tparams := mux.Vars(request)\n\tid := string(params[\"id\"])\n\n\tr := Repository{DBURI: h.DBURI}\n\n\tuser, err := r.GetByID(id)\n\n\tif err != nil {\n\t\twriteErr(response, err)\n\t}\n\n\terr = json.NewEncoder(response).Encode(user)\n\n\tif err != nil {\n\t\twriteErr(response, err)\n\t}\n}", "title": "" }, { "docid": "f1fbbfcf995974ad98d0c40f51e30ede", "score": "0.74177396", "text": "func GetUserByID(id int, db *sql.DB) *model.User {\n\t// * define user\n\tvar user *model.User\n\n\t// * define sql statement with placeholder\n\tstmt := `SELECT * FROM USERS WHERE USERS.ID = ?`\n\n\t// * execute the query with id for the placeholder\n\trows, err := db.Query(stmt, id)\n\tif err != nil {\n\t\tlog.Fatalf(\"%s - ERROR occured at db.Query(stmt) line 122 %s\", fileName, err)\n\t}\n\n\t// * process result set\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tid int\n\t\t\tname string\n\t\t\tage int\n\t\t)\n\t\tif err := rows.Scan(&id, &name, &age); err != nil {\n\t\t\tlog.Fatalf(\"%s - ERROR occured at rows.Scan(&name, &age) line 134 %s\", fileName, err)\n\t\t}\n\n\t\t// * store in users []model.Users\n\t\tuser = &model.User{id, name, age}\n\t}\n\treturn user\n\n}", "title": "" }, { "docid": "9d4af712089a200fef99908ac620e328", "score": "0.74029374", "text": "func GetUserByID(db *sql.DB, id int) (*User, error) {\n\tquery := psql.\n\t\tSelect(\"key_id\", \"net_id\", \"creation_date\", \"last_modification_date\").\n\t\tFrom(\"users\").\n\t\tWhere(sq.Eq{\"key_id\": id}).\n\t\tLimit(1)\n\n\tuser := new(User)\n\terr := query.RunWith(db).\n\t\tQueryRow().\n\t\tScan(\n\t\t\t&user.KeyID,\n\t\t\t&user.NetID,\n\t\t\t&user.CreationDate,\n\t\t\t&user.LastModificationDate,\n\t\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "515539e1e5a352513d1b8fac684b8366", "score": "0.73868984", "text": "func (u *User) GetUserByID(id string) (UserView UserView, err error) {\n\t// user = &User{}\n\tif err = config.DB.Table(u.TableName()).Where(\"id = ?\", id).First(&UserView).Error; err != nil {\n\t\treturn\n\t}\n\treturn UserView, err\n}", "title": "" }, { "docid": "b41a0434eb7ab5ea28c2ea3389a34624", "score": "0.73823047", "text": "func (u *Users) GetByID(id int) (*user.User, error) {\n\tvar findID int\n\tvar email, oauthToken, identifier, avatarURL string\n\tvar uuid int64\n\terr := u.db.QueryRow(\"SELECT id, email, oauth_token, uuid, identifier, avatar_url FROM users where id = $1\", id).Scan(&findID, &email, &oauthToken, &uuid, &identifier, &avatarURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user.User{\n\t\tID: findID,\n\t\tEmail: email,\n\t\tOauthToken: oauthToken,\n\t\tUUID: uuid,\n\t\tIdentifier: identifier,\n\t\tAvatarURL: avatarURL,\n\t}, nil\n}", "title": "" }, { "docid": "7efb20b7e8c5d97e42d3848437023701", "score": "0.7374659", "text": "func GetUserByID(user *repo.User) (*repo.User, error) {\n\n\tval, err := user.GetUserByID()\n\tif err != nil {\n\t\tu.Logger.Error(\"[GetUserByID] Error : %s\", err)\n\t\treturn nil, err\n\t}\n\treturn val, nil\n}", "title": "" }, { "docid": "ddf3a19d754341dbed3b5aa2ee44cd3c", "score": "0.7373036", "text": "func (s *UserService) GetUserByID(userID uuid.UUID) (*models.User, error) {\n\treturn s.getUserByID(userID)\n}", "title": "" }, { "docid": "68d2c3a1fdaaa06e3ae4f2329236d62e", "score": "0.73603904", "text": "func (u *userDao) GetUserByID(userID primitive.ObjectID) (*dto.UserResponse, rest_err.APIError) {\n\n\tcoll := db.Db.Collection(keyUserColl)\n\tctx, cancel := context.WithTimeout(context.Background(), connectTimeout*time.Second)\n\tdefer cancel()\n\n\tvar user dto.UserResponse\n\topts := options.FindOne()\n\topts.SetProjection(bson.M{keyHashPw: 0})\n\n\tif err := coll.FindOne(ctx, bson.M{keyID: userID}, opts).Decode(&user); err != nil {\n\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tapiErr := rest_err.NewNotFoundError(fmt.Sprintf(\"User dengan ID %v tidak ditemukan\", userID.Hex()))\n\t\t\treturn nil, apiErr\n\t\t}\n\n\t\tlogger.Error(\"gagal mendapatkan user (by ID) dari database\", err)\n\t\tapiErr := rest_err.NewInternalServerError(\"Gagal mendapatkan user dari database\", err)\n\t\treturn nil, apiErr\n\t}\n\n\treturn &user, nil\n}", "title": "" }, { "docid": "ce9904fb9cf4a07fc347a4171b6ccabc", "score": "0.73591506", "text": "func (r *UserRepo) FindByID(id string) (model.User, error) {\n\tlog.Printf(\"FindByID(%s) \\n\", id)\n\tctx, cancel := timeoutContext()\n\tdefer cancel()\n\n\tvar user model.User\n\toid, _ := primitive.ObjectIDFromHex(id)\n\terr := r.col.FindOne(ctx, bson.M{\"_id\": oid}).Decode(&user)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn user, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "16ddf4581d3704e3d3c586a6bbb8f51e", "score": "0.73536754", "text": "func GetUserById(id int) (v *UserModel, err error) {\n\tv = new(UserModel)\n\tif err = DB.First(&v, 10).Error;\n\t\terr == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "a50152e954c2db0d6d0a390ef6d0bfe0", "score": "0.73525536", "text": "func (r *SQLRepo) GetByID(id string) (*pb.User, error) {\n\n\tdb, err := r.GetDB()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(`select id, first_name, last_name, date_of_birth from public.user where id = $1`)\n\tdefer stmt.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(id)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tpbUser, err := transform(rows)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn pbUser, nil\n\t}\n\n\treturn nil, errors.New(\"Not found\")\n}", "title": "" }, { "docid": "084eb0c942fc5622149d5a6879f6ac26", "score": "0.7339878", "text": "func userByID(id int) (model.User, error) {\n\tvar err error\n\n\tresult := model.User{}\n\n\tswitch database.ReadConfig().Type {\n\tcase database.TypeMySQL:\n\t\terr = database.SQL.Get(&result, \"SELECT id, first_name, last_name, email, password, status_id, created_at FROM user WHERE id = ? LIMIT 1\", id)\n\tdefault:\n\t\terr = model.ErrCode\n\t}\n\treturn result, model.StandardizeError(err)\n}", "title": "" }, { "docid": "5288a73cafe7ac577dddb2a712f5bd42", "score": "0.7338251", "text": "func GetUserById(id int64) (v *User, err error) {\n\to := orm.NewOrm()\n\tv = &User{Id: id}\n\tif err = o.QueryTable(new(User)).Filter(\"Id\", id).RelatedSel().One(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "a5ca5433ce4183657824ff5876358b55", "score": "0.733801", "text": "func GetUser(id int64) (*model.User, error) {\n\tuser := &model.User{\n\t\tID: id,\n\t}\n\terr := model.DB.Select(user)\n\treturn user, err\n}", "title": "" }, { "docid": "16c30e5fb41c91c6d865bae201728a72", "score": "0.73346984", "text": "func GetUserByID(id string) (*User, error) {\n\trow := shared.Db.QueryRow(\"select id, username, avatar from auth_user \"+\n\t\t\"join user_profile_profile on user_id=auth_user.id \"+\n\t\t\"where auth_user.id=$1\", id)\n\tuser := User{}\n\terr := row.Scan(&user.ID, &user.Username, &user.Avatar)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user, nil\n}", "title": "" }, { "docid": "6fdefc97d710e715f25355c3f7b85218", "score": "0.7324429", "text": "func GetUserByID(id int) (User, error) {\n\tfor _, user := range users {\n\t\tif user.ID == id {\n\t\t\treturn *user, nil\n\t\t}\n\t}\n\n\treturn User{}, fmt.Errorf(\"User with ID '%v' not found\", id)\n}", "title": "" }, { "docid": "862d2d8c643caae46d9d3dee70e65179", "score": "0.7323206", "text": "func (*ServiceMemory) GetByID(userID string) (user *models.User, err error) {\n\tfor idx, record := range fixtures.Users {\n\t\tif record.IsActive == true && record.UserID == userID {\n\t\t\treturn &fixtures.Users[idx], nil\n\t\t}\n\t}\n\n\treturn nil, models.ErrRecordNotFound\n}", "title": "" }, { "docid": "c34260622a9b91a5bbe78c4337cbb652", "score": "0.7322536", "text": "func (u *UserService) FindByID(id uint) model.User {\n\treturn u.UserRepository.FindByID(id)\n}", "title": "" }, { "docid": "67a1081c2b37e8236d240b7bfebdb1c0", "score": "0.7322326", "text": "func (h *Handler) GetUserByID(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tvar user models.User\n\th.DB.Preload(\"Keys\").Preload(\"Tribes\").Preload(\"SharedKeys\").First(&user, params[\"user_id\"])\n\twrite, _ := json.Marshal(&user)\n\thelpers.RenderJSON(w, write, http.StatusOK)\n}", "title": "" }, { "docid": "5daa8e4f59cffd7751eef933c2152e5c", "score": "0.7321208", "text": "func (userh *UserHandler) GetUserByID(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\tres := &struct {\n\t\tSuccess bool `json:\"success\"`\n\t\tMessage string `json:\"message\"`\n\t\tUser *entity.User `json:\"user\"`\n\t}{\n\t\tSuccess: false,\n\t}\n\tif userid := request.FormValue(\"userid\"); userid != \"\" {\n\t\tuser := userh.UserSer.GetUserByID(userid)\n\t\tif user == nil {\n\t\t\tres.Message = \" Record Not Found \"\n\t\t\tresponse.Write(Helper.MarshalThis(res))\n\t\t\treturn\n\t\t}\n\t\tres.Message = \" Succesfuly Fetched User \"\n\t\tres.User = user\n\t\tres.Success = true\n\t\tresponse.Write(Helper.MarshalThis(res))\n\t\treturn\n\t} else {\n\t\tres.Message = \" Invalid Input \"\n\t\tresponse.Write(Helper.MarshalThis(res))\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "f30ae0d6d934d4b501a128dde56e6ec6", "score": "0.731575", "text": "func (u UsersAPI) ByID(id uint) User {\n\n\tvar user User\n\tu.db.Find(&user, id)\n\treturn user\n\n}", "title": "" }, { "docid": "7d982d4ef84460889421f8d6733b5dcd", "score": "0.7312122", "text": "func (u *UserService) FindByID(id string) (model.User, error) {\r\n\tu.init()\r\n\treturn u.repo.FindByID(id)\r\n}", "title": "" }, { "docid": "d382e21d15b3085e37395e8fab71e9fa", "score": "0.73106706", "text": "func GetUserByID(userID *uint64) (models.User, error) {\n\tuser := models.User{}\n\tif err := db.DB.Model(&user).Where(\"id = ?\", userID).Find(&user).Error; err != nil {\n\t\treturn user, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "dce9417fd1403620dfacfef9ba3f1c46", "score": "0.7303584", "text": "func GetUserByID(pgDB *pg.DB, userID int) (User, error) {\n\tvar user User\n\tgetUserErr := pgDB.Model((*User)(nil)).Where(\"id = ?\", userID).Select(&user)\n\treturn user, getUserErr\n}", "title": "" }, { "docid": "b8bd17cf136d856b16474b1553e3fe2f", "score": "0.7303581", "text": "func (s UserService) FindByID(id entity.ID) (u entity.User, err error) {\n\tdb := db.Init()\n\n\tif err = db.Preload(\"Reservations\").Where(\"id = ?\", id).First(&u).Error; err != nil {\n\t\treturn entity.User{}, err\n\t}\n\tdefer db.Close()\n\treturn u, nil\n}", "title": "" }, { "docid": "ef9359ee690e914633f9416b2c303061", "score": "0.7294925", "text": "func GetUserByID(id int) (User, error) {\n\tfor _, u := range users {\n\t\tif u.ID == id {\n\t\t\treturn *u, nil\n\t\t}\n\t}\n\treturn User{}, fmt.Errorf(\"user with id '%v' not found\", id)\n}", "title": "" }, { "docid": "e471ceef3b27dc664e762e15c17ea0e1", "score": "0.7280524", "text": "func (d *Accessor) GetUser(id string, attrs []string) (user.User, error) {\n\tlog.Debugf(\"DB: Getting identity %s\", id)\n\n\terr := d.checkDB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar userRec cadbuser.Record\n\terr = d.db.Get(\"GetUser\", &userRec, d.db.Rebind(getUser), id)\n\tif err != nil {\n\t\treturn nil, cadbutil.GetError(err, \"User\")\n\t}\n\n\treturn cadbuser.New(&userRec, d.db), nil\n}", "title": "" }, { "docid": "d84e23e368a66eda6a73cff35803988c", "score": "0.7273468", "text": "func GetUserById(w http.ResponseWriter, req *http.Request) {\n\tid := mux.Params(req).PathParams[\"id\"]\n\tuser, err := pool.Dispatch(pool.UserFindById, bson.ObjectIdHex(id))\n\tif err != nil {\n\t\tJsonErrorResponse(w, err, http.StatusNotFound)\n\t\treturn\n\t}\n\n\tJsonResponse(w, user)\n}", "title": "" }, { "docid": "0d6b519b850e4efd57a89c5099cddb87", "score": "0.72724134", "text": "func (u *usersAPI) FetchByID(id int) (*User, bool) {\n\tuser := User{ID: id}\n\terr := DB.Read(&user)\n\treturn &user, utils.ProcessError(err, \"fetch the user by id\")\n}", "title": "" }, { "docid": "1fcbc04344f0c3bfb127840727aabde9", "score": "0.72724086", "text": "func (service UsersService) GetByID(id int) (map[string]interface{}, error) {\n\tuser := map[string]interface{}{}\n\tuserInterface, err := service.repository.FindByID(id)\n\tif err != nil {\n\t\treturn user, err\n\t}\n\tuser = structs.Map(userInterface.(models.User))\n\treturn user, nil\n}", "title": "" }, { "docid": "1ef0f8919577f5944352411c0ec430bf", "score": "0.72679305", "text": "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "1ef0f8919577f5944352411c0ec430bf", "score": "0.72679305", "text": "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "1ef0f8919577f5944352411c0ec430bf", "score": "0.72679305", "text": "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "1ef0f8919577f5944352411c0ec430bf", "score": "0.72679305", "text": "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "1ef0f8919577f5944352411c0ec430bf", "score": "0.72679305", "text": "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "1ef0f8919577f5944352411c0ec430bf", "score": "0.72679305", "text": "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "c3edccc6126581ef6497312921ec7af6", "score": "0.72513884", "text": "func (u UserRepository) GetUserById(db *sql.DB, user models.User, userId int) (models.User, error) {\n\trow := db.QueryRow(\"SELECT id, email, activated, username FROM users WHERE id = $1\", userId)\n\terr := row.Scan(&user.ID, &user.Email, &user.Activated, &user.Username)\n\n\tif err != nil {\n\n\t\treturn user, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "ec9b84f41fbfe50c761b84f6b4fa1013", "score": "0.725004", "text": "func UserByID(db storage.IStorage) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tidStr := mux.Vars(r)[\"id\"]\n\t\tid, err := strconv.Atoi(idStr)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tsendResponse(w, map[string]interface{}{\n\t\t\t\t\"status\": http.StatusBadRequest,\n\t\t\t\t\"error\": \"Error getting data\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tu, err := db.Get(id)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\tsendResponse(w, map[string]interface{}{\n\t\t\t\"status\": http.StatusOK,\n\t\t\t\"user\": u,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "41ea7c9bfa7c0be6b7bcc657ffa2d682", "score": "0.7244759", "text": "func (ds UsersService) GetByID(ctx context.Context, userID int) (*entities.User, error) {\n\tuser := entities.User{}\n\tquery := `\n\t\tselect u.id, u.email, w.id, w.user_id, w.balance, w.currency \n\t\tfrom users as u \n\t\tjoin wallets as w \n\t\ton u.id = w.user_id \n\t\twhere u.id = $1\n\t`\n\n\tuserRow, getUserErr := ds.db.QueryContext(ctx, query, userID)\n\tif getUserErr != nil {\n\t\treturn nil, getUserErr\n\t}\n\tfor userRow.Next() {\n\t\twallet := entities.Wallet{}\n\t\tscanErr := userRow.Scan(\n\t\t\t&user.ID,\n\t\t\t&user.Email,\n\t\t\t&wallet.ID,\n\t\t\t&wallet.UserID,\n\t\t\t&wallet.Balance,\n\t\t\t&wallet.Currency,\n\t\t)\n\t\tif scanErr != nil {\n\t\t\treturn nil, fmt.Errorf(\"GetByID: Error of reading the result: %s\", scanErr)\n\t\t}\n\t\tuser.Wallet = &wallet\n\t}\n\n\treturn &user, nil\n}", "title": "" }, { "docid": "7395fed13f789c701aa2ba989eceb12a", "score": "0.7215879", "text": "func (gs *GormStorage) GetUserByID(userID string) (models.User, error) {\n\tuser := models.User{}\n\n\t// SELECT * FROM users WHERE ID = $userID and join roles and user_mailgroups tables\n\terr := gs.db.Preload(\"Roles\").Preload(\"MailGroups\").First(&user, \"id = ?\", userID).Error\n\tif err != nil {\n\t\treturn user, errors.Wrap(err, fmt.Sprintf(\"get user(id: %s) error\", userID))\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "112ae5ca81eeeb1faed93a780f978b5d", "score": "0.72148305", "text": "func (s userStore) Get(id string) (model.User, error) {\n\n\tuser := model.User{}\n\n\tdocID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn user, err\n\t}\n\n\tif err := s.db.Collection(\"users\").FindOne(s.ctx, bson.M{\"_id\": docID}).Decode(&user); err != nil {\n\t\treturn user, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "a2d50861b82fb53634736b500a02e9bf", "score": "0.72066665", "text": "func (uc UserController) GetUserById(w http.ResponseWriter, r *http.Request) {\n\tsplitPath := strings.Split(r.URL.Path, \"/\")\n\tid := splitPath[len(splitPath)-1]\n\n\toid, err := primitive.ObjectIDFromHex(id)\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tu := models.User{}\n\tfilters := bson.M{\"_id\": oid}\n\n\terr = FindOne(uc.client.Database(\"InstagramCloneAPI\").Collection(\"users\"), filters).Decode(&u)\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tuj, err := json.Marshal(u)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(uj)\n}", "title": "" }, { "docid": "8283bea3dad3c966750d02e244aedbc3", "score": "0.72014177", "text": "func GetUserByID(ctx *fiber.Ctx) error {\n\t//ドキュメントIDを渡す必要がある\n\tdocID := ctx.Params(\"id\")\n\tif docID == \"\" {\n\t\treturn ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{\n\t\t\t\"success\": false,\n\t\t\t\"message\": \"No Document ID\",\n\t\t})\n\t}\n\tuser := repositories.FindUserByID(ctx, docID)\n\treturn ctx.Status(fiber.StatusOK).JSON(fiber.Map{\n\t\t\"success\": \"Got user by ID\",\n\t\t\"data\": fiber.Map{\n\t\t\t\"users\": user,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "ccbe4daa1d7923826828d127ecf540fc", "score": "0.72004795", "text": "func (s *service) GetUserByID(uid uint64) (*User, error) {\n\ts.log.Info(\"in pkg.user.service.GetUserByID\")\n\treturn s.repo.GetUserByID(uid)\n}", "title": "" }, { "docid": "06966f61e033968d6fa02b7b85f4164e", "score": "0.71995836", "text": "func (s *AuthService) GetUserById(id int) (*st.UserInfo, error) {\n\tu, err := s.UserDao.Get(id)\n\tif err != nil {\n\t\treturn nil, st.AuthError{Msg: err.Error(), Status: 500}\n\t}\n\tif u == nil {\n\t\treturn nil, nil\n\t}\n\treturn &st.UserInfo{ID: u.ID, Username: u.Username, FirstName: u.FirstName, LastName: u.LastName, Email: u.Email}, nil\n}", "title": "" }, { "docid": "5888345ee691f409628dc79555421a3c", "score": "0.7197233", "text": "func (m UserManager) ById(id int64) (*User, error) {\n\treturn m.store.UserByID(id)\n}", "title": "" }, { "docid": "aff69f61b951a642147d6cdda7151335", "score": "0.71824753", "text": "func GetUser(id int) (*models.User, error) {\n\tfor _, user := range Users {\n\t\tif user.ID == id {\n\t\t\treturn user, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"User (id: %v) not found\", id)\n}", "title": "" } ]
2837a13f214f0c302ccf52d8dffe3d6f
GetVersionPreferenceOrder returns the preferred ordering of versions for this api group
[ { "docid": "1e90908c4a3e5ad4ca1ca5b20ecf1fc2", "score": "0.81551504", "text": "func (g *APIGroupBuilder) GetVersionPreferenceOrder() []string {\n\torder := []string{}\n\tfor _, v := range g.Versions {\n\t\torder = append(order, v.GroupVersion.Version)\n\t}\n\treturn order\n}", "title": "" } ]
[ { "docid": "fe8b483af033e052d4b76f64d3c3dfd1", "score": "0.54828197", "text": "func (k Kind) Order() int {\n\tswitch k {\n\tcase KindNamespace:\n\t\treturn 1\n\tcase KindServiceAccount:\n\t\treturn 2\n\tcase KindPodSecurityPolicy:\n\t\treturn 3\n\tcase KindNetworkPolicy:\n\t\treturn 4\n\tcase KindClusterRole:\n\t\treturn 5\n\tcase KindRole:\n\t\treturn 6\n\tcase KindClusterRoleBinding:\n\t\treturn 7\n\tcase KindRoleBinding:\n\t\treturn 8\n\tcase KindConfigMap:\n\t\treturn 9\n\tcase KindDeployment:\n\t\treturn 10\n\tcase KindDaemonSet:\n\t\treturn 11\n\tcase KindCronJob:\n\t\treturn 12\n\tcase KindService:\n\t\treturn 13\n\tcase KindPodDisruptionBudget:\n\t\treturn 14\n\t}\n\tpanic(\"unknown kind: \" + string(k))\n}", "title": "" }, { "docid": "4b0fd4ba20de3eb2b54e344f9dc207df", "score": "0.4992967", "text": "func (o DiscoveryModesList) DefaultOrder() []string {\n\n\treturn []string{}\n}", "title": "" }, { "docid": "33aed92fa2f465887d9a4c4a48d30b6f", "score": "0.4979189", "text": "func (o *DiscoveryMode) DefaultOrder() []string {\n\n\treturn []string{}\n}", "title": "" }, { "docid": "56a5ba7635f5991a906d8098fcba0b11", "score": "0.48875436", "text": "func GetListPackageGroupsSortOrderEnumStringValues() []string {\n\treturn []string{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "891607e2192e8eb01049e10f9fc50255", "score": "0.4868518", "text": "func GetListCertificateAuthorityBundleVersionsSortOrderEnumStringValues() []string {\n\treturn []string{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "6663885ab82c0664b3da001871d7636c", "score": "0.47691604", "text": "func (o *PolicyGraph) DefaultOrder() []string {\n\n\treturn []string{}\n}", "title": "" }, { "docid": "21700743c291f0f4d56bf032d56dbd0f", "score": "0.47656384", "text": "func TestStrategyBestVersion(t *testing.T) {\n\tm := makeManifest([]string{\"1.12\", \"1.13\"})\n\ta := App{\n\t\tConf: Config{},\n\t\tpackageManifestCache: map[string]*PackageManifest{\n\t\t\t\"9998.0.0\": m,\n\t\t},\n\t\tCurrentOSVersion: \"9998.0.0\",\n\t}\n\tpv, osv, err := a.PickVersion(\"docker\", []string{\"17.03\", \"1.13\", \"1.12\"})\n\tassert.Nil(t, err)\n\tassert.Equal(t, pv, \"1.13\")\n\tassert.Equal(t, []string{\"9998.0.0\"}, osv, \"os versions\")\n}", "title": "" }, { "docid": "ca9ea88621e00e8f456306d862664863", "score": "0.47575286", "text": "func SuggestedApiVersion(gvk schema.GroupVersionKind) string {\n\tswitch gvk.GroupVersion() {\n\tcase schema.GroupVersion{Group: \"apps\", Version: \"v1beta1\"},\n\t\tschema.GroupVersion{Group: \"apps\", Version: \"v1beta2\"}:\n\t\treturn \"apps/v1/\" + gvk.Kind\n\tcase schema.GroupVersion{Group: \"extensions\", Version: \"v1beta1\"}:\n\t\tswitch Kind(gvk.Kind) {\n\t\tcase DaemonSet, Deployment, NetworkPolicy, ReplicaSet:\n\t\t\treturn \"apps/v1/\" + gvk.Kind\n\t\tcase Ingress:\n\t\t\treturn \"networking/v1beta1/\" + gvk.Kind\n\t\tcase PodSecurityPolicy:\n\t\t\treturn \"policy/v1beta1/\" + gvk.Kind\n\t\tdefault:\n\t\t\treturn gvkStr(gvk)\n\t\t}\n\tdefault:\n\t\treturn gvkStr(gvk)\n\t}\n\n}", "title": "" }, { "docid": "a4b68d3318a0aac1c35be6c094e9a731", "score": "0.4750799", "text": "func (h *GlobalHook) Order(binding BindingType) float64 {\n\tif h.Config.HasBinding(binding) {\n\t\tswitch binding {\n\t\tcase BeforeAll:\n\t\t\treturn h.Config.BeforeAll.Order\n\t\tcase AfterAll:\n\t\t\treturn h.Config.AfterAll.Order\n\t\tcase OnStartup:\n\t\t\treturn h.Config.OnStartup.Order\n\t\t}\n\t}\n\treturn 0.0\n}", "title": "" }, { "docid": "a5a3ea91c5114e86c938bc1023435fa7", "score": "0.4749318", "text": "func (i *InputDefinition) OptionsOrder() []string {\n\treturn i.optionKeysOrdered\n}", "title": "" }, { "docid": "1da964672458c4b9d1a98bfe340d678b", "score": "0.46644136", "text": "func (o StatefulSetListTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StatefulSetListType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "76125d6a58badd157b6a96d761b98c26", "score": "0.4647046", "text": "func (s *MessagesSendMultiMediaRequest) GetUpdateStickersetsOrder() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Flags.Has(15)\n}", "title": "" }, { "docid": "4997677aaea53144c58d76957ad7ead6", "score": "0.4643454", "text": "func (s *KeyExchangeService) GetPriorities(roomID string) ([]model.KeyVersion, error) {\n\tvar kvs []model.KeyVersion\n\terr := s.col.Find(model.KeyVersionFilter{RoomID: bson.ObjectIdHex(roomID)}).All(&kvs)\n\treturn kvs, err\n}", "title": "" }, { "docid": "b653b71b3584717a95681416c6af9091", "score": "0.46346086", "text": "func GetListCertificateAuthorityBundleVersionsSortByEnumStringValues() []string {\n\treturn []string{\n\t\t\"VERSION_NUMBER\",\n\t}\n}", "title": "" }, { "docid": "f3481242fe32a7d3ed814f77a9c70fd4", "score": "0.4633971", "text": "func (o PolicyGraphsList) DefaultOrder() []string {\n\n\treturn []string{}\n}", "title": "" }, { "docid": "0a1973a480e3081fca820f4dd3d13a5f", "score": "0.4629236", "text": "func (o SparseDiscoveryModesList) DefaultOrder() []string {\n\n\treturn []string{}\n}", "title": "" }, { "docid": "f4429af23a19428894d603df48eac045", "score": "0.46030012", "text": "func (o DaemonSetListTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DaemonSetListType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a8bc4215d36ea879c28b545c0ed03ff3", "score": "0.45820984", "text": "func (o PodSchedulingContextListOutput) ApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PodSchedulingContextList) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2a90982154bf7e3135eaca0ba34dafa2", "score": "0.45712885", "text": "func (SslPolicy_MinTlsVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{462, 0}\n}", "title": "" }, { "docid": "df332ea18595282f1b6fbdf1706e8fab", "score": "0.45633364", "text": "func DependencyOrder(disco ServerResourcesSwaggerSchema, list []*unstructured.Unstructured) (sort.Interface, error) {\n\tsortKeys := make([]int, len(list))\n\tfor i, item := range list {\n\t\tvar err error\n\t\tsortKeys[i], err = depTier(disco, item.GetObjectKind())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tlog.Debugf(\"sortKeys is %v\", sortKeys)\n\treturn &mappedSort{sortKeys: sortKeys, items: list}, nil\n}", "title": "" }, { "docid": "97a96e5edaa4038616aca5d56bc424f0", "score": "0.45549688", "text": "func (o DiscoveryModesList) Version() int {\n\n\treturn 1\n}", "title": "" }, { "docid": "d0e85b622b5a1dfaeda23c406c1ffe3d", "score": "0.45530948", "text": "func (LocationPolicyLocation_Preference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{268, 0}\n}", "title": "" }, { "docid": "fafa899636a967de6df05a54a1571236", "score": "0.4549005", "text": "func (o ReplicaSetListTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReplicaSetListType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8d47b350b2815de25c06244ce7bedea2", "score": "0.4545416", "text": "func (GetModelVersionsRequest_SortBy) EnumDescriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_model_proto_rawDescGZIP(), []int{20, 0}\n}", "title": "" }, { "docid": "28912c9fb0efc7c163c77acf83ad6ff1", "score": "0.45399618", "text": "func (o StatefulSetTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StatefulSetType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9a499edbb05c89e0a40bea6095d00b91", "score": "0.4536682", "text": "func (o SparsePolicyGraphsList) DefaultOrder() []string {\n\n\treturn []string{}\n}", "title": "" }, { "docid": "86f0028c61573279d9049d7293588867", "score": "0.45295158", "text": "func (o PodPresetListOutput) ApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PodPresetList) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "69341faa8e558e6792b13e8a41577e88", "score": "0.45164397", "text": "func (o PersistentVolumeClaimListOutput) ApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PersistentVolumeClaimList) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c54552c4e9acaeb97c2c71b9a39f11e5", "score": "0.45137763", "text": "func (o *InstalledApp) DefaultOrder() []string {\n\n\treturn []string{\n\t\t\"name\",\n\t}\n}", "title": "" }, { "docid": "9e19cf3924a626ec9af3532938826049", "score": "0.44962007", "text": "func (RequestDocumentsOrderMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_grpc_proto_v1_document_document_proto_rawDescGZIP(), []int{3, 1}\n}", "title": "" }, { "docid": "41a48cbd47a9fa8d2e281a6deb973b24", "score": "0.4493211", "text": "func (o ReplicaSetTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReplicaSetType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8306889c9ecb283b7f279dc3200af4e7", "score": "0.44930607", "text": "func (p *PackageManager) UpdateVersionOrder(pack Package) (err error) {\n\n\t// if not saved in database return\n\tif p.DB.NewRecord(pack) {\n\t\treturn ErrPackageNotFound\n\t}\n\n\to := versionOrder{}\n\n\tversions := []PackageVersion{}\n\n\tif err = p.DB.Find(&versions, \"package_id = ?\", pack.ID).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\terr = nil\n\t\t} else {\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar (\n\t\terrSemver error\n\t\tsv semver.Version\n\t)\n\n\tfor _, version := range versions {\n\t\tif sv, errSemver = semver.Make(version.Version); errSemver != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\to = append(o, orderItem{\n\t\t\tID: version.ID,\n\t\t\tSemver: sv,\n\t\t})\n\t}\n\n\t// sort them by semver\n\tsort.Sort(o)\n\n\t// update\n\tp.DB.Model(PackageVersion{}).Where(\"package_id = ?\", pack.ID).Update(\"version_order\", 0)\n\n\tfor index, oi := range o {\n\t\tp.DB.Model(PackageVersion{}).Where(\"id = ?\", oi.ID).Update(\"version_order\", index+1)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d5e8db692fc06bd8091b6ff098f06fd4", "score": "0.44814703", "text": "func (o KogitoDataIndexSpecEnvsValueFromFieldRefPtrOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KogitoDataIndexSpecEnvsValueFromFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ApiVersion\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8f1f106a3a19226eeefbd578437b3316", "score": "0.4468154", "text": "func (o KogitoMgmtConsoleSpecEnvsValueFromFieldRefPtrOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KogitoMgmtConsoleSpecEnvsValueFromFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ApiVersion\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fdb078e3f0c72f2585869ecfc4ace73a", "score": "0.44639894", "text": "func dataKindPriority(kind ld.VersionedDataKind) int {\n\tswitch kind {\n\tcase ld.Segments:\n\t\treturn 0\n\tcase ld.Features:\n\t\treturn 1\n\tdefault:\n\t\treturn len(kind.GetNamespace()) + 2\n\t}\n}", "title": "" }, { "docid": "2e06fb19d7dee4ced95d8c40d6734cdd", "score": "0.44439724", "text": "func Versions() []string { return getVersions() }", "title": "" }, { "docid": "d2e0591e684bfc1a15b8928c49331a55", "score": "0.44354466", "text": "func (c *Client) GetChoicesVersion(ctx context.Context) (version string, err error) {\n\tvb, err := c.prot.Get(ctx, choicesPrefix+versionKey)\n\tversion = string(vb)\n\tif err != nil {\n\t\terr = GetChoicesVersionError{Err: err}\n\t}\n\treturn\n}", "title": "" }, { "docid": "cc0ea194499665dafb4a968c95bc7a67", "score": "0.44338536", "text": "func (o DaemonSetTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DaemonSetType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e142e276bde8ecb51ae13f8a9c476aeb", "score": "0.44234976", "text": "func (*AppengineState_Service_Version) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_deploy_api_modelpb_asset_proto_rawDescGZIP(), []int{4, 0, 0}\n}", "title": "" }, { "docid": "4f4b2cd239b2107bc0cd73ab0366c4c8", "score": "0.4418842", "text": "func (o KogitoRuntimeSpecEnvsValueFromFieldRefPtrOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KogitoRuntimeSpecEnvsValueFromFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ApiVersion\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0b0a8e1312902b72c77a946416eb9462", "score": "0.44141194", "text": "func (o PolicyGraphsList) Version() int {\n\n\treturn 1\n}", "title": "" }, { "docid": "93ebc85a84ed938c6f0dfc07ca76ae7b", "score": "0.44133297", "text": "func (o KogitoTrustySpecEnvsValueFromFieldRefPtrOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KogitoTrustySpecEnvsValueFromFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ApiVersion\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4afa061d5845a136e5e05fd486e2cda4", "score": "0.44115415", "text": "func (m *AdminConsentRequestPolicy) GetVersion()(*int32) {\n return m.version\n}", "title": "" }, { "docid": "4f84df1f77c7ce5c05440af037d4ad31", "score": "0.44026297", "text": "func (o InstalledAppsList) DefaultOrder() []string {\n\n\treturn []string{\n\t\t\"name\",\n\t}\n}", "title": "" }, { "docid": "dcee935c81619cd79cf962458d0d152f", "score": "0.439349", "text": "func (o KogitoJobsServiceSpecEnvsValueFromFieldRefPtrOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KogitoJobsServiceSpecEnvsValueFromFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ApiVersion\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f41c8d5bfed3fdbf737c23fa34b1347b", "score": "0.4392767", "text": "func (*ListGroupsRequest) Version() int16 {\n\treturn 0\n}", "title": "" }, { "docid": "c8f60d7dc9217a36ff371cbdb325aa99", "score": "0.43903437", "text": "func (*ListInstanceOSPoliciesCompliancesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_osconfig_v1alpha_instance_os_policies_compliance_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "7fce9c9284b6f3b7f0f1a446a586873a", "score": "0.43896377", "text": "func (version *MigrateVersion) SortVersions(direction string, names []string) []string {\n\tif len(names) == 0 {\n\t\treturn nil\n\t}\n\tvar versions []string\n\tfor i, v := range names {\n\t\tindex := strings.Index(v, \"_\")\n\t\tif index < 0 {\n\t\t\tcontinue\n\t\t}\n\t\tversions = append(versions, names[i])\n\t}\n\tswitch direction {\n\tcase \"asc\":\n\t\tsort.Slice(versions, func(i, j int) bool {\n\t\t\treturn versions[i] < versions[j]\n\t\t})\n\t\treturn versions\n\tcase \"desc\":\n\t\tsort.Slice(versions, func(i, j int) bool {\n\t\t\treturn versions[i] > versions[j]\n\t\t})\n\t\treturn versions\n\tdefault:\n\t\treturn versions\n\t}\n}", "title": "" }, { "docid": "c28e3f8516a4c7359dd273a9ab04a23c", "score": "0.4379645", "text": "func (rdm *resourceDiscoveryManager) calculateAPIGroupsLocked() []apidiscoveryv2beta1.APIGroupDiscovery {\n\t// Re-order the apiGroups by their priority.\n\tgroups := []apidiscoveryv2beta1.APIGroupDiscovery{}\n\tfor _, group := range rdm.apiGroups {\n\t\tcopied := *group.DeepCopy()\n\n\t\t// Re-order versions based on their priority. Use kube-aware string\n\t\t// comparison as a tie breaker\n\t\tsort.SliceStable(copied.Versions, func(i, j int) bool {\n\t\t\tiVersion := copied.Versions[i].Version\n\t\t\tjVersion := copied.Versions[j].Version\n\n\t\t\tiPriority := rdm.versionPriorities[metav1.GroupVersion{Group: group.Name, Version: iVersion}].VersionPriority\n\t\t\tjPriority := rdm.versionPriorities[metav1.GroupVersion{Group: group.Name, Version: jVersion}].VersionPriority\n\n\t\t\t// Sort by version string comparator if priority is equal\n\t\t\tif iPriority == jPriority {\n\t\t\t\treturn version.CompareKubeAwareVersionStrings(iVersion, jVersion) > 0\n\t\t\t}\n\n\t\t\t// i sorts before j if it has a higher priority\n\t\t\treturn iPriority > jPriority\n\t\t})\n\n\t\tgroups = append(groups, *copied.DeepCopy())\n\n\t}\n\n\t// For each group, determine the highest minimum group priority and use that\n\tpriorities := map[string]int{}\n\tfor gv, info := range rdm.versionPriorities {\n\t\tif existing, exists := priorities[gv.Group]; exists {\n\t\t\tif existing < info.GroupPriorityMinimum {\n\t\t\t\tpriorities[gv.Group] = info.GroupPriorityMinimum\n\t\t\t}\n\t\t} else {\n\t\t\tpriorities[gv.Group] = info.GroupPriorityMinimum\n\t\t}\n\t}\n\n\tsort.SliceStable(groups, func(i, j int) bool {\n\t\tiName := groups[i].Name\n\t\tjName := groups[j].Name\n\n\t\t// Default to 0 priority by default\n\t\tiPriority := priorities[iName]\n\t\tjPriority := priorities[jName]\n\n\t\t// Sort discovery based on apiservice priority.\n\t\t// Duplicated from staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/helpers.go\n\t\tif iPriority == jPriority {\n\t\t\t// Equal priority uses name to break ties\n\t\t\treturn iName < jName\n\t\t}\n\n\t\t// i sorts before j if it has a higher priority\n\t\treturn iPriority > jPriority\n\t})\n\n\treturn groups\n}", "title": "" }, { "docid": "d4dc7f74bb302f0e5c93127e5a26fc46", "score": "0.43789175", "text": "func (o *MultipleCollaboratorsFieldField) GetOrder() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Order\n}", "title": "" }, { "docid": "a37bb9afa84761b4babc15c1f13e0125", "score": "0.43722138", "text": "func (o SparseInstalledAppsList) DefaultOrder() []string {\n\n\treturn []string{\n\t\t\"name\",\n\t}\n}", "title": "" }, { "docid": "9d5fbf5c954ee9a323bcda7cd501d55a", "score": "0.43614894", "text": "func (Version_VersionNumber) EnumDescriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_common_policy_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "8d4863760f53a0c5aa4a8905358be11b", "score": "0.43540904", "text": "func (b *PBM) GetPriorities(k8sclient client.Client, cluster *api.PerconaServerMongoDB) (map[string]float64, error) {\n\tpriorities := make(map[string]float64)\n\n\tusersSecret := corev1.Secret{}\n\terr := k8sclient.Get(\n\t\tcontext.TODO(),\n\t\ttypes.NamespacedName{Name: cluster.Spec.Secrets.Users, Namespace: cluster.Namespace},\n\t\t&usersSecret,\n\t)\n\tif err != nil {\n\t\treturn priorities, errors.Wrap(err, \"get users secret\")\n\t}\n\n\tc := psmdb.Credentials{\n\t\tUsername: string(usersSecret.Data[\"MONGODB_BACKUP_USER\"]),\n\t\tPassword: string(usersSecret.Data[\"MONGODB_BACKUP_PASSWORD\"]),\n\t}\n\n\tfor _, rs := range cluster.Spec.Replsets {\n\t\t// PBM selects nodes with higher priority, so we're assigning 0.5 to\n\t\t// external nodes to run backups on nodes in the cluster.\n\t\tfor _, extNode := range rs.ExternalNodes {\n\t\t\tpriorities[extNode.HostPort()] = 0.5\n\t\t}\n\n\t\tcli, err := psmdb.MongoClient(k8sclient, cluster, *rs, c)\n\t\tif err != nil {\n\t\t\treturn priorities, errors.Wrap(err, \"get mongo client\")\n\t\t}\n\n\t\t// If you explicitly set a subset of the replset nodes in the config,\n\t\t// the remaining nodes will be automatically assigned priority 1.0,\n\t\t// including the primary. That's why, we need to get primary nodes and\n\t\t// set them in the config.\n\t\tprimary, err := psmdb.GetPrimaryPod(cli)\n\t\tif err != nil {\n\t\t\treturn priorities, errors.Wrap(err, \"get primary pod\")\n\t\t}\n\t\tpriorities[primary] = 0.5\n\t}\n\n\treturn priorities, nil\n}", "title": "" }, { "docid": "454fb3f536028066fce29220ec5ec6b9", "score": "0.43534538", "text": "func (p *Set) Order() {\n\tvar primes []uint64\n\tfor idx := range p.set {\n\t\tif idx == 0 || idx == 1 {\n\t\t\tcontinue\n\t\t}\n\t\tif !p.set[idx] {\n\t\t\tprimes = append(primes, uint64(idx))\n\t\t}\n\t}\n\tp.primes = primes\n}", "title": "" }, { "docid": "7c6212e0e771733f305e32a63c93e56e", "score": "0.43466747", "text": "func (o StorageClassListOutput) ApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StorageClassList) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ce68e57688435be222d60f64912ad4c8", "score": "0.43405077", "text": "func CompareVersion(a, b string) int {\n\tif a[0] == 'v' {\n\t\ta = a[1:]\n\t}\n\tif b[0] == 'v' {\n\t\tb = b[1:]\n\t}\n\tarray1 := strings.Split(a, \".\")\n\tarray2 := strings.Split(b, \".\")\n\tfor i := 0; i < len(array2)-len(array1); i++ {\n\t\tarray1 = append(array1, \"\")\n\t}\n\tfor i := 0; i < len(array1)-len(array2); i++ {\n\t\tarray2 = append(array2, \"\")\n\t}\n\tv1 := 0\n\tv2 := 0\n\tfor i := 0; i < len(array1); i++ {\n\t\tv1 = gconv.Int(array1[i])\n\t\tv2 = gconv.Int(array2[i])\n\t\tif v1 > v2 {\n\t\t\treturn 1\n\t\t}\n\t\tif v1 < v2 {\n\t\t\treturn -1\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "c512717484639a3eb9677b4557e84ca1", "score": "0.4338288", "text": "func (o PodSchedulingContextOutput) ApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PodSchedulingContext) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "50a8105fa5ebd26705f5df5d9d2036d3", "score": "0.43356833", "text": "func GetListGovernanceInstancesSortOrderEnumStringValues() []string {\n\treturn []string{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "26edc6f68e78cd48bbcff6670e07729b", "score": "0.43349448", "text": "func (a *PreferencesApiService) ListPreference(ctx _context.Context) ApiListPreferenceRequest {\n\treturn ApiListPreferenceRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "5216ff966942ecc27086e92e85aadd35", "score": "0.43326697", "text": "func (*ListAvailableVersionsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datafusion_v1_datafusion_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "757a52c665829aa54bd36d9592eabf5d", "score": "0.432321", "text": "func (g *al_basic_mut) Order() int {\n\tg.mu.RLock()\n\tdefer g.mu.RUnlock()\n\n\treturn len(g.list)\n}", "title": "" }, { "docid": "c48aefdcfbdaa4fbe0b1178724218903", "score": "0.432039", "text": "func (Version_VersionKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_grafeas_v1_package_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "e7a72f34a9e9555081f74d6b882f025b", "score": "0.4315075", "text": "func (RequestDocumentsOrderBy) EnumDescriptor() ([]byte, []int) {\n\treturn file_grpc_proto_v1_document_document_proto_rawDescGZIP(), []int{3, 0}\n}", "title": "" }, { "docid": "8141506d8740d29d95d7994c973af267", "score": "0.42986417", "text": "func parseGroupVersions() (map[string][]string, error) {\n\tgvs := make(map[string][]string)\n\tgroups, err := ioutil.ReadDir(scaffold.ApisDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read pkg/apis directory to find api Versions: %v\", err)\n\t}\n\n\tfor _, g := range groups {\n\t\tif g.IsDir() {\n\t\t\tgroupDir := filepath.Join(scaffold.ApisDir, g.Name())\n\t\t\tversions, err := ioutil.ReadDir(groupDir)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"could not read %s directory to find api Versions: %v\", groupDir, err)\n\t\t\t}\n\n\t\t\tgvs[g.Name()] = make([]string, 0)\n\t\t\tfor _, v := range versions {\n\t\t\t\tif v.IsDir() && scaffold.ResourceVersionRegexp.MatchString(v.Name()) {\n\t\t\t\t\tgvs[g.Name()] = append(gvs[g.Name()], v.Name())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(gvs) == 0 {\n\t\treturn nil, fmt.Errorf(\"no groups or versions found in %s\", scaffold.ApisDir)\n\t}\n\treturn gvs, nil\n}", "title": "" }, { "docid": "efb5e86ef6094092b98aaf69dcda3af5", "score": "0.42966706", "text": "func (o KogitoBuildSpecEnvsValueFromFieldRefPtrOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KogitoBuildSpecEnvsValueFromFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ApiVersion\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b09e0f47853c7cf4f5338d4a5061baf6", "score": "0.42950153", "text": "func (r ApiK8sVersionsGetRequest) OrderBy(orderBy string) ApiK8sVersionsGetRequest {\n\tr.orderBy = &orderBy\n\treturn r\n}", "title": "" }, { "docid": "669f308cd8658b8245c7e58f66757458", "score": "0.42881972", "text": "func (o ControllerRevisionListTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ControllerRevisionListType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0f8c63e95a8a47e8d7c2d679822881da", "score": "0.42854628", "text": "func (r *Replica) UpdatePreferredPeerOrder(quorum []int32) {\n\taux := make([]int32, r.N)\n\ti := 0\n\tfor _, p := range quorum {\n\t\tif p == r.Id {\n\t\t\tcontinue\n\t\t}\n\t\taux[i] = p\n\t\ti++\n\t}\n\n\tfor _, p := range r.PreferredPeerOrder {\n\t\tfound := false\n\t\tfor j := 0; j < i; j++ {\n\t\t\tif aux[j] == p {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\taux[i] = p\n\t\t\ti++\n\t\t}\n\t}\n\n\tr.PreferredPeerOrder = aux\n}", "title": "" }, { "docid": "183bc94e3c2282278c8d952320ae777f", "score": "0.42831987", "text": "func (r *Record) getKeyOrdering() []string {\n\tout := make([]string, len(r.fields))\n\ti := 0\n\tfor k, _ := range r.fields {\n\t\tout[i] = k\n\t\ti++\n\t}\n\treturn out\n}", "title": "" }, { "docid": "5411f7f4e9334ade0b0eefe313e41e97", "score": "0.42831257", "text": "func (group NamespacesEventhubsConsumerGroup) GetAPIVersion() string {\n\treturn string(APIVersion_Value)\n}", "title": "" }, { "docid": "516df684d9963f41128c99bf6b8a0650", "score": "0.4282253", "text": "func (o EventListOutput) ApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EventList) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5c6a1705ed00ebb7163fa9243f40a94e", "score": "0.42791975", "text": "func (OrderBy) EnumDescriptor() ([]byte, []int) {\n\treturn file_productManager_v1_productManager_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "2afdc54d883f601463aeea0db40ff848", "score": "0.42759717", "text": "func CompareVersions(a *Version, b *Version) int {\n\tfor i := 0; i < 100; i++ {\n\t\tif i >= len(a.Parts) {\n\t\t\tif i >= len(b.Parts) {\n\t\t\t\treturn 0\n\t\t\t} else {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t}\n\t\tif i > len(b.Parts) {\n\t\t\treturn 1\n\t\t}\n\t\tif a.Parts[i] > b.Parts[i] {\n\t\t\treturn 1\n\t\t} else if a.Parts[i] < b.Parts[i] {\n\t\t\treturn -1\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "246337d3a6e484f2068012d40d837f96", "score": "0.42661425", "text": "func (*GetModelVersionsResponse) Descriptor() ([]byte, []int) {\n\treturn file_determined_api_v1_model_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "20460cc6ef0b2cde8d6affcfe25e8a26", "score": "0.4262668", "text": "func (m *MeetingTimeSuggestion) GetOrder()(*int32) {\n val, err := m.GetBackingStore().Get(\"order\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "196d87ee4c77e404ac7b987b520d110c", "score": "0.4257814", "text": "func (VirtualGatewaySpec_ConnectionHandler_TcpRoutes_TcpHost_SslConfig_SslParameters_ProtocolVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_mesh_api_enterprise_networking_v1beta1_virtual_gateway_proto_rawDescGZIP(), []int{0, 1, 3, 0, 0, 1, 0}\n}", "title": "" }, { "docid": "697b96e92ad00be1e335abfc67d8bb3d", "score": "0.42549846", "text": "func (o KogitoMgmtConsoleSpecEnvsValueFromFieldRefOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KogitoMgmtConsoleSpecEnvsValueFromFieldRef) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f6f4b1dc5728155a3c7ed3c5bdfb3ea7", "score": "0.42536247", "text": "func (ProxyProtocolConfig_Version) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_proxy_protocol_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "239fe69c4d4de35ec9232afb28b9115b", "score": "0.4251611", "text": "func (*ResponseCountOrders) Descriptor() ([]byte, []int) {\n\treturn file_booking_proto_rawDescGZIP(), []int{66}\n}", "title": "" }, { "docid": "8c52b33b5a4a472e670433aba3c8494e", "score": "0.4247526", "text": "func GetPriorities(ctx context.Context, k8sclient client.Client, cluster *api.PerconaServerMongoDB) (map[string]float64, error) {\n\tpriorities := make(map[string]float64)\n\n\tusersSecret := corev1.Secret{}\n\terr := k8sclient.Get(\n\t\tctx,\n\t\ttypes.NamespacedName{Name: cluster.Spec.Secrets.Users, Namespace: cluster.Namespace},\n\t\t&usersSecret,\n\t)\n\tif err != nil {\n\t\treturn priorities, errors.Wrap(err, \"get users secret\")\n\t}\n\n\tc := psmdb.Credentials{\n\t\tUsername: string(usersSecret.Data[\"MONGODB_BACKUP_USER\"]),\n\t\tPassword: string(usersSecret.Data[\"MONGODB_BACKUP_PASSWORD\"]),\n\t}\n\n\tfor _, rs := range cluster.Spec.Replsets {\n\t\t// PBM selects nodes with higher priority, so we're assigning 0.5 to\n\t\t// external nodes to run backups on nodes in the cluster.\n\t\tfor _, extNode := range rs.ExternalNodes {\n\t\t\tpriorities[extNode.HostPort()] = 0.5\n\t\t}\n\n\t\tcli, err := psmdb.MongoClient(ctx, k8sclient, cluster, *rs, c)\n\t\tif err != nil {\n\t\t\treturn priorities, errors.Wrap(err, \"get mongo client\")\n\t\t}\n\n\t\t// If you explicitly set a subset of the replset nodes in the config,\n\t\t// the remaining nodes will be automatically assigned priority 1.0,\n\t\t// including the primary. That's why, we need to get primary nodes and\n\t\t// set them in the config.\n\t\tprimary, err := psmdb.GetPrimaryPod(ctx, cli)\n\t\tif err != nil {\n\t\t\treturn priorities, errors.Wrap(err, \"get primary pod\")\n\t\t}\n\t\tpriorities[primary] = 0.5\n\t}\n\n\treturn priorities, nil\n}", "title": "" }, { "docid": "af3af4e15912bb9c22c9cf6fb7e68451", "score": "0.42398468", "text": "func (NodeGroupAutoscalingPolicy_Mode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{307, 0}\n}", "title": "" }, { "docid": "77d67b0f12b552adc5c88144eb7a1551", "score": "0.42342204", "text": "func (o KogitoDataIndexSpecEnvsValueFromFieldRefOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KogitoDataIndexSpecEnvsValueFromFieldRef) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c6b3ea6952a51f41439f692f2792af6e", "score": "0.42329946", "text": "func (o FlowSourceFlowConfigOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfig) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3006dd4321d70c048671437fa1cd56da", "score": "0.4231397", "text": "func (DeployPolicy_Strategy) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_instancegroup_instance_group_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "52c8a6004dde17997b4ba407a1ab7477", "score": "0.422847", "text": "func (RequestModifyOrder_OrderPlacement) EnumDescriptor() ([]byte, []int) {\n\treturn file_request_modify_order_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "46770e39704efe7ddc1e91abae5c7181", "score": "0.4216964", "text": "func (o AuditSinkListTypeOutput) ApiVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AuditSinkListType) *string { return v.ApiVersion }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dc04fd030075ad6815588f3c816e4fff", "score": "0.4214758", "text": "func (rules *SimpleAuthorizeOperationRules) Order() []string {\n\trules.safe()\n\trules.safe()\n\treturn rules.order\n}", "title": "" }, { "docid": "6c9d63e3ad4b25d29ba347a83fc3ba58", "score": "0.42142332", "text": "func (*RegionalParametersVersionValue) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_v3_enums_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "de98c00a875c88e649ffaf917d389856", "score": "0.4210391", "text": "func (mock *FeatureControllerMock) GroupVersionKindCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockFeatureControllerMockGroupVersionKind.RLock()\n\tcalls = mock.calls.GroupVersionKind\n\tlockFeatureControllerMockGroupVersionKind.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e30a49b09ba6fc817e88acc8926e1ef5", "score": "0.42048883", "text": "func GetMappingListPackageGroupsSortOrderEnum(val string) (ListPackageGroupsSortOrderEnum, bool) {\n\tenum, ok := mappingListPackageGroupsSortOrderEnumLowerCase[strings.ToLower(val)]\n\treturn enum, ok\n}", "title": "" }, { "docid": "2bb30b5b32610c94a380fb9e8ee3b232", "score": "0.42047146", "text": "func (IpVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_instancegroup_instance_group_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e5bd53e679ad5bd7a6e87fa8bc468329", "score": "0.41963184", "text": "func (*ListInstanceOSPoliciesCompliancesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_osconfig_v1alpha_instance_os_policies_compliance_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "7469efa8adf60cbd185ceffb0da51f13", "score": "0.41919866", "text": "func (o *PolicyGraph) Version() int {\n\n\treturn 1\n}", "title": "" }, { "docid": "4d1280833cf564f38a53c7257122f673", "score": "0.4188862", "text": "func GetListAddonsSortOrderEnumStringValues() []string {\n\treturn []string{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "836d8c78b65521d74d2b2c2efa011d5f", "score": "0.4186405", "text": "func (pdrq *PingDetectorResultQuery) Order(o ...pingdetectorresult.OrderOption) *PingDetectorResultQuery {\n\tpdrq.order = append(pdrq.order, o...)\n\treturn pdrq\n}", "title": "" }, { "docid": "8376225ae8e17d40dd1bf8cd6eea558a", "score": "0.41844952", "text": "func (*ListAvailableVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datafusion_v1_datafusion_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "8282ea87d3f12e4c3c273220d05ad06c", "score": "0.41842675", "text": "func compareVersions(v1, v2 string) int {\n\tsep := func(r rune) bool {\n\t\treturn r == '.' || r == '_' || r == '+'\n\t}\n\ts1 := strings.FieldsFunc(v1, sep)\n\ts2 := strings.FieldsFunc(v2, sep)\n\tm, n := len(s1), len(s2)\n\tz := min(m, n)\n\n\tfor i := 0; i < z; i++ {\n\t\tc := comparePart(s1[i], s2[i])\n\t\tif c != 0 {\n\t\t\treturn c\n\t\t}\n\t}\n\n\treturn intcmp(m, n)\n}", "title": "" }, { "docid": "e931c61a92ecf27c51a123dec187606b", "score": "0.4183179", "text": "func sortVersionList() {\n\tsort.Slice(VersionList, func(i, j int) bool {\n\t\treturn VersionList[i].Version < VersionList[j].Version\n\t})\n\n\tvar j int\n\tfor i, fdata := range VersionList {\n\t\tif i+1 != fdata.Version {\n\t\t\tFirstMismatch = i\n\t\t\tfmt.Println(GREEN_COL+\"After sorting ... First Mismatch: %d\"+ERR_END, FirstMismatch)\n\t\t\treturn\n\t\t}\n\t\tj++\n\t}\n\n\tFirstMismatch = j\n\tfmt.Println(GREEN_COL+\"After sorting ... First Mismatch: %d\"+ERR_END, FirstMismatch)\n}", "title": "" }, { "docid": "04fdfe6b2b2b2de0d10ad7757156beee", "score": "0.41809562", "text": "func (*ListWalletGroupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_global_api_proto_rawDescGZIP(), []int{38}\n}", "title": "" }, { "docid": "116fe1edbf6d9bd6caeb97ad449c245e", "score": "0.41783613", "text": "func (r ApiK8sVersionsDefaultGetRequest) OrderBy(orderBy string) ApiK8sVersionsDefaultGetRequest {\n\tr.orderBy = &orderBy\n\treturn r\n}", "title": "" } ]
d05df092d2791818e815f36f58ae2226
QueryTime gets the latest timestamp for a specific provider
[ { "docid": "df3bb030bd73c3aebbb5846b497a33ff", "score": "0.7666453", "text": "func QueryTime(dbName string, netProvider string, provider string) time.Time {\n\tDB := connectDb(dbName)\n\tdefer DB.Close()\n\tvar p Row\n\terr := DB.QueryRowx(querySQL, netProvider, provider).StructScan(&p)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn time.Time{}\n\t\t}\n\t\tlog.Fatalf(\"Error finding the timestamp for %q -> %q\\n\", netProvider, provider)\n\t}\n\treturn p.Timestamp\n}", "title": "" } ]
[ { "docid": "8e18cf54f25766c5ecc63e6d905a6943", "score": "0.6164949", "text": "func (is *InfluxStorage) LastTimePoint(providerName, tokenID, currencyID string) (time.Time, error) {\n\tmeasurementName := fmt.Sprintf(\"%s_%s\", common.GetTokenSymbolFromProviderNameTokenID(providerName, tokenID), currencyID)\n\tstmt := fmt.Sprintf(`SELECT LAST(\"%s\") FROM \"%s\"`,\n\t\tschema.Rate.String(),\n\t\tmeasurementName,\n\t)\n\tres, err := influxdb.QueryDB(is.influxClient, stmt, is.dbName)\n\tif err != nil {\n\t\treturn time.Time{}, nil\n\t}\n\tif len(res) == 0 || len(res[0].Series) == 0 || len(res[0].Series[0].Values[0]) == 0 {\n\t\tis.sugar.Infow(\"no result returned for last record query\", \"res\", res)\n\t\treturn time.Time{}, nil\n\t}\n\tidxs, err := schema.NewFieldsRegistrar(res[0].Series[0].Columns)\n\tif err != nil {\n\t\treturn time.Time{}, nil\n\t}\n\treturn influxdb.GetTimeFromInterface(res[0].Series[0].Values[0][idxs[schema.Time]])\n}", "title": "" }, { "docid": "b81a688ed0c6db4fb00413c33893fa48", "score": "0.56018233", "text": "func (m *ServiceNowConnection) GetLastQueriedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastQueriedDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "e744489008295764fe5b1b376d1b484c", "score": "0.5593681", "text": "func QueryPerProvider(start, end time.Time, providers []string, db *sql.DB) {\n kWh := 0.0\n var out []string\n out = append(out, end.Format(\"2006-01-02\"))\n for _, provider := range providers {\n var p_kWh float64\n var p_cost float64\n err := db.QueryRow(providerSummary,\n provider, start.Format(time.RFC3339),\n end.Format(time.RFC3339)).Scan(&p_kWh, &p_cost)\n if err != nil {\n log.Fatal(err)\n }\n if kWh == 0 {\n kWh = p_kWh\n out = append(out, fmt.Sprintf(\"%.2f\", kWh))\n } else {\n if math.Abs(kWh - p_kWh) > 0.001 {\n log.Fatal(\"per-provider kWh mismatch (? previously vs ? for ?)\",\n kWh, p_kWh, provider)\n }\n }\n out = append(out, fmt.Sprintf(\"%.2f\", p_cost))\n }\n fmt.Println(strings.Join(out, \",\"))\n}", "title": "" }, { "docid": "1d12b42f121542fd376edafef47be702", "score": "0.55250937", "text": "func LastAuthTime(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldLastAuthTime), v))\n\t})\n}", "title": "" }, { "docid": "2be8a582946cf3071abe594d90e2d93f", "score": "0.5254838", "text": "func GetLastAt(ctx context.Context, project string) time.Time {\n\tkey := taxonomy.CacheKeyPrefixMeasurementLastAt + project\n\titem, err := memcache.Get(ctx, key)\n\tif err == memcache.ErrCacheMiss {\n\t\treturn time.Time{}\n\t}\n\tif err != nil {\n\t\tAppError.Panic(err)\n\t}\n\n\ttimeStampString := string(item.Value)\n\ttimeStamp, err := strconv.ParseInt(timeStampString, 10, 64)\n\tif err != nil {\n\t\tAppError.Panic(err)\n\t}\n\n\treturn time.Unix(timeStamp, 0)\n}", "title": "" }, { "docid": "cea1e3bce2c69388e89871020f4eafe4", "score": "0.5206851", "text": "func (_KeeperConsumer *KeeperConsumerCaller) LastTimeStamp(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _KeeperConsumer.contract.Call(opts, &out, \"lastTimeStamp\")\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": "80d46ec40d30b4403c1b03a741ea99b3", "score": "0.51712435", "text": "func DsQueryTimeFormat(t time.Time) string {\n\treturn t.Format(\"01/02/2006 15:04\")\n}", "title": "" }, { "docid": "e5825b07b06f4b1f49016954aebdb230", "score": "0.5151524", "text": "func LastUsed(v time.Time) predicate.RefreshToken {\n\treturn predicate.RefreshToken(sql.FieldEQ(FieldLastUsed, v))\n}", "title": "" }, { "docid": "7a8689ad30aae2886a088595f6bf6057", "score": "0.51399606", "text": "func GetTime(settings *playfab.Settings, postData *GetTimeRequestModel, developerSecretKey string) (*GetTimeResultModel, error) {\r\n if developerSecretKey == \"\" {\n return nil, playfab.NewCustomError(\"developerSecretKey should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Server/GetTime\", \"X-SecretKey\", developerSecretKey)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &GetTimeResultModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "ddf74ad210d5524cf5aa122903a7489d", "score": "0.51314473", "text": "func GetResultTime() time.Time {\n\tvar time Time\n\n\tdb.Table(\"select_time\").\n\t\tOrder(\"etime desc\").First(&time)\n\treturn time.Etime\n}", "title": "" }, { "docid": "aaf1aa12dcd83aa598ae20469ee771e6", "score": "0.5117844", "text": "func (f *SensorDataFilter) WhereTime(p entql.Int64P) {\n\tf.Where(p.Field(sensordata.FieldTime))\n}", "title": "" }, { "docid": "9850916273a55ba69f9c81ebb8327a69", "score": "0.50891304", "text": "func LastAuthTimeLTE(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldLastAuthTime), v))\n\t})\n}", "title": "" }, { "docid": "1220fc372b094132177774857fa92192", "score": "0.5051883", "text": "func (o LookupSavedQueryResultOutput) LastUpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupSavedQueryResult) string { return v.LastUpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4970fb8b269506602e36769a61d9a58b", "score": "0.50420886", "text": "func (o DiscoveredOutput) LastScanTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Discovered) *string { return v.LastScanTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "81cbfcc60482611b8a2e9a5c44e92fac", "score": "0.50073284", "text": "func (this *storageService) formatQuery() string {\n\tquery := this.query\n\t//Test if the query if empty. If yes, this means a force reload\n\tif query == \"\" {\n\t\tquery = loadQuery(this.bucketQueryObject)\n\t}\n\n\t//Smoking Gopher developer. WTF ??? why formating date on 2006-01-02 15:04:05 ??????\n\tformat := \"2006-01-02 15:04:05\"\n\n\tnow := time.Now()\n\tendDate := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), 0, 0, now.Location())\n\tendDate = endDate.Add(-time.Duration(this.latency) * time.Minute)\n\tstartDate := endDate.Add(-time.Duration(this.minuteDelta) * time.Minute)\n\treturn strings.ReplaceAll(strings.ReplaceAll(query, \"START_TIMESTAMP\", startDate.Format(format)), \"END_TIMESTAMP\", endDate.Format(format))\n}", "title": "" }, { "docid": "6de0aa44cc0c51c9db300cb79d44347f", "score": "0.5000098", "text": "func LastAuthTimeGTE(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldLastAuthTime), v))\n\t})\n}", "title": "" }, { "docid": "2307660528d5c34993dcf3493895d326", "score": "0.4986595", "text": "func NewQueryTimeHook() *proxy.HooksContext {\n\treturn &proxy.HooksContext{\n\t\tPreQuery: func(c context.Context, stmt *proxy.Stmt, args []driver.NamedValue) (interface{}, error) {\n\t\t\treturn time.Now(), nil\n\t\t},\n\n\t\tQuery: func(c context.Context, ctx interface{}, stmt *proxy.Stmt, args []driver.NamedValue, rows driver.Rows) error {\n\t\t\treturn nil\n\t\t},\n\n\t\tPostQuery: func(c context.Context, ctx interface{}, stmt *proxy.Stmt, args []driver.NamedValue, rows driver.Rows, err error) error {\n\t\t\tlog.Printf(\"query time [%s] : %s \\n\", time.Since(ctx.(time.Time)), stmt.QueryString)\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "759c5d2193e9c32964094daac2760a95", "score": "0.49708048", "text": "func queryEndTime(intervals []interval) time.Time {\n\treturn intervals[0].endTime\n}", "title": "" }, { "docid": "2210d8936c6cc24f8ea9496c4f9924ca", "score": "0.4959625", "text": "func (d *Database) GetSensorFromTime(timestamp interface{}) (s models.SensorData, err error) {\n\tsensors, err := d.GetAllFromPreparedQuery(\"SELECT * FROM sensors WHERE timestamp = ?\", timestamp)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"GetSensorFromTime\")\n\t} else {\n\t\ts = sensors[0]\n\t}\n\treturn\n}", "title": "" }, { "docid": "49f413e88a3918e53e05e6aae280bf02", "score": "0.49478763", "text": "func LastUsedEQ(v time.Time) predicate.RefreshToken {\n\treturn predicate.RefreshToken(sql.FieldEQ(FieldLastUsed, v))\n}", "title": "" }, { "docid": "64f424634b92e44a7dc99cbe2ad0e465", "score": "0.4939959", "text": "func queryStartTime(intervals []interval) time.Time {\n\treturn intervals[len(intervals)-1].startTime\n}", "title": "" }, { "docid": "8fba45d1a1a81601c78af2ff64aa2f53", "score": "0.4905381", "text": "func GetTime(key string) time.Time { return g2.GetTime(key) }", "title": "" }, { "docid": "916e83a9d123ae1e43f7e2a7a9bf971e", "score": "0.4903331", "text": "func getCurrentOplogTime(sess *mdb.SessionProvider) (primitive.Timestamp, error) {\n\tmostRecentOplogEntry := mdb.Oplog{}\n\tvar tempBSON bson.Raw\n\n\terr := sess.FindOne(\"local\", \"oplog.rs\", 0, nil, &bson.M{\"$natural\": -1}, &tempBSON, 0)\n\tif err != nil {\n\t\treturn primitive.Timestamp{}, fmt.Errorf(\"error getting recent oplog entry: %w\", err)\n\t}\n\terr = bson.Unmarshal(tempBSON, &mostRecentOplogEntry)\n\tif err != nil {\n\t\treturn primitive.Timestamp{}, err\n\t}\n\treturn mostRecentOplogEntry.Timestamp, nil\n}", "title": "" }, { "docid": "3d0c472a8fbb6b26640513bdc2f804b5", "score": "0.48929715", "text": "func GetLastAt(ctx context.Context, project string) time.Time {\n\tfromCache := cache.GetLastAt(ctx, project)\n\tif !fromCache.IsZero() {\n\t\treturn fromCache\n\t}\n\n\tfromDataStore := ds.GetLastAt(ctx, project)\n\tcache.SetLastAt(ctx, project, fromDataStore)\n\n\treturn fromDataStore\n}", "title": "" }, { "docid": "aefb309c4546154db79ba0ea5951867c", "score": "0.48556787", "text": "func TimeTrackQuery(start time.Time, name string, collection *mgo.Collection, m bson.M, q *mgo.Query) (log string) {\n\telapsed := time.Since(start)\n\tlog += \"\\n\\n\"\n\tlog += fmt.Sprintf(\"%#v\", collection) + \"\\n\\n\"\n\tlog += fmt.Sprintf(\"%#v\", m) + \"\\n\\n\"\n\tlog += fmt.Sprintf(\"%#v\", q) + \"\\n\\n\"\n\tlog += fmt.Sprintf(\"%s took %s\", name, elapsed) + \"\\n\\n\"\n\treturn\n}", "title": "" }, { "docid": "4437df85fb9e529ab6aefc1b2c75adeb", "score": "0.48556232", "text": "func LastAuthTimeEQ(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldLastAuthTime), v))\n\t})\n}", "title": "" }, { "docid": "88299a6555bece00541f5b5a1e469398", "score": "0.4851288", "text": "func (qs SensorQS) LastTsfGe(v float64) SensorQS {\n\treturn qs.filter(`\"last_tsf\" >=`, v)\n}", "title": "" }, { "docid": "56bc0ae4aa6783565448f6a7c4060602", "score": "0.4850437", "text": "func GetTimeRange(uid string) Time {\n\tvar time Time\n\n\tdb.Table(\"select_time\").\n\t\tJoins(\"join student on student.major = select_time.major\").\n\t\tWhere(\"student.id = ?\", uid).\n\t\tSelect(\"select_time.*\").\n\t\tFirst(&time)\n\n\treturn time\n}", "title": "" }, { "docid": "852621912ec0de94a23f1c944a12f2aa", "score": "0.48118982", "text": "func GetLastUpdate(ctx *Ctx, ds DS, raw bool) (lastUpdate *time.Time) {\n\t// curl -s -XPOST -H 'Content-type: application/json' '${URL}/index/_search?size=0' -d '{\"aggs\":{\"m\":{\"max\":{\"field\":\"date_field\"}}}}' | jq -r '.aggregations.m.value_as_string'\n\tdateField := JSONEscape(ds.DateField(ctx))\n\toriginField := JSONEscape(ds.OriginField(ctx))\n\torigin := JSONEscape(ds.Origin(ctx))\n\tvar payloadBytes []byte\n\tif ds.ResumeNeedsCategory(ctx, raw) {\n\t\tcategory := ds.ItemCategory(ctx)\n\t\tcategoryField := \"is_\" + ds.Name() + \"_\" + category\n\t\tif ds.ResumeNeedsOrigin(ctx, raw) {\n\t\t\tpayloadBytes = []byte(`{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"` + originField + `\":\"` + origin + `\"}},{\"term\":{\"` + categoryField + `\":1}}]}},\"aggs\":{\"m\":{\"max\":{\"field\":\"` + dateField + `\"}}}}`)\n\t\t} else {\n\t\t\tpayloadBytes = []byte(`{\"query\":{\"bool\":{\"filter\":{\"term\":{\"` + categoryField + `\":1}}}},\"aggs\":{\"m\":{\"max\":{\"field\":\"` + dateField + `\"}}}}`)\n\t\t}\n\t} else {\n\t\tif ds.ResumeNeedsOrigin(ctx, raw) {\n\t\t\tpayloadBytes = []byte(`{\"query\":{\"bool\":{\"filter\":{\"term\":{\"` + originField + `\":\"` + origin + `\"}}}},\"aggs\":{\"m\":{\"max\":{\"field\":\"` + dateField + `\"}}}}`)\n\t\t} else {\n\t\t\tpayloadBytes = []byte(`{\"aggs\":{\"m\":{\"max\":{\"field\":\"` + dateField + `\"}}}}`)\n\t\t}\n\t}\n\tvar url string\n\tif raw {\n\t\turl = ctx.ESURL + \"/\" + ctx.RawIndex + \"/_search?size=0\"\n\t} else {\n\t\turl = ctx.ESURL + \"/\" + ctx.RichIndex + \"/_search?size=0\"\n\t}\n\tif ctx.Debug > 0 {\n\t\tPrintf(\"resume from date query raw=%v: %s\\n\", raw, string(payloadBytes))\n\t}\n\tmethod := Post\n\tresp, _, _, _, err := Request(\n\t\tctx,\n\t\turl,\n\t\tmethod,\n\t\tmap[string]string{\"Content-Type\": \"application/json\"}, // headers\n\t\tpayloadBytes, // payload\n\t\t[]string{}, // cookies\n\t\tnil, // JSON statuses\n\t\tnil, // Error statuses\n\t\tmap[[2]int]struct{}{{200, 200}: {}}, // OK statuses: 200\n\t\tnil, // Cache statuses\n\t\ttrue, // retry\n\t\tnil, // cache for\n\t\tfalse, // skip in dry-run mode\n\t)\n\tFatalOnError(err)\n\ttype resultStruct struct {\n\t\tAggs struct {\n\t\t\tM struct {\n\t\t\t\tStr string `json:\"value_as_string\"`\n\t\t\t} `json:\"m\"`\n\t\t} `json:\"aggregations\"`\n\t}\n\tvar res resultStruct\n\terr = jsoniter.Unmarshal(resp.([]byte), &res)\n\tif err != nil {\n\t\tPrintf(\"resume from date JSON decode error: %+v for %s url: %s, query: %s\\n\", err, method, url, string(payloadBytes))\n\t\treturn\n\t}\n\tif res.Aggs.M.Str != \"\" {\n\t\tvar tm time.Time\n\t\ttm, err = TimeParseAny(res.Aggs.M.Str)\n\t\tif err != nil {\n\t\t\tPrintf(\"resume from date decode aggregations error: %+v for %s url: %s, query: %s\\n\", err, method, url, string(payloadBytes))\n\t\t\treturn\n\t\t}\n\t\tlastUpdate = &tm\n\t}\n\treturn\n}", "title": "" }, { "docid": "66ca75ab01dcf7428f4bdbfb064d2b4f", "score": "0.4800785", "text": "func LastAuthTimeGT(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLastAuthTime), v))\n\t})\n}", "title": "" }, { "docid": "c191193d7575b04618f9b145269311f6", "score": "0.47981483", "text": "func (o LookupExperimentResultOutput) LastUpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupExperimentResult) string { return v.LastUpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "11650393cd8bb131193e91b012dd5aca", "score": "0.4787685", "text": "func LastAuthTimeIn(vs ...time.Time) predicate.Auth {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Auth(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(FieldLastAuthTime), v...))\n\t})\n}", "title": "" }, { "docid": "45358d60ad46c1a36798fe1e0465a7a1", "score": "0.47806898", "text": "func (o LookupVerifiedAccessGroupResultOutput) LastUpdatedTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupVerifiedAccessGroupResult) *string { return v.LastUpdatedTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "22c82709d0c6f623d4bbe3db986fcabd", "score": "0.4773733", "text": "func (o DiscoveredResponseOutput) LastScanTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DiscoveredResponse) string { return v.LastScanTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f83d3ef2b4e7af69821fc42088b4f03b", "score": "0.4750684", "text": "func LastUsedNEQ(v time.Time) predicate.RefreshToken {\n\treturn predicate.RefreshToken(sql.FieldNEQ(FieldLastUsed, v))\n}", "title": "" }, { "docid": "9c53645f74cd440da2ddd2e3d8631f95", "score": "0.47502032", "text": "func GetLastPacket(pubHash int64) (*Packet, error) {\n db, err := GetDB()\n if err != nil {\n glog.Error(err)\n return nil, err\n }\n rows, err := db.Query(\"select id, created_at, voltage, frequency, protected from packet where pub_hash=$1 order by created_at desc limit 1\", pubHash)\n if err != nil {\n glog.Errorf(\"data.GetLastPacket %v \\n\", err)\n return nil, err\n }\n defer rows.Close()\n if !rows.Next() {\n glog.Errorf(\"data.GetLastPacket %v \\n\", err)\n return nil, fmt.Errorf(\"No data for user: %d \\n\", pubHash)\n }\n pc := &Packet{Id: pubHash}\n err = rows.Scan(&pc.Id, &pc.Timestamp, &pc.Voltage, &pc.Frequency, &pc.Status)\n if err != nil {\n glog.Errorf(\"data.GetLastPacket %v \\n\", err)\n return nil, err\n }\n return pc, nil\n}", "title": "" }, { "docid": "2519947785a3d1a34f6d22318e98ae85", "score": "0.47426966", "text": "func (m *ServiceNowConnection) SetLastQueriedDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n err := m.GetBackingStore().Set(\"lastQueriedDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fbe170f6d1bfcb460811afbd95fe0ef5", "score": "0.472993", "text": "func (params *SearchParams) ReadTime() *int { return params.readTimes.val(mmpSingle) }", "title": "" }, { "docid": "6d2a874c4b4eb5a8b0a872c7bb53ce56", "score": "0.47261387", "text": "func (v *Provider) FinishTime() (time.Time, error) {\n\tres, err := v.batteryG()\n\n\tif err == nil {\n\t\ttimestamp, err := time.Parse(time.RFC3339, res.Data.Attributes.Timestamp)\n\n\t\tif res.Data.Attributes.RemainingTime == nil {\n\t\t\treturn time.Time{}, api.ErrNotAvailable\n\t\t}\n\n\t\treturn timestamp.Add(time.Duration(*res.Data.Attributes.RemainingTime) * time.Minute), err\n\t}\n\n\treturn time.Time{}, err\n}", "title": "" }, { "docid": "a48b94f11840c1fba0d545e07127e0ef", "score": "0.47153354", "text": "func (o DiscoveredPtrOutput) LastScanTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Discovered) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.LastScanTime\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a2bea4c4432ae4546e1e0d01eddcd30f", "score": "0.47107455", "text": "func LastUpdated() time.Time { return time.Unix(1537539535, 0) }", "title": "" }, { "docid": "abed0c15e785a77db36965f049b0898d", "score": "0.47065657", "text": "func LastUsedLTE(v time.Time) predicate.RefreshToken {\n\treturn predicate.RefreshToken(sql.FieldLTE(FieldLastUsed, v))\n}", "title": "" }, { "docid": "6ce602f8fdae94087e481815152b25cb", "score": "0.46988124", "text": "func Query(host string, version int) (*Response, error) {\n\tm, err := getTime(host, version)\n\tnow := toNtpTime(time.Now())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := &Response{\n\t\tTime: m.ReceiveTime.Time(),\n\t\tRTT: rtt(m.OriginTime, m.ReceiveTime, m.TransmitTime, now),\n\t\tClockOffset: offset(m.OriginTime, m.ReceiveTime, m.TransmitTime, now),\n\t\tStratum: m.Stratum,\n\t}\n\n\t// https://tools.ietf.org/html/rfc5905#section-7.3\n\tif r.Stratum == 0 {\n\t\tr.Stratum = maxStratum\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "42a25ce818a7e92c08087ce8ff4dec45", "score": "0.4692628", "text": "func timeEndpoint(endFunc endpointFunc, w http.ResponseWriter, r *http.Request, cacheGet chan lolCache.Request, cachePut chan lolCache.Response) {\n\tc := appengine.NewContext(r)\n\tst := time.Now().UnixNano()\n\tendFunc(w, r, cacheGet, cachePut)\n\tc.Infof(\"API Query (%s) Took: %.4fms\\n\", r.URL, (float64(time.Now().UnixNano()-st))/float64(1000000.0))\n}", "title": "" }, { "docid": "2445635a305a35a2867e521356387d52", "score": "0.4691495", "text": "func GetCurrentTimeStamp() time.Time {\n\t// remove millisecond for sql time sync\n\treturn time.Unix(time.Now().UnixNano()/1000000000, 0)\n}", "title": "" }, { "docid": "af413b91c54ccb5d506cb619cb9484b9", "score": "0.46868584", "text": "func (qs SensorQS) LastTsfEq(v float64) SensorQS {\n\treturn qs.filter(`\"last_tsf\" =`, v)\n}", "title": "" }, { "docid": "f04228ec516967d1d0e626bfd93f3236", "score": "0.4685759", "text": "func QueryMetricsInfo(cid string, appname string, sTime int64, eTime int64) ([]map[string]interface{}, error) {\n\tsql := fmt.Sprintf(QueryMetricFormatSql, cid, appname, sTime, eTime)\n\treturn Query(sql)\n}", "title": "" }, { "docid": "b602c76f6b2be4d6c16565a61a4f008a", "score": "0.46810442", "text": "func (t DefaultMeasuredAtResult) GetTime() time.Duration {\n\treturn t.Result.GetTime()\n}", "title": "" }, { "docid": "abe9bafedc3e426713843bda6ee3b627", "score": "0.4674461", "text": "func (entry *LogEntry) Time() time.Time {\r\n return entry.time\r\n}", "title": "" }, { "docid": "da41641c350fc34959046db4afdd82ea", "score": "0.4667098", "text": "func (ev CursorWithinEvent) Time() time.Time {\n\treturn ev.T\n}", "title": "" }, { "docid": "b6e434b6527864803d3e5180d473a5dc", "score": "0.46649355", "text": "func (b *Backend) GetChampionsTimeStamp() time.Time {\n\tchampionList, err := b.GetChampions()\n\tif err != nil {\n\t\tb.log.Errorf(\"Error getting Champions for TimeStamp: %s\", err)\n\t\treturn time.Time{}\n\t}\n\n\tif len(championList) == 0 {\n\t\treturn time.Time{}\n\t}\n\n\t// Find oldest champ time\n\toldest := time.Now()\n\tfor _, champion := range championList {\n\t\tif oldest.Sub(champion.Timestamp) > 0 {\n\t\t\toldest = champion.Timestamp\n\t\t}\n\t}\n\n\treturn oldest\n}", "title": "" }, { "docid": "873b730a3224cb86b521933a98a8818d", "score": "0.46644124", "text": "func (m *MobileThreatDefenseConnector) GetLastHeartbeatDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastHeartbeatDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "2823cfa21b86765ebb500af65e23fafc", "score": "0.46643475", "text": "func CurrentTime(ntpServer string) time.Time {\n\toptions := beevik_ntp.QueryOptions{Timeout: 2 * time.Second}\n\tt, err := beevik_ntp.QueryWithOptions(ntpServer, options)\n\tif err == nil {\n\t\treturn t.Time\n\t}\n\treturn time.Now()\n}", "title": "" }, { "docid": "8100de5765853f139944ea03a100990a", "score": "0.4655867", "text": "func (o LookupPrivateConnectionResultOutput) UpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupPrivateConnectionResult) string { return v.UpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bc356b3295e836575c1c8eafa6dfa321", "score": "0.46501577", "text": "func LastUsedGT(v time.Time) predicate.RefreshToken {\n\treturn predicate.RefreshToken(sql.FieldGT(FieldLastUsed, v))\n}", "title": "" }, { "docid": "25b91ba534242c358bd61ca72769ac5c", "score": "0.46342364", "text": "func (d *Devops) LastPointPerHost(qi query.Query) {\n\tvar sql string\n\tsql = fmt.Sprintf(`\n\tWITH latest_recorded_time AS (\n\t\tSELECT \n\t\t\thostname,\n\t\t\tmeasure_name,\n\t\t\tmax(time) as latest_time\n\t\tFROM \"%[1]s\".\"cpu\"\n\t\tGROUP BY 1, 2\n\t)\n\tSELECT b.hostname, \n\t\tb.measure_name, \n\t\tb.measure_value::double, \n\t\tb.time\n\tFROM latest_recorded_time a\n\tJOIN \"%[1]s\".\"cpu\" b\n\tON a.hostname = b.hostname AND a.latest_time = b.time AND a.measure_name = b.measure_name\n\tORDER BY hostname, measure_name`, d.DBName)\n\thumanLabel := \"Timestream last row per host\"\n\thumanDesc := humanLabel\n\td.fillInQuery(qi, humanLabel, humanDesc, devops.TableName, sql)\n}", "title": "" }, { "docid": "607debb5c95772fd910d286c729322f9", "score": "0.46338916", "text": "func (a DeploymentFinishedAdapter) GetTime() time.Time {\n\treturn a.cloudEvent.GetTime()\n}", "title": "" }, { "docid": "e3d7ed30f8d6f3c5cdde25bda0fabe97", "score": "0.46323738", "text": "func LastAuthTimeNEQ(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldLastAuthTime), v))\n\t})\n}", "title": "" }, { "docid": "db3d3c13b9f251447078935bef188b80", "score": "0.46288192", "text": "func (qs SensorQS) LastTsfGt(v float64) SensorQS {\n\treturn qs.filter(`\"last_tsf\" >`, v)\n}", "title": "" }, { "docid": "137d5cd5fdf2a471aa70dc6c082a330c", "score": "0.4625014", "text": "func (m *PassiveDnsRecord) GetLastSeenDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastSeenDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "29ec09ed8dc4bca0c59ae8579643b214", "score": "0.4619759", "text": "func (m *AndroidManagedStoreAccountEnterpriseSettings) GetLastAppSyncDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastAppSyncDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "0ac7929fe34fa40e647f62397428e948", "score": "0.46177754", "text": "func (db *SQLStorage) GetCurrent(gun, tufRole string) (*time.Time, []byte, error) {\n\tvar row TUFFile\n\tq := db.Select(\"updated_at, data\").Where(\n\t\t&TUFFile{Gun: gun, Role: tufRole}).Order(\"version desc\").Limit(1).First(&row)\n\tif err := isReadErr(q, row); err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn &(row.UpdatedAt), row.Data, nil\n}", "title": "" }, { "docid": "3f85e96e60d157aed76f97499fc4f3ea", "score": "0.46133977", "text": "func TestEngineMysqlTime(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\ttimeStampResult []string\n\t\ttimeStampErr error\n\t\twantTime int64\n\t\twantErr string\n\t}{\n\t\t{\n\t\t\tname: \"Success\",\n\t\t\ttimeStampResult: []string{\"1685115631\"},\n\t\t\twantTime: 1685115631,\n\t\t}, {\n\t\t\tname: \"Error in result\",\n\t\t\ttimeStampErr: errors.New(\"some error in MySQL\"),\n\t\t\twantErr: \"some error in MySQL\",\n\t\t}, {\n\t\t\tname: \"Error in parsing\",\n\t\t\ttimeStampResult: []string{\"16851r15631\"},\n\t\t\twantErr: \"could not parse time\",\n\t\t}, {\n\t\t\tname: \"More than 1 result\",\n\t\t\ttimeStampResult: []string{\"1685115631\", \"3241241\"},\n\t\t\twantErr: \"could not get MySQL time\",\n\t\t}, {\n\t\t\tname: \"Null result\",\n\t\t\ttimeStampResult: []string{\"null\"},\n\t\t\twantErr: \"unexpected result for MySQL time\",\n\t\t},\n\t}\n\n\tquery := \"SELECT UNIX_TIMESTAMP()\"\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tse := &Engine{}\n\t\t\tdb := fakesqldb.New(t)\n\t\t\tconn, err := connpool.NewDBConnNoPool(context.Background(), db.ConnParams(), nil, nil)\n\t\t\trequire.NoError(t, err)\n\n\t\t\tif tt.timeStampErr != nil {\n\t\t\t\tdb.AddRejectedQuery(query, tt.timeStampErr)\n\t\t\t} else {\n\t\t\t\tdb.AddQuery(query, sqltypes.MakeTestResult(sqltypes.MakeTestFields(\"UNIX_TIMESTAMP\", \"int64\"), tt.timeStampResult...))\n\t\t\t}\n\n\t\t\tgotTime, err := se.mysqlTime(context.Background(), conn)\n\t\t\tif tt.wantErr != \"\" {\n\t\t\t\trequire.ErrorContains(t, err, tt.wantErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\trequire.EqualValues(t, tt.wantTime, gotTime)\n\t\t\trequire.NoError(t, db.LastError())\n\t\t})\n\t}\n}", "title": "" }, { "docid": "395ac2dbbed39cb8588b12725b3cb360", "score": "0.46075687", "text": "func (d *mongoDriver) modifyQueryForTimeLimits(q bson.M, now time.Time) bson.M {\n\tvar timeLimits []bson.M\n\tif d.opts.CheckWaitUntil {\n\t\tcheckWaitUntil := bson.M{\"$or\": []bson.M{\n\t\t\t{\"time_info.wait_until\": bson.M{\"$lte\": now}},\n\t\t\t{\"time_info.wait_until\": bson.M{\"$exists\": false}},\n\t\t}}\n\t\ttimeLimits = append(timeLimits, checkWaitUntil)\n\t}\n\n\tif d.opts.CheckDispatchBy {\n\t\tcheckDispatchBy := bson.M{\"$or\": []bson.M{\n\t\t\t{\"time_info.dispatch_by\": bson.M{\"$gt\": now}},\n\t\t\t{\"time_info.dispatch_by\": bson.M{\"$exists\": false}},\n\t\t}}\n\t\ttimeLimits = append(timeLimits, checkDispatchBy)\n\t}\n\n\tif len(timeLimits) > 0 {\n\t\tq = bson.M{\"$and\": append(timeLimits, q)}\n\t}\n\n\treturn q\n}", "title": "" }, { "docid": "fffc01f888925d9a42ddbda493280514", "score": "0.4605178", "text": "func (*TOCoordinate) SelectMaxLastUpdatedQuery(where, orderBy, pagination, _ string) string {\n\treturn selectMaxLastUpdatedQuery(where, orderBy, pagination)\n}", "title": "" }, { "docid": "a8a27aeb2e44a741772f2c3de849d4c4", "score": "0.460415", "text": "func (impl Implementation) WrapAsOfSystemTime(sql string, t time.Time) string {\n\taost := impl.AsOfSystemTime(t)\n\tif aost == \"\" {\n\t\treturn sql\n\t}\n\treturn \"SELECT * FROM (\" + sql + \")\" + aost\n}", "title": "" }, { "docid": "5995c84b3daa30b28df26d6474e4626f", "score": "0.45964307", "text": "func (r DefaultResult) GetTime() time.Duration {\n\treturn r.Time\n}", "title": "" }, { "docid": "03e5ac790dc96a65249dc8c1fca2f403", "score": "0.45949247", "text": "func Now() Time", "title": "" }, { "docid": "9b5de8dc04dbfb1415d050a8fd706bac", "score": "0.4594624", "text": "func getEntryTime(frame *rtda.Frame) {\n\tentry := _getEntryPop(frame)\n\tmodDate := entry.ModifiedDate\n\tmodTime := entry.ModifiedTime\n\ttime := int64(modDate)<<16 | int64(modTime)\n\n\tstack := frame.OperandStack()\n\tstack.PushLong(time)\n}", "title": "" }, { "docid": "2a1318264c53e77be04f8dd3f94d3b34", "score": "0.45939565", "text": "func (d *Database) GetSensorFromGreaterTime(timeBlockInMilliseconds int64) (sensors []models.SensorData, err error) {\n\tlatestTime, err := d.GetLastSensorTimestamp()\n\tif err != nil {\n\t\treturn\n\t}\n\tminimumTimestamp := latestTime - timeBlockInMilliseconds\n\tlogger.Log.Debugf(\"%d = %d - %d\", minimumTimestamp, latestTime, timeBlockInMilliseconds)\n\tsensors, err = d.GetAllFromPreparedQuery(\"SELECT * FROM (SELECT * FROM sensors WHERE timestamp > ? GROUP BY deviceid ORDER BY timestamp DESC)\", minimumTimestamp)\n\treturn\n}", "title": "" }, { "docid": "5534644a5b3ff3b056418ace7dfc12c0", "score": "0.45937818", "text": "func (info *Info) GetTime() *time.Time {\n\treturn info.TimeStamp\n}", "title": "" }, { "docid": "4cc296d71a39283430361aa3e54f7449", "score": "0.45934075", "text": "func now() time.Duration { return time.Since(startTime) }", "title": "" }, { "docid": "39b473adc725a7daab715bac19624092", "score": "0.45884317", "text": "func UpdateTimeLTE(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateTime), v))\n\t})\n}", "title": "" }, { "docid": "6b1652078a6aaac72ed17408568402fd", "score": "0.45725194", "text": "func Query(costTime time.Duration) {\n\tqueryMetric.Observe(float64(costTime))\n}", "title": "" }, { "docid": "6d7a50214bd64e1a8447c135cdd186ba", "score": "0.45675695", "text": "func (_KeeperConsumer *KeeperConsumerCallerSession) LastTimeStamp() (*big.Int, error) {\n\treturn _KeeperConsumer.Contract.LastTimeStamp(&_KeeperConsumer.CallOpts)\n}", "title": "" }, { "docid": "1ab014af9f1003ffdb493929326722eb", "score": "0.4561917", "text": "func (model *StormDB) GetLastBlockNumberTime() time.Time {\n\tvar t time.Time\n\terr := model.db.Get(models.BucketBlockNumber, models.KeyBlockNumberTime, &t)\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"GetLastBlockNumberTime err %s\", err))\n\t}\n\treturn t\n}", "title": "" }, { "docid": "26daa72e4757598a96af7d77c1616c4e", "score": "0.45600766", "text": "func (portal *Portal) QueryVerifyTimeout() (int64, error) {\n\tdb := db.GetDB()\n\n\tvar verify models.Verify\n\n\tif err := db.Get(&verify, \"SELECT * FROM Verify WHERE MemberID=$1 AND Action=$2 AND Method=$3 AND Status=$4\", portal.Member.MemberID, portal.Action, portal.Method, constants.STATUS_PENDING); err != nil {\n\t\tif err != sql.ErrNoRows {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\t//Not enough time passed after the last code request\n\tif verify.Created > portal.Timestamp-portal.Timeout {\n\t\treturn portal.Timeout - portal.Timestamp + verify.Created, errors.New(\"CODE_TIMEOUT\")\n\t}\n\n\treturn portal.Timeout, nil\n\n}", "title": "" }, { "docid": "ae7ecd387d25c5b4d96db0aad3ce57b6", "score": "0.4556099", "text": "func (m *DeviceConfigurationTargetedUserAndDevice) GetLastCheckinDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"lastCheckinDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "title": "" }, { "docid": "3bca340b4918ff93513c9e6fc690684a", "score": "0.4553597", "text": "func UpdateTime(v time.Time) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdateTime), v))\n\t})\n}", "title": "" }, { "docid": "443ca5baf6839766dda6181246a8e2d5", "score": "0.45521533", "text": "func (db *SQLStorage) GetCurrent(gun data.GUN, tufRole data.RoleName) (*time.Time, []byte, error) {\n\tvar row TUFFile\n\tq := db.Select(\"updated_at, data\").Where(\n\t\t&TUFFile{Gun: gun.String(), Role: tufRole.String()}).Order(\"version desc\").Limit(1).First(&row)\n\tif err := isReadErr(q, row); err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn &(row.UpdatedAt), row.Data, nil\n}", "title": "" }, { "docid": "0745734f082bfd140e331e9aae8a5564", "score": "0.45505145", "text": "func LastUpdatedLTE(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldLastUpdated), v))\n\t})\n}", "title": "" }, { "docid": "c8ddeed5f723fdcac12751dc4e042c80", "score": "0.4544414", "text": "func (id *IndexDeps) LastTime() time.Time {\n\treturn id.now\n}", "title": "" }, { "docid": "242a11ff6bf4a3cc349907c222344132", "score": "0.45276323", "text": "func (bq *InMemoryBuildQueue) getCurrentTime() *timestamppb.Timestamp {\n\treturn timestamppb.New(bq.now)\n}", "title": "" }, { "docid": "a766680095c797a5b38fbafbcaff33b3", "score": "0.45243385", "text": "func (o LookupAuthorizationPolicyResultOutput) UpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupAuthorizationPolicyResult) string { return v.UpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "163e0739892458f04fccc4326e33b54f", "score": "0.45239824", "text": "func (m *ProducerMock) GetTime(t *train.Train, now *time.Time) ([]time.Time, time.Time, time.Time) {\n\targs := m.Called(t, now)\n\treturn args.Get(0).([]time.Time), args.Get(1).(time.Time), args.Get(2).(time.Time)\n}", "title": "" }, { "docid": "d1c9f57c6ada83329d27b60da850d81d", "score": "0.4522581", "text": "func Now() time.Duration { return time.Since(startTime) }", "title": "" }, { "docid": "ba7141935a4cb7915c82297690123aaf", "score": "0.4522306", "text": "func GetParsedTime(t time.Time) time.Time {\n\tparsedTime, err := time.Parse(DatabaseTimeFormat,t.Format(DatabaseTimeFormat))\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn parsedTime\n}", "title": "" }, { "docid": "6bae021c9053f9b73bde490c7fe1e799", "score": "0.45196155", "text": "func (o LookupGuestPolicyResultOutput) UpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupGuestPolicyResult) string { return v.UpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f5c63f8e8569e218a0d5eaf314cc7f35", "score": "0.4516896", "text": "func (g GraphiteDaemon) QueryRecent(target string, d time.Duration) ([]GraphiteSeries, error) {\n\t// TODO(eefi): Warn if d is not whole seconds?\n\tfrom := fmt.Sprintf(\"-%ds\", int64(d/time.Second))\n\tdata, err := g.query(target, from, \"now\")\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "ce39e39288f9aa8bbaa8a135f35854d9", "score": "0.45062727", "text": "func configTime(c *tls.Config) time.Time {\n\tt := c.Time\n\tif t == nil {\n\t\tt = time.Now\n\t}\n\treturn t()\n}", "title": "" }, { "docid": "f13520a106548c890741149c0e860e95", "score": "0.4501965", "text": "func getLast24(g graphite.Querier, sensor string, cf string) float64 {\n\ttarget := fmt.Sprintf(`summarize(sensor.%s.%s,\"100y\",\"%s\")`, sensor, cf, cf)\n\tdata, err := g.Query(\"-24h\", \"now\", target)\n\tif err != nil {\n\t\tlog.Println(\"Failed to get graphite data\")\n\t\treturn 0.0\n\t}\n\treturn data[0].Datapoints[0].Value\n}", "title": "" }, { "docid": "5af40b504113e4c0f5d32571afe325e6", "score": "0.44997582", "text": "func (w *Whisper) FetchTime(from time.Time) (Interval, []Point, error) {\n\tnow := uint32(time.Now().Unix())\n\treturn w.FetchUntil(uint32(from.Unix()), now)\n}", "title": "" }, { "docid": "2fba8125e1b893dbf14ba652fec22627", "score": "0.44989234", "text": "func (v *Provider) FinishTime() (time.Time, error) {\n\tres, err := v.chargerG()\n\tif err == nil {\n\t\tcrg := res.Charging\n\n\t\t// estimate not available\n\t\tif crg.State == \"Error\" || crg.ChargingType == \"Invalid\" {\n\t\t\treturn time.Time{}, api.ErrNotAvailable\n\t\t}\n\n\t\tremaining := time.Duration(crg.RemainingToCompleteInSeconds) * time.Second\n\t\treturn time.Now().Add(remaining), err\n\t}\n\n\treturn time.Time{}, err\n}", "title": "" }, { "docid": "0d4f66b57a062a9e28f1e7651818103f", "score": "0.44983935", "text": "func (o AiFeatureStoreOutput) UpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AiFeatureStore) pulumi.StringOutput { return v.UpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c43754543e5a49f9babb7106e80a5752", "score": "0.44967878", "text": "func (o LookupAppConnectionResultOutput) UpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupAppConnectionResult) string { return v.UpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fa85a22c5a8481928684aad18b05549e", "score": "0.4496025", "text": "func (q Query) GetLastModified() time.Time {\n\treturn q.UpdatedAt.Truncate(time.Second)\n}", "title": "" }, { "docid": "9002cc805f32e2c826fe67d9057e0a14", "score": "0.44891766", "text": "func (p *Client) EventTime() time.Time {\n\tif !p.E.isThere() {\n\t\treturn time.Now()\n\t}\n\treturn p.E.Executions[len(p.E.Executions)-1].Timestamp\n}", "title": "" }, { "docid": "f79b3d6f2a25fe00995b0831267c2d66", "score": "0.44862792", "text": "func (o LookupEndpointResultOutput) UpdateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupEndpointResult) string { return v.UpdateTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "097a8a0a2cd76579c83960917278895f", "score": "0.44762608", "text": "func (a AliasValue) Time() time.Time {\n\tt := time2.FromSqlDateTime(a.String())\n\treturn t\n}", "title": "" }, { "docid": "7206c0ae0a8b23e565806534d5afd4e9", "score": "0.4471395", "text": "func (myDetectionInfo *DetectionInfo) LastFound() (param *time.Time) {\n\treturn myDetectionInfo.LastFoundvar\n}", "title": "" } ]
ce755a6c12026347dba9d4656f7567ab
SetupConditions returns the opening and closing conditions.
[ { "docid": "6b4f61d842b29fc4eb1dff26837b3477", "score": "0.8079525", "text": "func SetupConditions() (conditions.Condition, conditions.Condition, error) {\n\tvar openingCondition conditions.Condition\n\tvar closingCondition conditions.Condition\n\n\t// Create the opening condition\n\tswitch viper.GetString(\"coop.opening.mode\") {\n\tcase \"time_based\":\n\t\toc, err := timebased.NewTimeBasedCondition(viper.GetString(\"coop.opening.value\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"error while creating the opening condition: %s\", err)\n\t\t}\n\n\t\topeningCondition = oc\n\tcase \"sun_based\":\n\t\toc, err := sunbased.NewSunBasedCondition(viper.GetString(\"coop.opening.value\"), viper.GetFloat64(\"coop.latitude\"), viper.GetFloat64(\"coop.longitude\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"error while creating the opening condition: %s\", err)\n\t\t}\n\n\t\topeningCondition = oc\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"error with the opening mode: %s\", viper.GetString(\"coop.opening.mode\"))\n\t}\n\n\t// Create the closing condition\n\tswitch viper.GetString(\"coop.closing.mode\") {\n\tcase \"time_based\":\n\t\tcc, err := timebased.NewTimeBasedCondition(viper.GetString(\"coop.closing.value\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"error while creating the closing condition: %s\", err)\n\t\t}\n\n\t\tclosingCondition = cc\n\tcase \"sun_based\":\n\t\tcc, err := sunbased.NewSunBasedCondition(viper.GetString(\"coop.closing.value\"), viper.GetFloat64(\"coop.latitude\"), viper.GetFloat64(\"coop.longitude\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"error while creating the closing condition: %s\", err)\n\t\t}\n\n\t\tclosingCondition = cc\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"error with the closing mode: %s\", viper.GetString(\"coop.closing.mode\"))\n\t}\n\n\treturn openingCondition, closingCondition, nil\n}", "title": "" } ]
[ { "docid": "dce2cf6c096c9d257e73dc1296f2f144", "score": "0.6265342", "text": "func (wscs *WebSocketChannelStatus) InitializeConditions() {\n\twscCondSet.Manage(wscs).InitializeConditions()\n}", "title": "" }, { "docid": "6ae7147040979cce7774cc60b728a96b", "score": "0.6239674", "text": "func (cs *ChannelStatus) InitializeConditions() {\n\tchannelCondSet.Manage(cs).InitializeConditions()\n}", "title": "" }, { "docid": "9cacadd945a9c1783cad02c5511d0e2d", "score": "0.62306803", "text": "func (s *AWSCodeCommitSourceStatus) InitializeConditions() {\n\tawsCodeCommitConditionSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "f6a201617122433cec93adc2704dfc31", "score": "0.60946137", "text": "func (webtest *Webtest) GetConditions() conditions.Conditions {\n\treturn webtest.Status.Conditions\n}", "title": "" }, { "docid": "5143d95be31ec883c5801a876a47fb04", "score": "0.606953", "text": "func NewConditions() *Conditions {\n\treturn &Conditions{\n\t\tConds: make([]Condition, 0),\n\t\tOffset: defaultOffset,\n\t\tLimit: defaultLimit,\n\t}\n}", "title": "" }, { "docid": "d84b62393fb1bbf2adb1e030d927cf73", "score": "0.6020702", "text": "func (s *MQTTSourceStatus) InitializeConditions() {\n\tmqttCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "b717410e833fc29807168a95a4a681d8", "score": "0.60182506", "text": "func (s *CronJobSourceStatus) InitializeConditions() {\n\tcronJobSourceCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "a5c34453814e721e365e290ec2e8a8f6", "score": "0.60107964", "text": "func (_options *CreateDialogNodeOptions) SetConditions(conditions string) *CreateDialogNodeOptions {\n\t_options.Conditions = core.StringPtr(conditions)\n\treturn _options\n}", "title": "" }, { "docid": "97ae018f8932ed8980c21207141a7760", "score": "0.59702784", "text": "func (dbs *DaytonaBindingStatus) InitializeConditions() {\n\tdaytonaCondSet.Manage(dbs).InitializeConditions()\n}", "title": "" }, { "docid": "83218c755c1bcf4893c1942eef48522b", "score": "0.5957534", "text": "func (s *ContainerSourceStatus) InitializeConditions() {\n\tcontainerCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "d225787db5803a086a89f394abf566d2", "score": "0.5956201", "text": "func (b *EventingBackendStatus) InitializeConditions() {\n\tinitialConditions := makeBackendConditions()\n\tb.Conditions = initializeConditions(initialConditions, b.Conditions)\n}", "title": "" }, { "docid": "f742e8f235856599447f47f39b3cd49c", "score": "0.59458244", "text": "func NewConditions(\n\tnet *chaincfg.Params,\n\tftime time.Time,\n\tfamt1, famt2 btcutil.Amount,\n\tffeerate, rfeerate btcutil.Amount, // fund feerate and redeem feerate\n\trefundLockTime uint32, // refund locktime\n\tdeals []*Deal,\n\tinfo *PremiumInfo,\n) (*Conditions, error) {\n\tfamts := make(map[Contractor]btcutil.Amount)\n\tfamts[FirstParty] = famt1\n\tfamts[SecondParty] = famt2\n\n\tconds := &Conditions{\n\t\tNetParams: net,\n\t\tFixingTime: ftime,\n\t\tFundAmts: famts,\n\t\tFundFeerate: ffeerate,\n\t\tRedeemFeerate: rfeerate,\n\t\tRefundLockTime: refundLockTime,\n\t\tDeals: deals,\n\t\tPremiumInfo: info,\n\t}\n\n\t// validate structure\n\tvalidate := validator.New()\n\t_ = validate.RegisterValidation(\"funds\", func(fl validator.FieldLevel) bool {\n\t\tm, ok := fl.Field().Interface().(map[Contractor]btcutil.Amount)\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\n\t\treturn m[0] != 0 || m[1] != 0\n\t})\n\n\terr := validate.Struct(conds)\n\n\treturn conds, err\n}", "title": "" }, { "docid": "cea08bdd47fd200e444bf7f291f30d08", "score": "0.59268713", "text": "func (status *CommonServiceBrokerStatus) InitializeConditions() {\n\tstatus.manage().InitializeConditions()\n}", "title": "" }, { "docid": "4408cba1b3edee554de2098c7d3c7201", "score": "0.5914844", "text": "func (ms *MetricStatus) InitializeConditions() {\n\tcondSet.Manage(ms).InitializeConditions()\n}", "title": "" }, { "docid": "c8a3bcab0483c6f089c5e25134a9cf79", "score": "0.59129775", "text": "func (s *ContainerSourcesStatus) InitializeConditions() {\n\tcontainerCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "19724f413fd31056778a882c4de0e989", "score": "0.5902595", "text": "func (s *GitHubSourceStatus) InitializeConditions() {\n\tgitHubSourceCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "2634c6c5a0793a8f69e0c6e06b8fd0fb", "score": "0.586558", "text": "func (os *OperandStatus) InitializeConditions() {\n\toperandConditions.Manage(os).InitializeConditions()\n}", "title": "" }, { "docid": "93473d278b08adc4a1d24097855c346b", "score": "0.58270967", "text": "func (s *BitBucketSourceStatus) InitializeConditions() {\n\tbitBucketSourceCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "77a784894ca0da94ea44859e6f21dc8a", "score": "0.579733", "text": "func GetConditions(c dproxy.Proxy) Conditions {\n\tcon := Conditions{}\n\tc_item := c.M(\"item\")\n\tc_con := c_item.M(\"condition\")\n\tcon.Title, _ = c_item.M(\"title\").String()\n\n\tlat, _ := c_item.M(\"lat\").String()\n\tcon.Lat, _ = strconv.ParseFloat(lat, 64)\n\n\tlong, _ := c_item.M(\"long\").String()\n\tcon.Long, _ = strconv.ParseFloat(long, 64)\n\n\tcon.PubDate, _ = c_item.M(\"pubDate\").String()\n\n\ttemp, _ := c_con.M(\"temp\").String()\n\tcon.Temp, _ = strconv.ParseFloat(temp, 64)\n\n\tcon.Text, _ = c_con.M(\"text\").String()\n\n\treturn con\n}", "title": "" }, { "docid": "684845878c7542b8cdf04075cfbbde2f", "score": "0.57944643", "text": "func (c Conditions) GetConditions() string {\n\tcond := \"Date: \" + c.start + \"~\" + c.end + \"/ \"\n\tcond += \"Total amount: \" + c.lb + \" ~ \" + c.ub + \"/ \"\n\tcond += \"Number of Rows: \" + c.numrows + \"/ \"\n\treturn cond\n}", "title": "" }, { "docid": "5a2179727784a45c538081c53c5d066b", "score": "0.5785186", "text": "func (in GitRepository) GetConditions() []metav1.Condition {\n\treturn in.Status.Conditions\n}", "title": "" }, { "docid": "edb227fdeb6c2d065261789178d452fe", "score": "0.573987", "text": "func (s *GitLabSourceStatus) InitializeConditions() {\n\tgitLabSourceCondSet.Manage(s).InitializeConditions()\n}", "title": "" }, { "docid": "00a1b710cc6fda76c18df3652440870f", "score": "0.57307047", "text": "func (ispn *Infinispan) SetConditions(conds []InfinispanCondition) bool {\n\tchanged := false\n\tfor _, c := range conds {\n\t\tchanged = changed || ispn.SetCondition(c.Type, c.Status, c.Message)\n\t}\n\treturn changed\n}", "title": "" }, { "docid": "66412497b86cf59ab1767ddf5e05c804", "score": "0.5717905", "text": "func (status *ServiceInstanceStatus) InitializeConditions() {\n\tstatus.manage().InitializeConditions()\n}", "title": "" }, { "docid": "b4dd8dcc9094fe462dd4e8dde69f0aa2", "score": "0.57097644", "text": "func (setting *SqlDatabaseContainerThroughputSetting) GetConditions() conditions.Conditions {\n\treturn setting.Status.Conditions\n}", "title": "" }, { "docid": "9e8324801f0f3aa6d0e2f1f58490fc2f", "score": "0.5708986", "text": "func (s *SubscriptionStatus) InitializeConditions() {\n\tinitialConditions := MakeSubscriptionConditions()\n\ts.Conditions = initializeConditions(initialConditions, s.Conditions)\n}", "title": "" }, { "docid": "90b322ae0659d092e9a05321e5518468", "score": "0.5673819", "text": "func (database *FlexibleServersDatabase) GetConditions() conditions.Conditions {\n\treturn database.Status.Conditions\n}", "title": "" }, { "docid": "e9ad0cacdd74ed454adc9e2f632bab54", "score": "0.5643799", "text": "func (mg *DocumentationPart) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "51842fb3a5b05f1025c5c3d20253acfc", "score": "0.56354374", "text": "func (mg *FileSystem) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "6f78c9419586236f57979f160b6d8a1d", "score": "0.5625598", "text": "func (s *SendGridTargetStatus) InitializeConditions() {\n\tSendgridCondSet.Manage(s).InitializeConditions()\n\ts.Address = &duckv1.Addressable{}\n}", "title": "" }, { "docid": "57eacaf4594ef973df4a6332b8f23000", "score": "0.56208223", "text": "func (signalR *SignalR) GetConditions() conditions.Conditions {\n\treturn signalR.Status.Conditions\n}", "title": "" }, { "docid": "dd4e4574c2225ae0ab8698841bcd78d6", "score": "0.5618775", "text": "func (mg *Database) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "cbc950587b35c3b29e075d988f89c23c", "score": "0.56067646", "text": "func (mg *Method) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "bbfd27de0ece21822aa311273e9da195", "score": "0.56053865", "text": "func initializeConditions(initialConditions, currentConditions []Condition) []Condition {\n\tgivenConditions := make(map[ConditionType]Condition)\n\n\t// create map of Condition per ConditionType\n\tfor _, condition := range currentConditions {\n\t\tgivenConditions[condition.Type] = condition\n\t}\n\n\tfinalConditions := currentConditions\n\t// check if every Condition is present in the current Conditions\n\tfor _, expectedCondition := range initialConditions {\n\t\tif _, ok := givenConditions[expectedCondition.Type]; !ok {\n\t\t\t// and add it if it is missing\n\t\t\tfinalConditions = append(finalConditions, expectedCondition)\n\t\t}\n\t}\n\treturn finalConditions\n}", "title": "" }, { "docid": "1052c7fe5481b62e1cae557e34e9b961", "score": "0.55978054", "text": "func (_m *ConditionManager) Conditions() []*v1alpha1.Condition {\n\tret := _m.Called()\n\n\tvar r0 []*v1alpha1.Condition\n\tif rf, ok := ret.Get(0).(func() []*v1alpha1.Condition); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*v1alpha1.Condition)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "b29f4192febcf5756f273b926baf259e", "score": "0.55893755", "text": "func (server *FlexibleServer) GetConditions() conditions.Conditions {\n\treturn server.Status.Conditions\n}", "title": "" }, { "docid": "b29f4192febcf5756f273b926baf259e", "score": "0.55893755", "text": "func (server *FlexibleServer) GetConditions() conditions.Conditions {\n\treturn server.Status.Conditions\n}", "title": "" }, { "docid": "bb6ba378c4b16b20d45e0bd112648bb1", "score": "0.55832374", "text": "func (configuration *Configuration) GetConditions() conditions.Conditions {\n\treturn configuration.Status.Conditions\n}", "title": "" }, { "docid": "d7e72eea2646abffa8f1a00e3b79e1ee", "score": "0.5578301", "text": "func (webtest *Webtest) SetConditions(conditions conditions.Conditions) {\n\twebtest.Status.Conditions = conditions\n}", "title": "" }, { "docid": "84ed06eca8f2ffa79aae6fe0017b0339", "score": "0.557227", "text": "func WithConditions(c []apis.Condition) OptionFunc {\n\treturn func(r *runitem) {\n\t\tr.Conditions = c\n\t}\n}", "title": "" }, { "docid": "3216eeee4c16bccc943953fa550dfef7", "score": "0.55689794", "text": "func (mg *Integration) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "9d170c3d598f29ece0937b4dcff49ff0", "score": "0.5563008", "text": "func MakeSubscriptionConditions() []Condition {\n\tconditions := []Condition{\n\t\t{\n\t\t\tType: ConditionAPIRuleStatus,\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t\tStatus: corev1.ConditionUnknown,\n\t\t},\n\t\t{\n\t\t\tType: ConditionSubscribed,\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t\tStatus: corev1.ConditionUnknown,\n\t\t},\n\t\t{\n\t\t\tType: ConditionSubscriptionActive,\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t\tStatus: corev1.ConditionUnknown,\n\t\t},\n\t\t{\n\t\t\tType: ConditionWebhookCallStatus,\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t\tStatus: corev1.ConditionUnknown,\n\t\t},\n\t}\n\treturn conditions\n}", "title": "" }, { "docid": "0cc2019be24f74e5d6622c5f7a77c74c", "score": "0.55627406", "text": "func (setting *ServersAuditingSetting) GetConditions() conditions.Conditions {\n\treturn setting.Status.Conditions\n}", "title": "" }, { "docid": "aa7c78d3cbd9d7a3b9ebe420fe12daf9", "score": "0.55521023", "text": "func (mg *Connection) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "042e794a3b52c54524e4881a160c8f5c", "score": "0.55420625", "text": "func (scaleSet *VirtualMachineScaleSet) GetConditions() conditions.Conditions {\n\treturn scaleSet.Status.Conditions\n}", "title": "" }, { "docid": "8215f0cf795353f046696aa7db85cf0d", "score": "0.55391055", "text": "func (mg *Stage) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "072630c2a0ce4faab20dd6174092cad8", "score": "0.55274117", "text": "func (mg *Authorizer) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "2ae8182b16f2f1991ac70bec590764fe", "score": "0.55266535", "text": "func (s *Status) InitializeConditions(conditionTypes ...ConditionType) {\n\tfor _, t := range conditionTypes {\n\t\tc := Condition{\n\t\t\tType: t,\n\t\t\tStatus: corev1.ConditionUnknown,\n\t\t}\n\t\ts.SetCondition(c)\n\t}\n}", "title": "" }, { "docid": "bff93a304b2f9f29d6bc0140ce72cc7d", "score": "0.55253404", "text": "func (mg *Crawler) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "1cb8670c800252a987bb1ca53105e8dc", "score": "0.54995334", "text": "func (mg *Model) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "e0b8ab11ca0d69c0afe5394687e96473", "score": "0.5498448", "text": "func (procedure *SqlDatabaseContainerStoredProcedure) GetConditions() conditions.Conditions {\n\treturn procedure.Status.Conditions\n}", "title": "" }, { "docid": "aef02622854ac8f051f0427aae73a8ca", "score": "0.5497138", "text": "func (mg *DocumentationVersion) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "1960c7d9af27d515c39bf7f6f97c8b48", "score": "0.5496895", "text": "func (mg *Backup) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "34b628402f0e1488b548cec2747b9122", "score": "0.54894614", "text": "func (mg *RestAPI) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "666218f3339ab3283e3dbe67ff4c28e9", "score": "0.5470307", "text": "func (snapshot *Snapshot) GetConditions() conditions.Conditions {\n\treturn snapshot.Status.Conditions\n}", "title": "" }, { "docid": "4812c7d5db3cb7ea8589a414fcd6793f", "score": "0.5468136", "text": "func (rule *NamespacesEventhubsAuthorizationRule) GetConditions() conditions.Conditions {\n\treturn rule.Status.Conditions\n}", "title": "" }, { "docid": "8c4503b3c4b5ce3a6c38d6d7a51d4cba", "score": "0.5455593", "text": "func (site *Site) GetConditions() conditions.Conditions {\n\treturn site.Status.Conditions\n}", "title": "" }, { "docid": "b0ec9f3191894bda1f7aa6117148c00e", "score": "0.5446105", "text": "func (mg *UsagePlan) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "35a96e4c94aa7815f729b85c22039939", "score": "0.54428875", "text": "func (database *MongodbDatabase) GetConditions() conditions.Conditions {\n\treturn database.Status.Conditions\n}", "title": "" }, { "docid": "e0daea800fcfda89085d0e4f8b9ee22c", "score": "0.54412216", "text": "func (mg *NotificationChannel) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "966273ff49c2c9b5bc287252c6be6d96", "score": "0.54305935", "text": "func (mg *RequestValidator) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "9831ee1a8bf151bde20a0315de1e34b2", "score": "0.5424493", "text": "func (mg *Listener) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "46d534df006c61b385f2f8d36ec27251", "score": "0.5421713", "text": "func (mg *GlobalTable) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "b59b21863bc04f30d9cda61e8d5ba488", "score": "0.5421659", "text": "func (pool *ManagedClustersAgentPool) GetConditions() conditions.Conditions {\n\treturn pool.Status.Conditions\n}", "title": "" }, { "docid": "3e413e2381ea616a54d4277c29f634cf", "score": "0.54152274", "text": "func (mg *IAMPolicy) SetConditions(c ...runtimev1alpha1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "cc08421eb17c3947d7160dc7c0c9885a", "score": "0.5412963", "text": "func (mg *SecurityConfiguration) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "7e6dffc07917d207a8ed42e163366924", "score": "0.54031676", "text": "func (s *Stage) Conditions() []WorkflowNodeCondition {\n\tres := []WorkflowNodeCondition{}\n\tfor _, p := range s.Prerequisites {\n\t\tif !strings.HasPrefix(p.Parameter, \"git.\") {\n\t\t\tp.Parameter = \"cds.pip.\" + p.Parameter\n\t\t}\n\t\tres = append(res, WorkflowNodeCondition{\n\t\t\tValue: p.ExpectedValue,\n\t\t\tVariable: p.Parameter,\n\t\t\tOperator: WorkflowConditionsOperatorRegex,\n\t\t})\n\t}\n\treturn res\n}", "title": "" }, { "docid": "9bd681e03223ee8c5b8b90dc29df3a9d", "score": "0.5399739", "text": "func (p *Provider) SetConditions(c ...xpv1.Condition) {\n\tp.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "be247ef43eb1ae964a16bceb8dab38f3", "score": "0.5394419", "text": "func (mg *Job) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "f8be256ea0e718a4a4112fa55391ac10", "score": "0.53935695", "text": "func (mg *Registration) SetConditions(c ...nddv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "b3f5b12d4b6b3be6a00185eb886f8cc7", "score": "0.5389019", "text": "func (alias *Alias) GetConditions() conditions.Conditions {\n\treturn alias.Status.Conditions\n}", "title": "" }, { "docid": "0d29e757a45c29317ddd5db5885aefc0", "score": "0.5388746", "text": "func (mg *Classifier) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "09ebd061d4a59e1443aa3c9113afcaa5", "score": "0.5383911", "text": "func NewSetConditions(receiver, runtime string) New {\n\treturn func(f *jen.File, o types.Object) {\n\t\tf.Commentf(\"SetConditions of this %s.\", o.Name())\n\t\tf.Func().Params(jen.Id(receiver).Op(\"*\").Id(o.Name())).Id(\"SetConditions\").Params(jen.Id(\"c\").Op(\"...\").Qual(runtime, \"Condition\")).Block(\n\t\t\tjen.Id(receiver).Dot(fields.NameStatus).Dot(\"SetConditions\").Call(jen.Id(\"c\").Op(\"...\")),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "5ba02496d36ff235a870c9f5a63a19a0", "score": "0.5372022", "text": "func (a *Instance) SetConditions(c ...runtimev1alpha1.Condition) {\n\ta.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "bad65608c3e6e1055dfa0be99d0a1caf", "score": "0.5367193", "text": "func (mg *Resource) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "75abb78e40d6f2b18311c789074c7dfb", "score": "0.53666633", "text": "func (o CSIScaleOperatorStatusOutput) Conditions() CSIScaleOperatorStatusConditionsArrayOutput {\n\treturn o.ApplyT(func(v CSIScaleOperatorStatus) []CSIScaleOperatorStatusConditions { return v.Conditions }).(CSIScaleOperatorStatusConditionsArrayOutput)\n}", "title": "" }, { "docid": "90bc7d70403ba82589999008528f63d4", "score": "0.53645474", "text": "func (i *InternetGateway) SetConditions(c ...runtimev1alpha1.Condition) {\n\ti.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "837d40c3dde500e477c2d28b284c8ed4", "score": "0.53631926", "text": "func (pool *ManagedClustersAgentPool) SetConditions(conditions conditions.Conditions) {\n\tpool.Status.Conditions = conditions\n}", "title": "" }, { "docid": "b80332aaed110c133ebfd5272415344f", "score": "0.53618616", "text": "func (o *PublicFormViewFieldOptions) SetConditions(v []FormViewFieldOptionsCondition) {\n\to.Conditions = v\n}", "title": "" }, { "docid": "7df942117bee791a8d5d04e6bde92df4", "score": "0.53597635", "text": "func (workspace *Workspace) GetConditions() conditions.Conditions {\n\treturn workspace.Status.Conditions\n}", "title": "" }, { "docid": "7df942117bee791a8d5d04e6bde92df4", "score": "0.53597635", "text": "func (workspace *Workspace) GetConditions() conditions.Conditions {\n\treturn workspace.Status.Conditions\n}", "title": "" }, { "docid": "7df942117bee791a8d5d04e6bde92df4", "score": "0.53597635", "text": "func (workspace *Workspace) GetConditions() conditions.Conditions {\n\treturn workspace.Status.Conditions\n}", "title": "" }, { "docid": "916edf248cfb4712f260c2f08842e94d", "score": "0.53556585", "text": "func (mg *Table) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "df7731c6a4317c2a13d4a90a8c00d0b1", "score": "0.5355509", "text": "func (component *Component) GetConditions() conditions.Conditions {\n\treturn component.Status.Conditions\n}", "title": "" }, { "docid": "e41f3d8c854b6de6aa2c3447f348a059", "score": "0.5354672", "text": "func (machine *VirtualMachine) GetConditions() conditions.Conditions {\n\treturn machine.Status.Conditions\n}", "title": "" }, { "docid": "1383a53f4e863e7bdcd867e9d00da846", "score": "0.5350839", "text": "func AutomodRulesetConditions(mods ...qm.QueryMod) automodRulesetConditionQuery {\n\tmods = append(mods, qm.From(\"\\\"automod_ruleset_conditions\\\"\"))\n\tq := NewQuery(mods...)\n\tif len(queries.GetSelect(q)) == 0 {\n\t\tqueries.SetSelect(q, []string{\"\\\"automod_ruleset_conditions\\\".*\"})\n\t}\n\n\treturn automodRulesetConditionQuery{q}\n}", "title": "" }, { "docid": "0d8672ef69f82bd854f25762b65202e5", "score": "0.5349481", "text": "func (c *DockerMachine) GetConditions() clusterv1alpha4.Conditions {\n\treturn c.Status.Conditions\n}", "title": "" }, { "docid": "a1d38ed50d25d905c0cbd47bfe745899", "score": "0.53482765", "text": "func MatchConditions(expected []metav1.Condition) types.GomegaMatcher {\n\treturn &matchConditions{\n\t\texpected: expected,\n\t}\n}", "title": "" }, { "docid": "e86e9f0172143bc22dfe995ba4993aa2", "score": "0.5345246", "text": "func (namespace *Namespace) GetConditions() conditions.Conditions {\n\treturn namespace.Status.Conditions\n}", "title": "" }, { "docid": "72622c47da9e2f9c7b959c06f1187da4", "score": "0.53449905", "text": "func (procedure *SqlDatabaseContainerStoredProcedure) SetConditions(conditions conditions.Conditions) {\n\tprocedure.Status.Conditions = conditions\n}", "title": "" }, { "docid": "e206164e93099fb65be370bfc9d862c7", "score": "0.53406674", "text": "func (setting *SqlDatabaseContainerThroughputSetting) SetConditions(conditions conditions.Conditions) {\n\tsetting.Status.Conditions = conditions\n}", "title": "" }, { "docid": "fcff5c5558da90395dac2fb3d1977b57", "score": "0.533148", "text": "func (o GroupSyncStatusOutput) Conditions() GroupSyncStatusConditionsArrayOutput {\n\treturn o.ApplyT(func(v GroupSyncStatus) []GroupSyncStatusConditions { return v.Conditions }).(GroupSyncStatusConditionsArrayOutput)\n}", "title": "" }, { "docid": "5be5bd7d52f6e31cd6a3e734d628666d", "score": "0.5322983", "text": "func (in Bucket) GetConditions() []metav1.Condition {\n\treturn in.Status.Conditions\n}", "title": "" }, { "docid": "114373fa93650018dee38c7e2816ed51", "score": "0.53207004", "text": "func (mg *EndpointGroup) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "e35f5770c298b13a7bf0c77f693c3f59", "score": "0.5317328", "text": "func (mg *UsagePlanKey) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" }, { "docid": "0e298b4d6aaeb1f62ed03b72b5ae8152", "score": "0.53167546", "text": "func (database *FlexibleServersDatabase) SetConditions(conditions conditions.Conditions) {\n\tdatabase.Status.Conditions = conditions\n}", "title": "" }, { "docid": "3715ca1144239d1f194746f6c10173d3", "score": "0.53031653", "text": "func (signalR *SignalR) SetConditions(conditions conditions.Conditions) {\n\tsignalR.Status.Conditions = conditions\n}", "title": "" }, { "docid": "a9568acddee5b473b9ae3fa747ee4ce3", "score": "0.52988046", "text": "func (ns *Namespace) Conditions() []api.Condition {\n\treturn ns.conditions\n}", "title": "" }, { "docid": "b46f69481c77e27aacd43a6cb23c9126", "score": "0.52962375", "text": "func (group *ServersFailoverGroup) GetConditions() conditions.Conditions {\n\treturn group.Status.Conditions\n}", "title": "" }, { "docid": "e8f4330e70fb96ee111b83fb2a5bda89", "score": "0.5292934", "text": "func (mg *Accelerator) SetConditions(c ...xpv1.Condition) {\n\tmg.Status.SetConditions(c...)\n}", "title": "" } ]
0e2b657c1d44cfb8614f245f2cb8082f
Validates the attributes of a formation object (Note: does not validate any child or parent objects).
[ { "docid": "fbfc2414679e015374ac3a622820ccd5", "score": "0.6179127", "text": "func (f *Formation) Validate() error {\n\terr := validator.New().Struct(f)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid parameters for formation:\\n%w\", err)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "61129137cbc9fa574d323448005dc9de", "score": "0.61049134", "text": "func (inf *Inflation) Validate() error {\n\t// no required fields, return nil.\n\treturn nil\n}", "title": "" }, { "docid": "a676d55b6ef328904e5730c474b2dd0a", "score": "0.60671914", "text": "func validateAttributes(attrs map[string]models.ValueType, allAttrs bool) error {\n\t// TBD: to finalize the attributes specifics\n\tattrsOK := false\n\tif vt, ok := attrs[AttrCred]; ok && vt.Kind == com.ValueTypeSecret {\n\t\tif !allAttrs {\n\t\t\tattrsOK = true\n\t\t} else if vt, ok := attrs[AttrZone]; ok && vt.Kind == com.ValueTypeString {\n\t\t\tattrsOK = true\n\t\t}\n\t}\n\tif !attrsOK {\n\t\tmsg := \"required domain attributes missing or invalid: need \" + AttrCred + \"[E]\"\n\t\tif allAttrs {\n\t\t\tmsg += \", \" + AttrZone + \"[S]\"\n\t\t}\n\t\treturn fmt.Errorf(msg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f0324bd54041b61e23af102f1752137", "score": "0.59516853", "text": "func (m *MandateSubmissionCreationDataAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLastPaymentDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSchemeFileID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSchemeSubmissionID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubmissionDatetime(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": "fc0703f7b6067ce1ddd19587e837228b", "score": "0.5943529", "text": "func (w Warrant) Validate() error {\n\tif len(w.FirstName) == 0 {\n\t\treturn errors.New(\"missing first name element\")\n\t}\n\tif len(w.LastName) == 0 {\n\t\treturn errors.New(\"missing last name element\")\n\t}\n\tif len(w.Civility) == 0 {\n\t\treturn errors.New(\"missing civility element\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "520b9a30a84f3e4bc345316bc39bb740", "score": "0.58816344", "text": "func (mt *EasypostFieldObject) Validate() (err error) {\n\tif mt.Key == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"key\"))\n\t}\n\tif mt.Value == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"value\"))\n\t}\n\tif mt.Visibility == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"visibility\"))\n\t}\n\tif mt.Label == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"label\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7abc8f860e04a3e793fc4831cde0da76", "score": "0.5876177", "text": "func (u *Usecase) validFields(d *Device) error {\n\tif d.Name == \"\" {\n\t\treturn &InvalidError{\"attribute `Name` must not be empty\"}\n\t}\n\n\tif d.User == 0 {\n\t\treturn &InvalidError{\"invalid user\"}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a16f84617d6e80489e02f4fb8c306f45", "score": "0.5868873", "text": "func (m *LicenseAttributeDTO) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a909f455c72680cbd59f15c3bd038f12", "score": "0.5800012", "text": "func (m *AdviceSubmissionAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubmissionDatetime(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTransactionStartDatetime(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": "e3b307b81dc3eae6e6204570781cda04", "score": "0.57866967", "text": "func IsValid(document *map[string]string) bool {\n\treturn AllFieldsPresent(document) && \n\t\tIsValidByr((*document)[\"byr\"]) &&\n\t\tIsValidEcl((*document)[\"ecl\"]) &&\n\t\tIsValidEyr((*document)[\"eyr\"]) &&\n\t\tIsValidHcl((*document)[\"hcl\"]) &&\n\t\tIsValidHgt((*document)[\"hgt\"]) &&\n\t\tIsValidIyr((*document)[\"iyr\"]) &&\n\t\tIsValidPid((*document)[\"pid\"])\n}", "title": "" }, { "docid": "b931d270cf0c9baadc2ac9459f4441a8", "score": "0.5780314", "text": "func (m *MandateAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAmount(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBeneficiaryParty(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDebtorParty(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFrequency(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProcessingDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSchemeProcessingDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(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": "7594832fd4a91485fc9a0a7e1155b122", "score": "0.5772096", "text": "func (m *FamilyAttributeRequirements) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "faee81f798005e9cd19eb6b489541b67", "score": "0.576223", "text": "func (fi *FeatureInfo) Valid() error {\n\treturn nil\n}", "title": "" }, { "docid": "6f8885ec7d028516f41d3e18c87f72fb", "score": "0.57575667", "text": "func (c *Compiler) validateAttributes(attributes ObjectExpr) ([]string, error) {\n\tvalidAttributes := map[string]Type{\n\t\tnameAttr: StringType,\n\t\tdescriptionAttr: StringType,\n\t\timportsAttr: ObjectType,\n\t\tinputSchemaAttr: ObjectType,\n\t}\n\tvar missingAttrs []string\n\tvar err error\n\tfor k, v := range attributes {\n\t\tvalidType, found := validAttributes[k]\n\t\tif !found {\n\t\t\terr = multierror.Append(err, fmt.Errorf(\"unknown attribute %s\", k))\n\t\t} else {\n\t\t\tdelete(validAttributes, k)\n\t\t}\n\t\tt := v.Type()\n\t\tif t != validType {\n\t\t\te := fmt.Errorf(\"invalid type for %s: wanted %s but found %s\",\n\t\t\t\tk, typeRepr[validType], typeRepr[t])\n\t\t\terr = multierror.Append(err, e)\n\t\t}\n\t}\n\tif len(validAttributes) != 0 {\n\t\tfor k := range validAttributes {\n\t\t\te := fmt.Errorf(\"required attribute %s is not defined\", k)\n\t\t\terr = multierror.Append(err, e)\n\t\t\tmissingAttrs = append(missingAttrs, k)\n\t\t}\n\t}\n\treturn missingAttrs, err\n}", "title": "" }, { "docid": "c3e4f95e85f8a5a0284d6679bfbe7ad9", "score": "0.5732859", "text": "func (m *RequestAttribute) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAggregation(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateConfidential(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDataSources(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDataType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEnabled(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.validateMetadata(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNormalization(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSkipPersonalDataMasking(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": "05c1fbb0de887e3cc9694f8d86c71670", "score": "0.56716913", "text": "func (m *Metric) Valid() error {\n\tif m.ID == \"\" {\n\t\treturn fmt.Errorf(\"attribute ID not set in %v\", *m)\n\t}\n\tif m.Name == \"\" {\n\t\treturn fmt.Errorf(\"attribute Name not set in %v\", *m)\n\t}\n\tif m.Category == \"\" {\n\t\treturn fmt.Errorf(\"attribute Category not set in %v\", *m)\n\t}\n\tif m.Description == \"\" {\n\t\treturn fmt.Errorf(\"attribute Description not set in %v\", *m)\n\t}\n\tif m.Operation == \"\" {\n\t\treturn fmt.Errorf(\"attribute Operation not set in %v\", *m)\n\t}\n\tif m.BaseIndex == \"\" {\n\t\treturn fmt.Errorf(\"attribute BaseIndex not set in %v\", *m)\n\t}\n\tif m.IndexSplit == \"\" {\n\t\treturn fmt.Errorf(\"attribute IndexSplit not set in %v\", *m)\n\t}\n\tif m.Function == \"\" {\n\t\treturn fmt.Errorf(\"attribute Function not set in %v\", *m)\n\t}\n\tif m.Metadata == nil {\n\t\tm.Metadata = make(map[string]string)\n\t}\n\tif _, supported := supportedOperations[m.Operation]; !supported {\n\t\treturn fmt.Errorf(\n\t\t\t\"attribute Operation has unsupported value: %s, metric: %v\",\n\t\t\tm.Operation, *m,\n\t\t)\n\t}\n\tif _, supported := supportedIndexSplit[m.IndexSplit]; !supported {\n\t\treturn fmt.Errorf(\n\t\t\t\"attribute IndexSplit has unsupported value: %s, metric: %v\",\n\t\t\tm.IndexSplit, *m,\n\t\t)\n\t}\n\tif _, supported := supportedFuctions[m.Function]; !supported {\n\t\treturn fmt.Errorf(\n\t\t\t\"attribute Function has unsupported value: %s, metric: %v\",\n\t\t\tm.Function, *m,\n\t\t)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e15953ebdab40061d0d1aff469c9961", "score": "0.5564788", "text": "func (recipe *Recipe) Validate() error {\n\tvalidate := validator.New()\n\treturn validate.Struct(recipe)\n}", "title": "" }, { "docid": "ecd4b212f829597b84503a3ec8182309", "score": "0.5547313", "text": "func (m *DockerAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateForceBasicAuth(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateV1Enabled(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": "e73b151ed3c22013fc2b291eddffe67e", "score": "0.5542807", "text": "func validateAttribute(attr Attribute) error {\n\tswitch k := reflect.TypeOf(attr.Value).Kind(); k {\n\tcase\n\t\treflect.Bool,\n\t\treflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n\t\treflect.Float32, reflect.Float64,\n\t\treflect.String:\n\t\treturn nil\n\tdefault:\n\t\t// also allow time\n\t\tif _, ok := attr.Value.(time.Time); ok {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"attribute %s is invalid type: %s\", attr.Name, k.String())\n\t}\n}", "title": "" }, { "docid": "28c88129a21a10f3714232fa0c7a0bad", "score": "0.54914266", "text": "func (g *GLTF) validateAccessorAttribute(ac Accessor, attribName string) error {\n\n\tparts := strings.Split(attribName, \"_\")\n\tsemantic := parts[0]\n\n\tusage := \"attribute \" + attribName\n\n\tif attribName == \"POSITION\" {\n\t\treturn g.validateAccessor(ac, usage, []string{VEC3}, []int{FLOAT})\n\t} else if attribName == \"NORMAL\" {\n\t\treturn g.validateAccessor(ac, usage, []string{VEC3}, []int{FLOAT})\n\t} else if attribName == \"TANGENT\" {\n\t\t// Note that morph targets only support VEC3 whereas normal attributes only support VEC4.\n\t\treturn g.validateAccessor(ac, usage, []string{VEC3, VEC4}, []int{FLOAT})\n\t} else if semantic == \"TEXCOORD\" {\n\t\treturn g.validateAccessor(ac, usage, []string{VEC2}, []int{FLOAT, UNSIGNED_BYTE, UNSIGNED_SHORT})\n\t} else if semantic == \"COLOR\" {\n\t\treturn g.validateAccessor(ac, usage, []string{VEC3, VEC4}, []int{FLOAT, UNSIGNED_BYTE, UNSIGNED_SHORT})\n\t} else if semantic == \"JOINTS\" {\n\t\treturn g.validateAccessor(ac, usage, []string{VEC4}, []int{UNSIGNED_BYTE, UNSIGNED_SHORT})\n\t} else if semantic == \"WEIGHTS\" {\n\t\treturn g.validateAccessor(ac, usage, []string{VEC4}, []int{FLOAT, UNSIGNED_BYTE, UNSIGNED_SHORT})\n\t} else {\n\t\treturn fmt.Errorf(\"attribute %v is not supported\", attribName)\n\t}\n}", "title": "" }, { "docid": "e79f9dc53a78cab42e6582169b2a374a", "score": "0.5474243", "text": "func (m *ContainerAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBANK(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCREDITCARD(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateINSURANCE(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateINVESTMENT(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLOAN(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": "0bdd46b67e2d04536381fecce044fd69", "score": "0.5458892", "text": "func (ut *JSONDataMetaStation) Validate() (err error) {\n\tif ut.ID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"id\"))\n\t}\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\tif ut.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"modules\"))\n\t}\n\tif ut.Firmware == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"firmware\"))\n\t}\n\tif ut.Firmware != nil {\n\t\tif err2 := ut.Firmware.Validate(); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range ut.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "848956852ceac4336b24bfbdc303286a", "score": "0.5457435", "text": "func (o *conversionOptions) validate() error {\r\n\tif o.goalID == 0 && len(o.goalName) == 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute(s): %s or %s\", fieldID, fieldName)\r\n\t} else if o.goalID == 0 && o.tonicPowUserID > 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute: %s\", fieldID)\r\n\t} else if o.tonicPowUserID == 0 && len(o.tncpwSession) == 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute(s): %s or %s\", fieldVisitorSessionGUID, fieldUserID)\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "cafe54b0662ac34d670440fc45d46b13", "score": "0.54483044", "text": "func (ap *AttackPattern) Valid() (valid bool, errs []error) {\n\tov, err := ap.Object.Valid()\n\tif !ov {\n\t\terrs = append(errs, fmt.Errorf(\"Invalid Object: %v\", err))\n\t}\n\n\tif ap.Type != attackPatternType {\n\t\terrs = append(errs, fmt.Errorf(\"Field 'type' is %s, should be %s\", ap.Type, attackPatternType))\n\t}\n\n\tif ap.Name == \"\" {\n\t\terrs = append(errs, fmt.Errorf(\"Field 'name' required for %s\", attackPatternType))\n\t}\n\n\tfor _, kcp := range ap.KillChainPhases {\n\t\t_, newErrs := kcp.Valid()\n\t\tif len(newErrs) != 0 {\n\t\t\terrs = append(errs, newErrs...)\n\t\t}\n\t}\n\n\tif len(errs) == 0 {\n\t\tvalid = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "fabf1210b62d213fe6840bb2103d6dbf", "score": "0.54456586", "text": "func (b *batInfo) validate() error {\n\tif b.ModelType != \"C\" && b.ModelType != \"R\" {\n\t\treturn fmt.Errorf(\"Invalid Model Type: %v\", b.ModelType)\n\t}\n\n\tif !checkSize(b.FirmwareVersion, 1, 2) {\n\t\treturn fmt.Errorf(\"Invalid Firmware Version: %v\", b.FirmwareVersion)\n\t}\n\n\tif !checkSize(b.SerialNumber, 1, 4) {\n\t\treturn fmt.Errorf(\"Invalid Serial Number: %v\", b.SerialNumber)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8be91cf744f18dc72c751cf10eb51ac4", "score": "0.5444861", "text": "func (ut *jSONDataMeta) Validate() (err error) {\n\tif ut.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"id\"))\n\t}\n\tif ut.Station != nil {\n\t\tif err2 := ut.Station.Validate(); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "365d72a71113b0d99b8642e13dbb78c3", "score": "0.5439908", "text": "func (frm entryForm) Validate() (map[string]string, bool) {\n\terrs := map[string]string{}\n\tg1 := frm.Department != \"\"\n\tif !g1 {\n\t\terrs[\"department\"] = \"Missing department\"\n\t}\n\tg2 := frm.CheckThis\n\tif !g2 {\n\t\terrs[\"check_this\"] = \"You need to comply\"\n\t}\n\tg3 := frm.Items != \"\"\n\tif !g3 {\n\t\terrs[\"items\"] = \"No items\"\n\t}\n\treturn errs, g1 && g2 && g3\n}", "title": "" }, { "docid": "5c2524e2e899924474742071e9798ae9", "score": "0.5433733", "text": "func Validate(instance interface{}) string {\n\tval := unwrap(reflect.ValueOf(instance))\n\ttyp := val.Type()\n\n\tif typ.Kind() != reflect.Struct {\n\t\tcore.DefaultLogger.Panic(\"The provided instance is not a struct\")\n\t}\n\n\tvar result []string\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\t\tfieldTag := field.Tag\n\t\tif len(fieldTag) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldVal := val.Field(i)\n\t\tfieldKind := fieldVal.Kind()\n\t\tif !fieldVal.CanInterface() || fieldKind == reflect.Invalid {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar toEval []evalContext\n\t\tvar requiredCtx *evalContext\n\n\t\tfor _, v := range validators {\n\t\t\tif param, found := fieldTag.Lookup(v.key); found {\n\t\t\t\tctx := evalContext{validator: v, param: param}\n\n\t\t\t\tif v.key == required.key {\n\t\t\t\t\trequiredCtx = &ctx\n\t\t\t\t} else {\n\t\t\t\t\ttoEval = append(toEval, ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(toEval) == 0 && requiredCtx == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif requiredCtx == nil {\n\t\t\trequiredCtx = &evalContext{validator: required, param: \"true\"}\n\t\t}\n\n\t\tvar errors []string\n\t\teval := func(ctx evalContext) bool {\n\t\t\tif err := ctx.validator.fn(fieldVal, ctx.param); len(err) > 0 {\n\t\t\t\terrors = append(errors, err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif eval(*requiredCtx) {\n\t\t\tfor _, ctx := range toEval {\n\t\t\t\teval(ctx)\n\t\t\t}\n\t\t}\n\n\t\tif len(errors) > 0 {\n\t\t\tresult = append(result, fmt.Sprintf(\"%s: %s\", field.Name, strings.Join(errors, \", \")))\n\t\t}\n\t}\n\n\treturn strings.Join(result, \"; \")\n}", "title": "" }, { "docid": "e39d33a2cdbbffdeddb001e84bedd70c", "score": "0.5418789", "text": "func (v *ClassValue) Valid() bool {\n\tfor _, f := range v.Fields {\n\t\tif !f.Valid() {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "930b17bc315c00f95433fe2de6acc977", "score": "0.54169875", "text": "func (f *InfoField) Validate() error {\n\tif err := f.BWCls.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.RLC.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.Idx.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := f.PathType.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c99232dcd88f9c8c12da8568a18cc493", "score": "0.541637", "text": "func (list FieldAttrList) IsConformant() bool {\n\treturn list.Contains(\"min_is\", \"max_is\", \"size_is\")\n}", "title": "" }, { "docid": "a97c3087910292bea469d0e00d78455f", "score": "0.54071015", "text": "func (m *Principal_Attribute) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tswitch m.AttributeSpec.(type) {\n\n\tcase *Principal_Attribute_Service:\n\t\t// no validation rules for Service\n\n\tcase *Principal_Attribute_SourceIps:\n\n\t\tif v, ok := interface{}(m.GetSourceIps()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn Principal_AttributeValidationError{\n\t\t\t\t\tField: \"SourceIps\",\n\t\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\t\tCause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase *Principal_Attribute_Header:\n\n\t\tif v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn Principal_AttributeValidationError{\n\t\t\t\t\tField: \"Header\",\n\t\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\t\tCause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "886c40242ead1d9ebd920c4b7bfc465b", "score": "0.5397722", "text": "func (a *Attribute) Validate() []error {\n\n\tvar errs []error\n\n\tif a.Required && a.DefaultValue == nil && a.ExampleValue == nil {\n\t\terrs = append(errs, fmt.Errorf(\"%s.spec: '%s' is required but has no default_value or example_value\", a.linkedSpecification.Model().RestName, a.Name))\n\t}\n\n\tif a.Description != \"\" && a.Description[len(a.Description)-1] != '.' && a.linkedSpecification != nil && a.linkedSpecification.Model() != nil {\n\t\terrs = append(errs, fmt.Errorf(\"%s.spec: description of attribute '%s' must end with a period\", a.linkedSpecification.Model().RestName, a.Name))\n\t}\n\n\tif a.Type == AttributeTypeEnum && len(a.AllowedChoices) == 0 {\n\t\terrs = append(errs, fmt.Errorf(\"%s.spec: enum attribute '%s' must define allowed_choices\", a.linkedSpecification.Model().RestName, a.Name))\n\t}\n\n\tif a.AllowedChars != \"\" && a.AllowedCharsMessage == \"\" && a.linkedSpecification != nil && a.linkedSpecification.Model() != nil {\n\t\terrs = append(errs, fmt.Errorf(\"%s.spec: attribute '%s' must define allowed_chars_message\", a.linkedSpecification.Model().RestName, a.Name))\n\t}\n\n\tif a.Signed && (a.Autogenerated || a.Transient || a.ReadOnly) {\n\t\terrs = append(errs, fmt.Errorf(\"%s.spec: attribute '%s' cannot be use for signature if it is autogenerated, transient, read only or not exposed\", a.linkedSpecification.Model().RestName, a.Name))\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "baf7c3e3cd3b8785f057d80d0a347d29", "score": "0.5396931", "text": "func (df *DateFilter) Validate() error {\n\tdf.defaultAttribute()\n\n\tif !df.attributeValid() {\n\t\treturn fmt.Errorf(\"Attribute is required one of %v\", validAttributes)\n\t}\n\n\tif df.Custom != \"\" && df.Unit != \"\" && df.Past != 0 {\n\t\treturn errors.New(\"Can't use both the unit, past and custom either unit & past or custom on its own\")\n\t}\n\n\tif df.Custom == \"\" && df.Unit == \"\" && df.Past == 0 {\n\t\treturn errors.New(\"Date range or custom input is required\")\n\t}\n\n\tif df.Unit != \"\" && df.Past == 0 {\n\t\treturn errors.New(\"Past is required to determine how many units to go into the past from today\")\n\t}\n\n\tif !df.unitValid() && df.Past != 0 {\n\t\treturn fmt.Errorf(\"Unit is required one of %v\", validCalendarUnits)\n\t}\n\n\tif df.Custom != \"\" && !df.customValid() {\n\t\treturn errors.New(\"Custom input requires the operator one of [< : >]\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5798fb0e08f126d3b16fcd73d31f24c4", "score": "0.53804076", "text": "func (p *Publication) IsValidFields() error {\n\tif p.Content != \"\" {\n\t\treturn nil\n\t}\n\treturn errorstatus.ErrorBadInfo\n\n}", "title": "" }, { "docid": "aed73124f2d0346fc7ebc80bf6e3457a", "score": "0.537728", "text": "func (m *MandateSubmissionCreationData) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAttributes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreatedOn(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.validateModifiedOn(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrganisationID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVersion(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": "870cdfc8fe9e7b1b670955fe3c4f970a", "score": "0.5376015", "text": "func (DirectorBindStrategy) Validate(ctx request.Context, obj runtime.Object) field.ErrorList {\n\to := obj.(*bind.DirectorBind)\n\tlog.Printf(\"Validating fields for DirectorBind %s\\n\", o.Name)\n\terrors := field.ErrorList{}\n\t// perform validation here and add to errors using field.Invalid\n\treturn errors\n}", "title": "" }, { "docid": "501ff8c247f1acdb675b1cf9aa1b196c", "score": "0.53660285", "text": "func (r Record) validate(now time.Time) error {\n\tvar err error\n\n\t// Validate that certain fields are set.\n\tif r.Organization == \"\" {\n\t\terr = errorset.Append(err, errors.New(\"missing Organization\"))\n\t}\n\tif r.Environment == \"\" {\n\t\terr = errorset.Append(err, errors.New(\"missing Environment\"))\n\t}\n\tif r.GatewayFlowID == \"\" {\n\t\terr = errorset.Append(err, errors.New(\"missing GatewayFlowID\"))\n\t}\n\tif r.ClientReceivedStartTimestamp == 0 {\n\t\terr = errorset.Append(err, errors.New(\"missing ClientReceivedStartTimestamp\"))\n\t}\n\tif r.ClientReceivedEndTimestamp == 0 {\n\t\terr = errorset.Append(err, errors.New(\"missing ClientReceivedEndTimestamp\"))\n\t}\n\tif r.ClientReceivedStartTimestamp > r.ClientReceivedEndTimestamp {\n\t\terr = errorset.Append(err, errors.New(\"ClientReceivedStartTimestamp > ClientReceivedEndTimestamp\"))\n\t}\n\n\t// Validate that timestamps make sense.\n\tts := time.Unix(r.ClientReceivedStartTimestamp/1000, 0)\n\tif ts.After(now.Add(time.Minute)) { // allow a minute of tolerance\n\t\terr = errorset.Append(err, errors.New(\"ClientReceivedStartTimestamp cannot be in the future\"))\n\t}\n\tif ts.Before(now.Add(-90 * 24 * time.Hour)) {\n\t\terr = errorset.Append(err, errors.New(\"ClientReceivedStartTimestamp cannot be more than 90 days old\"))\n\t}\n\n\tfor _, attr := range r.Attributes {\n\t\tif validateErr := validateAttribute(attr); validateErr != nil {\n\t\t\terr = errorset.Append(err, validateErr)\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "2ce6c2d3bd1ee2f709f629efe3a52db0", "score": "0.5325467", "text": "func (m *ModelAttr) Validate(val interface{}) error {\n\tmot := reflect.TypeOf(val)\n\n\t//is it a pointer,get the element\n\tif mot.Kind() == reflect.Ptr {\n\t\tmot = mot.Elem()\n\t}\n\n\t// switch m.dtype.Kind() {\n\t// case reflect.Array:\n\t// case reflect.Slice:\n\t// case reflect.Map:\n\t// \tmapo := reflect.ValueOf(val)\n\t//\n\t// \tif mapo.Kind() == reflect.Ptr {\n\t// \t\tmapo = mapo.Elem()\n\t// \t}\n\t//\n\t//\n\t//\n\t// default:\n\t//we must first if we are not dealing with a pointer or interface if so,use normal == equality checks and AssignableTo else we can do more by checking if it implements the type and the standard checks\n\tif mot.Kind() != reflect.Interface && mot.Kind() != reflect.Ptr {\n\t\t//are the types the same or can the type be interused\n\t\tif mot != m.dtype && !mot.AssignableTo(m.dtype) {\n\t\t\treturn ErrTypeMisMatch\n\t\t}\n\t} else {\n\t\t//is this a implements relationship? or Assignable or equality?\n\t\tif !mot.Implements(m.dtype) && !mot.AssignableTo(m.dtype) && mot != m.dtype {\n\t\t\treturn ErrTypeMisMatch\n\t\t}\n\t}\n\t// }\n\n\treturn nil\n}", "title": "" }, { "docid": "3e4483815785033dbd9e1468ce918cb1", "score": "0.5324969", "text": "func (d *UpdateDTO) Validate() error {\n\treturn v.ValidateStruct(d, v.Field(&d.IsForeman, v.Skip.When(d.IsForeman == nil)))\n}", "title": "" }, { "docid": "f66019ac0b64c3f034a004098aa548ac", "score": "0.5324084", "text": "func Validate(r *http.Request, f Form) (bool, error) {\n\t// Copy the body to a buffer so we can use it twice\n\tbuf := new(bytes.Buffer)\n\tif _, err := buf.ReadFrom(r.Body); err != nil {\n\t\treturn false, errors.New(err)\n\t}\n\tnbuf := ioutil.NopCloser(bytes.NewBuffer(buf.Bytes()))\n\tr.Body = nbuf\n\n\tm := make(map[string]interface{})\n\tif err := json.NewDecoder(buf).Decode(&m); err != nil {\n\t\treturn false, errors.New(err)\n\t}\n\n\tfields := f.Fields()\n\tvalidations := f.Validations()\n\tfor _, field := range fields {\n\t\tid := getId(field)\n\t\tif id == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip fields without validation constrainst\n\t\tif _, ok := validations[id]; !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tvalue := normalizeValue(id, m)\n\t\tfor _, val := range validations[id] {\n\t\t\tif !val.Func(value) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\t\tf.SetValue(id, value)\n\t}\n\n\tif err := json.NewDecoder(r.Body).Decode(f); err != nil {\n\t\treturn false, errors.New(err)\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "970b621e843b692a55609d9ba9eaee7a", "score": "0.53220683", "text": "func (payload *createItemPayload) Validate() (err error) {\n\tif payload.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"name\"))\n\t}\n\tif payload.Description == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"description\"))\n\t}\n\tif payload.Price == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"price\"))\n\t}\n\tif payload.Compensation == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"compensation\"))\n\t}\n\tif payload.CategoryID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"category_id\"))\n\t}\n\tif payload.PlaceID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"place_id\"))\n\t}\n\tif payload.Image1 == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"image1\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3ccddd9599a855e04041407741990ac8", "score": "0.53204566", "text": "func (cha *ChainAttributes) Validate() error {\n\tif cha.Type == \"\" {\n\t\treturn fmt.Errorf(\"base chain must have type set\")\n\t}\n\t// TODO Add additional attributes validation\n\n\treturn nil\n}", "title": "" }, { "docid": "56459e4fca3628ff5362ab9c90f6119f", "score": "0.5318078", "text": "func (c Create) Validate(_ context.Context, tx goes.Tx, agg goes.Aggregate) error {\n\t// user := *agg.(*User)\n\t// _ = user\n\treturn validateFirstName(c.FirstName)\n}", "title": "" }, { "docid": "468199fa45e30a5fb60c11763db6a400", "score": "0.5310865", "text": "func (w *Workflow) Validate(ctx context.Context) *apis.FieldError {\n\terrs := validate.ObjectMetadata(w.GetObjectMeta()).ViaField(\"metadata\")\n\treturn errs.Also(w.Spec.Validate(apis.WithinSpec(ctx)).ViaField(\"spec\"))\n}", "title": "" }, { "docid": "9c9d58a12e9bb37fac1f6a98964f28e0", "score": "0.5294326", "text": "func (mt *Vironpage) Validate() (err error) {\n\tif mt.ID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"id\"))\n\t}\n\tif mt.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"name\"))\n\t}\n\tif mt.Section == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"section\"))\n\t}\n\tif mt.Group == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"group\"))\n\t}\n\tif mt.Components == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"components\"))\n\t}\n\tfor _, e := range mt.Components {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "57bb00297fac0e503a3af590ca093c3a", "score": "0.5291768", "text": "func (commit ObjectCommit) Validate() error {\n\tif commit.FormID == 0 {\n\t\treturn fmt.Errorf(errFieldMustBeGreaterThanZero, \"FormID\")\n\t} else if commit.ShadowID == 0 {\n\t\treturn fmt.Errorf(errFieldMustBeGreaterThanZero, \"ShadowID\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b28f8f3971579b4a85de97f6bcb6e541", "score": "0.5285757", "text": "func (BeeStrategy) Validate(ctx request.Context, obj runtime.Object) field.ErrorList {\n\to := obj.(*insect.Bee)\n\tlog.Printf(\"Validating fields for Bee %s\\n\", o.Name)\n\terrors := field.ErrorList{}\n\t// perform validation here and add to errors using field.Invalid\n\treturn errors\n}", "title": "" }, { "docid": "4c20fddd233980012cbdb3e7bc3a5d95", "score": "0.52707803", "text": "func (ut *JSONDataMeta) Validate() (err error) {\n\tif ut.Station != nil {\n\t\tif err2 := ut.Station.Validate(); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8fd752c5a6a3964159dd5c0bebe7e413", "score": "0.52686715", "text": "func (r *InfoReq) Validate() error {\n\treturn validate.Struct(r)\n}", "title": "" }, { "docid": "42c02ab3faa5cc7f31a5e9a196e99ea3", "score": "0.5260258", "text": "func Validate(obj interface{}) (map[string]interface{}, bool) {\n\n\trules := govalidator.MapData{\n\t\t\"name\": []string{\"required\", \"between:3,150\"},\n\t\t//\"email\": []string{\"required\", \"min:4\", \"max:20\", \"email\"},\n\t\t//\"web\": []string{\"url\"},\n\t\t//\"age\": []string{\"numeric_between:18,56\"},\n\t}\n\n\treturn validate.Validate(rules, obj)\n}", "title": "" }, { "docid": "9273e52e7c51d67eb93882564f14ead2", "score": "0.5259871", "text": "func (m *GaragesCreateBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCentreID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLocations(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(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": "37cb8d4e58e87dec3cda4241d2c7ea13", "score": "0.5250302", "text": "func (strategy UpdateScatterStrategy) FieldsValidation() error {\n\tif len(strategy) == 0 {\n\t\treturn nil\n\t}\n\n\tm := make(map[string]struct{}, len(strategy))\n\tfor _, term := range strategy {\n\t\tif term.Key == \"\" {\n\t\t\treturn fmt.Errorf(\"key should not be empty\")\n\t\t}\n\t\tid := term.Key + \":\" + term.Value\n\t\tif _, ok := m[id]; !ok {\n\t\t\tm[id] = struct{}{}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"duplicated key=%v value=%v\", term.Key, term.Value)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39cf0a1500868b31a4c930aea97e3eff", "score": "0.52486235", "text": "func (mod ModGenerational) Validate() error {\n\t// Check the selection method presence\n\tif mod.Selector == nil {\n\t\treturn errors.New(\"'Selector' cannot be nil\")\n\t}\n\t// Check the crossover method presence\n\tif mod.Crossover == nil {\n\t\treturn errors.New(\"'Crossover' cannot be nil\")\n\t}\n\t// Check the mutation rate in the presence of a mutator\n\tif mod.Mutator != nil && (mod.MutRate < 0 || mod.MutRate > 1) {\n\t\treturn errors.New(\"'MutRate' should belong to the [0, 1] interval\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6621fa7e3ebd0894c667286c26d1c63", "score": "0.52472335", "text": "func (m *RecallDecisionSubmissionAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubmissionDatetime(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": "9f3e562ad0eeab95d6706020a86163a4", "score": "0.5243484", "text": "func (a Association) IsValid() bool {\n\tvalid := true\n\n\treturn valid\n}", "title": "" }, { "docid": "369eea7ba30fb739ddf1430cd39e53c8", "score": "0.52292943", "text": "func (m *AdviceSubmission) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAttributes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreatedOn(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.validateModifiedOn(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrganisationID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRelationships(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVersion(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": "b65acc56cc36cc19e27536cf6b1b270c", "score": "0.52290094", "text": "func (payload *createFilterPayload) Validate() (err error) {\n\tif payload.Alias == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"alias\"))\n\t}\n\tif payload.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"name\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "bcb1398a79d341f27e0cb7318428ea27", "score": "0.52216494", "text": "func (object Asset) Validate() error {\n\terrs := validate.Struct(object)\n\tif errs != nil {\n\t\treturn fmt.Errorf(\"%v\", errs)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "35c17ac92444708e58f07d88a9e27d08", "score": "0.522015", "text": "func (m *CatalogObject) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCatalogV1Ids(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCategoryData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCustomAttributeDefinitionData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCustomAttributeValues(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDiscountData(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.validateImageData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateItemData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateItemOptionData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateItemOptionValueData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateItemVariationData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMeasurementUnitData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateModifierData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateModifierListData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePricingRuleData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProductSetData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQuickAmountsSettingsData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionPlanData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTaxData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTimePeriodData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(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": "34c4a40c4ea0a27568771d23afbfcaab", "score": "0.5217932", "text": "func (mt *EasypostCarrierdetail) Validate() (err error) {\n\tif mt.Object == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"object\"))\n\t}\n\n\tif ok := goa.ValidatePattern(`^CarrierDetail$`, mt.Object); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.object`, mt.Object, `^CarrierDetail$`))\n\t}\n\treturn\n}", "title": "" }, { "docid": "131fe93291da8ae83fa66755a66f8b50", "score": "0.52033705", "text": "func (m Metadata) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "56c885dca35cbb28c9260035d5519528", "score": "0.520284", "text": "func (b *batData) validate() error {\n\tif !checkSize(b.HighestCellVoltage, voltFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid Highest Cell Voltage: %v\", b.HighestCellVoltage)\n\t}\n\n\tif !checkSize(b.LowestCellVoltage, voltFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid Lowest Cell Voltage: %v\", b.LowestCellVoltage)\n\t}\n\n\tif !checkSize(b.SysMaxTemperature, tempFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid System Max Temperature: %v\", b.SysMaxTemperature)\n\t}\n\n\tif !checkSize(b.SysAvgTemperature, tempFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid System Average Temperature: %v\", b.SysAvgTemperature)\n\t}\n\n\tif !checkSize(b.SysMinTemperature, tempFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid System Min Temperature: %v\", b.SysMinTemperature)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "629f57f5f894e9e1d8dbefcdd3a43aed", "score": "0.5190291", "text": "func (m *Attr) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateValue(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": "071f8d9a64c4f9d9333f6e706af36d41", "score": "0.5187264", "text": "func hasValidations(attCtx *AttributeContext, ut expr.UserType) bool {\n\t// We need to check empirically whether there are validations to be\n\t// generated, we can't just generate and check whether something was\n\t// generated to avoid infinite recursions.\n\tres := false\n\tdone := errors.New(\"done\")\n\tWalk(ut.Attribute(), func(a *expr.AttributeExpr) error {\n\t\tif a.Validation == nil {\n\t\t\treturn nil\n\t\t}\n\t\tif attCtx.Pointer || !a.Validation.HasRequiredOnly() {\n\t\t\tres = true\n\t\t\treturn done\n\t\t}\n\t\tres = len(generatedRequiredValidation(a, attCtx)) > 0\n\t\tif res {\n\t\t\treturn done\n\t\t}\n\t\treturn nil\n\t})\n\treturn res\n}", "title": "" }, { "docid": "92cc37db2dc493da980463d834db7d47", "score": "0.5187075", "text": "func (fifi *FIAdditionalFIToFI) Validate() error {\n\tif fifi.tag != TagFIAdditionalFIToFI {\n\t\treturn fieldError(\"tag\", ErrValidTagForType, fifi.tag)\n\t}\n\tif err := fifi.isAlphanumeric(fifi.AdditionalFIToFI.LineOne); err != nil {\n\t\treturn fieldError(\"LineOne\", err, fifi.AdditionalFIToFI.LineOne)\n\t}\n\tif err := fifi.isAlphanumeric(fifi.AdditionalFIToFI.LineTwo); err != nil {\n\t\treturn fieldError(\"LineTwo\", err, fifi.AdditionalFIToFI.LineTwo)\n\t}\n\tif err := fifi.isAlphanumeric(fifi.AdditionalFIToFI.LineThree); err != nil {\n\t\treturn fieldError(\"LineThree\", err, fifi.AdditionalFIToFI.LineThree)\n\t}\n\tif err := fifi.isAlphanumeric(fifi.AdditionalFIToFI.LineFour); err != nil {\n\t\treturn fieldError(\"LineFour\", err, fifi.AdditionalFIToFI.LineFour)\n\t}\n\tif err := fifi.isAlphanumeric(fifi.AdditionalFIToFI.LineFive); err != nil {\n\t\treturn fieldError(\"LineFive\", err, fifi.AdditionalFIToFI.LineFive)\n\t}\n\tif err := fifi.isAlphanumeric(fifi.AdditionalFIToFI.LineSix); err != nil {\n\t\treturn fieldError(\"LineSix\", err, fifi.AdditionalFIToFI.LineSix)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "549a4ef25b1bc241e1b738b369000dac", "score": "0.51850176", "text": "func EnsureFields(f interface{}) error {\n\tl := reflect.ValueOf(f).NumField()\n\n\tfor i := 0; i < l; i++ {\n\t\tv := reflect.ValueOf(f)\n\t\tk := v.Field(i).Kind()\n\n\t\tif k != reflect.Ptr {\n\t\t\tt := v.Type()\n\n\t\t\tif IsEmpty(v.Field(i).Interface()) {\n\t\t\t\tr, _ := t.Field(i).Tag.Lookup(\"validate\")\n\t\t\t\tskipValidate := r == \"false\"\n\t\t\t\tif !t.Field(i).Anonymous && !skipValidate {\n\t\t\t\t\treturn fmt.Errorf(\"field %s required but missing in %s struct\", t.Field(i).Name, t.Name())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e8214dc4879efa30354f7e27a6453d7", "score": "0.5182429", "text": "func (m *HTTPClientAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAuthentication(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAutoBlock(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBlocked(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateConnection(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": "030b68d3129e74cec99ff39f0df585df", "score": "0.5176141", "text": "func (payload *createProfilePayload) Validate() (err error) {\n\tif payload.FirstName == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"first_name\"))\n\t}\n\tif payload.LastName == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"last_name\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "dbd61587b3c6b940857d4bcf0abfef25", "score": "0.5174049", "text": "func (o Request) Valid() error {\n\tif len(o.GroupBy) == 0 {\n\t\treturn skerr.Fmt(\"at least one GroupBy value must be supplied.\")\n\t}\n\n\tvalid := false\n\tfor _, op := range AllOperations {\n\t\tif op == o.Operation {\n\t\t\tvalid = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !valid {\n\t\treturn skerr.Fmt(\"invalid Operation value: %q\", o.Operation)\n\t}\n\n\tvalid = false\n\tfor _, incomingOp := range o.Summary {\n\t\tfor _, op := range AllOperations {\n\t\t\tif op == incomingOp {\n\t\t\t\tvalid = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !valid {\n\t\t\treturn skerr.Fmt(\"invalid Summary value: %q\", incomingOp)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5aa63f4ab39cc071518771ca4a79b27", "score": "0.5169418", "text": "func (mt *Patient) Validate() (err error) {\n\tif mt.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"name\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "fe90c8fecc9fce3a747090f539ead690", "score": "0.5161942", "text": "func (fd FileDescriptor) Validate() (errors []error) {\n\terrors = append(errors, fd.Creation.Validate(fmt.Sprintf(\"creation date/time of FileDescriptor %q\", fd.Name()))...)\n\terrors = append(errors, fd.LastMod.Validate(fmt.Sprintf(\"last modification date/time of FileDescriptor %q\", fd.Name()))...)\n\treturn errors\n}", "title": "" }, { "docid": "263d3fbfa3efb53437aa2f729be35e11", "score": "0.51605195", "text": "func (m *Family) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAttributeAsLabel(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAttributeRequirements(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLabels(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": "67ee9593bec76b321e5973f7e843fde9", "score": "0.5158333", "text": "func (payload *CreateItemPayload) Validate() (err error) {\n\tif payload.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"name\"))\n\t}\n\tif payload.Description == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"description\"))\n\t}\n\n\tif payload.Image1 == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"image1\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "bfc579ea0c5041af86a051edeb559f47", "score": "0.5150395", "text": "func (m *meta) validate() error {\n\tif m.magic != magic {\n\t\treturn ErrInvalid\n\t} else if m.version != version {\n\t\treturn ErrVersionMismatch\n\t} else if m.checksum != m.sum64() {\n\t\treturn ErrChecksum\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5cf0e8ad256689d5dbcc9ad26168c387", "score": "0.5133745", "text": "func (mt *LatexArchive) Validate() (err error) {\n\tif mt.UUID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"uuid\"))\n\t}\n\tif mt.Filename == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"filename\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e89619346e69ce47d933cee62fe23c6b", "score": "0.51335776", "text": "func (m *BakerInfo) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9900fa7e2437b56b74b7bb0001d6d510", "score": "0.51313305", "text": "func (cv Validator) Validate(i interface{}) error {\n\treturn cv.Validator.Struct(i)\n}", "title": "" }, { "docid": "6ef24b869c2934bf8ff39f8c2f86cfe6", "score": "0.5130975", "text": "func (cfg fromCFN) validate() error {\n\tif cfg.isEmpty() {\n\t\treturn nil\n\t}\n\tif len(aws.StringValue(cfg.Name)) == 0 {\n\t\treturn errors.New(\"name cannot be an empty string\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "28de46380223ffa0a0521e6ef8cc3051", "score": "0.51308244", "text": "func (m *AttachmentInfo) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateViews(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": "49c2824aae55fffc3c402c6e17942ee6", "score": "0.51286125", "text": "func (ut *JSONDataMetaModule) Validate() (err error) {\n\tif ut.ID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"id\"))\n\t}\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\n\tfor _, e := range ut.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c90d8c7f2d2521ac3a8aacc43cb563f", "score": "0.5128113", "text": "func (i *infoOptions) validate() error {\n\t// date-field required\n\tif len(i.DateField) == 0 {\n\t\treturn errors.New(`date-field required`)\n\t}\n\n\t// date-field index value if sep is present\n\tif len(i.Sep) > 0 {\n\t\t// attempt to convert DateField to int\n\t\tvar err error\n\t\t_, err = strconv.Atoi(i.DateField)\n\t\tif err != nil {\n\t\t\treturn errors.New(`date-field must be an integer when using a csv field separator`)\n\t\t}\n\t}\n\n\t// dest-template required\n\tif i.DestTemplate == \"\" {\n\t\treturn errors.New(`dest-template required`)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e63d804833d040c58f64fd40d36a3d65", "score": "0.5128005", "text": "func (m *GetEdnaInstance) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateApps(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreditCards(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDevices(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInterests(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateKids(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLastLoginLocation(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLoginIds(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMessagingPreferences(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNewsletterCentreIds(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNewsletterCountries(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNewsletterSubscriptions(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePrimaryCentreCountry(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVehicles(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateZip(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": "53e8b7887843ccaf59c040d4a72a0192", "score": "0.5120188", "text": "func (s StructSpec) Validate() error {\n\tfor _, f := range s.Fields {\n\t\terr := f.Validate()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "955378c959fd1c3c389ab0ead59c979d", "score": "0.51199204", "text": "func (m *DirectDebitRecallSubmissionAttributes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubmissionDatetime(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": "c3728f4417075a163b816b37b18757e9", "score": "0.5115061", "text": "func Validate(ctx http.IContext, vld *validator.Validate, arg interface{}) bool {\n\n\tif err := ctx.GetRequest().GetBodyAs(arg); err != nil {\n\t\thttp.InternalServerException(ctx)\n\t\treturn false\n\t}\n\n\tswitch err := vld.Struct(arg); err.(type) {\n\tcase validator.ValidationErrors:\n\t\thttp.FailedValidationException(ctx, err.(validator.ValidationErrors))\n\t\treturn false\n\n\tcase nil:\n\t\tbreak\n\n\tdefault:\n\t\thttp.InternalServerException(ctx)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "eef71ad13b8505b88965f304602df696", "score": "0.51083034", "text": "func (m *Fulfilment) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDeliveryCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePickUpPoints(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(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": "ac473033b87d41a788e32853a1b53382", "score": "0.51073605", "text": "func (ut *jSONDataMetaStation) Validate() (err error) {\n\tif ut.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"id\"))\n\t}\n\tif ut.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"name\"))\n\t}\n\tif ut.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"modules\"))\n\t}\n\tif ut.Firmware == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"firmware\"))\n\t}\n\tif ut.Firmware != nil {\n\t\tif err2 := ut.Firmware.Validate(); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range ut.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f12a3c523133ae27116a20d3430dc937", "score": "0.5106215", "text": "func (r *ReconcileCanary) IsValid(obj metav1.Object) (bool, error) {\n\t//log.Info(fmt.Sprintf(\"IsValid? %s\", obj))\n\n\tcanary, ok := obj.(*kharonv1alpha1.Canary)\n\tif !ok {\n\t\terr := errors.NewBadRequest(errorNotACanaryObject)\n\t\tlog.Error(err, errorNotACanaryObject)\n\t\treturn false, err\n\t}\n\n\t// Check if TargetRef is empty\n\tif (kharonv1alpha1.Ref{}) == canary.Spec.TargetRef {\n\t\terr := errors.NewBadRequest(errorTargetRefEmpty)\n\t\tlog.Error(err, errorTargetRefEmpty)\n\t\treturn false, err\n\t}\n\n\t// Check if TargetRefContainerPort is empty\n\tif len(canary.Spec.TargetRefContainerPort.StrVal) <= 0 && canary.Spec.TargetRefContainerPort.IntVal <= 0 {\n\t\terr := errors.NewBadRequest(errorTargetRefContainerPortEmpty)\n\t\tlog.Error(err, errorTargetRefContainerPortEmpty)\n\t\treturn false, err\n\t}\n\n\t// Check kind of target\n\tif canary.Spec.TargetRef.Kind != \"Deployment\" && canary.Spec.TargetRef.Kind != \"DeploymentConfig\" {\n\t\terr := errors.NewBadRequest(errorTargetRefKind)\n\t\tlog.Error(err, errorTargetRefKind)\n\t\treturn false, err\n\t}\n\n\t// Check if ServiceName is empty\n\tif len(canary.Spec.ServiceName) <= 0 {\n\t\terr := errors.NewBadRequest(errorServiceNameEmpty)\n\t\tlog.Error(err, errorServiceNameEmpty)\n\t\treturn false, err\n\t}\n\n\t// Check if CanaryAnalysis is empty\n\tif (kharonv1alpha1.CanaryAnalysis{}) == canary.Spec.CanaryAnalysis {\n\t\terr := errors.NewBadRequest(errorCanaryAnalysisEmpty)\n\t\tlog.Error(err, errorCanaryAnalysisEmpty)\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "757eff1bb87ef76108c2dba925ec889c", "score": "0.51045775", "text": "func (property *Property) Validate() error {\n\tif property.Address == \"\" {\n\t\treturn errors.New(\"enter the address of the property\")\n\t}\n\tif property.Country == \"\" {\n\t\treturn errors.New(\"enter the country the property is in\")\n\t}\n\tif property.Available != \"Yes\" && property.Available != \"No\" {\n\t\treturn errors.New(\"only enter either yes or no for availability\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a9e4f5c4509a17589e22912c13e4851", "score": "0.5103129", "text": "func (payload *CreateFilterPayload) Validate() (err error) {\n\tif payload.Alias == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"alias\"))\n\t}\n\tif payload.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, \"name\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "794dedc95cd2119738ba5e346ba9fec4", "score": "0.5102904", "text": "func (r *HousingTypology) Valid() error {\n\tif r.Name == \"\" {\n\t\treturn fmt.Errorf(\"Nom vide\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87c51cb5970ffb764f08d0b314bb0296", "score": "0.5100998", "text": "func (t *Transaction) isValid() error {\n\tif t.Version > 0 && t.Version != DummyVersion {\n\t\treturn ErrInvalidVersion\n\t}\n\tif t.SystemFee < 0 {\n\t\treturn ErrNegativeSystemFee\n\t}\n\tif t.NetworkFee < 0 {\n\t\treturn ErrNegativeNetworkFee\n\t}\n\tif t.NetworkFee+t.SystemFee < t.SystemFee {\n\t\treturn ErrTooBigFees\n\t}\n\tif len(t.Signers) == 0 {\n\t\treturn ErrEmptySigners\n\t}\n\tfor i := 0; i < len(t.Signers); i++ {\n\t\tfor j := i + 1; j < len(t.Signers); j++ {\n\t\t\tif t.Signers[i].Account.Equals(t.Signers[j].Account) {\n\t\t\t\treturn ErrNonUniqueSigners\n\t\t\t}\n\t\t}\n\t}\n\tattrs := map[AttrType]bool{}\n\tfor i := range t.Attributes {\n\t\ttyp := t.Attributes[i].Type\n\t\tif !typ.allowMultiple() {\n\t\t\tif attrs[typ] {\n\t\t\t\treturn fmt.Errorf(\"%w: multiple '%s' attributes\", ErrInvalidAttribute, typ.String())\n\t\t\t}\n\t\t\tattrs[typ] = true\n\t\t}\n\t}\n\tif len(t.Script) == 0 {\n\t\treturn ErrEmptyScript\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8edf99b34258d041d7161d9a2e68c8cd", "score": "0.5100001", "text": "func (a *PersonArguments) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "219d29bc1657e4f20c6f66ab2c33a456", "score": "0.5099868", "text": "func (f *CreateReviewForm) Validate() map[string][]string {\n\terrors := make(map[string][]string)\n\n\tif f.PlaceID == \"\" {\n\t\terrors[\"placeID\"] = []string{\"placeID must be specified\"}\n\t}\n\n\tvalidBadges := make(map[string]bool)\n\tfor name, s := range f.Badges {\n\t\tif _, ok := Badges[name]; !ok {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tvalidBadges[name] = s\n\t\t}\n\t}\n\n\tif len(validBadges) == 0 {\n\t\terrors[\"badges\"] = []string{fmt.Sprintf(\"at least one valid badge is required per review. Acceptable badges: [ %v ]\", strings.Join(BadgeNames, \", \"))}\n\t}\n\n\tvalidate04Rating(errors, f.NoiseLevel, \"noiseLevel\")\n\tvalidate04Rating(errors, f.WifiRestrictions, \"wifiRestrictions\")\n\tvalidate04Rating(errors, f.WifiSpeed, \"wifiSpeed\")\n\tvalidate04Rating(errors, f.BeverageQuality, \"beverageQuality\")\n\tvalidate04Rating(errors, f.BeverageSelection, \"beverageSelection\")\n\n\tvalidate02Rating(errors, f.FoodOptions, \"foodOptionsLevel\")\n\n\treturn errors\n}", "title": "" }, { "docid": "37b7a5b7c066229399cdda424e08c7f2", "score": "0.5095106", "text": "func checkPreconditions(dictionary dictionary, attrs *mixerpb.Attributes) error {\n\tvar e *me.Error\n\n\tfor k := range attrs.StringAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k := range attrs.Int64Attributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k := range attrs.DoubleAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k := range attrs.BoolAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k := range attrs.TimestampAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k := range attrs.DurationAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k := range attrs.BytesAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\t}\n\n\tfor k, v := range attrs.StringMapAttributes {\n\t\tif _, present := dictionary[k]; !present {\n\t\t\te = me.Append(e, fmt.Errorf(\"attribute index %d is not defined in the current dictionary\", k))\n\t\t}\n\n\t\tfor k2 := range v.Map {\n\t\t\tif _, present := dictionary[k2]; !present {\n\t\t\t\te = me.Append(e, fmt.Errorf(\"string map index %d is not defined in the current dictionary\", k2))\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: we should catch the case where the same attribute is being repeated in different types\n\t// (that is, an attribute called FOO which is both an int and a string for example)\n\n\treturn e.ErrorOrNil()\n}", "title": "" }, { "docid": "d5943d60e80580a60e6ee0105c392a14", "score": "0.50908446", "text": "func (o *CreateProductUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b72a2a4f33597daf2d0bcb88ee347035", "score": "0.5086655", "text": "func (ut *JSONDataMetaSensor) Validate() (err error) {\n\tif ut.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"name\"))\n\t}\n\tif ut.Key == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"key\"))\n\t}\n\tif ut.UnitOfMeasure == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"unitOfMeasure\"))\n\t}\n\tif ut.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"ranges\"))\n\t}\n\tfor _, e := range ut.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7d76fbf39ce41628a0f74ac568f1e2ba", "score": "0.5085675", "text": "func (m *S) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validatePerson(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": "b6136764545b4c4bc6ff0a23a3f6da98", "score": "0.5083651", "text": "func (v Volume) validate() error {\n\tif err := v.EFS.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"efs\": %w`, err)\n\t}\n\treturn v.MountPointOpts.validate()\n}", "title": "" }, { "docid": "a5317c9c261378e0c192f9bf5c9d2a52", "score": "0.5080646", "text": "func checkStructFieldsRequired(vo reflect.Value, parent string) error {\n\tfor i := 0; i < vo.NumField(); i++ {\n\t\tif err := checkIfRequired(\n\t\t\tvo.Field(i),\n\t\t\tchildString(parent, vo.Type().Field(i).Name),\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
25a95504d804da3f06f646c8d3991b69
QueryByIDForAnswer attempts to find a challenge with a matching ID field. Selects the Solution and Status fields from the db. Returns the sql.ErrNoRows error if no matching challenges were found.
[ { "docid": "501cc1a4c82d44602a2db8204c708b5c", "score": "0.85832334", "text": "func (c *Challenge) QueryByIDForAnswer(db *sqlx.DB) error {\n\treturn db.Get(c, \"SELECT solution, status FROM challenges WHERE id = $1\",\n\t\tc.ID)\n}", "title": "" } ]
[ { "docid": "6866418d50bb407bdae47f86d7a6e801", "score": "0.647163", "text": "func (ansRepo *AnswerGormRepo) Answer(id string) (*entities.Answer, []error) {\n\tqstn := entities.Answer{}\n\terrs := ansRepo.conn.Where(\"id = ?\", id).First(&qstn).GetErrors()\n\t// errs := ansRepo.conn.First(&qstn, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &qstn, errs\n}", "title": "" }, { "docid": "8b4a4ebdad33053b4f2253641e1f45b7", "score": "0.62934333", "text": "func FindAnswerById(w http.ResponseWriter, r *http.Request){\n\tparams := mux.Vars(r)\n\tanswer, err := dboper_answers.FindOne(utils.COLLECTION_ANSWERS, params[\"id\"])\n\tif err != nil{\n\t\tutils.RespondWithError(w, http.StatusBadRequest, \"Invalid Answer Id\")\n\t}\n\tutils.RespondWithJson(w, http.StatusOK, answer)\n}", "title": "" }, { "docid": "93a8490815569fe5ce6da0035c60e74c", "score": "0.5681842", "text": "func (d *driver) GetQuestion(id int) (question.Question, error) {\n\tquestion := question.Question{}\n\terr := d.db.QueryRow(\n\t\t\" SELECT post.id as id, users.username, submitted_on, title, content, author, views, organization.name,\"+\n\t\t\t\" (SELECT count(*) from answer where post.id=answer.question) as answers\"+\n\t\t\t\" FROM ((((post NATURAL JOIN question) JOIN users ON (author = users.id))\"+\n\t\t\t\" JOIN post_of ON (post.id = post_of.pid)) JOIN team ON (team.id = post_of.tid))\"+\n\t\t\t\" JOIN organization ON (team.org_id = organization.id)\"+\n\t\t\t\" where post.id=$1\",\n\t\tid).Scan(&question.ID, &question.Username, &question.SubmittedOn, &question.Title,\n\t\t&question.Content, &question.Author, &question.Views, &question.Organization, &question.Answers)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to retrieve question with id %v: %v\", id, err)\n\t\treturn question, err\n\t}\n\n\treturn question, nil\n}", "title": "" }, { "docid": "0d702bf62898ff8f554138491042bf92", "score": "0.52277726", "text": "func getChallenge(db nosql.DB, id string) (challenge, error) {\n\tb, err := db.Get(challengeTable, []byte(id))\n\tif nosql.IsErrNotFound(err) {\n\t\treturn nil, MalformedErr(errors.Wrapf(err, \"challenge %s not found\", id))\n\t} else if err != nil {\n\t\treturn nil, ServerInternalErr(errors.Wrapf(err, \"error loading challenge %s\", id))\n\t}\n\tch, err := unmarshalChallenge(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ch, nil\n}", "title": "" }, { "docid": "49080630aa845e725f07e4bf975f0cef", "score": "0.51567405", "text": "func QueryDataByID(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\tvar err error\n\tif err = chaincode.CheckArgsEmpty(args, 1); err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tid, bs := args[0], []byte{}\n\tif bs, err = stub.GetState(id); err != nil {\n\t\treturn shim.Error(\"Failed to get state for id: \" + id)\n\t} else if len(bs) == 0 {\n\t\treturn shim.Error(\"Shared data does not exist, id: \" + id)\n\t}\n\n\treturn shim.Success(bs)\n}", "title": "" }, { "docid": "4452f854abe5728e8cdfceb966c97a12", "score": "0.5142477", "text": "func (projectdb *ProjectDB) GetReplyByID(ID string) model.Reply {\n\treply := model.Reply{}\n\treplyID, _ := strconv.Atoi(ID)\n\tprojectdb.Connection.Where(\"id = ?\", int64(replyID)).Find(&reply)\n\treturn reply\n}", "title": "" }, { "docid": "ad8ff59d03c2656b435407b20d287949", "score": "0.5107765", "text": "func FindQuestionByID(question *models.Question) error {\n\terr := database.DB.Debug().Where(\"id = ?\", question.ID).First(&question).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\tif gorm.IsRecordNotFoundError(err) {\n\t\treturn errors.New(\"Question Not Found\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5094aede1fcbf4baf79d6b565c62f576", "score": "0.5105507", "text": "func GetQuestionByID(id int64) Question {\n\n\tsession := dmas.MgoSession.Clone()\n\tdefer session.Close()\n\n\tsession.SetMode(mgo.Monotonic, true)\n\n\tresult := Question{}\n\tsession.DB(dmas.DbName).C(\"questions\").FindId(id).One(&result)\n\n\treturn result\n}", "title": "" }, { "docid": "04305733b459967c3801c48f5f4c0fda", "score": "0.50409746", "text": "func FindResponseByID(id string) (res Response) {\n\topendatabase()\n\tdata, err := DB.Get([]byte(id), nil)\n\tif err != nil {\n\t\terrorpk.AddError(\"FindChunkByid Chunkdb package\", \"can't get Chunkdb\", \"DBError\")\n\t}\n\n\tjson.Unmarshal(data, &res)\n\tclosedatabase()\n\treturn res\n}", "title": "" }, { "docid": "4d0305e8adea3084b48f10b952354228", "score": "0.4978816", "text": "func (k Keeper) GetAnswer(ctx sdk.Context, qID, responder string) types.Answer {\n\tstore := ctx.KVStore(k.storeKey)\n\n\tbz := store.Get([]byte(qID + responder))\n\tvar answer types.Answer\n\tk.cdc.MustUnmarshalBinaryBare(bz, &Answer)\n\treturn answer\n}", "title": "" }, { "docid": "3c8ae59102486e8014ed7b4d8a6caaea", "score": "0.49458757", "text": "func (s *service) Answer(\n\tctx context.Context,\n\tuserID uuid.UUID,\n\tanswer Answer) (AnswerResponse, error) {\n\n\tqnr, err := s.r.getQuestionnaire(ctx, s.qnrID)\n\tif err != nil {\n\t\treturn AnswerResponse{}, fmt.Errorf(\"could not get questionnaire id=%v: repo.getQuestionnaire: %v\",\n\t\t\ts.qnrID, err)\n\t}\n\n\tlatestQuestion, err := s.r.getLatestAskedQuestion(ctx, s.qnrID, userID)\n\tif errors.Is(err, ErrNotFound) {\n\t\t// FIXME: use the answer of the latest answered question to determine the next question\n\t\t// ignore answer from arguments.\n\t\tlatestAnsweredQuestion, err := s.r.getLatestAnsweredQuestion(ctx, s.qnrID, userID)\n\t\tif err != nil {\n\t\t\treturn AnswerResponse{}, fmt.Errorf(\"could not get latest answered question, qnrID=%v, userID=%v: repo.getLatestAskedQuestion: %v\",\n\t\t\t\ts.qnrID, userID, err)\n\t\t}\n\t\treturn s.askNextQuestion(ctx, qnr, userID, latestAnsweredQuestion, answer)\n\t}\n\tif err != nil {\n\t\treturn AnswerResponse{}, fmt.Errorf(\"could not get latest asked question, qnrID=%v, userID=%v: repo.getLatestAskedQuestion: %v\",\n\t\t\ts.qnrID, userID, err)\n\t}\n\n\tif err := validateAnswer(ctx, latestQuestion, answer); err != nil {\n\t\treturn AnswerResponse{\n\t\t\tInfo: invalidAnswerInfoMessage,\n\t\t\tQuestion: Question{\n\t\t\t\tText: Message(latestQuestion.Question),\n\t\t\t\tAnswerOptions: getAnswerOptionsIfRequired(latestQuestion),\n\t\t\t},\n\t\t}, fmt.Errorf(\"%w: userID=%v, questionID=%v, answer=%q\", err, userID, latestQuestion.ID, answer)\n\t}\n\n\tif err := s.r.saveAnswer(ctx, userID, latestQuestion.ID, answer); err != nil {\n\t\treturn AnswerResponse{}, fmt.Errorf(\"could not save answer: repo.saveAnswer: %v\", err)\n\t}\n\n\treturn s.askNextQuestion(ctx, qnr, userID, latestQuestion, answer)\n}", "title": "" }, { "docid": "56792ff3c99d3e3cb620b6edd7e6e45b", "score": "0.49098185", "text": "func (this *QuestionController) AnswerQuestion() {\n\tthis.TplName = \"questionlist.tpl\"\n\tisLogin := this.Ctx.Input.GetData(\"isLogin\").(bool)\n\tif !isLogin {\n\t\tthis.Redirect(\"/login\", 302)\n\t\treturn\n\t}\n\n\tdomain := this.Ctx.Input.Param(\":domain\")\n\tid := this.Ctx.Input.Param(\":id\")\n\tquestionID, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tthis.Redirect(\"/\", 302)\n\t\treturn\n\t}\n\n\tquestion, err := models.GetQuestionByDomainID(domain, uint(questionID))\n\tif err != nil || question.Answer != \"\" {\n\t\tthis.Redirect(\"/\", 302)\n\t\treturn\n\t}\n\n\t// make sure the question belong to this user\n\tloginUser := this.Ctx.Input.GetData(\"user\").(*models.User)\n\tif loginUser.PageID != question.PageID {\n\t\tthis.Redirect(\"/\", 302)\n\t\treturn\n\t}\n\n\tquestionURL := \"/_/\" + domain + \"/\" + id\n\n\t// parse form\n\ta := new(models.AnswerForm)\n\tif err := this.ParseForm(a); err != nil {\n\t\tthis.Redirect(questionURL+\"?err=1\", 302)\n\t\treturn\n\t}\n\n\tvalid := validation.Validation{}\n\tb, err := valid.Valid(a)\n\tif err != nil {\n\t\tthis.Redirect(questionURL+\"?err=1\", 302)\n\t\treturn\n\t}\n\n\tif !b {\n\t\tthis.Redirect(questionURL+\"?err=1\", 302)\n\t\treturn\n\t}\n\n\tquestion = &models.Question{\n\t\tAnswer: a.Answer,\n\t}\n\n\terr = models.AnswerQuestion(uint(questionID), question)\n\tif err != nil {\n\t\tthis.Redirect(questionURL+\"?err=1\", 302)\n\t\treturn\n\t}\n\tthis.Redirect(questionURL, 302)\n}", "title": "" }, { "docid": "4828eba39392ab88e964c9064b90322a", "score": "0.47983697", "text": "func setupChallengeByChallengeID(challengeIDInt int, resolved bool) *model.Challenge {\n\tlistingAddr := common.HexToAddress(testAddress)\n\tchallengeID := big.NewInt(int64(challengeIDInt))\n\tstatement := \"\"\n\taddress2, _ := cstrings.RandomHexStr(32)\n\tchallenger := common.HexToAddress(address2)\n\tstake := new(big.Int)\n\tstake.SetString(\"100000000000000000000\", 10)\n\trewardPool := new(big.Int)\n\trewardPool.SetString(\"50000000000000000000\", 10)\n\ttotalTokens := big.NewInt(232323223232)\n\tchallengeType := model.ChallengePollType\n\n\trequestAppealExpiry := big.NewInt(1231312)\n\ttestChallenge := model.NewChallenge(challengeID, listingAddr, statement, rewardPool,\n\t\tchallenger, resolved, stake, totalTokens, requestAppealExpiry, challengeType,\n\t\tint64(1212141313))\n\treturn testChallenge\n}", "title": "" }, { "docid": "16c15b7a8da6f5a05994a0e72a673908", "score": "0.4794357", "text": "func (_AccessControlledAggregator *AccessControlledAggregatorSession) GetAnswer(_roundId *big.Int) (*big.Int, error) {\n\treturn _AccessControlledAggregator.Contract.GetAnswer(&_AccessControlledAggregator.CallOpts, _roundId)\n}", "title": "" }, { "docid": "6d99acb6584ab64600422588907b05f3", "score": "0.47879228", "text": "func (c *SurveyQuestionClient) Get(ctx context.Context, id string) (*SurveyQuestion, error) {\n\treturn c.Query().Where(surveyquestion.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "2e51b6ce7ec11180932eff678f67a6be", "score": "0.47750768", "text": "func TestQuestionGetByIDCorrectData(t *testing.T) {\n\tcMock := getMock()\n\tcMock.On(\"GetQuestionByID\", 1).Return(createdQuestion, nil)\n\n\tdata, err := QuestionGET(\"1\")\n\tif assert.Nil(t, err) {\n\t\tcMock.AssertExpectations(t)\n\n\t\tassert.Equal(t, createdQuestion.ID, data.ID)\n\t\tassert.Equal(t, createdQuestion.Title, data.Title)\n\t\tassert.Equal(t, *createdQuestion.Content, *data.Content)\n\t\tassert.Equal(t, createdQuestion.AuthorID, data.AuthorID)\n\t\tassert.Equal(t, *createdQuestion.HasBest, *data.HasBest)\n\t\tassert.Equal(t, createdQuestion.Created, data.Created)\n\t}\n}", "title": "" }, { "docid": "e47af7d89ffc2f3d9a810d22b6f7f84c", "score": "0.47509795", "text": "func GetQuestionByTestID(test_id string) (models []Question, err error) {\n\tfmt.Println(\"getting questions for test \" + test_id)\n\tquery := \"SELECT * from public.question WHERE test_id=$1\"\n\trows, err := database.Get().Query(query, test_id)\n\tif err != nil {\n\t\tfmt.Println(\"Question query error\")\n\t\tfmt.Println(err)\n\t}\n\tfor rows.Next() {\n\t\tvar model Question\n\t\terr := rows.Scan(&model.ID, &model.Title, pq.Array(&model.Options), &model.Answer, &model.TestID)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error in model\")\n\t\t\treturn models, err\n\t\t}\n\t\tmodels = append(models, model)\n\t}\n\tfmt.Println(len(models))\n\treturn\n}", "title": "" }, { "docid": "e72476db682ac54059b6fa8c28000a1b", "score": "0.47449043", "text": "func createAnswer(qid int) error {\n\t//With the front end this would be gathered from text boxes\n\tfmt.Printf(\"Enter the answer: \")\n\tin := bufio.NewReader(os.Stdin)\n\tanswerText, err := in.ReadString('\\n')\n\tanswerText = answerText[:len(answerText)-1]\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar correctText string\n\tfmt.Printf(\"Is this answer correct (true or false): \")\n\t_, err = fmt.Scanln(&correctText)\n\tif err != nil {\n\t\treturn err\n\t}\n\t\n\tcorrect, err := strconv.ParseBool(correctText)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// insert the data\n\tq := `INSERT INTO answers (answer_text, is_correct)\n VALUES ($1, $2)`\n\tresult, err := db.Exec(q, answerText, correct)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Find the id of the answer created\n\tmax := 0\t\n\tq = `SELECT answer_id\n FROM answers`\n\tanswers := []answer{}\n\terr = db.Select(&answers, q)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, answer := range answers {\n\t\tif answer.AnswerId > max {\n\t\t\tmax = answer.AnswerId\t\t\n\t\t}\n\t}\n\n\t//create question answer pair\n\terr = createQA(qid, max)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcount, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"%d answers(s) created.\\n\", count)\n\n\t//check if more answers need to be created\n\tvar response string\n\tfmt.Printf(\"Do more answers need to be created (1 for yes, 0 for no): \")\n\t_, err = fmt.Scanln(&response)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//convert the input into an int\n\tcheck, err := strconv.Atoi(response)\n \tif err != nil {\n \t return err\n \t}\n\tif check == 1 {\n\t\tcreateAnswer(qid)\t\n\t}\n\t\n\treturn nil\n}", "title": "" }, { "docid": "9ebba877910ae56fa947f9233905d9ec", "score": "0.4741207", "text": "func QueryStoryByID(id int) bool {\n\tvar exist bool\n\tdefer func(begun time.Time) {\n\t\tprom.QueryStoryDuration.Observe(time.Since(begun).Seconds())\n\t}(time.Now())\n\texist = model.QueryStoryByID(id)\n\treturn exist\n}", "title": "" }, { "docid": "86b8859dd4b6a6e9c26f039903f07f75", "score": "0.47169533", "text": "func (c Challenge) UpdateStatusByID(db *sqlx.DB) error {\n\t_, err := db.Exec(\"UPDATE challenges SET status = $1 WHERE id = $2\",\n\t\tc.Status, c.ID)\n\n\treturn err\n}", "title": "" }, { "docid": "966fe2d6f8ae78214abd98faa6e43d8c", "score": "0.47026107", "text": "func getReportByID(res http.ResponseWriter, req *http.Request) {\n\t//Getting url parameters\n\tparams := mux.Vars(req)\n\t//var reports []Models.Report\n\tvar report Models.Report\n\t//var errorHandler Models.ErrorHandler\n\tvar employee Models.Employee\n\tvar client Models.Client\n\tres.Header().Add(\"Content-type\", \"applicaction/json\")\n\t//Creating query\n\tquery := `SELECT r.*,e.*,c.name, c.address\n\t\t\t FROM reports as r \n\t\t\t LEFT JOIN clients as c on r.idClient = c.idClient \n\t\t\t INNER JOIN employees as e on r.idEmployee = e.idEmployee \n\t\t\t WHERE r.idReport=? and r.isDeleted=0`\n\t//create the sql statement with its parameters\n\treportSQL, err := DB.MySQL.Prepare(query)\n\tif functions.CheckError(http.StatusInternalServerError, err, &res) != false {\n\t\treturn\n\t}\n\tdefer reportSQL.Close()\n\t//Retrieve data from SQL Statement\n\terr = reportSQL.QueryRow(params[\"IDReport\"]).Scan(\n\t\t//Maping report data\n\t\t&report.IDReport, &report.OriginPlace, &report.DestinationPlace, &report.DepartureDate,\n\t\t&report.ReturnDate, &report.TeamName, &report.IDLeader, &report.Purpose, &report.IsSponsored,\n\t\t&report.ClientPurpose, &report.SpecialRequirements, &report.OperationDate,\n\t\t&report.OperationArrangement, &report.StatusChangeDate, &report.Comments,\n\t\t&report.ReportStatus, &report.IDClient, &report.IDEmployee, &report.IsInternational,\n\t\t&report.IsDeleted,\n\t\t//Maping employee data\n\t\t&employee.IDEmployee, &employee.Email, &employee.Name, &employee.PhoneNumber,\n\t\t&employee.BirthDate, &employee.Nationality, &employee.EmergencyNumber, &employee.Password,\n\t\t&employee.Role, &employee.IsDeleted,\n\t\t//Maping client data\n\t\t&client.Name, &client.Address,\n\t)\n\treport.Employee = &employee\n\treport.Client = &client\n\t//In case the SQL Instruction returns empty\n\tif functions.CheckError(int64(http.StatusBadRequest), err, &res) != false {\n\t\treturn\n\t}\n\tjson.NewEncoder(res).Encode(report)\n}", "title": "" }, { "docid": "83a8149e27d426d0482ec45444337b57", "score": "0.46996534", "text": "func FindQuestionOption(exec boil.Executor, iD int, selectCols ...string) (*QuestionOption, error) {\n\tquestionOptionObj := &QuestionOption{}\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 \\\"question_options\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(nil, exec, questionOptionObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from question_options\")\n\t}\n\n\treturn questionOptionObj, nil\n}", "title": "" }, { "docid": "2ef426b4d8328d91e9f4793187021059", "score": "0.4687572", "text": "func (i Intangible) AsAnswer() (*Answer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1756e100463099a4d8bff9d1b3d26b3a", "score": "0.4685025", "text": "func (b *Bot) Answer(query *Query, resp *QueryResponse) error {\n\tresp.QueryID = query.ID\n\n\tfor _, result := range resp.Results {\n\t\tresult.Process(b)\n\t}\n\n\t_, err := b.Raw(\"answerInlineQuery\", resp)\n\treturn err\n}", "title": "" }, { "docid": "dacf32a3ef2abf8b96b56c6fa9983109", "score": "0.46788192", "text": "func (k Keeper) GetAnswerString(ctx sdk.Context, qID, responder string) string {\n\treturn k.GetAnswer(ctx, qID, responder).Answer\n}", "title": "" }, { "docid": "84aba2dbe01ab91d67f7ae66c72f41a4", "score": "0.46786302", "text": "func (_AggregatorInterface *AggregatorInterfaceSession) GetAnswer(roundId *big.Int) (*big.Int, error) {\n\treturn _AggregatorInterface.Contract.GetAnswer(&_AggregatorInterface.CallOpts, roundId)\n}", "title": "" }, { "docid": "463f2446e47ac6bb3740c087c5313f3a", "score": "0.46779445", "text": "func (h *QuestionSlotHandler) GetById(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\t//get ID questionSlot\n\tid, _ := strconv.Atoi(vars[\"id\"])\n\tslotId, _ := strconv.Atoi(vars[\"slotId\"])\n\n\t//send to useCase\n\tpayload, err := h.QuestionSlotUsecase.GetByID(r.Context(), id, slotId)\n\tif err != nil {\n\t\tdomain.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tdomain.RespondwithJSON(w, http.StatusOK, payload)\n\treturn\n}", "title": "" }, { "docid": "668d3302f181d509f586c911f0699fff", "score": "0.4657817", "text": "func CheckChallenge(challengeStr string, userID uint64, challengeID uint64, db *bolt.DB) (success bool, err error) {\n\tif challengeStr == \"\" {\n\t\tsuccess = false\n\t\terr = errors.New(\"Empty challenge provided\")\n\t} else {\n\t\tvar challenge Challenge\n\t\terr = db.View(func(tx *bolt.Tx) error {\n\t\t\tb := tx.Bucket([]byte(\"challenges\"))\n\t\t\tchallengeJSON := b.Get(itob(challengeID))\n\n\t\t\tjson.Unmarshal(challengeJSON, &challenge)\n\t\t\treturn nil\n\t\t})\n\n\t\tif err == nil {\n\t\t\tif challenge.Challenge == challengeStr {\n\t\t\t\tif challenge.UserID == userID {\n\t\t\t\t\t//All OK\n\t\t\t\t\tsuccess = true\n\t\t\t\t\terr = nil\n\n\t\t\t\t\t//Delete the challenge from the DB\n\t\t\t\t\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t\t\t\t\tb := tx.Bucket([]byte(\"challenges\"))\n\n\t\t\t\t\t\treturn b.Delete(itob(challengeID))\n\n\t\t\t\t\t})\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Print(err.Error())\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsuccess = false\n\t\t\t\t\terr = errors.New(\"This is not a challenge for this user\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuccess = false\n\t\t\t\terr = errors.New(\"Challenge String Failed\")\n\t\t\t}\n\t\t} else {\n\t\t\tsuccess = false\n\t\t\terr = errors.New(\"Failed to successfully query the DB for your challenge\")\n\t\t}\n\n\t}\n\n\treturn success, err\n}", "title": "" }, { "docid": "b60e766147d59f9d8f5173a2d221ea4f", "score": "0.46552816", "text": "func (ansRepo *AnswerGormRepo) DeleteAnswer(id string) (*entities.Answer, []error) {\n\tqstn, errs := ansRepo.Answer(id)\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\t// errs := ansRepo.conn.Where(\"id = ?\", id).First(&qstn).GetErrors()\n\terrs = ansRepo.conn.Delete(qstn).GetErrors()\n\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn qstn, errs\n}", "title": "" }, { "docid": "7500a4cdc4a82d3e63f9862062896b2a", "score": "0.46541435", "text": "func (su Shorturl) QueryByID(ctx context.Context, traceID string, shorturl_id int) (Info, error) {\n\n\tconst q = `\n\tUPDATE\n\t\tshorturls\n\tSET \n\t\tvisits = visits + 1\n\tWHERE\n\t\tshorturl_id = $1\n\t\tRETURNING url`\n\n\tsu.log.Printf(\"%s : %s : query : %s\", traceID, \"shorturl.QueryByID\",\n\t\tdatabase.Log(q, shorturl_id))\n\n\tvar shorturl Info\n\tif err := su.db.GetContext(ctx, &shorturl, q, shorturl_id); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn Info{}, ErrNotFound\n\t\t}\n\t\treturn Info{}, errors.Wrapf(err, \"selecting shorturl %q\", shorturl_id)\n\t}\n\n\treturn shorturl, nil\n}", "title": "" }, { "docid": "6f84656d97c8920835958fee6d7dcf98", "score": "0.46519578", "text": "func (questionRepo *MockQuestionRepo) Question(id uint) (*entity.Question, []error) {\n\treturn questionRepo.questions[id], nil\n}", "title": "" }, { "docid": "ba3e23e67f02dce3b0792b6db31a55b6", "score": "0.46512356", "text": "func (_AggregatorV2V3Interface *AggregatorV2V3InterfaceSession) GetAnswer(roundId *big.Int) (*big.Int, error) {\n\treturn _AggregatorV2V3Interface.Contract.GetAnswer(&_AggregatorV2V3Interface.CallOpts, roundId)\n}", "title": "" }, { "docid": "9b377cd857e0bf480ccc4adaa9d4ea23", "score": "0.46490324", "text": "func (i Identifiable) AsAnswer() (*Answer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9b377cd857e0bf480ccc4adaa9d4ea23", "score": "0.46490324", "text": "func (i Identifiable) AsAnswer() (*Answer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9b377cd857e0bf480ccc4adaa9d4ea23", "score": "0.46490324", "text": "func (i Identifiable) AsAnswer() (*Answer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d93ed6afe06a17039de68a7159bdafe3", "score": "0.46318355", "text": "func (h *Workout) GetByID(w http.ResponseWriter, r *http.Request) {\n\tworkoutID, err := strconv.Atoi(chi.URLParam(r, \"workoutID\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\texercise, err := h.uc.GetByID(workoutID)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(exercise)\n}", "title": "" }, { "docid": "8eefc2ec6a71072f72d5ebda285a22a0", "score": "0.4626074", "text": "func (questionRepo *QuestionGormRepo) Question(id uint) (*entity.Question, []error) {\n\tquestion := entity.Question{}\n\terrs := questionRepo.conn.Set(\"gorm:auto_preload\", true).First(&question, id).GetErrors()\n\treturn &question, errs\n}", "title": "" }, { "docid": "af0ac6d8e8be78333e3f1cd25eae5621", "score": "0.46242172", "text": "func (v VirtualMachine) Answer(id, answer string) error {\n\treq := types.AnswerVM{\n\t\tThis: v.Reference(),\n\t\tQuestionId: id,\n\t\tAnswerChoice: answer,\n\t}\n\n\t_, err := methods.AnswerVM(v.c, &req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e68a3079b105b7c816e67fedbd64682f", "score": "0.4623394", "text": "func (r *ticketRepository) GetByID(id int) (*models.Ticket, error) {\n\treturn models.Tickets(qm.Where(\"id=?\", id), qm.Load(\"Questions.QuestionOptions\")).One(r.db)\n}", "title": "" }, { "docid": "b7f63a32ced174e3a3dbb982c194d293", "score": "0.46155694", "text": "func (h *Handler) GetAnswers(w http.ResponseWriter, r *http.Request) {\n\tans, err := h.Client.Answer.Query().\n\t\tWithQuestionID().\n\t\tAll(r.Context())\n\tif err != nil {\n\t\trender.InternalServerError(w, r, \"Error Retrieving polls\")\n\t\treturn\n\t}\n\trender.OK(w, r, ans)\n}", "title": "" }, { "docid": "b9d6d88bb036e94440e0c4b0b562432d", "score": "0.460621", "text": "func (h *Handler) QuizID(w http.ResponseWriter, r *http.Request) {\n\tidStr := chi.URLParam(r, \"id\")\n\tcourses, err := h.DB.GetCourses()\n\tvar numCourses = len(courses)\n\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil || id <= 0 || id > numCourses {\n\t\th.NotFoundError(w, r)\n\t\treturn\n\t}\n\n\tqq, err := h.DB.GetQuestionsByCourseID(id)\n\tif err != nil {\n\t\t// FIXME better handling\n\t\th.NotFoundError(w, r)\n\t\treturn\n\t}\n\n\tfor i := range qq {\n\t\tq := qq[i]\n\n\t\too, err := h.DB.GetOptionsByQuestionID(q.ID)\n\t\tif err != nil {\n\t\t\t// FIXME better handling\n\t\t\th.NotFoundError(w, r)\n\t\t\treturn\n\t\t}\n\t\tq.Options = oo\n\n\t\tq.Correct = true\n\n\t\tqq[i] = q\n\t}\n\n\tb := bytes.NewBufferString(\"\")\n\tview.Render(b, \"quiz\", struct {\n\t\tCompleted bool\n\t\tQuestionCount int\n\t\tQuestions []model.Question\n\t}{\n\t\tCompleted: false,\n\t\tQuestionCount: len(qq),\n\t\tQuestions: qq,\n\t})\n\n\trenderMenu(w, r, \"Quiz\", template.HTML(b.String()))\n}", "title": "" }, { "docid": "2a83b59e8b32c64fb32172b74de110f9", "score": "0.46045637", "text": "func (client *Client) AnswerInlineQuery(inlineQueryID JSONInt64, isPersonal bool, results []InputInlineQueryResult, cacheTime int32, nextOffset string, switchPmText string, switchPmParameter string) (*Ok, error) {\n\tresult, err := client.SendAndCatch(UpdateData{\n\t\t\"@type\": \"answerInlineQuery\",\n\t\t\"inline_query_id\": inlineQueryID,\n\t\t\"is_personal\": isPersonal,\n\t\t\"results\": results,\n\t\t\"cache_time\": cacheTime,\n\t\t\"next_offset\": nextOffset,\n\t\t\"switch_pm_text\": switchPmText,\n\t\t\"switch_pm_parameter\": switchPmParameter,\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 ok Ok\n\terr = json.Unmarshal(result.Raw, &ok)\n\treturn &ok, err\n\n}", "title": "" }, { "docid": "410aa6e1514c24580e2f9762ec52275e", "score": "0.46003854", "text": "func (i *IdeasDAO) FindById(id string) (Idea, error) {\n\tvar idea Idea\n\terr := db.C(COLLECTION).FindId(bson.ObjectIdHex(id)).One(&idea)\n\treturn idea, err\n}", "title": "" }, { "docid": "279776810e7ffbbaa7ec963198a6f9b8", "score": "0.45985103", "text": "func (_AccessControlledAggregator *AccessControlledAggregatorCallerSession) GetAnswer(_roundId *big.Int) (*big.Int, error) {\n\treturn _AccessControlledAggregator.Contract.GetAnswer(&_AccessControlledAggregator.CallOpts, _roundId)\n}", "title": "" }, { "docid": "3b5a5537385379e605b96c50f00dede8", "score": "0.45919988", "text": "func (dao *SurveyDAO) Get(id uint) (*models.Survey, error) {\n\tvar survey models.Survey\n\tvar err error\n\tif id == 0 {\n\t\terr = config.Config.DB.Set(\"gorm:auto_preload\", true).\n\t\t\tFirst(&survey).\n\t\t\tError\n\t} else {\n\t\terr = config.Config.DB.Set(\"gorm:auto_preload\", true).\n\t\t\tWhere(\"id = ?\", id).\n\t\t\tFind(&survey).\n\t\t\tError\n\t}\n\n\treturn &survey, err\n}", "title": "" }, { "docid": "a1867e845f24c8dfe591b5a0c099e66b", "score": "0.4587157", "text": "func (d *Dao) AnswerStatus(c context.Context, mid int64, ts time.Time) (status bool, err error) {\n\trow := d.db.QueryRow(c, _isAnsweredSQL, mid, ts)\n\tvar count int64\n\tif err = row.Scan(&count); err != nil {\n\t\tif err != sql.ErrNoRows {\n\t\t\terr = errors.Wrap(err, \"AnswerStatus\")\n\t\t\treturn\n\t\t}\n\t\tcount = 0\n\t\terr = nil\n\t}\n\tstatus = count > 0\n\treturn\n}", "title": "" }, { "docid": "fb91e2ba3ed7b94a666440e9971b8cf5", "score": "0.4582661", "text": "func ByID(ds datastore.Datastore, id int) (Issue, error) {\n\ti := Issue{}\n\tvar resolved, visible int // for converting 0/1 to bool\n\tq := queries[\"select-issue-by-id\"]\n\terr := ds.MySQL.Session.QueryRow(q, id).Scan(\n\t\t&i.ID,\n\t\t&resolved,\n\t\t&visible,\n\t\t&i.Description,\n\t\t&i.Action,\n\t\t&i.MemberID,\n\t\t&i.Association,\n\t\t&i.AssociationID,\n\t\t&i.Type.ID,\n\t\t&i.Type.Name,\n\t\t&i.Type.Description,\n\t\t&i.Type.Category.ID,\n\t\t&i.Type.Category.Name,\n\t\t&i.Type.Category.Description,\n\t)\n\tif resolved == 1 {\n\t\ti.Resolved = true\n\t}\n\tif visible == 1 {\n\t\ti.Visible = true\n\t}\n\treturn i, err\n}", "title": "" }, { "docid": "47e6895df47acb78232eaf0c7f5dc275", "score": "0.45660934", "text": "func (iq InlineQuery) Answer(b *Bot, results []InlineQueryResult, opts *AnswerInlineQueryOpts) (bool, error) {\n\treturn b.AnswerInlineQuery(iq.Id, results, opts)\n}", "title": "" }, { "docid": "233edd5f2f598789b80b5c110523a81e", "score": "0.45582134", "text": "func (_OffchainAggregator *OffchainAggregatorSession) GetAnswer(_roundId *big.Int) (*big.Int, error) {\n\treturn _OffchainAggregator.Contract.GetAnswer(&_OffchainAggregator.CallOpts, _roundId)\n}", "title": "" }, { "docid": "327400a6d445a78561395f5fb436f5ca", "score": "0.45573246", "text": "func (state FAQManager) FindAnswered() ([]FAQ, error) {\n\tfaqs := []FAQ{}\n\terr := state.db.Not(\"answer\", \"\").Find(&faqs).Error\n\treturn faqs, err\n}", "title": "" }, { "docid": "5f3453e3bc6f21e0a42f3b5ded04b7ed", "score": "0.4546508", "text": "func (state FAQManager) Find(id uint) (*FAQ, error) {\n\tfaq := FAQ{}\n\terr := state.db.Where(\"id = ?\", id).Find(&faq).Error\n\treturn &faq, err\n}", "title": "" }, { "docid": "793e7ddea5ce8489d4c580f0e12d7ac4", "score": "0.45341912", "text": "func ApointmentFindByID(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tapointmentID := vars[\"apointmentID\"]\n\tvar err error\n\tif len(apointmentID) == 0 {\n\t\tpanic(err)\n\t}\n\tapointment, err := db.FindByID(apointmentID)\n\tif len(apointment.ID) > 0 {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tif err := json.NewEncoder(w).Encode(apointment); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// If we didn't find it, 404\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusNotFound)\n\tif err := json.NewEncoder(w).Encode(m.JSONErr{Code: http.StatusNotFound, Text: \"Not Found\"}); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "207e474cfc14238df87dbd5e61b54765", "score": "0.4528279", "text": "func GetQuestion(w http.ResponseWriter, r *http.Request) {\n\tqParams := mux.Vars(r)\n\tquizID := qParams[\"id\"]\n\tquestionID := qParams[\"qa_id\"]\n\tquiz, _ := findQuiz(quizID)\n\tif quiz == nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(\"Quiz is not found\"))\n\t\treturn\n\t}\n\tqa, _ := quiz.Find(questionID)\n\tif qa == nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(\"Question is not found\"))\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(qa)\n}", "title": "" }, { "docid": "aef9c1250ae7484e8958bc33fed85109", "score": "0.45263043", "text": "func FindJiraProjectByID(ctx context.Context, db DB, value string) (*JiraProject, error) {\n\tq := \"SELECT `jira_project`.`id`,`jira_project`.`checksum`,`jira_project`.`project_id`,`jira_project`.`key`,`jira_project`.`avatar_url`,`jira_project`.`category_id`,`jira_project`.`customer_id`,`jira_project`.`ref_id` FROM `jira_project` WHERE `id` = ?\"\n\tvar _ID sql.NullString\n\tvar _Checksum sql.NullString\n\tvar _ProjectID sql.NullString\n\tvar _Key sql.NullString\n\tvar _AvatarURL sql.NullString\n\tvar _CategoryID sql.NullString\n\tvar _CustomerID sql.NullString\n\tvar _RefID sql.NullString\n\terr := db.QueryRowContext(ctx, q, value).Scan(\n\t\t&_ID,\n\t\t&_Checksum,\n\t\t&_ProjectID,\n\t\t&_Key,\n\t\t&_AvatarURL,\n\t\t&_CategoryID,\n\t\t&_CustomerID,\n\t\t&_RefID,\n\t)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt := &JiraProject{}\n\tif _ID.Valid {\n\t\tt.SetID(_ID.String)\n\t}\n\tif _Checksum.Valid {\n\t\tt.SetChecksum(_Checksum.String)\n\t}\n\tif _ProjectID.Valid {\n\t\tt.SetProjectID(_ProjectID.String)\n\t}\n\tif _Key.Valid {\n\t\tt.SetKey(_Key.String)\n\t}\n\tif _AvatarURL.Valid {\n\t\tt.SetAvatarURL(_AvatarURL.String)\n\t}\n\tif _CategoryID.Valid {\n\t\tt.SetCategoryID(_CategoryID.String)\n\t}\n\tif _CustomerID.Valid {\n\t\tt.SetCustomerID(_CustomerID.String)\n\t}\n\tif _RefID.Valid {\n\t\tt.SetRefID(_RefID.String)\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "781e3426d512f08b6f934059c0913494", "score": "0.45058784", "text": "func (ansRepo *AnswerGormRepo) UpdateAnswer(answer *entities.Answer) (*entities.Answer, []error) {\n\tqstn := answer\n\terrs := ansRepo.conn.Save(qstn).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn qstn, errs\n}", "title": "" }, { "docid": "46a4183c491824d46200aeca9321f663", "score": "0.4495027", "text": "func (client *Client) AnswerCallbackQuery(callbackQueryID JSONInt64, text string, showAlert bool, uRL string, cacheTime int32) (*Ok, error) {\n\tresult, err := client.SendAndCatch(UpdateData{\n\t\t\"@type\": \"answerCallbackQuery\",\n\t\t\"callback_query_id\": callbackQueryID,\n\t\t\"text\": text,\n\t\t\"show_alert\": showAlert,\n\t\t\"url\": uRL,\n\t\t\"cache_time\": cacheTime,\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 ok Ok\n\terr = json.Unmarshal(result.Raw, &ok)\n\treturn &ok, err\n\n}", "title": "" }, { "docid": "254d5500dd78e5ba850a5b02e518fea4", "score": "0.448708", "text": "func getAnswer(input string) answerStruct {\n\tvar url string\n\t//Set url based on input\n\tif input == \"\" {\n\t\turl = \"https://yesno.wtf/api\"\n\t} else if input == \"yes\" {\n\t\turl = \"https://yesno.wtf/api?force=yes\"\n\t} else if input == \"no\" {\n\t\turl = \"https://yesno.wtf/api?force=no\"\n\t} else if input == \"maybe\" {\n\t\turl = \"https://yesno.wtf/api?force=maybe\"\n\t}\n\tresponse, err := http.Get(url)\n\tvar answer *answerStruct\n\n\tif err != nil {\n\t\tfmt.Printf(\"The HTTP request failed with error %s\\n\", err)\n\t\treturn *answer\n\t}\n\n\t//data holds json\n\tdata, _ := ioutil.ReadAll(response.Body)\n\n\t//update answer with json\n\terr = json.Unmarshal(data, &answer)\n\n\treturn *answer\n}", "title": "" }, { "docid": "25aa7d565587cf132cd5a1889465fe9f", "score": "0.44735125", "text": "func (_AccessControlledAggregator *AccessControlledAggregatorCaller) GetAnswer(opts *bind.CallOpts, _roundId *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _AccessControlledAggregator.contract.Call(opts, &out, \"getAnswer\", _roundId)\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": "3f61c5d4eb006cee266d1505c1bc23ce", "score": "0.447174", "text": "func (_ExposedOffchainAggregator *ExposedOffchainAggregatorSession) GetAnswer(_roundId *big.Int) (*big.Int, error) {\n\treturn _ExposedOffchainAggregator.Contract.GetAnswer(&_ExposedOffchainAggregator.CallOpts, _roundId)\n}", "title": "" }, { "docid": "a00fe3ff4510329f51b5d4536c80a858", "score": "0.44715548", "text": "func (self *LobbyAPI) GetChallengeFor(challengedPlayer string) (*model.Challenge, error) {\n\tfailure := validatePlayer(self, challengedPlayer)\n\tif ( failure != nil ) {\n\t\treturn nil, failure\n\t}\n\n\tchallenges := self.lobbyDAO.GetChallengesFor( challengedPlayer )\n\tif ( len(challenges) < 1 ) {\n\t\treturn nil, nil\n\t}\n\n\tfor _, challenge := range challenges {\n\n\t\tif ( challenge == nil ) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ( challenge.IsChallengeExpired() ) {\n\t\t\tself.RemoveExpiredChallenge(challenge.ChallengeID)\n\t\t\tcontinue\n\t\t}\n\n\t\treturn challenge, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "e29dbfc776405069352bc40806a03429", "score": "0.44491133", "text": "func IDEQ(id int) predicate.Hospital {\n\treturn predicate.Hospital(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4861337a01e58bac08e4e9b55f022cc8", "score": "0.44490933", "text": "func (l *Listing) ChallengeID() *big.Int {\n\treturn l.challengeID\n}", "title": "" }, { "docid": "a057d87a0c3a38e76a26681a8cf71eb6", "score": "0.44407988", "text": "func respondAnswer(update models.Update) models.BotMessage {\n\tbotMessage := models.BotMessage{}\n\tbotMessage.ReplyMarkup = controllers.CreateProblemKeyBoard()\n\tuser := models.FindUserById(int64(update.Message.User.Id))\n\tif user.Current_problem < 0 {\n\t\tbotMessage.Text = \"Unknown command(\"\n\t} else {\n\t\tproblem := models.FindProblemById(int64(user.Current_problem))\n\t\tanswer, err := strconv.ParseFloat(update.Message.Text, 64)\n\t\tif err != nil {\n\t\t\tbotMessage.Text = \"Incorrect answer(\"\n\t\t} else {\n\t\t\tif problem.Answer == answer {\n\t\t\t\tbotMessage.Text = \"Correct answer!\"\n\t\t\t\tcontrollers.SolveProblem(user, problem)\n\t\t\t\tbotMessage.ReplyMarkup = controllers.CreateDefaultKeyoard()\n\t\t\t}\n\t\t}\n\t}\n\tbotMessage.ChatId = update.Message.Chat.Id\n\treturn botMessage\n}", "title": "" }, { "docid": "527aaeaa8d444b44a51323ac2196ddc1", "score": "0.44258475", "text": "func (l *Listing) SetChallengeID(id *big.Int) {\n\tl.challengeID = id\n}", "title": "" }, { "docid": "4f94fca5b2cb17c9b0124b3560e49687", "score": "0.4422414", "text": "func (_AggregatorInterface *AggregatorInterfaceCallerSession) GetAnswer(roundId *big.Int) (*big.Int, error) {\n\treturn _AggregatorInterface.Contract.GetAnswer(&_AggregatorInterface.CallOpts, roundId)\n}", "title": "" }, { "docid": "f9f323f89aadce412f9b84b47524cde6", "score": "0.4418974", "text": "func GetAnswerAction(c *gin.Context) {\n\tlg.Info(\"GetAnswerAction()\")\n\n\t//Param\n\tif c.Param(\"id\") == \"\" {\n\t\tc.AbortWithError(400, errors.New(\"missing id on request parameter\"))\n\t\treturn\n\t}\n\n\tvar ans []m.Answers\n\terr := m.GetDB().GetAnswersByID(&ans, c.Param(\"id\"))\n\tif err != nil {\n\t\t//when no data,\n\t\tlg.Error(err)\n\t\tc.AbortWithError(400, err)\n\t\treturn\n\t}\n\n\t//lg.Debug(ans)\n\t//[{1 title1 abc@gmail.com [\"answer1\", \"answer2\", \"answer3\"]} {1 title1 xxxx@gmail.com [\"aaaaa111\", \"bbbbb222\", \"ccccc333\"]}]\n\n\t//convert data\n\tvar f FormattedAnswers\n\t//var a []Answer\n\ta := make([]Answer, 0, len(ans))\n\n\tf.ID = ans[0].ID\n\tf.Title = ans[0].Title\n\tjson.Unmarshal([]byte(ans[0].Questions), &f.Questions)\n\n\tfor _, v := range ans {\n\t\t//json\n\t\tvar answers []string\n\t\tjson.Unmarshal([]byte(v.Answers), &answers)\n\n\t\ta = append(a, Answer{\n\t\t\tEmail: v.Email,\n\t\t\tAnswer: answers,\n\t\t})\n\t}\n\tf.Answers = a\n\n\t//lg.Debug(f)\n\n\tc.JSON(http.StatusOK, f)\n}", "title": "" }, { "docid": "1e4cfe50707827f29e8e248305ccec91", "score": "0.44085434", "text": "func (self *LobbyAPI) RejectChallenge(challengeID string) bool {\n\tchallenge := self.lobbyDAO.GetChallenge( challengeID )\n\tif ( challenge == nil ) {\n\t\treturn true\n\t}\n\n\tchallenge.ChallengeStatus = \"rejected\"\n\tself.lobbyDAO.SaveChallenge(challenge)\n\treturn true\n}", "title": "" }, { "docid": "5436c7d5c38fa575500655ba34469c6c", "score": "0.43942776", "text": "func SetAnswer(w http.ResponseWriter, r *http.Request) {\n\tvar answers []int\n\tjson.NewDecoder(r.Body).Decode(&answers)\n\tqParams := mux.Vars(r)\n\tquizID := qParams[\"id\"]\n\tquestionID := qParams[\"qa_id\"]\n\tquiz, _ := findQuiz(quizID)\n\tif quiz == nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(\"Quiz is not found\"))\n\t\treturn\n\t}\n\tres, err := quiz.SetAnswer(questionID, answers)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"Bad request\"))\n\t\treturn\n\t}\n\tresult := make(map[string]bool)\n\tresult[\"result\"] = res\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(result)\n}", "title": "" }, { "docid": "d8edf35536c71fa6e816c610cbdb78dc", "score": "0.4391255", "text": "func (base *problemBase) GetAnswer() string {\n\treturn base.answer\n}", "title": "" }, { "docid": "eda613d3307acc8a1acd79bc19062612", "score": "0.43906105", "text": "func HandleContestProblems(w http.ResponseWriter, r *http.Request) {\n\tcid := r.URL.Query().Get(\"cid\")\n\tpid := r.URL.Query().Get(\"pid\")\n\tsession := getMongoS()\n\tdefer session.Close()\n\tcontestCol := session.DB(\"oj\").C(\"contests\")\n\tproblemCol := session.DB(\"oj\").C(\"problems\")\n\tcontest := []model.Contest{}\n\tproblem := []model.Problem{}\n\tcontestCol.Find(bson.M{\"contestid\": cid}).All(&contest)\n\tif len(contest) > 0 {\n\t\ta2i := map[string]int{\"A\": 0, \"B\": 1, \"C\": 2, \"D\": 3, \"E\": 4, \"F\": 5, \"G\": 6, \"H\": 7, \"I\": 8, \"J\": 9, \"K\": 10, \"L\": 11, \"M\": 12, \"N\": 13, \"O\": 14, \"P\": 15, \"Q\": 16, \"R\": 17, \"S\": 18, \"T\": 19, \"U\": 20, \"V\": 21, \"W\": 22, \"X\": 23, \"Y\": 24, \"Z\": 25}\n\t\tif v, ok := a2i[pid]; ok {\n\t\t\tproblemCol.Find(bson.M{\"id\": contest[0].ContestProblems[v]}).All(&problem)\n\t\t\tif len(problem) > 0 {\n\t\t\t\tRender.HTML(w, http.StatusFound, \"contestProblem\", contestProblemResult{problem[0], cid, pid, GetIslogin(r)})\n\t\t\t} else {\n\t\t\t\thttp.Redirect(w, r, \"/error\", 401)\n\t\t\t}\n\t\t} else {\n\t\t\thttp.Redirect(w, r, \"/error\", 401)\n\t\t}\n\t} else {\n\t\thttp.Redirect(w, r, \"/error\", 401)\n\t}\n}", "title": "" }, { "docid": "6fc133086c8f9eec1e3c82f076d2e147", "score": "0.43864253", "text": "func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6fc133086c8f9eec1e3c82f076d2e147", "score": "0.43864253", "text": "func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6fc133086c8f9eec1e3c82f076d2e147", "score": "0.43864253", "text": "func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "be73c3050f58a572348d8c1ce0bc7063", "score": "0.43855083", "text": "func FindByID(w http.ResponseWriter, r *http.Request) {\n\n\tvar msg pandorabox.Message\n\n\tmsg = pandorabox.Message{\n\t\tContent: \"Invalid ID, not a int\",\n\t\tStatus: \"ERROR\",\n\t\tBody: nil,\n\t}\n\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\tpandorabox.RespondWithJSON(w, http.StatusOK, msg)\n\t\treturn\n\t}\n\n\tentity := GetByID(id)\n\n\tif entity.ID != 0 {\n\t\tpandorabox.RespondWithJSON(w, http.StatusOK, entity)\n\t\treturn\n\t}\n\n\tmsg = pandorabox.Message{\n\t\tContent: \"Not exist this Student\",\n\t\tStatus: \"ERROR\",\n\t\tBody: nil,\n\t}\n\tpandorabox.RespondWithJSON(w, http.StatusOK, msg)\n\n}", "title": "" }, { "docid": "ff99c1bc70e874e9588d17f9e1865f2e", "score": "0.4385435", "text": "func (_OffchainAggregator *OffchainAggregatorCallerSession) GetAnswer(_roundId *big.Int) (*big.Int, error) {\n\treturn _OffchainAggregator.Contract.GetAnswer(&_OffchainAggregator.CallOpts, _roundId)\n}", "title": "" }, { "docid": "5fcc7160f30875249846a2ecca610a8a", "score": "0.43846154", "text": "func IDEQ(id int) predicate.APIResponse {\n\treturn predicate.APIResponse(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0fb4c44758caf0b8e103a65eec55cf5d", "score": "0.43844032", "text": "func GetAnswer() int {\n\treturn int(C.GetAnswer())\n}", "title": "" }, { "docid": "4ed645b50bfc796b5373c5978b75b379", "score": "0.4372727", "text": "func (vm *VM) AnswerQuestion(questionId string, choiceId int) error {\n\n\t//validate input\n\tif \"\" == questionId {\n\t\treturn fmt.Errorf(\"questionId can not be empty\")\n\t}\n\n\tanswer := &types.VmQuestionAnswer{\n\t\tXmlns: \"http://www.vmware.com/vcloud/v1.5\",\n\t\tQuestionId: questionId,\n\t\tChoiceId: choiceId,\n\t}\n\n\toutput, err := xml.MarshalIndent(answer, \" \", \" \")\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err)\n\t}\n\n\tutil.Logger.Printf(\"[TRACE] AnswerQuestion XML DEBUG \\n : %s\\n\\n\", string(output))\n\n\tbuffer := bytes.NewBufferString(xml.Header + string(output))\n\n\tapiEndpoint, _ := url.ParseRequestURI(vm.VM.HREF)\n\tapiEndpoint.Path += \"/question/action/answer\"\n\n\treq := vm.client.NewRequest(map[string]string{}, \"POST\", *apiEndpoint, buffer)\n\n\t_, err = checkResp(vm.client.Http.Do(req))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error asnwering question: %s\", err)\n\t}\n\n\t// The request was successful\n\treturn nil\n\n}", "title": "" }, { "docid": "ece688aefd13b95cea7b04d046dbb1fa", "score": "0.43684894", "text": "func (ansRepo *AnswerGormRepo) Answers() ([]entities.Answer, []error) {\n\tans := []entities.Answer{}\n\terrs := ansRepo.conn.Find(&ans).GetErrors()\n\tif len(errs) > 0 {\n\t\t\n\t\treturn nil, errs\n\t}\n\treturn ans, errs\n}", "title": "" }, { "docid": "1f2c11fcb758f614a3f881eb2e36c38c", "score": "0.4362756", "text": "func (i *Issue) FindIssueAndRepliesByID(id string) (*IssueShow, *[]RepliesInIssue, error) {\n\tvar issue IssueShow\n\t// query := database.DB.Preload(\"Replies\").Where(\"issues.id = ?\", id).First(&result)\n\tquery := database.DB.Model(&Issue{}).\n\t\tSelect(`\n\t\t\tissues.id,\n\t\t\tissues.title,\n\t\t\tissues.body,\n\t\t\tissues.status,\n\t\t\tissues.severity,\n\t\t\tissues.created_at,\n\t\t\tissues.updated_at,\n\t\t\tissues.user_id,\n\t\t\tusers.\"name\" AS \"user_name\"`).\n\t\tJoins(\"left join users on issues.user_id = users.id\").\n\t\tWhere(\"issues.id = ?\", id).\n\t\tFirst(&issue)\n\n\tvar replies []RepliesInIssue\n\tqueryReplies := database.DB.Model(&Reply{}).\n\t\tSelect(`\n\t\t\treplies.id,\n\t\t\treplies.user_id,\n\t\t\treplies.issue_id,\n\t\t\tusers.\"name\" as \"replier\",\n\t\t\treplies.body,\n\t\t\treplies.created_at,\n\t\t\treplies.updated_at`).\n\t\tJoins(\"join users on replies.user_id = users.id\").\n\t\tJoins(\"join issues on replies.issue_id = issues.id\").\n\t\tWhere(\"replies.issue_id = ?\", id).\n\t\tScan(&replies)\n\n\tif issue.ID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"ERROR: could not find issue with ID: %s\", id)\n\t}\n\n\tif query.Error != nil || queryReplies.Error != nil {\n\t\treturn nil, nil, query.Error\n\t}\n\treturn &issue, &replies, nil\n}", "title": "" }, { "docid": "01ec8128407780c249983dec24a02e77", "score": "0.43590432", "text": "func GetDoSurveyById(id int) (v *DoSurvey, err error) {\n\to := orm.NewOrm()\n\tv = &DoSurvey{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "7c44ef3cbd4afd791f2b78cb002ab8df", "score": "0.43471164", "text": "func (_ExposedOffchainAggregator *ExposedOffchainAggregatorCallerSession) GetAnswer(_roundId *big.Int) (*big.Int, error) {\n\treturn _ExposedOffchainAggregator.Contract.GetAnswer(&_ExposedOffchainAggregator.CallOpts, _roundId)\n}", "title": "" }, { "docid": "4ac6408c6c2bc61cfbef6483511cec21", "score": "0.4340801", "text": "func (c Core) QueryByID(ctx context.Context, userID string) (User, error) {\n\tif err := validate.CheckID(userID); err != nil {\n\t\treturn User{}, ErrInvalidID\n\t}\n\n\tdbUsr, err := c.store.QueryByID(ctx, userID)\n\tif err != nil {\n\t\tif errors.Is(err, database.ErrDBNotFound) {\n\t\t\treturn User{}, ErrNotFound\n\t\t}\n\t\treturn User{}, fmt.Errorf(\"query: %w\", err)\n\t}\n\n\treturn toUser(dbUsr), nil\n}", "title": "" }, { "docid": "47875adb81b31ea7ea0822da4fc82605", "score": "0.4338136", "text": "func (_AggregatorV2V3Interface *AggregatorV2V3InterfaceCallerSession) GetAnswer(roundId *big.Int) (*big.Int, error) {\n\treturn _AggregatorV2V3Interface.Contract.GetAnswer(&_AggregatorV2V3Interface.CallOpts, roundId)\n}", "title": "" }, { "docid": "6d40da75285fff9cfac81e4f23c38453", "score": "0.4332485", "text": "func (c *SurveyClient) Get(ctx context.Context, id string) (*Survey, error) {\n\treturn c.Query().Where(survey.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "bd36a8e97b3431493c42a4e4643c481c", "score": "0.43215734", "text": "func (g QuestDao) SelectByID(id int) (entity.Quest, error) {\n\treturn _QuestSelectByID(g, id)\n}", "title": "" }, { "docid": "313f52389993f16c0785aa11c17ad657", "score": "0.43208", "text": "func updateStudentAnswer() error {\n\t//With the front end this would be gathered from the button click\n\tvar studentAnswerId string\n\tfmt.Printf(\"Enter the student answer id: \")\n\t_, err := fmt.Scanln(&studentAnswerId)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar answerId string\n\tfmt.Printf(\"Enter the answer id: \")\n\t_, err = fmt.Scanln(&answerId)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//convert the input into an int\n\tsaID, err := strconv.Atoi(studentAnswerId)\n \tif err != nil {\n \t return err\n \t}\n\tif saID != currentUserId {\n\t\tfmt.Printf(\"Users can only change their own answers\\n\")\t\n\t\treturn nil\n\t}\n\taID, err := strconv.Atoi(answerId)\n \tif err != nil {\n \t return err\n \t}\n\t// update the data\n\tq := `UPDATE student_answers \n\t\tSET answer_id = $1\n Where sa_id = $2`\n\tresult, err := db.Exec(q, aID, saID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcount, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"%d student answers(s) updated.\\n\", count)\n\treturn nil\n}", "title": "" }, { "docid": "6dfede5693b1a2f6ee3cd1a3bb59edea", "score": "0.43157792", "text": "func (v *WorkflowQueryResult) GetAnswer() (o []byte) {\n\tif v != nil && v.Answer != nil {\n\t\treturn v.Answer\n\t}\n\treturn\n}", "title": "" }, { "docid": "8e1c26575206606d97a2bf1abe5844ee", "score": "0.43011433", "text": "func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8e1c26575206606d97a2bf1abe5844ee", "score": "0.43011433", "text": "func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8e1c26575206606d97a2bf1abe5844ee", "score": "0.43011433", "text": "func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "115f8ba0e4f8f50b859999cd4bc2b196", "score": "0.43004873", "text": "func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "115f8ba0e4f8f50b859999cd4bc2b196", "score": "0.43004873", "text": "func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "115f8ba0e4f8f50b859999cd4bc2b196", "score": "0.43004873", "text": "func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e3327bda145e5782cfcac58c8ade6442", "score": "0.42995688", "text": "func (d *DriverDigit) GenerateIdQuestionAnswer() (id, q, a string) {\n\tid = RandomId()\n\tdigits := randomDigits(d.Length)\n\ta = parseDigitsToString(digits)\n\treturn id, a, a\n}", "title": "" }, { "docid": "ef75f2c4092d3cdeae613b5b8ab29731", "score": "0.42956293", "text": "func FindIssueProjectByID(ctx context.Context, db DB, value string) (*IssueProject, error) {\n\tq := \"SELECT `issue_project`.`id`,`issue_project`.`checksum`,`issue_project`.`name`,`issue_project`.`url`,`issue_project`.`created_at`,`issue_project`.`customer_id`,`issue_project`.`ref_type`,`issue_project`.`ref_id`,`issue_project`.`metadata` FROM `issue_project` WHERE `id` = ?\"\n\tvar _ID sql.NullString\n\tvar _Checksum sql.NullString\n\tvar _Name sql.NullString\n\tvar _URL sql.NullString\n\tvar _CreatedAt sql.NullInt64\n\tvar _CustomerID sql.NullString\n\tvar _RefType sql.NullString\n\tvar _RefID sql.NullString\n\tvar _Metadata sql.NullString\n\terr := db.QueryRowContext(ctx, q, value).Scan(\n\t\t&_ID,\n\t\t&_Checksum,\n\t\t&_Name,\n\t\t&_URL,\n\t\t&_CreatedAt,\n\t\t&_CustomerID,\n\t\t&_RefType,\n\t\t&_RefID,\n\t\t&_Metadata,\n\t)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt := &IssueProject{}\n\tif _ID.Valid {\n\t\tt.SetID(_ID.String)\n\t}\n\tif _Checksum.Valid {\n\t\tt.SetChecksum(_Checksum.String)\n\t}\n\tif _Name.Valid {\n\t\tt.SetName(_Name.String)\n\t}\n\tif _URL.Valid {\n\t\tt.SetURL(_URL.String)\n\t}\n\tif _CreatedAt.Valid {\n\t\tt.SetCreatedAt(_CreatedAt.Int64)\n\t}\n\tif _CustomerID.Valid {\n\t\tt.SetCustomerID(_CustomerID.String)\n\t}\n\tif _RefType.Valid {\n\t\tt.SetRefType(_RefType.String)\n\t}\n\tif _RefID.Valid {\n\t\tt.SetRefID(_RefID.String)\n\t}\n\tif _Metadata.Valid {\n\t\tt.SetMetadata(_Metadata.String)\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "d8fa4097a3cd5d05e6b529c4f4b83f82", "score": "0.42813897", "text": "func (m *manager) FindIssueByID(c echo.Context) error {\n\tid, err := getID(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem, err := m.iuc.FindByID(id)\n\tif err != nil {\n\t\tif err.Error() == \"record not found\" {\n\t\t\treturn c.JSON(200, map[string]interface{}{\n\t\t\t\t\"item\": nil,\n\t\t\t})\n\t\t}\n\t\treturn err\n\t}\n\n\treturn c.JSON(200, map[string]interface{}{\n\t\t\"item\": item,\n\t})\n}", "title": "" }, { "docid": "26e9686874e90e3b7d8f21e17fd8f0dd", "score": "0.4278736", "text": "func (bot *BotAPI) AnswerInlineQuery(config InlineConfig) (APIResponse, error) {\n\tv := url.Values{}\n\n\tv.Add(\"inline_query_id\", config.InlineQueryID)\n\tv.Add(\"cache_time\", strconv.Itoa(config.CacheTime))\n\tv.Add(\"is_personal\", strconv.FormatBool(config.IsPersonal))\n\tv.Add(\"next_offset\", config.NextOffset)\n\tdata, err := json.Marshal(config.Results)\n\tif err != nil {\n\t\treturn APIResponse{}, err\n\t}\n\tv.Add(\"results\", string(data))\n\tv.Add(\"switch_pm_text\", config.SwitchPMText)\n\tv.Add(\"switch_pm_parameter\", config.SwitchPMParameter)\n\n\tbot.debugLog(\"answerInlineQuery\", v, nil)\n\n\treturn bot.MakeRequest(\"answerInlineQuery\", v)\n}", "title": "" }, { "docid": "7d500d18da809d5888328818ef675449", "score": "0.42761105", "text": "func questionHandler(file *os.File) {\n\tproblems := readRecords(file)\n\n\tcorrectAnsCount := 0 // initialize counter for number of questions answer correctly\n\tfor i, p := range problems { // iterate through the questions with the user\n\t\ttimer := time.NewTimer(time.Duration(*maxTimeLimit) * time.Second) // initialize (and re-initialize) a timer for each question\n\t\tfmt.Printf(\"Problem #%d: %s = \\n\", i+1, p.question)\n\t\tgo getAnswer() // get userAnswer\n\n\t\tselect { // when user is within time limit, then there is no message tine the channel timer.C\n\t\tcase <-timer.C: //checks if timer expired before any question was answered\n\t\t\tfmt.Println(questionCompletionMsg(problems, correctAnsCount))\n\t\t\treturn\n\t\tcase userAnswer := <-answerChannel: // when there is a user answer in the answerChannel\n\t\t\tif reflect.DeepEqual(userAnswer, p.answer) { // compare user's answer to the actual answer\n\t\t\t\tcorrectAnsCount++\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Println(questionCompletionMsg(problems, correctAnsCount))\n}", "title": "" }, { "docid": "10fe65025b0ff101ce60d65d4113be11", "score": "0.4272556", "text": "func (_OffchainAggregator *OffchainAggregatorCaller) GetAnswer(opts *bind.CallOpts, _roundId *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _OffchainAggregator.contract.Call(opts, &out, \"getAnswer\", _roundId)\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": "" } ]
3f23ea56c5467f6a58b1306259cbce49
FromDB implemented xorm.Conversion convent database data to self
[ { "docid": "43f22651f73146257a3593bb23e1b299", "score": "0.0", "text": "func (s *Status) FromDB(bytes []byte) error {\n\tif r, ok := Statuses[string(bytes)]; ok {\n\t\t*s = r\n\t\treturn nil\n\t}\n\treturn errors.New(\"no this data\")\n}", "title": "" } ]
[ { "docid": "58cb93ff55d9efb5b4bd36039630a40b", "score": "0.60416776", "text": "func (source *Source) ToDB() ([]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "a040db45f83a66b2b2fae9abd0b2b418", "score": "0.5941252", "text": "func (org *sqlorg)orgToDBRowXlate() *dbOrg {\n var dbrow *dbOrg\n dbrow = new(dbOrg)\n //UUID cannot be null, so no need to check if its null.\n dbrow.Uuid = syncParam.UUIDtoString(org.uuid)\n dbrow.Name = org.name\n dbrow.Address.Scan(org.address)\n dbrow.Parent.Scan(nil)\n if org.parent != nil {\n //Update the parent with parent UUID\n dbrow.Parent.Scan(syncParam.UUIDtoString(org.parent.uuid))\n }\n // Convert the time to unix format.\n dbrow.StartTime = org.startTime\n dbrow.Status = uint64(org.status)\n dbrow.Validity.Scan(org.validity)\n return dbrow\n}", "title": "" }, { "docid": "4001d50db97d34935c5408c78a6f27d1", "score": "0.5892442", "text": "func (post PublicField) ToDB() PublicFieldDB {\n\treturn PublicFieldDB{\n\t\tCardProps: post.CardProps,\n\t\tPublicProps: post.PublicProps,\n\t\tTags: post.Tags,\n\t}\n}", "title": "" }, { "docid": "a00058f9fe465a046ca8255a095d818e", "score": "0.5700006", "text": "func (source *Source) FromDB(bs []byte) error {\n\treturn nil\n}", "title": "" }, { "docid": "eac89fabe8cfb73d0f2e29d7838a90cd", "score": "0.55113965", "text": "func (m *SpeakerDB) DB() interface{} {\n\treturn &m.Db\n}", "title": "" }, { "docid": "f6a4da2c575c24f7936ba006b3b1df66", "score": "0.5453188", "text": "func memberFromDB(bMember dbdt.Member, jMember *Member) {\n\tjMember.JoinedBy = bMember.JoinedBy\n\tjMember.JoiningTime = bMember.JoiningTime\n\tjMember.LeavingTime = bMember.LeavingTime\n\tjMember.MemberID = bMember.MemberID\n\tjMember.NickName = bMember.NickName\n\tjMember.RemovedBy = bMember.RemovedBy\n\tjMember.RemovingTime = bMember.RemovingTime\n\tjMember.Role = bMember.Role\n}", "title": "" }, { "docid": "3f96aee28fd0ed2fc78cfa9b0daf5f23", "score": "0.5424893", "text": "func (d *dbBase) convertValueFromDB(fi *fieldInfo, val interface{}, tz *time.Location) (interface{}, error) {\n\tif val == nil {\n\t\treturn nil, nil\n\t}\n\n\tvar value interface{}\n\tvar tErr error\n\n\tvar str *StrTo\n\tswitch v := val.(type) {\n\tcase []byte:\n\t\ts := StrTo(string(v))\n\t\tstr = &s\n\tcase string:\n\t\ts := StrTo(v)\n\t\tstr = &s\n\t}\n\n\tfieldType := fi.fieldType\n\nsetValue:\n\tswitch {\n\tcase fieldType == TypeBooleanField:\n\t\tif str == nil {\n\t\t\tswitch v := val.(type) {\n\t\t\tcase int64:\n\t\t\t\tb := v == 1\n\t\t\t\tvalue = b\n\t\t\tdefault:\n\t\t\t\ts := StrTo(ToStr(v))\n\t\t\t\tstr = &s\n\t\t\t}\n\t\t}\n\t\tif str != nil {\n\t\t\tb, err := str.Bool()\n\t\t\tif err != nil {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tvalue = b\n\t\t}\n\tcase fieldType == TypeVarCharField || fieldType == TypeCharField || fieldType == TypeTextField || fieldType == TypeJSONField || fieldType == TypeJsonbField:\n\t\tif str == nil {\n\t\t\tvalue = ToStr(val)\n\t\t} else {\n\t\t\tvalue = str.String()\n\t\t}\n\tcase fieldType == TypeTimeField || fieldType == TypeDateField || fieldType == TypeDateTimeField:\n\t\tif str == nil {\n\t\t\tswitch t := val.(type) {\n\t\t\tcase time.Time:\n\t\t\t\td.ins.TimeFromDB(&t, tz)\n\t\t\t\tvalue = t\n\t\t\tdefault:\n\t\t\t\ts := StrTo(ToStr(t))\n\t\t\t\tstr = &s\n\t\t\t}\n\t\t}\n\t\tif str != nil {\n\t\t\ts := str.String()\n\t\t\tvar (\n\t\t\t\tt time.Time\n\t\t\t\terr error\n\t\t\t)\n\t\t\tif len(s) >= 19 {\n\t\t\t\ts = s[:19]\n\t\t\t\tt, err = time.ParseInLocation(formatDateTime, s, tz)\n\t\t\t} else if len(s) >= 10 {\n\t\t\t\tif len(s) > 10 {\n\t\t\t\t\ts = s[:10]\n\t\t\t\t}\n\t\t\t\tt, err = time.ParseInLocation(formatDate, s, tz)\n\t\t\t} else if len(s) >= 8 {\n\t\t\t\tif len(s) > 8 {\n\t\t\t\t\ts = s[:8]\n\t\t\t\t}\n\t\t\t\tt, err = time.ParseInLocation(formatTime, s, tz)\n\t\t\t}\n\t\t\tt = t.In(DefaultTimeLoc)\n\n\t\t\tif err != nil && s != \"00:00:00\" && s != \"0000-00-00\" && s != \"0000-00-00 00:00:00\" {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tvalue = t\n\t\t}\n\tcase fieldType&IsIntegerField > 0:\n\t\tif str == nil {\n\t\t\ts := StrTo(ToStr(val))\n\t\t\tstr = &s\n\t\t}\n\t\tif str != nil {\n\t\t\tvar err error\n\t\t\tswitch fieldType {\n\t\t\tcase TypeBitField:\n\t\t\t\t_, err = str.Int8()\n\t\t\tcase TypeSmallIntegerField:\n\t\t\t\t_, err = str.Int16()\n\t\t\tcase TypeIntegerField:\n\t\t\t\t_, err = str.Int32()\n\t\t\tcase TypeBigIntegerField:\n\t\t\t\t_, err = str.Int64()\n\t\t\tcase TypePositiveBitField:\n\t\t\t\t_, err = str.Uint8()\n\t\t\tcase TypePositiveSmallIntegerField:\n\t\t\t\t_, err = str.Uint16()\n\t\t\tcase TypePositiveIntegerField:\n\t\t\t\t_, err = str.Uint32()\n\t\t\tcase TypePositiveBigIntegerField:\n\t\t\t\t_, err = str.Uint64()\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tif fieldType&IsPositiveIntegerField > 0 {\n\t\t\t\tv, _ := str.Uint64()\n\t\t\t\tvalue = v\n\t\t\t} else {\n\t\t\t\tv, _ := str.Int64()\n\t\t\t\tvalue = v\n\t\t\t}\n\t\t}\n\tcase fieldType == TypeFloatField || fieldType == TypeDecimalField:\n\t\tif str == nil {\n\t\t\tswitch v := val.(type) {\n\t\t\tcase float64:\n\t\t\t\tvalue = v\n\t\t\tdefault:\n\t\t\t\ts := StrTo(ToStr(v))\n\t\t\t\tstr = &s\n\t\t\t}\n\t\t}\n\t\tif str != nil {\n\t\t\tv, err := str.Float64()\n\t\t\tif err != nil {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tvalue = v\n\t\t}\n\tcase fieldType&IsRelField > 0:\n\t\tfi = fi.relModelInfo.fields.pk\n\t\tfieldType = fi.fieldType\n\t\tgoto setValue\n\t}\n\nend:\n\tif tErr != nil {\n\t\terr := fmt.Errorf(\"convert to `%s` failed, field: %s err: %s\", fi.addrValue.Type(), fi.fullName, tErr)\n\t\treturn nil, err\n\t}\n\n\treturn value, nil\n\n}", "title": "" }, { "docid": "3b5ffb91089e3fefa7b8dab6d4721101", "score": "0.5340152", "text": "func dataLoader(activeDB *gorm.DB, data BookArchieve) {\n\tactiveDB.Create(&data)\n}", "title": "" }, { "docid": "a7e2fe82a7d6bf104ff6f48a7956eaab", "score": "0.5313744", "text": "func (m *StarDB) DB() interface{} {\n\treturn m.Db\n}", "title": "" }, { "docid": "c11cf1f96fa12b84137bc354f11bad49", "score": "0.5289971", "text": "func (m *PlaceDB) DB() interface{} {\n\treturn m.Db\n}", "title": "" }, { "docid": "b2a12a90d282d384a61f035b57d434f2", "score": "0.5286943", "text": "func (kv KV) DB() interface{} {\n\treturn kv.db\n}", "title": "" }, { "docid": "b2a12a90d282d384a61f035b57d434f2", "score": "0.5286943", "text": "func (kv KV) DB() interface{} {\n\treturn kv.db\n}", "title": "" }, { "docid": "4b3b115e19b0b32b13f33b9c9559e081", "score": "0.52776045", "text": "func (d *DB) DBQuery(table, row string) {\n\t///results, err := db.Query(\"SELECT id, name FROM tags\")\n\tquery := fmt.Sprintf(\"SELECT %v, sample_id, x,y,z FROM %v\", row, table)\n\n\n\t/// if id is lesser than oldID dont do anything\n\t//else continue the process\n\t//fmt.Sprintf(\"SELECT @last_id := MAX(id) FROM table; SELECT * FROM table WHERE id = @last_id;\")\n\n\n\tresults, err := d.Db.Query(query)\n\n\tif err != nil {\n\t\tpanic(err.Error()) // proper error handling instead of panic in your app\n\t}\n\t//results.Scan(\"id\", \"sensor_id\")\n\tvar last_id int\n\tvar changeZ,changeY,changeX int\n\tvar num int\n\t valuesX,valuesY,valuesZ := []int{},[]int{},[]int{}\n\n\n\tf := fmt.Sprintf(\"SELECT sample_id FROM %v ORDER BY id DESC LIMIT 1\", DBWriteTo)\n\tvar tg Tag\n\t_= d.Db.QueryRow(f).Scan(&tg.SampleID)\n\tfmt.Printf(\"the last processed sample id: %v\\n\", tg.SampleID)\n\t//r.NextResultSet()\n\n\tfor results.Next() {\n\t\t//for i := 0; i < 1; i++ {\n\t\t//\n\n\t\tvar tag Tag\n\t\t// for each row, scan the result into our tag composite object\n\t\terr = results.Scan(&tag.ID, &tag.SampleID, &tag.x, &tag.y, &tag.z)\n\t\t//if tag.Processed.Bool {\n\t\t//\tfmt.Println(tag.SampleID)\n\t\tif tg.SampleID < tag.SampleID {\n\t\t\tfmt.Println(\"hello\")\n\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error()) // proper error handling instead of panic in your app\n\t\t\t}\n\t\t\tif tag.SampleID == last_id {\n\t\t\t\tnum++\n\t\t\t\t//save values for standard cal\n\t\t\t\tvaluesX = append(valuesX, int(tag.x.Int64))\n\t\t\t\tvaluesY = append(valuesY, int(tag.y.Int64))\n\t\t\t\tvaluesZ = append(valuesZ, int(tag.z.Int64))\n\n\t\t\t\tchangeX += int(tag.x.Int64)\n\t\t\t\tchangeY += int(tag.y.Int64)\n\t\t\t\tchangeZ += int(tag.z.Int64)\n\t\t\t\t//fmt.Println(\"same values\")\n\t\t\t}\n\t\t\tif tag.SampleID != last_id {\n\t\t\t\tif num == 0 {\n\t\t\t\t\tnum = 1\n\t\t\t\t}\n\t\t\t\tvar difff1 int\n\t\t\t\tfor _, v := range valuesX {\n\t\t\t\t\tdiff := v - changeX\n\t\t\t\t\t//fmt.Printf(\"diff: %v,,,,,,, Value : %v,,,,,, changeX: %v \\n\", diff, v, changeX)\n\t\t\t\t\tdiff2 := diff * diff\n\t\t\t\t\tdifff1 += diff2\n\t\t\t\t\t//neWvaluesX = append(neWvaluesX, diff2)\n\t\t\t\t}\n\t\t\t\tvar difff2 int\n\t\t\t\tfor _, v := range valuesY {\n\t\t\t\t\tdiff := v - changeY\n\t\t\t\t\tdiff2 := diff * diff\n\t\t\t\t\tdifff2 += diff2\n\t\t\t\t\t//neWvaluesX = append(neWvaluesY, diff2)\n\t\t\t\t}\n\t\t\t\tvar difff3 int\n\t\t\t\tfor _, v := range valuesZ {\n\t\t\t\t\tdiff := v - changeZ\n\t\t\t\t\tdiff2 := diff * diff\n\t\t\t\t\tdifff3 += diff2\n\t\t\t\t\t//neWvaluesX = append(neWvaluesZ, diff2)\n\t\t\t\t}\n\n\t\t\t\tvarianceX := difff3 / num\n\t\t\t\tvarianceY := difff2 / num\n\t\t\t\tvarianceZ := difff1 / num\n\n\t\t\t\tsDX := math.Sqrt(float64(varianceX))\n\t\t\t\tsDY := math.Sqrt(float64(varianceY))\n\t\t\t\tsDZ := math.Sqrt(float64(varianceZ))\n\t\t\t\t//fmt.Printf(\"diff: %v,,,,,,, Value : %v,,,,,, changeX: %v standare : %v\\n\", difff3, num, varianceX,sDX)\n\t\t\t\t//fmt.Println(varianceX, varianceY, varianceZ, sDX, sDY, sDZ)\n\t\t\t\tnewX := changeX / num\n\t\t\t\tnewY := changeY / num\n\t\t\t\tnewZ := changeZ / num\n\n\t\t\t\t//fmt.Printf(\"newX %v,newY %v, newZ %v,changeX : %v, changeY : %v, changeZ : %v, num : %v\\n\", newX, newY, newZ, changeX,changeY,changeZ, num)\n\n\t\t\t\ttableRow := fmt.Sprintf(\"INSERT INTO %v (id, sample_id, x_mean,x_stdev, x_ms_ratio, y_mean,y_stdev, y_ms_ratio, z_mean, z_stdev, z_ms_ratio ) \\nVALUES (%v,%v,%v,%v,%v,%v,%v,%v,%v, %v,%v)\",DBWriteTo, tag.ID, tag.SampleID, newX, sDX, varianceX, newY, sDY, varianceY, newZ, sDZ, varianceZ)\n\n\t\t\t\t//tableRow2 := fmt.Sprintf(\"INSERT INTO pytest (processed) \\nVALUES (%v)\", true)\n\n\t\t\t\tvar wg sync.WaitGroup\n\t\t\t\twg.Add(1)\n\n\t\t\t\tgo func() {\n\t\t\t\t\tdefer wg.Done()\n\t\t\t\t\td.Insert(tableRow)\n\t\t\t\t}()\n\n\n\t\t\t\twg.Wait()\n\t\t\t\tnum = 0\n\t\t\t\tchangeX, changeY, changeZ = 0, 0, 0\n\t\t\t}\n\t\t\t//(\"INSERT INTO test VALUES ( 2, 'TEST' )\")\n\t\t\tlast_id = tag.SampleID\n\t\t}\n\t}\n\t//}\n}", "title": "" }, { "docid": "2eb5b26c634481f1611e635607f05312", "score": "0.52526176", "text": "func (org *sqlorg)dbToOrgRowXlate(sqlds *postgreSqlDataStore,\n handle interface{}, dbrow *dbOrg) {\n var ret bool\n org.name = dbrow.Name\n\n org_address, addrOk := dbrow.Address.Value()\n //Check the type of value to avoid runtime panic on invalid datatype.\n if addrOk != nil {\n if org.address, ret = org_address.(string); !ret {\n org.address = \"\"\n }\n }\n org.uuid = syncParam.StringtoUUID(dbrow.Uuid)\n org.status = orgStatusBit(dbrow.Status)\n org_validity, valOk := dbrow.Validity.Value()\n if valOk != nil {\n if org.validity, ret = org_validity.(uint64); !ret {\n org.validity = 0\n }\n }\n org.startTime = dbrow.StartTime\n org_parent, _ := dbrow.Parent.Value()\n var org_parentStr string\n if org_parentStr, ret = org_parent.(string); !ret {\n // Nil value, so set it to empty string.\n org_parentStr = \"\"\n }\n //Recursively process the parent until we reach global parent.\n var parentOrg = new(sqlorg)\n parentOrg.uuid = syncParam.StringtoUUID(org_parentStr)\n org.parent = &parentOrg.org\n parentOrg.getOrgEntryByUUID(sqlds, handle)\n}", "title": "" }, { "docid": "e15990a01653861a48578173d6754b95", "score": "0.5250944", "text": "func (m *DomainDataAdded) FetchDataFromDB(db *DB, timeUnit string, timeLength int) {\n\titerator := NewDateIterator(db, timeUnit, timeLength)\n\tfor date := iterator.Next(); date.Valid; date = iterator.Next() {\n\t\trecords := iterator.GetRecordsForDate(\"snapshot\", m, date.Value)\n\t\tm.AddDate(date.Value)\n\t\tfor obj := records.Next(); obj != nil; obj = records.Next() {\n\t\t\tm.AppendValues(obj, \"DataAdded\", iterator.CurrentOffset)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "15d33ab8d4bbe111bc30f3442ea7a2f7", "score": "0.5247288", "text": "func (e *Engine) DB() *bolt.DB { return e.db }", "title": "" }, { "docid": "207f17bcb6d966a820eb0f30bee12b15", "score": "0.5246548", "text": "func (d *dbBase) convertValueFromDB(fi *fieldInfo, val interface{}) (interface{}, error) {\n\tif val == nil {\n\t\treturn nil, nil\n\t}\n\n\tvar value interface{}\n\tvar tErr error\n\n\tvar str *StrTo\n\tswitch v := val.(type) {\n\tcase []byte:\n\t\ts := StrTo(string(v))\n\t\tstr = &s\n\tcase string:\n\t\ts := StrTo(v)\n\t\tstr = &s\n\t}\n\n\tfieldType := fi.fieldType\n\nsetValue:\n\tswitch {\n\tcase fieldType == TypeBooleanField:\n\t\tif str == nil {\n\t\t\tswitch v := val.(type) {\n\t\t\tcase int64:\n\t\t\t\tb := v == 1\n\t\t\t\tvalue = b\n\t\t\tdefault:\n\t\t\t\ts := StrTo(ToStr(v))\n\t\t\t\tstr = &s\n\t\t\t}\n\t\t}\n\t\tif str != nil {\n\t\t\tb, err := str.Bool()\n\t\t\tif err != nil {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tvalue = b\n\t\t}\n\tcase fieldType == TypeVarCharField || fieldType == TypeCharField || fieldType == TypeTextField || fieldType == TypeJSONField || fieldType == TypeJsonbField:\n\t\tif str == nil {\n\t\t\tvalue = ToStr(val)\n\t\t} else {\n\t\t\tvalue = str.String()\n\t\t}\n\tcase fieldType == TypeTimeField || fieldType == TypeDateField || fieldType == TypeDateTimeField:\n\t\tif str == nil {\n\t\t\tswitch t := val.(type) {\n\t\t\tcase time.Time:\n\t\t\t\tvalue = t\n\t\t\tdefault:\n\t\t\t\ts := StrTo(ToStr(t))\n\t\t\t\tstr = &s\n\t\t\t}\n\t\t}\n\t\tif str != nil {\n\t\t\ts := str.String()\n\t\t\tvar (\n\t\t\t\tt time.Time\n\t\t\t\terr error\n\t\t\t)\n\t\t\tif len(s) >= 19 {\n\t\t\t\ts = s[:19]\n\t\t\t\t// t, err = time.ParseInLocation(formatDateTime, s, tz)\n\t\t\t} else if len(s) >= 10 {\n\t\t\t\tif len(s) > 10 {\n\t\t\t\t\ts = s[:10]\n\t\t\t\t}\n\t\t\t\t// t, err = time.ParseInLocation(formatDate, s, tz)\n\t\t\t} else if len(s) >= 8 {\n\t\t\t\tif len(s) > 8 {\n\t\t\t\t\ts = s[:8]\n\t\t\t\t}\n\t\t\t\t// t, err = time.ParseInLocation(formatTime, s, tz)\n\t\t\t}\n\t\t\tt = t.In(DefaultTimeLoc)\n\n\t\t\tif err != nil && s != \"00:00:00\" && s != \"0000-00-00\" && s != \"0000-00-00 00:00:00\" {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tvalue = t\n\t\t}\n\tcase fieldType&IsIntegerField > 0:\n\t\tif str == nil {\n\t\t\ts := StrTo(ToStr(val))\n\t\t\tstr = &s\n\t\t}\n\t\tif str != nil {\n\t\t\tvar err error\n\t\t\tswitch fieldType {\n\t\t\tcase TypeBitField:\n\t\t\t\t_, err = str.Int8()\n\t\t\tcase TypeSmallIntegerField:\n\t\t\t\t_, err = str.Int16()\n\t\t\tcase TypeIntegerField:\n\t\t\t\t_, err = str.Int32()\n\t\t\tcase TypeBigIntegerField:\n\t\t\t\t_, err = str.Int64()\n\t\t\tcase TypePositiveBitField:\n\t\t\t\t_, err = str.Uint8()\n\t\t\tcase TypePositiveSmallIntegerField:\n\t\t\t\t_, err = str.Uint16()\n\t\t\tcase TypePositiveIntegerField:\n\t\t\t\t_, err = str.Uint32()\n\t\t\tcase TypePositiveBigIntegerField:\n\t\t\t\t_, err = str.Uint64()\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tif fieldType&IsPositiveIntegerField > 0 {\n\t\t\t\tv, _ := str.Uint64()\n\t\t\t\tvalue = v\n\t\t\t} else {\n\t\t\t\tv, _ := str.Int64()\n\t\t\t\tvalue = v\n\t\t\t}\n\t\t}\n\tcase fieldType == TypeFloatField || fieldType == TypeDecimalField:\n\t\tif str == nil {\n\t\t\tswitch v := val.(type) {\n\t\t\tcase float64:\n\t\t\t\tvalue = v\n\t\t\tdefault:\n\t\t\t\ts := StrTo(ToStr(v))\n\t\t\t\tstr = &s\n\t\t\t}\n\t\t}\n\t\tif str != nil {\n\t\t\tv, err := str.Float64()\n\t\t\tif err != nil {\n\t\t\t\ttErr = err\n\t\t\t\tgoto end\n\t\t\t}\n\t\t\tvalue = v\n\t\t}\n\tcase fieldType&IsRelField > 0:\n\t\t// fi = fi.relModelInfo.fields.pk\n\t\tfieldType = fi.fieldType\n\t\tgoto setValue\n\t}\n\nend:\n\tif tErr != nil {\n\t\terr := fmt.Errorf(\"convert to `%s` failed, field: %s err: %s\", fi.addrValue.Type(), fi.name, tErr)\n\t\treturn nil, err\n\t}\n\n\treturn value, nil\n\n}", "title": "" }, { "docid": "dc29d090540c021fc3069cffa8c4f683", "score": "0.51975894", "text": "func loadFromDB(into interface{}, bucket, key string) error {\n\treturn db.View(func(tx *bolt.Tx) error {\n\t\treturn loadFromBucket(into, tx.Bucket([]byte(bucket)), []byte(key))\n\t})\n}", "title": "" }, { "docid": "22230e3dd20802ea376e9d45e7a9e2fd", "score": "0.518522", "text": "func (m *BackupTime) FetchDataFromDB(db *DB, timeUnit string, timeLength int) {\n\titerator := NewDateIterator(db, timeUnit, timeLength)\n\tfor date := iterator.Next(); date.Valid; date = iterator.Next() {\n\t\trecords := iterator.GetRecordsForDate(\"repo_backup_times\", m, date.Value)\n\t\tm.AddDate(date.Value)\n\t\tfor obj := records.Next(); obj != nil; obj = records.Next() {\n\t\t\tm.AppendValues(obj, \"Took\", iterator.CurrentOffset)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8d68111273352cc9588a67ab803c531f", "score": "0.517718", "text": "func (d *dbBase) TimeFromDB(t *time.Time, tz *time.Location) {\n\t*t = t.In(tz)\n}", "title": "" }, { "docid": "532784fa1d2d3998afb732bfb1344f48", "score": "0.5167746", "text": "func (m *Folio) ToORM(ctx context.Context) (FolioORM, error) {\n\tto := FolioORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(FolioWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.UUID = m.UUID\n\tto.Name = m.Name\n\tto.Desc = m.Desc\n\tfor _, v := range m.Assets {\n\t\tif v != nil {\n\t\t\tif tempAssets, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Assets = append(to.Assets, &tempAssets)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Assets = append(to.Assets, nil)\n\t\t}\n\t}\n\tfor _, v := range m.Notes {\n\t\tif v != nil {\n\t\t\tif tempNotes, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Notes = append(to.Notes, &tempNotes)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Notes = append(to.Notes, nil)\n\t\t}\n\t}\n\tif m.Owner != nil {\n\t\ttempOwner, err := m.Owner.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Owner = &tempOwner\n\t}\n\tfor _, v := range m.Tags {\n\t\tif v != nil {\n\t\t\tif tempTags, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Tags = append(to.Tags, &tempTags)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Tags = append(to.Tags, nil)\n\t\t}\n\t}\n\tfor _, v := range m.Shares {\n\t\tif v != nil {\n\t\t\tif tempShares, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Shares = append(to.Shares, &tempShares)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Shares = append(to.Shares, nil)\n\t\t}\n\t}\n\tif m.Thumbnail != nil {\n\t\ttempThumbnail, err := m.Thumbnail.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Thumbnail = &tempThumbnail\n\t}\n\tif posthook, ok := interface{}(m).(FolioWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "79a77754ffc9a1cfa37f2dcb86eb0de6", "score": "0.51625144", "text": "func (m *TypeWithID) ToORM(ctx context.Context) (TypeWithIDORM, error) {\n\tto := TypeWithIDORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(TypeWithIDWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.Ip = m.Ip\n\tfor _, v := range m.Things {\n\t\tif v != nil {\n\t\t\tif tempThings, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Things = append(to.Things, &tempThings)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Things = append(to.Things, nil)\n\t\t}\n\t}\n\tif m.ANestedObject != nil {\n\t\ttempANestedObject, err := m.ANestedObject.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.ANestedObject = &tempANestedObject\n\t}\n\tif m.Point != nil {\n\t\ttempPoint, err := m.Point.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Point = &tempPoint\n\t}\n\tif m.User != nil {\n\t\ttempUser, err := m.User.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.User = &tempUser\n\t}\n\tif m.Address != nil {\n\t\tif to.Address, err = types1.ParseInet(m.Address.Value); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif posthook, ok := interface{}(m).(TypeWithIDWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "e02ce53dcade707bbafb6241c1ecaf63", "score": "0.5149741", "text": "func (s *Status) ToDB() ([]byte, error) {\n\treturn []byte(s.Name), nil\n}", "title": "" }, { "docid": "ddde9c203b8d5412625f5260b71b14fc", "score": "0.51381445", "text": "func (post AdminField) ToCardDB() AdminFieldDB {\n\tid, err := primitive.ObjectIDFromHex(post.ID)\n\tif err != nil {\n\t\tid = primitive.ObjectID{}\n\t}\n\treturn AdminFieldDB{\n\t\tID: id,\n\t\tCardProps: post.CardProps,\n\t\tStatus: post.Status,\n\t\tTags: post.Tags,\n\t}\n}", "title": "" }, { "docid": "b0e1485a6a8ee6daa81ccac2c353e3ff", "score": "0.51290375", "text": "func Convert(redisType, sqlUser, sqlPassword, sqlDatabase, sqlHost, sqlPort, sqlTable, redisAddr, redisPass, sqlType string) error {\n\tvar db *sql.DB\n\tvar err error\n\n\tswitch sqlType {\n\tcase \"mysql\":\n\t\tdb, err = OpenMySQL(sqlUser, sqlPassword, sqlDatabase, sqlHost, sqlPort)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \"postgres\":\n\t\tdb, err = OpenPostgres(sqlUser, sqlPassword, sqlDatabase, sqlHost, sqlPort)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn errors.New(\"unsupported sql database type\")\n\t}\n\n\trdb := OpenRedis(redisAddr, redisPass)\n\n\tdefer db.Close()\n\tdefer rdb.Close()\n\n\trows, err := db.Query(fmt.Sprintf(`SELECT * FROM %s`, sqlTable))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer rows.Close()\n\n\tcolumns, err := rows.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvalues := make([]sql.RawBytes, len(columns))\n\tscanArgs := make([]interface{}, len(values))\n\tfor i := range values {\n\t\tscanArgs[i] = &values[i]\n\t}\n\n\tindex := 0\n\tswitch redisType {\n\tcase \"string\":\n\t\tfor rows.Next() {\n\t\t\tif err = rows.Scan(scanArgs...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor i, col := range values {\n\t\t\t\tid := fmt.Sprintf(\"%s:%d:%s\", sqlTable, index, columns[i])\n\t\t\t\terr := rdb.Set(CTX, id, string(col), 0).Err()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tindex += 1\n\t\t}\n\tcase \"list\":\n\t\tfor rows.Next() {\n\t\t\tif err = rows.Scan(scanArgs...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfields := []string{}\n\t\t\tfor _, col := range values {\n\t\t\t\tfields = append(fields, string(col))\n\t\t\t}\n\t\t\tid := fmt.Sprintf(\"%s:%d\", sqlTable, index)\n\t\t\terr := rdb.RPush(CTX, id, fields).Err()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tindex += 1\n\t\t}\n\tcase \"hash\":\n\t\tfor rows.Next() {\n\t\t\tif err = rows.Scan(scanArgs...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trowMap := make(map[string]string)\n\t\t\tfor i, col := range values {\n\t\t\t\trowMap[columns[i]] = string(col)\n\t\t\t}\n\t\t\tid := fmt.Sprintf(\"%s:%d\", sqlTable, index)\n\t\t\terr := rdb.HSet(CTX, id, rowMap).Err()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tindex += 1\n\t\t}\n\t\tif err = rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "41f1e3d24009cf3ae9ab4726afad6442", "score": "0.5128553", "text": "func (m *PostDB) DB() interface{} {\n\treturn m.Db\n}", "title": "" }, { "docid": "4ed5b75ac318d5e5a402a0e1977927a9", "score": "0.51209235", "text": "func (p Photo) ToDAO(dao *PhotoDAO) {\n\tdao.ID, _ = primitive.ObjectIDFromHex(p.ID)\n\tdao.OwnerID, _ = primitive.ObjectIDFromHex(p.OwnerID)\n\tdao.Base64 = p.Base64\n\tdao.Description = p.Description\n\tdao.Name = p.Name\n\tdao.Type = p.Type\n}", "title": "" }, { "docid": "9a2216cf24abc494c3646f3f0b7b9a48", "score": "0.5114312", "text": "func (b *BaseBuilder) DB() *DB {\n\treturn b.db\n}", "title": "" }, { "docid": "b513072561f5c11d54bdc636a8c73ac2", "score": "0.50743634", "text": "func (q *BaseQueryBuilder) DB() *DB {\n\treturn q.db\n}", "title": "" }, { "docid": "d1e76c165e58032da2fb7df1a69fb7f7", "score": "0.5050731", "text": "func (s *Seriesly) DB(db string) *SerieslyDB {\n\treturn &SerieslyDB{s, db}\n}", "title": "" }, { "docid": "ab2fadf2e01bbbdd4ad68db535e6b80c", "score": "0.5040118", "text": "func (m *FolioORM) ToPB(ctx context.Context) (Folio, error) {\n\tto := Folio{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(FolioWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.UUID = m.UUID\n\tto.Name = m.Name\n\tto.Desc = m.Desc\n\tfor _, v := range m.Assets {\n\t\tif v != nil {\n\t\t\tif tempAssets, cErr := v.ToPB(ctx); cErr == nil {\n\t\t\t\tto.Assets = append(to.Assets, &tempAssets)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Assets = append(to.Assets, nil)\n\t\t}\n\t}\n\tfor _, v := range m.Notes {\n\t\tif v != nil {\n\t\t\tif tempNotes, cErr := v.ToPB(ctx); cErr == nil {\n\t\t\t\tto.Notes = append(to.Notes, &tempNotes)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Notes = append(to.Notes, nil)\n\t\t}\n\t}\n\tif m.Owner != nil {\n\t\ttempOwner, err := m.Owner.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Owner = &tempOwner\n\t}\n\tfor _, v := range m.Tags {\n\t\tif v != nil {\n\t\t\tif tempTags, cErr := v.ToPB(ctx); cErr == nil {\n\t\t\t\tto.Tags = append(to.Tags, &tempTags)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Tags = append(to.Tags, nil)\n\t\t}\n\t}\n\tfor _, v := range m.Shares {\n\t\tif v != nil {\n\t\t\tif tempShares, cErr := v.ToPB(ctx); cErr == nil {\n\t\t\t\tto.Shares = append(to.Shares, &tempShares)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Shares = append(to.Shares, nil)\n\t\t}\n\t}\n\tif m.Thumbnail != nil {\n\t\ttempThumbnail, err := m.Thumbnail.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Thumbnail = &tempThumbnail\n\t}\n\tif posthook, ok := interface{}(m).(FolioWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "800c437213975e2ca4985b960712fb15", "score": "0.50358754", "text": "func (m *DomainFilesNewAndChanged) FetchDataFromDB(db *DB, timeUnit string, timeLength int) {\n\titerator := NewDateIterator(db, timeUnit, timeLength)\n\tfor date := iterator.Next(); date.Valid; date = iterator.Next() {\n\t\trecords := iterator.GetRecordsForDate(\"snapshot\", m, date.Value)\n\t\tm.AddDate(date.Value)\n\t\tfor obj := records.Next(); obj != nil; obj = records.Next() {\n\t\t\tm.AppendMultipleValues(obj, []string{\"FilesNew\", \"FilesChanged\"}, iterator.CurrentOffset)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0dc3365513628a7ae198ff899db9943b", "score": "0.50271165", "text": "func DatamapFromDB(name string, db *sql.DB) (ExtractedDatamapFile, error) {\n\n\tvar out ExtractedDatamapFile\n\n\tquery := `\n\tselect\n\t\tkey, sheet, cellref\n\tfrom datamap_line\n\t\tjoin datamap on datamap_line.dm_id = datamap.id where datamap.name = ?;\n\t`\n\trows, err := db.Query(query, name)\n\tif err != nil {\n\t\terstr := fmt.Sprintf(\"cannot query for datamap key, sheet and cellref - %v\", err)\n\t\treturn nil, errors.New(erstr)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tkey string\n\t\t\tsheet string\n\t\t\tcellref string\n\t\t)\n\t\tif err := rows.Scan(&key, &sheet, &cellref); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tout = append(out, datamapLine{Key: key, Sheet: sheet, Cellref: cellref})\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "41eab0becc9974386f2d7b8f09af3c1d", "score": "0.5026235", "text": "func (m *DBModel) parseToQuery(ent interface{}) (bson.M, error) {\n\tif ent == nil {\n\t\treturn bson.M{}, nil\n\t}\n\n\tsel, err := bson.Marshal(ent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobj := bson.M{}\n\tbson.Unmarshal(sel, &obj)\n\n\treturn obj, nil\n}", "title": "" }, { "docid": "ce785e24abffaeb294fd27d01a4361d6", "score": "0.50245374", "text": "func (c *Get) FromDB(db dbdt.Conversation) {\n\tc.Basic.FromDB(db.Basic)\n\n\tc.ClientID = db.ClientID\n\tc.ConversationAdmin = db.ConversationAdmin\n\tc.ConversationName = db.ConversationName\n\n\tvar jMember Member\n\n\tfor _, member := range db.Members {\n\t\tmemberFromDB(member, &jMember)\n\t\tc.Members = append(c.Members, jMember)\n\t}\n\n}", "title": "" }, { "docid": "b72af570b68189373560a6169f8e8f4d", "score": "0.50169826", "text": "func getAllFile(session *gocql.Session,data *Data){\n \n var (\n id int\n completed bool\n name string\n due time.Time\n ) \n query := session.Query(\"SELECT id,name,completed,due FROM \"+TABLE_NAME+\";\").Iter()\n for query.Scan(&id,&name,&completed,&due) {\n file:=&File{}\n file.Id=id\n file.Name=name\n file.Completed=completed\n file.Due=due\n data.append(file)\n\n\n }\n}", "title": "" }, { "docid": "a0248f2833085905e0b1641d148b0ccb", "score": "0.49987924", "text": "func (rep *repository) Model(value interface{}) *gorm.DB {\n\treturn rep.db.Model(value)\n}", "title": "" }, { "docid": "623168eca2601759319f0f6827dc88d5", "score": "0.49927035", "text": "func (c *File) ToDBValues() map[string]interface{} {\n\tresult := make(map[string]interface{})\n \n\n \n \n \n result[\"filetype\"]=c.Filetype\n \n \n \n \n \n result[\"path\"]=c.Path\n \n \n \n \n \n result[\"title\"]=c.Title\n \n \n \n\treturn result\n}", "title": "" }, { "docid": "5e4b01fb5a4958f318ffbc3c19827aa9", "score": "0.4976953", "text": "func Martualtobson(Data Data) (value []byte, err error) {\n\tvalue, err = json.Marshal(Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn value, nil\n}", "title": "" }, { "docid": "4aa0b0cfdd94f4ba4ebccea1957d6d7c", "score": "0.4945949", "text": "func (m *Subway) ToORM(ctx context.Context) (SubwayORM, error) {\n\tto := SubwayORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(SubwayWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Name = m.Name\n\tto.LineColor = m.LineColor\n\tif m.GetPoint() != nil {\n\t\ttempPoint, err := m.GetPoint().ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Point = &tempPoint\n\t}\n\tto.DistanceFromPolygon = m.DistanceFromPolygon\n\tif posthook, ok := interface{}(m).(SubwayWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "2597014a1332deaa0d27e7a1208f233a", "score": "0.49356604", "text": "func (j *PreferencesJsonData) FromDB(data []byte) error {\n\tdec := json.NewDecoder(bytes.NewBuffer(data))\n\tdec.UseNumber()\n\treturn dec.Decode(j)\n}", "title": "" }, { "docid": "f311c8c338b571494ddd93555ca43d7b", "score": "0.49300322", "text": "func (m *Note) ToORM(ctx context.Context) (NoteORM, error) {\n\tto := NoteORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(NoteWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.Name = m.Name\n\tto.Note = m.Note\n\tif m.Folio != nil {\n\t\ttempFolio, err := m.Folio.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Folio = &tempFolio\n\t}\n\tif m.Thumbnail != nil {\n\t\ttempThumbnail, err := m.Thumbnail.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Thumbnail = &tempThumbnail\n\t}\n\tif posthook, ok := interface{}(m).(NoteWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "a152a72de2cd52ee7d1df851784cc19e", "score": "0.4929813", "text": "func (m *Share) ToORM(ctx context.Context) (ShareORM, error) {\n\tto := ShareORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(ShareWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.Friend != nil {\n\t\ttempFriend, err := m.Friend.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Friend = &tempFriend\n\t}\n\tif m.Thumbnail != nil {\n\t\ttempThumbnail, err := m.Thumbnail.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Thumbnail = &tempThumbnail\n\t}\n\tfor _, v := range m.Folios {\n\t\tif v != nil {\n\t\t\tif tempFolios, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Folios = append(to.Folios, &tempFolios)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Folios = append(to.Folios, nil)\n\t\t}\n\t}\n\tif posthook, ok := interface{}(m).(ShareWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "297bc474a46b66a4021eea49ca60a41c", "score": "0.4929099", "text": "func (obj *content) Database() Database {\n\treturn obj.db\n}", "title": "" }, { "docid": "9b97a974a2cfdafdc82cdc577def7036", "score": "0.49111348", "text": "func (db *gormDB) DB() (*sql.DB, error) {\n\treturn db.db.DB()\n}", "title": "" }, { "docid": "9a443e8847596a6caa88636e532f69d1", "score": "0.48980662", "text": "func (c ContentCommon) ToDBValues() map[string]interface{} {\n\tresult := map[string]interface{}{\n\t\t\"id\": c.CID,\n\t\t\"version\": c.Version,\n\t\t\"published\": c.Published,\n\t\t\"modified\": c.Modified,\n\t\t\"status\": c.Status,\n\t\t\"author\": c.Author,\n\t\t\"cuid\": c.CUID,\n\t}\n\treturn result\n}", "title": "" }, { "docid": "6a577e1ebd36e04932ed6085267904c9", "score": "0.48807567", "text": "func (d *DB) DB() *bolt.DB {\n\treturn d.db\n}", "title": "" }, { "docid": "bd1844eda33d089aee0d723639faed50", "score": "0.48733115", "text": "func (m *DomainFilesProcessed) FetchDataFromDB(db *DB, timeUnit string, timeLength int) {\n\titerator := NewDateIterator(db, timeUnit, timeLength)\n\tfor date := iterator.Next(); date.Valid; date = iterator.Next() {\n\t\trecords := iterator.GetRecordsForDate(\"snapshot\", m, date.Value)\n\t\tm.AddDate(date.Value)\n\t\tfor obj := records.Next(); obj != nil; obj = records.Next() {\n\t\t\tm.AppendValues(obj, \"TotalFilesProcessed\", iterator.CurrentOffset)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36513dd4d85a95e235bd8fc696302144", "score": "0.48706546", "text": "func (db *DB) DB() *sqlx.DB {\n\treturn db.db\n}", "title": "" }, { "docid": "efd02762124eec6ccfcbb2197ba5da5a", "score": "0.48673677", "text": "func (m *DBModel) Query(query bson.M, offset int, limit int, reverse bool, result interface{}) error {\n\t// col, err := m.GetCollection()\n\n\ts := m.GetFreshSession()\n\tdefer s.Close()\n\tcol, err := m.GetColWith(s)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tq := col.Find(query)\n\tif limit > 0 {\n\t\tq.Limit(limit)\n\t}\n\tif offset > 0 {\n\t\tq.Skip(offset)\n\t}\n\tif reverse {\n\t\tq.Sort(\"-_id\")\n\t}\n\n\terr = q.All(result)\n\treturn err\n}", "title": "" }, { "docid": "7492fe88f563dbab1e32cd4f000a69e0", "score": "0.48627713", "text": "func (m *DomainDiskSpaceOnRestore) FetchDataFromDB(db *DB, timeUnit string, timeLength int) {\n\titerator := NewDateIterator(db, timeUnit, timeLength)\n\tfor date := iterator.Next(); date.Valid; date = iterator.Next() {\n\t\trecords := iterator.GetRecordsForDate(\"domain_raw_data\", m, date.Value)\n\t\tm.AddDate(date.Value)\n\t\tfor obj := records.Next(); obj != nil; obj = records.Next() {\n\t\t\tm.AppendValues(obj, \"TotalSize\", iterator.CurrentOffset)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "38dd4d6ea2c2184692ad92f1720c1ff5", "score": "0.48517856", "text": "func (c *Usergroup) ToDBValues() map[string]interface{} {\n\tresult := make(map[string]interface{})\n \n\n \n \n \n result[\"summary\"]=c.Summary\n \n \n \n \n \n result[\"title\"]=c.Title\n \n \n \n\tfor key, value := range c.ContentCommon.ToDBValues() {\n\t\tresult[key] = value\n\t}\n\treturn result\n}", "title": "" }, { "docid": "dab8a94ef9dc747c7ddba5cc69efb504", "score": "0.48345575", "text": "func (m *Point) ToORM(ctx context.Context) (PointORM, error) {\n\tto := PointORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(PointWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Lat = m.Lat\n\tto.Lng = m.Lng\n\tif posthook, ok := interface{}(m).(PointWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "b2d6a1515c22d9badf29020b88563cd4", "score": "0.4827598", "text": "func (h *Handler) Connection() *gorm.DB { return h.db }", "title": "" }, { "docid": "5cfe36b53b98a3d7777df96427728ee7", "score": "0.48233655", "text": "func (m *SportsObject) ToORM(ctx context.Context) (SportsObjectORM, error) {\n\tto := SportsObjectORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(SportsObjectWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ObjectId = m.ObjectId\n\tto.ObjectName = m.ObjectName\n\tto.ObjectAddress = m.ObjectAddress\n\tif m.GetObjectPoint() != nil {\n\t\ttempObjectPoint, err := m.GetObjectPoint().ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.ObjectPoint = &tempObjectPoint\n\t}\n\tto.DepartmentalOrganizationId = m.DepartmentalOrganizationId\n\tto.DepartmentalOrganizationName = m.DepartmentalOrganizationName\n\tto.Availability = m.Availability\n\tto.ObjectSumSquare = m.ObjectSumSquare\n\tif posthook, ok := interface{}(m).(SportsObjectWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "e97249d132f16a8056ed353772f12dda", "score": "0.48192856", "text": "func (dao PhotoDAO) ToModel(p *Photo) {\n\tp.ID = dao.ID.Hex()\n\tp.OwnerID = dao.OwnerID.Hex()\n\tp.Base64 = dao.Base64\n\tp.Description = dao.Description\n\tp.Name = dao.Name\n\tp.Type = dao.Type\n}", "title": "" }, { "docid": "78e591f2360d68b499a32c3057818dc0", "score": "0.48157924", "text": "func GetDB() *gorm.DB {\n return db\n}", "title": "" }, { "docid": "78e591f2360d68b499a32c3057818dc0", "score": "0.48157924", "text": "func GetDB() *gorm.DB {\n return db\n}", "title": "" }, { "docid": "8c8d938eefdf370dbd25201381bfc255", "score": "0.4809345", "text": "func (scraper *Scraper) ScrapeToDb(gameweek int) {\n\tscraper.updateScores(gameweek)\n}", "title": "" }, { "docid": "703da149d71c42ab90b0b8fc78087ea4", "score": "0.47971013", "text": "func (dc DBCalls) GetFromDB(query string) (*sql.Rows, error) {\n\treturn db.Query(query)\n}", "title": "" }, { "docid": "573df9a594206c2fc7d3fb25b0570dbf", "score": "0.479352", "text": "func (s *Datastore) DB() *sqlx.DB {\n\treturn s.db\n}", "title": "" }, { "docid": "a05a7541254a7c02c2d334e853714b4a", "score": "0.4785382", "text": "func (g *Grapi) DB() *gorm.DB {\n\treturn g.db\n}", "title": "" }, { "docid": "5436cef35640182e5758455372ee20bc", "score": "0.47799778", "text": "func main() {\n\n\t//Return DB connection object based on config file\n\tdatabase := db.GetConnection(\"config.ini\") //Pass configuration file location\n\n\t//Create and return a new object\n\t//record := db.NewObject()\n\n\t//Saving object\n\t//record.Set(\"student.name\", \"suriya\")\n\t//record.Set(\"student.mark\", 52)\n\t//record.Set(\"student.age\", 24)\n\t//record.Set(\"employee.name\", \"williams\")\n\t//record.Set(\"fruits\",[]string{\"apple\",\"orange\"})\n\t//database.Save(record)\n\n\t//Saving Json\n\t//database.Save(`{\"name\":\"hello\"}`)\n\n\t//Read all records from database\n\tallRec := database.Read()\n\tfmt.Println(allRec)\n\n\t//Read record by id from database\n\trecById := database.FindById(\"53fd9d1eb0985415f02f75e2\")\n\tfmt.Println(recById)\n\n\t//Read first record from database\n\trecFirst := database.First()\n\tfmt.Println(recFirst)\n\t\n\t//Read limited number of records from database\n\trecLimit := database.Limit(2)\n\tfmt.Println(recLimit)\n\n\t//Get record count from database\n\tcount := database.Count()\n\tfmt.Println(count)\n\t\n\t//Get records based on query string.\n\trecWhere := database.Where(\"mark == 36\")\n\tfmt.Println(recWhere)\n\n\t//Converting to Json\n\tfmt.Println(allRec[0].ToJson())\n\t\n\t//Update using object\n\t//allRec[0].Set(\"student.communication.telephone\",\"2332348\")\n\t//database.Update(allRec[0])\n\n\t//Update using json\n\t//database.Update(`{\"_id\":\"53fd9cf3b0985415f02f75e1\",\"name\":\"world\"}`)\n\n\t//Delete using object\n\t//database.Delete(allRec[1])\n\t\n\t//Delete using json\n\t//database.Delete(`{\"_id\":\"53fd78d9b0985415f02f75de\"}`)\n\n //Merge using json\n database.Merge(`{\"_id\":\"54045b66a4cc0c7a7df045c2\",\"name\":\"hello\"}`)\n fmt.Println(database.FindById(\"54045b66a4cc0c7a7df045c2\"))\n}", "title": "" }, { "docid": "67f794cffca995693a537af9db81428d", "score": "0.47793666", "text": "func (edgeData *AssocEdgeData) DBFields() DBFields {\n\t// can cache AssocEdgeData though :/\n\t// however leaving as-is because probably better for when this comes from a different cache\n\treturn DBFields{\n\t\t\"edge_type\": func(v interface{}) error {\n\t\t\tedgeType, err := cast.ToUUIDString(v)\n\t\t\tedgeData.EdgeType = EdgeType(edgeType)\n\t\t\treturn err\n\t\t},\n\t\t\"edge_name\": func(v interface{}) error {\n\t\t\tvar err error\n\t\t\tedgeData.EdgeName, err = cast.ToString(v)\n\t\t\treturn err\n\t\t},\n\t\t\"symmetric_edge\": func(v interface{}) error {\n\t\t\tvar err error\n\t\t\tedgeData.SymmetricEdge, err = cast.ToBool(v)\n\t\t\treturn err\n\t\t},\n\t\t\"inverse_edge_type\": func(v interface{}) error {\n\t\t\tid, err := cast.ToUUIDString(v)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// empty string. nothing to do here since this is nullable\n\t\t\tif id == \"\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn edgeData.InverseEdgeType.Scan(id)\n\t\t},\n\t\t\"edge_table\": func(v interface{}) error {\n\t\t\tvar err error\n\t\t\tedgeData.EdgeTable, err = cast.ToString(v)\n\t\t\treturn err\n\t\t},\n\t\t\"created_at\": func(v interface{}) error {\n\t\t\tvar err error\n\t\t\tedgeData.CreatedAt, err = cast.ToTime(v)\n\t\t\treturn err\n\t\t},\n\t\t\"updated_at\": func(v interface{}) error {\n\t\t\tvar err error\n\t\t\tedgeData.UpdatedAt, err = cast.ToTime(v)\n\t\t\treturn err\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4a74cd574cf0c182f504157d4288be44", "score": "0.47734615", "text": "func TestGORM(t *testing.T) {\n\tuser := User{Name: \"jinzhu\", Age: 33, Active:true}\n\n\tDB.Create(&user)\n\n\tvar result User\n\tif err := DB.First(&result, user.ID).Error; err != nil {\n\t\tt.Errorf(\"Failed, got error: %v\", err)\n\t}\n\tlog.Println(result)\n\tdata:=structs.Map(result)\n\tvar updatedData User\n\tif err:=DB.Table(\"users\").Where(\"id = ?\",1).Omit(\"Name\").Updates(data).Scan(&updatedData); err!=nil{\n\t\tt.Errorf(\"Failed, got error: %v\",err)\n\t}\n\tlog.Println(updatedData)\n}", "title": "" }, { "docid": "7cef727fd8abfc9e9c153ce2083b0627", "score": "0.4769899", "text": "func (*ConcreteDB) Select() manager.Mail", "title": "" }, { "docid": "78c5900c992d04483c8c1bdaef244865", "score": "0.47690338", "text": "func (d *dbBase) TimeToDB(t *time.Time, tz *time.Location) {\n\t*t = t.In(tz)\n}", "title": "" }, { "docid": "7814430606f8695a5ddec2fd5ca06ccf", "score": "0.47689724", "text": "func (c *PersistenceContext) GetData() Data {\n\treturn c.Persistence.GetData(c.PK)\n}", "title": "" }, { "docid": "769c1c8538df0d95f82bf75c896ca51c", "score": "0.4765496", "text": "func (tbl XUserTable) DB() *sql.DB {\n\treturn tbl.db.(*sql.DB)\n}", "title": "" }, { "docid": "bcc72d191f6968e096cdc6f5ed061121", "score": "0.4757334", "text": "func (p *Proxy) Load(db DB) error {\n\tpks := sq.Eq{}\n\tfor _, pk := range p.schema.xinfo.pk {\n\t\tpks[pk] = p.Field(pk).Interface()\n\t}\n\tif len(pks) == 0 {\n\t\tlog.Panicf(\n\t\t\t\"y/proxy: No primary key found in the \\\"%s\\\".\",\n\t\t\tp.schema.table)\n\t}\n\treturn p.Find(ByEq(pks)).Load(db)\n}", "title": "" }, { "docid": "4ae0de039b7059b9cb51f4d0fb71222e", "score": "0.4753257", "text": "func copyMetricFromDbModel(dm *data_access.DbMetric) *Metric {\n\treturn &Metric{Name:dm.Name, Longitude:dm.Longitude, Latitude:dm.Latitude, Timestamp:dm.Timestamp, DriverId:dm.DriverId, Value:dm.Value}\n}", "title": "" }, { "docid": "d47acd70e403fb737a9c00cd2208ab54", "score": "0.4752899", "text": "func (m *ProfileDB) DB() interface{} {\n\treturn m.Db\n}", "title": "" }, { "docid": "e814a8ed886a876a4a633d1dcb5a7623", "score": "0.4748748", "text": "func (c *conn) DB() *gosql.DB {\n\treturn c.db\n}", "title": "" }, { "docid": "c0c2e900f8031e694c4b105dc907031c", "score": "0.4743528", "text": "func (bridge *OvsBridge) ReadFromDBRow(row *libovsdb.Row) error {\n\tif bridge.PortUUIDs == nil {\n\t\tbridge.PortUUIDs = make([]string, 0)\n\t}\n\tfor field, value := range row.Fields {\n\t\tswitch field {\n\t\tcase \"name\":\n\t\t\tbridge.Name = value.(string)\n\t\tcase \"datapath_id\":\n\t\t\tswitch value.(type) {\n\t\t\tcase string:\n\t\t\t\tbridge.DatapathID = value.(string)\n\t\t\t}\n\t\tcase \"ports\":\n\t\t\tswitch value.(type) {\n\t\t\tcase libovsdb.UUID:\n\t\t\t\tbridge.PortUUIDs = append(bridge.PortUUIDs, value.(libovsdb.UUID).GoUUID)\n\t\t\tcase libovsdb.OvsSet:\n\t\t\t\tfor _, uuids := range value.(libovsdb.OvsSet).GoSet {\n\t\t\t\t\tbridge.PortUUIDs = append(bridge.PortUUIDs, uuids.(libovsdb.UUID).GoUUID)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0db221fa83016b5c0e9b8f2ea14a70d0", "score": "0.47373903", "text": "func (m *Prov) GetAllDataFromDB() (data []*Prov, err error) {\n\tdata = make([]*Prov, 0)\n\tdata = append(data, &Prov{\n\t\tID: 51,\n\t\tName: \"四川\",\n\t})\n\tdata = append(data, &Prov{\n\t\tID: 50,\n\t\tName: \"重庆\",\n\t})\n\tdata = append(data, &Prov{\n\t\tID: 11,\n\t\tName: \"北京\",\n\t})\n\treturn\n}", "title": "" }, { "docid": "f7c662f43b42d3ab9a0f83bb2799b3dc", "score": "0.47365543", "text": "func talonToLua(engine *lua.Engine, v interface{}) interface{} {\n\tswitch t := v.(type) {\n\tcase *talon.Rows:\n\t\treturn engine.NewUserData(t, engine.Meta[keys.TalonRowsMetatable])\n\tcase *talon.Row:\n\t\treturn engine.NewUserData(t, engine.Meta[keys.TalonRowMetatable])\n\tdefault:\n\t\treturn v\n\t}\n}", "title": "" }, { "docid": "fca47f7bc31707922c3446d906ef3d34", "score": "0.4736289", "text": "func (b *BaseData) Prepare() {\n}", "title": "" }, { "docid": "04e494b249e7e95393a848c4a1264c38", "score": "0.4735499", "text": "func (stManager *scaleTeamManager) DB() *gorm.DB {\n\treturn stManager.db\n}", "title": "" }, { "docid": "9a9b9b156c9402829e89fa98155c7b34", "score": "0.47334564", "text": "func (m *MultiaccountTypeWithID) ToORM(ctx context.Context) (MultiaccountTypeWithIDORM, error) {\n\tto := MultiaccountTypeWithIDORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(MultiaccountTypeWithIDWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.SomeField = m.SomeField\n\taccountID, err := auth1.GetAccountID(ctx, nil)\n\tif err != nil {\n\t\treturn to, err\n\t}\n\tto.AccountID = accountID\n\tif posthook, ok := interface{}(m).(MultiaccountTypeWithIDWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "8ea774bf4d0d29789b267997736028d2", "score": "0.47318414", "text": "func (dao *SysDictTypeDao) DB() gdb.DB {\n\treturn g.DB(dao.group)\n}", "title": "" }, { "docid": "7bb3fd765228906562dd881c9b0a5666", "score": "0.47293147", "text": "func (b *BaseStore) Apply(opts ListOpts, db *gorm.DB) *gorm.DB {\n\tif opts == nil {\n\t\treturn db\n\t}\n\n\tif opts.Offset() != nil {\n\t\tdb = db.Offset(*opts.Offset())\n\t}\n\n\tif opts.Max() != nil {\n\t\tdb = db.Limit(*opts.Max())\n\t}\n\n\tif len(opts.Sort()) > 0 {\n\t\tdb = db.Order(opts.SortString())\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "f3dcea4aa181bf9d07b70657156ca1b2", "score": "0.47279623", "text": "func (odr *LesOdr) Database() mandb.Database {\n\treturn odr.db\n}", "title": "" }, { "docid": "101d15552ce96b06dfa3fc1d30e959ba", "score": "0.4725074", "text": "func ResultFromDB(pkg string) (*result, error) {\n\tvar result *result\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\tval := tx.Bucket([]byte(resultBucket)).Get([]byte(pkg))\n\t\tif val == nil {\n\t\t\t// not found so just leave result\n\t\t\treturn nil\n\t\t}\n\n\t\tvar buf bytes.Buffer\n\t\tif _, err := buf.Write(val); err != nil {\n\t\t\treturn fmt.Errorf(\"could not write result to buffer: %s\", err)\n\t\t}\n\n\t\tdec := gob.NewDecoder(&buf)\n\t\tif err := dec.Decode(&result); err != nil {\n\t\t\tlog.Printf(\"bytes: %s\", buf.Bytes())\n\t\t\treturn fmt.Errorf(\"could not decode result %s: %s\", val, err)\n\t\t}\n\t\treturn nil\n\t})\n\treturn result, err\n}", "title": "" }, { "docid": "8d639b3c001326c1675a26eae1d6cc5b", "score": "0.4710495", "text": "func newdbBaseMongo() dbBaser {\n\tb := new(dbBaseMongo)\n\tb.ins = b\n\treturn b\n}", "title": "" }, { "docid": "ed75f70e23646fc4d819a01b9d423e6f", "score": "0.47058445", "text": "func (rep *repository) Create(value interface{}) *gorm.DB {\n\treturn rep.db.Create(value)\n}", "title": "" }, { "docid": "52925419ab62bfc9ed0ee11b64fcdda6", "score": "0.4702558", "text": "func (trademark *Trademark) ToDB() *DBTrademark {\n\treturn &DBTrademark{\n\t\tApplicationNumber: trademark.ApplicationNumber,\n\t\tApplicationDate: trademark.ApplicationDate,\n\t\tRegistrationDate: trademark.RegistrationDate,\n\t\tApplicationLanguageCode: trademark.ApplicationLanguageCode,\n\t\tSecondLanguageCode: trademark.SecondLanguageCode,\n\t\tExpiryDate: trademark.ExpiryDate,\n\t\tName: trademark.Name,\n\t}\n}", "title": "" }, { "docid": "9dbb5e11e52fee04198dff1afe72184c", "score": "0.4700175", "text": "func (m *NoteORM) ToPB(ctx context.Context) (Note, error) {\n\tto := Note{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(NoteWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.Name = m.Name\n\tto.Note = m.Note\n\tif m.Folio != nil {\n\t\ttempFolio, err := m.Folio.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Folio = &tempFolio\n\t}\n\tif m.Thumbnail != nil {\n\t\ttempThumbnail, err := m.Thumbnail.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Thumbnail = &tempThumbnail\n\t}\n\tif posthook, ok := interface{}(m).(NoteWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "a34669df463238d32c8e406d0499ce75", "score": "0.46912545", "text": "func (paymentYandex PaymentYandex) create() (Entity, error) {\n\t_item := paymentYandex\n\tif err := db.Create(&_item).Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := _item.GetPreloadDb(false,false, nil).First(&_item,_item.Id).Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar entity Entity = &_item\n\n\treturn entity, nil\n}", "title": "" }, { "docid": "35589ef7ba638456f358a0e78c57997e", "score": "0.46877754", "text": "func (rep *repository) Raw(sql string, values ...interface{}) *gorm.DB {\n\treturn rep.db.Raw(sql, values...)\n}", "title": "" }, { "docid": "0cdfa33bc44195c535f391025ed3e85f", "score": "0.46869728", "text": "func transformFieldsToDb(fields map[string]interface{}) map[string]interface{} {\n\tnewMap := make(map[string]interface{})\n\tfor k, v := range fields {\n\t\tnewMap[strcase.ToSnake(k)] = v\n\t}\n\treturn newMap\n}", "title": "" }, { "docid": "a6a96b528faebf5823fe69483e2d6a67", "score": "0.46849406", "text": "func (m *Tag) ToORM(ctx context.Context) (TagORM, error) {\n\tto := TagORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(TagWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.Kind = m.Kind\n\tto.Label = m.Label\n\tto.Desc = m.Desc\n\tfor _, v := range m.Folios {\n\t\tif v != nil {\n\t\t\tif tempFolios, cErr := v.ToORM(ctx); cErr == nil {\n\t\t\t\tto.Folios = append(to.Folios, &tempFolios)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Folios = append(to.Folios, nil)\n\t\t}\n\t}\n\tif m.Thumbnail != nil {\n\t\ttempThumbnail, err := m.Thumbnail.ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Thumbnail = &tempThumbnail\n\t}\n\tif posthook, ok := interface{}(m).(TagWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "240c9946f3cc73ab548386e66f9cea93", "score": "0.4684832", "text": "func (a *App) DB() *sql.DB { return a.db }", "title": "" }, { "docid": "2710854dd928bd7549c88cafeafd9ea9", "score": "0.46844265", "text": "func (dc DBCalls) GetOneFromDB(query string) *sql.Row {\n\treturn db.QueryRow(query)\n}", "title": "" }, { "docid": "4056d8fc7b31a5c56c08780abb2bcf5b", "score": "0.46775112", "text": "func (p *Persistence) All(to interface{}) error {\n\treturn p.DBConn.All(to)\n}", "title": "" }, { "docid": "44c2cfaf0d997aa8eb58098b0e371692", "score": "0.46756884", "text": "func (m *Pollution) ToORM(ctx context.Context) (PollutionORM, error) {\n\tto := PollutionORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(PollutionWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.AdmArea = m.AdmArea\n\tto.District = m.District\n\tto.Location = m.Location\n\tto.IsPolluted = m.IsPolluted\n\tif m.GetObjectPoint() != nil {\n\t\ttempObjectPoint, err := m.GetObjectPoint().ToORM(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.ObjectPoint = &tempObjectPoint\n\t}\n\tto.Results = m.Results\n\tif posthook, ok := interface{}(m).(PollutionWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "20134bc4d4b128a4f15fc8ba356ff45d", "score": "0.4674604", "text": "func (dao *OnlineUserDao) DB() gdb.DB {\n\treturn g.DB(dao.Group)\n}", "title": "" }, { "docid": "fa1b64d32c0e992e92f6fe101402a43c", "score": "0.46725884", "text": "func (db *Database) DB() (*sql.DB, error) {\n\treturn db.GormDB.DB()\n\n}", "title": "" }, { "docid": "e2735d3f984c69334174557ab43cdf9b", "score": "0.46725038", "text": "func (dao *DAO) Query(handler func(*gorm.DB) error) error {\n\treturn handler(dao.db)\n}", "title": "" }, { "docid": "f9bd8ca7c11a0cf63d6f63d2eec51337", "score": "0.46694425", "text": "func (m *ToDo) ToORM(ctx context.Context) (ToDoORM, error) {\n\tto := ToDoORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(ToDoWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.Title = m.Title\n\tto.Description = m.Description\n\tif m.Reminder != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.Reminder); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Reminder = t\n\t}\n\tif posthook, ok := interface{}(m).(ToDoWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "84cb8d8db611454a662774959309e9c8", "score": "0.46606928", "text": "func (rc *RecordCollection) create(data RecordData) *RecordCollection {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tpanic(rc.substituteSQLErrorMessage(r))\n\t\t}\n\t}()\n\trc.CheckExecutionPermission(rc.model.methods.MustGet(\"Create\"))\n\t// process create data for FK relations if any\n\tdata = rc.createFKRelationRecords(data)\n\n\tnewData := data.Underlying().Copy()\n\trc.applyDefaults(newData, true)\n\tfMap := newData.Underlying().FieldMap\n\trc.applyContexts()\n\trc.addAccessFieldsCreateData(&fMap)\n\tfMap = rc.addEmbeddedfields(fMap)\n\trc.model.convertValuesToFieldType(&fMap, true)\n\tfMap = rc.addContextsFieldsValues(fMap)\n\t// clean our fMap from ID and non stored fields\n\tfMap.RemovePKIfZero()\n\tstoredFieldMap := rc.filterMapOnStoredFields(fMap)\n\t// insert in DB\n\tvar createdId int64\n\tquery, args := rc.query.insertQuery(storedFieldMap)\n\trc.env.cr.Get(&createdId, query, args...)\n\n\trc.env.cache.addRecord(rc.model, createdId, storedFieldMap, rc.query.ctxArgsSlug())\n\trSet := rc.withIds([]int64{createdId})\n\t// update reverse relation fields\n\trSet.updateRelationFields(fMap)\n\t// update related fields\n\trSet.updateRelatedFields(fMap)\n\t// process create data for reverse relations if any\n\trSet.createReverseRelationRecords(data)\n\t// compute stored fields\n\trSet.processInverseMethods(data)\n\trSet.processTriggers(fMap.FieldNames(rSet.model))\n\trSet.CheckConstraints(data.Underlying().FieldNames())\n\treturn rSet\n}", "title": "" }, { "docid": "96c356e7d0338690e1b2da236d9d6708", "score": "0.4654839", "text": "func (m *TypeWithIDORM) ToPB(ctx context.Context) (TypeWithID, error) {\n\tto := TypeWithID{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(TypeWithIDWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tto.Ip = m.Ip\n\tfor _, v := range m.Things {\n\t\tif v != nil {\n\t\t\tif tempThings, cErr := v.ToPB(ctx); cErr == nil {\n\t\t\t\tto.Things = append(to.Things, &tempThings)\n\t\t\t} else {\n\t\t\t\treturn to, cErr\n\t\t\t}\n\t\t} else {\n\t\t\tto.Things = append(to.Things, nil)\n\t\t}\n\t}\n\tif m.ANestedObject != nil {\n\t\ttempANestedObject, err := m.ANestedObject.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.ANestedObject = &tempANestedObject\n\t}\n\tif m.Point != nil {\n\t\ttempPoint, err := m.Point.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Point = &tempPoint\n\t}\n\tif m.User != nil {\n\t\ttempUser, err := m.User.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.User = &tempUser\n\t}\n\tif m.Address != nil && m.Address.IPNet != nil {\n\t\tto.Address = &types1.InetValue{Value: m.Address.String()}\n\t}\n\tif posthook, ok := interface{}(m).(TypeWithIDWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" } ]
2bcdd0e9eb7f3a8648197ba72818e44d
setHolidaysNL : Netherland holidays Bevrijdingsdag is a holiday every 5 years
[ { "docid": "8607daa20703851127a6ee19253e656b", "score": "0.82478803", "text": "func setHolidaysNL(yyyy int, h *Holidays) {\n\t// Nieuwjaar = NewYear\n\th.Europe.NLHolidays.Nieuwjaardag = setObservableHoliday(time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC), moveToMonday)\n\t// GoedeVrijdag = GoodFriday - not an official public holiday,\n\t// though most schools are closed. Some public offices are closed\n\t// but most commercial concerns like banks and stores are open.\n\th.Europe.NLHolidays.Goedevrijdag = calculateGregorianGoodFriday(yyyy)\n\t// PaasMaandag = EasterMonday\n\th.Europe.NLHolidays.Paasmaandag = calculateGregorianEasterMonday(yyyy)\n\t// KoningsDag = KoningsDag April 27th. If Sunday then observed Saturday\n\tif time.Date(yyyy, time.April, 27, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday {\n\t\th.Europe.NLHolidays.Koningsdag = time.Date(yyyy, time.April, 26, 0, 0, 0, 0, time.UTC)\n\t} else {\n\t\th.Europe.NLHolidays.Koningsdag = time.Date(yyyy, time.April, 27, 0, 0, 0, 0, time.UTC)\n\t}\n\t// BevrijdingsDag = May, 5\n\th.Europe.NLHolidays.Bevrijdingsdag = time.Date(yyyy, time.May, 5, 0, 0, 0, 0, time.UTC)\n\t// Hemelvaart = Ascension, 40 days after Easter\n\th.Europe.NLHolidays.Hemelvaart = calculateGregorianAscension(yyyy)\n\t// PinksterMaandag = Whit Sunday/Pentecost 50 days after Easter\n\th.Europe.NLHolidays.Pinkstermaandag = calculateGregorianPentecost(yyyy)\n\t// EersteKerstdag = Christmas\n\th.Europe.NLHolidays.Eerstekerstdag = time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC)\n\t// TweedeKerstdag = Christmas2\n\th.Europe.NLHolidays.Tweedekerstdag = time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC)\n\tfmt.Println(\"setHolidaysNL completed...\")\n\twaitGroup.Done()\n}", "title": "" } ]
[ { "docid": "b82fe598725e11bee75a426b15c32bba", "score": "0.7012385", "text": "func setHolidaysUK(yyyy int, h *Holidays) {\n\t// New Years day Observed\n\th.Europe.UKHolidays.NewYearsDay = setObservableHoliday(time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC), moveToMonday)\n\th.Europe.UKHolidays.GoodFriday = calculateGregorianGoodFriday(yyyy)\n\th.Europe.UKHolidays.EarlyMay = returnFirstMonday(yyyy, time.May)\n\th.Europe.UKHolidays.SpringHoliday = returnLastMonday(yyyy, time.May)\n\tswitch true {\n\tcase time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC).Weekday() == time.Saturday:\n\t\t//if Christmas is Friday then Boxing day is Observed Monday\n\t\th.Europe.UKHolidays.ChristmasDay = time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.UKHolidays.BoxingDay = time.Date(yyyy, time.December, 28, 0, 0, 0, 0, time.UTC)\n\tcase time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC).Weekday() == time.Saturday:\n\t\t// if Christmas and Boxing day fall on the weekend then Monday and Tuesday are observed\n\t\th.Europe.UKHolidays.ChristmasDay = time.Date(yyyy, time.December, 27, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.UKHolidays.BoxingDay = time.Date(yyyy, time.December, 28, 0, 0, 0, 0, time.UTC)\n\tcase time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday:\n\t\t// if Christmas is on Sunday then it is observed Monday and Boxing Day on Tuesday\n\t\th.Europe.UKHolidays.ChristmasDay = time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.UKHolidays.BoxingDay = time.Date(yyyy, time.December, 27, 0, 0, 0, 0, time.UTC)\n\tdefault:\n\t\th.Europe.UKHolidays.ChristmasDay = time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.UKHolidays.BoxingDay = time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC)\n\t}\n\tfmt.Println(\"setHolidaysUK completed...\")\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "6292df662d3ae87dd15bdd3f3a32c737", "score": "0.69598055", "text": "func setHolidaysECB(yyyy int, h *Holidays) {\n\t// New Years day\n\th.Europe.ECBTarget2Holidays.NewYearsDay = setObservableHoliday(time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC), moveToMonday)\n\th.Europe.ECBTarget2Holidays.GoodFriday = calculateGregorianGoodFriday(yyyy)\n\th.Europe.ECBTarget2Holidays.EasterMonday = calculateGregorianEasterMonday(yyyy)\n\th.Europe.ECBTarget2Holidays.LaborDay = time.Date(yyyy, time.May, 1, 0, 0, 0, 0, time.UTC)\n\tswitch true {\n\tcase time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC).Weekday() == time.Saturday:\n\t\t//if Christmas is Friday then Christmas Holiday is Observed Monday\n\t\th.Europe.ECBTarget2Holidays.ChristmasDay = time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.ECBTarget2Holidays.ChristmasHoliday = time.Date(yyyy, time.December, 28, 0, 0, 0, 0, time.UTC)\n\tcase time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC).Weekday() == time.Saturday:\n\t\t// if Christmas and Christmas Holiday fall on the weekend then Monday and Tuesday are observed\n\t\th.Europe.ECBTarget2Holidays.ChristmasDay = time.Date(yyyy, time.December, 27, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.ECBTarget2Holidays.ChristmasHoliday = time.Date(yyyy, time.December, 28, 0, 0, 0, 0, time.UTC)\n\tcase time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday:\n\t\t// if Christmas is on Sunday then it is observed Monday and Christmas Holiday on Tuesday\n\t\th.Europe.ECBTarget2Holidays.ChristmasDay = time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.ECBTarget2Holidays.ChristmasHoliday = time.Date(yyyy, time.December, 27, 0, 0, 0, 0, time.UTC)\n\tdefault:\n\t\th.Europe.ECBTarget2Holidays.ChristmasDay = time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC)\n\t\th.Europe.ECBTarget2Holidays.ChristmasHoliday = time.Date(yyyy, time.December, 26, 0, 0, 0, 0, time.UTC)\n\t}\n\tfmt.Println(\"setHolidaysECB completed...\")\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "5b5fbbd84521247915b735a70162f473", "score": "0.6945878", "text": "func setHolidaysUS(yyyy int, h *Holidays) {\n\t// Calculate the US Federal Holidays\n\th.Americas.USFederalHolidaysObserved.NewYearsDay = setObservableHoliday(time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC), moveToMonday)\n\t// Martin Luther King is the third Monday in January\n\th.Americas.USFederalHolidaysObserved.MartinLutherKing = return3rdMonday(yyyy, time.January)\n\t// Washington's Birthday is the third Monday in February\n\th.Americas.USFederalHolidaysObserved.WashingtonsBirthday = return3rdMonday(yyyy, time.February)\n\t// Memorial Day is the last Monday in May\n\th.Americas.USFederalHolidaysObserved.MemorialDay = returnLastMonday(yyyy, time.May)\n\t// Independence Day is July 4th or nearest Monday\n\th.Americas.USFederalHolidaysObserved.IndependenceDay = setObservableHoliday(time.Date(yyyy, time.July, 4, 0, 0, 0, 0, time.UTC), moveToMonday)\n\t// Labor Day is the first Monday in September\n\th.Americas.USFederalHolidaysObserved.LaborDay = returnFirstMonday(yyyy, time.September)\n\t// Columbus Day is the Second Monday in October\n\th.Americas.USFederalHolidaysObserved.ColumbusDay = returnSecondMonday(yyyy, time.October)\n\t// Veterans Day is Novemeber 11th\n\th.Americas.USFederalHolidaysObserved.VeteransDay = returnObservableUSVeterandDay(yyyy)\n\t//Thanksgiving Day is the Fourth Thursday of the month\n\th.Americas.USFederalHolidaysObserved.ThanksgivingDay = returnFourthThursday(yyyy, time.November)\n\t//Christmas Day if falls on a Saturday is observed Friday or if it falls on a Sunday is observed Monday\n\th.Americas.USFederalHolidaysObserved.ChristmasDay = returnObservableChristmas(yyyy)\n\t// Copy US Federal Holdiays and then calculate Good Friday\n\th.Americas.NYSEHolidaysObserved.NewYearsDay = h.Americas.USFederalHolidaysObserved.NewYearsDay\n\th.Americas.NYSEHolidaysObserved.MartinLutherKing = h.Americas.USFederalHolidaysObserved.MartinLutherKing\n\th.Americas.NYSEHolidaysObserved.WashingtonsBirthday = h.Americas.USFederalHolidaysObserved.WashingtonsBirthday\n\t// Good Friday is two days before Gregorian/Western Easter\n\th.Americas.NYSEHolidaysObserved.GoodFriday = calculateGregorianGoodFriday(yyyy)\n\th.Americas.NYSEHolidaysObserved.MemorialDay = h.Americas.USFederalHolidaysObserved.MemorialDay\n\th.Americas.NYSEHolidaysObserved.IndependenceDay = h.Americas.USFederalHolidaysObserved.IndependenceDay\n\th.Americas.NYSEHolidaysObserved.LaborDay = h.Americas.USFederalHolidaysObserved.LaborDay\n\th.Americas.NYSEHolidaysObserved.ThanksgivingDay = h.Americas.USFederalHolidaysObserved.ThanksgivingDay\n\th.Americas.NYSEHolidaysObserved.ChristmasDay = h.Americas.USFederalHolidaysObserved.ChristmasDay\n\tfmt.Println(\"setHolidaysUS completed...\")\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "950853b543e1003aed8cdba36632c3c7", "score": "0.6900337", "text": "func setHolidaysAustrailia(yyyy int, h *Holidays) {\n\t// New Years day, if\n\th.AsiaPacific.AustrailianHolidays.NewYearsDay = setObservableHoliday(time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC), moveToMonday)\n\th.AsiaPacific.AustrailianHolidays.Austrailiaday = setObservableHoliday(time.Date(yyyy, time.January, 26, 0, 0, 0, 0, time.UTC), moveToMonday)\n\th.AsiaPacific.AustrailianHolidays.GoodFriday = calculateGregorianGoodFriday(yyyy)\n\th.AsiaPacific.AustrailianHolidays.EasterMonday = calculateGregorianEasterMonday(yyyy)\n\th.AsiaPacific.AustrailianHolidays.ANZACDday = setObservableHoliday(time.Date(yyyy, time.April, 25, 0, 0, 0, 0, time.UTC), moveToMonday)\n\th.AsiaPacific.AustrailianHolidays.ChristmasDay = setObservableHoliday(time.Date(yyyy, time.December, 25, 0, 0, 0, 0, time.UTC), moveToMonday)\n\tfmt.Println(\"setHolidaysAustrailia completed...\")\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "f50aea3fc59961d01bb7fab8d4a360bc", "score": "0.6608075", "text": "func setHolidaysJapan(yyyy int, h *Holidays) {\n\t// don't go below start of Gregorian calendar\n\tif time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday {\n\t\t//Move new years to Monday\n\t\th.AsiaPacific.JapanBankHolidays.NewYearsDay = time.Date(yyyy, time.January, 2, 0, 0, 0, 0, time.UTC)\n\t\t// bank holiday 2 and new years day share the same day\n\t\th.AsiaPacific.JapanBankHolidays.BankHoliday2 = time.Date(yyyy, time.January, 2, 0, 0, 0, 0, time.UTC)\n\t\th.AsiaPacific.JapanBankHolidays.BankHoliday3 = time.Date(yyyy, time.January, 3, 0, 0, 0, 0, time.UTC)\n\t} else {\n\t\t// if New Years Day falls on a Saturday then New Years Eve is a holiday otherwise it is nil\n\t\tif time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC).Weekday() == time.Saturday {\n\t\t\th.AsiaPacific.JapanBankHolidays.NewYearsEve = time.Date(yyyy-1, time.December, 31, 0, 0, 0, 0, time.UTC)\n\t\t} else {\n\t\t\th.AsiaPacific.JapanBankHolidays.NewYearsEve = time.Time{}\n\t\t}\n\t\th.AsiaPacific.JapanBankHolidays.NewYearsDay = time.Date(yyyy, time.January, 1, 0, 0, 0, 0, time.UTC)\n\t\th.AsiaPacific.JapanBankHolidays.BankHoliday2 = time.Date(yyyy, time.January, 2, 0, 0, 0, 0, time.UTC)\n\t\th.AsiaPacific.JapanBankHolidays.BankHoliday3 = time.Date(yyyy, time.January, 3, 0, 0, 0, 0, time.UTC)\n\t}\n\t// set coming of the aged date, 2nd Monday in January\n\th.AsiaPacific.JapanBankHolidays.ComingOfAgeDay = returnSecondMonday(yyyy, time.January)\n\t// National Foundation Day is February 11th\n\th.AsiaPacific.JapanBankHolidays.NationalFoundationDay = time.Date(yyyy, time.February, 3, 0, 0, 0, 0, time.UTC)\n\t// Vernal Equinox Day is calculated to fall on the Spring Equinox\n\th.AsiaPacific.JapanBankHolidays.VernalEquinoxDay = time.Date(yyyy, time.March, julian.JDToTime(solstice.March(yyyy)).Day(), 0, 0, 0, 0, time.UTC)\n\t// Showa Day is April 29th, Part of Golden Week\n\th.AsiaPacific.JapanBankHolidays.ShowaDay = time.Date(yyyy, time.April, 29, 0, 0, 0, 0, time.UTC)\n\t// Constitution Memorial Day is May 3rd, Part of Golden week\n\th.AsiaPacific.JapanBankHolidays.ConstitutionDay = time.Date(yyyy, time.May, 3, 0, 0, 0, 0, time.UTC)\n\t// Greenery (Arbor) Day is May 4th, Part of Golden week\n\th.AsiaPacific.JapanBankHolidays.GreeneryDay = time.Date(yyyy, time.May, 4, 0, 0, 0, 0, time.UTC)\n\t// Childrens Day is May 5th, Part of Golden week\n\th.AsiaPacific.JapanBankHolidays.ChildrensDay = time.Date(yyyy, time.May, 4, 0, 0, 0, 0, time.UTC)\n\t// Marine day. First offical in 1996. Since 2003 this holiday is now the third Monday in July\n\tif yyyy >= 1996 && yyyy < 2003 {\n\t\th.AsiaPacific.JapanBankHolidays.MarineDay = time.Date(yyyy, time.July, 20, 0, 0, 0, 0, time.UTC)\n\t} else {\n\t\th.AsiaPacific.JapanBankHolidays.MarineDay = return3rdMonday(yyyy, time.July)\n\t}\n\t// Mountain Day is August 11th (or 12th if Sunday)\n\tif time.Date(yyyy, time.August, 11, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday {\n\t\th.AsiaPacific.JapanBankHolidays.MountainDay = time.Date(yyyy, time.August, 12, 0, 0, 0, 0, time.UTC)\n\t} else {\n\t\th.AsiaPacific.JapanBankHolidays.MountainDay = time.Date(yyyy, time.August, 11, 0, 0, 0, 0, time.UTC)\n\t}\n\t// Respect For The Aged Day is the 3rd Monday in September\n\th.AsiaPacific.JapanBankHolidays.RespectForTheAgedDay = return3rdMonday(yyyy, time.September)\n\t// Autumnal Equinox Day is calculated to fall on the Fall Equinox\n\th.AsiaPacific.JapanBankHolidays.AutumnalEquinoxDay = time.Date(yyyy, time.March, julian.JDToTime(solstice.September(yyyy)).Day(), 0, 0, 0, 0, time.UTC)\n\t// Health Sports Day is the 2nd Monday in October\n\th.AsiaPacific.JapanBankHolidays.HealthSportsDay = returnSecondMonday(yyyy, time.October)\n\t// Culture Day is November 3rd or the fourth if the 3rd is a Sunday\n\tif time.Date(yyyy, time.November, 3, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday {\n\t\th.AsiaPacific.JapanBankHolidays.CultureDay = time.Date(yyyy, time.November, 4, 0, 0, 0, 0, time.UTC)\n\t} else {\n\t\th.AsiaPacific.JapanBankHolidays.CultureDay = time.Date(yyyy, time.November, 3, 0, 0, 0, 0, time.UTC)\n\t}\n\t// Labor Thanksgiving Day is November 23rd or 24th if the 23rd is a Sunday\n\tif time.Date(yyyy, time.November, 23, 0, 0, 0, 0, time.UTC).Weekday() == time.Sunday {\n\t\th.AsiaPacific.JapanBankHolidays.LaborThanksgivingDay = time.Date(yyyy, time.November, 24, 0, 0, 0, 0, time.UTC)\n\t} else {\n\t\th.AsiaPacific.JapanBankHolidays.LaborThanksgivingDay = time.Date(yyyy, time.November, 23, 0, 0, 0, 0, time.UTC)\n\t}\n\t// Emperors Birthday : effective 1989 is now December 23rd.\n\tif yyyy >= 1989 {\n\t\th.AsiaPacific.JapanBankHolidays.EmperorsBirthday = time.Date(yyyy, time.December, 23, 0, 0, 0, 0, time.UTC)\n\t}\n\tfmt.Println(\"setHolidaysJapan completed...\")\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "06b68f440fa3f9da3e51d93cfbd37969", "score": "0.63304615", "text": "func setHolidayYear(yyyy int, h *Holidays) {\n\t// don't go below start of Gregorian calendar\n\tconst firstgregorianyear int = 1583\n\t// don't go above the year where integer calculations will start to fail\n\tconst lastgregorianyear int = 4099\n\tif inBetween(yyyy, firstgregorianyear, lastgregorianyear) {\n\t\th.Year = yyyy\n\t}\n\tfmt.Println(\"setHolidayYear completed...\")\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "2b454f0a1bfa8c79d5b608914d7cebd9", "score": "0.6109045", "text": "func addNorwegianHolidays(c *Calendar) {\n\tc.AddHoliday(\n\t\tnoFoersteNyttaarsdag,\n\t\tnoSkjaertorsdag,\n\t\tnoLangfredag,\n\t\tnoFoerstePaaskedag,\n\t\tnoAndrePaaskedag,\n\t\tnoArbeiderenesdag,\n\t\tnoGrunnlovsdag,\n\t\tnoKristihimmelfartsdag,\n\t\tnoFoerstePinsedag,\n\t\tnoAndrePinsedag,\n\t\tnoFoersteJuledag,\n\t\tnoAndreJuledag,\n\t)\n}", "title": "" }, { "docid": "7de5ecc2727d23418fc14e2c3f16f578", "score": "0.5700757", "text": "func calculateFixeddateHoliday(year int, month time.Month, date int, observerule ObservedRule, loc *time.Location) (time.Month, int){\n\thd := time.Date(year,month,date,0,0,0,1,loc)\n\n\tif observerule == ObservedExact || !IsWeekend(hd) {\n\t\treturn hd.Month(), hd.Day()\n\t}\n\n\toffset := 1\n\tif hd.Weekday() == time.Saturday {\n\t\tif observerule == ObservedNearest {\n\t\t\toffset -= 2\n\t\t}\n\t\tif observerule == ObservedMonday {\n\t\t\toffset++\n\t\t}\n\n\t}\n\n\thd = hd.AddDate(0,0,offset)\n\treturn hd.Month(), hd.Day()\n}", "title": "" }, { "docid": "f801c74b0f8c8984b0cc7a6d5a90c5c8", "score": "0.559781", "text": "func calculateNewYearsHoliday(year int, loc *time.Location) (time.Month, int) {\n\tday := time.Date(year, time.January, 1, 0, 0, 0, 0, loc)\n\tswitch day.Weekday() {\n\tcase time.Saturday:\n\t\tday = day.AddDate(0, 0, 2)\n\tcase time.Sunday:\n\t\tday = day.AddDate(0, 0, 1)\n\t}\n\treturn time.January, day.Day()\n}", "title": "" }, { "docid": "9e2ac00ff4b2340f1fa01f3d72a0fa7f", "score": "0.5262834", "text": "func AddNorwegianHalfDays(c *Calendar) {\n\tc.AddHoliday(\n\t\tnoJulaften,\n\t\tnoNyttaarsaften,\n\t)\n}", "title": "" }, { "docid": "c705a8abfb0a887cc310894221df5c4d", "score": "0.50128186", "text": "func (e Events) Holidays() (*gabs.Container, error) {\n\tresponse, err := callAPI(formatURL(e.Key, \"events\", \"holidays\"))\n\treturn response, err\n}", "title": "" }, { "docid": "a36a4b900e697ee00312a421bc212ee2", "score": "0.4937096", "text": "func makeGBEarlyMay() Holiday {\n\thol := NewHolidayFloat(time.May, time.Monday, 1)\n\thol.Func = func(year int, loc *time.Location) (month time.Month, day int) {\n\t\tif year == 2020 {\n\t\t\t// In 2020 force VE day\n\t\t\treturn time.May, 8\n\t\t}\n\t\t// Else defer to floating holiday calculation\n\t\treturn time.May, 0\n\t}\n\treturn hol\n}", "title": "" }, { "docid": "d6806b1e7e65bad82e108e7277296406", "score": "0.49160385", "text": "func (c *Calendar) AddHoliday(h ...Holiday) {\n\tfor _, hd := range h {\n\t\tc.holidays[hd.Month] = append(c.holidays[hd.Month], hd)\n\t}\n}", "title": "" }, { "docid": "373829c573884f78560589a4f7ee605c", "score": "0.4866406", "text": "func NewHoliday(month time.Month, day int) Holiday {\n\treturn Holiday{Month: month, Day: day}\n}", "title": "" }, { "docid": "1c0fad10d58d6aea03b4ad7912f0101e", "score": "0.47751033", "text": "func AddItalianHolidays(c *Calendar) {\n\tc.AddHoliday(\n\t\tITCapodanno,\n\t\tITEpifania,\n\t\tITPasquetta,\n\t\tITFestaDellaLiberazione,\n\t\tITFestaDelLavoro,\n\t\tITFestaDellaRepubblica,\n\t\tITFerragosto,\n\t\tITTuttiISanti,\n\t\tITImmacolata,\n\t\tITNatale,\n\t\tITSantoStefano,\n\t)\n}", "title": "" }, { "docid": "ad33a7a41ca19a4ddf180c5f6d2b4f78", "score": "0.47602952", "text": "func AddSwedishHolidays(c *Calendar) {\n\tc.AddHoliday(\n\t\tSENyarsdagen,\n\t\tSETrettondedagJul,\n\t\tSELangfredagen,\n\t\tSEPaskdagen,\n\t\tSEAnnandagPask,\n\t\tSEForstaMaj,\n\t\tSEKristiHimmelfardsdag,\n\t\tSEPingstdagen,\n\t\tSENationaldagen,\n\t\tSEMidsommarafton,\n\t\tSEMidsommardagen,\n\t\tSEAllaHelgonsDag,\n\t\tSEJulafton,\n\t\tSEJuldagen,\n\t\tSEAnnandagJul,\n\t\tSENewYearsEve,\n\t)\n}", "title": "" }, { "docid": "7ff55e3bfb2c2644f8f654c879084b3d", "score": "0.4704425", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetDeadlineForFeatureUpdatesInDays(value *int32)() {\n m.deadlineForFeatureUpdatesInDays = value\n}", "title": "" }, { "docid": "e9cd6d1db68b48684d980bd96dd3dd11", "score": "0.47032994", "text": "func CompanyHolidaysHandler(w http.ResponseWriter, r *http.Request) {\n\tcl, err := factorial.New(\n\t\tfactorial.WithOAuth2Client(provider.Client(token)),\n\t)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tcompanyHolidays, err := cl.ListCompanyHolidays()\n\tif err != nil {\n\t\tlog.Panicln(\"Error while getting company holidays\", err)\n\t}\n\tt, err := template.New(\"companyHolidays\").Parse(companyHolidaysTemplate)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tt.Execute(w, struct {\n\t\tCompanyHolidays []factorial.CompanyHoliday\n\t}{\n\t\tCompanyHolidays: companyHolidays,\n\t})\n}", "title": "" }, { "docid": "d7165195539ddb39976e3be814bb13ac", "score": "0.46902213", "text": "func FinancialHolidayHandler(w http.ResponseWriter, r *http.Request) {\n\tyear := r.URL.Query().Get(\"year\")\n\tif len(year) >= 4 {\n\t\tholidayData, _ := json.Marshal(utility.GetFinancialHoliday(year))\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(holidayData)\n\t} else {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"400 BadRequest\"))\n\t}\n}", "title": "" }, { "docid": "debbc11822c9f2c0666632f5f0fc6c02", "score": "0.4675865", "text": "func NewHolidayFloat(month time.Month, weekday time.Weekday, offset int) Holiday {\n\treturn Holiday{Month: month, Weekday: weekday, Offset: offset}\n}", "title": "" }, { "docid": "3b0296a9c5deec28d511e52c2bc705dc", "score": "0.45896086", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetEngagedRestartSnoozeScheduleInDays(value *int32)() {\n m.engagedRestartSnoozeScheduleInDays = value\n}", "title": "" }, { "docid": "7c827c07dc275e1528e09bd1d9361367", "score": "0.4551245", "text": "func (s *Student) SetNationals(year string, att8 Attainment8, exists bool) {\n\n\ts.natYear = year\n\ts.natAtt8 = att8\n\ts.natAtt8Exists = exists\n}", "title": "" }, { "docid": "aa7632d8737bf271617cd2e6df8b6da2", "score": "0.4523866", "text": "func setOpenCloseWeeks(t time.Time, nWeeks, nP int) (o time.Time, c time.Time, err error) {\n\n\tstartWeek := closestSunday(t)\n\tendWeek := startWeek.AddDate(0, 0, (7 * (nWeeks - 1)))\n\tif nWeeks < nP {\n\t\treturn o, c, errors.New(\"each participant must get at least 1 week in the season\")\n\t}\n\treturn startWeek, endWeek, nil\n}", "title": "" }, { "docid": "dbe47cb54fcad336074a098111fe02bf", "score": "0.448517", "text": "func main() {\n\tmonths := [13]int{0,31,28,31,30,31,30,31,31,30,31,30,31}\n\n\tweekday := 0\n\tday := 1\n\tmonth := 1\n\tyear := 1900\n\n\tcount := 0\n\n\tfor i := 0; ; i++ {\n\t\tif day == months[month] {\n\t\t\tday = 1\n\t\t\tmonth = changeMonth(month)\n\t\t\tif month == 1 {\n\t\t\t\tyear++\n\t\t\t\tif year % 4 == 0 && ( year % 100 != 0 || year % 400 == 0) {\n\t\t\t\t\tmonths[2] = 29\n\t\t\t\t\tfmt.Println(year)\n\t\t\t\t} else {\n\t\t\t\t\tmonths[2] = 28\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif year > 1900 && day == 1 && weekday == 6 {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\n\t\tday++\n\t\tweekday = changeDay(weekday)\n\n\t\tif( year == 2000 && month == 12 && day == 31 ) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t//fmt.Printf(\"%d.%d.%d weekday : %d\\n\", day, month, year, weekday)\n\tfmt.Println(count)\n}", "title": "" }, { "docid": "3be1c1598d9f7a7cf76822529b4d2a58", "score": "0.44385934", "text": "func calculateUSThanksgivingday(year int, loc *time.Location) (time.Month, int) {\n\treturn calculateFixedWeekdayHoliday(year, time.November, time.Thursday, 4, loc)\n}", "title": "" }, { "docid": "ade72020cc1d940dd7904e513896190d", "score": "0.44309714", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetFeatureUpdatesRollbackWindowInDays(value *int32)() {\n m.featureUpdatesRollbackWindowInDays = value\n}", "title": "" }, { "docid": "481c25ccbcf741cbef2f462e43cf3b71", "score": "0.43620664", "text": "func Example_daylightSavingsBoundaries() {\n\tloc, _ := time.LoadLocation(\"America/Montreal\")\n\ti, _ := Interval{\n\t\tStart: time.Date(2000, time.January, 1, 0, 0, 0, 0, loc),\n\t\tEnd: time.Date(2009, time.January, 1, 0, 0, 0, 0, loc),\n\t}.Round(Day)\n\tfmt.Printf(\"DST boundaries in %v\\n\", i)\n\n\tdays, _ := i.Walk(Day)\n\n\tfor day := range days {\n\t\thours := day.End.Sub(day.Start).Hours()\n\t\tif hours != 24 {\n\t\t\tzs, _ := day.Start.Zone()\n\t\t\tze, _ := day.End.Zone()\n\t\t\tfmt.Printf(\"%v (%s->%s) has %.0f hours\\n\", day.Start.Format(\"2006-01-02\"), zs, ze, hours)\n\t\t}\n\t}\n\n\t// Output:\n\t// DST boundaries in [2000-01-01T00:00:00-05:00, 2009-01-01T00:00:00-05:00)\n\t// 2000-04-02 (EST->EDT) has 23 hours\n\t// 2000-10-29 (EDT->EST) has 25 hours\n\t// 2001-04-01 (EST->EDT) has 23 hours\n\t// 2001-10-28 (EDT->EST) has 25 hours\n\t// 2002-04-07 (EST->EDT) has 23 hours\n\t// 2002-10-27 (EDT->EST) has 25 hours\n\t// 2003-04-06 (EST->EDT) has 23 hours\n\t// 2003-10-26 (EDT->EST) has 25 hours\n\t// 2004-04-04 (EST->EDT) has 23 hours\n\t// 2004-10-31 (EDT->EST) has 25 hours\n\t// 2005-04-03 (EST->EDT) has 23 hours\n\t// 2005-10-30 (EDT->EST) has 25 hours\n\t// 2006-04-02 (EST->EDT) has 23 hours\n\t// 2006-10-29 (EDT->EST) has 25 hours\n\t// 2007-03-11 (EST->EDT) has 23 hours\n\t// 2007-11-04 (EDT->EST) has 25 hours\n\t// 2008-03-09 (EST->EDT) has 23 hours\n\t// 2008-11-02 (EDT->EST) has 25 hours\n}", "title": "" }, { "docid": "5db8577d3db62b024fe5db8b701e8b1d", "score": "0.4361999", "text": "func doTheFliegelAndVanFlandernAlgorithm(jd int) (day, month, year int) {\n\tl := jd + 68569\n\tn := (4 * l) / 146097\n\tl = l - (146097*n+3)/4\n\ti := (4000 * (l + 1)) / 1461001\n\tl = l - (1461*i)/4 + 31\n\tj := (80 * l) / 2447\n\td := l - (2447*j)/80\n\tl = j / 11\n\tm := j + 2 - (12 * l)\n\ty := 100*(n-49) + i + l\n\treturn d, m, y\n}", "title": "" }, { "docid": "53b4dc1779614ace82db4cb8f2788d96", "score": "0.43439817", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetEngagedRestartDeadlineInDays(value *int32)() {\n m.engagedRestartDeadlineInDays = value\n}", "title": "" }, { "docid": "7482b54d64c16bde77cf6ddbac3efc03", "score": "0.43235874", "text": "func AddBritishHolidays(c *Calendar) {\n\tc.AddHoliday(\n\t\tGBNewYear,\n\t\tGBGoodFriday,\n\t\tGBEasterMonday,\n\t\tGBEarlyMay,\n\t\tGBSpringHoliday,\n\t\tGBSummerHoliday,\n\t\tGBChristmasDay,\n\t\tGBBoxingDay,\n\t)\n}", "title": "" }, { "docid": "048a1f466f97ed5a2c6a050b5da4a6da", "score": "0.4313626", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetFeatureUpdatesDeferralPeriodInDays(value *int32)() {\n m.featureUpdatesDeferralPeriodInDays = value\n}", "title": "" }, { "docid": "ffa4ae38ea5c6b04659be15cea1d15fb", "score": "0.42818883", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetDeadlineGracePeriodInDays(value *int32)() {\n m.deadlineGracePeriodInDays = value\n}", "title": "" }, { "docid": "122ee0b0c7e66042b3d2458aa225ef17", "score": "0.42383787", "text": "func main() {\n\tstart := time.Date(1901, 1, 1, 1, 0, 0, 0, time.UTC)\n\tend := time.Date(2000, 12, 31, 1, 0, 0, 0, time.UTC)\n\n\tcount := 0\n\tfor d := start; d.Before(end); d = d.AddDate(0, 1, 0) {\n\t\tif d.Weekday() == time.Sunday {\n\t\t\tcount += 1\n\t\t}\n\t}\n\n\tfmt.Printf(\"%d sundays between %v and %v\", count, start, end)\n}", "title": "" }, { "docid": "c89a36492d27499c7501a09cee869172", "score": "0.41660848", "text": "func (c *Calendar) IsHoliday(date time.Time) bool {\n\tidx := date.Month()\n\tfor i := range c.holidays[idx] {\n\t\tif c.holidays[idx][i].matches(date) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor i := range c.holidays[0] {\n\t\tif c.holidays[0][i].matches(date) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "81ac3b4fcec965b2550fe11c6b162869", "score": "0.41459852", "text": "func (_Unit_Interface *Unit_InterfaceSession) SetSpecialLifPrice(price *big.Int, fromDay *big.Int, daysAmount *big.Int) (*types.Transaction, error) {\n\treturn _Unit_Interface.Contract.SetSpecialLifPrice(&_Unit_Interface.TransactOpts, price, fromDay, daysAmount)\n}", "title": "" }, { "docid": "1a86f7a9c6e7e65cfc0451407ffcd9fa", "score": "0.4129217", "text": "func euler_19 () {\n\n\tresult := 0;\n\n\tdate := time.Date(1901,time.January,1, 0, 0, 0, 0, time.UTC)\n\tfor date.Weekday() != time.Sunday {\n\t\tdate = date.Add(time.Hour * 24)\n\t}\n\n\tfor ; date.Year() < 2001; date = date.Add(time.Hour * 24 * 7) {\n\t\tif date.Weekday() == time.Sunday && date.Day() == 1 {\n\t\t\tresult++\n\t\t\t//fmt.Println(date);\n\t\t}\n\t}\n\tfmt.Println(\"There were\", result, \"Sundays on the first day of the month in the twentieth century\")\n\treturn\n}", "title": "" }, { "docid": "c35b5db6c1003b8c5a03d3616b3284c2", "score": "0.41226155", "text": "func turnOnL7() { l7 = true }", "title": "" }, { "docid": "17ee0d8aecb957dc85eda0d0c0253631", "score": "0.4077717", "text": "func (m *Windows10GeneralConfiguration) SetDefenderDaysBeforeDeletingQuarantinedMalware(value *int32)() {\n m.defenderDaysBeforeDeletingQuarantinedMalware = value\n}", "title": "" }, { "docid": "782a6fb940fc072f31dcd278c1d0abf8", "score": "0.40589523", "text": "func Years(n int) int {\n\treturn n * 7\n}", "title": "" }, { "docid": "782a6fb940fc072f31dcd278c1d0abf8", "score": "0.40589523", "text": "func Years(n int) int {\n\treturn n * 7\n}", "title": "" }, { "docid": "782a6fb940fc072f31dcd278c1d0abf8", "score": "0.40589523", "text": "func Years(n int) int {\n\treturn n * 7\n}", "title": "" }, { "docid": "782a6fb940fc072f31dcd278c1d0abf8", "score": "0.40589523", "text": "func Years(n int) int {\n\treturn n * 7\n}", "title": "" }, { "docid": "698c491ce51be07ef7f1bfc4047787ab", "score": "0.4051269", "text": "func (a *DateTimeApiService) DateTimeGetPublicHolidays(ctx context.Context, input GetPublicHolidaysRequest) (PublicHolidaysResponse, *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 PublicHolidaysResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/validate/date-time/get/holidays\"\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\", \"text/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\", \"text/json\", \"application/xml\", \"text/xml\"}\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 = &input\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[\"Apikey\"] = key\n\t\t\t\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v PublicHolidaysResponse\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\t\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "886b9716cd24d1666d058c795cbbaf53", "score": "0.40509075", "text": "func (this *CodeWriter) Set_had_nl( value bool) {\n this.had_nl = value \n}", "title": "" }, { "docid": "57383042047947edaeae3a5f4cba62f5", "score": "0.40476373", "text": "func calculateGoodFriday(year int, loc *time.Location) (time.Month, int) {\n\teaster := calculateEaster(year, loc)\n\t//Go the the day before yesterday\n\tgf := easter.AddDate(0, 0, -2)\n\treturn gf.Month(), gf.Day()\n}", "title": "" }, { "docid": "cc25241d091082a5cb884ce28a7cf161", "score": "0.40229416", "text": "func printPayrollScheduleConsideringPublicHolidays(payFrequency, startingDate,\n\tpublicHolidaysFilePath string) {\n\tpublicHolidays := utilities.GetPublicHolidays(publicHolidaysFilePath)\n\tfmt.Println(\"\\nPrinting Payroll Schedule\")\n\tpayFrequencyValue, month, day, year := payrollhelper.GetPayFrequencyNumberAndDateValues(payFrequency,\n\t\tstartingDate)\n\tdaysOffset := payFrequencyValue * utilities.DaysConstant\n\tdate := time.Date(year, month, day, 00, 00, 00, 00, time.UTC)\n\t_ = payrollhelper.GetPayrollScheduleOnFrequencyWithPublicHolidays(date, year, daysOffset, publicHolidays)\n}", "title": "" }, { "docid": "f669232b599e6bfcce29c07575b4cacc", "score": "0.40201342", "text": "func (c *Calendar) CountHolidayHoursWithOffset(start time.Time, offsetHour int) int {\n\tdays := int(math.Ceil(float64(offsetHour) / float64(24)))\n\n\tholidayHours := 0\n\tday := 0\n\tfor day <= days {\n\t\tdate := start.AddDate(0, 0, day)\n\t\tif !c.IsWorkday(date) {\n\t\t\tholidayHours += 24\n\t\t\tdays++\n\t\t}\n\t\tday++\n\t}\n\n\treturn holidayHours\n}", "title": "" }, { "docid": "2981458a9b34e0f9a0260f6b27522f9e", "score": "0.40140164", "text": "func (_Unit_Interface *Unit_InterfaceTransactorSession) SetSpecialLifPrice(price *big.Int, fromDay *big.Int, daysAmount *big.Int) (*types.Transaction, error) {\n\treturn _Unit_Interface.Contract.SetSpecialLifPrice(&_Unit_Interface.TransactOpts, price, fromDay, daysAmount)\n}", "title": "" }, { "docid": "cc4698be3e4f32455c3afb7622ea85e1", "score": "0.40033108", "text": "func (m *EventMessage) SetIsAllDay(value *bool)() {\n m.isAllDay = value\n}", "title": "" }, { "docid": "fd9363081fc61df44b3cb5c527130944", "score": "0.3999032", "text": "func Timeinday() {\n\tWEEKDAYS := []structs.WHEN{\n\t\t{D: []int{1}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t\t{D: []int{2}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t\t{D: []int{3}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t\t{D: []int{4}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t\t{D: []int{5}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t}\n\tfmt.Println(WEEKDAYS)\n\tWEEKEND := []structs.WHEN{\n\t\t{D: []int{6}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t\t{D: []int{7}, M: \"morning\", A: \"arvo\", E: \"evening\"},\n\t}\n\tfmt.Println(WEEKEND)\n\n\tvar m = map[string]structs.WHEN{\n\t\t\"MONDAY\": WEEKDAYS[0],\n\t\t\"TUESDAY\": WEEKDAYS[1],\n\t\t\"WEDNESDAY\": WEEKDAYS[2],\n\t\t\"THURSDAY\": WEEKDAYS[3],\n\t\t\"FRIDAY\": WEEKDAYS[4],\n\t}\n\tfmt.Println(m)\n\tw := structs.WHEN{D: []int{29, 30, 31}, M: \"morning\", A: \"arvo\", E: \"evening\"}\n\tpw := &w\n\tt := time.Now()\n\tswitch {\n\tcase t.Hour() < 12:\n\t\tfmt.Println(pw.M)\n\t\tfmt.Printf(\"%v\", pw.D)\n\t\tfmt.Println(pw.D)\n\tcase t.Hour() < 17:\n\t\tfmt.Println(pw.A)\n\t\tfmt.Printf(\"%v\", pw.D)\n\t\tfmt.Println(pw.D)\n\tdefault:\n\t\tfmt.Println(pw.E)\n\t\tfmt.Printf(\"%v\", pw.D)\n\t\tfmt.Println(pw.D)\n\t}\n}", "title": "" }, { "docid": "b5025ba110ebe8c32fa9b74e8cac46d4", "score": "0.39888018", "text": "func LastNWorkDays(plant string, n int) (nWorkdays []time.Time) {\n\tvar offset int\n\tvar workdays int\n\n\tloc := plantLocation[plant]\n\tif n <= 0 {\n\t\td, _ := time.Parse(\"2006-01-02\", time.Now().In(loc).Format(\"2006-01-02\"))\n\t\tnWorkdays = append(nWorkdays, d)\n\t\treturn\n\t}\n\n\toffset = -1\n\n\td, _ := time.Parse(\"2006-01-02\", time.Now().Add(-24*time.Hour).In(loc).Format(\"2006-01-02\"))\n\tfor workdays < n {\n\t\tfor d.Weekday() == time.Saturday || d.Weekday() == time.Sunday || HolidayMap[plant][d] {\n\t\t\td = d.Add(-24 * time.Hour)\n\t\t\toffset--\n\t\t}\n\t\tworkdays++\n\t\tnWorkdays = append(nWorkdays, d)\n\t\tif workdays == n {\n\t\t\tbreak\n\t\t}\n\t\td = d.Add(-24 * time.Hour)\n\t\toffset--\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "8756ec4b72611ae7173b7d0b98ded99d", "score": "0.39853323", "text": "func Years(n int) int {\n\treturn 7 * n\n}", "title": "" }, { "docid": "efac9c6bce186c5d3e2d7f7623537ad5", "score": "0.3976693", "text": "func (w *Week) SetDayInWeek (day int, amount int32) {\n switch day {\n case 1: w.Monday += amount\n case 2: w.Tuesday += amount\n case 3: w.Wednesday += amount\n case 4: w.Thursday += amount\n case 5: w.Friday += amount\n case 6: w.Saturday += amount\n case 7: w.Sunday += amount\n }\n}", "title": "" }, { "docid": "f49d4ae3009bf2a0fa36f3b2ec6f5129", "score": "0.3960318", "text": "func (c *BitCal) AddWorkDays(date time.Time, days int, include bool) (ret_date time.Time) {\n\n\tvar (\n\t\tday_found bool\n\t\tcount int\n\t)\n\n\tif days == 0 {\n\t\tret_date = date\n\t\treturn\n\t}\n\n\tc.init_year(date.Year())\n\n\tarr_ind, bit_ind := date2index(date)\n\n//\tlog.Printf(\"Year: %d ARR_IND: %d BIT_IND: %d\",date.Year(), arr_ind, bit_ind)\n\n\tif days > 0 {\n\t\tworkb, cyear, carr_ind, cbit_ind := c.get_forward_bits(date.Year(), arr_ind, bit_ind, include)\n\n\t\tfor !day_found {\n\t\t\tcc := bits.OnesCount64(workb)\n\n\t\t\tprev_count := count\n\t\t\tcount += cc\n\n\t\t\tif count >= days {\n\t\t\t\t// Day in this segment\n\t\t\t\tif count == days {\n\t\t\t\t\t// Get the last work day\n\t\t\t\t\ttrail := bits.TrailingZeros64(workb)\n\n\t\t\t\t\t// log.Printf(\"Year: %d Carr_ind: %d Cbit_ind: %d Trail: %d\", cyear, carr_ind, cbit_ind, trail)\n\n\t\t\t\t\tif trail > 0 {\n\t\t\t\t\t\tcbit_ind -= trail\n\t\t\t\t\t}\n\n\t\t\t\t\tret_date = index2date(cyear, carr_ind, cbit_ind)\n\t\t\t\t\tday_found = true\n\n\t\t\t\t} else {\n\t\t\t\t\tcount = prev_count\n\t\t\t\t\tclear_right_still_greater(&workb, days, count, include)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tworkb, cyear, carr_ind, cbit_ind = c.get_forward_bits(cyear, carr_ind, cbit_ind, include)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tworkb, cyear, carr_ind, cbit_ind := c.get_backword_bits(date.Year(), arr_ind, bit_ind, include)\n\n\t\tfor !day_found {\n//\t\t\tlog.Printf(\"Year: %d Carr_ind: %d Cbit_ind: %d\", cyear, carr_ind, cbit_ind)\n\n\t\t\tcc := bits.OnesCount64(workb)\n\n\t\t\tprev_count := count\n\t\t\tcount += cc\n\n\t\t\tif count >= -days {\n\t\t\t\tif count == -days {\n\t\t\t\t\t// Get the last work day\n\t\t\t\t\tlead := bits.LeadingZeros64(workb)\n\n//\t\t\t\t\tlog.Printf(\"Year: %d Carr_ind: %d Cbit_ind: %d Lead: %d\", cyear, carr_ind, cbit_ind, lead)\n\n\t\t\t\t\tif lead > 0 {\n\t\t\t\t\t\tcbit_ind += lead\n\t\t\t\t\t}\n\n\t\t\t\t\tret_date = index2date(cyear, carr_ind, cbit_ind)\n\t\t\t\t\tday_found = true\n\n\t\t\t\t} else {\n\t\t\t\t\tcount = prev_count\n\t\t\t\t\tclear_left_still_greater(&workb, days, count, include)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tworkb, cyear, carr_ind, cbit_ind = c.get_backword_bits(cyear, carr_ind, cbit_ind, include)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a45b0ed2b4a60c9a7bca3a5f874e1864", "score": "0.39556092", "text": "func textToDishInYear(text []byte, year int) ([]*Dish, error) {\n\n\tlines := strings.Split(string(text), \"\\n\")\n\tif count := len(lines); count <= 3 {\n\t\treturn nil, fmt.Errorf(\"textToDish: input has not enough lines\\n\")\n\t}\n\n\tisoWeekRegexp := regexp.MustCompile(\"[0-9]{1,2}\")\n\tanchorDate := time.Time{}\n\tfor i := range lines {\n\t\tif strings.HasPrefix(strings.Trim(lines[i], \" \"), \"Speiseplan Bistro\") {\n\t\t\tweekNrBytes := isoWeekRegexp.Find([]byte(lines[i]))\n\t\t\tif weekNrBytes == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"textToDish: parsing error: failed to locate week number\")\n\t\t\t}\n\t\t\tweekNr, err := strconv.ParseInt(string(weekNrBytes), 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"textToDish: parsing error: failed to parse %s to week number: %v\", weekNrBytes, err)\n\t\t\t}\n\t\t\tanchorDate = isoweek.StartTime(year, int(weekNr), time.Local)\n\t\t}\n\t}\n\tif anchorDate.Equal(time.Time{}) {\n\t\treturn nil, fmt.Errorf(\"textToDish: parsing error: failed to locate week number\")\n\t}\n\n\t//find Wochentag line or exit\n\tlineWochentag := -1\n\tfor i := range lines {\n\t\tif strings.HasPrefix(strings.Trim(lines[i], \" \"), \"Wochentag\") {\n\t\t\tlineWochentag = i\n\t\t}\n\t}\n\tif lineWochentag == -1 {\n\t\treturn nil, fmt.Errorf(\"textToDish: parsing error: \\\"Wochentag\\\" line not found\")\n\t}\n\n\t//get whitespace offset of the headers in the lines\n\theaders := []string{\"Wok Station\", \"Vegetarisch\", \"Gericht 2\", \"Gericht 3\"}\n\theaderLine := lines[lineWochentag]\n\tcolumns := make([]*column, 0, len(headers))\n\tfor i := range headers {\n\t\tindex := strings.Index(headerLine, headers[i])\n\t\tif index == -1 {\n\t\t\treturn nil, fmt.Errorf(\"textToDish: parsing error: failed to locate %v in \\\"Wochentag\\\" line\", headers[i])\n\t\t}\n\t\tcolumns = append(columns, &column{offset: index, name: headers[i], id: i})\n\t}\n\n\tdishes := make([]*Dish, 0)\n\n\t//main parse loop look for line with kcal to seperate the \"rows\". Go backwards from there to parse dishes\n\tlastKcalLine := lineWochentag\n\tconst kcal = \"kcal\"\n\trowID := 0\n\tfor i := lineWochentag + 1; i < len(lines); i++ {\n\t\tif strings.Contains(lines[i], kcal) {\n\t\t\tstartLine := lastKcalLine + 1\n\t\t\tkcalLine := i\n\n\t\t\t//parse textual description\n\t\t\ttitles := splitAfterXWhitespaces(lines[startLine], 3)\n\n\t\t\tdescriptions := make([][]*token, 0)\n\t\t\tfor j := startLine + 1; j < kcalLine; j++ {\n\t\t\t\tif !hasIgnorePrefix(lines[j]) {\n\t\t\t\t\tdescriptions = append(descriptions, splitAfterXWhitespaces(lines[j], 3))\n\t\t\t\t}\n\t\t\t}\n\t\t\tnutritionalValue := splitAfterXWhitespaces(lines[kcalLine], 3)\n\n\t\t\t//maps coldID to Dish if it exists\n\t\t\ttmp := make(map[int]*Dish)\n\t\t\tfor j := range titles {\n\t\t\t\tid := matchToColumn(titles[j].offset, columns).id\n\t\t\t\tv, ok := tmp[id]\n\t\t\t\tif !ok {\n\t\t\t\t\ttmp[id] = &Dish{Title: titles[j].value}\n\t\t\t\t} else {\n\t\t\t\t\tv.Title = titles[j].value\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor j := range descriptions {\n\t\t\t\tfor k := range descriptions[j] {\n\t\t\t\t\tid := matchToColumn(descriptions[j][k].offset, columns).id\n\t\t\t\t\tv, ok := tmp[id]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\ttmp[id] = &Dish{Description: descriptions[j][k].value}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif v.Description != \"\" {\n\t\t\t\t\t\t\tv.Description += \", \"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv.Description += descriptions[j][k].value\n\t\t\t\t\t\tv.Description = strings.Trim(v.Description, \" ,\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor j := range nutritionalValue {\n\t\t\t\tid := matchToColumn(nutritionalValue[j].offset, columns).id\n\t\t\t\tv, ok := tmp[id]\n\t\t\t\tif !ok {\n\t\t\t\t\ttmp[id] = &Dish{Kcal: nutritionalValue[j].value}\n\t\t\t\t} else {\n\t\t\t\t\tv.Kcal = nutritionalValue[j].value\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//filter entries with kcal to eliminate \"Tageskarte\" entries\n\t\t\tfor colID, v := range tmp {\n\t\t\t\tif v.Kcal != \"\" {\n\t\t\t\t\tv.Type = columns[colID].name\n\t\t\t\t\tv.rowID = rowID\n\t\t\t\t\tv.colID = colID\n\t\t\t\t\tv.Date = anchorDate.AddDate(0, 0, rowID)\n\t\t\t\t\tdishes = append(dishes, v)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//update for next round\n\t\t\tlastKcalLine = i\n\t\t\trowID++\n\t\t}\n\t}\n\n\treturn dishes, nil\n}", "title": "" }, { "docid": "ca1ecbf2e8a907fd46635d5dd31c3db0", "score": "0.39548048", "text": "func tqLeapAdjustedYearDay(tqyd, gy int) int {\n\tif gLeapYear(gy) {\n\t\tconst tqydAldrin int = tqMonthLen * int(Hippocrates)\n\t\tif tqyd == tqydAldrin {\n\t\t\treturn AldrinDay\n\t\t} else if tqyd > tqydAldrin {\n\t\t\ttqyd--\n\t\t}\n\t}\n\tif tqyd == commonYearLen {\n\t\tif gy == gMoonLandingYear {\n\t\t\treturn MoonLandingDay\n\t\t}\n\t\treturn ArmstrongDay\n\t}\n\treturn tqyd\n}", "title": "" }, { "docid": "69f64538f258a8af9e7381ded076992c", "score": "0.39421377", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetEngagedRestartTransitionScheduleInDays(value *int32)() {\n m.engagedRestartTransitionScheduleInDays = value\n}", "title": "" }, { "docid": "1fd8ddffec1deeb4fefd8b8be7cc8783", "score": "0.39391512", "text": "func (c *Client) UpdateHrHolidaysRemainingLeavesUsers(ids []int64, hhrlu *HrHolidaysRemainingLeavesUser) error {\n\treturn c.Update(HrHolidaysRemainingLeavesUserModel, ids, hhrlu)\n}", "title": "" }, { "docid": "5b72b09a69a5151a829ed6775a9527f0", "score": "0.39177436", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetPostponeRebootUntilAfterDeadline(value *bool)() {\n m.postponeRebootUntilAfterDeadline = value\n}", "title": "" }, { "docid": "6448cd5afe86af58843c2c67cd61ffc8", "score": "0.39167437", "text": "func NWorkDaysAgo(plant string, n int) (time.Time, int) {\n\tvar offset int\n\n\tvar workdays int\n\tloc := plantLocation[plant]\n\tif n <= 0 {\n\t\td, _ := time.Parse(\"2006-01-02\", time.Now().In(loc).Format(\"2006-01-02\"))\n\t\treturn d, 0\n\t}\n\n\toffset = -1\n\td, _ := time.Parse(\"2006-01-02\", time.Now().Add(-24*time.Hour).In(loc).Format(\"2006-01-02\"))\n\tfor workdays < n {\n\t\tfor d.Weekday() == time.Saturday || d.Weekday() == time.Sunday || HolidayMap[plant][d] {\n\t\t\td = d.Add(-24 * time.Hour)\n\t\t\toffset--\n\t\t}\n\t\tworkdays++\n\t\tif workdays == n {\n\t\t\tbreak\n\t\t}\n\t\td = d.Add(-24 * time.Hour)\n\t\toffset--\n\t}\n\treturn d, offset\n}", "title": "" }, { "docid": "97f838493c6de52fcf5e4d4f0b86f0a6", "score": "0.39162683", "text": "func YearDays(year int) int {\n\tsum := 348\n\tfor i := 0x8000; i > 0x8; i >>= 1 {\n\t\tif (lunarTable[year-MinYear] & i) != 0 {\n\t\t\tsum += 1\n\t\t}\n\t}\n\treturn sum + LeapDays(year)\n}", "title": "" }, { "docid": "e5e15576e694adc58505855235be1c45", "score": "0.39082763", "text": "func NewHolidayRepository() *HolidayRepository {\n\treturn &HolidayRepository{}\n}", "title": "" }, { "docid": "01d26c34fbafc54f3b73da0b9d9bbcdf", "score": "0.39035854", "text": "func (c *Client) NDFDgenByDayLatLonList(ctx context.Context, v NDFDgenByDayLatLonListRequest) (string, error) {\n\tvar input struct {\n\t\tXMLName struct{} `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl NDFDgenByDayLatLonList\"`\n\t\tArgs struct {\n\t\t\tListLatLon ListLatLon `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl listLatLon\"`\n\t\t\tStartDate time.Time `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl startDate\"`\n\t\t\tNumDays int `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl numDays\"`\n\t\t\tUnit Unit `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl Unit\"`\n\t\t\tFormat Format `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl format\"`\n\t\t} `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl NDFDgenByDayLatLonListRequest\"`\n\t}\n\tinput.Args.ListLatLon = ListLatLon(v.ListLatLon)\n\tinput.Args.StartDate = time.Time(v.StartDate)\n\tinput.Args.NumDays = int(v.NumDays)\n\tinput.Args.Unit = Unit(v.Unit)\n\tinput.Args.Format = Format(v.Format)\n\tvar output struct {\n\t\tXMLName struct{} `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl NDFDgenByDayLatLonList\"`\n\t\tArgs struct {\n\t\t\tDwmlByDayOut string `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl dwmlByDayOut\"`\n\t\t} `xml:\"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl NDFDgenByDayLatLonListResponse\"`\n\t}\n\terr := c.do(ctx, \"POST\", \"http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php\", \"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgenByDayLatLonList\", &input, &output)\n\treturn string(output.Args.DwmlByDayOut), err\n}", "title": "" }, { "docid": "fa8b46622b0d98ca90860acd811481f6", "score": "0.38974723", "text": "func Years (y int) int {\n return 7 * y\n}", "title": "" }, { "docid": "2ffa4d61a1935245c30b46e0e4f700f6", "score": "0.38916495", "text": "func Years(y int) int {\n\treturn y * 7\n}", "title": "" }, { "docid": "2ffa4d61a1935245c30b46e0e4f700f6", "score": "0.38916495", "text": "func Years(y int) int {\n\treturn y * 7\n}", "title": "" }, { "docid": "1bfed41890fb458e907b800f143b9fde", "score": "0.38914356", "text": "func LeapDays(year int) int {\n\tif LeapMonth(year) != 0 {\n\t\tif (lunarTable[year-MinYear] & 0x10000) != 0 {\n\t\t\treturn 30\n\t\t}\n\t\treturn 29\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "4789274e5bdd80498899283fcb68c967", "score": "0.38802466", "text": "func Day07(input string) (answer1, answer2 string, err error) {\n\n\truleset, err := generateBagRuleset(input)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"could not read from scanner\")\n\t\treturn\n\t}\n\n\tanswer1 = strconv.Itoa(len(ruleset.findAllContaining(bag{\"shiny\", \"gold\"})))\n\tanswer2 = strconv.Itoa(ruleset.countBags(bag{\"shiny\", \"gold\"}))\n\treturn\n}", "title": "" }, { "docid": "b4cd9ad6b984af42bb87c29896e36d89", "score": "0.385904", "text": "func calculateCAIndependence(year int, loc *time.Location) (time.Month, int) {\n\treturn calculateFixeddateHoliday(year, time.July, 1, ObservedMonday, loc)\n}", "title": "" }, { "docid": "51f8a9d1e0ad7e1341055346e53b9f3e", "score": "0.38489863", "text": "func Years(n int) {\n\tfmt.Println(n * 7)\n}", "title": "" }, { "docid": "3ac83edccfc3e0e88d0f9825657ee22c", "score": "0.38305947", "text": "func dateBoundaries(start time.Time, end time.Time, numDays int) []time.Time {\n\tif numDays <= 0 {\n\t\tnumDays = 1\n\t}\n\n\tstart = utility.GetUTCDay(start)\n\tend = utility.GetUTCDay(end)\n\tduration := 24 * time.Hour * time.Duration(numDays)\n\tboundary := start\n\tboundaries := []time.Time{}\n\n\tfor boundary.Before(end) {\n\t\tboundaries = append(boundaries, boundary)\n\t\tboundary = boundary.Add(duration)\n\t}\n\treturn boundaries\n}", "title": "" }, { "docid": "0457be9504abeb94ab38d007722a2f49", "score": "0.38267007", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetDeadlineForQualityUpdatesInDays(value *int32)() {\n m.deadlineForQualityUpdatesInDays = value\n}", "title": "" }, { "docid": "2776cbee96d5ebb5851b84e6ca3b61cf", "score": "0.3809782", "text": "func count1stSundaysInRange(date1DayOfWeek DayOfWeek, date1 Date, date2 Date) int {\n\tdateCursor := date1\n\tdayOfWeek := date1DayOfWeek\n\n\t// Increment date cursor until we reach date2\n\tfirstSundays := 0\n\tfor ; dateCursor != date2; dateCursor,dayOfWeek = tomorrow(dateCursor),nextDayOfWeek(dayOfWeek) {\n\t\tif dateCursor.day == 1 && dayOfWeek == sunday {\n\t\t\tfirstSundays++\n\t\t\tfmt.Printf(\"Sunday: %d-%d-%d\\n\", dateCursor.month, dateCursor.day, dateCursor.year)\n\t\t}\n\t}\n\n\treturn firstSundays\n}", "title": "" }, { "docid": "f736950e251da45e82e9b2535a0c2745", "score": "0.38092571", "text": "func SetPfVfLinkNetNs(pfPciAddr, netNsPath string, pollInterval time.Duration, quitCh chan bool, doneCh chan error) {\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\tvar errL []error\n\t//merge any errors found during execution, send through channel, and close it.\n\tdefer func() {\n\t\tif len(errL) != 0 {\n\t\t\terrMsg := \"\"\n\t\t\tfor i, err := range errL {\n\t\t\t\terrMsg = errMsg + fmt.Sprintf(\"error %d) '%s'\", i+1, err.Error())\n\t\t\t}\n\t\t\tdoneCh <- fmt.Errorf(\"%s\", errMsg)\n\t\t}\n\t\tclose(doneCh)\n\t}()\n\n\tif pfPciAddr == \"\" || netNsPath == \"\" {\n\t\terrL = append(errL, fmt.Errorf(\"SetPfVfLinkNetNs(): specify PF PCI address and/or netns path '%s' & '%s'\",\n\t\t\tpfPciAddr, netNsPath))\n\t\treturn\n\t}\n\n\tpfPciDir := filepath.Join(sysBusPci, pfPciAddr)\n\tif _, err := os.Lstat(pfPciDir); err != nil {\n\t\terrL = append(errL, fmt.Errorf(\"SetPfVfLinkNetNs(): failed to find PCI device at '%s': '%s'\", pfPciDir,\n\t\t\terr.Error()))\n\t\treturn\n\t}\n\n\ttargetNetNs, err := netns.GetFromPath(netNsPath)\n\tif err != nil {\n\t\terrL = append(errL, fmt.Errorf(\"SetPfVfLinkNetNs(): failed to get target network namespace: '%s'\",\n\t\t\terr.Error()))\n\t\treturn\n\t}\n\tdefer targetNetNs.Close()\n\t// if failure to set PF netns, emit error, assume its in correct netns and continue\n\tif err = setLinkNetNs(pfPciAddr, targetNetNs); err != nil {\n\t\terrL = append(errL, fmt.Errorf(\"SetPfVfLinkNetNs(): unable to set physical function '%s' network namespace: '%s'\", pfPciAddr,\n\t\t\terr.Error()))\n\t}\n\tticker := time.NewTicker(pollInterval)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-quitCh:\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tif err := setVfNetNs(pfPciAddr, targetNetNs); err != nil {\n\t\t\t\t//save errors for returning but continue\n\t\t\t\terrL = append(errL, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8ddebf4a738f0146d5827be8bab5208f", "score": "0.3801905", "text": "func Years(i int) int {\n\treturn i * 7\n}", "title": "" }, { "docid": "ecfe4205c69cb677fe636bb584e5d2e1", "score": "0.3796517", "text": "func Test_Calendar_1(t *testing.T) {\n\tTBegin(t)\n\t//\n\tvar ret Calendar\n\tret.Set(\"2018-01-01\", 20.01)\n\tret.Set(\"2018-01-02\", 21.02)\n\tret.Set(\"2018-01-03\", 22.03)\n\tret.Set(\"2018-01-04\", 23.04)\n\tret.Set(\"2018-01-05\", 24.05)\n\tret.Set(\"2018-01-06\", 10.06)\n\tret.Set(\"2018-01-07\", 11.07)\n\tret.Set(\"2018-01-08\", 12.08)\n\tret.Set(\"2018-01-09\", 13.09)\n\tret.Set(\"2018-01-10\", 9.10)\n\tret.Set(\"2018-01-11\", 8.11)\n\tret.Set(\"2018-01-12\", 7.12)\n\tret.Set(\"2018-01-13\", 6.13)\n\tret.Set(\"2018-01-14\", 5.14)\n\tret.Set(\"2018-01-15\", 4.15)\n\tret.Set(\"2018-01-16\", 3.16)\n\tret.Set(\"2018-01-17\", 2.17)\n\tret.Set(\"2018-01-18\", 1.18)\n\tret.Set(\"2018-01-19\", 0.19)\n\tret.Set(\"2018-01-20\", 20.10)\n\tret.Set(\"2018-01-21\", 19.20)\n\tret.Set(\"2018-01-22\", 18.30)\n\tret.Set(\"2018-01-23\", 17.40)\n\tret.Set(\"2018-01-24\", 16.50)\n\tret.Set(\"2018-01-25\", 15.60)\n\tret.Set(\"2018-01-26\", 14.70)\n\tret.Set(\"2018-01-27\", 13.80)\n\tret.Set(\"2018-01-28\", 12.90)\n\tret.Set(\"2018-01-29\", 11.11)\n\tret.Set(\"2018-01-30\", 10.22)\n\tret.Set(\"2018-01-31\", 9.33)\n\tret.Set(\"2018-02-01\", 8.44)\n\tret.Set(\"2018-02-02\", 7.55)\n\tret.Set(\"2018-02-03\", 6.66)\n\tret.Set(\"2018-02-04\", 5.77)\n\tret.Set(\"2018-02-05\", 4.88)\n\tret.Set(\"2018-02-06\", 3.99)\n\tret.Set(\"2018-02-07\", 2.15)\n\tret.Set(\"2018-02-08\", 1.54)\n\tret.Set(\"2018-02-09\", 0.00)\n\tret.Set(\"2018-02-10\", 1.00)\n\tret.Set(\"2018-02-11\", 2.00)\n\tret.Set(\"2018-02-12\", 3.00)\n\tret.Set(\"2018-02-13\", 4.00)\n\tret.Set(\"2018-02-14\", 5.00)\n\tret.Set(\"2018-02-15\", 6.00)\n\tret.Set(\"2018-02-16\", 7.00)\n\tret.Set(\"2018-02-17\", 8.00)\n\tret.Set(\"2018-02-18\", 9.00)\n\tret.Set(\"2018-02-19\", 10.00)\n\tgot := ret.String()\n\tconst expect = `\n2018 JANUARY\n*--------------------------------------------------------------*\n| Mon | Tue | Wed | Thu | Fri | Sat | Sun |\n|--------|--------|--------|--------|--------|--------|--------|\n| 1 | 2 | 3 | 4 | 5 | 6 | 7 |\n| 20.01 | 21.02 | 22.03 | 23.04 | 24.05 | 10.06 | 11.07 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 8 | 9 | 10 | 11 | 12 | 13 | 14 |\n| 12.08 | 13.09 | 9.1 | 8.11 | 7.12 | 6.13 | 5.14 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 15 | 16 | 17 | 18 | 19 | 20 | 21 |\n| 4.15 | 3.16 | 2.17 | 1.18 | 0.19 | 20.1 | 19.2 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 22 | 23 | 24 | 25 | 26 | 27 | 28 |\n| 18.3 | 17.4 | 16.5 | 15.6 | 14.7 | 13.8 | 12.9 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 29 | 30 | 31 | | | | |\n| 11.11 | 10.22 | 9.33 | | | | |\n|--------|--------|--------|--------|--------|--------|--------|\n| | | | | | | |\n| | | | | | | |\n*--------------------------------------------------------------*\n(375)\n382.06\n\n2018 FEBRUARY\n*--------------------------------------------------------------*\n| Mon | Tue | Wed | Thu | Fri | Sat | Sun |\n|--------|--------|--------|--------|--------|--------|--------|\n| | | | 1 | 2 | 3 | 4 |\n| | | | 8.44 | 7.55 | 6.66 | 5.77 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 5 | 6 | 7 | 8 | 9 | 10 | 11 |\n| 4.88 | 3.99 | 2.15 | 1.54 | 0 | 1 | 2 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 12 | 13 | 14 | 15 | 16 | 17 | 18 |\n| 3 | 4 | 5 | 6 | 7 | 8 | 9 |\n|--------|--------|--------|--------|--------|--------|--------|\n| 19 | 20 | 21 | 22 | 23 | 24 | 25 |\n| 10 | | | | | | |\n|--------|--------|--------|--------|--------|--------|--------|\n| 26 | 27 | 28 | | | | |\n| | | | | | | |\n|--------|--------|--------|--------|--------|--------|--------|\n| | | | | | | |\n| | | | | | | |\n*--------------------------------------------------------------*\n(91)\n95.98\n\t`\n\tgot = strings.TrimSpace(got)\n\tTEqual(t, got, strings.TrimSpace(expect))\n}", "title": "" }, { "docid": "13c22d2474879a26fff33fe3c3fce921", "score": "0.37956637", "text": "func checkBirthdays() {\n\tlogging.LogInfo(\"Checking for birthdays\")\n\tebrList, err := db.GetAllEntryBirthdayReminders()\n\tif err != nil {\n\t\tlogging.LogWarning(\"An error occured while querying the database for birthdays\")\n\t}\n\n\tfor _, entry := range ebrList {\n\n\t\tt := time.Now()\n\t\t_, month, day := t.Date()\n\t\tpattern := fmt.Sprintf(\"(-|\\\\s)%02d(-|\\\\s)%02d\", int(month), day)\n\t\tr, _ := regexp.Compile(pattern)\n\t\tif r.MatchString(entry.Date) == false {\n\t\t\tcontinue\n\t\t}\n\t\tresponseString := fmt.Sprintf(\"Hi %s\\n\", entry.UserName)\n\t\tresponseString += fmt.Sprintf(\"%s has his / her birthday today.\\n He / She was born on %s. You can reach this person in this way:\\n %s\", entry.Name, entry.Date, entry.Contact)\n\t\tsMessage := comm.SendMessage{\n\t\t\tText: responseString,\n\t\t\tChatID: entry.ChatId,\n\t\t}\n\t\tsender.AddMessageToTx(sMessage, \"sendMessage\")\n\t}\n}", "title": "" }, { "docid": "42115a1562f0bbdb85f718cdae61d901", "score": "0.3791105", "text": "func (fe *fieldExtract) SetDayOfYear(chunk numberChunk) error {\n\tif chunk.separator != ' ' && chunk.separator != '.' {\n\t\treturn badFieldPrefixError(fieldMonth, chunk.separator)\n\t}\n\n\ty, ok := fe.Get(fieldYear)\n\tif !ok {\n\t\treturn errors.AssertionFailedf(\"year must be set before day of year\")\n\t}\n\ty, m, d := julianDayToDate(dateToJulianDay(y, 1, 1) + chunk.v - 1)\n\tif err := fe.Reset(fieldYear, y); err != nil {\n\t\treturn err\n\t}\n\tif err := fe.Set(fieldMonth, m); err != nil {\n\t\treturn err\n\t}\n\treturn fe.Set(fieldDay, d)\n}", "title": "" }, { "docid": "4b6a751a36f8abb5283ed9e9f7026471", "score": "0.37812915", "text": "func Create(wd Workdays, hd Holidays) (c *BitCal) {\n\n\tc = &BitCal{}\n\n\tc.wd = wd\n\tc.hd = hd\n\n\tc.bmap = make(map[int]bityear)\n\n\treturn\n}", "title": "" }, { "docid": "0737e1a2642066579fdb037bd3fc65ad", "score": "0.37783343", "text": "func (_Unit_Interface *Unit_InterfaceTransactor) SetSpecialLifPrice(opts *bind.TransactOpts, price *big.Int, fromDay *big.Int, daysAmount *big.Int) (*types.Transaction, error) {\n\treturn _Unit_Interface.contract.Transact(opts, \"setSpecialLifPrice\", price, fromDay, daysAmount)\n}", "title": "" }, { "docid": "36d3e678fc7e08344572731860498ab0", "score": "0.37776288", "text": "func Years(hYear int) int {\n\treturn hYear * 7\n}", "title": "" }, { "docid": "beabcaa6bd25ed3d3d7d16c62ec1f276", "score": "0.37713537", "text": "func (o *DcimInterfacesListParams) SetLabelNisw(labelNisw *string) {\n\to.LabelNisw = labelNisw\n}", "title": "" }, { "docid": "f74784131493b09c3191b14b8412efc5", "score": "0.37500605", "text": "func (m *StandardTimeZoneOffset) SetDayOfWeek(value *DayOfWeek)() {\n err := m.GetBackingStore().Set(\"dayOfWeek\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "dc296330a5ef6446adb8230745c6e8ce", "score": "0.3747437", "text": "func (m *EventMessage) SetIsOutOfDate(value *bool)() {\n m.isOutOfDate = value\n}", "title": "" }, { "docid": "ae74f9da6af0c9e9114c51db38626f71", "score": "0.37287486", "text": "func scheduleUpdates(db nflpickem.Updater) {\n\t// Friday at 8:00\n\tgo func() {\n\t\tnextFriday := adjustIfPast(nextDay(time.Friday).Add(time.Hour * 8))\n\t\tlogNextScheduleUpdate(nextFriday)\n\t\ttime.Sleep(nextFriday.Sub(time.Now()))\n\t\tfor {\n\t\t\tgo update(db, false)\n\t\t\tlogNextScheduleUpdate(time.Now().AddDate(0, 0, 7))\n\t\t\ttime.Sleep(time.Hour * 24 * 7)\n\t\t}\n\t}()\n\n\t// Sunday at 18:00\n\tgo func() {\n\t\tnextSunday := adjustIfPast(nextDay(time.Sunday).Add(time.Hour * 18))\n\t\tlogNextScheduleUpdate(nextSunday)\n\t\ttime.Sleep(nextSunday.Sub(time.Now()))\n\t\tfor {\n\t\t\tgo update(db, false)\n\t\t\tlogNextScheduleUpdate(time.Now().AddDate(0, 0, 7))\n\t\t\ttime.Sleep(time.Hour * 24 * 7)\n\t\t}\n\t}()\n\n\t// Sunday at 21:00\n\tgo func() {\n\t\tnextSunday := adjustIfPast(nextDay(time.Sunday).Add(time.Hour * 21))\n\t\tlogNextScheduleUpdate(nextSunday)\n\t\ttime.Sleep(nextSunday.Sub(time.Now()))\n\t\tfor {\n\t\t\tgo update(db, false)\n\t\t\tlogNextScheduleUpdate(time.Now().AddDate(0, 0, 7))\n\t\t\ttime.Sleep(time.Hour * 24 * 7)\n\t\t}\n\t}()\n\n\t// Monday at 8:00\n\tgo func() {\n\t\tnextMonday := adjustIfPast(nextDay(time.Monday).Add(time.Hour * 8))\n\t\tlogNextScheduleUpdate(nextMonday)\n\t\ttime.Sleep(nextMonday.Sub(time.Now()))\n\t\tfor {\n\t\t\tgo update(db, false)\n\t\t\tlogNextScheduleUpdate(time.Now().AddDate(0, 0, 7))\n\t\t\ttime.Sleep(time.Hour * 24 * 7)\n\t\t}\n\t}()\n\n\t// Tuesday at 8:00. Here we need to update the current week - 1\n\tgo func() {\n\t\tnextTuesday := adjustIfPast(nextDay(time.Tuesday).Add(time.Hour * 8))\n\t\tlogNextScheduleUpdate(nextTuesday)\n\t\ttime.Sleep(nextTuesday.Sub(time.Now()))\n\t\tfor {\n\t\t\tgo update(db, true)\n\t\t\tlogNextScheduleUpdate(time.Now().AddDate(0, 0, 7))\n\t\t\ttime.Sleep(time.Hour * 24 * 7)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "edf76d50fc74dac5844dcb587a4ff756", "score": "0.37255257", "text": "func (d *Date) SetDay(day int) { d.day = day }", "title": "" }, { "docid": "9508dbd7756699c9c29fd63b6b15382a", "score": "0.3724076", "text": "func Years(hYears int) int {\n\treturn hYears * 7\n}", "title": "" }, { "docid": "d2c4d01edac1db8802abe8592f54e5a4", "score": "0.3718398", "text": "func euler19() int {\n\ttotal := 0\n\tfor y := 1901; y < 2001; y++ {\n\t\tfor m := 1; m < 13; m++ {\n\t\t\td := time.Date(y, time.Month(m), 1, 0, 0, 0, 0, time.UTC)\n\t\t\tif d.Weekday() == time.Sunday {\n\t\t\t\ttotal += 1\n\t\t\t}\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "dc15df8e33eeb160c0d3cc3f86248633", "score": "0.37103975", "text": "func edays(year int) uint16 {\n\treturn uint16(365.25 * (float64(year) - 1960))\n}", "title": "" }, { "docid": "edc2bfcce848129114660b1a1e4c9701", "score": "0.36994958", "text": "func Years(x int) int {\n\treturn x * 7\n}", "title": "" }, { "docid": "edc2bfcce848129114660b1a1e4c9701", "score": "0.36994958", "text": "func Years(x int) int {\n\treturn x * 7\n}", "title": "" }, { "docid": "db1f98e178772cfbe2727bce426ef800", "score": "0.36958545", "text": "func (m *WindowsUpdateForBusinessConfiguration) SetScheduleRestartWarningInHours(value *int32)() {\n m.scheduleRestartWarningInHours = value\n}", "title": "" }, { "docid": "ba91d4d89451f3da25ffcd8548757ee7", "score": "0.36918637", "text": "func (t *SimpleChaincode) setnewFndbalance (stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "2ee35ece148573e36d2e6724eff82523", "score": "0.36480045", "text": "func setEpochs(nn neuralNetwork, flags flags) neuralNetwork {\n\tdefaultConfig := defaultConfig()\n\tif flags.flagE && flags.epochs == defaultConfig.epochs { // early stopping, \"infinite\" training\n\t\tnn.epochs = 42000\n\t} else {\n\t\tnn.epochs = flags.epochs\n\t}\n\treturn nn\n}", "title": "" }, { "docid": "7401ebc86231656881419833658c8626", "score": "0.3645993", "text": "func NewHday(in string) (Hday, error) {\n\tempty := Hday{}\n\tfs := strings.Split(in, \"\\t\")\n\tif len(fs) != 5 {\n\t\treturn empty, errors.New(\"hday: invalid data row\")\n\t}\n\n\t// start date\n\td, err := parseDate(fs[0])\n\tif err != nil {\n\t\treturn empty, errors.New(\"hday: invalid start date\")\n\t}\n\n\t// end date\n\ted, err := parseDate(fs[2])\n\tif err != nil {\n\t\treturn empty, errors.New(\"hday: invalid end date\")\n\t}\n\n\t// name\n\tn := fs[4]\n\n\t// valid holiday\n\th := Hday{\n\t\tdate: d,\n\t\tendDate: ed,\n\t\tname: n,\n\t}\n\n\treturn h, nil\n}", "title": "" }, { "docid": "3c1b66745c40b332dea7bc3217921457", "score": "0.36453784", "text": "func (c *Calendar) WorkdayN(year int, month time.Month, n int) int {\n\tvar date time.Time\n\tvar add int\n\tif n == 0 {\n\t\treturn 0\n\t}\n\n\tif n > 0 {\n\t\tdate = time.Date(year, month, 1, 12, 0, 0, 0, time.UTC)\n\t\tadd = 1\n\t} else {\n\t\tdate = time.Date(year, month+1, 1, 12, 0, 0, 0, time.UTC).AddDate(0, 0, -1)\n\t\tadd = -1\n\t\tn = -n\n\t}\n\n\tndays := 0\n\tfor ; month == date.Month(); date = date.AddDate(0, 0, add) {\n\t\tif c.IsWorkday(date) {\n\t\t\tndays++\n\t\t\tif ndays == n {\n\t\t\t\treturn date.Day()\n\t\t\t}\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "2991eb739c3960ac1d3254c9d814ae7a", "score": "0.36406976", "text": "func (c *options) setOnHours(onHours string) error {\n\thrs, err := parseHours(onHours)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.onHours = hrs\n\treturn nil\n}", "title": "" }, { "docid": "762294ebc9c60d825eda64201f95c5e6", "score": "0.36387572", "text": "func setHF() {\n\n\tii := -1\n\tfor j, c := range elxcat {\n\t\tif c == \"CHF\" {\n\t\t\tii = j\n\t\t\tbreak\n\t\t}\n\t}\n\tif ii == -1 {\n\t\tpanic(\"can't find CHF category\\n\")\n\t}\n\thfcodes = elix[ii]\n}", "title": "" }, { "docid": "916d1f24bddcdbc1d3c9c1f449b545fc", "score": "0.36342013", "text": "func updateFoodWeek() error {\n\tloc, _ := time.LoadLocation(\"Europe/Berlin\")\n\t_, thisWeek := time.Now().In(loc).UTC().ISOWeek()\n\tweekstring := strconv.Itoa(thisWeek)\n\tif getTmp(\"mensa\", \"food|week|\"+weekstring) == \"\" {\n\t\tmensaBotLog.Info(\"No File for this week found - starting download\")\n\t\terr := downloadFood(weekstring)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b8b0ddabc50e902784ddc9c61d9d5f2", "score": "0.36333734", "text": "func (rs CountryHandler) DomainsWithoutIPv6ByCountryCode(w http.ResponseWriter, r *http.Request) {\n\tcode := chi.URLParam(r, \"code\")\n\n\tcountry, err := rs.Repo.GetCountryCode(r.Context(), strings.ToUpper(code))\n\tif err != nil {\n\t\trender.Status(r, http.StatusNotFound)\n\t\trender.JSON(w, r, render.M{\"error\": \"Country not found\"})\n\t\treturn\n\t}\n\n\t// Retrieve the list of domains for the country.ID\n\tdomains, err := rs.Repo.ListDomainsByCountry(r.Context(), country.ID)\n\tif err != nil {\n\t\trender.Status(r, http.StatusInternalServerError)\n\t\trender.JSON(w, r, render.M{\"error\": \"internal server error\"})\n\t\treturn\n\t}\n\tvar domainList []DomainResponse\n\tfor _, domain := range domains {\n\t\tdomainList = append(domainList, DomainResponse{\n\t\t\tRank: domain.Rank,\n\t\t\tDomain: domain.Site,\n\t\t\tCheckAAAA: domain.CheckAAAA,\n\t\t\tCheckWWW: domain.CheckWWW,\n\t\t\tCheckNS: domain.CheckNS,\n\t\t\tCheckCurl: domain.CheckCurl,\n\t\t\tAsName: domain.AsName,\n\t\t\tCountry: domain.Country,\n\t\t\tTsAAAA: domain.TsAAAA,\n\t\t\tTsWWW: domain.TsWWW,\n\t\t\tTsNS: domain.TsNS,\n\t\t\tTsCurl: domain.TsCurl,\n\t\t\tTsCheck: domain.TsCheck,\n\t\t\tTsUpdated: domain.TsUpdated,\n\t\t})\n\t}\n\trender.JSON(w, r, domainList)\n}", "title": "" } ]
dcd76c3b35276f060857dde1054aaf77
Run web server with turndown endpoints
[ { "docid": "4416b99822b2fb580c2361ea463cc910", "score": "0.73763806", "text": "func runWebServer(kubeClient kubernetes.Interface, client clientset.Interface, scheduler *turndown.TurndownScheduler, manager turndown.TurndownManager, provider provider.TurndownProvider) {\n\tmux := http.NewServeMux()\n\n\tendpoints := turndown.NewTurndownEndpoints(kubeClient, client, scheduler, manager, provider)\n\n\tmux.HandleFunc(\"/schedule\", endpoints.HandleStartSchedule)\n\tmux.HandleFunc(\"/cancel\", endpoints.HandleCancelSchedule)\n\n\tklog.Fatal(http.ListenAndServe(\":9731\", mux))\n}", "title": "" } ]
[ { "docid": "04ce6e481666f461aae8c0fd18e1011c", "score": "0.7477051", "text": "func main() {\n flag.Parse()\n cfgFile := flag.Arg(0)\n err := bootstrap(cfgFile)\n if err == nil {\n listen := config.GetStringDefault(\"listen\", \"0.0.0.0\")\n port := config.GetStringDefault(\"port\", \"9999\")\n web.Run(fmt.Sprintf(\"%s:%s\", listen, port))\n }\n}", "title": "" }, { "docid": "bcce1d41aa2ecbf90973ac93d4c47221", "score": "0.7435362", "text": "func main() {\n\tr := api.GetRoutes()\n\tr.Run(\":8080\")\n}", "title": "" }, { "docid": "c3d400df0eb0dae4aa13111483837d04", "score": "0.7132529", "text": "func main() {\n\tapp := fiber.New()\n\tport := getenv(\"PORT\", \":8080\")\n\tapp.Get(\"/api/v1/tickers\", finance.GetTickersPandas)\n\tapp.Get(\"/api/v1/sentiment\", nlp.GetSentiment)\n\tapp.Get(\"/api/v1/twitter\", twitter.GetTwitterSimple)\n\tapp.Post(\"/api/v1/discord\", discord.SendDiscordHook)\n\tapp.Listen(port)\n}", "title": "" }, { "docid": "6b32e3b02c0607ba80459e78f2564bdb", "score": "0.70836425", "text": "func Run(gnf gnfinder.GNfinder, port int) {\n\tlog.Printf(\"Starting the HTTP API server on port %d.\", port)\n\te := echo.New()\n\n\tvar err error\n\te.Renderer, err = NewTemplate()\n\tif err != nil {\n\t\te.Logger.Fatal(err)\n\t}\n\n\te.Use(middleware.Gzip())\n\te.Use(middleware.CORS())\n\tif withLogs {\n\t\te.Use(middleware.Logger())\n\t}\n\n\te.GET(\"/\", home(gnf))\n\te.GET(\"/apidoc\", apidoc(gnf))\n\te.POST(\"/find\", find(gnf))\n\n\te.GET(\"/api\", infoApiGET(gnf))\n\te.GET(\"/api/\", infoApiGET(gnf))\n\te.GET(\"/api/v1\", infoApiGET(gnf))\n\te.GET(\"/api/v1/\", infoApiGET(gnf))\n\te.GET(\"/api/v1/ping\", pingApiGET())\n\te.GET(\"/api/v1/version\", verApiGET(gnf))\n\te.GET(\"/api/v1/find/:text\", findApiGET(gnf))\n\te.POST(\"/api/v1/find\", findApiPOST(gnf))\n\n\tfs := http.FileServer(http.FS(static))\n\te.GET(\"/static/*\", echo.WrapHandler(fs))\n\n\taddr := fmt.Sprintf(\":%d\", port)\n\ts := &http.Server{\n\t\tAddr: addr,\n\t\tReadTimeout: 5 * time.Minute,\n\t\tWriteTimeout: 5 * time.Minute,\n\t}\n\te.Logger.Fatal(e.StartServer(s))\n}", "title": "" }, { "docid": "000e14c02e03e7e0675ad7ebc33bb830", "score": "0.70829636", "text": "func main() {\n\tr := setupRouter()\n\tr.Run(\":8080\")\n}", "title": "" }, { "docid": "cccff620e3cdf3775d013d564f2fb783", "score": "0.7012983", "text": "func (u *HTTPServer) Run() {\n\t// Echo instance\n\te := echo.New()\n\te.Use(mw.Recover())\n\te.Use(mw.Logger())\n\n\t/// CORS restricted\n\t// Allows requests from all origins\n\t// wth GET, PUT, POST or DELETE method.\n\te.Use(mw.CORSWithConfig(mw.CORSConfig{\n\t\tAllowOrigins: []string{\"*\"},\n\t\tAllowMethods: []string{echo.GET, echo.PUT, echo.POST, echo.DELETE},\n\t}))\n\te.GET(\"/swagger/*\", echoSwagger.WrapHandler)\n\te.GET(\"/\", h)\n\n\tgAPI := e.Group(\"/api\")\n\tjwtConfig := mw.JWTConfig{\n\t\tClaims: &auth.Claims{},\n\t\tSigningKey: []byte(appconf.Secret),\n\t\tContextKey: \"user\",\n\t}\n\tgAPI.Use(mw.JWTWithConfig(jwtConfig))\n\tgAPI.Use(amw.EchoMiddleware(u.Roles, amw.JWTConfig{\n\t\tRolesCtxKey: \"roles\",\n\t\tTokenCtxKey: \"user\",\n\t}))\n\tOnboarding(u.DB, e)\n\tRegisterTo(u.DB, e)\n\tSupport(u.DB, e)\n\tRoutesConfig(u.DB, gAPI, u.Ecom)\n\te.HTTPErrorHandler = httpErrorHandler\n\n\tfmt.Println(\"online\")\n\taddr := appconf.App.Address\n\te.Logger.Fatal(e.Start(addr))\n}", "title": "" }, { "docid": "3f4251c5e5f645a700401e842fd3de99", "score": "0.70100147", "text": "func main() {\n\tsrv := server.CreateHTTPServerWithRoutes()\n\tgo func() {\n\t\ttime.Sleep(time.Second)\n\t\tfmt.Println(\"Sever listening on http://localhost:8080\")\n\t}()\n\tlog.Fatal(srv.ListenAndServe())\n}", "title": "" }, { "docid": "7e77388f5f3f0ca4bdbc7de947e71860", "score": "0.6977255", "text": "func main() {\n\t//Define config\n\tviper.SetConfigName(\"config\")\n\tviper.AddConfigPath(\".\")\n\tviper.AutomaticEnv()\n\tviper.SetConfigType(\"yaml\")\n\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tfmt.Printf(\"Error with config file: %s\", err)\n\t}\n\n\tif Config.LiveMode {\n\t\tfmt.Print(\"Server Launched in Production Environment!\")\n\t} else {\n\t\tfmt.Print(\"Server Launched in Development/Quality Environment!\")\n\t}\n\n\tConfig.ApplyConfig()\n\n\t//Create routes\n\tr := mux.NewRouter()\n\n\tapi := r.PathPrefix(\"/api/v1\").Subrouter()\n\tapi.HandleFunc(\"/techdata/auth\", Techdata.AuthLogin).Methods(http.MethodGet)\n\tapi.HandleFunc(\"/techdata/products\", getProductsTechData).Methods(http.MethodGet)\n\tapi.HandleFunc(\"/techdata/orders\", getOrdersTechData).Methods(http.MethodGet)\n\tapi.HandleFunc(\"/techdata/customers\", getCustomersTechData).Methods(http.MethodGet)\n\n\t//Launch on port in config.yml, default 8080\n\tlog.Fatal(http.ListenAndServe(viper.GetString(\"server.port\"), r))\n}", "title": "" }, { "docid": "99cd3c6f1cba97e8335065b11b000338", "score": "0.69725263", "text": "func Run(config configuration.ServiceConfig) error {\n\ttmplEngine := template.NewTemplateEngine(config)\n\thandler := routes.NewHandler(config, tmplEngine)\n\tapiHandler := api.NewHandler(config)\n\tr := mux.NewRouter()\n\n\thandler.DefineMainRoute(r)\n\thandler.DefineStaticRoute(r)\n\tapiHandler.DefineRoute(r)\n\n\tsrv := http.Server{\n\t\tAddr: config.Endpoint,\n\t\tHandler: r,\n\t\tIdleTimeout: 10 * time.Second,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 5 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\n\tlog.Println(\"Server running on :\", config.Endpoint)\n\n\treturn srv.ListenAndServe()\n}", "title": "" }, { "docid": "a8917c2885102794886d07bb45417ad3", "score": "0.6964989", "text": "func Run() {\n\tdefaultRoutes()\n\trouter.Run(\":5000\")\n}", "title": "" }, { "docid": "d5668fa8a2e3f6f1a3aef59218e11b6d", "score": "0.69625074", "text": "func (s *Rest) Run(port int) {\n\ts.lock.Lock()\n\ts.httpServer = s.makeHTTPServer(port, s.routes())\n\ts.httpServer.ErrorLog = log.ToStdLogger(log.Default(), \"WARN\")\n\ts.lock.Unlock()\n\n\tlog.Printf(\"[INFO] started web server at port %d\", port)\n\terr := s.httpServer.ListenAndServe()\n\tlog.Printf(\"[WARN] web server terminated reason: %s\", err)\n}", "title": "" }, { "docid": "3a05975cda11eb805df4a53fbcf8a82a", "score": "0.69368666", "text": "func main() {\n\tfmt.Println(\"serving on port 8080!!\")\n\n\t//CODE11: create a new gorilla mux router\n\n\t//CODE12: establish api routes\n\n\t//CODE13: configured CORS settings for incoming AJAX requests\n\n\t//CODE14: startup the http server and configure it on port 8080 with the gorilla mux router\n\n}", "title": "" }, { "docid": "4cdbc7c423cf43a533e5c664526b05a1", "score": "0.69200593", "text": "func (s *Server) Run() {\n\tlog.Printf(\"[INFO] activate web server on port %v\", s.Port)\n\tsrv := http.Server{\n\t\tAddr: fmt.Sprintf(\"%v:%v\", s.address, s.Port),\n\t\tHandler: s.routes(),\n\t\tReadHeaderTimeout: time.Second * 5,\n\t}\n\tlog.Printf(\"[WARN] http server terminated, %s\", srv.ListenAndServe())\n}", "title": "" }, { "docid": "d5a5613f70611c1e2187cbc1e2bed3e5", "score": "0.6916801", "text": "func Run() {\n\n\tr := mux.NewRouter()\n\n\tr.HandleFunc(\"/\", postShortURL).Methods(http.MethodPost)\n\tr.HandleFunc(\"/{hash}\", getRedirectShortURL).Methods(http.MethodGet)\n\tr.HandleFunc(\"/info/{hash}\", getURLInfo).Methods(http.MethodGet)\n\n\tport := getHTTPEnvPort()\n\n\tlog.Printf(\"Listening HTTP in port %v ...\", port)\n\tlog.Fatal(http.ListenAndServe(\":\"+port, r))\n}", "title": "" }, { "docid": "d7e5b6143339ae3834a391c75b10ddd6", "score": "0.6910571", "text": "func RunServer(port string) {\n\n\te := echo.New()\n\n\t// Middleware\n\te.Use(middleware.Logger())\n\te.Use(middleware.Recover())\n\t// limit the application to 20 requests/sec using the default in-memory store\n\te.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(20)))\n\n\te.HideBanner = true\n\t//e.colorer.Printf(banner, e.colorer.Red(\"v\"+Version), e.colorer.Blue(website))\n\n\t// Route for system management\n\te.GET(\"/tumblebug/swagger/*\", echoSwagger.WrapHandler)\n\t// e.GET(\"/tumblebug/swaggerActive\", rest_common.RestGetSwagger)\n\te.GET(\"/tumblebug/health\", rest_common.RestGetHealth)\n\n\te.Use(middleware.CORSWithConfig(middleware.CORSConfig{\n\t\tAllowOrigins: []string{\"*\"},\n\t\tAllowMethods: []string{http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete},\n\t}))\n\n\tAPI_USERNAME := os.Getenv(\"API_USERNAME\")\n\tAPI_PASSWORD := os.Getenv(\"API_PASSWORD\")\n\n\te.Use(middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) {\n\t\t// Be careful to use constant time comparison to prevent timing attacks\n\t\tif subtle.ConstantTimeCompare([]byte(username), []byte(API_USERNAME)) == 1 &&\n\t\t\tsubtle.ConstantTimeCompare([]byte(password), []byte(API_PASSWORD)) == 1 {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t}))\n\n\tfmt.Println(\"\\n \\n \")\n\tfmt.Printf(banner)\n\tfmt.Println(\"\\n \")\n\tfmt.Printf(infoColor, website)\n\tfmt.Println(\"\\n \\n \")\n\n\t// Route\n\te.GET(\"/tumblebug/checkNs/:nsId\", rest_common.RestCheckNs)\n\n\te.GET(\"/tumblebug/connConfig\", rest_common.RestGetConnConfigList)\n\te.GET(\"/tumblebug/connConfig/:connConfigName\", rest_common.RestGetConnConfig)\n\te.GET(\"/tumblebug/region\", rest_common.RestGetRegionList)\n\te.GET(\"/tumblebug/region/:regionName\", rest_common.RestGetRegion)\n\n\te.POST(\"/tumblebug/lookupSpecs\", rest_mcir.RestLookupSpecList)\n\te.POST(\"/tumblebug/lookupSpec\", rest_mcir.RestLookupSpec)\n\n\te.POST(\"/tumblebug/lookupImages\", rest_mcir.RestLookupImageList)\n\te.POST(\"/tumblebug/lookupImage\", rest_mcir.RestLookupImage)\n\n\te.POST(\"/tumblebug/inspectResources\", rest_common.RestInspectResources)\n\te.GET(\"/tumblebug/inspectResourcesOverview\", rest_common.RestInspectResourcesOverview)\n\n\te.POST(\"/tumblebug/registerCspResources\", rest_common.RestRegisterCspNativeResources)\n\te.POST(\"/tumblebug/registerCspResourcesAll\", rest_common.RestRegisterCspNativeResourcesAll)\n\n\t// @Tags [Admin] System environment\n\te.POST(\"/tumblebug/config\", rest_common.RestPostConfig)\n\te.GET(\"/tumblebug/config/:configId\", rest_common.RestGetConfig)\n\te.GET(\"/tumblebug/config\", rest_common.RestGetAllConfig)\n\te.DELETE(\"/tumblebug/config/:configId\", rest_common.RestInitConfig)\n\te.DELETE(\"/tumblebug/config\", rest_common.RestInitAllConfig)\n\n\te.GET(\"/tumblebug/object\", rest_common.RestGetObject)\n\te.GET(\"/tumblebug/objects\", rest_common.RestGetObjects)\n\te.DELETE(\"/tumblebug/object\", rest_common.RestDeleteObject)\n\te.DELETE(\"/tumblebug/objects\", rest_common.RestDeleteObjects)\n\n\te.GET(\"/tumblebug/loadCommonResource\", rest_mcir.RestLoadCommonResource)\n\te.GET(\"/tumblebug/ns/:nsId/loadDefaultResource\", rest_mcir.RestLoadDefaultResource)\n\te.DELETE(\"/tumblebug/ns/:nsId/defaultResources\", rest_mcir.RestDelAllDefaultResources)\n\n\t// Route for NameSpace subgroup\n\tg := e.Group(\"/tumblebug/ns\", common.NsValidation())\n\n\t//Namespace Management\n\tg.POST(\"\", rest_common.RestPostNs)\n\tg.GET(\"/:nsId\", rest_common.RestGetNs)\n\tg.GET(\"\", rest_common.RestGetAllNs)\n\tg.PUT(\"/:nsId\", rest_common.RestPutNs)\n\tg.DELETE(\"/:nsId\", rest_common.RestDelNs)\n\tg.DELETE(\"\", rest_common.RestDelAllNs)\n\n\t//MCIS Management\n\tg.POST(\"/:nsId/mcis\", rest_mcis.RestPostMcis)\n\tg.POST(\"/:nsId/registerCspVm\", rest_mcis.RestPostRegisterCSPNativeVM)\n\n\te.POST(\"/tumblebug/mcisRecommendVm\", rest_mcis.RestRecommendVm)\n\te.POST(\"/tumblebug/mcisDynamicCheckRequest\", rest_mcis.RestPostMcisDynamicCheckRequest)\n\te.POST(\"/tumblebug/systemMcis\", rest_mcis.RestPostSystemMcis)\n\n\tg.POST(\"/:nsId/mcisDynamic\", rest_mcis.RestPostMcisDynamic)\n\tg.POST(\"/:nsId/mcis/:mcisId/vmDynamic\", rest_mcis.RestPostMcisVmDynamic)\n\n\t//g.GET(\"/:nsId/mcis/:mcisId\", rest_mcis.RestGetMcis, middleware.TimeoutWithConfig(middleware.TimeoutConfig{Timeout: 20 * time.Second}), middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(1)))\n\t//g.GET(\"/:nsId/mcis\", rest_mcis.RestGetAllMcis, middleware.TimeoutWithConfig(middleware.TimeoutConfig{Timeout: 20 * time.Second}), middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(1)))\n\t// path specific timeout and ratelimit\n\tg.GET(\"/:nsId/mcis/:mcisId\", rest_mcis.RestGetMcis, middleware.TimeoutWithConfig(\n\t\tmiddleware.TimeoutConfig{Timeout: 60 * time.Second}),\n\t\tmiddleware.RateLimiter(middleware.NewRateLimiterMemoryStore(2)))\n\tg.GET(\"/:nsId/mcis\", rest_mcis.RestGetAllMcis, middleware.TimeoutWithConfig(\n\t\tmiddleware.TimeoutConfig{Timeout: 60 * time.Second}),\n\t\tmiddleware.RateLimiter(middleware.NewRateLimiterMemoryStore(2)))\n\n\t// g.PUT(\"/:nsId/mcis/:mcisId\", rest_mcis.RestPutMcis)\n\tg.DELETE(\"/:nsId/mcis/:mcisId\", rest_mcis.RestDelMcis)\n\tg.DELETE(\"/:nsId/mcis\", rest_mcis.RestDelAllMcis)\n\n\tg.POST(\"/:nsId/mcis/:mcisId/vm\", rest_mcis.RestPostMcisVm)\n\tg.GET(\"/:nsId/mcis/:mcisId/vm/:vmId\", rest_mcis.RestGetMcisVm)\n\tg.GET(\"/:nsId/mcis/:mcisId/subgroup\", rest_mcis.RestGetMcisGroupIds)\n\tg.GET(\"/:nsId/mcis/:mcisId/subgroup/:subgroupId\", rest_mcis.RestGetMcisGroupVms)\n\tg.POST(\"/:nsId/mcis/:mcisId/subgroup/:subgroupId\", rest_mcis.RestPostMcisSubGroupScaleOut)\n\n\t//g.GET(\"/:nsId/mcis/:mcisId/vm\", rest_mcis.RestGetAllMcisVm)\n\t// g.PUT(\"/:nsId/mcis/:mcisId/vm/:vmId\", rest_mcis.RestPutMcisVm)\n\tg.DELETE(\"/:nsId/mcis/:mcisId/vm/:vmId\", rest_mcis.RestDelMcisVm)\n\t//g.DELETE(\"/:nsId/mcis/:mcisId/vm\", rest_mcis.RestDelAllMcisVm)\n\n\t//g.POST(\"/:nsId/mcis/recommend\", rest_mcis.RestPostMcisRecommend)\n\n\tg.GET(\"/:nsId/control/mcis/:mcisId\", rest_mcis.RestGetControlMcis)\n\tg.GET(\"/:nsId/control/mcis/:mcisId/vm/:vmId\", rest_mcis.RestGetControlMcisVm)\n\n\tg.POST(\"/:nsId/cmd/mcis/:mcisId\", rest_mcis.RestPostCmdMcis)\n\tg.POST(\"/:nsId/cmd/mcis/:mcisId/vm/:vmId\", rest_mcis.RestPostCmdMcisVm)\n\tg.POST(\"/:nsId/installBenchmarkAgent/mcis/:mcisId\", rest_mcis.RestPostInstallBenchmarkAgentToMcis)\n\tg.POST(\"/:nsId/benchmark/mcis/:mcisId\", rest_mcis.RestGetBenchmark)\n\tg.POST(\"/:nsId/benchmarkAll/mcis/:mcisId\", rest_mcis.RestGetAllBenchmark)\n\tg.GET(\"/:nsId/benchmarkLatency/mcis/:mcisId\", rest_mcis.RestGetBenchmarkLatency)\n\n\t//MCIS AUTO Policy\n\tg.POST(\"/:nsId/policy/mcis/:mcisId\", rest_mcis.RestPostMcisPolicy)\n\tg.GET(\"/:nsId/policy/mcis/:mcisId\", rest_mcis.RestGetMcisPolicy)\n\tg.GET(\"/:nsId/policy/mcis\", rest_mcis.RestGetAllMcisPolicy)\n\tg.PUT(\"/:nsId/policy/mcis/:mcisId\", rest_mcis.RestPutMcisPolicy)\n\tg.DELETE(\"/:nsId/policy/mcis/:mcisId\", rest_mcis.RestDelMcisPolicy)\n\tg.DELETE(\"/:nsId/policy/mcis\", rest_mcis.RestDelAllMcisPolicy)\n\n\tg.POST(\"/:nsId/monitoring/install/mcis/:mcisId\", rest_mcis.RestPostInstallMonitorAgentToMcis)\n\tg.GET(\"/:nsId/monitoring/mcis/:mcisId/metric/:metric\", rest_mcis.RestGetMonitorData)\n\tg.PUT(\"/:nsId/monitoring/status/mcis/:mcisId/vm/:vmId\", rest_mcis.RestPutMonitorAgentStatusInstalled)\n\n\t// MCIS Cloud Adaptive Network (for developer)\n\tg.POST(\"/:nsId/network/mcis/:mcisId\", rest_mcis.RestPostConfigureCloudAdaptiveNetworkToMcis)\n\tg.PUT(\"/:nsId/network/mcis/:mcisId\", rest_mcis.RestPutInjectCloudInformationForCloudAdaptiveNetwork)\n\n\t// Network Load Balancer\n\tg.POST(\"/:nsId/mcis/:mcisId/mcSwNlb\", rest_mcis.RestPostMcNLB)\n\tg.POST(\"/:nsId/mcis/:mcisId/nlb\", rest_mcis.RestPostNLB)\n\tg.GET(\"/:nsId/mcis/:mcisId/nlb/:resourceId\", rest_mcis.RestGetNLB)\n\tg.GET(\"/:nsId/mcis/:mcisId/nlb\", rest_mcis.RestGetAllNLB)\n\t// g.PUT(\"/:nsId/mcis/:mcisId/nlb/:resourceId\", rest_mcis.RestPutNLB)\n\tg.DELETE(\"/:nsId/mcis/:mcisId/nlb/:resourceId\", rest_mcis.RestDelNLB)\n\tg.DELETE(\"/:nsId/mcis/:mcisId/nlb\", rest_mcis.RestDelAllNLB)\n\tg.GET(\"/:nsId/mcis/:mcisId/nlb/:resourceId/healthz\", rest_mcis.RestGetNLBHealth)\n\n\t// VM snapshot -> creates one customImage and 'n' dataDisks\n\tg.POST(\"/:nsId/mcis/:mcisId/vm/:vmId/snapshot\", rest_mcis.RestPostMcisVmSnapshot)\n\n\t// These REST APIs are for dev/test only\n\tg.POST(\"/:nsId/mcis/:mcisId/nlb/:resourceId/vm\", rest_mcis.RestAddNLBVMs)\n\tg.DELETE(\"/:nsId/mcis/:mcisId/nlb/:resourceId/vm\", rest_mcis.RestRemoveNLBVMs)\n\n\t//MCIR Management\n\tg.POST(\"/:nsId/resources/dataDisk\", rest_mcir.RestPostDataDisk)\n\tg.GET(\"/:nsId/resources/dataDisk/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/dataDisk\", rest_mcir.RestGetAllResources)\n\tg.PUT(\"/:nsId/resources/dataDisk/:resourceId\", rest_mcir.RestPutDataDisk)\n\tg.DELETE(\"/:nsId/resources/dataDisk/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/dataDisk\", rest_mcir.RestDelAllResources)\n\tg.GET(\"/:nsId/mcis/:mcisId/vm/:vmId/dataDisk\", rest_mcir.RestGetVmDataDisk)\n\tg.PUT(\"/:nsId/mcis/:mcisId/vm/:vmId/dataDisk\", rest_mcir.RestPutVmDataDisk)\n\n\tg.POST(\"/:nsId/resources/image\", rest_mcir.RestPostImage)\n\tg.GET(\"/:nsId/resources/image/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/image\", rest_mcir.RestGetAllResources)\n\tg.PUT(\"/:nsId/resources/image/:resourceId\", rest_mcir.RestPutImage)\n\tg.DELETE(\"/:nsId/resources/image/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/image\", rest_mcir.RestDelAllResources)\n\n\tg.POST(\"/:nsId/resources/customImage\", rest_mcir.RestPostCustomImage)\n\tg.GET(\"/:nsId/resources/customImage/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/customImage\", rest_mcir.RestGetAllResources)\n\t// g.PUT(\"/:nsId/resources/customImage/:resourceId\", rest_mcir.RestPutCustomImage)\n\tg.DELETE(\"/:nsId/resources/customImage/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/customImage\", rest_mcir.RestDelAllResources)\n\n\tg.POST(\"/:nsId/resources/sshKey\", rest_mcir.RestPostSshKey)\n\tg.GET(\"/:nsId/resources/sshKey/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/sshKey\", rest_mcir.RestGetAllResources)\n\tg.PUT(\"/:nsId/resources/sshKey/:resourceId\", rest_mcir.RestPutSshKey)\n\tg.DELETE(\"/:nsId/resources/sshKey/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/sshKey\", rest_mcir.RestDelAllResources)\n\n\tg.POST(\"/:nsId/resources/spec\", rest_mcir.RestPostSpec)\n\tg.GET(\"/:nsId/resources/spec/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/spec\", rest_mcir.RestGetAllResources)\n\tg.PUT(\"/:nsId/resources/spec/:resourceId\", rest_mcir.RestPutSpec)\n\tg.DELETE(\"/:nsId/resources/spec/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/spec\", rest_mcir.RestDelAllResources)\n\n\tg.POST(\"/:nsId/resources/fetchSpecs\", rest_mcir.RestFetchSpecs)\n\tg.POST(\"/:nsId/resources/filterSpecs\", rest_mcir.RestFilterSpecs)\n\tg.POST(\"/:nsId/resources/filterSpecsByRange\", rest_mcir.RestFilterSpecsByRange)\n\tg.POST(\"/:nsId/resources/testSortSpecs\", rest_mcir.RestTestSortSpecs)\n\n\tg.POST(\"/:nsId/resources/fetchImages\", rest_mcir.RestFetchImages)\n\tg.POST(\"/:nsId/resources/searchImage\", rest_mcir.RestSearchImage)\n\n\tg.POST(\"/:nsId/resources/securityGroup\", rest_mcir.RestPostSecurityGroup)\n\tg.GET(\"/:nsId/resources/securityGroup/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/securityGroup\", rest_mcir.RestGetAllResources)\n\tg.PUT(\"/:nsId/resources/securityGroup/:resourceId\", rest_mcir.RestPutSecurityGroup)\n\tg.DELETE(\"/:nsId/resources/securityGroup/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/securityGroup\", rest_mcir.RestDelAllResources)\n\n\tg.POST(\"/:nsId/resources/securityGroup/:securityGroupId/rules\", rest_mcir.RestPostFirewallRules)\n\tg.DELETE(\"/:nsId/resources/securityGroup/:securityGroupId/rules\", rest_mcir.RestDelFirewallRules)\n\n\tg.POST(\"/:nsId/resources/vNet\", rest_mcir.RestPostVNet)\n\tg.GET(\"/:nsId/resources/vNet/:resourceId\", rest_mcir.RestGetResource)\n\tg.GET(\"/:nsId/resources/vNet\", rest_mcir.RestGetAllResources)\n\tg.PUT(\"/:nsId/resources/vNet/:resourceId\", rest_mcir.RestPutVNet)\n\tg.DELETE(\"/:nsId/resources/vNet/:resourceId\", rest_mcir.RestDelResource)\n\tg.DELETE(\"/:nsId/resources/vNet\", rest_mcir.RestDelAllResources)\n\n\tg.POST(\"/:nsId/resources/vNet/:vNetId/subnet\", rest_mcir.RestPostSubnet)\n\t// g.GET(\"/:nsId/resources/vNet/:vNetId/subnet/:subnetId\", rest_mcir.RestGetSubnet)\n\t// g.GET(\"/:nsId/resources/vNet/:vNetId/subnet\", rest_mcir.RestGetAllSubnet)\n\t// g.PUT(\"/:nsId/resources/vNet/:vNetId/subnet/:subnetId\", rest_mcir.RestPutSubnet)\n\tg.DELETE(\"/:nsId/resources/vNet/:parentResourceId/subnet/:childResourceId\", rest_mcir.RestDelChildResource)\n\t// g.DELETE(\"/:nsId/resources/vNet/:vNetId/subnet\", rest_mcir.RestDelAllSubnet)\n\n\t/*\n\t\tg.POST(\"/:nsId/resources/publicIp\", mcir.RestPostPublicIp)\n\t\tg.GET(\"/:nsId/resources/publicIp/:publicIpId\", mcir.RestGetPublicIp)\n\t\tg.GET(\"/:nsId/resources/publicIp\", mcir.RestGetAllPublicIp)\n\t\tg.PUT(\"/:nsId/resources/publicIp/:publicIpId\", mcir.RestPutPublicIp)\n\t\tg.DELETE(\"/:nsId/resources/publicIp/:publicIpId\", mcir.RestDelPublicIp)\n\t\tg.DELETE(\"/:nsId/resources/publicIp\", mcir.RestDelAllPublicIp)\n\n\t\tg.POST(\"/:nsId/resources/vNic\", mcir.RestPostVNic)\n\t\tg.GET(\"/:nsId/resources/vNic/:vNicId\", mcir.RestGetVNic)\n\t\tg.GET(\"/:nsId/resources/vNic\", mcir.RestGetAllVNic)\n\t\tg.PUT(\"/:nsId/resources/vNic/:vNicId\", mcir.RestPutVNic)\n\t\tg.DELETE(\"/:nsId/resources/vNic/:vNicId\", mcir.RestDelVNic)\n\t\tg.DELETE(\"/:nsId/resources/vNic\", mcir.RestDelAllVNic)\n\t*/\n\n\t// We cannot use these wildcard method below.\n\t// https://github.com/labstack/echo/issues/382\n\t//g.DELETE(\"/:nsId/resources/:resourceType/:resourceId\", mcir.RestDelResource)\n\t//g.DELETE(\"/:nsId/resources/:resourceType\", mcir.RestDelAllResources)\n\n\tg.GET(\"/:nsId/checkResource/:resourceType/:resourceId\", rest_mcir.RestCheckResource)\n\tg.GET(\"/:nsId/checkMcis/:mcisId\", rest_mcis.RestCheckMcis)\n\tg.GET(\"/:nsId/mcis/:mcisId/checkVm/:vmId\", rest_mcis.RestCheckVm)\n\n\t// g.POST(\"/:nsId/registerExistingResources\", rest_mcir.RestRegisterExistingResources)\n\n\t// Temporal test API for development of UpdateAssociatedObjectList\n\tg.PUT(\"/:nsId/testAddObjectAssociation/:resourceType/:resourceId\", rest_mcir.RestTestAddObjectAssociation)\n\tg.PUT(\"/:nsId/testDeleteObjectAssociation/:resourceType/:resourceId\", rest_mcir.RestTestDeleteObjectAssociation)\n\tg.GET(\"/:nsId/testGetAssociatedObjectCount/:resourceType/:resourceId\", rest_mcir.RestTestGetAssociatedObjectCount)\n\n\tselfEndpoint := os.Getenv(\"SELF_ENDPOINT\")\n\tapidashboard := \" http://\" + selfEndpoint + \"/tumblebug/swagger/index.html\"\n\n\tfmt.Println(\" Access to API dashboard\" + \" (username: \" + API_USERNAME + \" / password: \" + API_PASSWORD + \")\")\n\tfmt.Printf(noticeColor, apidashboard)\n\tfmt.Println(\"\\n \")\n\n\t// A context for graceful shutdown (It is based on the signal package)\n\t// NOTE -\n\t// Use os.Interrupt Ctrl+C or Ctrl+Break on Windows\n\t// Use syscall.KILL for Kill(can't be caught or ignored) (POSIX)\n\t// Use syscall.SIGTERM for Termination (ANSI)\n\t// Use syscall.SIGINT for Terminal interrupt (ANSI)\n\t// Use syscall.SIGQUIT for Terminal quit (POSIX)\n\tgracefulShutdownContext, stop := signal.NotifyContext(context.TODO(),\n\t\tos.Interrupt, syscall.SIGKILL, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT)\n\tdefer stop()\n\n\t// Wait graceful shutdown (and then main thread will be finished)\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func(wg *sync.WaitGroup) {\n\t\tdefer wg.Done()\n\n\t\t// Block until a signal is triggered\n\t\t<-gracefulShutdownContext.Done()\n\n\t\tfmt.Println(\"\\n[Stop] CB-Tumblebug REST Server\")\n\t\tctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := e.Shutdown(ctx); err != nil {\n\t\t\te.Logger.Panic(err)\n\t\t}\n\t}(&wg)\n\n\tport = fmt.Sprintf(\":%s\", port)\n\tif err := e.Start(port); err != nil && err != http.ErrServerClosed {\n\t\te.Logger.Panic(\"shuttig down the server\")\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "09f5c75c3274a75168df63eca09d83d9", "score": "0.69061136", "text": "func main() {\n\tapp.Run(\":8080\")\n}", "title": "" }, { "docid": "54ef2bcc50d36447b76a7ff56da87f8f", "score": "0.6897421", "text": "func main() {\n\tconfiguration, err := config.Parse()\n\tgrpcClient := grpc.CreateFromConfiguration(configuration)\n\tdependencies := application.InitDependencies(grpcClient)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tserver := http.NewServer(configuration.HTTPServer, dependencies)\n\tserver.Start()\n}", "title": "" }, { "docid": "25cee43e6ed3e3339a2c5477ea992f60", "score": "0.68672186", "text": "func runWebServer(p uint) {\n\twFlags.Parse(os.Args[2:])\n\tweb.Run(p)\n}", "title": "" }, { "docid": "2135e4401840696f8eb0ca076684be4c", "score": "0.68565476", "text": "func Run() {\n\tlogger.NewLogger()\n\tr := mux.NewRouter()\n\n\tfs := http.FileServer(http.Dir(\"./docs/swaggerui/\"))\n\tr.PathPrefix(\"/docs\").\n\t\tSubrouter().\n\t\tStrictSlash(true).\n\t\t// Path(\"/\").\n\t\tQueries().\n\t\tHandler(http.StripPrefix(\"/docs/\", fs))\n\n\trouters.AddUserRoutes(r)\n\trouters.AddThreadRoutes(r)\n\trouters.AddPostRoutes(r)\n\n\twriteTimeout, _ := strconv.Atoi(os.Getenv(\"WRITE_TIMEOUT_SEC\"))\n\treadTimeout, _ := strconv.Atoi(os.Getenv(\"READ_TIMEOUT_SEC\"))\n\n\tserver := &http.Server{\n\t\tHandler: r,\n\t\tAddr: fmt.Sprintf(\"localhost:%s\", os.Getenv(\"API_PORT\")),\n\t\tWriteTimeout: time.Duration(writeTimeout) * time.Second,\n\t\tReadTimeout: time.Duration(readTimeout) * time.Second,\n\t}\n\n\tfmt.Printf(\"Start server at localhost:%s!\\n\", os.Getenv(\"API_PORT\"))\n\tlog.Fatalln(server.ListenAndServe())\n}", "title": "" }, { "docid": "29c0e26bdd3ea4f6835d5df57b722457", "score": "0.68554443", "text": "func (s *Rest) Run(ctx context.Context) error {\n\trouter := s.routes()\n\n\ts.httpServer = &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", s.Port),\n\t\tHandler: router,\n\t\tReadHeaderTimeout: 60 * time.Second,\n\t\tWriteTimeout: 60 * time.Second,\n\t\tIdleTimeout: 120 * time.Second,\n\t}\n\n\tlog.Printf(\"rest server started on port %d\", s.Port)\n\n\ts.Ready.Store(true)\n\tif err := s.httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "992e67ba45403b788fa535be121a14db", "score": "0.6819916", "text": "func RunServer() {\n\trouter := httprouter.New()\n\trouter.OPTIONS(\"/api/v1\", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"*\")\n\t\tw.Write([]byte(\"nice\"))\n\t})\n\trouter.PUT(\"/api/v1\", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"*\")\n\t\tvar body requestRun\n\t\tjson.NewDecoder(r.Body).Decode(&body)\n\t\toutput := runtime.Parse(body.Code)\n\t\toutput.Print()\n\t\tres := map[string]interface{}{\"data\": output, \"status\": 200}\n\t\tw.WriteHeader(200)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tbytes, _ := json.Marshal(&res)\n\n\t\tw.Write(bytes)\n\t})\n\n\trouter.ServeFiles(\"/*filepath\", http.Dir(\"/\"))\n\tport := \":\" + os.Getenv(\"PORT\")\n\tif port == \":\" {\n\t\tport = \":8080\"\n\t}\n\terr := http.ListenAndServe(port, router)\n\tpanic(err)\n}", "title": "" }, { "docid": "3ac72305a317f9163c64fe00099e39f6", "score": "0.67979187", "text": "func (api *API) Run(ctx context.Context) error {\n\taddr := net.JoinHostPort(api.config.Hostname, strconv.Itoa(api.config.Port))\n\n\tapiHTTP := api.handler()\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/\", apiHTTP)\n\tmux.Handle(\"/swagger/swagger.json\", apiHTTP)\n\n\tif api.config.Swagger {\n\t\tmux.Handle(\"/swagger/\", http.FileServer(http.FS(docs.SwaggerContent)))\n\t}\n\n\tsrv := &http.Server{Addr: addr, Handler: mux}\n\n\terrCh := make(chan error)\n\tgo func() {\n\t\tlog.Infof(\"Server listening on %q\", addr)\n\t\terrCh <- srv.ListenAndServe()\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\tlog.Infof(\"Shutting down server at %q\", addr)\n\tcase err := <-errCh:\n\t\treturn err\n\t}\n\n\t// Shutdown gracefully with a 30s timeout.\n\tctx, cancel := context.WithTimeout(context.Background(), api.shutdownTimeout)\n\tdefer cancel()\n\n\terr := srv.Shutdown(ctx)\n\treturn err\n}", "title": "" }, { "docid": "626c381366e876cb6db36ef875aa8218", "score": "0.6793674", "text": "func (s *ArgoRolloutsServer) Run(ctx context.Context, port int, dashboard bool) {\n\thttpServer := s.newHTTPServer(ctx, port)\n\tgrpcServer := s.newGRPCServer()\n\n\t// Start listener\n\tvar conn net.Listener\n\tvar realErr error\n\t_ = wait.ExponentialBackoff(backoff, func() (bool, error) {\n\t\tconn, realErr = net.Listen(\"tcp\", fmt.Sprintf(\":%d\", port))\n\t\tif realErr != nil {\n\t\t\tlog.Warnf(\"failed listen: %v\", realErr)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\terrors.CheckError(realErr)\n\n\tstartupMessage := fmt.Sprintf(\"Argo Rollouts api-server serving on port %d (namespace: %s)\", port, s.Options.Namespace)\n\tif dashboard {\n\t\tstartupMessage = fmt.Sprintf(\"Argo Rollouts Dashboard is now available at http://localhost:%d/%s\", port, s.Options.RootPath)\n\t}\n\n\tlog.Info(startupMessage)\n\n\ttcpm := cmux.New(conn)\n\n\thttpL := tcpm.Match(cmux.HTTP1Fast())\n\tgrpcL := tcpm.Match(cmux.Any())\n\n\tgo func() {\n\t\ts.checkServeErr(\"httpServer\", httpServer.Serve(httpL))\n\t}()\n\tgo func() {\n\t\ts.checkServeErr(\"grpcServer\", grpcServer.Serve(grpcL))\n\t}()\n\tgo func() { s.checkServeErr(\"tcpm\", tcpm.Serve()) }()\n\n\ts.stopCh = make(chan struct{})\n\t<-s.stopCh\n\terrors.CheckError(conn.Close())\n}", "title": "" }, { "docid": "ca57b17b11a0fcc2f009e334227ea868", "score": "0.679206", "text": "func main() {\n\t// prebuildChecks()\n\trouter := mux.NewRouter().StrictSlash(true)\n\tsub := router.PathPrefix(\"/api/v1\").Subrouter()\n\tsub.Methods(\"POST\").Path(\"/generate\").HandlerFunc(controllers.GenerateDeploy)\n\tlog.Println(\"starting server on \", PORT)\n\taddr := fmt.Sprintf(\":%d\", PORT)\n\tlog.Fatal(http.ListenAndServe(addr, router))\n}", "title": "" }, { "docid": "7e45cdfe776a5b2eeb1252b12a8dbb38", "score": "0.6790252", "text": "func Run() {\n\n\tconfigYamlPath := os.Getenv(\"configYaml\")\n\tif configYamlPath == \"\" {\n\t\tconfigYamlPath = \"/downloads/config.yaml\"\n\t}\n\n\tdownloadDirectory := os.Getenv(\"downloadDir\")\n\tif downloadDirectory == \"\" {\n\t\tdownloadDirectory = \"/downloads/\"\n\t}\n\tport := os.Getenv(\"port\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t} else if port == \"80\" {\n\t\tport = \"\"\n\t}\n\n\trouter := mux.NewRouter()\n\n\trouter.PathPrefix(\"/public/\").Handler(http.StripPrefix(\"/public/\", http.FileServer(http.Dir(\"frontend/\"))))\n\trouter.PathPrefix(\"/downloads/\").Handler(http.StripPrefix(\"/downloads/\", http.FileServer(http.Dir(downloadDirectory+\"/\"))))\n\tServeAllPodcasts(router, configYamlPath, downloadDirectory+\"/\", port)\n\tServePodcastInfo(router, configYamlPath)\n\trouter.HandleFunc(\"/ping\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"pong\")\n\t})\n\n\trouter.PathPrefix(\"/downloads/\").Handler(http.StripPrefix(\"/downloads/\", http.FileServer(http.Dir(downloadDirectory+\"/\"))))\n\trouter.PathPrefix(\"/public/\").Handler(http.StripPrefix(\"/public/\", http.FileServer(http.Dir(\"./frontend/\"))))\n\t//router.PathPrefix(\"/\").Handler(http.FileServer(http.Dir(\"./frontend\")))\n\n\tserver := &http.Server{\n\t\tHandler: router,\n\t\tAddr: \":\" + \"8080\",\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\tfmt.Println(\"Router running at Port \" + port)\n\tlog.Fatal(server.ListenAndServe())\n}", "title": "" }, { "docid": "476e5d098eceae7625c611ad6cdab994", "score": "0.6779899", "text": "func (r *Rest) Run(port int) {\n\n\tr.httpServer = &http.Server{\n\t\tHandler: r.routes(),\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\t// Good practice: enforce timeouts for servers you create!\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\tlog.Fatal(r.httpServer.ListenAndServe())\n}", "title": "" }, { "docid": "4365f7697dc3c905af2ea67e57b58c1d", "score": "0.67765915", "text": "func RunServer(ctx context.Context, grpcPort, httpPort, SwaggerDir string) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tgwmux := runtime.NewServeMux()\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\tif err := v1.RegisterToDoServiceHandlerFromEndpoint(ctx, gwmux, \"localhost:\"+grpcPort, opts); err != nil {\n\t\tlogger.Log.Fatal(\"failed to start HTTP gateway\", zap.String(\"reason\", err.Error()))\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/\", gwmux)\n\tmux.HandleFunc(\"/swagger/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif !strings.HasSuffix(r.URL.Path, \"swagger.json\") {\n\t\t\tlogger.Log.Fatal(\"fail to serve swagger.json\", zap.String(\"Not Found:\", r.URL.Path))\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\tp := strings.TrimPrefix(r.URL.Path, \"/swagger/\")\n\t\tp = path.Join(SwaggerDir, p)\n\n\t\tlogger.Log.Info(\"Serving swagger-file:\", zap.String(p, \"\"))\n\n\t\thttp.ServeFile(w, r, p)\n\t})\n\tserveSwaggerUI(mux)\n\n\tsrv := &http.Server{\n\t\tAddr: \":\" + httpPort,\n\t\tHandler: middleware.AddRequestID(middleware.AddLogger(logger.Log, mux)),\n\t}\n\n\t// graceful shutdown\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func() {\n\t\tfor range c {\n\t\t\t// sig is a ^C, handle it\n\t\t}\n\n\t\t_, cancel := context.WithTimeout(ctx, 5*time.Second)\n\t\tdefer cancel()\n\n\t\t_ = srv.Shutdown(ctx)\n\t}()\n\n\tlogger.Log.Info(\"starting HTTP/REST gateway...\")\n\treturn srv.ListenAndServe()\n}", "title": "" }, { "docid": "7c67e9f164e3eb2b89cd3ff5768e22c7", "score": "0.6753785", "text": "func main() {\n\tweb.NewApplication().\n\t\tSetProperty(app.ProfilesInclude, actuator.Profile, logging.Profile, swagger.Profile).\n\t\tSetProperty(app.Version, version).\n\t\tSetProperty(server.Host, \"localhost\").\n\t\tSetProperty(server.Port, \"8080\").\n\t\tSetProperty(server.ContextPath, basePath).\n\t\tRun()\n}", "title": "" }, { "docid": "4b0215d046970fbba57b0f0cf0bcff2e", "score": "0.6734796", "text": "func main() {\n\tDefaultContainer.Router(CurlyRouter{})\n\tws := new(WebService)\n\tws.Route(ws.GET(\"/basepath/{resource:*}\").To(staticFromPathParam))\n\tAdd(ws)\n\n\tprintln(\"[go-restful] serve path tails from http://localhost:8080/basepath\")\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "34fb38b62b4a8e3d87051e10d63a4b4c", "score": "0.6727203", "text": "func serveWeb() {\n\ttime.Sleep(time.Millisecond * 10)\n\thttp.HandleFunc(\"/\", home)\n\tlog.Fatalln(http.ListenAndServe(\":8000\", nil))\n\tsyn.Done()\n}", "title": "" }, { "docid": "78f067ffa31c436a2cdad81aa98c8c5a", "score": "0.6722587", "text": "func Run(cfg *config.Config) {\n\tlogger := initLogger()\n\tif cfg == nil {\n\t\tlogger.Fatalf(\"config is not defined\")\n\t}\n\thb := api.New()\n\tfor _, c := range cfg.Checks {\n\t\thb.AddCheck(c.Name, c.URL)\n\t}\n\tgo hb.Run(cfg.Duration)\n\ts := &Server{\n\t\tcheck: hb,\n\t\tlogger: logger,\n\t}\n\tr := mux.NewRouter()\n\tr.HandleFunc(apiPrefix+\"/status\", s.report)\n\tr.HandleFunc(apiPrefix+\"/checks\", s.addHealthCheck).Methods(\"POST\")\n\tlogger.Infof(\"server is started to %s\", cfg.Address)\n\tlogger.Fatal(http.ListenAndServe(cfg.Address, r))\n}", "title": "" }, { "docid": "fe6588633cfa838668d4c0f1dcd7cba1", "score": "0.671819", "text": "func main() {\n\te := echo.New()\n\n\t//Post/Rank\n\te.POST(\"/api/post/rank\", endpoint.PostRank)\n\n\t//Get/Rank\n\te.GET(\"/api/get/rank\", endpoint.GetRank)\n\n\te.Logger.Fatal(e.Start(\":\" + os.Getenv(\"PORT\")))\n}", "title": "" }, { "docid": "a62650850606b00608d86aaa727b7f2a", "score": "0.6707437", "text": "func (s *Server) Run() error {\n\tc := cors.New(cors.Options{\n\t\tAllowedHeaders: []string{\"*\"},\n\t\tAllowedOrigins: []string{\"*\"},\n\t\tAllowCredentials: true,\n\t})\n\n\thandler := c.Handler(s.router)\n\n\tlog.Printf(\"API server listening on %s\", s.cfg.ListenAddress)\n\n\ts.TeslaOwnerTokenRefresh()\n\n\treturn http.ListenAndServe(s.cfg.ListenAddress, handlers.LoggingHandler(os.Stdout, handler))\n}", "title": "" }, { "docid": "fc7612c5276c78205bef56e93dff6a50", "score": "0.670693", "text": "func (s *SimpleWebServer) Run(addr string) error {\n\n\tmux := http.NewServeMux()\n\n\tmux.Handle(\"/\", s.router)\n\n\t// http.Handle(\"/\", s.router)\n\terr := http.ListenAndServe(addr, mux)\n\treturn err\n}", "title": "" }, { "docid": "b9284b4f60b22fb57a7a612b100f3d81", "score": "0.6701732", "text": "func main() {\n\tflag.Parse()\n\n\tctx := context.Background()\n\tsrv, cleanup, err := httpsrv.SetupLocal(ctx)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to setup the server, got error: %s\", err)\n\t}\n\tdefer cleanup()\n\n\t// Listen and serve HTTP.\n\tif p := os.Getenv(\"PORT\"); p != \"\" {\n\t\tport = p\n\t}\n\n\tlog.Printf(\"starting server listening at :%s ...\", port)\n\tlog.Fatal(srv.ListenAndServe(\":\" + port))\n}", "title": "" }, { "docid": "bd13e1f0ebba33cb8c79f995dd53d5ec", "score": "0.66890556", "text": "func Run(manager *sockets.ClientManager) {\n\trouter := getRouter(manager)\n\ts := &http.Server{\n\t\tAddr: \"0.0.0.0:8080\",\n\t\tHandler: router,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\ts.ListenAndServe()\n}", "title": "" }, { "docid": "b07f83bf7b71fddbb27526b30d4daf5e", "score": "0.6685934", "text": "func Run(addr string) error {\n\tlog.Default()\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", rootHandler)\n\tmux.HandleFunc(\"/start\", startHandler)\n\tmux.HandleFunc(\"/move\", moveHandler)\n\tmux.HandleFunc(\"/end\", endHandler)\n\n\tlog.Printf(\"Listen on: %s\", addr)\n\tif err := http.ListenAndServe(addr, mux); err != http.ErrServerClosed {\n\t\treturn fmt.Errorf(\"running webserver: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7336daebe850635191eada2e2c4ff66b", "score": "0.66692454", "text": "func (server *Server) Run() {\n\t// start router\n\tr := mux.NewRouter()\n\n\t// serve static files\n\tr.PathPrefix(\"/static/\").Handler(http.StripPrefix(\"/static/\", http.FileServer(http.Dir(server.Config.StaticFiles))))\n\n\trg := r.Methods(\"GET\").Subrouter()\n\n\trg.HandleFunc(\"/\", server.indexHandler)\n\trg.HandleFunc(\"/login\", server.loginHandler)\n\n\t// rg := r.Methods(\"GET\").Subrouter()\n\t// rg.HandleFunc(\"/info\", restInfo)\n\t// rg.HandleFunc(\"/status\", restStatus)\n\t// rg.HandleFunc(\"/xlines\", restGetXLines)\n\t// rg.HandleFunc(\"/accounts\", restGetAccounts)\n\n\t// PUT methods\n\t// rp := r.Methods(\"POST\").Subrouter()\n\t// rp.HandleFunc(\"/rehash\", restRehash)\n\n\t// make waitgroup\n\tvar wg sync.WaitGroup\n\n\t// start listeners\n\tfor _, addr := range server.Config.Listeners {\n\t\t// mark us as existing\n\t\twg.Add(1)\n\n\t\tgo func(address string, tlsConfig *TLSListenConfig) {\n\t\t\tif tlsConfig != nil {\n\t\t\t\tfmt.Println(\"Listening with HTTPS on\", address)\n\t\t\t\thttp.ListenAndServeTLS(address, tlsConfig.Cert, tlsConfig.Key, r)\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Listening on\", address)\n\t\t\t\thttp.ListenAndServe(address, r)\n\t\t\t}\n\n\t\t\t// mark this listener as done\n\t\t\twg.Done()\n\t\t}(addr, server.Config.TLSListenersInfo[addr])\n\t}\n\n\t// wait for all listeners to be done before exiting\n\twg.Wait()\n}", "title": "" }, { "docid": "d2c6183ad525ae718709ffeff3136d8a", "score": "0.6662701", "text": "func main() {\n\tvar aHandler uberHandler\n\thttp.ListenAndServe(\":8080\", aHandler)\n}", "title": "" }, { "docid": "c3a8e81416bce6fc0f3cab6e750eb5d1", "score": "0.66587096", "text": "func main() {\n\th := &handler{}\n\tp := \":8600\"\n\tdone := make(chan bool)\n\n\tgo func() {\n\t\tlog.Fatal(http.ListenAndServe(p, h))\n\t\tdone <- true\n\t}()\n\n\tlog.Printf(\"now listening on port %v\", p)\n\tlog.Println(\"try running:\")\n\tlog.Printf(\"curl -i \\\"http://localhost%s/bork?seed=cat\\\"\", p)\n\tlog.Printf(\"use seeds 'cat' and 'cate' for errors, anything else for success\")\n\t<-done\n}", "title": "" }, { "docid": "b24b31b96378dd8f97f2c95411ddbdf7", "score": "0.665814", "text": "func Run(port string) {\n\tlog.Fatal(http.ListenAndServe(\":\"+port, nil))\n}", "title": "" }, { "docid": "911217854e0536c704004805465b5e2b", "score": "0.66471857", "text": "func run() error {\n\tmux := makeMuxRouter()\n\thttpAddr := os.Getenv(\"ADDR\")\n\tlog.Println(\"Listening on: \", httpAddr)\n\ts := &http.Server{\n\t\tAddr: \":\" + httpAddr,\n\t\tHandler: mux,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\n\t// Start the listener and error out if a problem\n\tif err := s.ListenAndServe(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17e13728a5a78da8a70c607491051389", "score": "0.6642022", "text": "func Run(port string) error {\n\te := echo.New()\n\n\te.HideBanner = true\n\te.Debug = true\n\n\thandler := handler.New()\n\n\tapi := e.Group(\"/api\")\n\tapi.GET(\"/add\", handler.Add)\n\tapi.GET(\"/sub\", handler.Sub)\n\tapi.GET(\"/mul\", handler.Mul)\n\tapi.GET(\"/div\", handler.Div)\n\n\treturn e.Start(fmt.Sprintf(\":%s\", port))\n}", "title": "" }, { "docid": "d5c6141cc8398856c63c7002d789f3e9", "score": "0.6636572", "text": "func (h *Http) Run(ctx context.Context) error {\n\n\tif h.AssetsLocation != \"\" {\n\t\tlog.Printf(\"[DEBUG] assets file server enabled for %s, webroot %s\", h.AssetsLocation, h.AssetsWebRoot)\n\t}\n\n\tvar httpServer, httpsServer *http.Server\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tif httpServer != nil {\n\t\t\tif err := httpServer.Close(); err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] failed to close proxy http server, %v\", err)\n\t\t\t}\n\t\t}\n\t\tif httpsServer != nil {\n\t\t\tif err := httpsServer.Close(); err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] failed to close proxy https server, %v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\thandler := R.Wrap(h.proxyHandler(),\n\t\tR.Recoverer(log.Default()),\n\t\th.signatureHandler(),\n\t\th.pingHandler,\n\t\th.healthMiddleware,\n\t\th.mgmtHandler(),\n\t\th.headersHandler(h.ProxyHeaders),\n\t\th.accessLogHandler(h.AccessLog),\n\t\th.stdoutLogHandler(h.StdOutEnabled, logger.New(logger.Log(log.Default()), logger.Prefix(\"[INFO]\")).Handler),\n\t\th.maxReqSizeHandler(h.MaxBodySize),\n\t\th.gzipHandler(),\n\t)\n\n\trand.Seed(time.Now().UnixNano())\n\n\tif len(h.SSLConfig.FQDNs) == 0 && h.SSLConfig.SSLMode == SSLAuto {\n\t\t// discovery async and may happen not right away. Try to get servers for some time\n\t\tfor i := 0; i < 100; i++ {\n\t\t\th.SSLConfig.FQDNs = h.Servers() // fill all discovered if nothing defined\n\t\t\tif len(h.SSLConfig.FQDNs) > 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(50 * time.Millisecond)\n\t\t}\n\t}\n\n\tswitch h.SSLConfig.SSLMode {\n\tcase SSLNone:\n\t\tlog.Printf(\"[INFO] activate http proxy server on %s\", h.Address)\n\t\thttpServer = h.makeHTTPServer(h.Address, handler)\n\t\thttpServer.ErrorLog = log.ToStdLogger(log.Default(), \"WARN\")\n\t\treturn httpServer.ListenAndServe()\n\tcase SSLStatic:\n\t\tlog.Printf(\"[INFO] activate https server in 'static' mode on %s\", h.Address)\n\n\t\thttpsServer = h.makeHTTPSServer(h.Address, handler)\n\t\thttpsServer.ErrorLog = log.ToStdLogger(log.Default(), \"WARN\")\n\n\t\thttpServer = h.makeHTTPServer(h.toHTTP(h.Address, h.SSLConfig.RedirHTTPPort), h.httpToHTTPSRouter())\n\t\thttpServer.ErrorLog = log.ToStdLogger(log.Default(), \"WARN\")\n\n\t\tgo func() {\n\t\t\tlog.Printf(\"[INFO] activate http redirect server on %s\", h.toHTTP(h.Address, h.SSLConfig.RedirHTTPPort))\n\t\t\terr := httpServer.ListenAndServe()\n\t\t\tlog.Printf(\"[WARN] http redirect server terminated, %s\", err)\n\t\t}()\n\t\treturn httpsServer.ListenAndServeTLS(h.SSLConfig.Cert, h.SSLConfig.Key)\n\tcase SSLAuto:\n\t\tlog.Printf(\"[INFO] activate https server in 'auto' mode on %s\", h.Address)\n\t\tlog.Printf(\"[DEBUG] FQDNs %v\", h.SSLConfig.FQDNs)\n\n\t\tm := h.makeAutocertManager()\n\t\thttpsServer = h.makeHTTPSAutocertServer(h.Address, handler, m)\n\t\thttpsServer.ErrorLog = log.ToStdLogger(log.Default(), \"WARN\")\n\n\t\thttpServer = h.makeHTTPServer(h.toHTTP(h.Address, h.SSLConfig.RedirHTTPPort), h.httpChallengeRouter(m))\n\t\thttpServer.ErrorLog = log.ToStdLogger(log.Default(), \"WARN\")\n\n\t\tgo func() {\n\t\t\tlog.Printf(\"[INFO] activate http challenge server on port %s\", h.toHTTP(h.Address, h.SSLConfig.RedirHTTPPort))\n\t\t\terr := httpServer.ListenAndServe()\n\t\t\tlog.Printf(\"[WARN] http challenge server terminated, %s\", err)\n\t\t}()\n\n\t\treturn httpsServer.ListenAndServeTLS(\"\", \"\")\n\t}\n\treturn fmt.Errorf(\"unknown SSL type %v\", h.SSLConfig.SSLMode)\n}", "title": "" }, { "docid": "b25f0e24b6ac581443f098816c8912ab", "score": "0.6630659", "text": "func SetupAndServe(port int, targetBinary types.TargetBinary, fuzzerConfig types.FuzzerConfig, archiveConfig types.ArchiveConfig, metricsReportInterval time.Duration, workdir string) {\n\tvar err error\n\ttarget = targetBinary\n\n\tfuzzerConf = fuzzerConfig\n\tarchiveConf = archiveConfig\n\tfileManager = &types.FleetFileManager{Basedir: workdir}\n\tnodes = newNodes()\n\n\treaper := newReaper(nodes, 1*time.Hour)\n\tgo reaper.run()\n\n\tif metricsReportInterval > 0 {\n\t\tmetricsPoller := MetricsPoller{\n\t\t\tNodes: &nodes,\n\t\t\tInterval: metricsReportInterval,\n\t\t}\n\t\tgo metricsPoller.run()\n\t}\n\n\tif archiveConf.Type != \"\" {\n\t\tswitch archiveConf.Type {\n\t\tcase \"disk\":\n\t\t\tarchiver, err = NewDiskArchiver(archiveConf)\n\t\tcase \"s3\":\n\t\t\tarchiver, err = NewS3Archiver(archiveConf)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Unknown archiver type: %s\", archiveConf.Type)\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tgo ArchiveToTimestampedDirsForever(archiver, fileManager.Basedir, archiveConf.Interval)\n\t} else {\n\t\tarchiver = NullArchiver{}\n\t}\n\n\ttrace.Service = \"roving-srv\"\n\tssf.NamePrefix = \"roving-srv.\"\n\n\tmux := goji.NewMux()\n\n\tif fuzzerConfig.UseDict {\n\t\tlog.Printf(\"Reading dict...\")\n\n\t\tdict, err = fileManager.ReadDict()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tif len(dict) == 0 {\n\t\t\tlog.Fatalf(\"Failed to read dict - dict was empty! path=%s!\", fileManager.DictPath())\n\t\t}\n\t\tlog.Printf(\"Successfully read dict bytes=%d\", len(dict))\n\t}\n\n\t// Admin browser endpoints\n\tmux.HandleFunc(pat.Get(\"/\"), adminIndex)\n\tmux.HandleFunc(pat.Get(\"/admin\"), adminIndex)\n\tmux.HandleFunc(pat.Get(\"/admin/archive\"), adminArchive)\n\tmux.HandleFunc(pat.Get(\"/admin/fuzzer/:fuzzerId/input/:type/:name\"), adminInput)\n\tmux.HandleFunc(pat.Get(\"/admin/output\"), adminOutput)\n\t// Client endpoints\n\tmux.HandleFunc(pat.Post(\"/state\"), postState)\n\tmux.HandleFunc(pat.Get(\"/queue\"), getQueues)\n\tmux.HandleFunc(pat.Get(\"/config\"), getConfig)\n\tmux.HandleFunc(pat.Get(\"/target/binary\"), getTargetBinary)\n\tmux.HandleFunc(pat.Get(\"/inputs\"), getInputs)\n\tmux.HandleFunc(pat.Get(\"/dict\"), getDict)\n\n\tlog.Printf(\"Starting Roving server on port %d...\", port)\n\n\thttp.ListenAndServe(fmt.Sprintf(\":%d\", port), mux)\n}", "title": "" }, { "docid": "e31524668181f5edf06300e1664a1e23", "score": "0.6624156", "text": "func Run() {\n\taddr := fmt.Sprintf(\":%s\", port)\n\tlog.Printf(\"Now listening on %s...\\n\", addr)\n\tlog.Fatal(http.ListenAndServe(addr, handlers()))\n}", "title": "" }, { "docid": "be5d4a28de006aee7a16078e3bbcc693", "score": "0.6624155", "text": "func runServer(\n\trouter *mux.Router,\n\tsws *SocketWorkSubscriber,\n\tport int,\n) {\n\thttp.Handle(\"/socket.io/\", sws.server) // Mount the socket.io server\n\thttp.Handle(\"/static/\", http.FileServer(http.Dir(\"./\")))\n\thttp.Handle(\"/api/\", router)\n\thttp.HandleFunc(\"/\", IndexHandler) // Mount the lone template server\n\n\tportStr := fmt.Sprintf(\":%d\", port)\n\tfmt.Println(fmt.Sprintf(\"Listening on localhost:%d\", port))\n\tlog.Fatal(http.ListenAndServe(portStr, nil))\n}", "title": "" }, { "docid": "66e61838bf783dd4081a1aef8ef940b2", "score": "0.662407", "text": "func (s *Server) Run(host, port string) error {\n\thttp.HandleFunc(\"/current\", s.CurrentTemperatureAndHumidity)\n\thttp.HandleFunc(\"/histories\", s.TemperatureAndHumidityHistories)\n\taddr := net.JoinHostPort(host, port)\n\tif err := http.ListenAndServe(addr, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8cbd814ab97a9a0318587a896cb427c", "score": "0.6622686", "text": "func (a *App) Run(addr string) {\r\n\tlog.Fatal(http.ListenAndServe(addr, handlers.CORS(handlers.AllowedHeaders([]string{\"X-Requested-With\", \"Content-Type\", \"Authorization\"}), handlers.AllowedMethods([]string{\"GET\", \"POST\", \"DELETE\", \"PUT\", \"HEAD\", \"OPTIONS\"}), handlers.AllowedOrigins([]string{\"*\"}))(a.Router)))\r\n}", "title": "" }, { "docid": "a6a675963f9d7b567d9de26dcc9c99ec", "score": "0.66170996", "text": "func main() {\n\tportal := goddPortal.New()\n\tportal.AppendApp(appMain(), \":8081\")\n\tportal.StartServer()\n}", "title": "" }, { "docid": "1ca125df551ad38378b470c298d2c996", "score": "0.6614924", "text": "func (a *App) Run(addr string) {\n\tfmt.Println(\"HTTP server is running on port :8080\")\n\tlog.Fatal(http.ListenAndServe(addr, a.Router))\n}", "title": "" }, { "docid": "add81d9df1c89e157266ebbbdf7efff0", "score": "0.6610537", "text": "func Run() error {\n\thttp.HandleFunc(\"/\", router)\n\treturn http.ListenAndServe(config.ListenVars.Address+\":\"+config.ListenVars.Port, nil)\n}", "title": "" }, { "docid": "e2d38df668055c1b9fe59698dc99d259", "score": "0.6609732", "text": "func (a *App) Run() {\n\tsrv := &http.Server{\n\t\tHandler: a.router,\n\t\tAddr: \":9000\",\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\tlog.Fatal(srv.ListenAndServe())\n}", "title": "" }, { "docid": "2b1ca76fea522b9db9164d9371ae3163", "score": "0.6606349", "text": "func (as *AdminServer) Run() error {\n\n\tas.setupRoutes()\n http.ListenAndServe(\":8080\", nil)\n\n\treturn nil\n}", "title": "" }, { "docid": "d3f3660ecf863b33f4deddbf454a0a1a", "score": "0.6604573", "text": "func main() {\n\t// HandleFunc tells HTTP package to handle all requests to the webroot with\n\t// our hello function\n\t// http.HandleFunc(\"/\", hello)\n\t// fmt.Println(\"Server started\")\n\t// log.Fatal(http.ListenAndServe(\":8080\", nil))\n\tapi.Run()\n}", "title": "" }, { "docid": "57426c83c8dd1748a336b49728c0a55b", "score": "0.660247", "text": "func Run(\n\tctx context.Context,\n\taddr string,\n\tauth Authenticater,\n\tautoupdate *autoupdate.Autoupdate,\n\thistory History,\n\tredisConnection *redis.Redis,\n\tsaveIntercal time.Duration,\n\tprofileRoutes bool,\n) error {\n\tvar connectionCount *connectionCount\n\tif redisConnection != nil {\n\t\tconnectionCount = newConnectionCount(ctx, redisConnection, saveIntercal)\n\t\tmetric.Register(connectionCount.Metric)\n\t}\n\n\tmux := http.NewServeMux()\n\tHandleHealth(mux)\n\tHandleAutoupdate(mux, auth, autoupdate, history, connectionCount)\n\tHandleInternalAutoupdate(mux, auth, history, autoupdate)\n\tHandleShowConnectionCount(mux, autoupdate, auth, connectionCount)\n\tHandleHistoryInformation(mux, auth, history)\n\n\tif profileRoutes {\n\t\tHandleProfile(mux)\n\t}\n\n\tsrv := &http.Server{\n\t\tAddr: addr,\n\t\tHandler: mux,\n\t\tBaseContext: func(net.Listener) context.Context { return ctx },\n\t}\n\n\t// Shutdown logic in separate goroutine.\n\twait := make(chan error)\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tif err := srv.Shutdown(context.WithoutCancel(ctx)); err != nil {\n\t\t\t// TODO EXTERNAL ERROR\n\t\t\twait <- fmt.Errorf(\"HTTP server shutdown: %w\", err)\n\t\t\treturn\n\t\t}\n\t\twait <- nil\n\t}()\n\n\tif err := srv.ListenAndServe(); err != http.ErrServerClosed {\n\t\t// TODO EXTERNAL ERROR\n\t\treturn fmt.Errorf(\"HTTP Server failed: %v\", err)\n\t}\n\n\treturn <-wait\n}", "title": "" }, { "docid": "c1d2752c4a9775d3b861165eae302377", "score": "0.6601272", "text": "func main() {\n\n\tport := \"3846\"\n\tif os.Getenv(\"PORT\") != \"\" {\n\t\tport = os.Getenv(\"PORT\")\n\t}\n\n\tserver.Register()\n\n\t// fire up webserver on designated port passed via command line\n\tlog.Println(\"auth server is listening on port \", port)\n\tlog.Fatal(http.ListenAndServe(\":\"+port, nil))\n}", "title": "" }, { "docid": "45a48d6fc7d5ee1cde87395752068616", "score": "0.65885335", "text": "func (server Server) Run() {\n\tserverMux := http.NewServeMux()\n\tserverMux.HandleFunc(\"/persons\", handlers.Persons)\n\n\tlog.Println(http.ListenAndServe(server.String(), serverMux))\n}", "title": "" }, { "docid": "2ad0f9ea12c4a7fcb1c7547f1f77391f", "score": "0.65843606", "text": "func Run(\n\tctx context.Context,\n\tlogger *zap.Logger,\n\tlistener net.Listener,\n\thandler http.Handler,\n\toptions ...RunOption,\n) error {\n\ts := &runner{\n\t\tshutdownTimeout: DefaultShutdownTimeout,\n\t\treadHeaderTimeout: DefaultReadHeaderTimeout,\n\t}\n\tfor _, option := range options {\n\t\toption(s)\n\t}\n\tstdLogger, err := zap.NewStdLogAt(logger.Named(\"httpserver\"), zap.ErrorLevel)\n\tif err != nil {\n\t\treturn err\n\t}\n\thttpServer := &http.Server{\n\t\tHandler: handler,\n\t\tReadHeaderTimeout: s.readHeaderTimeout,\n\t\tErrorLog: stdLogger,\n\t\tTLSConfig: s.tlsConfig,\n\t}\n\tif s.tlsConfig == nil && !s.disableH2C {\n\t\thttpServer.Handler = h2c.NewHandler(handler, &http2.Server{\n\t\t\tIdleTimeout: DefaultIdleTimeout,\n\t\t})\n\t}\n\tif s.walkFunc != nil {\n\t\troutes, ok := handler.(chi.Routes)\n\t\tif ok {\n\t\t\tif err := chi.Walk(routes, s.walkFunc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\teg, ctx := errgroup.WithContext(ctx)\n\teg.Go(func() error {\n\t\treturn httpServe(httpServer, listener)\n\t})\n\teg.Go(func() error {\n\t\t<-ctx.Done()\n\t\tstart := time.Now()\n\t\tlogger.Info(\"shutdown_starting\", zap.Duration(\"shutdown_timeout\", s.shutdownTimeout))\n\t\tdefer logger.Info(\"shutdown_finished\", zap.Duration(\"duration\", time.Since(start)))\n\t\tif s.shutdownTimeout != 0 {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), s.shutdownTimeout)\n\t\t\tdefer cancel()\n\t\t\treturn httpServer.Shutdown(ctx)\n\t\t}\n\t\treturn httpServer.Close()\n\t})\n\n\tlogger.Info(\n\t\t\"starting\",\n\t\tzap.String(\"address\", listener.Addr().String()),\n\t\tzap.Duration(\"shutdown_timeout\", s.shutdownTimeout),\n\t\tzap.Bool(\"tls\", s.tlsConfig != nil),\n\t)\n\tif err := eg.Wait(); err != http.ErrServerClosed {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6fd6ed963efd41b44082c57c4fc65da", "score": "0.6580274", "text": "func startWebServer() {\n\tDebugf(\"Starting the echo instance and serving the API traffic\")\n\t// Starting a new echo instance\n\te := echo.New()\n\n\t// Middleware remove any \"/\" from URL, since most of the API we used doesn't have\n\t// trailing slack\n\te.Pre(middleware.RemoveTrailingSlash())\n\n\t// Load all the public facing templates\n\tt := &Template{\n\t\ttemplates: template.Must(template.ParseGlob(\"public/views/*.html\")),\n\t}\n\te.Renderer = t\n\n\t// Error Handler to send all the internal error with a message\n\te.HTTPErrorHandler = func(err error, c echo.Context) {\n\t\tif he, ok := err.(*echo.HTTPError); ok {\n\t\t\tc.JSON(he.Code, err)\n\t\t}\n\t}\n\n\t// Render 404 page\n\techo.NotFoundHandler = func(c echo.Context) error {\n\t\treturn c.Render(http.StatusNotFound, \"404.html\", \"\")\n\t}\n\n\t// Serve the routes\n\twebRouter(e)\n\n\t// Start server\n\te.Logger.Fatal(e.Start(\":\" + IsSettingEmpty(\"API_PORT\")))\n}", "title": "" }, { "docid": "00650587d535357c19a6936b3b0e4428", "score": "0.65783286", "text": "func Run(roomProvider RoomProvider, listenAddr string) {\n\thttp.HandleFunc(\"/\", server(roomProvider))\n\terr := http.ListenAndServe(listenAddr, nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "5add665762ee9fe0ba9340af32243454", "score": "0.65754455", "text": "func Run(s *http.Server) {\n\tlogger := logging.NewLogger()\n\n\t// Make custom initializations to request\n\ts.Handler = InitRequest(s.Handler)\n\n\tgo shutdown(s)\n\n\t// Start server\n\tif err := s.ListenAndServe(); err != http.ErrServerClosed {\n\t\tlogger.Fatal(fmt.Sprintf(\"Server error: %s\", err.Error()))\n\t}\n\n\tlogger.Info(\"Server gracefully stopped\")\n}", "title": "" }, { "docid": "3a502eba09379eb1b1dc0bbc18344bb0", "score": "0.65696317", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\n\t// TODO set port in a config\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "c29e3d528ef794ef7169d7efbd5e2c95", "score": "0.65613174", "text": "func (s *webServer) run() {\n\n\t// The router and REST APIs\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(\"/api\", s.GetItem).Methods(\"GET\")\n\trouter.HandleFunc(\"/api\", s.PostItem).Methods(\"POST\")\n\thttp.Handle(\"/api\", router)\n\n\t// WebSocket\n\thttp.Handle(\"/message\", websocket.Handler(s.socket))\n\n\t// Web Contents\n\thttp.Handle(\"/\", http.FileServer(http.Dir(\"./public\")))\n\n\t// Server up and running\n\tlog.Println(s.instance.ListenAndServe())\n}", "title": "" }, { "docid": "165f298a17604d607f7cd85d1c2ce56b", "score": "0.6556572", "text": "func Web() {\n\thttp.Handle(\"/ping\", ping())\n\thttp.Handle(\"/\", crud())\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "ea267a4fa805a9fb4b3bbcb8e3185fee", "score": "0.6555851", "text": "func (server *Server) Run(addr string) {\n\tfmt.Println(\"Listening on port \" + addr)\n\tlog.Fatal(http.ListenAndServe(addr, server.Router))\n}", "title": "" }, { "docid": "8e7fa752eeb88b6b4e569ef7f9518fc4", "score": "0.65556", "text": "func Run(opt *options.Option) error {\n\tas := new(apiServer)\n\tif err := as.prepare(opt); err != nil {\n\t\treturn err\n\t}\n\n\tif err := as.listenAndServe(); err != nil {\n\t\treturn err\n\t}\n\tshutdown.RegisterFirstShutdown(as.finalizer)\n\tshutdown.WaitShutdown(20)\n\treturn nil\n}", "title": "" }, { "docid": "60d6d6cec4c976ca93eee1251f8db4fa", "score": "0.654992", "text": "func StartWebServer(port string) {\n\n\trouter := router.NewRouter()\n\n\trouter = RegisterRoutes(router)\n\n\trouter.Run(\":\" + port)\n}", "title": "" }, { "docid": "9b4907b43ea00f480396e38e3bb81ce4", "score": "0.65460515", "text": "func main() {\n\taddr, addrExists := os.LookupEnv(\"ADDR\")\n\tif !addrExists {\n\t\taddr = \":8080\"\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/v1/summary\", SummaryHandler)\n\tlog.Printf(\"Server is open and listening at %s\", addr)\n\tlog.Fatal(http.ListenAndServe(addr, mux))\n}", "title": "" }, { "docid": "069ade837fa6cf9271e78c998f71db19", "score": "0.65437", "text": "func main() {\n\tgodotenv.Load()\n\troutes := router.NewRouter()\n\n\toriginsOk := handlers.AllowedOrigins([]string{\"*\"})\n\theadersOk := handlers.AllowedHeaders([]string{\"X-Requested-With\"})\n\tmethodsOk := handlers.AllowedMethods([]string{\"GET\", \"HEAD\", \"POST\", \"PUT\", \"OPTIONS\"})\n\n\tlog.Println(\"Server Is Running At \", os.Getenv(\"PORT\"))\n\tlog.Fatal(http.ListenAndServe(\":\" + os.Getenv(\"PORT\"), handlers.CORS(headersOk, originsOk, methodsOk)(routes)))\n}", "title": "" }, { "docid": "1bce044368425c618f717f396ebbf8be", "score": "0.6542484", "text": "func RunServer(name, addr, path string, errorHandling promhttp.HandlerErrorHandling) {\n\tif (*sslCertFileF == \"\") != (*sslKeyFileF == \"\") {\n\t\tlog.Fatal(\"One of the flags -web.ssl-cert-file or -web.ssl-key-file is missing to enable HTTPS.\")\n\t}\n\n\tssl := false\n\tif *sslCertFileF != \"\" && *sslKeyFileF != \"\" {\n\t\tif _, err := os.Stat(*sslCertFileF); os.IsNotExist(err) {\n\t\t\tlog.Fatalf(\"SSL certificate file does not exist: %s\", *sslCertFileF)\n\t\t}\n\t\tif _, err := os.Stat(*sslKeyFileF); os.IsNotExist(err) {\n\t\t\tlog.Fatalf(\"SSL key file does not exist: %s\", *sslKeyFileF)\n\t\t}\n\t\tssl = true\n\t}\n\n\thandler := handler(errorHandling)\n\tvar buf bytes.Buffer\n\tdata := map[string]string{\"name\": name, \"path\": path}\n\tif err := landingPage.Execute(&buf, data); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif ssl {\n\t\trunHTTPS(addr, path, handler, buf.Bytes())\n\t} else {\n\t\trunHTTP(addr, path, handler, buf.Bytes())\n\t}\n}", "title": "" }, { "docid": "9673a2c7444aea9b8c613a9f798db510", "score": "0.6542088", "text": "func (h *HTTPSrv) Run() {\n\te := echo.New()\n\te.HideBanner = true\n\n\te.POST(\"/orders\", h.NewOrder)\n\te.DELETE(\"/orders\", h.CancelOrder)\n\n\te.Logger.Fatal(e.Start(\":8080\"))\n}", "title": "" }, { "docid": "be0cb65ac8cbef2ee10e93ac6c9b22d8", "score": "0.6541284", "text": "func ListenAndServe() {\n\tmain(false)\n}", "title": "" }, { "docid": "c51d2ecffcd0286ea7a162bc176677a2", "score": "0.6541083", "text": "func Run(config *Config) {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\tapp := NewApplication(config)\n\n\tcors := cors.New(cors.Options{AllowedOrigins: config.Origins})\n\n\thttp.Handle(\"/\", app.stats.Handler(handlers.ProxyHeaders(handlers.LoggingHandler(os.Stdout, cors.Handler(app.Router())))))\n\n\tfmt.Println(\"Starting server\", config.Version, \"on\", config.Bind)\n\n\t// starts a server that waits until all current requests are finished\n\t// before shutting down. The server stops listening\n\t// immediately though, so a new process can listen on the port and start\n\t// serving requests straight away\n\tgraceful.Run(config.Bind, 30*time.Second, nil)\n}", "title": "" }, { "docid": "fc1cf4fa20c2ee84037a422ff57c69d2", "score": "0.6540472", "text": "func Run(databaseHandler database.DatabaseHandler, config configuration.ServiceConfig) error {\n\thandler := newServiceHandler(databaseHandler)\n\tr := mux.NewRouter()\n\n\t// Notes routes\n\tnoteSubrouter := r.PathPrefix(\"/notes\").Subrouter()\n\tnoteSubrouter.Methods(\"GET\").Path(\"\").HandlerFunc(handler.getAllNotes)\n\tnoteSubrouter.Methods(\"POST\").Path(\"\").HandlerFunc(handler.addNote)\n\tnoteSubrouter.Methods(\"GET\").Path(\"/{id}\").HandlerFunc(handler.getNoteByID)\n\tnoteSubrouter.Methods(\"DELETE\").Path(\"/{id}\").HandlerFunc(handler.deleteNote)\n\tnoteSubrouter.Methods(\"PATCH\").Path(\"/{id}\").HandlerFunc(handler.patchNote)\n\n\t// Todos routes\n\ttodoSubrouter := r.PathPrefix(\"/todos\").Subrouter()\n\ttodoSubrouter.Methods(\"GET\").Path(\"\").HandlerFunc(handler.getAllTodos)\n\ttodoSubrouter.Methods(\"POST\").Path(\"\").HandlerFunc(handler.addTodo)\n\ttodoSubrouter.Methods(\"GET\").Path(\"/{id}\").HandlerFunc(handler.getTodoByID)\n\ttodoSubrouter.Methods(\"DELETE\").Path(\"/{id}\").HandlerFunc(handler.deleteTodo)\n\ttodoSubrouter.Methods(\"PATCH\").Path(\"/{id}\").HandlerFunc(handler.patchTodo)\n\n\tsrv := http.Server{\n\t\tAddr: config.EndpointAPI,\n\t\tHandler: r,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 5 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\treturn srv.ListenAndServe()\n}", "title": "" }, { "docid": "84defb62bdce883017ff13972d0c0369", "score": "0.65330404", "text": "func Run() {\n\n\tfmt.Println(\"WebSite Lunched\")\n\tlogger.Print(\"WebSite Lunched\", nil)\n\n\t// When Client ask /\n\thttp.HandleFunc(\"/\", indexHandler)\n\n}", "title": "" }, { "docid": "10d1d15fabeb16022aec7247bea1f684", "score": "0.65257436", "text": "func Run(address string, port string) {\n\tascii := figlet4go.NewAsciiRender()\n\toptions := figlet4go.NewRenderOptions()\n\toptions.FontColor = []figlet4go.Color{\n\t\tfiglet4go.ColorGreen,\n\t}\n\trenderStr, _ := ascii.RenderOpts(\"API-Server!\", options)\n\tfmt.Print(renderStr)\n\n\tlogConfig := config.GetLogConfiguration()\n\tlogging.Init(logConfig)\n\tlogger := logging.GetLogger()\n\tlogger.Info(\"logger initialized\")\n\n\trouter := gin.New()\n\trouter.Use(gin.Logger())\n\trouter.Use(gin.Recovery())\n\n\tsessionRef := sf.GetSession()\n\n\tcon := config.NewConfigurations(logger)\n\n\t// userRepository contains all the methods that interact with DB to perform CURD operations for user.\n\tuserRepository := reposytory.NewUserRepository(sessionRef, logger)\n\tuserRepository.GetUserByUserName(\"admin\")\n\n\tauthRepository := reposytory.NewAuthRepository(sessionRef, logger)\n\n\taccountRepository := reposytory.NewAccountRepository(sessionRef, logger)\n\n\t// validation contains all the methods that are need to validate the user json in request\n\tvalidator := data2.NewValidation()\n\n\t// authService contains all methods that help in authorizing a user request\n\tauthService := service.NewAuthService(logger, con, authRepository)\n\n\t// AuthHandler encapsulates all the services related to user\n\tauthHandler := handlers.NewAuthHandler(logger, con, validator, userRepository, authService)\n\n\taccountHandler := handlers.NewAccountHandler(authHandler, logger, accountRepository)\n\n\tauthHandler.Routes(router)\n\taccountHandler.Routes(router)\n\trouter.GET(\"/swagger/*any\", ginSwagger.WrapHandler(swaggerFiles.Handler))\n\n\terr := router.Run(fmt.Sprintf(\"%s:%v\", address, port))\n\tif err != nil {\n\t\tlogger.Error(err)\n\t}\n\n}", "title": "" }, { "docid": "f7329ff0410ce823057edabcc1f65411", "score": "0.6525172", "text": "func Run(conf ServerConf) {\n\tfor _, line := range strings.Split(fmt.Sprintf(logo, conf.Version, conf.BuildDate), \"\\n\") {\n\t\tlog.Println(\"#\", line)\n\t}\n\n\tsite := newSite()\n\tif len(conf.Init) > 0 {\n\t\tinitSite(site, conf.Init)\n\t}\n\n\tbroker := newBroker(site)\n\tgo broker.run()\n\n\tif conf.Debug {\n\t\thttp.Handle(\"/_d/site\", newDebugHandler(broker))\n\t}\n\n\tvar auth *Auth\n\n\tif conf.Auth != nil {\n\t\tvar err error\n\t\tif auth, err = newAuth(conf.Auth); err != nil {\n\t\t\tpanic(fmt.Errorf(\"failed connecting to OIDC provider: %v\", err))\n\t\t}\n\t\thttp.Handle(\"/_auth/init\", newLoginHandler(auth))\n\t\thttp.Handle(\"/_auth/callback\", newAuthHandler(auth))\n\t\thttp.Handle(\"/_auth/logout\", newLogoutHandler(auth, broker))\n\t}\n\n\thttp.Handle(\"/_s\", newSocketServer(broker, auth, conf.Editable)) // XXX terminate sockets when logged out\n\n\tfileDir := filepath.Join(conf.DataDir, \"f\")\n\thttp.Handle(\"/_f\", newFileStore(fileDir, conf.Keychain, auth))\n\thttp.Handle(\"/_f/\", newFileServer(fileDir, conf.Keychain, auth))\n\tfor _, dir := range conf.PrivateDirs {\n\t\tprefix, src := splitDirMapping(dir)\n\t\techo(Log{\"t\": \"private_dir\", \"source\": src, \"address\": prefix})\n\t\thttp.Handle(prefix, http.StripPrefix(prefix, newDirServer(src, conf.Keychain, auth)))\n\t}\n\tfor _, dir := range conf.PublicDirs {\n\t\tprefix, src := splitDirMapping(dir)\n\t\techo(Log{\"t\": \"public_dir\", \"source\": src, \"address\": prefix})\n\t\thttp.Handle(prefix, http.StripPrefix(prefix, http.FileServer(http.Dir(src))))\n\t}\n\n\thttp.Handle(\"/_c/\", newCache(\"/_c/\", conf.Keychain, conf.MaxCacheRequestSize))\n\thttp.Handle(\"/_m/\", newMultipartServer(\"/_m/\", conf.Keychain, auth, conf.MaxRequestSize))\n\n\tif conf.Proxy {\n\t\thttp.Handle(\"/_p\", newProxy(auth, conf.MaxProxyRequestSize, conf.MaxProxyResponseSize))\n\t}\n\n\tif conf.IDE {\n\t\tide := http.StripPrefix(\"/_ide\", http.FileServer(http.Dir(path.Join(conf.WebDir, \"_ide\"))))\n\t\thttp.Handle(\"/_ide\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tif auth != nil && !auth.allow(r) {\n\t\t\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tide.ServeHTTP(w, r)\n\t\t}))\n\t}\n\n\thttp.Handle(\"/\", newWebServer(site, broker, auth, conf.Keychain, conf.MaxRequestSize, conf.WebDir))\n\n\techo(Log{\"t\": \"listen\", \"address\": conf.Listen, \"webroot\": conf.WebDir})\n\n\tif conf.CertFile != \"\" && conf.KeyFile != \"\" {\n\t\tif err := http.ListenAndServeTLS(conf.Listen, conf.CertFile, conf.KeyFile, nil); err != nil {\n\t\t\techo(Log{\"t\": \"listen_tls\", \"error\": err.Error()})\n\t\t}\n\t} else {\n\t\tif err := http.ListenAndServe(conf.Listen, nil); err != nil {\n\t\t\techo(Log{\"t\": \"listen_no_tls\", \"error\": err.Error()})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fb5e6ec2655eefe74adb030cd35662d9", "score": "0.6514263", "text": "func (a *App) Run(host string) {\n\tlog.Fatal(http.ListenAndServe(host, a.Router))\n\tfmt.Println(\"Listning on localhost:8080\")\n}", "title": "" }, { "docid": "de0d4fe1f24244293ff30d4b6f568ae8", "score": "0.6511083", "text": "func (api *api) run(port string) {\n\thttp.HandleFunc(\"/allow\", api.allowAction)\n\thttp.HandleFunc(\"/forbid\", api.forbidAction)\n\tlog.Fatal(http.ListenAndServe(\":\"+port, nil))\n}", "title": "" }, { "docid": "e932aa31382a288e00cc22adb58c942c", "score": "0.65088195", "text": "func Run() {\n\tgetHandlers()\n\trouter.Run(\":9990\")\n}", "title": "" }, { "docid": "615a9cdb69982547285f4e9bfa01f9c8", "score": "0.6508142", "text": "func (a *App) Run(host string) {\n\tc := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"*\"},\n\t\tAllowCredentials: true,\n\t})\n\n\thandler := c.Handler(a.Router)\n\tlog.Fatal(http.ListenAndServe(host, handler))\n}", "title": "" }, { "docid": "882f2e8941535837fd22d5d43b52e8a3", "score": "0.64998543", "text": "func main() {\n\thttp.Handle(\"/echo\", websocket.Handler(EchoServer))\n\terr := http.ListenAndServe(\":12345\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "8b4bdc052c41b86c157835a374c15486", "score": "0.64988977", "text": "func Serve(initOptions client.InitRegionOptions, appConfig types.AppConfig, tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter,\n\ttkgTimeOut time.Duration, bind string, browser string) error {\n\n\tswaggerSpec, err := loads.Analyzed(restapi.FlatSwaggerJSON, \"2.0\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tapi := operations.NewKickstartUIAPI(swaggerSpec)\n\tserver := restapi.NewServer(api)\n\n\tserver.EnabledListeners = []string{\"http\"}\n\thost, port, err := net.SplitHostPort(bind)\n\tif err != nil {\n\t\treturn errors.Errorf(\"Invalid binding address provided. Please use address in the the form '127.0.0.1:8080'\")\n\t}\n\tserver.Port, err = strconv.Atoi(port)\n\tif err != nil {\n\t\treturn errors.Errorf(\"Invalid binding port provided. Please provide a valid number (e.g. 8080).\")\n\t}\n\tserver.Host = host\n\tserver.Browser = browser\n\n\tws.InitWebsocketUpgrader(server.Host)\n\n\tapp := &handlers.App{InitOptions: initOptions, AppConfig: appConfig, TKGTimeout: tkgTimeOut, TKGConfigReaderWriter: tkgConfigReaderWriter}\n\tapp.ConfigureHandlers(api)\n\tserver.SetAPI(api)\n\tserver.SetHandler(api.Serve(FileServerMiddleware))\n\n\t// check if the port is already in use, if so exit gracefully\n\tl, err := net.Listen(\"tcp\", server.Host+\":\"+strconv.Itoa(server.Port))\n\tif err != nil {\n\t\tserver.Logf(\"Failed to start the kickstart UI Server[Host:%s, Port:%d], error: %s\\n\", server.Host, server.Port, err)\n\t\tos.Exit(1)\n\t}\n\tl.Close()\n\n\tdefer func() {\n\t\terr := server.Shutdown()\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t}()\n\tif err := server.Serve(); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ec75b79fa514b5e2f4127dedb650e94", "score": "0.64960927", "text": "func main() {\n\tr := router.NewRouter(handlerFuncs)\n\thttp.ListenAndServe(\":8080\", r)\n\n}", "title": "" }, { "docid": "be3e8fee48d35d955b452316040adf31", "score": "0.64959556", "text": "func main() {\n\tsetTileFaces()\n\n\tHttpsServer(8088)\n\treturn\n}", "title": "" }, { "docid": "d0125f09953ce221753e0899c9f67c41", "score": "0.64948606", "text": "func Run(localHost string, port int, downloadRoot, uploadRoot string) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\thandler := createHandler(hub.New(localHost, &upload.Uploader{Root: uploadRoot}), downloadRoot, cancel)\n\n\tif err := startServer(ctx, port, handler); err != nil {\n\t\tlog.Print(err)\n\t}\n}", "title": "" }, { "docid": "7f2e4decf83bb666c33eb133374b8101", "score": "0.6493742", "text": "func Run(cfg Config) {\n\tservice := handlers.NewService()\n\tendpoints := NewEndpoints(service)\n\n\t// Mechanical domain.\n\terrc := make(chan error)\n\n\t// Interrupt handler.\n\tgo handlers.InterruptHandler(errc)\n\n\t// Debug listener.\n\tgo func() {\n\t\tlog.Println(\"transport\", \"debug\", \"addr\", cfg.DebugAddr)\n\n\t\tm := http.NewServeMux()\n\t\tm.Handle(\"/debug/pprof/\", http.HandlerFunc(pprof.Index))\n\t\tm.Handle(\"/debug/pprof/cmdline\", http.HandlerFunc(pprof.Cmdline))\n\t\tm.Handle(\"/debug/pprof/profile\", http.HandlerFunc(pprof.Profile))\n\t\tm.Handle(\"/debug/pprof/symbol\", http.HandlerFunc(pprof.Symbol))\n\t\tm.Handle(\"/debug/pprof/trace\", http.HandlerFunc(pprof.Trace))\n\n\t\terrc <- http.ListenAndServe(cfg.DebugAddr, m)\n\t}()\n\n\t// HTTP transport.\n\tgo func() {\n\t\tlog.Println(\"transport\", \"HTTP\", \"addr\", cfg.HTTPAddr)\n\t\th := svc.MakeHTTPHandler(endpoints)\n\t\terrc <- http.ListenAndServe(cfg.HTTPAddr, h)\n\t}()\n\n\t// gRPC transport.\n\tgo func() {\n\t\tlog.Println(\"transport\", \"gRPC\", \"addr\", cfg.GRPCAddr)\n\t\tln, err := net.Listen(\"tcp\", cfg.GRPCAddr)\n\t\tif err != nil {\n\t\t\terrc <- err\n\t\t\treturn\n\t\t}\n\n\t\tsrv := svc.MakeGRPCServer(endpoints)\n\t\ts := grpc.NewServer()\n\t\tpb.RegisterTodoServer(s, srv)\n\n\t\terrc <- s.Serve(ln)\n\t}()\n\n\t// Run!\n\tlog.Println(\"exit\", <-errc)\n}", "title": "" }, { "docid": "87da1ed9c29ee6d9f91c15e1fa118357", "score": "0.6492104", "text": "func (a *Handler) Run(port string) {\n\thttp.ListenAndServe(port, a.Router)\n}", "title": "" }, { "docid": "cf33d9d70ac15db2bb993b6e6a16fdbe", "score": "0.6488277", "text": "func Run(port int) {\n\tlogger.Info(\"Starting API server...\")\n\n\ts := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tHandler: api(),\n\t\tReadTimeout: 90 * time.Second,\n\t\tWriteTimeout: 90 * time.Second,\n\t}\n\ts.ListenAndServe()\n}", "title": "" }, { "docid": "c4619f2e3c54cc2ec9f1dc27c4bb4549", "score": "0.6480469", "text": "func main() {\n\tconfig := NewConfig()\n\tapp := &App{}\n\trouter := app.NewRouter()\n\n\tlog.Printf(\"Listening at port %s\", config.ServerPort)\n\trouter.Run(standard.New(config.ServerPort))\n}", "title": "" }, { "docid": "59d95d4c5555fb4ad741eb1a3e866690", "score": "0.6476374", "text": "func (s *Server) Run() {\n\n\tdefer s.logger.Sync()\n\n\ts.observability()\n\n\t//s.router.Handle(\"/metrics\", promhttp.Handler())\n\ts.routerHandler()\n\n\th := &ochttp.Handler{Handler: s.router}\n\tif err := view.Register(ochttp.DefaultServerViews...); err != nil {\n\t\tlog.Fatal(\"failed to register ochttp.DefaultServerViews\")\n\t}\n\ts.initialiseConsumer()\n\ts.logger.Info(\"edith is listening at port\", zap.String(\"port\", s.port))\n\terr := http.ListenAndServe(fmt.Sprintf(\":%s\", s.port), h)\n\tif err != nil {\n\t\ts.logger.Error(\"edith starting failed \", zap.String(\"port\", s.port), zap.Error(err))\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "279a0336e37e6c1142bab7f820b3fbea", "score": "0.64747566", "text": "func main() {\n\tvar connection = repo.Connect2DB()\n\trepo.InitializeDB(connection)\n\tinitializeSignalHandler(connection)\n\tserv.InitializeOWMService()\n\n\trouter := initializeRouter()\n\n\tmid.LogInfo(\"starting http server on port: 8082\")\n\tmid.LogFatal(http.ListenAndServe(\":8082\", router))\n}", "title": "" }, { "docid": "eb83f000b013ddd7e7df8b720e0e43cc", "score": "0.64728385", "text": "func (server *Server) Run(addr string) {\n\tfmt.Printf(\"Listening to port %s\\n\", addr)\n\tlog.Fatal(http.ListenAndServe(\":\"+addr, server.Router))\n}", "title": "" }, { "docid": "5825050ce351c41f5416aad3503e1c80", "score": "0.6471169", "text": "func main() {\n\tgo server.StartRPC()\n\tserver.StartHTTP()\n}", "title": "" }, { "docid": "76bef1e5bce413fdc7e413b5611ac9ed", "score": "0.6465564", "text": "func Run(c *Config) error {\n\terr := validatePort(c.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tportString := fmt.Sprintf(\":%d\", c.Port)\n\n\tlog.Printf(\"[INFO] Listening on %s\\n\", portString)\n\n\tvar proxyFunc = func(ws *websocket.Conn) {\n\t\tproxyHandler(ws, c)\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/\", websocket.Handler(proxyFunc))\n\n\tsrv := &http.Server{\n\t\tAddr: portString,\n\t\tHandler: mux,\n\t\tTLSConfig: &tls.Config{},\n\t}\n\n\tif c.CertManager != nil {\n\t\tsrv.TLSConfig.GetCertificate = c.CertManager.GetCertificate\n\t}\n\n\tif c.CertManager != nil || (c.Cert != \"\" && c.Key != \"\") {\n\t\terr = srv.ListenAndServeTLS(c.Cert, c.Key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\terr = srv.ListenAndServe()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff221f53e96b50f55c478c7efcd700ea", "score": "0.64610523", "text": "func main() {\n\n\t// serves frontend on port 80\n\t// should change to 443 if not using certbot\n\n\tserver01 := &http.Server{\n\t\tAddr: \":80\",\n\t\tHandler: frontend(),\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t}\n\tg.Go(func() error {\n\t\treturn server01.ListenAndServe()\n\t})\n\tif err := g.Wait(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n}", "title": "" }, { "docid": "13d2292d20e82e303e11b7bd962b496e", "score": "0.64595485", "text": "func (s *Server) Run() {\n\tlog.Printf(\"Loading settings...\\n\")\n\tsettings.Init()\n\n\tmySettings := settings.Get()\n\tip := mySettings[\"server\"].(map[string]interface{})[\"ip\"].(string)\n\tport := mySettings[\"server\"].(map[string]interface{})[\"port\"].(string)\n\n\tlistenIn := ip + \":\" + port\n\n\tlog.Printf(\"Creating routes...\\n\")\n\troutes := routers.Init()\n\n\tlog.Printf(\"Server starting on port %v [%s]\\n\",\n\t\tlistenIn,\n\t\tsettings.GetEnvironment())\n\n\tlog.Fatal(fasthttp.ListenAndServe(listenIn, routes.Handler))\n}", "title": "" }, { "docid": "532c10e3a6c074f6729cedc9c19b3bc9", "score": "0.6456178", "text": "func Run() {\n\tengine := gin.Default()\n\n\tperson.Routes(engine)\n\tstatus.Routes(engine)\n\ttest.Routes(engine)\n\n\tengine.Run(\":5000\")\n}", "title": "" }, { "docid": "af8398d5b2a4a2d3f959e2f2edd5d3ba", "score": "0.64510685", "text": "func main() {\n\thttp.Handle(\"/ws\", websocket.Handler(EchoServer))\n\terr := http.ListenAndServe(\":12345\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" } ]
f94d2309bf42e4a10547e2222b7afead
New logger with a copied session and outputs as this logger. Changes to this logger will not affect the new logger.
[ { "docid": "64eeb21a04e14076e4beff523876e0da", "score": "0.52393603", "text": "func (l *logger) New(id string) Logger {\n\treturn &logger{identifier: id,\n\t\toutputs: l.outputs,\n\t\tstackOffset: standardStackOffset,\n\t\tsessionID: l.sessionID,\n\t}\n}", "title": "" } ]
[ { "docid": "8e731b77e55c3e39f541655c73fd1b45", "score": "0.6645213", "text": "func (lg *Logger) Clone() *Logger {\n\treturn &Logger{\n\t\tlogger: lg.logger,\n\t\tprefix: lg.prefix,\n\t\tpath: lg.path,\n\t\tsyslogEndpoint: lg.syslogEndpoint,\n\t}\n}", "title": "" }, { "docid": "e20921e37691124d879e72732f12daf3", "score": "0.6613593", "text": "func (ls *LoggingSink) Clone() Sink {\n\treturn ls\n}", "title": "" }, { "docid": "559f1dce12fc64ae211899021e635b04", "score": "0.65554535", "text": "func (logger *Logger) Copy() *Logger {\n\tvar formatter *TextFormatter\n\tformatter = logger.Formatter.(*TextFormatter)\n\n\ttextFormatter := &TextFormatter{\n\t\tForceColors: formatter.ForceColors,\n\t\tDisableColors: formatter.DisableColors,\n\t\tDisableTimestamp: formatter.DisableTimestamp,\n\t\tShortTimestamp: formatter.ShortTimestamp,\n\t\tTimestampFormat: formatter.TimestampFormat,\n\t}\n\n\tl := Logger{\n\t\tprefix: logger.prefix,\n\t}\n\tl.Formatter = textFormatter\n\tl.Out = logger.Out\n\tl.Level = logger.Level\n\n\treturn &l\n}", "title": "" }, { "docid": "6b4f8eba2c493f8cae9c8bbe9ca641de", "score": "0.6510631", "text": "func (l *Logger) Copy() *Logger {\n\tn := NewLogger()\n\tn.WithStream(l.stream)\n\tfor k, v := range l.tags {\n\t\tn.tags[k] = v\n\t}\n\treturn n\n}", "title": "" }, { "docid": "cbc6c442748e0f88b00c713bac1f0c82", "score": "0.6423021", "text": "func Clone(in *logrus.Logger) *logrus.Logger {\n\tout := &logrus.Logger{\n\t\tOut: in.Out,\n\t\tHooks: make(logrus.LevelHooks),\n\t\tFormatter: in.Formatter,\n\t\tLevel: in.Level,\n\t}\n\tfor k, v := range in.Hooks {\n\t\tout.Hooks[k] = v\n\t}\n\treturn out\n}", "title": "" }, { "docid": "78d36bf7e5b193649193dd3f89e9877a", "score": "0.63349324", "text": "func (l *Logger) Clone() *Logger {\n\t// copy level output and format maps.\n\tformats := make(map[string]Formatter, len(l.formatters))\n\tfor k, v := range l.formatters {\n\t\tformats[k] = v\n\t}\n\tlevelFormat := make(map[Level]Formatter, len(l.LevelFormatter))\n\tfor k, v := range l.LevelFormatter {\n\t\tlevelFormat[k] = v\n\t}\n\tlevelOutput := make(map[Level]io.Writer, len(l.LevelOutput))\n\tfor k, v := range l.LevelOutput {\n\t\tlevelOutput[k] = v\n\t}\n\n\treturn &Logger{\n\t\tPrefix: l.Prefix,\n\t\tLevel: l.Level,\n\t\tTimeFormat: l.TimeFormat,\n\t\tNewLine: l.NewLine,\n\t\tPrinter: l.Printer,\n\t\tLevelOutput: levelOutput,\n\t\tformatter: l.formatter,\n\t\tformatters: formats,\n\t\tLevelFormatter: levelFormat,\n\t\thandlers: l.handlers,\n\t\tchildren: newLoggerMap(),\n\t\tmu: sync.RWMutex{},\n\t\tonce: sync.Once{},\n\t}\n}", "title": "" }, { "docid": "3dc42579c770332bf51d80fa3f085078", "score": "0.57931125", "text": "func Clone() *mgo.Session {\n\treturn session.Clone()\n}", "title": "" }, { "docid": "f696a9ec9418f455a4ce531894de8c41", "score": "0.5618832", "text": "func (s *Session) Copy() *mgo.Session {\n\treturn s.session.Copy()\n}", "title": "" }, { "docid": "ee7d90011cab8a4f98fcd29f4cbcccd2", "score": "0.5580644", "text": "func (t *operations) SessionLog(session *tether.SessionConfig) (dio.DynamicMultiWriter, error) {\n\tdefer trace.End(trace.Begin(\"configure session log writer\"))\n\n\tname := session.ID\n\tif name == \"\" {\n\t\tname = session.Name\n\t}\n\n\tlogPath := strings.Join([]string{pathPrefix, logDir, name + \".log\"}, string(os.PathSeparator))\n\n\t// open SttyS2 for session logging\n\tlog.Infof(\"opening %s for session logging\", logPath)\n\tf, err := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_APPEND|os.O_SYNC|syscall.O_NOCTTY, 777)\n\tif err != nil {\n\t\tdetail := fmt.Sprintf(\"failed to open file for session log: %s\", err)\n\t\tlog.Error(detail)\n\t\treturn nil, errors.New(detail)\n\t}\n\n\t// use multi-writer so it goes to both screen and session log\n\treturn dio.MultiWriter(f, os.Stdout), nil\n}", "title": "" }, { "docid": "cbfed21ebf0141bba16ac455d748f390", "score": "0.55409193", "text": "func newLogger(name string, buffer int64) *Logger {\n\tl := &Logger{\n\t\tMultiChannelledLog: NewMultiChannelledLog(name, buffer),\n\t\tbufferLength: buffer,\n\t}\n\treturn l\n}", "title": "" }, { "docid": "4907cdafc74da74ecd6339e3c386bc7a", "score": "0.5517704", "text": "func NewLogger() core.Logger { return core.NewLogger() }", "title": "" }, { "docid": "891cb78a122796445db30e00c7ac9a74", "score": "0.55052525", "text": "func (c *Connect) logger(session *ssh.Session) (err error) {\n\tlogfile, err := os.OpenFile(c.logFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif !c.logTimestamp && !c.logRemoveAnsiCode {\n\t\tsession.Stdout = io.MultiWriter(session.Stdout, logfile)\n\t\tsession.Stderr = io.MultiWriter(session.Stderr, logfile)\n\t} else {\n\t\tbuf := new(bytes.Buffer)\n\t\tsession.Stdout = io.MultiWriter(session.Stdout, buf)\n\t\tsession.Stderr = io.MultiWriter(session.Stderr, buf)\n\n\t\tgo func() {\n\t\t\tpreLine := []byte{}\n\t\t\tfor {\n\t\t\t\tif buf.Len() > 0 {\n\t\t\t\t\t// get line\n\t\t\t\t\tline, err := buf.ReadBytes('\\n')\n\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\tpreLine = append(preLine, line...)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprintLine := string(append(preLine, line...))\n\n\t\t\t\t\t\tif c.logTimestamp {\n\t\t\t\t\t\t\ttimestamp := time.Now().Format(\"2006/01/02 15:04:05 \") // yyyy/mm/dd HH:MM:SS\n\t\t\t\t\t\t\tprintLine = timestamp + printLine\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// remove ansi code.\n\t\t\t\t\t\tif c.logRemoveAnsiCode {\n\t\t\t\t\t\t\t// NOTE:\n\t\t\t\t\t\t\t// In vtclean.Clean, the beginning of the line is deleted for some reason.\n\t\t\t\t\t\t\t// for that reason, one character add at line head.\n\t\t\t\t\t\t\tprintLine = \".\" + printLine\n\t\t\t\t\t\t\tprintLine = vtclean.Clean(printLine, false)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfmt.Fprintf(logfile, printLine)\n\t\t\t\t\t\tpreLine = []byte{}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "7ff7c959a3ae6ecc56a2a516284d1ba2", "score": "0.55040616", "text": "func Fork() *Logger {\n\tvar newContext = make([]*Pair, len(context))\n\tglobal.RLock()\n\tcopy(newContext, context)\n\tglobal.RUnlock()\n\treturn &Logger{context: newContext}\n}", "title": "" }, { "docid": "08cb4eb6f100d0b388beea01bde6b7cf", "score": "0.5494726", "text": "func (s *Session) Copy() *Session {\n\treturn &Session{s.session.Copy()}\n}", "title": "" }, { "docid": "31f3c01df9b124be9ae8060b16776dd1", "score": "0.54568154", "text": "func CopyStandardLogTo(name string) {\n\t//gglog.CopyStandardLogTo(name)\n\t//logger.CopyStandardLogTo(name)\n\t//TODO: not supported in this version of mlogger\n\treturn\n}", "title": "" }, { "docid": "4161a8f0d165d06d7fc3c0d9a2460d9d", "score": "0.54400104", "text": "func (s *Session) Copy() *Session {\n\tc := s.session.Copy()\n\tdbName := s.dbName\n\treturn NewSession(c, dbName)\n}", "title": "" }, { "docid": "224ccf2d60b549876677d1fe0f9d8097", "score": "0.5398855", "text": "func CopyLoggerWithLevel(logger *logrus.Logger, lvl logrus.Level) *logrus.Logger {\n\tnewLogger := &logrus.Logger{\n\t\tOut: logger.Out,\n\t\tHooks: make(logrus.LevelHooks),\n\t\tLevel: lvl,\n\t\tFormatter: logger.Formatter,\n\t\tReportCaller: logger.ReportCaller,\n\t\tExitFunc: logger.ExitFunc,\n\t}\n\t// Copy hooks, so that original Logger hooks are not altered\n\tfor l, hook := range logger.Hooks {\n\t\tnewLogger.Hooks[l] = hook\n\t}\n\treturn newLogger\n}", "title": "" }, { "docid": "ddcaa344b8e6accc7a460a6cc6e12028", "score": "0.53702015", "text": "func newLogger(writer io.Writer) *log.Logger {\n\treturn log.New(writer, \"\", 0)\n}", "title": "" }, { "docid": "41caf63088e9fc97bcda1513a425d30d", "score": "0.5344593", "text": "func (cm *CategoryManager) CopySession() *mgo.Session {\n\treturn cm.session.Copy()\n}", "title": "" }, { "docid": "a98249c8c657fe099baeca02bda504bb", "score": "0.5340964", "text": "func newLog () (*log) {\n\treturn &log {}\n}", "title": "" }, { "docid": "f7c7bd840d141a56717b4bf3da1e1e4b", "score": "0.5294599", "text": "func newLogger(w io.Writer, prefix string) *log.Logger {\n\treturn log.New(w, prefix, log.LstdFlags)\n}", "title": "" }, { "docid": "17844c911f68babce7740b2668454b5c", "score": "0.5255076", "text": "func newRawLogger(path string, bufferSize int, bufferWait time.Duration, sighup chan interface{}) (*rawLogger, error) {\n\tl := &rawLogger{\n\t\tinput: make(chan interface{}),\n\t\tencoderInput: make(chan interface{}, bufferSize),\n\t\toutput: make(chan []byte, bufferSize),\n\t\tdone: make(chan interface{}),\n\t\twait: bufferWait,\n\t\tmetrics: newMetrics(),\n\t}\n\n\twriter, err := logging.NewRotateWriter(path, sighup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl.writer = writer\n\n\treturn l, nil\n}", "title": "" }, { "docid": "ad48cd5c6b34c55a3a538eb00bfc6e3b", "score": "0.52530414", "text": "func UseLogger(newLogger seelog.LoggerInterface) {\n\tloggerMutex.Lock()\n\tdefer loggerMutex.Unlock()\n\tlogger = newLogger\n}", "title": "" }, { "docid": "73431e2c7f74bd4941f273206814ea50", "score": "0.52502805", "text": "func (l *Logger) Fork() *Logger {\n\tvar fork = Logger{context: make([]*Pair, len(l.context))}\n\tcopy(fork.context, l.context)\n\treturn &fork\n}", "title": "" }, { "docid": "f4ae07e3fbafe958f1f5ef3711d7a3b2", "score": "0.52225447", "text": "func PassRefLog(log *zap.Logger) {\n\tlogger = log\n}", "title": "" }, { "docid": "99352a325d6fc0a21b984317e29b4229", "score": "0.52164143", "text": "func (ld Logs) Clone() Logs {\n\tcloneLd := NewLogs()\n\tld.ResourceLogs().CopyTo(cloneLd.ResourceLogs())\n\treturn cloneLd\n}", "title": "" }, { "docid": "71dc429954d793cca7179f9fbf4ddf74", "score": "0.5192476", "text": "func useLogger(logger logpkg.Logger) {\n\tlog = logger\n}", "title": "" }, { "docid": "21ef9805f0a56740d61c7978b0de3ebe", "score": "0.5184201", "text": "func newLogger() *log.Logger {\n\tlogger := log.New(os.Stdout, \"\" /* prefix */, 0 /* flags */)\n\treturn logger\n}", "title": "" }, { "docid": "7314db5d9bdcd8ee6ed78d066a45f864", "score": "0.518402", "text": "func logger(msg string) {\n\tfmt.Println(string(msg))\n\thistory = append(history, msg)\n}", "title": "" }, { "docid": "8e82f737d11ecf32b8c36c0913f1f0ea", "score": "0.5150344", "text": "func capture() *logger {\r\n\tout := new(bytes.Buffer)\r\n\tinner := log.New(out, log.Prefix(), log.Flags())\r\n\tinner.SetPrefix(\"\")\r\n\treturn &logger{\r\n\t\tLog: out,\r\n\t\tLogger: inner,\r\n\t}\r\n}", "title": "" }, { "docid": "978212b5dfab5fbfd4dfde3c69b37b9d", "score": "0.5143633", "text": "func New() (*LogOnly, error) {\n\n\tonce.Do(func() {\n\t\tclient = &LogOnly{\n\t\t\tlogger: log.With().Str(\"pkg\", \"dest-log\").Logger(),\n\t\t}\n\t})\n\n\treturn client, nil\n}", "title": "" }, { "docid": "7c15943c2bdc8bad0139a3a30e1d5242", "score": "0.5128351", "text": "func UseLogger(newLogger log.LoggerInterface) {\n\tlogger = newLogger\n}", "title": "" }, { "docid": "611ffb7c21a535506b3a58978e89bacc", "score": "0.5123277", "text": "func (um *AccountManager) CopySession() *mgo.Session {\n\treturn um.session.Copy()\n}", "title": "" }, { "docid": "5f6b170fb07847f72d30302ca0a350f4", "score": "0.5119426", "text": "func newLogger(cfg *LoggerConfig) *zap.Logger {\n\tif len(cfg.Filename) == 0 {\n\t\treturn debugLogger(cfg.Options.ZapOptions...)\n\t}\n\n\tc := zap.NewProductionEncoderConfig()\n\n\tc.TimeKey = \"time\"\n\tc.EncodeTime = MyTimeEncoder\n\tc.EncodeCaller = zapcore.FullCallerEncoder\n\n\tws := make([]zapcore.WriteSyncer, 0, 2)\n\n\tws = append(ws, zapcore.AddSync(&lumberjack.Logger{\n\t\tFilename: cfg.Filename,\n\t\tMaxSize: cfg.Options.MaxSize,\n\t\tMaxAge: cfg.Options.MaxAge,\n\t\tMaxBackups: cfg.Options.MaxBackups,\n\t\tCompress: cfg.Options.Compress,\n\t\tLocalTime: true,\n\t}))\n\n\tif cfg.Options.Stderr {\n\t\tws = append(ws, zapcore.Lock(os.Stderr))\n\t}\n\n\tcore := zapcore.NewCore(zapcore.NewJSONEncoder(c), zapcore.NewMultiWriteSyncer(ws...), zap.DebugLevel)\n\n\treturn zap.New(core, cfg.Options.ZapOptions...)\n}", "title": "" }, { "docid": "e6bc487fa0729806836c8ea08de671c6", "score": "0.5113153", "text": "func newLogger() *logrus.Logger {\n\tif Log != nil {\n\t\treturn Log\n\t}\n\tLog = logrus.New()\n\n\tConf := config.Conf\n\tif Conf == nil {\n\t\tfmt.Println(\"加载配置文件conf.ini失败。请检查当前目录下是否存在该文件。\")\n\t\tos.Exit(-1)\n\t}\n\n\tlogPath := Conf.LogPath\n\tlogName := Conf.LogName\n\n\tConfigLocalFilesystemLogger(logPath, logName, time.Hour*24*365, time.Hour*24)\n\n\treturn Log\n}", "title": "" }, { "docid": "17ad40b97fe1c71c552faa0c1417dd8b", "score": "0.5112359", "text": "func newLogger(format OutputFormat, verbose bool) log.Logger {\n\tvar writer io.Writer\n\n\tswitch format {\n\tcase OutputFormatJSON:\n\t\twriter = zerolog.SyncWriter(os.Stdout)\n\tcase OutputFormatText:\n\t\twriter = log.NewWriter()\n\t}\n\n\treturn log.NewLogger(log.Args{\n\t\tVerbose: verbose,\n\t\tWriter: writer,\n\t},\n\t)\n}", "title": "" }, { "docid": "e7200e2923ee0484fb753d7437cceac3", "score": "0.5111709", "text": "func ExportLogger(logger *Logger) {\n if logger != nil {\n gLogger = logger\n }\n}", "title": "" }, { "docid": "22f5654bb32cd8fc4a0bd487568f6c66", "score": "0.51085335", "text": "func OverrideWithNewLogger(logger Logger, format, level string) error {\n\tol, ok := logger.(*defaultLogger)\n\tif !ok {\n\t\treturn fmt.Errorf(\"logger %T cannot be overridden\", logger)\n\t}\n\n\tnewLogger, err := NewDefaultLogger(format, level)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnl, ok := newLogger.(*defaultLogger)\n\tif !ok {\n\t\treturn fmt.Errorf(\"logger %T cannot be overridden by %T\", logger, newLogger)\n\t}\n\n\tol.Logger = nl.Logger\n\treturn nil\n}", "title": "" }, { "docid": "ad85ecb26cc47cdeb7e7b89735f3502e", "score": "0.5107799", "text": "func (c *Client) Logger() stdlog.StdLog { return c.log }", "title": "" }, { "docid": "aadff7912d92e628930fc16c5c405000", "score": "0.5084878", "text": "func newLogger(l zapcore.Level) (*zap.SugaredLogger, zap.AtomicLevel) {\n\tatom := zap.NewAtomicLevel()\n\tatom.SetLevel(l)\n\terrorMessage := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\treturn lvl >= zapcore.ErrorLevel && lvl >= atom.Level()\n\t})\n\n\tinfoMessage := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\treturn lvl < zapcore.ErrorLevel && lvl >= atom.Level()\n\t})\n\n\tconsoleInfo := zapcore.Lock(os.Stdout)\n\tconsoleErrors := zapcore.Lock(os.Stderr)\n\n\tencoderConfig := zap.NewProductionEncoderConfig()\n\tencoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder\n\tconsoleEncoder := zapcore.NewConsoleEncoder(encoderConfig)\n\n\tcore := zapcore.NewTee(\n\t\tzapcore.NewCore(consoleEncoder, consoleErrors, errorMessage),\n\t\tzapcore.NewCore(consoleEncoder, consoleInfo, infoMessage),\n\t)\n\n\tlogger := zap.New(core)\n\tzap.RedirectStdLog(logger)\n\treturn logger.Sugar(), atom\n}", "title": "" }, { "docid": "4b1b9bcf4114d7d883004a77647f3899", "score": "0.50789845", "text": "func UseLogger(logger *cl.SubSystem) {\n\tLog = logger\n\tlog = Log.Ch\n}", "title": "" }, { "docid": "1e78bfb97ee3639d5e5e34d5a5301a2b", "score": "0.5074603", "text": "func restoreLogger(previousLogger log.FieldLogger) {\n\tlogger = previousLogger\n}", "title": "" }, { "docid": "cf65c1a04fb9e435c2cc9947c1e7ee84", "score": "0.5051841", "text": "func UseLogger(\n\tlogger *cl.SubSystem) {\n\n\tLog = logger\n\tlog = Log.Ch\n}", "title": "" }, { "docid": "527a86546a0d60ef8fecefa33d75dd4b", "score": "0.5027801", "text": "func NewLogger(wc io.WriteCloser, verbose bool) *Logger {\n\t// by default just write to file\n\tvar w io.Writer\n\tw = wc\n\tif verbose {\n\t\tw = io.MultiWriter(wc, os.Stdout)\n\t}\n\treturn &Logger{\n\t\tcloser: wc,\n\t\tlogger: log.New(w, \"[Filecoin Migration] \", log.LstdFlags),\n\t}\n}", "title": "" }, { "docid": "0630cd73c70cc19b8d7987e27fd917a5", "score": "0.5025814", "text": "func (c *LogContext) Clone() Context {\n\ta := *c\n\treturn &a\n}", "title": "" }, { "docid": "36eb85def3997544e9ccaf1d7f9cf9e5", "score": "0.50196266", "text": "func cloneAppendLog(log []types.InstanceControlLogEntry, entries ...types.InstanceControlLogEntry) []types.InstanceControlLogEntry {\n\tfor _, entry := range entries {\n\t\tlog = append(log, entry.Clone())\n\t}\n\treturn log\n}", "title": "" }, { "docid": "76f27d8db7296768713bcb59fc4f83f8", "score": "0.5010134", "text": "func useLogger(logger seelog.LoggerInterface) {\n\tlog = logger\n}", "title": "" }, { "docid": "76f27d8db7296768713bcb59fc4f83f8", "score": "0.5010134", "text": "func useLogger(logger seelog.LoggerInterface) {\n\tlog = logger\n}", "title": "" }, { "docid": "2d3d621e183390d1e0068acb0a4b5bae", "score": "0.5005524", "text": "func new() *log.Logger {\n\tvar err error\n\tfile, err = os.OpenFile(fmt.Sprintf(\"%s/%s.log\", config.Main.LoggerFile, time.Now().Format(\"2006-01-02\")),\n\t\tos.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn log.New(file, \"\", log.LstdFlags)\n}", "title": "" }, { "docid": "a5ff00d7b9bb1e69b6b9a3cb7898d25f", "score": "0.5000449", "text": "func (alog *AppLogger) New(requestID string) Logger {\n\t// shortcut\n\talog.mux.RLock()\n\tif alog.requestID == requestID {\n\t\talog.mux.RUnlock()\n\n\t\treturn alog\n\t}\n\tdefer alog.mux.RUnlock()\n\n\tlg := alog.pool.Get()\n\tif nlog, ok := lg.(*AppLogger); ok {\n\t\tnlog.requestID = requestID\n\t\tnlog.SetTags(requestID)\n\n\t\treturn nlog\n\t}\n\n\treturn lg.(Logger).New(requestID)\n}", "title": "" }, { "docid": "e457b2f7f9a06d0e3c95518611662c9e", "score": "0.49880663", "text": "func (in *Logging) DeepCopy() *Logging {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Logging)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e457b2f7f9a06d0e3c95518611662c9e", "score": "0.49880663", "text": "func (in *Logging) DeepCopy() *Logging {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Logging)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4bf64cf60921f8b712779224070be80b", "score": "0.49795482", "text": "func New(output io.Writer) *Golog {\n\n\t//Create a default logger having as output destination the writer passed in the constructor.\n\t//All loggers will use this writer unless it is excplicitly overwrited by set*Output() functions\n\tlogger = log.New(output, \"\", 0)\n\n\tstopChan = make(chan struct{})\n\n\tch = make(chan channelMessage, 10)\n\n\t// infoChan = make(chan channelMessage, 10)\n\t// debugChan = make(chan channelMessage, 10)\n\t// errorChan = make(chan channelMessage, 10)\n\n\tgolog = &Golog{\n\t\tShowTimestamp: true,\n\t\tShowPrefix: true,\n\t\tShowCallerInfo: true,\n\t\tOut: output,\n\t\tLogger: logger,\n\t\tLogLevel: DEBUG,\n\t\tChann: ch,\n\t\t// Info: infoChan,\n\t\t// Debug: debugChan,\n\t\t// Error: errorChan,\n\t}\n\n\tgo golog.consume(stopChan)\n\n\treturn golog\n}", "title": "" }, { "docid": "50638dc67eca6c845992d38e8780ec4b", "score": "0.49746773", "text": "func new(name string, systemLog bool, logFile io.Writer, opts ...LogOption) *logger {\n\tvar dl, il, wl, el, pl io.Writer\n\tvar syslogErr error\n\tdLogs, iLogs, wLogs, eLogs, pLogs := []io.Writer{}, []io.Writer{}, []io.Writer{}, []io.Writer{}, []io.Writer{}\n\n\tif systemLog {\n\t\tdl, il, wl, el, pl, syslogErr = setup(name)\n\t}\n\n\tif logFile != nil {\n\t\tdLogs = append(dLogs, logFile)\n\t\tiLogs = append(iLogs, logFile)\n\t\twLogs = append(wLogs, logFile)\n\t\teLogs = append(eLogs, logFile)\n\t\tpLogs = append(pLogs, logFile)\n\t}\n\n\tif dl != nil {\n\t\tdLogs = append(dLogs, il)\n\t}\n\tif il != nil {\n\t\tiLogs = append(iLogs, il)\n\t}\n\tif wl != nil {\n\t\twLogs = append(wLogs, wl)\n\t}\n\tif el != nil {\n\t\teLogs = append(eLogs, el)\n\t}\n\tif pl != nil {\n\t\tpLogs = append(pLogs, pl)\n\t}\n\n\tl := logger{\n\t\tformatter: StdFormatter{},\n\t\tflags: LstdFlags,\n\t\tfields: LogFields{},\n\t\tlevel: LevelDefault,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&l)\n\t}\n\n\t// Windows services don't have stdout/stderr. Writes will fail, so try them last.\n\tdLogs = append(dLogs, os.Stdout)\n\tiLogs = append(iLogs, os.Stdout)\n\twLogs = append(wLogs, os.Stdout)\n\teLogs = append(eLogs, os.Stderr)\n\tpLogs = append(pLogs, os.Stderr)\n\n\tprefixDebug, prefixInfo, prefixWaring, prefixError, prefixPanic, prefixFatal := tagDebug, tagInfo, tagWarning, tagError, tagPanic, tagFatal\n\tif l.formatter.HasFlags() {\n\t\tl.flags = l.formatter.Flags()\n\t}\n\tif l.formatter.HasPrefixes() {\n\t\tprefixes := l.formatter.Prefixes()\n\t\tprefixDebug = prefixes[LevelDebug]\n\t\tprefixInfo = prefixes[LevelInfo]\n\t\tprefixWaring = prefixes[LevelWaring]\n\t\tprefixError = prefixes[LevelError]\n\t\tprefixPanic = prefixes[LevelPanic]\n\t\tprefixFatal = prefixes[LevelFatal]\n\t}\n\n\tl.debugLog = log.New(io.MultiWriter(dLogs...), prefixDebug, l.flags)\n\tl.infoLog = log.New(io.MultiWriter(iLogs...), prefixInfo, l.flags)\n\tl.warningLog = log.New(io.MultiWriter(wLogs...), prefixWaring, l.flags)\n\tl.errorLog = log.New(io.MultiWriter(eLogs...), prefixError, l.flags)\n\tl.panicLog = log.New(io.MultiWriter(pLogs...), prefixPanic, l.flags)\n\tl.fatalLog = log.New(io.MultiWriter(eLogs...), prefixFatal, l.flags)\n\n\tfor _, w := range []io.Writer{logFile, il, wl, el, pl} {\n\t\tif c, ok := w.(io.Closer); ok && c != nil {\n\t\t\tl.closers = append(l.closers, c)\n\t\t}\n\t}\n\n\tl.initialized = true\n\n\tif syslogErr != nil {\n\t\tl.Error(syslogErr)\n\t}\n\n\tlogLock.Lock()\n\tdefer logLock.Unlock()\n\tif !defaultLogger.initialized {\n\t\tdefaultLogger = &l\n\t}\n\n\treturn &l\n}", "title": "" }, { "docid": "05d6477d60ea0b938f324e23e57861f1", "score": "0.49729812", "text": "func (o LoggerOpts) Logger(global bool) zerolog.Logger {\n\tvar logout io.Writer = os.Stderr\n\tlvl, _ := zerolog.ParseLevel(o.LogLevel)\n\tif o.LogFormat == \"logfmt\" {\n\t\tlogout = zerolog.ConsoleWriter{Out: logout}\n\t}\n\n\tlg := zerolog.New(logout).Level(lvl).With().Timestamp().Logger()\n\tif global {\n\t\tlog.SetOutput(lg)\n\t}\n\treturn lg\n}", "title": "" }, { "docid": "8d07ed0d11aff1f6d65436faaff2cc8d", "score": "0.49397674", "text": "func NewLogBackend(out io.Writer, prefix string, flag int) *LogBackend {\n\tb := &LogBackend{Logger: log.New(out, prefix, flag)}\n\n\t// Unfortunately, the API used only takes an io.Writer where the Windows API\n\t// need the actual fd to change colors.\n\tif f, ok := out.(file); ok {\n\t\tb.f = f\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "238a43d77dd73387e660f268b89959cf", "score": "0.4925561", "text": "func NewNopLogger() Logger { return nopLogger{} }", "title": "" }, { "docid": "9a2790a2d076b86c7cf360fbaed57de3", "score": "0.4914701", "text": "func useLogger(l logr.Logger) {\n\tlogger = WrapLogger(l)\n}", "title": "" }, { "docid": "57053000640e5d7fd80d8aab0c170bdb", "score": "0.49126354", "text": "func UseLogger(newLogger seelog.LoggerInterface) {\n\tLogger = newLogger\n}", "title": "" }, { "docid": "57053000640e5d7fd80d8aab0c170bdb", "score": "0.49126354", "text": "func UseLogger(newLogger seelog.LoggerInterface) {\n\tLogger = newLogger\n}", "title": "" }, { "docid": "da76428db0a0eca3f48c1caa76d5eb3f", "score": "0.49123043", "text": "func logWrap(c client.Client) client.Client {\n return &logWrapper{c}\n}", "title": "" }, { "docid": "0e372d8329cbd0f8b2889359b0bd4d12", "score": "0.4911299", "text": "func initLog(l *logrus.Logger) {\n\tif l != nil {\n\t\tlog = l\n\t\tlogDebug(funcName(), \"Use the logger pass in New\")\n\t\treturn\n\t}\n\n\tlog = logrus.New()\n\n\tlogDebug(funcName(), \"Create new logger\")\n\n\tlog.Formatter = new(logrus.TextFormatter)\n\n\tfile, err := os.OpenFile(logFile, os.O_CREATE|os.O_WRONLY, 0666)\n\tcheckErr(err, funcName(), \"Failed to log to file, using default stderr\")\n\n\tlog.Out = file\n}", "title": "" }, { "docid": "1bde5e89ecd0a6979bf5a033972fc06a", "score": "0.49003887", "text": "func SetGlobal(out interface{}) func() {\n\told := log.L()\n\tvar new log.Logger\n\tswitch out.(type) {\n\tcase *testing.T:\n\t\tnew = New(out.(*testing.T))\n\tcase io.Writer:\n\t\tnew = log.NewSimpleLogger(log.SimpleConfig{\n\t\t\tLevel: level.Min,\n\t\t\tOutput: out.(io.Writer),\n\t\t})\n\tdefault:\n\t\tpanic(\"unsupported output type\")\n\t}\n\tlog.Set(new)\n\treturn func() {\n\t\tlog.Set(old)\n\t}\n}", "title": "" }, { "docid": "ec428c0ec18eb311a5f8101786f90234", "score": "0.48956692", "text": "func makeLogger(out io.Writer, app, env string) log.Logger {\n\ttimeFormat := log.DefaultTimestampUTC\n\tif isDev(env) {\n\t\ttimeFormat = log.TimestampFormat(time.Now, \"15:04:05.000000\")\n\t}\n\n\tlogger := log.NewLogfmtLogger(log.NewSyncWriter(out))\n\tlogger = log.With(logger, \"service\", app)\n\tlogger = log.With(logger, \"time\", timeFormat)\n\n\t/*\n\t\twrapper := logger\n\t\tif isDev(env) {\n\t\t\twrapper = log.With(logger, \"caller\", log.Caller(6))\n\t\t\tlogger = log.With(logger, \"caller\", log.DefaultCaller)\n\t\t}\n\t*/\n\tstdwrapper := logAdapter{logger}\n\n\t// add location information in dev output\n\tif isDev(env) {\n\t\tlogger = log.With(logger, \"caller\", log.DefaultCaller)\n\t\tstdwrapper.logger = log.With(stdwrapper.logger, \"caller\", log.Caller(6))\n\t}\n\n\t//stdlog.SetOutput(log.NewStdlibAdapter(logger, log.TimestampKey(\"time\")))\n\tstdlog.SetFlags(0)\n\tstdlog.SetPrefix(\"\")\n\tstdlog.SetOutput(&stdwrapper)\n\n\treturn logger\n}", "title": "" }, { "docid": "dd2de0a42bbd11a08c78152f6323fffb", "score": "0.4894247", "text": "func (m *LogManager) NewLogger() *zap.SugaredLogger {\n\tvar rnd [2]byte\n\n\trand.Read(rnd[:]) //nolint:errcheck\n\n\tw := &internalLogger{\n\t\tm: m,\n\t\tprefix: blob.ID(fmt.Sprintf(\"%v%v_%x\", BlobPrefix, clock.Now().Local().Format(\"20060102150405\"), rnd)),\n\t}\n\n\treturn zap.New(zapcore.NewCore(\n\t\tzaplogutil.NewStdConsoleEncoder(zaplogutil.StdConsoleEncoderConfig{\n\t\t\tTimeLayout: zaplogutil.PreciseLayout,\n\t\t\tLocalTime: false,\n\t\t}),\n\t\tw, zap.DebugLevel), zap.WithClock(zaplogutil.Clock())).Sugar()\n}", "title": "" }, { "docid": "dff7baa0333f22857ba64bfea1310b56", "score": "0.48908854", "text": "func (self *Tree) Log(dir string) *Tree {\n\tself.logger = persistence.NewLogger(dir)\n\t<-self.logger.Record()\n\treturn self\n}", "title": "" }, { "docid": "dc10c55003f3ef5a698180bdef5fce9f", "score": "0.4890411", "text": "func New(out io.Writer, prefix string, flag int, l LoggerLevel) *LeveledLogger {\n\treturn &LeveledLogger{logger: *log.New(out, prefix, flag), level: l}\n}", "title": "" }, { "docid": "3bf447ab019b0f462982543c86b90712", "score": "0.48893374", "text": "func Logger() common.Logger {\n\tloggerMu.RLock()\n\tdefer loggerMu.RUnlock()\n\n\tloggerOnce.Do(func() {\n\t\tlogger = newLogger()\n\t})\n\n\treturn logger\n}", "title": "" }, { "docid": "470cab778e0ae91c49d23dbeedad836a", "score": "0.48848504", "text": "func newSession(c client.Client, name string, ch chan<- message.One, dch chan<- disconMsg) *session {\n\treturn &session{\n\t\tc: c,\n\t\tname: name,\n\t\tchatChannelChan: ch,\n\t\tdisconChan: dch,\n\t}\n}", "title": "" }, { "docid": "29b69ab70a7d211336851ae04493d374", "score": "0.48752663", "text": "func SetLogger(ctx context.Context, logger *logrus.Entry) {\n\tfields := rootlessLog.Data\n\trootlessLog = logger.WithFields(fields)\n}", "title": "" }, { "docid": "2587d32bce1691041ce62bc16d5d87a9", "score": "0.4866971", "text": "func New() *Logger {\n\treturn &Logger{\n\t\tLevel: InfoLevel,\n\t\tTimeFormat: \"2006/01/02 15:04\",\n\t\tNewLine: true,\n\t\tPrinter: pio.NewPrinter(\"\", os.Stdout).EnableDirectOutput().Hijack(logHijacker),\n\t\t// children: newLoggerMap(),\n\t}\n}", "title": "" }, { "docid": "243e8d53aba705ba51e7d4a5ddf6027a", "score": "0.4860955", "text": "func L() *Logger {\n\t_globalMu.RLock()\n\tl := _globalL\n\t_globalMu.RUnlock()\n\treturn l\n}", "title": "" }, { "docid": "54867c9fb0e4acdd3fc6c4da5a60c13f", "score": "0.48594785", "text": "func TestNewOverwrites(t *testing.T) {\n\tclearLoggers()\n\tlogger := Get(\"logger 1\")\n\tlogger.AddHandler(\"h\", &testHandler{})\n\tlogger.AddHandler(\"h1\", &testHandler{})\n\thandlers := len(logger.handlers)\n\n\tnewLogger := New(\"logger 1\")\n\tif len(newLogger.handlers) == handlers {\n\t\tt.Error(\"New didn't return a new logger. Returned logger with same number of handlers\")\n\t}\n}", "title": "" }, { "docid": "3550b6c12a719430fe136f8511100cb6", "score": "0.48546895", "text": "func New(w io.Writer) *Logger {\n\tlogger := &Logger{Out: w}\n\tlogger.SetLevel(DebugLevel)\n\tlogger.SetTimeFormat(\"2006-01-02T15:04:05.000Z\")\n\tlogger.SetLogFormat(\"[%s] %s %s\")\n\n\tlogger.init = func(log Log, ctx *gear.Context) {\n\t\tlog[\"start\"] = ctx.StartAt.Format(logger.tf)\n\t\tlog[\"ip\"] = ctx.IP().String()\n\t\tlog[\"scheme\"] = ctx.Scheme()\n\t\tlog[\"proto\"] = ctx.Req.Proto\n\t\tlog[\"method\"] = ctx.Method\n\t\tlog[\"uri\"] = ctx.Req.RequestURI\n\t\tif s := ctx.GetHeader(gear.HeaderUpgrade); s != \"\" {\n\t\t\tlog[\"upgrade\"] = s\n\t\t}\n\t\tif s := ctx.GetHeader(gear.HeaderOrigin); s != \"\" {\n\t\t\tlog[\"origin\"] = s\n\t\t}\n\t\tif s := ctx.GetHeader(gear.HeaderReferer); s != \"\" {\n\t\t\tlog[\"referer\"] = s\n\t\t}\n\t\tif s := ctx.GetHeader(gear.HeaderXCanary); s != \"\" {\n\t\t\tlog[\"xCanary\"] = s\n\t\t}\n\t\tlog[\"userAgent\"] = ctx.GetHeader(gear.HeaderUserAgent)\n\t}\n\n\tlogger.consume = func(log Log, ctx *gear.Context) {\n\t\tend := time.Now().UTC()\n\t\tlog[\"duration\"] = end.Sub(ctx.StartAt) / 1e6 // ms\n\n\t\tif s := ctx.GetHeader(gear.HeaderXRequestID); s != \"\" {\n\t\t\tlog[\"xRequestId\"] = s\n\t\t} else if s := ctx.Res.Get(gear.HeaderXRequestID); s != \"\" {\n\t\t\tlog[\"xRequestId\"] = s\n\t\t}\n\n\t\tif router := gear.GetRouterPatternFromCtx(ctx); router != \"\" {\n\t\t\tlog[\"router\"] = fmt.Sprintf(\"%s %s\", ctx.Method, router)\n\t\t}\n\n\t\tif err := logger.output(end, InfoLevel, log); err != nil {\n\t\t\tlogger.output(end, ErrLevel, err)\n\t\t}\n\t}\n\treturn logger\n}", "title": "" }, { "docid": "457b16f0fc7cf2328909cf12dc2f804a", "score": "0.48499295", "text": "func ApplyLogger(newlogger func() kitlog.Logger) midway.Middleware {\n\treturn func(inner http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\treqID := r.Header.Get(\"X-Request-ID\")\n\t\t\tlogger := newlogger()\n\t\t\tlogger = kitlog.With(\n\t\t\t\tlogger,\n\t\t\t\t\"request_id\", reqID,\n\t\t\t)\n\n\t\t\t// access log\n\t\t\tlogger.Log(\n\t\t\t\t\"at\", \"info\",\n\t\t\t\t\"method\", r.Method,\n\t\t\t\t\"path\", r.URL.Path,\n\t\t\t\t\"protocol\", r.URL.Scheme,\n\t\t\t\t\"remote_addr\", r.RemoteAddr,\n\t\t\t)\n\n\t\t\tinner.ServeHTTP(w, r.WithContext(WithLogger(r.Context(), logger)))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "8abd14f8fb7ddc16422fc1fc7252c71f", "score": "0.48493353", "text": "func New() logger.Logger {\n\treturn new(nopLogger)\n}", "title": "" }, { "docid": "014e4bf416c40836b4e3901879e53173", "score": "0.4845724", "text": "func New(info logger.Info) (logger.Logger, error) {\n\tlog.G(context.TODO()).WithField(\"container\", info.ContainerID).\n\t\tWithField(\"token\", info.Config[token]).\n\t\tWithField(\"line-only\", info.Config[lineonly]).\n\t\tDebug(\"logging driver logentries configured\")\n\n\tlog, err := le_go.Connect(info.Config[token])\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error connecting to logentries\")\n\t}\n\tvar lineOnly bool\n\tif info.Config[lineonly] != \"\" {\n\t\tif lineOnly, err = strconv.ParseBool(info.Config[lineonly]); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error parsing lineonly option\")\n\t\t}\n\t}\n\treturn &logentries{\n\t\tcontainerID: info.ContainerID,\n\t\tcontainerName: info.ContainerName,\n\t\twriter: log,\n\t\tlineOnly: lineOnly,\n\t}, nil\n}", "title": "" }, { "docid": "8c1ac5f9a342abfaba5bcf1260e6e092", "score": "0.48451063", "text": "func newSession() *Session {\n\treturn &Session{\n\t\tId: connections.getNewSessionUUID(),\n\t\tlastTime: time.Now().Unix()}\n}", "title": "" }, { "docid": "a09a8e2bb229babbbbbda45c038f6815", "score": "0.4843356", "text": "func (m *SyslogAuditor) Clone(into interface{}) (interface{}, error) {\n\tvar out *SyslogAuditor\n\tvar ok bool\n\tif into == nil {\n\t\tout = &SyslogAuditor{}\n\t} else {\n\t\tout, ok = into.(*SyslogAuditor)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"mismatched object types\")\n\t\t}\n\t}\n\t*out = *(ref.DeepCopy(m).(*SyslogAuditor))\n\treturn out, nil\n}", "title": "" }, { "docid": "5900bb8d940821d5b698944521eb01d5", "score": "0.4842572", "text": "func New(sink Sink, lv Level) *Logger {\n\treturn &Logger{level: &lv, sink: sink}\n}", "title": "" }, { "docid": "b4e5909ecd6a727e4c23c9cd1f1f157b", "score": "0.48390317", "text": "func CastToLogger(object *gobject.Object) *Logger {\n\treturn LoggerNewFromC(object.ToC())\n}", "title": "" }, { "docid": "19fe09eca1fc380f45b0800bc9db7ba6", "score": "0.48329225", "text": "func Logger(ctx context.Context) *zap.SugaredLogger {\n\tnewLogger := logger\n\tif ctx != nil {\n\t\tif ctxHTTPReqID, ok := ctx.Value(cmnCtx.HTTPReqIDKey).(string); ok {\n\t\t\tnewLogger = newLogger.With(zap.String(cmnCtx.HTTPReqIDKey.String(), ctxHTTPReqID))\n\t\t}\n\t\tif ctxHTTPSessID, ok := ctx.Value(cmnCtx.HTTPSessIDKey).(string); ok {\n\t\t\tnewLogger = newLogger.With(zap.String(cmnCtx.HTTPSessIDKey.String(), ctxHTTPSessID))\n\t\t}\n\t\tif ctxBNISessID, ok := ctx.Value(cmnCtx.SessIDKey).(string); ok {\n\t\t\tnewLogger = newLogger.With(zap.String(cmnCtx.SessIDKey.String(), ctxBNISessID))\n\t\t}\n\t}\n\treturn newLogger\n}", "title": "" }, { "docid": "499f76046b02d44130c89aa3e2a49c84", "score": "0.4832902", "text": "func Changelogger() {\n\tnow := time.Now()\n\t//next := now.Add(time.Hour * 24)\n\t//next = time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())\n\tnext := now.Add(time.Hour * 24)\n\tnext = time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())\n\n\tt := time.NewTimer(next.Sub(now))\n\tfor {\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\tfmt.Printf(\"create a new logger at: %v\\n\",time.Now())\n\t\t\tFileMap[pkgLogID].Close()\n\t\t\tInitBackendDaily()\n\t\t\t//t.Reset(time.Hour*24)\n\t\t\tt.Reset(time.Hour*24)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bc104858f859493b3e8b2f562b27e208", "score": "0.48309952", "text": "func NewLogger() log.Logger {\n\tif logger != nil {\n\t\treturn logger\n\t}\n\tfilepath := \"dataCollector.log\"\n\tfileMode := os.O_APPEND\n\n\tfileHandler, err := log.NewFileHandler(filepath, fileMode, 0)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\thandler := log.NewStdoutHandler()\n\tformat := \"%(asctime)s %(levelname)s (%(filename)s:%(lineno)d) \" +\n\t\t\"%(name)s %(message)s\"\n\tdateFormat := \"%Y-%m-%d %H:%M:%S.%3n\"\n\tformatter := log.NewStandardFormatter(format, dateFormat)\n\thandler.SetFormatter(formatter)\n\tfileHandler.SetFormatter(formatter)\n\n\tlogger = log.GetLogger(\"dataCollector\")\n\tlogger.SetLevel(log.LevelDebug)\n\tlogger.AddHandler(handler)\n\tlogger.AddHandler(fileHandler)\n\n\tlogger.Debug(\"Logger skonfigurowany\")\n\n\treturn logger\n}", "title": "" }, { "docid": "5336be2d3d731261b1523a64cd327607", "score": "0.48301753", "text": "func (l *Logger) openNew() error {\n\terr := os.MkdirAll(l.currentLogDir(), 0744)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't make directory for new logfile: %s\", err)\n\t}\n\terr = os.MkdirAll(l.archiveDir(), 0744)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't make directory for rotated logfiles: %s\", err)\n\t}\n\tname := l.filename()\n\n\tmode := os.FileMode(0644)\n\tinfo, err := os_Stat(name)\n\tif err == nil {\n\t\t// Copy the mode off the old logfile.\n\t\tmode = info.Mode()\n\t\t// move the existing file\n\t\tnewname := backupName(name, l.archiveDir(), l.LocalTime)\n\t\tif err := os.Rename(name, newname); err != nil {\n\t\t\treturn fmt.Errorf(\"can't rename log file: %s\", err)\n\t\t}\n\t\t//fmt.Printf(\"openNew has renamed %s -> %s\\n\", name, newname)\n\n\t\t// this is a no-op anywhere but linux\n\t\tif err := chown(name, info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// we use truncate here because this should only get called when we've moved\n\t// the file ourselves. if someone else creates the file in the meantime,\n\t// just wipe out the contents.\n\tf, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't open new logfile: %s\", err)\n\t}\n\tl.file = f\n\tl.size = 0\n\n\t// replay the Preamble, so that the original version/config\n\t// lines (the first l.PreambleLineCount lines logged) are retained at\n\t// the top of each log file.\n\tif len(l.Preamble) > 0 {\n\t\tfor i := range l.Preamble {\n\t\t\twriteme := []byte(l.Preamble[i])\n\t\t\tn, err := l.file.Write(writeme)\n\t\t\tl.size += int64(n)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tn, err := l.file.WriteString(\"___***___END_OF_PREAMBLE___***___\\n\")\n\t\tl.size += int64(n)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8fe53c590d212635ac03cb57abc257ee", "score": "0.48292166", "text": "func Log() *log.Logger {\n\treturn logger\n}", "title": "" }, { "docid": "7289383f364d920b47f7673e69c4aaf5", "score": "0.48225752", "text": "func logger() *logrus.Logger {\n\tif l == nil {\n\t\tl = logrus.New()\n\t\tif os.Getenv(\"ENV\") == \"production\" {\n\t\t\tl.SetFormatter(&logrus.JSONFormatter{})\n\t\t\tl.SetOutput(os.Stdout)\n\t\t} else {\n\t\t\tl.SetFormatter(&logrus.TextFormatter{\n\t\t\t\tFullTimestamp: true,\n\t\t\t\tForceColors: true,\n\t\t\t\tDisableQuote: true,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "ef1176b3cba7704d1ed7949aac8e0520", "score": "0.48220035", "text": "func StdLogger() *Logger {\n\treturn l\n}", "title": "" }, { "docid": "94bb2933458198ced4e890d5745545a3", "score": "0.4818064", "text": "func newLogger() *logrus.Logger {\n\tlevel := config.Get(\"log\", \"level\").String(\"info\")\n\tformat := config.Get(\"log\", \"format\").String(\"text\")\n\tlslog := logrus.New()\n\n\tlogLevel, err := logrus.ParseLevel(level)\n\tif err != nil {\n\t\tlogLevel = logrus.InfoLevel\n\t}\n\tlslog.SetLevel(logLevel)\n\n\tif format == \"json\" {\n\t\tlslog.SetFormatter(&logrus.JSONFormatter{})\n\t} else {\n\t\tlslog.SetFormatter(&logrus.TextFormatter{\n\t\t\tForceColors: true,\n\t\t\tFullTimestamp: true,\n\t\t})\n\t}\n\n\tlslog.WithFields(logrus.Fields{\n\t\t\"logLevel\": logLevel,\n\t\t\"format\": format,\n\t}).Info(\"Logger set to Logrus with:\")\n\n\treturn lslog\n}", "title": "" }, { "docid": "54682080afb1949a0f15120d73694a38", "score": "0.48140547", "text": "func InitNewLogger(outInterface io.Writer, level int) {\n\tlogLevel = level\n\n\tdebugLog.SetOutput(outInterface)\n\tinfoLog.SetOutput(outInterface)\n\twarningLog.SetOutput(outInterface)\n\terrorLog.SetOutput(outInterface)\n\n\tgo listenLogChannel(debugLog, debugLogChannel)\n\tgo listenLogChannel(errorLog, errorLogChannel)\n\tgo listenLogChannel(warningLog, warningLogChannel)\n\tgo listenLogChannel(infoLog, infoLogChannel)\n}", "title": "" }, { "docid": "c4949648f7be32707f8e938086b67db9", "score": "0.4813218", "text": "func New(prefix string) Logger {\n\tl, err := logging.GetLogger(prefix)\n\tif err != nil {\n\t\t// use std logger\n\t\treturn &stdLogger{}\n\t}\n\n\treturn &gologger{\n\t\tLogger: l,\n\t}\n}", "title": "" }, { "docid": "8face17f210e0338e246b20c248cd29d", "score": "0.4810523", "text": "func Logger() *Log {\n\treturn newLog()\n}", "title": "" }, { "docid": "de2b7f49de90f14dae4a2194688154b7", "score": "0.48104963", "text": "func (ls LogSet) Child(name string) LogSink {\n\tchild := newls(ls.name+\".\"+name, ls.appRole, ls.level, ls.dumpBundle)\n\tchild.metrics = metrics.NewPrefixedChildRegistry(ls.metrics, name+\".\")\n\treturn child\n}", "title": "" }, { "docid": "dfdefa8d8616f9a2e325765906b80d86", "score": "0.4810252", "text": "func createTgLoggerInstance() *tlogger.TgLogger {\n\t//once.Do(func() {\n\ttgToken := os.Getenv(\"TELEGRAM_BOT_TOKEN\")\n\ttgChatId, _ := strconv.ParseInt(os.Getenv(\"TELEGRAM_LOG_CHAT_ID\"), 10, 64)\n\tlog.Println(\"Create new tg-logger\")\n\tvar err error\n\tlevel := \"info\"\n\tif isDebug {\n\t\tlevel = \"info\"\n\t}\n\ttgLogger, err = tlogger.NewLogger(level, tgToken, []int64{tgChatId})\n\tif err != nil {\n\t\tlog.Fatal(\"Problem with creating telegram-logger\")\n\t}\n\ttgLogger.SetName(\"WA Volley Bot\")\n\t//})\n\treturn tgLogger\n}", "title": "" }, { "docid": "df885b788ab76455277447f9daf700a8", "score": "0.48079818", "text": "func NewLogger() *Logger {\n\tl := &Logger{\n\t\tpc: make([]uintptr, 16),\n\t\tqueue: make(chan string, 2048),\n\t\tfatalQueue: make(chan string),\n\t\torderedSongsQueue: make(chan string, 2048),\n\t\tchipMoneyQueue: make(chan string, 2048),\n\t\trotate: make(chan bool),\n\t\treconfig: make(chan string),\n\t\tgzDir: `logs`,\n\t\torderedSongsFile: `ordered_songs.csv`,\n\t\tchipMoneyFile: `chip_money.csv`,\n\t}\n\n\tl.open()\n\tl.l = log.New(l.fd, `jukebox on `, log.LstdFlags)\n\n\treturn l\n}", "title": "" }, { "docid": "c03d4aa7b84dd69b1df51b04b7005df9", "score": "0.48020288", "text": "func (recv *Logger) Attach(session *Session) {\n\tc_session := (*C.SoupSession)(C.NULL)\n\tif session != nil {\n\t\tc_session = (*C.SoupSession)(session.ToC())\n\t}\n\n\tC.soup_logger_attach((*C.SoupLogger)(recv.native), c_session)\n\n\treturn\n}", "title": "" }, { "docid": "cb7d387247adca7dc3d6c4a8765cd10c", "score": "0.4800776", "text": "func (flags *SharedFlags) NewLogger(conf zap.Config, options ...zap.Option) (*zap.Logger, error) {\n\tvar level zapcore.Level\n\terr := (&level).UnmarshalText([]byte(flags.Logging.Level))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(flags.Logging.Path) != 0 {\n\t\tconf.OutputPaths = flags.Logging.Path\n\t\tconf.ErrorOutputPaths = flags.Logging.Path\n\t}\n\n\tconf.Level = zap.NewAtomicLevelAt(level)\n\treturn conf.Build(options...)\n}", "title": "" }, { "docid": "131580077e6e89c7ecc64e1cf9dadc70", "score": "0.47999406", "text": "func NewLogger(out io.Writer) *Logger {\n\treturn &Logger{out: out}\n}", "title": "" }, { "docid": "22fe5f96aff333c76bfa1a0570a5ba01", "score": "0.47937348", "text": "func (o *loginBase) Copy() (newObject *Login) {\n\tnewObject = NewLogin()\n\n\tif o.personIDIsValid {\n\t\tnewObject.SetPersonID(o.personID)\n\t}\n\tif o.usernameIsValid {\n\t\tnewObject.SetUsername(o.username)\n\t}\n\tif o.passwordIsValid {\n\t\tnewObject.SetPassword(o.password)\n\t}\n\tif o.isEnabledIsValid {\n\t\tnewObject.SetIsEnabled(o.isEnabled)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "99527569af7052a4b0233c1711f1448c", "score": "0.4791036", "text": "func newLogger(l *log.Logger) amqpextra.LoggerFunc {\n\t// prefixes of log lines from github.com/makasim/amqpextra\n\tvar (\n\t\tdebugPrefix = \"[DEBUG]\"\n\t\twarnPrefix = \"[WARN]\"\n\t\terrorPrefix = \"[ERROR]\"\n\t)\n\treturn func(format string, args ...interface{}) {\n\t\tif strings.HasPrefix(format, debugPrefix) {\n\t\t\tl.Debugf(strings.TrimPrefix(format, debugPrefix), args...)\n\t\t\treturn\n\t\t}\n\t\tif strings.HasPrefix(format, warnPrefix) {\n\t\t\tl.Infof(strings.TrimPrefix(format, warnPrefix), args...)\n\t\t\treturn\n\t\t}\n\t\tif strings.HasPrefix(format, errorPrefix) {\n\t\t\tl.Errorf(strings.TrimPrefix(format, errorPrefix), args...)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" } ]
faf7a8e3d26d47a1c41b64d25bec386c
UnmarshalText implements encoding.TextUnmarshaler interface.
[ { "docid": "7214499e30b2f525c8685d27111b1703", "score": "0.0", "text": "func (v *TxSchedulePriority) UnmarshalText(b []byte) error {\n\ts := string(b)\n\tif i, ok := TxSchedulePriority_value[s]; ok {\n\t\t*v = TxSchedulePriority(i)\n\t\treturn nil\n\t}\n\treturn errCouldNotParse(\"TxSchedulePriority\")(string(b))\n}", "title": "" } ]
[ { "docid": "a8b9c8c42aa0ac3217b72e33a81b2db2", "score": "0.77965015", "text": "func (c *EmbeddedFileContents) UnmarshalText(text []byte) (err error) {\n\tout := make([]byte, len(text))\n\twritten, _, err := ascii85.Decode(out, text, true)\n\tif err == nil {\n\t\t*c = out[:written]\n\t}\n\treturn\n}", "title": "" }, { "docid": "bb4075360b3a78e0bcc60e6159d06c2b", "score": "0.77770144", "text": "func (b *Bytes) UnmarshalText(text []byte) error {\n\tvar err error\n\t*b, err = ParseBytes(string(text))\n\treturn err\n}", "title": "" }, { "docid": "49c52ec5c5b17f24cd3985482604deb7", "score": "0.7648965", "text": "func (x *Code) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseCode(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "492c6355bcbdcdc4e355e0daf45479a7", "score": "0.75656444", "text": "func (a *Type) UnmarshalText(data []byte) error {\n\tstr := string(data)\n\tparsed, err := ParseType(str)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = parsed\n\treturn nil\n}", "title": "" }, { "docid": "7e590d89a9a85a83c1018f834f590c51", "score": "0.74962586", "text": "func DecodeText(raw []byte, v interface{}) error {\n\tswitch t := v.(type) {\n\tcase *string:\n\t\t*t = string(raw)\n\t\treturn nil\n\tcase *[]byte:\n\t\t*t = raw\n\t\treturn nil\n\tcase encoding.TextUnmarshaler:\n\t\treturn t.UnmarshalText(raw)\n\tdefault:\n\t\treturn fmt.Errorf(\"cannot decode %T into %T: %T does not implement encoding.TextUnmarshaller\", []byte{}, v, v)\n\t}\n}", "title": "" }, { "docid": "d4a6206d2348a4f8fed58b7870c4c6b4", "score": "0.74594545", "text": "func (t *Token) UnmarshalText(p []byte) error {\n\tn := codec.DecodedLen(len(p))\n\tif len(*t) < n {\n\t\t*t = append(*t, make([]byte, n-len(*t))...)\n\t}\n\t_, err := codec.Decode(*t, p)\n\treturn err\n}", "title": "" }, { "docid": "cb9288775b4dde4689262e1591b00768", "score": "0.7413076", "text": "func (mm *MeteringMode) UnmarshalText(text []byte) (err error) {\n\t*mm = mapStringMeteringMode[string(text)]\n\treturn nil\n}", "title": "" }, { "docid": "af4b5bd65b2c72b0bc4b8d686b4d5af2", "score": "0.7409938", "text": "func (m *Message) UnmarshalText(text []byte) error {\n\treturn m.Parse(string(text))\n}", "title": "" }, { "docid": "d8b376d736cf4e01fcd8773e50a31fb5", "score": "0.73884827", "text": "func (x *Event) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseEvent(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "e4c3357c34ff6239e8380da88323c353", "score": "0.73729116", "text": "func (receiver *Value) UnmarshalText(text []byte) error {\n\tif nil == receiver {\n\t\treturn errNilReceiver\n\t}\n\n\treturn receiver.Scan(text)\n}", "title": "" }, { "docid": "22e1493a5846b8314b48fcea82b2eded", "score": "0.73726165", "text": "func (f *fonteFamília) UnmarshalText(texto []byte) error {\n\tfonte, err := ioutil.ReadFile(string(texto))\n\tif err != nil {\n\t\treturn erros.Novo(err)\n\t}\n\n\tif f.Font, err = truetype.Parse(fonte); err != nil {\n\t\treturn erros.Novo(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39ebabd7f565b3dd79fef133817ab0fc", "score": "0.7348177", "text": "func (key *Signature) UnmarshalText(text []byte) error {\n\treturn key.Decode(string(text))\n}", "title": "" }, { "docid": "ebb9beb5a101829ded8211222cd725e6", "score": "0.7343441", "text": "func (x *Bytes) UnmarshalText(text []byte) error {\n\tdata, err := base64.RawURLEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = data\n\treturn nil\n}", "title": "" }, { "docid": "c21dcc0249e070f4754f46f09b8b51b0", "score": "0.7317245", "text": "func (v *Version) UnmarshalText(text []byte) error {\n\tvalue := string(text)\n\ttmp, err := ParseVersion(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv = tmp\n\treturn nil\n}", "title": "" }, { "docid": "51ade68672c9a66f30d63e728edfa4db", "score": "0.7289608", "text": "func (id *ID) UnmarshalText(b []byte) error {\n\treturn id.fillID(b)\n}", "title": "" }, { "docid": "3f821eca25a665b82d5a5c51436a5eb6", "score": "0.72815", "text": "func (b *Base64Binary) UnmarshalText(text []byte) error {\n\tbin, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*b = Base64Binary(bin)\n\treturn nil\n}", "title": "" }, { "docid": "b5b6100d97bd6443eb6522a8181941e0", "score": "0.7274483", "text": "func (i *TransportType) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = ParseTransportTypeString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "4f74a7076cda5f68acf4dbcb059bd664", "score": "0.7272338", "text": "func (bb *Bytes) UnmarshalText(b []byte) error {\n\ttmp, err := hex.DecodeString(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*bb = tmp\n\treturn nil\n}", "title": "" }, { "docid": "0b68629c5bb2e079daf35eee766b8255", "score": "0.7259319", "text": "func (i *ModelFormat) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = ModelFormatString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "d5eef8dabbf99fc515b43d531edf4f2a", "score": "0.7257195", "text": "func (key *PublicKey) UnmarshalText(text []byte) error {\n\treturn key.Decode(string(text))\n}", "title": "" }, { "docid": "c3b9e040bcc10b5a9298978484d5a65a", "score": "0.72541195", "text": "func (t *notTextUnmarshaler) UnmarshalText() {\n\tpanic(\"unexpected call\")\n}", "title": "" }, { "docid": "165c3c3eddfa48254c7528e32e147835", "score": "0.7248975", "text": "func (id *ID) UnmarshalText(text []byte) error {\n\tresult, err := ParseID(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*id = result\n\treturn nil\n}", "title": "" }, { "docid": "7e7ee9d73b117a47e02dea3bff5b5c75", "score": "0.7247046", "text": "func (n *ID) UnmarshalText(text []byte) error {\n\tid, err := parseID(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*n = id\n\treturn nil\n}", "title": "" }, { "docid": "61d2193253ce8334d55162353d3c7c6a", "score": "0.72447336", "text": "func (t *TraceID) UnmarshalText(text []byte) error {\n\tq, err := TraceIDFromString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = q\n\treturn nil\n}", "title": "" }, { "docid": "a8e76ca01395ed19d3d1b416690bbfc1", "score": "0.72235584", "text": "func (x *Operation) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseOperation(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "fc657eefd40c8a6984879ea872b218c7", "score": "0.7194498", "text": "func (i *State) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = StateString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "95802a99e7b16ab5a99880dac0688c44", "score": "0.71648926", "text": "func (id *ID) UnmarshalText(text []byte) error {\n\tdecoded := Parse(string(text))\n\t*id = decoded\n\treturn nil\n}", "title": "" }, { "docid": "c4e74e46eba53fb6def308c567958db7", "score": "0.71491313", "text": "func (t *Table) UnmarshalText(text []byte) error {\n\tname := string(text)\n\tid, err := findNameRTFiles([]string{\n\t\t\"/etc/iproute2/rt_tables\",\n\t\t\"/etc/iproute2/rt_tables.d/*.conf\",\n\t}, name)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to lookup table %q\", name)\n\t}\n\t*t = Table{\n\t\tID: id,\n\t\tName: name,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60ebd2f3a57b6f915c51ce01c540fadb", "score": "0.7147516", "text": "func (n *NonEmptyString) UnmarshalText(text []byte) error {\n\t*n = NonEmptyString(text)\n\treturn nil\n}", "title": "" }, { "docid": "ed49e3ea07291919ef72e284f05b6d4e", "score": "0.71467686", "text": "func (x *TenantedDeploymentMode) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseTenantedDeploymentMode(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "d691cafb8a21d397d4478a0baafbd64d", "score": "0.71272737", "text": "func (s *Scalar) UnmarshalText(text []byte) error {\n\tsb, err := base64.StdEncoding.DecodeString(string(text))\n\tif err == nil {\n\t\treturn s.Decode(sb)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "3a8a38a57f52b6421c388a8eb0b1076a", "score": "0.7126984", "text": "func (v *IntersectionType) UnmarshalText(p []byte) error {\n\tr, err := parseIntersectionTypeValue(string(p))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = r\n\treturn nil\n}", "title": "" }, { "docid": "c56895d6d8414c77f95f9a843fd9d8a4", "score": "0.7116962", "text": "func (u *UUID) UnmarshalText(text []byte) (err error) {\n\treturn parseText(u,text)\n}", "title": "" }, { "docid": "d311e2a4b1fa0c37e65a13180eb14804", "score": "0.71139556", "text": "func (x *LibraryType) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseLibraryType(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "bc05c5db4073bd9ebf9e719e252fb8be", "score": "0.7112865", "text": "func (l *Level) UnmarshalText(text []byte) error {\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\tlevel, err := ParseLevel(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*l = level\n\treturn nil\n}", "title": "" }, { "docid": "9755e2de3614e035f02f35b29e69c89f", "score": "0.7112773", "text": "func (t *Type) UnmarshalText(text []byte) error {\n\tswitch {\n\tcase bytes.Equal(text, []byte(\"full\")):\n\t\t*t = TypeFull\n\tcase bytes.Equal(text, []byte(\"file\")):\n\t\t*t = TypeFile\n\tcase bytes.Equal(text, []byte(\"dir\")):\n\t\t*t = TypeDir\n\tdefault:\n\t\treturn ErrorUnknownType\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "598342fb701b31dc24acd3040bff2088", "score": "0.7104537", "text": "func (x *Shop) UnmarshalText(text []byte) error {\n\ttmp, err := ParseShop(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "e7e28eb76a6e39b22c90bad30eed5a99", "score": "0.71011484", "text": "func (i *NullString) UnmarshalText(data []byte) error {\n\ti.String = string(data)\n\ti.Valid = i.String != \"\"\n\n\treturn nil\n}", "title": "" }, { "docid": "0abc03e18261494d704e00ff17cbd23c", "score": "0.70965266", "text": "func (i *Image) UnmarshalText(text []byte) error {\n\ttxt := strings.TrimSpace(string(text))\n\ttxt = strings.ReplaceAll(txt, \"||\", \"|\\n|\")\n\n\tlines := strings.Split(txt, \"\\n\")\n\timg := make([][]Char, len(lines))\n\n\tfor n, line := range lines {\n\t\tline = strings.Trim(line, \"|\")\n\t\trunes := []rune(line)\n\n\t\timg[n] = make([]Char, len(runes))\n\t\tfor m, r := range runes {\n\t\t\timg[n][m] = Char(r)\n\t\t}\n\t}\n\n\t*i = img\n\n\treturn nil\n}", "title": "" }, { "docid": "20101abb73c7638e62111e24998e47e6", "score": "0.70878243", "text": "func (s *NullString) UnmarshalText(text []byte) error {\n\ts.String = string(text)\n\ts.Valid = s.String != \"\"\n\treturn nil\n}", "title": "" }, { "docid": "009a1ed9555ae058ea21cf27c99e50a6", "score": "0.7065819", "text": "func (v *RejoinType) UnmarshalText(b []byte) error {\n\ts := string(b)\n\tif i, ok := RejoinType_value[s]; ok {\n\t\t*v = RejoinType(i)\n\t\treturn nil\n\t}\n\treturn errCouldNotParse(\"RejoinType\")(string(b))\n}", "title": "" }, { "docid": "4caa462782e521c435118d68a051d082", "score": "0.7054975", "text": "func (t *CustomDateTime) UnmarshalText(text []byte) error {\n\ttt, err := ParseDateTime(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = tt\n\treturn nil\n}", "title": "" }, { "docid": "f7967b270ce179fea991d31cae2a0346", "score": "0.7052859", "text": "func (r *Reference) UnmarshalText(text []byte) error {\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\n\tparts := strings.Split(string(text), refSeparator)\n\tif len(parts) > 1 {\n\t\t// Parse version just to make sure it has the correct format\n\t\tif _, err := strconv.ParseUint(parts[1], 10, 64); err != nil {\n\t\t\treturn errors.Wrap(err, \"invalid reference version\")\n\t\t}\n\n\t\t*r = Reference(strings.Join(\n\t\t\t[]string{\n\t\t\t\tparts[0],\n\t\t\t\tparts[1],\n\t\t\t}, refSeparator,\n\t\t))\n\t\treturn nil\n\t}\n\t*r = Reference(parts[0])\n\treturn nil\n}", "title": "" }, { "docid": "e0cd212386010e24e78178f91c25b5c8", "score": "0.7052044", "text": "func (id *ID) UnmarshalText(text []byte) error {\n\tif len(text) == 0 {\n\t\t*id = ID{}\n\t\treturn nil\n\t}\n\tunmarshaled, err := FromString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*id = unmarshaled\n\treturn nil\n}", "title": "" }, { "docid": "7d235bde0d4b66a4f73381f720cf902a", "score": "0.703861", "text": "func (m *Multipart) UnmarshalText(text []byte) error {\n\tswitch string(text) {\n\tcase \"false\":\n\t\t*m = MultipartFalse\n\n\tcase \"true\":\n\t\t*m = MultipartTrue\n\n\tdefault:\n\t\treturn errors.New(\"invalid Multipart\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d89c5e427ab26f6b393e3dd8525ce4b7", "score": "0.70371443", "text": "func (t *HandlerType) UnmarshalText(text []byte) error {\n\tx := HandlerType(text)\n\n\tif x.Validate() != nil {\n\t\treturn fmt.Errorf(\"invalid text representation of handler type: %s\", text)\n\t}\n\n\t*t = x\n\treturn nil\n}", "title": "" }, { "docid": "db973eb9e82fdb234a1906aefbea3137", "score": "0.7018504", "text": "func (r *RegularKey) UnmarshalText(b []byte) error {\n\taccount, err := NewRegularKeyFromAddress(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\tcopy(r[:], account[:])\n\treturn nil\n}", "title": "" }, { "docid": "25e89cb98d53b07e71b822e2baff98d9", "score": "0.70124227", "text": "func (key *SecretKey) UnmarshalText(text []byte) error {\n\treturn key.Decode(string(text))\n}", "title": "" }, { "docid": "4b5f584cfebcfcd6ed246639597ecb8f", "score": "0.70116466", "text": "func (v *Season_Ic_Tt) UnmarshalText(bs []byte) error {\n\treturn v.unmarshalText(string(bs))\n}", "title": "" }, { "docid": "7bfef45c457b4722d07c35c47145c469", "score": "0.70078796", "text": "func (t *TopicType) UnmarshalText(input []byte) error {\n\treturn hexutil.UnmarshalFixedText(\"Topic\", input, t[:])\n}", "title": "" }, { "docid": "907024bdab34e61c08c2a6b6f288e9b2", "score": "0.7003697", "text": "func (p *Processed) UnmarshalText(text []byte) error {\n\tswitch string(text) {\n\tcase \"false\":\n\t\t*p = ProcessedFalse\n\n\tcase \"true\":\n\t\t*p = ProcessedTrue\n\n\tdefault:\n\t\treturn errors.New(\"invalid Processed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1dbb1492214f084eb43fd12731272fa3", "score": "0.7003094", "text": "func (ss *ShutterSpeed) UnmarshalText(text []byte) (err error) {\n\t*ss = parseShutterSpeed(text)\n\treturn nil\n}", "title": "" }, { "docid": "5220a6521eea072eb334b955c3449a69", "score": "0.69862217", "text": "func (id *Key) UnmarshalText(text []byte) error {\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\tdata, err := base62Encoding.Decode(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(data) != 8 {\n\t\treturn errors.New(\"BUID length must be 128 bit\")\n\t}\n\tcopy(id[:], data)\n\treturn nil\n}", "title": "" }, { "docid": "e173175760eb8bf857b094e295a7d85e", "score": "0.6965944", "text": "func (id *ID) UnmarshalText(text []byte) error {\n\tif len(text) != encodedLen {\n\t\treturn ErrInvalidID\n\t}\n\tfor _, c := range text {\n\t\tif dec[c] == 0xFF {\n\t\t\treturn ErrInvalidID\n\t\t}\n\t}\n\tif !decode(id, text) {\n\t\t*id = nilID\n\t\treturn ErrInvalidID\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae246db193e1f538253d4ceb87051cfa", "score": "0.69619954", "text": "func (s *IDSlice) UnmarshalText(text []byte) error {\n\tparsed, err := IDSliceFromString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = parsed\n\treturn nil\n}", "title": "" }, { "docid": "235f039f6cc8dff0d5cc9da1579bd68e", "score": "0.6951917", "text": "func (p *PGN) UnmarshalText(text []byte) error {\n\tpgn, err := Parse(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Tags = pgn.Tags\n\tp.Moves = pgn.Moves\n\treturn nil\n}", "title": "" }, { "docid": "220048352cb9a4c82c9622aa2ef16adf", "score": "0.6949574", "text": "func (l *EncodeType) UnmarshalText(text []byte) error {\n\tif l == nil {\n\t\treturn errUnmarshalNilEncodeType\n\t}\n\tif !l.unmarshalText(text) && !l.unmarshalText(bytes.ToLower(text)) {\n\t\treturn fmt.Errorf(\"unrecognized level: %q\", text)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9252121e0aec9ab0cd4413172f393df3", "score": "0.69411606", "text": "func (i *SecSystem) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = SecSystemString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "8dfa672314092ec2f9bb6bd0d098353d", "score": "0.6937827", "text": "func (p *Protocol) UnmarshalText(text []byte) error {\n\tname := string(text)\n\tid, err := findNameRTFiles([]string{\n\t\t\"/etc/iproute2/rt_protos\",\n\t\t\"/etc/iproute2/rt_protos.d/*.conf\",\n\t}, name)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to lookup protocol %q\", name)\n\t}\n\t*p = Protocol{\n\t\tID: id,\n\t\tName: name,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "440996a7fa8097f13621c1176020737f", "score": "0.69358975", "text": "func (i *Permit) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = PermitString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "11efc7e5c92608bfab2360c6a136666d", "score": "0.69327015", "text": "func (id *ID) UnmarshalText(data []byte) error {\n\tid.value = string(data)\n\treturn nil\n}", "title": "" }, { "docid": "bef39311042a4ec886f0ed59063f8588", "score": "0.69323224", "text": "func (b *ByteSize) UnmarshalText(text []byte) error {\n\tv, err := units.RAMInBytes(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*b = ByteSize(v)\n\treturn nil\n}", "title": "" }, { "docid": "86e7f022628889c963f0aaf2fd92783a", "score": "0.6925582", "text": "func (dt *DateTime) UnmarshalText(data []byte) error {\n\tvar err error\n\t*dt, err = ParseDateTime(string(data))\n\treturn err\n}", "title": "" }, { "docid": "553515053332153b115aa133c660d958", "score": "0.6925563", "text": "func (v *MType) UnmarshalText(b []byte) error {\n\ts := string(b)\n\tif i, ok := MType_value[s]; ok {\n\t\t*v = MType(i)\n\t\treturn nil\n\t}\n\treturn errCouldNotParse(\"MType\")(string(b))\n}", "title": "" }, { "docid": "ece07e0f35adf6e41b46eb21b5838f72", "score": "0.69214", "text": "func (l *LTIRoles) UnmarshalText(in []byte) error {\n\tvar cleanedIn string = string(in)\n\tcleanedIn = strings.TrimPrefix(cleanedIn, \"\\\"\")\n\tcleanedIn = strings.TrimSuffix(cleanedIn, \"\\\"\")\n\n\t(*l) = *(NewLTIRoles(cleanedIn))\n\n\treturn nil\n}", "title": "" }, { "docid": "d101ac47746b482504f2a1b6dea1c35f", "score": "0.69201326", "text": "func (dt *DateTime) UnmarshalText(data []byte) (err error) {\n\ts := string(data)\n\t*dt, err = DateTimeParse(s)\n\treturn\n}", "title": "" }, { "docid": "dd6b9455f95188ae7b80f0284ab53aa5", "score": "0.69190246", "text": "func (i *OrderBookSide) UnmarshalText(text []byte) error {\n\tvar err error\n\t*i, err = OrderBookSideString(string(text))\n\treturn err\n}", "title": "" }, { "docid": "04ccf3e98df95050efb8c3a9be36b179", "score": "0.6913633", "text": "func (b *BigInt) UnmarshalText(text []byte) (err error) {\n\tvar bigInt = new(big.Int)\n\terr = bigInt.UnmarshalText(text)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t*b = BigInt(*bigInt)\n\treturn nil\n}", "title": "" }, { "docid": "13006d1649c56e43e10d5fdddd41a62e", "score": "0.6902946", "text": "func (x *ResponseType) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := ParseResponseType(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "1a2aece379122d0ea7ef5b33aceaf57a", "score": "0.69018435", "text": "func (p *Plugin) UnmarshalText(text []byte) error {\n\tmetadataBytes, templateBytes, err := splitPluginFile(text)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := yaml.Unmarshal(metadataBytes, p); err != nil {\n\t\treturn err\n\t}\n\n\tp.Template, err = template.New(p.Title).\n\t\tFuncs(pluginFuncs()).\n\t\tParse(string(templateBytes))\n\treturn err\n}", "title": "" }, { "docid": "63d517d75e5565e8fe23b9753f87edf0", "score": "0.68666446", "text": "func (c *Char) UnmarshalText(b []byte) error {\n\tcnt := utf8.RuneCount(b)\n\tif cnt == 0 {\n\t\treturn fmt.Errorf(`%w empty string: should be a single char`, ErrUnmarshal)\n\t}\n\n\tif cnt > 1 {\n\t\treturn fmt.Errorf(`%w \"%s\": should be a single char`, ErrUnmarshal, string(b))\n\t}\n\n\tr, _ := utf8.DecodeRune(b)\n\t*c = Char(r)\n\n\treturn nil\n}", "title": "" }, { "docid": "cabefc2c8db0037618b72714b022ab41", "score": "0.68655086", "text": "func (d *Decimal) UnmarshalText(text []byte) error {\n\tif !decimalRegExp.Match(text) {\n\t\treturn fmt.Errorf(\"%s is not valid decimal\", text)\n\t}\n\tf, err := strconv.ParseFloat(string(text), 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = Decimal(float32(f))\n\treturn nil\n}", "title": "" }, { "docid": "c0e7f4b7314dfa92ca80639b14198d8d", "score": "0.6856694", "text": "func (id *ID) UnmarshalText(text []byte) error {\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\tdata, err := base62Encoding.Decode(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(data) != 16 {\n\t\treturn errors.New(\"BUID length must be 128 bit\")\n\t}\n\tcopy(id[:], data)\n\treturn nil\n}", "title": "" }, { "docid": "b7f80c5295ae184ee2a0744f4a9211fb", "score": "0.68565345", "text": "func (d *Date) UnmarshalText(b []byte) error {\n\tvar err error\n\td.Time, err = time.Parse(DateLayout, string(b))\n\treturn err\n}", "title": "" }, { "docid": "46035418083cff48e9789b9fc2c50344", "score": "0.6856367", "text": "func (t *Delay) UnmarshalText(text []byte) error {\n\ts := string(text)\n\n\td, err := time.ParseDuration(s)\n\tif err != nil {\n\t\tlog.Errorf(\"Error parsing duration (%s): %s\", s, err.Error())\n\t\treturn err\n\t}\n\n\t*t = Delay(d)\n\treturn nil\n}", "title": "" }, { "docid": "bdbc11323f67c1d3484144ba29e390f3", "score": "0.6851575", "text": "func (p *PublicKey) UnmarshalText(b []byte) error {\n\t_, err := hex.Decode(p[:], b)\n\treturn err\n}", "title": "" }, { "docid": "9818a7774e025c59605d9c95b5979d6d", "score": "0.6850433", "text": "func (t *DateTime) UnmarshalText(b []byte) error {\n\tstr := string(b)\n\tvar err error\n\n\tif str == \"\" || str == \"null\" {\n\t\tt.Time = time.Time{}\n\n\t\treturn nil\n\t}\n\tt.Time, err = time.Parse(time.RFC3339, str)\n\treturn err\n}", "title": "" }, { "docid": "f7feafdfcc8c9220d07a371c555af930", "score": "0.68161374", "text": "func (n *Ident) UnmarshalText(data []byte) error {\n\t*n = New(string(data))\n\treturn nil\n}", "title": "" }, { "docid": "8e8e91d042065e44cb8df007ee30ae36", "score": "0.6805085", "text": "func (dt *Datetime) UnmarshalText(text []byte) error {\n\tif dt == nil {\n\t\treturn nil\n\t}\n\tif len(text) == 0 {\n\t\tdt.t = nil\n\t\treturn nil\n\t}\n\ts := string(text)\n\tif strings.Count(s, \"/\") > 1 {\n\t\treturn dt.handleNotRFC3339(s)\n\t}\n\treturn dt.handleRFC3339(s)\n}", "title": "" }, { "docid": "d54c2182a5e4bf417241708bedbf0d56", "score": "0.6802703", "text": "func (s *SpanID) UnmarshalText(text []byte) error {\n\tq, err := SpanIDFromString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*s = q\n\treturn nil\n}", "title": "" }, { "docid": "d04e4a8bdc5a8e2cf06babf79625b93d", "score": "0.68004245", "text": "func (b *Bloom) UnmarshalText(input []byte) error {\n\treturn hexutil.UnmarshalFixedText(\"Bloom\", input, b[:])\n}", "title": "" }, { "docid": "7c4a5e61f72228be978eb5fe7c140ea7", "score": "0.6795982", "text": "func (id *SerialNumber) UnmarshalText(data []byte) error {\n\tvar err error\n\t*id, err = SerialNumberFromString(string(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b20a7aaa212370af2003d6f0742bae4", "score": "0.6792532", "text": "func (rk *RestrictionKey) UnmarshalText(data []byte) error {\n\ts := string(data)\n\t*rk = NewRestrictionKey(s)\n\tif !rk.Valid() {\n\t\treturn errors.Errorf(valueNotValidFmt, s)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "467aabf237cb7d4dd3bb5fa64018ece1", "score": "0.6784832", "text": "func (x *__TypeKind) UnmarshalText(text []byte) error {\n\tname := string(text)\n\ttmp, err := Parse__TypeKind(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = tmp\n\treturn nil\n}", "title": "" }, { "docid": "58eb2686195442f94f78e724f1a45d3b", "score": "0.67846507", "text": "func (s *Seed) UnmarshalText(b []byte) error {\n\taccount, err := NewSeedFromAddress(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\tcopy(s[:], account[:])\n\treturn nil\n}", "title": "" }, { "docid": "fa50cc56926d830bbff52f902f44ea13", "score": "0.6775666", "text": "func (t *Temp) UnmarshalText(s []byte) error {\n\tss := tempPattern.FindSubmatch(bytes.ToUpper(s))\n\tif ss == nil {\n\t\treturn fmt.Errorf(\"could not parse temperature string of '%s' (is the unit included?)\", s)\n\t}\n\n\tvalStr, unit := ss[1], ss[2]\n\tval, err := strconv.ParseFloat(string(valStr), 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch string(unit) {\n\tcase \"F\":\n\t\t*t = Fahrenheit(val)\n\t\treturn nil\n\n\tcase \"C\":\n\t\t*t = Celcius(val)\n\t\treturn nil\n\n\tcase \"K\":\n\t\t*t = Kelvin(val)\n\t\treturn nil\n\n\tdefault:\n\t\tpanic(\"unknown unit in temperature\")\n\t}\n}", "title": "" }, { "docid": "6f8426dbf2ccf9d89c339e513339c2ab", "score": "0.67642826", "text": "func (v *VariableLength) UnmarshalText(b []byte) error {\n\tvar err error\n\t*v, err = hex.DecodeString(string(b))\n\treturn err\n}", "title": "" }, { "docid": "3043fdc3199815e063d57313096dea9f", "score": "0.67598903", "text": "func (fm *FlashMode) UnmarshalText(text []byte) (err error) {\n\tvar i int\n\ti, err = strconv.Atoi(string(text))\n\t*fm = parseFlashMode(uint8(i))\n\treturn err\n}", "title": "" }, { "docid": "a3f855eae24c0f4dad1fa22bb13b622f", "score": "0.67569137", "text": "func (d *Date) UnmarshalText(data []byte) (err error) {\n\td.Time, err = time.Parse(fullDate, string(data))\n\treturn err\n}", "title": "" }, { "docid": "9321925a8a60c742ba02bac5c5b15d59", "score": "0.6755017", "text": "func (x *Right) UnmarshalText(b []byte) error {\n\ti, err := jsonplugin.ParseEnumString(string(b), Right_customvalue, Right_value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Right(i)\n\treturn nil\n}", "title": "" }, { "docid": "f1d146e7f75daed53126319f34341d2a", "score": "0.67518455", "text": "func (p *Percent32) UnmarshalText(text []byte) error {\n\treturn p.Set(string(text))\n}", "title": "" }, { "docid": "dcaf17b548d71115656d89d4532ed383", "score": "0.67477494", "text": "func (c *CustomStruct) UnmarshalText(text []byte) error {\n\tres := strings.Split(string(text), \",\")\n\tc.Bar1 = res[0]\n\tc.Bar2 = res[1]\n\treturn nil\n}", "title": "" }, { "docid": "275bdd165a498487d59489a190c5362e", "score": "0.67461956", "text": "func (s *Signature) UnmarshalText(text []byte) error {\n\tsize := hex.DecodedLen(len(text))\n\tif size != SignatureSize {\n\t\treturn fmt.Errorf(\"bad signature size: %d\", size)\n\t}\n\n\tvar signature [SignatureSize]byte\n\tif _, err := hex.Decode(signature[:], text); err != nil {\n\t\treturn err\n\t}\n\n\t*s = signature\n\treturn nil\n}", "title": "" }, { "docid": "20372fe043767a89178b10e65211cadd", "score": "0.67413604", "text": "func (d *Date) UnmarshalText(text []byte) error {\n\tt, err := time.Parse(\"2006-01-02Z07:00\", string(text))\n\tif err != nil {\n\t\tt, err = time.Parse(\"2006-01-02\", string(text))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t*d = Date(t)\n\treturn nil\n}", "title": "" }, { "docid": "0beb350fecf9def06b2b5fdb20dbc974", "score": "0.6726774", "text": "func (dur *Duration) UnmarshalText(text []byte) error {\n\td, err := time.ParseDuration(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*dur = Duration(d)\n\treturn err\n}", "title": "" }, { "docid": "ccfd68b91348b877b88c620243745b11", "score": "0.6718341", "text": "func (pos *Position) UnmarshalText(text []byte) error {\n\tcp, err := decodeFEN(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\tpos.board = cp.board\n\tpos.turn = cp.turn\n\tpos.castleRights = cp.castleRights\n\tpos.enPassantSquare = cp.enPassantSquare\n\tpos.halfMoveClock = cp.halfMoveClock\n\tpos.moveCount = cp.moveCount\n\tpos.inCheck = isInCheck(cp)\n\treturn nil\n}", "title": "" }, { "docid": "bc8120b1e9cd945a7272d5760b9694c7", "score": "0.6711891", "text": "func (d *DateTime) UnmarshalText(text []byte) error {\n\tt, err := time.Parse(time.RFC3339, string(text))\n\tif err != nil {\n\t\tt, err = time.Parse(\"2006-01-02T15:04:05\", string(text))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t*d = DateTime(t)\n\treturn nil\n}", "title": "" }, { "docid": "b2829fa6fa75a44f409d046713edf361", "score": "0.6710198", "text": "func (it *ImageType) UnmarshalText(text []byte) (err error) {\n\t*it = imageTypeValues[string(text)]\n\treturn nil\n\t//return []byte(imageTypeStrings[it]), nil\n}", "title": "" }, { "docid": "f2514b298f749832b5798bd9c10f3d47", "score": "0.6708401", "text": "func (v *Class) UnmarshalText(b []byte) error {\n\ts := string(b)\n\tif i, ok := Class_value[s]; ok {\n\t\t*v = Class(i)\n\t\treturn nil\n\t}\n\tif !strings.HasPrefix(s, \"CLASS_\") {\n\t\tif i, ok := Class_value[\"CLASS_\"+s]; ok {\n\t\t\t*v = Class(i)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errCouldNotParse(\"Class\")(string(b))\n}", "title": "" }, { "docid": "b3f438995372a1f0dc85747ad8a04038", "score": "0.67055863", "text": "func (r *Role) UnmarshalText(b []byte) error {\n\tif len(b) == 0 {\n\t\treturn fmt.Errorf(\"role value should not be empty\")\n\t}\n\n\tr.value = string(b)\n\treturn nil\n}", "title": "" }, { "docid": "95d15f84583283eb97b27c12544fb506", "score": "0.6702895", "text": "func (x *Bytes32) UnmarshalText(text []byte) error {\n\tdata, err := base64.RawURLEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(data) != 32 {\n\t\treturn fmt.Errorf(\"expected len=32, got len=%v\", len(data))\n\t}\n\tcopy(x[:], data)\n\treturn nil\n}", "title": "" } ]
254ee542e7ce3760969030a54eca26ad
Copy makes a copy of the endpoint ipam config
[ { "docid": "da7b090f004d6ee812b9b8b47d70de32", "score": "0.7872601", "text": "func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig {\n\tcfgCopy := *cfg\n\tcfgCopy.LinkLocalIPs = make([]string, 0, len(cfg.LinkLocalIPs))\n\tcfgCopy.LinkLocalIPs = append(cfgCopy.LinkLocalIPs, cfg.LinkLocalIPs...)\n\treturn &cfgCopy\n}", "title": "" } ]
[ { "docid": "77e8b0321ecde50f411c7f6a032f45f6", "score": "0.71289444", "text": "func (es *EndpointSettings) Copy() *EndpointSettings {\n\tepCopy := *es\n\tif es.IPAMConfig != nil {\n\t\tepCopy.IPAMConfig = es.IPAMConfig.Copy()\n\t}\n\n\tif es.Links != nil {\n\t\tlinks := make([]string, 0, len(es.Links))\n\t\tepCopy.Links = append(links, es.Links...)\n\t}\n\n\tif es.Aliases != nil {\n\t\taliases := make([]string, 0, len(es.Aliases))\n\t\tepCopy.Aliases = append(aliases, es.Aliases...)\n\t}\n\treturn &epCopy\n}", "title": "" }, { "docid": "585181a09e89beadb9719641e26de6f6", "score": "0.65707433", "text": "func (e *ConsulExposeConfig) Copy() *ConsulExposeConfig {\n\tif e == nil {\n\t\treturn nil\n\t}\n\tpaths := make([]ConsulExposePath, len(e.Paths))\n\tcopy(paths, e.Paths)\n\treturn &ConsulExposeConfig{\n\t\tPaths: paths,\n\t}\n}", "title": "" }, { "docid": "16a6f2618499d7a19280a93cd5d02ff3", "score": "0.64921427", "text": "func (cfg Config) Copy() Config {\n\tres := cfg\n\tif res.Addresses != nil {\n\t\tres.Addresses = append([]netaddr.IPPrefix{}, res.Addresses...)\n\t}\n\tif res.DNS != nil {\n\t\tres.DNS = append([]netaddr.IP{}, res.DNS...)\n\t}\n\tpeers := make([]Peer, 0, len(res.Peers))\n\tfor _, peer := range res.Peers {\n\t\tpeers = append(peers, peer.Copy())\n\t}\n\tres.Peers = peers\n\treturn res\n}", "title": "" }, { "docid": "b65a5e6c2cd4f2f91d174ecf02a3e3ab", "score": "0.6334521", "text": "func copyConfig(in *config.Beam) *config.Beam {\n\tbytes, err := json.Marshal(in)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to marshal Beam config for copy: %v\", err))\n\t}\n\tout := new(config.Beam)\n\terr = json.Unmarshal(bytes, out)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to unmarshal Beam config for copy: %v\", err))\n\t}\n\treturn out\n}", "title": "" }, { "docid": "e26b14d3c4596d836748752431bb502d", "score": "0.6311634", "text": "func (o *Config) Copy(s Config) {\n\to.Enable = s.Enable\n\to.RouterId = s.RouterId\n\to.RejectDefaultRoute = s.RejectDefaultRoute\n\to.AllowRedistributeDefaultRoute = s.AllowRedistributeDefaultRoute\n\to.Rfc1583 = s.Rfc1583\n\to.SpfCalculationDelay = s.SpfCalculationDelay\n\to.LsaInterval = s.LsaInterval\n\to.EnableGracefulRestart = s.EnableGracefulRestart\n\to.GracePeriod = s.GracePeriod\n\to.HelperEnable = s.HelperEnable\n\to.StrictLsaChecking = s.StrictLsaChecking\n\to.MaxNeighborRestartTime = s.MaxNeighborRestartTime\n\to.BfdProfile = s.BfdProfile\n}", "title": "" }, { "docid": "b72503f5e39c90cc35a9a7fdda2df098", "score": "0.62285995", "text": "func (c *Config) Copy() *Config {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn &Config{\n\t\tEndpoint: c.Endpoint,\n\t\tUsername: c.Username,\n\t\tPassword: c.Password,\n\t}\n}", "title": "" }, { "docid": "da4d26b10a088d7d6a90063ede801678", "score": "0.6204219", "text": "func (c *pyConfig) Copy() *pyConfig {\n\treturn &pyConfig{base: c.base}\n}", "title": "" }, { "docid": "3df079fce2422fe20165a9b2a953dfcc", "score": "0.6157205", "text": "func (o *Config) Copy() *Config {\n\tnewConfig := &Config{\n\t\tCredentials: o.Credentials,\n\t\tEndpoint: o.Endpoint,\n\t\tHTTPClient: o.HTTPClient,\n\t}\n\treturn newConfig\n}", "title": "" }, { "docid": "8a3e012768a0b393f34ed620dd4af638", "score": "0.60849416", "text": "func TestCloneAppconfig(t *testing.T) {\n\tconfig := &Config{\n\t\tAppName: \"testcfg\",\n\t\tRawDefinition: map[string]any{\n\t\t\t\"mounts\": []Mount{\n\t\t\t\t{\n\t\t\t\t\tSource: \"src-raw\",\n\t\t\t\t\tDestination: \"dst-raw\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tSource: \"src2\",\n\t\t\t\t\tDestination: \"dst2\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tMounts: []Mount{{\n\t\t\tSource: \"src\",\n\t\t\tDestination: \"dst\",\n\t\t}},\n\t\tHTTPService: &HTTPService{\n\t\t\tInternalPort: 100,\n\t\t},\n\t\tdefaultGroupName: \"some-group\",\n\t}\n\n\tcloned := helpers.Clone(config)\n\n\tassert.Equal(t, config, cloned)\n\n\tconfig.HTTPService.InternalPort = 50\n\n\tassert.Equal(t, 100, cloned.HTTPService.InternalPort,\n\t\t\"expected deep copy, but cloned object was modified by change to original config\")\n}", "title": "" }, { "docid": "64af43c660d0d53434ba20a6aadff0b6", "score": "0.60378397", "text": "func copyEndPoint(endpoint *grpc_application_go.Endpoint) *grpc_application_go.Endpoint {\n\tif endpoint == nil {\n\t\treturn nil\n\t}\n\treturn &grpc_application_go.Endpoint{\n\t\tType: endpoint.Type,\n\t\tPath: endpoint.Path,\n\t\tOptions: endpoint.Options,\n\t}\n}", "title": "" }, { "docid": "a6666b51a07f076f46d59d08296e1474", "score": "0.586477", "text": "func (peer Peer) Copy() Peer {\n\tres := peer\n\tif res.AllowedIPs != nil {\n\t\tres.AllowedIPs = append([]netaddr.IPPrefix{}, res.AllowedIPs...)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "1b84fe32b16d6d3a34c39254bc569f5c", "score": "0.5820955", "text": "func copyConfigFile(configFile *grpc_application_go.ConfigFile) *grpc_application_go.ConfigFile {\n\tif configFile == nil {\n\t\treturn nil\n\t}\n\treturn &grpc_application_go.ConfigFile{\n\t\tOrganizationId: configFile.OrganizationId,\n\t\tAppDescriptorId: configFile.AppDescriptorId,\n\t\tConfigFileId: configFile.ConfigFileId,\n\t\tName: configFile.Name,\n\t\tContent: configFile.Content,\n\t\tMountPath: configFile.MountPath,\n\t}\n}", "title": "" }, { "docid": "d9ca951aceebbb4ab0337c6864ccb12e", "score": "0.57849234", "text": "func (c *Config) Copy() *Config {\n\tif c == nil {\n\t\treturn nil\n\t}\n\tvar o Config\n\n\to.Consul = c.Consul\n\n\tif c.Consul != nil {\n\t\to.Consul = c.Consul.Copy()\n\t}\n\n\tif c.Dedup != nil {\n\t\to.Dedup = c.Dedup.Copy()\n\t}\n\n\tif c.DefaultDelims != nil {\n\t\to.DefaultDelims = c.DefaultDelims.Copy()\n\t}\n\n\tif c.Exec != nil {\n\t\to.Exec = c.Exec.Copy()\n\t}\n\n\to.KillSignal = c.KillSignal\n\n\to.LogLevel = c.LogLevel\n\n\to.MaxStale = c.MaxStale\n\n\to.PidFile = c.PidFile\n\n\to.ReloadSignal = c.ReloadSignal\n\n\tif c.FileLog != nil {\n\t\to.FileLog = c.FileLog.Copy()\n\t}\n\n\tif c.Syslog != nil {\n\t\to.Syslog = c.Syslog.Copy()\n\t}\n\n\tif c.Templates != nil {\n\t\to.Templates = c.Templates.Copy()\n\t}\n\n\tif c.TemplateErrFatal != nil {\n\t\to.TemplateErrFatal = c.TemplateErrFatal\n\t}\n\n\tif c.Vault != nil {\n\t\to.Vault = c.Vault.Copy()\n\t}\n\n\tif c.Wait != nil {\n\t\to.Wait = c.Wait.Copy()\n\t}\n\n\to.Once = c.Once\n\to.ParseOnly = c.ParseOnly\n\n\to.BlockQueryWaitTime = c.BlockQueryWaitTime\n\n\tif c.Nomad != nil {\n\t\to.Nomad = c.Nomad.Copy()\n\t}\n\n\treturn &o\n}", "title": "" }, { "docid": "6d89b437b4e89451324986ce64cb6154", "score": "0.5773065", "text": "func (ep *IstioEndpoint) DeepCopy() *IstioEndpoint {\n\treturn copyInternal(ep).(*IstioEndpoint)\n}", "title": "" }, { "docid": "9a54ce3602095920da6a690704c74b63", "score": "0.5737588", "text": "func copyHaproxyCfg() {\n\tdata, err := ioutil.ReadFile(\"/haproxy.cfg\")\n\tif err != nil {\n\t\tglog.Fatalf(\"unexpected error reading haproxy.cfg: %v\", err)\n\t}\n\terr = ioutil.WriteFile(\"/etc/haproxy/haproxy.cfg\", data, 0644)\n\tif err != nil {\n\t\tglog.Fatalf(\"unexpected error writing haproxy.cfg: %v\", err)\n\t}\n}", "title": "" }, { "docid": "124dfa3c5abc1fef5c463c467e7cd3e3", "score": "0.57095635", "text": "func (b *IngressBuilder) Copy(object *Ingress) *IngressBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.id = object.id\n\tb.href = object.href\n\tb.dnsName = object.dnsName\n\tb.clusterRoutesHostname = object.clusterRoutesHostname\n\tb.clusterRoutesTlsSecretRef = object.clusterRoutesTlsSecretRef\n\tb.default_ = object.default_\n\tif object.excludedNamespaces != nil {\n\t\tb.excludedNamespaces = make([]string, len(object.excludedNamespaces))\n\t\tcopy(b.excludedNamespaces, object.excludedNamespaces)\n\t} else {\n\t\tb.excludedNamespaces = nil\n\t}\n\tb.listening = object.listening\n\tb.loadBalancerType = object.loadBalancerType\n\tb.routeNamespaceOwnershipPolicy = object.routeNamespaceOwnershipPolicy\n\tif len(object.routeSelectors) > 0 {\n\t\tb.routeSelectors = map[string]string{}\n\t\tfor k, v := range object.routeSelectors {\n\t\t\tb.routeSelectors[k] = v\n\t\t}\n\t} else {\n\t\tb.routeSelectors = nil\n\t}\n\tb.routeWildcardPolicy = object.routeWildcardPolicy\n\treturn b\n}", "title": "" }, { "docid": "dae19600358960295d49eaad3e60d625", "score": "0.55776906", "text": "func (p *ConsulProxy) Copy() *ConsulProxy {\n\tif p == nil {\n\t\treturn nil\n\t}\n\n\tnewP := &ConsulProxy{\n\t\tLocalServiceAddress: p.LocalServiceAddress,\n\t\tLocalServicePort: p.LocalServicePort,\n\t\tExpose: p.Expose.Copy(),\n\t}\n\n\tif n := len(p.Upstreams); n > 0 {\n\t\tnewP.Upstreams = make([]ConsulUpstream, n)\n\n\t\tfor i := range p.Upstreams {\n\t\t\tnewP.Upstreams[i] = *p.Upstreams[i].Copy()\n\t\t}\n\t}\n\n\tif n := len(p.Config); n > 0 {\n\t\tnewP.Config = make(map[string]interface{}, n)\n\n\t\tfor k, v := range p.Config {\n\t\t\tnewP.Config[k] = v\n\t\t}\n\t}\n\n\treturn newP\n}", "title": "" }, { "docid": "b2a06682f49e9714b05a9dd580f0a653", "score": "0.5499837", "text": "func (c *Config) copyConf(programPath, programName, confName string) (*Config, error) {\n\n\tisTmp := false\n\tif programPath == \"/tmp\" {\n\t\tisTmp = true\n\t}\n\n\tnewConf := Config{programPath, programName, confName, isTmp, sync.RWMutex{}}\n\terr := newConf.read(c)\n\treturn &newConf, err\n}", "title": "" }, { "docid": "84652afbcedda814eb0b4120a4ffc6dd", "score": "0.5455124", "text": "func (b *GitlabIdentityProviderBuilder) Copy(object *GitlabIdentityProvider) *GitlabIdentityProviderBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.ca = object.ca\n\tb.url = object.url\n\tb.clientID = object.clientID\n\tb.clientSecret = object.clientSecret\n\treturn b\n}", "title": "" }, { "docid": "defc3d489cdfb48eff7b936522973cf5", "score": "0.5450184", "text": "func (b *ExternalConfigurationBuilder) Copy(object *ExternalConfiguration) *ExternalConfigurationBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tif object.labels != nil {\n\t\tb.labels = NewLabelList().Copy(object.labels)\n\t} else {\n\t\tb.labels = nil\n\t}\n\tif object.syncsets != nil {\n\t\tb.syncsets = NewSyncsetList().Copy(object.syncsets)\n\t} else {\n\t\tb.syncsets = nil\n\t}\n\treturn b\n}", "title": "" }, { "docid": "297c780d075e69c437995f1d238c1ad5", "score": "0.5446467", "text": "func (opts *Remote) Copy() *Remote {\n\toptsCopy := *opts\n\tif opts.Proxy != nil {\n\t\toptsCopy.Proxy = opts.Proxy.Copy()\n\t}\n\treturn &optsCopy\n}", "title": "" }, { "docid": "97cf324084cf126cf70cf1d3c3c20327", "score": "0.5445756", "text": "func (o *Entry) Copy(s Entry) {\n\to.TunnelInterface = s.TunnelInterface\n\to.AntiReplay = s.AntiReplay\n\to.EnableIpv6 = s.EnableIpv6\n\to.Type = s.Type\n\to.AkIkeGateway = s.AkIkeGateway\n\to.AkIpsecCryptoProfile = s.AkIpsecCryptoProfile\n\to.MkLocalSpi = s.MkLocalSpi\n\to.MkInterface = s.MkInterface\n\to.MkRemoteSpi = s.MkRemoteSpi\n\to.MkRemoteAddress = s.MkRemoteAddress\n\to.MkLocalAddressIp = s.MkLocalAddressIp\n\to.MkLocalAddressFloatingIp = s.MkLocalAddressFloatingIp\n\to.MkProtocol = s.MkProtocol\n\to.MkAuthType = s.MkAuthType\n\to.MkAuthKey = s.MkAuthKey\n\to.MkEspEncryptionType = s.MkEspEncryptionType\n\to.MkEspEncryptionKey = s.MkEspEncryptionKey\n\to.GpsInterface = s.GpsInterface\n\to.GpsPreferIpv6 = s.GpsPreferIpv6\n\to.GpsInterfaceIpIpv4 = s.GpsInterfaceIpIpv4\n\to.GpsInterfaceIpIpv6 = s.GpsInterfaceIpIpv6\n\to.GpsInterfaceFloatingIpIpv4 = s.GpsInterfaceFloatingIpIpv4\n\to.GpsInterfaceFloatingIpIpv6 = s.GpsInterfaceFloatingIpIpv6\n\to.GpsPublishConnectedRoutes = s.GpsPublishConnectedRoutes\n\tif s.GpsPublishRoutes == nil {\n\t\to.GpsPublishRoutes = nil\n\t} else {\n\t\to.GpsPublishRoutes = make([]string, len(s.GpsPublishRoutes))\n\t\tcopy(o.GpsPublishRoutes, s.GpsPublishRoutes)\n\t}\n\to.GpsLocalCertificate = s.GpsLocalCertificate\n\to.GpsCertificateProfile = s.GpsCertificateProfile\n\to.AntiReplay = s.AntiReplay\n\to.CopyTos = s.CopyTos\n\to.CopyFlowLabel = s.CopyFlowLabel\n\to.EnableTunnelMonitor = s.EnableTunnelMonitor\n\to.TunnelMonitorDestinationIp = s.TunnelMonitorDestinationIp\n\to.TunnelMonitorSourceIp = s.TunnelMonitorSourceIp\n\to.TunnelMonitorProxyId = s.TunnelMonitorProxyId\n\to.TunnelMonitorProfile = s.TunnelMonitorProfile\n\to.Disabled = s.Disabled\n}", "title": "" }, { "docid": "5f72b36e0f38e5ccd334d7194001b3b6", "score": "0.54142606", "text": "func (t *TLSConfig) Copy() *TLSConfig {\n\tif t == nil {\n\t\treturn t\n\t}\n\n\tnew := &TLSConfig{}\n\tnew.EnableHTTP = t.EnableHTTP\n\tnew.EnableRPC = t.EnableRPC\n\tnew.VerifyServerHostname = t.VerifyServerHostname\n\tnew.CAFile = t.CAFile\n\tnew.CertFile = t.CertFile\n\n\t// Shallow copy the key loader as its GetOutgoingCertificate method is what\n\t// is used by the HTTP server to retrieve the certificate. If we create a new\n\t// KeyLoader struct, the HTTP server will still be calling the old\n\t// GetOutgoingCertificate method.\n\tt.keyloaderLock.Lock()\n\tnew.KeyLoader = t.KeyLoader\n\tt.keyloaderLock.Unlock()\n\n\tnew.KeyFile = t.KeyFile\n\tnew.RPCUpgradeMode = t.RPCUpgradeMode\n\tnew.VerifyHTTPSClient = t.VerifyHTTPSClient\n\n\tnew.TLSCipherSuites = t.TLSCipherSuites\n\tnew.TLSMinVersion = t.TLSMinVersion\n\n\tnew.TLSPreferServerCipherSuites = t.TLSPreferServerCipherSuites\n\n\tnew.SetChecksum()\n\n\treturn new\n}", "title": "" }, { "docid": "9831c82b9df730212a8e7d54288db06c", "score": "0.53940547", "text": "func (rc *RecordConfig) Copy() (*RecordConfig, error) {\n\tnewR := &RecordConfig{}\n\t// Copy the exported fields.\n\terr := reprint.FromTo(rc, newR) // Deep copy\n\t// Set each unexported field.\n\tnewR.target = rc.target\n\treturn newR, err\n}", "title": "" }, { "docid": "4a39951eb9833f07c955f5207030e45f", "score": "0.5390255", "text": "func (t *Mocker) Apply(endpoint *metadata.NetworkEndpoint) error {\n\tdefer trace.End(trace.Begin(\"mocking endpoint configuration for \" + endpoint.Network.Name))\n\tt.IPs[endpoint.Network.Name] = endpoint.Assigned\n\n\treturn nil\n}", "title": "" }, { "docid": "4f1147e21b236da46de51a9bb06674b5", "score": "0.5370526", "text": "func copyIP(ip net.IP) net.IP {\n\tp := make(net.IP, len(ip))\n\tcopy(p, ip)\n\treturn p\n}", "title": "" }, { "docid": "d9fef73cf6636dd50a1aa597a408bc8c", "score": "0.5357573", "text": "func (vm *BaseVM) copy() *BaseVM {\n\tvm2 := new(BaseVM)\n\n\t// Make copies of all fields except lock/kill\n\tvm2.BaseConfig = vm.BaseConfig.Copy()\n\tvm2.ID = vm.ID\n\tvm2.Name = vm.Name\n\tvm2.Namespace = vm.Namespace\n\tvm2.Host = vm.Host\n\tvm2.State = vm.State\n\tvm2.LaunchTime = vm.LaunchTime\n\tvm2.Type = vm.Type\n\tvm2.ActiveCC = vm.ActiveCC\n\tvm2.instancePath = vm.instancePath\n\n\treturn vm2\n}", "title": "" }, { "docid": "af0e233b4ab2accf28dbdf237679229c", "score": "0.53548926", "text": "func (s *ConsulSidecarService) Copy() *ConsulSidecarService {\n\tif s == nil {\n\t\treturn nil\n\t}\n\treturn &ConsulSidecarService{\n\t\tTags: helper.CopySliceString(s.Tags),\n\t\tPort: s.Port,\n\t\tProxy: s.Proxy.Copy(),\n\t\tDisableDefaultTCPCheck: s.DisableDefaultTCPCheck,\n\t}\n}", "title": "" }, { "docid": "cf79aefb69559da067c63b4209e07c63", "score": "0.53358436", "text": "func (c *Config) clone() *Config {\n\tc2 := &Config{}\n\tconfigRaw, _ := yaml.Marshal(c)\n\t_ = yaml.Unmarshal(configRaw, c2)\n\treturn c2\n}", "title": "" }, { "docid": "6b341f0a77cd3d60bad0507c65d56850", "score": "0.5307581", "text": "func (ep *Endpoint) clone() cloneable {\n\tif ep == nil {\n\t\treturn nil\n\t}\n\n\tvar endpoint *registry.NSERegistration\n\tif ep.Endpoint != nil {\n\t\tendpoint = proto.Clone(ep.Endpoint).(*registry.NSERegistration)\n\t}\n\n\treturn &Endpoint{\n\t\tEndpoint: endpoint,\n\t\tSocketLocation: ep.SocketLocation,\n\t\tWorkspace: ep.Workspace,\n\t}\n}", "title": "" }, { "docid": "1007a9228ca2c367d91e6d6acd8de2c6", "score": "0.52807695", "text": "func TestTransformHalconfig_ExposedPortAddedToConfig(t *testing.T) {\n\tgateSvc := &corev1.Service{}\n\ttest.ReadYamlFile(\"testdata/output_service_lb.yml\", gateSvc, t)\n\tgateSvc.Status.LoadBalancer.Ingress = append(gateSvc.Status.LoadBalancer.Ingress, corev1.LoadBalancerIngress{Hostname: \"abc.com\"})\n\ttr, spinSvc := transformertest.SetupTransformerFromSpinFile(&TransformerGenerator{}, \"testdata/spinsvc_expose.yml\", t, gateSvc)\n\tgen := &generated.SpinnakerGeneratedConfig{}\n\ttest.AddServiceToGenConfig(gen, \"gate\", \"testdata/input_service.yml\", t)\n\tspinSvc.GetExposeConfig().Service.PublicPort = 7777\n\n\terr := tr.TransformConfig(context.TODO())\n\tassert.Nil(t, err)\n\n\tactualOverrideUrl, err := (tr.(*exposeTransformer)).svc.GetSpinnakerConfig().GetHalConfigPropString(context.TODO(), util.GateOverrideBaseUrlProp)\n\tassert.Nil(t, err)\n\tassert.Equal(t, \"http://abc.com:7777\", actualOverrideUrl)\n\tassert.Equal(t, \"http://abc.com:7777\", (tr.(*exposeTransformer)).svc.GetStatus().APIUrl)\n}", "title": "" }, { "docid": "de8d8a01096eaec89fdf085a815b910c", "score": "0.52558476", "text": "func (bp BaseParam) Copy() BaseParam {\n\tresult := BaseParam{}\n\tresult.Body = make(map[string]interface{})\n\tfor k, v := range bp.Body {\n\t\tval, okType := v.(map[string]interface{})\n\t\tif okType {\n\t\t\tm := make(map[string]interface{})\n\t\t\tfor kVal, vVal := range val {\n\t\t\t\tm[kVal] = vVal\n\t\t\t}\n\t\t\tresult.Body[k] = m\n\t\t} else {\n\t\t\tresult.Body[k] = v\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "f01be985df1e733b805c5a7001154b5a", "score": "0.5237747", "text": "func (ht *HealthTest) copy(ipAddress net.IP) *HealthTest {\n\treturn NewTest(ipAddress, ht.HealthTestParameters, ht.tester)\n}", "title": "" }, { "docid": "35983a9e8345aaaa5771ce5d13759bda", "score": "0.5236783", "text": "func (opts *Proxy) Copy() *Proxy {\n\toptsCopy := *opts\n\treturn &optsCopy\n}", "title": "" }, { "docid": "e2bdf6f95875ddfb15a628b46d1f0c57", "score": "0.52087873", "text": "func CopyAPI(apiToCopy *API) API {\n\tapiCopy := *apiToCopy\n\n\t// Copy Transport slice\n\tapiCopy.Transport = make([]string, len(apiToCopy.Transport))\n\tcopy(apiCopy.Transport, apiToCopy.Transport)\n\n\t// Copy Tags slice\n\tapiCopy.Tags = make([]string, len(apiToCopy.Tags))\n\tcopy(apiCopy.Tags, apiToCopy.Tags)\n\n\t// Copy Policies slice\n\tapiCopy.Policies = make([]string, len(apiToCopy.Policies))\n\tcopy(apiCopy.Policies, apiToCopy.Policies)\n\n\t// Copy SecurityScheme slice\n\tapiCopy.SecurityScheme = make([]string, len(apiToCopy.SecurityScheme))\n\tcopy(apiCopy.SecurityScheme, apiToCopy.SecurityScheme)\n\n\t// Copy VisibleRoles slice\n\tapiCopy.VisibleRoles = make([]string, len(apiToCopy.VisibleRoles))\n\tcopy(apiCopy.VisibleRoles, apiToCopy.VisibleRoles)\n\n\t// Copy VisibleTenants slice\n\tapiCopy.VisibleTenants = make([]string, len(apiToCopy.VisibleTenants))\n\tcopy(apiCopy.VisibleTenants, apiToCopy.VisibleTenants)\n\n\t// Copy MediationPolicies slice\n\tapiCopy.MediationPolicies = make([]MediationPolicy, len(apiToCopy.MediationPolicies))\n\tcopy(apiCopy.MediationPolicies, apiToCopy.MediationPolicies)\n\n\t// Copy SubscriptionAvailableTenants slice\n\tapiCopy.SubscriptionAvailableTenants = make([]string, len(apiToCopy.SubscriptionAvailableTenants))\n\tcopy(apiCopy.SubscriptionAvailableTenants, apiToCopy.SubscriptionAvailableTenants)\n\n\t// Copy AdditionalProperties\n\tfor key, value := range apiToCopy.AdditionalProperties {\n\t\tapiCopy.AdditionalProperties[key] = value\n\t}\n\n\t// Copy AccessControlRoles slice\n\tapiCopy.AccessControlRoles = make([]string, len(apiToCopy.AccessControlRoles))\n\tcopy(apiCopy.AccessControlRoles, apiToCopy.AccessControlRoles)\n\n\t// Copy Operations slice\n\tapiCopy.Operations = make([]APIOperations, len(apiToCopy.Operations))\n\tcopy(apiCopy.Operations, apiToCopy.Operations)\n\n\treturn apiCopy\n}", "title": "" }, { "docid": "d90f9b2f74c381f3276bc7ba0621bb52", "score": "0.51971453", "text": "func (al *accessList) Copy() *accessList {\n\tcp := newAccessList()\n\tfor k, v := range al.addresses {\n\t\tcp.addresses[k] = v\n\t}\n\tcp.slots = make([]map[common.Hash]struct{}, len(al.slots))\n\tfor i, slotMap := range al.slots {\n\t\tnewSlotmap := make(map[common.Hash]struct{}, len(slotMap))\n\t\tfor k := range slotMap {\n\t\t\tnewSlotmap[k] = struct{}{}\n\t\t}\n\t\tcp.slots[i] = newSlotmap\n\t}\n\treturn cp\n}", "title": "" }, { "docid": "184d9af0539dacd885a7023f919bccd5", "score": "0.5192472", "text": "func (c ClientInfo) Copy() ClientInfo {\n\tret := c\n\treturn ret\n}", "title": "" }, { "docid": "184d9af0539dacd885a7023f919bccd5", "score": "0.5192472", "text": "func (c ClientInfo) Copy() ClientInfo {\n\tret := c\n\treturn ret\n}", "title": "" }, { "docid": "2ae91510dbdd22a860835850747657d7", "score": "0.5185432", "text": "func (m Route) Copy() Route {\n\treturn Route{\n\t\tMembers: append([]ProcessSpec_ID(nil), m.Members...),\n\t\tPrimary: m.Primary,\n\t\tEndpoints: append([]Endpoint(nil), m.Endpoints...),\n\t}\n}", "title": "" }, { "docid": "af09851c5beda1a5257d3b99aef8f1ff", "score": "0.5182113", "text": "func (c *Configurations) Copy() device.Resulter {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn &Configurations{\n\t\tDirectionMask: c.DirectionMask,\n\t\tValueMask: c.ValueMask}\n}", "title": "" }, { "docid": "64e87019b60827cd8c231ae0b98a17c1", "score": "0.5177456", "text": "func (b *ServiceInfoBuilder) Copy(object *ServiceInfo) *ServiceInfoBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.fullname = object.fullname\n\tb.statusType = object.statusType\n\treturn b\n}", "title": "" }, { "docid": "53bca579e09b02071c3b457ca3a7bdfd", "score": "0.51689476", "text": "func (c *Config) Copy(cfgs ...*Config) *Config {\n\tdst := &Config{}\n\tdst.MergeIn(c)\n\n\tfor _, cfg := range cfgs {\n\t\tdst.MergeIn(cfg)\n\t}\n\n\treturn dst\n}", "title": "" }, { "docid": "4ba535e893123894f2353dd3120df4ac", "score": "0.5160656", "text": "func (o *Entry) Copy(s Entry) {\n o.Protocol = s.Protocol\n o.Encryption = s.Encryption\n o.Authentication = s.Authentication\n o.DhGroup = s.DhGroup\n o.LifetimeType = s.LifetimeType\n o.LifetimeValue = s.LifetimeValue\n o.LifesizeType = s.LifesizeType\n o.LifesizeValue = s.LifesizeValue\n}", "title": "" }, { "docid": "cd6f42ccd360dd17ec39c33da1fd0da4", "score": "0.51590264", "text": "func (o *Entry) Copy(s Entry) {\n o.Mode = s.Mode\n o.StaticIps = s.StaticIps\n o.EnableDhcp = s.EnableDhcp\n o.CreateDhcpDefaultRoute = s.CreateDhcpDefaultRoute\n o.DhcpDefaultRouteMetric = s.DhcpDefaultRouteMetric\n o.Ipv6Enabled = s.Ipv6Enabled\n o.ManagementProfile = s.ManagementProfile\n o.Mtu = s.Mtu\n o.AdjustTcpMss = s.AdjustTcpMss\n o.NetflowProfile = s.NetflowProfile\n o.LldpEnabled = s.LldpEnabled\n o.LldpProfile = s.LldpProfile\n o.LinkSpeed = s.LinkSpeed\n o.LinkDuplex = s.LinkDuplex\n o.LinkState = s.LinkState\n o.AggregateGroup = s.AggregateGroup\n o.Comment = s.Comment\n o.Ipv4MssAdjust = s.Ipv4MssAdjust\n o.Ipv6MssAdjust = s.Ipv6MssAdjust\n o.EnableUntaggedSubinterface = s.EnableUntaggedSubinterface\n o.DecryptForward = s.DecryptForward\n o.RxPolicingRate = s.RxPolicingRate\n o.TxPolicingRate = s.TxPolicingRate\n o.DhcpSendHostnameEnable = s.DhcpSendHostnameEnable\n o.DhcpSendHostnameValue = s.DhcpSendHostnameValue\n}", "title": "" }, { "docid": "7e0dd47411f6eff743c96d0a277330ee", "score": "0.514463", "text": "func copyExposedPort(port *grpc_application_go.Port) *grpc_application_go.Port {\n\tif port == nil {\n\t\treturn nil\n\t}\n\n\tendpoints := make([]*grpc_application_go.Endpoint, 0)\n\tfor _, endpoint := range port.Endpoints {\n\t\tendpoints = append(endpoints, copyEndPoint(endpoint))\n\t}\n\n\treturn &grpc_application_go.Port{\n\t\tName: port.Name,\n\t\tInternalPort: port.InternalPort,\n\t\tExposedPort: port.ExposedPort,\n\t\tEndpoints: endpoints,\n\t}\n}", "title": "" }, { "docid": "7024222c5f59ad7bf3a82ce6cfd0a21d", "score": "0.51385176", "text": "func (e EnvMap) copy(sizeHint int) EnvMap {\n\tn := len(e) + sizeHint\n\tif n < 0 {\n\t\tn = 0\n\t}\n\tm := make(EnvMap, n)\n\tfor k, v := range e {\n\t\tm[k] = v\n\t}\n\treturn m\n}", "title": "" }, { "docid": "882129441a98d696c40428094a467f01", "score": "0.51141226", "text": "func (ns *NetconfService) CopyConfig(\n\tprovider types.ServiceProvider,\n\ttarget, sourceDS datastore.DataStore,\n\tsourceEntity types.Entity,\n\turl string) bool {\n\n\t// target/source options: candidate | running | startup | url\n\tif (target == datastore.NotSet) {\n\t\terr := errors.YError{Msg: \"You must select target\"}\n\t\tpanic(err.Error())\n\t}\n\n\tif ((target == datastore.URL ||\n\t\tsourceDS == datastore.URL) && len(url) == 0){\n\t\terr := errors.YError{Msg: \"url must be specified\"}\n\t\tpanic(err.Error())\n\t}\n\tif ((sourceDS != datastore.NotSet && sourceEntity != nil) ||\n\t\tsourceDS == datastore.NotSet && sourceEntity == nil) {\n\t\terr := errors.YError{\n\t\t\tMsg: \"sourceDS OR sourceEntity must be valid, not neither nor both\"}\n\t\tpanic(err.Error())\n\t}\n\n\tdata := map[string]interface{} {}\n\tdsStr := target.String()\n\tdataValue := getDataValue(dsStr, url)\n\tdata[\"target/\" + dsStr] = dataValue\n\n\tif (sourceDS != datastore.NotSet){\n\t\tdsStr = sourceDS.String()\n\t\tdataValue = getDataValue(dsStr, url)\n\t\tdata[\"source/\" + dsStr] = dataValue\n\t} else {\n\t\tdata[\"source/config\"] = sourceEntity\n\t}\n\n\treadDataNode := path.ExecuteRPC(\n\t\tprovider, \"ietf-netconf:copy-config\", data, false)\n\treturn operationSucceeded(readDataNode)\n}", "title": "" }, { "docid": "c210a8a09587b11c0e0fd911a13651c0", "score": "0.5109011", "text": "func TestTransformHalconfig_ExposedPortOverridedFromConfig(t *testing.T) {\n\tgateSvc := &corev1.Service{}\n\ttest.ReadYamlFile(\"testdata/output_service_lb.yml\", gateSvc, t)\n\ttr, spinSvc := transformertest.SetupTransformerFromSpinFile(&TransformerGenerator{}, \"testdata/spinsvc_override_port.yml\", t, gateSvc)\n\tgen := &generated.SpinnakerGeneratedConfig{}\n\ttest.AddServiceToGenConfig(gen, \"gate\", \"testdata/input_service.yml\", t)\n\tspinSvc.GetExposeConfig().Service.PublicPort = 0\n\n\terr := tr.TransformManifests(context.TODO(), gen)\n\tassert.Nil(t, err)\n\tassert.Equal(t, int32(8089), gen.Config[\"gate\"].Service.Spec.Ports[0].Port)\n}", "title": "" }, { "docid": "3defcde7fc3995b0cf17b488a34b9a64", "score": "0.5102552", "text": "func (c *ReplicaConfig) Clone() *ReplicaConfig {\n\tstr, err := c.Marshal()\n\tif err != nil {\n\t\tlog.Panic(\"failed to marshal replica config\",\n\t\t\tzap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err)))\n\t}\n\tclone := new(ReplicaConfig)\n\terr = clone.Unmarshal([]byte(str))\n\tif err != nil {\n\t\tlog.Panic(\"failed to unmarshal replica config\",\n\t\t\tzap.Error(cerror.WrapError(cerror.ErrDecodeFailed, err)))\n\t}\n\treturn clone\n}", "title": "" }, { "docid": "31e62800eb4551c899afcc30a5cb8c07", "score": "0.5099801", "text": "func (configuration *VirtualNetworkGatewayIPConfiguration) AssignProperties_From_VirtualNetworkGatewayIPConfiguration(source *v20201101s.VirtualNetworkGatewayIPConfiguration) error {\n\t// Clone the existing property bag\n\tpropertyBag := genruntime.NewPropertyBag(source.PropertyBag)\n\n\t// Name\n\tconfiguration.Name = genruntime.ClonePointerToString(source.Name)\n\n\t// PrivateIPAllocationMethod\n\tconfiguration.PrivateIPAllocationMethod = genruntime.ClonePointerToString(source.PrivateIPAllocationMethod)\n\n\t// PublicIPAddress\n\tif source.PublicIPAddress != nil {\n\t\tvar subResourceStash v20200601s.SubResource\n\t\terr := subResourceStash.AssignProperties_From_SubResource(source.PublicIPAddress)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field SubResourceStash from PublicIPAddress\")\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 publicIPAddress SubResource\n\t\terr = publicIPAddress.AssignProperties_From_SubResource(&subResourceStashLocal)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field PublicIPAddress from SubResourceStash\")\n\t\t}\n\t\tconfiguration.PublicIPAddress = &publicIPAddress\n\t} else {\n\t\tconfiguration.PublicIPAddress = nil\n\t}\n\n\t// Subnet\n\tif source.Subnet != nil {\n\t\tvar subResourceStash v20200601s.SubResource\n\t\terr := subResourceStash.AssignProperties_From_SubResource(source.Subnet)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field SubResourceStash from Subnet\")\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 subnet SubResource\n\t\terr = subnet.AssignProperties_From_SubResource(&subResourceStashLocal)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"calling AssignProperties_From_SubResource() to populate field Subnet from SubResourceStash\")\n\t\t}\n\t\tconfiguration.Subnet = &subnet\n\t} else {\n\t\tconfiguration.Subnet = nil\n\t}\n\n\t// Update the property bag\n\tif len(propertyBag) > 0 {\n\t\tconfiguration.PropertyBag = propertyBag\n\t} else {\n\t\tconfiguration.PropertyBag = nil\n\t}\n\n\t// Invoke the augmentConversionForVirtualNetworkGatewayIPConfiguration interface (if implemented) to customize the conversion\n\tvar configurationAsAny any = configuration\n\tif augmentedConfiguration, ok := configurationAsAny.(augmentConversionForVirtualNetworkGatewayIPConfiguration); ok {\n\t\terr := augmentedConfiguration.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": "49b52bdff7aa85b9b21aa298c7cfe88b", "score": "0.5092998", "text": "func (o Options) Copy() Options {\n\tto := o\n\tto.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))\n\tcopy(to.APIOptions, o.APIOptions)\n\n\treturn to\n}", "title": "" }, { "docid": "afd846651bcdbcfc0da0148d122997bf", "score": "0.5085057", "text": "func TestTransformHalconfig_ExposedPortOverrideAddedToConfig(t *testing.T) {\n\tgateSvc := &corev1.Service{}\n\ttest.ReadYamlFile(\"testdata/output_service_lb.yml\", gateSvc, t)\n\tgateSvc.Status.LoadBalancer.Ingress = append(gateSvc.Status.LoadBalancer.Ingress, corev1.LoadBalancerIngress{Hostname: \"abc.com\"})\n\ts := `\napiVersion: spinnaker.io/v1alpha2\nkind: SpinnakerService\nmetadata:\n name: spinnaker\n namespace: ns1\nspec:\n spinnakerConfig:\n config: {}\n expose:\n type: service\n service:\n type: LoadBalancer\n publicPort: 80\n overrides: \n gate:\n publicPort: 7777\n`\n\ttr, _ := transformertest.SetupTransformerFromSpinText(&TransformerGenerator{}, s, t, gateSvc)\n\tgen := &generated.SpinnakerGeneratedConfig{}\n\ttest.AddServiceToGenConfig(gen, \"gate\", \"testdata/input_service.yml\", t)\n\n\terr := tr.TransformConfig(context.TODO())\n\tassert.Nil(t, err)\n\n\tactualOverrideUrl, err := (tr.(*exposeTransformer)).svc.GetSpinnakerConfig().GetHalConfigPropString(context.TODO(), util.GateOverrideBaseUrlProp)\n\tassert.Nil(t, err)\n\tassert.Equal(t, \"http://abc.com:7777\", actualOverrideUrl)\n\tassert.Equal(t, \"http://abc.com:7777\", (tr.(*exposeTransformer)).svc.GetStatus().APIUrl)\n}", "title": "" }, { "docid": "c66ff80bf315a116831c9978492e5a78", "score": "0.50793433", "text": "func (r RouteInfo) Copy() RouteInfo {\n\tcp := r\n\tif len(r.Refs) != 0 {\n\t\tcp.Refs = make([]Ref, len(r.Refs))\n\t\tcopy(cp.Refs, r.Refs)\n\t}\n\tif len(r.Pools) != 0 {\n\t\tcp.Pools = make([]Pool, len(r.Pools))\n\t\tcopy(cp.Pools, r.Pools)\n\t}\n\tif len(r.Blocks) != 0 {\n\t\tcp.Blocks = make([]Block, len(r.Blocks))\n\t\tcopy(cp.Blocks, r.Blocks)\n\t}\n\treturn cp\n}", "title": "" }, { "docid": "290f23df483b4f900cfe73262151d61d", "score": "0.5078015", "text": "func (f *FindBidRequest) Copy() *FindBidRequest {\n\treturn &FindBidRequest{\n\t\tAddr: f.Addr.Copy(),\n\t}\n}", "title": "" }, { "docid": "f5d6faafe649dd283249d1eaf8eec6ff", "score": "0.5077788", "text": "func LoadIPAMConfig(ifAddr *netlink.Addr, bytes []byte, envArgs string) (*IPAMConfig, string, error) {\n\tn := Net{}\n\tif err := json.Unmarshal(bytes, &n); err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\t//logging.Debugf(\"LoadIPAMConfig Net: %#v\", n)\n\t//logging.Debugf(\"LoadIPAMConfig envArgs: %#v\", envArgs)\n\n\tif n.IPAM == nil {\n\t\tlogging.Debugf(\"IPAM config missing 'ipam' key\")\n\t\treturn nil, \"\", fmt.Errorf(\"IPAM config missing 'ipam' key\")\n\t}\n\n\tif ifAddr != nil {\n\t\tlogging.Debugf(\"IPAM ifAddr IP: %v\", ifAddr.IP)\n\t\tlogging.Debugf(\"IPAM ifAddr mask hex: %v\", ifAddr.Mask)\n\t\tlogging.Debugf(\"IPAM ifAddr mash dec: %v\", net.IP(ifAddr.Mask))\n\n\t\tmask := net.IPMask(net.ParseIP(net.IP(ifAddr.Mask).String()).To4())\n\t\tprefixSize, _ := mask.Size()\n\n\t\tlogging.Debugf(\"IPAM ifAddr mash dec: %v\", prefixSize)\n\n\t\tn.IPAM.Addresses[0].AddressStr = ifAddr.IP.String() + \"/\" + strconv.Itoa(prefixSize)\n\t\tn.IPAM.Addresses[0].Address.IP = ifAddr.IP\n\t\tn.IPAM.Addresses[0].Address.Mask = ifAddr.Mask\n\n\t\tlogging.Debugf(\"IPAM Addresses AddressStr: %v\", n.IPAM.Addresses[0].AddressStr)\n\t\tlogging.Debugf(\"IPAM Addresses Address: %v\", n.IPAM.Addresses[0].Address)\n\t\tlogging.Debugf(\"IPAM Addresses Address IP: %v\", n.IPAM.Addresses[0].Address.IP)\n\n\t\tif err := canonicalizeIP(&n.IPAM.Addresses[0].Address.IP); err != nil {\n\t\t\treturn nil, \"\", logging.Debugf(\"invalid address %d: %s\", 0, err)\n\t\t}\n\n\t\tif n.IPAM.Addresses[0].Address.IP.To4() != nil {\n\t\t\tn.IPAM.Addresses[0].Version = \"4\"\n\t\t} else {\n\t\t\tn.IPAM.Addresses[0].Version = \"6\"\n\t\t}\n\n\t\tlogging.Debugf(\"IPAM Addresses Address Version: %v\", n.IPAM.Addresses[0].Version)\n\t}\n\n\t// Copy net name into IPAM so not to drag Net struct around\n\tn.IPAM.Name = n.Name\n\tlogging.Debugf(\"IPAM name: %v\", n.IPAM.Name)\n\n\treturn n.IPAM, n.CNIVersion, nil\n}", "title": "" }, { "docid": "3c06bcdf6345c32d221419c798be36ed", "score": "0.5066088", "text": "func (e EdgeMetadata) Copy() EdgeMetadata {\n\treturn EdgeMetadata{\n\t\tEgressPacketCount: cpu64ptr(e.EgressPacketCount),\n\t\tIngressPacketCount: cpu64ptr(e.IngressPacketCount),\n\t\tEgressByteCount: cpu64ptr(e.EgressByteCount),\n\t\tIngressByteCount: cpu64ptr(e.IngressByteCount),\n\t}\n}", "title": "" }, { "docid": "78c9c16fffb7204ea202fd838cabfbbf", "score": "0.5059151", "text": "func (o *Entry) Copy(s Entry) {\n\to.AdminUseOnly = s.AdminUseOnly\n\n\tif s.Servers == nil {\n\t\to.Servers = nil\n\t} else {\n\t\to.Servers = make([]Server, 0, len(s.Servers))\n\t\tfor _, x := range s.Servers {\n\t\t\to.Servers = append(o.Servers, Server{\n\t\t\t\tName: x.Name,\n\t\t\t\tServer: x.Server,\n\t\t\t\tPort: x.Port,\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d8104fa024199903b1bbd6694e8f2edc", "score": "0.50585693", "text": "func (c *ConsulConnect) Copy() *ConsulConnect {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\treturn &ConsulConnect{\n\t\tNative: c.Native,\n\t\tSidecarService: c.SidecarService.Copy(),\n\t\tSidecarTask: c.SidecarTask.Copy(),\n\t\tGateway: c.Gateway.Copy(),\n\t}\n}", "title": "" }, { "docid": "519f93cd91bbe8cd5af4d0479083aa4f", "score": "0.50556386", "text": "func (es *ExecutionService) CloneCfg() *ExecServiceCfg {\n\tclone := ExecServiceCfg{}\n\tcopier.Copy(&clone, es.ServiceCfgInUse)\n\treturn &clone\n}", "title": "" }, { "docid": "a20055a847619cb7a9d5e359c963cf0a", "score": "0.5051097", "text": "func (in *Endpoint) DeepCopyInto(out *Endpoint) {\n\t*out = *in\n\tif in.TargetPort != nil {\n\t\tin, out := &in.TargetPort, &out.TargetPort\n\t\t*out = new(intstr.IntOrString)\n\t\t**out = **in\n\t}\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\tvar outVal []string\n\t\t\tif val == nil {\n\t\t\t\t(*out)[key] = nil\n\t\t\t} else {\n\t\t\t\tin, out := &val, &outVal\n\t\t\t\t*out = make([]string, len(*in))\n\t\t\t\tcopy(*out, *in)\n\t\t\t}\n\t\t\t(*out)[key] = outVal\n\t\t}\n\t}\n\tif in.TLSConfig != nil {\n\t\tin, out := &in.TLSConfig, &out.TLSConfig\n\t\t*out = new(TLSConfig)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tin.BearerTokenSecret.DeepCopyInto(&out.BearerTokenSecret)\n\tif in.HonorTimestamps != nil {\n\t\tin, out := &in.HonorTimestamps, &out.HonorTimestamps\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.BasicAuth != nil {\n\t\tin, out := &in.BasicAuth, &out.BasicAuth\n\t\t*out = new(BasicAuth)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.MetricRelabelConfigs != nil {\n\t\tin, out := &in.MetricRelabelConfigs, &out.MetricRelabelConfigs\n\t\t*out = make([]*RelabelConfig, 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(RelabelConfig)\n\t\t\t\t(*in).DeepCopyInto(*out)\n\t\t\t}\n\t\t}\n\t}\n\tif in.RelabelConfigs != nil {\n\t\tin, out := &in.RelabelConfigs, &out.RelabelConfigs\n\t\t*out = make([]*RelabelConfig, 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(RelabelConfig)\n\t\t\t\t(*in).DeepCopyInto(*out)\n\t\t\t}\n\t\t}\n\t}\n\tif in.ProxyURL != nil {\n\t\tin, out := &in.ProxyURL, &out.ProxyURL\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "6e2cc2324378fe78a7f419b4e42df1f2", "score": "0.50394356", "text": "func TestTransformHalconfig_ExposedPortRemovedFromConfig(t *testing.T) {\n\tgateSvc := &corev1.Service{}\n\ttest.ReadYamlFile(\"testdata/output_service_lb.yml\", gateSvc, t)\n\tgateSvc.Spec.Ports[0].Port = 1111\n\tgateSvc.Status.LoadBalancer.Ingress = append(gateSvc.Status.LoadBalancer.Ingress, corev1.LoadBalancerIngress{Hostname: \"abc.com\"})\n\ttr, spinSvc := transformertest.SetupTransformerFromSpinFile(&TransformerGenerator{}, \"testdata/spinsvc_expose.yml\", t, gateSvc)\n\tgen := &generated.SpinnakerGeneratedConfig{}\n\ttest.AddServiceToGenConfig(gen, \"gate\", \"testdata/input_service.yml\", t)\n\tspinSvc.GetExposeConfig().Service.PublicPort = 0\n\n\terr := tr.TransformConfig(context.TODO())\n\tassert.Nil(t, err)\n\n\tactualOverrideUrl, err := (tr.(*exposeTransformer)).svc.GetSpinnakerConfig().GetHalConfigPropString(context.TODO(), util.GateOverrideBaseUrlProp)\n\tassert.Nil(t, err)\n\tassert.Equal(t, \"http://abc.com\", actualOverrideUrl)\n\tassert.Equal(t, \"http://abc.com\", (tr.(*exposeTransformer)).svc.GetStatus().APIUrl)\n}", "title": "" }, { "docid": "a901f1cd73497844575f353ebe7fde33", "score": "0.5032659", "text": "func (p Params) Copy() (out Params) {\n\tout = make(Params, len(p))\n\tfor k, v := range p {\n\t\tout[k] = v\n\t}\n\treturn out\n}", "title": "" }, { "docid": "82c5e0d8451d0de7514db2e30531f31d", "score": "0.5023619", "text": "func (route *Route) Copy() *Route {\n\treturn &Route{\n\t\tKey: route.Key,\n\t\tPatt: route.Patt,\n\t\tAddr: route.Addr,\n\t\tspoolDir: route.spoolDir,\n\t\tSpool: route.Spool,\n\t\tinstrument: route.instrument,\n\t\tReg: route.Reg,\n\t\tPickle: route.Pickle,\n\t\tOnline: route.Online,\n\t}\n}", "title": "" }, { "docid": "c3d9019e1f935ca94fff97e6039175b4", "score": "0.5019595", "text": "func (this *IvDomPart) Copy() *IvDomPart {\n\treturn CreateIvDomPart(this.From, this.To)\n}", "title": "" }, { "docid": "57827b990df5bd75deb303052718846b", "score": "0.5018775", "text": "func (self *Resource) copy() Resource {\n\tvar rc Resource\n\trc = *self\n\tproto := make([]Protocol, len(self.Protocols))\n\tcopy(proto, self.Protocols)\n\trc.Protocols = proto\n\treturn rc\n}", "title": "" }, { "docid": "dd035ca2182622b80de9616e486236b8", "score": "0.5007816", "text": "func (u *ConsulUpstream) Copy() *ConsulUpstream {\n\tif u == nil {\n\t\treturn nil\n\t}\n\n\treturn &ConsulUpstream{\n\t\tDestinationName: u.DestinationName,\n\t\tDestinationNamespace: u.DestinationNamespace,\n\t\tLocalBindPort: u.LocalBindPort,\n\t\tDatacenter: u.Datacenter,\n\t\tLocalBindAddress: u.LocalBindAddress,\n\t\tMeshGateway: u.MeshGateway.Copy(),\n\t}\n}", "title": "" }, { "docid": "c8dc2734e4341178aa26816a894677e9", "score": "0.4991647", "text": "func (s *Service) Copy() *Service {\n\tif s == nil {\n\t\treturn nil\n\t}\n\tns := new(Service)\n\t*ns = *s\n\tns.Tags = helper.CopySliceString(ns.Tags)\n\tns.CanaryTags = helper.CopySliceString(ns.CanaryTags)\n\n\tif s.Checks != nil {\n\t\tchecks := make([]*ServiceCheck, len(ns.Checks))\n\t\tfor i, c := range ns.Checks {\n\t\t\tchecks[i] = c.Copy()\n\t\t}\n\t\tns.Checks = checks\n\t}\n\n\tns.Connect = s.Connect.Copy()\n\n\tns.Meta = helper.CopyMapStringString(s.Meta)\n\tns.CanaryMeta = helper.CopyMapStringString(s.CanaryMeta)\n\n\treturn ns\n}", "title": "" }, { "docid": "72263aaea76cb8e59ae778505dcecb4e", "score": "0.49677235", "text": "func (in *ArbitraryFSAccessThroughSMsConfig) DeepCopyInto(out *ArbitraryFSAccessThroughSMsConfig) {\n\t*out = *in\n}", "title": "" }, { "docid": "bd7135bb68eb3c9d4b6c953dcfc09163", "score": "0.49633652", "text": "func (b *GithubIdentityProviderBuilder) Copy(object *GithubIdentityProvider) *GithubIdentityProviderBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.ca = object.ca\n\tb.clientID = object.clientID\n\tb.clientSecret = object.clientSecret\n\tb.hostname = object.hostname\n\tif object.organizations != nil {\n\t\tb.organizations = make([]string, len(object.organizations))\n\t\tcopy(b.organizations, object.organizations)\n\t} else {\n\t\tb.organizations = nil\n\t}\n\tif object.teams != nil {\n\t\tb.teams = make([]string, len(object.teams))\n\t\tcopy(b.teams, object.teams)\n\t} else {\n\t\tb.teams = nil\n\t}\n\treturn b\n}", "title": "" }, { "docid": "db12e8c0310b826dd762c97e1305be9c", "score": "0.49372905", "text": "func (e *Environ) Copy() *Environ {\n\treturn &Environ{\n\t\tID: e.ID,\n\t\tName: e.Name,\n\t}\n}", "title": "" }, { "docid": "805387c2f92f1b3dd599a227799bd180", "score": "0.49355236", "text": "func copyMachineDeploymentConfigToMachineSet(deployment *v1alpha1.MachineDeployment, is *v1alpha1.MachineSet) bool {\n\tisConfigChanged := !(apiequality.Semantic.DeepEqual(deployment.Spec.Template.Spec.MachineConfiguration, is.Spec.Template.Spec.MachineConfiguration))\n\n\tif isConfigChanged {\n\t\tklog.V(2).Infof(\"Observed a change in Config of Machine Deployment %s. Changing Config from %+v to \\n %+v.\", deployment.Name, is.Spec.Template.Spec.MachineConfiguration, deployment.Spec.Template.Spec.MachineConfiguration)\n\n\t\tis.Spec.Template.Spec.MachineConfiguration = deployment.Spec.Template.Spec.MachineConfiguration.DeepCopy()\n\t}\n\treturn isConfigChanged\n}", "title": "" }, { "docid": "0c567a8cbc387835ed262aec4c151c4d", "score": "0.49332383", "text": "func newIPAddressMutation(c config, op Op, opts ...ipaddressOption) *IPAddressMutation {\n\tm := &IPAddressMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeIPAddress,\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": "7498c75f8d10a0ced29ee4c3dd233328", "score": "0.49282983", "text": "func BindCopyConfigByKey(key string) (*Config, error) {\n\tvar cfg Config\n\t// NOTE: viper uses \"mapstructure\" tags instead of \"yaml\" tags\n\tif err := viper.UnmarshalKey(key, &cfg.Copy); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "3a68372d6977967b213b3ca72ddbf67c", "score": "0.492775", "text": "func (request *ConnectRequest) CopyTo(target base.IProxyMessage) {\n\trequest.ProxyRequest.CopyTo(target)\n\tif v, ok := target.(*ConnectRequest); ok {\n\t\tv.SetEndpoints(request.GetEndpoints())\n\t\tv.SetIdentity(request.GetIdentity())\n\t}\n}", "title": "" }, { "docid": "a95cf144ab48318455247203d9c9fd18", "score": "0.4922267", "text": "func (o *Entry) Copy(s Entry) {\n\to.Mode = s.Mode\n\to.StaticIps = s.StaticIps\n\to.EnableDhcp = s.EnableDhcp\n\to.CreateDhcpDefaultRoute = s.CreateDhcpDefaultRoute\n\to.DhcpDefaultRouteMetric = s.DhcpDefaultRouteMetric\n\to.Ipv6Enabled = s.Ipv6Enabled\n\to.ManagementProfile = s.ManagementProfile\n\to.Mtu = s.Mtu\n\to.AdjustTcpMss = s.AdjustTcpMss\n\to.NetflowProfile = s.NetflowProfile\n\to.LldpEnabled = s.LldpEnabled\n\to.LldpProfile = s.LldpProfile\n\to.LldpHaPassivePreNegotiation = s.LldpHaPassivePreNegotiation\n\to.LacpHaPassivePreNegotiation = s.LacpHaPassivePreNegotiation\n\to.LinkSpeed = s.LinkSpeed\n\to.LinkDuplex = s.LinkDuplex\n\to.LinkState = s.LinkState\n\to.AggregateGroup = s.AggregateGroup\n\to.Comment = s.Comment\n\to.LacpPortPriority = s.LacpPortPriority\n\to.Ipv4MssAdjust = s.Ipv4MssAdjust\n\to.Ipv6MssAdjust = s.Ipv6MssAdjust\n\to.EnableUntaggedSubinterface = s.EnableUntaggedSubinterface\n\to.DecryptForward = s.DecryptForward\n\to.RxPolicingRate = s.RxPolicingRate\n\to.TxPolicingRate = s.TxPolicingRate\n\to.DhcpSendHostnameEnable = s.DhcpSendHostnameEnable\n\to.DhcpSendHostnameValue = s.DhcpSendHostnameValue\n}", "title": "" }, { "docid": "5dd8b0960495bc85a3bcabb0f58b00e8", "score": "0.49091163", "text": "func CopyEpinioSettings(dir string) (string, error) {\n\treturn proc.Run(\"\", false, \"cp\", EpinioYAML(), dir+\"/epinio.yaml\")\n}", "title": "" }, { "docid": "6badc3a69a33c9cd58ba18a142a30c95", "score": "0.49064848", "text": "func newConfig(workspace string) {\n\tif Op != nil {\n\t\treturn\n\t}\n\n\topConfig, err := readConfig(workspace)\n\tlog.CheckIfErrorMessage(err, \"Error when reading config.\")\n\n\tOp = &opConfig\n}", "title": "" }, { "docid": "97e1c802a769b18b15c33f9380e76868", "score": "0.48806757", "text": "func TestTransformHalconfig_ExposedPortChanges(t *testing.T) {\n\tgateSvc := &corev1.Service{}\n\ttest.ReadYamlFile(\"testdata/output_service_lb.yml\", gateSvc, t)\n\tgateSvc.Spec.Ports[0].Port = 1111\n\tgateSvc.Status.LoadBalancer.Ingress = append(gateSvc.Status.LoadBalancer.Ingress, corev1.LoadBalancerIngress{Hostname: \"abc.com\"})\n\ttr, spinSvc := transformertest.SetupTransformerFromSpinFile(&TransformerGenerator{}, \"testdata/spinsvc_expose.yml\", t, gateSvc)\n\tgen := &generated.SpinnakerGeneratedConfig{}\n\ttest.AddServiceToGenConfig(gen, \"gate\", \"testdata/input_service.yml\", t)\n\tspinSvc.GetExposeConfig().Service.PublicPort = 7777\n\n\terr := tr.TransformConfig(context.TODO())\n\tassert.Nil(t, err)\n\n\tactualOverrideUrl, err := (tr.(*exposeTransformer)).svc.GetSpinnakerConfig().GetHalConfigPropString(context.TODO(), util.GateOverrideBaseUrlProp)\n\tassert.Nil(t, err)\n\tassert.Equal(t, \"http://abc.com:7777\", actualOverrideUrl)\n\tassert.Equal(t, \"http://abc.com:7777\", (tr.(*exposeTransformer)).svc.GetStatus().APIUrl)\n}", "title": "" }, { "docid": "06ade114db4f821bc77862876c19a702", "score": "0.4876759", "text": "func Copy(ctx context.Context, client Client, from, to string) error {\n\tsrcManifest, err := client.GetManifest(ctx, from)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to get manifest for source artifact %q: %w\", from, err)\n\t}\n\n\tstore := GenericStore(func(ctx context.Context, desc ocispecv1.Descriptor, writer io.Writer) error {\n\t\treturn client.Fetch(ctx, from, desc, writer)\n\t})\n\n\treturn client.PushManifest(ctx, to, srcManifest, WithStore(store))\n}", "title": "" }, { "docid": "835335dcc29787431cc7069e6694ebd5", "score": "0.4873643", "text": "func (b *VersionInquiryRequestBuilder) Copy(object *VersionInquiryRequest) *VersionInquiryRequestBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.serviceType = object.serviceType\n\treturn b\n}", "title": "" }, { "docid": "5559699980bfa533f242344f7126d198", "score": "0.48649523", "text": "func transferConfig() ([]byte, error) {\n\tconfigLock.RLock()\n\tdefer configLock.RUnlock()\n\n\twait2dump := conf.MosnConfig\n\tlisteners := make([]v2.Listener, 0, len(conf.Listener))\n\tfor _, l := range conf.Listener {\n\t\tlisteners = append(listeners, l)\n\t}\n\tclusters := make([]v2.Cluster, 0, len(conf.Cluster))\n\tfor _, c := range conf.Cluster {\n\t\tclusters = append(clusters, c)\n\t}\n\trouters := make([]*v2.RouterConfiguration, 0, len(conf.Routers))\n\t// get routers, should set the original path\n\tfor name := range conf.Routers {\n\t\trouterPath := conf.routerConfigPath[name]\n\t\tr := conf.Routers[name] // copy the value\n\t\tr.RouterConfigPath = routerPath\n\t\trouters = append(routers, &r)\n\t}\n\textends := make(map[string]json.RawMessage, len(conf.ExtendConfigs))\n\tfor k, v := range conf.ExtendConfigs {\n\t\textends[k] = v\n\t}\n\tif len(wait2dump.Servers) == 0 {\n\t\tlog.DefaultLogger.Errorf(\"no server config should only exists in test mode. mock an empty one\")\n\t\twait2dump.Servers = make([]v2.ServerConfig, 1)\n\t\twait2dump.Servers[0] = v2.ServerConfig{}\n\t}\n\twait2dump.Servers[0].Listeners = listeners\n\twait2dump.Servers[0].Routers = routers\n\twait2dump.ClusterManager.Clusters = clusters\n\twait2dump.ClusterManager.ClusterConfigPath = conf.clusterConfigPath\n\twait2dump.Extends = extends\n\tif transferExtensionFunc != nil {\n\t\ttransferExtensionFunc(&wait2dump)\n\t}\n\treturn json.MarshalIndent(wait2dump, \"\", \" \")\n}", "title": "" }, { "docid": "2853f5d31cd8902cacae3aa6cc478955", "score": "0.48607236", "text": "func (c EdgeMetadatas) Copy() EdgeMetadatas {\n\treturn c\n}", "title": "" }, { "docid": "3569dc9185ea513fac52a24c1c7ecab3", "score": "0.48570302", "text": "func swaggerCopy(orig json.RawMessage) json.RawMessage {\n\tc := make(json.RawMessage, len(orig))\n\tcopy(c, orig)\n\treturn c\n}", "title": "" }, { "docid": "2afc872ec485f509302dd24605c36e5e", "score": "0.4855839", "text": "func toJSON() IBotConfiguration {\nnewConfig:= new(IBotConfiguration)\nObject.assign(newConfig, this)\ndelete (<any>newConfig).internal\nnewConfig.services = this.services.slice().map((service: IConnectedService) => (<ConnectedService>service).toJSON())\n\nreturn newConfig\n}", "title": "" }, { "docid": "a3448c843e485b8a4bae13169ab786ad", "score": "0.48533553", "text": "func (s *Secret) Copy() *Secret {\n\treturn &Secret{\n\t\tID: s.ID,\n\t\tOrgID: s.OrgID,\n\t\tRepoID: s.RepoID,\n\t\tName: s.Name,\n\t\tImages: s.Images,\n\t\tPluginsOnly: s.PluginsOnly,\n\t\tEvents: sortEvents(s.Events),\n\t}\n}", "title": "" }, { "docid": "679d375676e6a697a7ebf7d5a55f95f4", "score": "0.4819347", "text": "func copyService(service *grpc_application_go.Service, settings *OrganizationSettings) *grpc_application_go.Service {\n\n\tif service == nil {\n\t\treturn nil\n\t}\n\n\tstorage := make([]*grpc_application_go.Storage, 0)\n\tfor _, sto := range service.Storage {\n\t\tstorage = append(storage, copyStorage(sto, settings))\n\t}\n\n\tports := make([]*grpc_application_go.Port, 0)\n\tfor _, port := range service.ExposedPorts {\n\t\tports = append(ports, copyExposedPort(port))\n\t}\n\n\tfiles := make([]*grpc_application_go.ConfigFile, 0)\n\tfor _, file := range service.Configs {\n\t\tfiles = append(files, copyConfigFile(file))\n\t}\n\n\treturn &grpc_application_go.Service{\n\t\tOrganizationId: service.OrganizationId,\n\t\tAppDescriptorId: service.AppDescriptorId,\n\t\tServiceGroupId: service.ServiceGroupId,\n\t\tServiceId: service.ServiceId,\n\t\tName: service.Name,\n\t\tType: service.Type,\n\t\tImage: service.Image,\n\t\tCredentials: copyImageCredential(service.Credentials),\n\t\tSpecs: copyDeploySpec(service.Specs),\n\t\tStorage: storage,\n\t\tExposedPorts: ports,\n\t\tEnvironmentVariables: service.EnvironmentVariables,\n\t\tConfigs: files,\n\t\tLabels: service.Labels,\n\t\tDeployAfter: service.DeployAfter,\n\t\tRunArguments: service.RunArguments,\n\t}\n\n}", "title": "" }, { "docid": "83d6f538c05816bedd1f2b2f5aad3f50", "score": "0.48161522", "text": "func TestIPAddress_config(t *testing.T) {\n\taddrs := makeAddrs([][2]string{\n\t\t{\"/addresses/address[ip='10.0.0.1']\", \"\"},\n\t\t{\"/addresses/address[ip='10.0.0.1']/config\", \"\"},\n\t\t{\"/addresses/address[ip='10.0.0.1']/config/ip\", \"10.0.0.1\"},\n\t\t{\"/addresses/address[ip='10.0.0.1']/config/prefix-length\", \"24\"},\n\t})\n\n\tt.Log(addrs)\n\n\t// check\n\tif v := len(addrs); v != 1 {\n\t\tt.Errorf(\"IPAddress.Put unmatch. len=%d\", v)\n\t}\n\n\taddr := addrs[\"10.0.0.1\"]\n\n\tif v := addr.Config.Compare(SUBINTERFACE_ADDR_IP_KEY, SUBINTERFACE_ADDR_PREFIXLEN_KEY); !v {\n\t\tt.Errorf(\"IPAddress.Put unmatch. config.cmp=%t\", v)\n\t}\n\tif v := addr.Config.IP.String(); v != \"10.0.0.1\" {\n\t\tt.Errorf(\"IPAddress.Put unmatch. config.ip=%s\", v)\n\t}\n\tif v := addr.Config.PrefixLen; v != 24 {\n\t\tt.Errorf(\"IPAddress.Put unmatch. config.ip=%d\", v)\n\t}\n}", "title": "" }, { "docid": "57e6fd1b3f416f521c1a982a131ff4b7", "score": "0.48147327", "text": "func (initp *InitParams) substituteEndpoint(networkType asdbv1.AerospikeNetworkType,\n\taddressType, configuredIP string, interfaceIPs []string, confString string) string {\n\tvar (\n\t\taccessAddress []string\n\t\taccessPort int32\n\t)\n\n\tpodPort := initp.networkInfo.podPort\n\tmappedPort := initp.networkInfo.mappedPort\n\n\tif addressType == tlsAccess || addressType == tlsAlternateAccess {\n\t\tpodPort = initp.networkInfo.podTLSPort\n\t\tmappedPort = initp.networkInfo.mappedTLSPort\n\t}\n\n\t//nolint:exhaustive // fallback to default\n\tswitch networkType {\n\tcase asdbv1.AerospikeNetworkTypePod:\n\t\taccessAddress = append(accessAddress, initp.networkInfo.podIP)\n\t\taccessPort = podPort\n\n\tcase asdbv1.AerospikeNetworkTypeHostInternal:\n\t\taccessAddress = append(accessAddress, initp.networkInfo.internalIP)\n\t\taccessPort = mappedPort\n\n\tcase asdbv1.AerospikeNetworkTypeHostExternal:\n\t\taccessAddress = append(accessAddress, initp.networkInfo.externalIP)\n\t\taccessPort = mappedPort\n\n\tcase asdbv1.AerospikeNetworkTypeConfigured:\n\t\tif configuredIP == \"\" {\n\t\t\tinitp.logger.Error(fmt.Errorf(\"configureIP missing\"),\n\t\t\t\tfmt.Sprintf(\"Please set %s and %s node label to use NetworkPolicy configuredIP for \"+\n\t\t\t\t\t\"access and alternateAccess addresses\", configuredAccessIPLabel, configuredAlternateAccessIPLabel))\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\taccessAddress = append(accessAddress, configuredIP)\n\t\taccessPort = mappedPort\n\n\tcase asdbv1.AerospikeNetworkTypeCustomInterface:\n\t\taccessAddress = interfaceIPs\n\t\taccessPort = podPort\n\n\tdefault:\n\t\taccessAddress = append(accessAddress, initp.networkInfo.podIP)\n\t\taccessPort = podPort\n\t}\n\n\t// Store computed address to update the status later.\n\tswitch addressType {\n\tcase access:\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalAccessAddress = accessAddress\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalAccessPort = accessPort\n\n\tcase alternateAccess:\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalAlternateAccessAddress = accessAddress\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalAlternateAccessPort = accessPort\n\n\tcase tlsAccess:\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalTLSAccessAddress = accessAddress\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalTLSAccessPort = accessPort\n\n\tcase tlsAlternateAccess:\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalTLSAlternateAccessAddress = accessAddress\n\t\tinitp.networkInfo.globalAddressesAndPorts.globalTLSAlternateAccessPort = accessPort\n\t}\n\n\t// Substitute in the configuration file.\n\t// If multiple IPs are found, then add all of them in the specific addressType\n\tvar newStr string\n\tfor _, addr := range accessAddress {\n\t\tnewStr += fmt.Sprintf(\"%s-address %s\\n \", addressType, addr)\n\t}\n\n\tconfString = strings.ReplaceAll(confString, fmt.Sprintf(\"%s-address <%s-address>\", addressType, addressType),\n\t\tstrings.TrimSuffix(newStr, \"\\n \"))\n\n\tre := regexp.MustCompile(fmt.Sprintf(\"\\\\s*%s-port\\\\s*%d\", addressType, podPort))\n\n\tif portString := re.FindString(confString); portString != \"\" {\n\t\t// # This port is set in api/v1beta1/aerospikecluster_mutating_webhook.go and is used as placeholder.\n\t\tconfString = strings.ReplaceAll(confString, portString,\n\t\t\tstrings.ReplaceAll(portString, strconv.Itoa(int(podPort)), strconv.Itoa(int(accessPort))))\n\t}\n\n\treturn confString\n}", "title": "" }, { "docid": "e43c7594a8d7984528a3f0a5d3b6640d", "score": "0.47992992", "text": "func (sm *ShardMaster) copyConfig(index int, config *Config) {\n\tif index == -1 || index >= len(sm.configs) {\n\t\tindex = len(sm.configs) - 1\n\t}\n\tconfig.Num = sm.configs[index].Num\n\tconfig.Shards = sm.configs[index].Shards\n\tconfig.Groups = make(map[int][]string)\n\tfor k, v := range sm.configs[index].Groups {\n\t\tvar servers = make([]string, len(v))\n\t\tcopy(servers, v)\n\t\tconfig.Groups[k] = servers\n\t}\n}", "title": "" }, { "docid": "11286a7809c5ef0a3117bd6f7884dbf2", "score": "0.47896653", "text": "func (dp *DimProperties) Copy() *DimProperties {\n\tclonedDimension := dp.Dimension\n\n\tclonedProperties := make(map[string]string)\n\tfor k, v := range dp.Properties {\n\t\tclonedProperties[k] = v\n\t}\n\n\tclonedTags := make(map[string]bool)\n\tfor k, v := range dp.Tags {\n\t\tclonedTags[k] = v\n\t}\n\n\treturn &DimProperties{\n\t\tDimension: clonedDimension,\n\t\tProperties: clonedProperties,\n\t\tTags: clonedTags,\n\t}\n}", "title": "" }, { "docid": "d361929372c5af8696c357d2a6d420d2", "score": "0.47781458", "text": "func (t *SharedSecret) Copy() *SharedSecret {\n\tc := &SharedSecret{}\n\tcopier.Copy(&c, &t)\n\treturn c\n}", "title": "" }, { "docid": "9732903489ebf9de44aed8feb5604d4d", "score": "0.47754607", "text": "func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) {\n\tipamConf := &Conf{}\n\n\tif err := json.Unmarshal(bytes, &ipamConf); err != nil {\n\t\treturn nil, \"\", errors.Wrapf(err, \"loadIPAMConfig config: failed to load netconf, %s\", string(bytes))\n\t}\n\tif ipamConf.IPAM == nil {\n\t\treturn nil, \"\", errors.New(\"loadIPAMConfig config: 'IPAM' field missing in configuration: \" + string(bytes))\n\t}\n\n\t// subnet is required to allocate ip address\n\tif ipamConf.IPAM.IPV4Subnet.IP == nil || ipamConf.IPAM.IPV4Subnet.Mask == nil {\n\t\treturn nil, \"\", errors.New(\"loadIPAMConfig config: subnet is required\")\n\t}\n\tif ones, _ := ipamConf.IPAM.IPV4Subnet.Mask.Size(); ones > ipstore.MaxMask {\n\t\treturn nil, \"\", errors.New(\"loadIPAMConfig config: no available ip in the subnet\")\n\t}\n\n\t// convert from types.IPNet to net.IPNet\n\tsubnet := net.IPNet{\n\t\tIP: ipamConf.IPAM.IPV4Subnet.IP,\n\t\tMask: ipamConf.IPAM.IPV4Subnet.Mask,\n\t}\n\n\t// Validate the ip if specified explicitly\n\tif ipamConf.IPAM.IPV4Address.IP != nil {\n\t\terr := verifyIPSubnet(ipamConf.IPAM.IPV4Address.IP, subnet)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tif isNetworkOrBroadcast(subnet, ipamConf.IPAM.IPV4Address.IP) {\n\t\t\treturn nil, \"\", errors.Errorf(\"ip specified is reserved by default: %v\", ipamConf.IPAM.IPV4Address)\n\t\t}\n\t}\n\n\t// get the default gateway\n\tif ipamConf.IPAM.IPV4Gateway == nil {\n\t\tipamConf.IPAM.IPV4Gateway = getDefaultIPV4GW(ipamConf.IPAM.IPV4Subnet)\n\t} else {\n\t\tif isNetworkOrBroadcast(subnet, ipamConf.IPAM.IPV4Gateway) {\n\t\t\treturn nil, \"\", errors.Errorf(\"gateway specified is reserved by default: %v\", ipamConf.IPAM.IPV4Gateway)\n\t\t}\n\t\tif err := verifyIPSubnet(ipamConf.IPAM.IPV4Gateway, subnet); err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t}\n\n\treturn ipamConf.IPAM, ipamConf.CNIVersion, nil\n}", "title": "" }, { "docid": "69dae3a542fac5ab9c2da59a7a5679cc", "score": "0.47689712", "text": "func (in *IPAMConfig) DeepCopy() *IPAMConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IPAMConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9e31b84bab048e7061baeb19546f2e2c", "score": "0.47688538", "text": "func (w *Wallet) copyFrom(src *Wallet) {\n\t// Clear the original info first\n\tw.Meta = make(map[string]string)\n\tw.Entries = w.Entries[:0]\n\n\t// Copies the meta\n\tfor k, v := range src.Meta {\n\t\tw.Meta[k] = v\n\t}\n\n\t// Copies the address entries\n\tfor _, e := range src.Entries {\n\t\tw.Entries = append(w.Entries, e)\n\t}\n}", "title": "" }, { "docid": "648701ae9e2ae92a4a90ba6a113bde60", "score": "0.47661552", "text": "func setOfportIPAddr(k8sClient client.Client, ofport int32, ipAddr []types.IPAddress) error {\n\tvar ctx = context.Background()\n\tvar agentInfoOld = &agentv1alpha1.AgentInfo{}\n\n\tvar agentInfo = &agentv1alpha1.AgentInfo{\n\t\tOVSInfo: agentv1alpha1.OVSInfo{\n\t\t\tBridges: []agentv1alpha1.OVSBridge{\n\t\t\t\t{\n\t\t\t\t\tPorts: []agentv1alpha1.OVSPort{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tInterfaces: []agentv1alpha1.OVSInterface{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tOfport: ofport,\n\t\t\t\t\t\t\t\t\tIPs: ipAddr,\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\tagentInfo.Name = agentName\n\n\terr := k8sClient.Get(ctx, k8stypes.NamespacedName{Name: agentName}, agentInfoOld)\n\tif errors.IsNotFound(err) {\n\t\tif err = k8sClient.Create(ctx, agentInfo); err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't create agent %s agentinfo: %s\", agentName, err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't fetch agent %s agentinfo: %s\", agentName, err)\n\t}\n\n\tagentInfo.ObjectMeta = agentInfoOld.ObjectMeta\n\terr = k8sClient.Update(ctx, agentInfo)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't update agent %s agentinfo: %s\", agentName, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c9150e405ff6446b489206de72eb799", "score": "0.47619346", "text": "func (m *TeamworkNetworkConfiguration) SetIpAddress(value *string)() {\n err := m.GetBackingStore().Set(\"ipAddress\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3dda6bed3de89c28ac53ac6b914a2d51", "score": "0.4756059", "text": "func (c ConfigSet) Copy() ConfigSet {\n\tcfgs := make(map[Type]Config, len(c.cfgs))\n\tfor k, v := range c.cfgs {\n\t\tcfgs[k] = v\n\t}\n\treturn ConfigSet{cfgs}\n}", "title": "" }, { "docid": "18638cffee9761b88739563d0e6f72ce", "score": "0.4752475", "text": "func (in *V1PolicyConfig) DeepCopyToModel() *models.V1PolicyConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(models.V1PolicyConfig)\n\tin.DeepCopyToModelInto(out)\n\treturn out\n}", "title": "" }, { "docid": "871f10d2a9982354b2ed5a920c368bdc", "score": "0.47515514", "text": "func (c *configuration) Clone() *configuration {\n\tvar clone = *c\n\treturn &clone\n}", "title": "" }, { "docid": "8d50ece54488c6ab735f006d68506b01", "score": "0.4747736", "text": "func (in *PrivateEndpointIPConfiguration) DeepCopy() *PrivateEndpointIPConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpointIPConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
24215175d64f33e4064e8bd9f2533cc3
MarshalJSON implements the json.Marshaller interface for type CosmosDbLinkedService.
[ { "docid": "24f77f33e26f399990c8fdef4d2961a8", "score": "0.8099389", "text": "func (c CosmosDbLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"CosmosDb\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
[ { "docid": "f66bb131d7a0be75438c39459c86fe8d", "score": "0.8144639", "text": "func (c CosmosDbLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"CosmosDb\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "237e5b744844ea52cbd6568c3eaa6a86", "score": "0.7801559", "text": "func (c CosmosDbMongoDbAPILinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"CosmosDbMongoDbApi\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "433993fd7e1e686b28244a7579ea4de3", "score": "0.77535677", "text": "func (c CosmosDbMongoDbAPILinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"CosmosDbMongoDbApi\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1246cf522a6ec0b80fd451f55e9f5dd5", "score": "0.7661275", "text": "func (a AzureSQLDatabaseLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureSqlDatabase\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ef8213d99b421fe0c26a765aab4b28b2", "score": "0.76297444", "text": "func (a AzureSQLDatabaseLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureSqlDatabase\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "848e1f8b9502099c33fbc467ca8a81f9", "score": "0.76008946", "text": "func (s SalesforceServiceCloudLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"SalesforceServiceCloud\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "407e71cd44a68f081ef1bd49104e5021", "score": "0.7598002", "text": "func (s SalesforceMarketingCloudLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"SalesforceMarketingCloud\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fc66b88de70d31695a902aa0c344dde5", "score": "0.7575819", "text": "func (s SalesforceServiceCloudLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"SalesforceServiceCloud\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1afbd2ca9528fa8e48da4fe22e669157", "score": "0.75719565", "text": "func (s SnowflakeLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Snowflake\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2e33574404f28bb14d3be795c8b09884", "score": "0.7570391", "text": "func (s SalesforceMarketingCloudLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"SalesforceMarketingCloud\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ee4af6d53a932b14ae41fcc417b20e6f", "score": "0.75444406", "text": "func (m MongoDbLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MongoDb\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "932a8798e25e0ab5637e6b035f3d468e", "score": "0.75407505", "text": "func (s SnowflakeLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Snowflake\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0adc59be3d3d9bc20d4bb2f44ad73e8f", "score": "0.7509771", "text": "func (m MarketoLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"Marketo\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fbb37220b7b86d6429e2ba478499738f", "score": "0.75070554", "text": "func (s SQLServerLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"SqlServer\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "007670a4f890091e5f7f5e656e2d7d7b", "score": "0.75059783", "text": "func (m MariaDBLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MariaDB\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "63aeb52d485f11ed13c6535410224986", "score": "0.7499919", "text": "func (m MongoDbLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MongoDb\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ef98d8189d363281c5e4d1af74dae0ef", "score": "0.74944264", "text": "func (a AzureMariaDBLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureMariaDB\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "861001df1cd3b5a424f5fb8c40890c8a", "score": "0.7480162", "text": "func (s SQLServerLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"SqlServer\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "38edf60e2be9afa372a7d316f766e345", "score": "0.7480048", "text": "func (s SalesforceLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Salesforce\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5838648488677556fc542c8665027a36", "score": "0.74734455", "text": "func (a AzureDatabricksLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureDatabricks\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "00d55ceebd94d97df82d8a1efd8f7139", "score": "0.74713737", "text": "func (m MariaDBLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MariaDB\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d24e2f1a30c88d3dd3216192ed3d4c67", "score": "0.74666125", "text": "func (m MarketoLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"Marketo\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "57f13fe7bdc8f564d4b6bb8d5c3839ff", "score": "0.74643826", "text": "func (a AzureMariaDBLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureMariaDB\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7a832f65d570c37ccd1d37b4c2fd98bc", "score": "0.74600255", "text": "func (o OracleCloudStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"OracleCloudStorage\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "58cb0b2bfcf4ea217ea0262809fb910c", "score": "0.7450033", "text": "func (s SalesforceLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Salesforce\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fa6d8b17c309ab19fb9a93422050f26d", "score": "0.7449542", "text": "func (a AzureDatabricksLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureDatabricks\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5e5f7b9a3af37aaed85da67dd394038f", "score": "0.7441894", "text": "func (a AzureStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureStorage\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "883dbd90410bc10014341dfdac1dda8a", "score": "0.7439563", "text": "func (o OdbcLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"Odbc\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5e9ffcede6b9bb263501dc956cef233a", "score": "0.7432792", "text": "func (a AzureMLServiceLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureMLService\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5bf6a3998b5b99cf3226eb6b38e153b7", "score": "0.7427977", "text": "func (o OracleCloudStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"OracleCloudStorage\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "feb0616031fe3043300cb891c71eb4a6", "score": "0.7418477", "text": "func (l LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", l.ID)\n\tpopulate(objectMap, \"name\", l.Name)\n\tpopulate(objectMap, \"properties\", l.Properties)\n\tpopulate(objectMap, \"tags\", l.Tags)\n\tpopulate(objectMap, \"type\", l.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2db6b08e43822f26c3ff3deb75d63ee1", "score": "0.74144053", "text": "func (c CosmosDbMongoDbAPILinkedServiceTypeProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateAny(objectMap, \"connectionString\", c.ConnectionString)\n\tpopulateAny(objectMap, \"database\", c.Database)\n\tpopulateAny(objectMap, \"isServerVersionAbove32\", c.IsServerVersionAbove32)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cb240b5871d3b549aab74e76f410eec4", "score": "0.7413041", "text": "func (c CouchbaseLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"Couchbase\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "16f2516bf832ec308ff4810d71f5f31b", "score": "0.74083024", "text": "func (c CosmosDbLinkedServiceTypeProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"accountEndpoint\", c.AccountEndpoint)\n\tpopulate(objectMap, \"accountKey\", c.AccountKey)\n\tpopulate(objectMap, \"azureCloudType\", c.AzureCloudType)\n\tpopulate(objectMap, \"connectionMode\", c.ConnectionMode)\n\tpopulate(objectMap, \"connectionString\", c.ConnectionString)\n\tpopulate(objectMap, \"credential\", c.Credential)\n\tpopulate(objectMap, \"database\", c.Database)\n\tpopulate(objectMap, \"encryptedCredential\", c.EncryptedCredential)\n\tpopulate(objectMap, \"servicePrincipalCredential\", c.ServicePrincipalCredential)\n\tpopulate(objectMap, \"servicePrincipalCredentialType\", c.ServicePrincipalCredentialType)\n\tpopulate(objectMap, \"servicePrincipalId\", c.ServicePrincipalID)\n\tpopulate(objectMap, \"tenant\", c.Tenant)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7d4038b18a67e783c903832b5e2fca5f", "score": "0.7403617", "text": "func (o OdbcLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"Odbc\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "985be87b3f193e915a99f7b06f3a54dc", "score": "0.7402758", "text": "func (a AzureStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureStorage\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "92ebc39ff9df80b8244d4ebb993285e2", "score": "0.739965", "text": "func (o OracleServiceCloudLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"OracleServiceCloud\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9bc23e4ac400a21e7e24ac00743800b0", "score": "0.73994046", "text": "func (a AzureMLServiceLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureMLService\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7f865f4be2a71b3c0c0595795d28753c", "score": "0.73954856", "text": "func (a AzureSQLDWLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureSqlDW\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d8e0d26336f13ce14434446cf2475f90", "score": "0.73903626", "text": "func (m MicrosoftAccessLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MicrosoftAccess\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "89031f13a39a3e6f2958f2b8a53a89d7", "score": "0.7390024", "text": "func (s ServiceNowLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"ServiceNow\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7a1609311c002398ff84ee1be00441b3", "score": "0.73807544", "text": "func (p PrestoLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", p.Annotations)\n\tpopulate(objectMap, \"connectVia\", p.ConnectVia)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"parameters\", p.Parameters)\n\tobjectMap[\"type\"] = \"Presto\"\n\tpopulate(objectMap, \"typeProperties\", p.TypeProperties)\n\tif p.AdditionalProperties != nil {\n\t\tfor key, val := range p.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8a43a559376a0483e1ef4704e90c98da", "score": "0.7377185", "text": "func (c CosmosDbLinkedServiceTypeProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulateAny(objectMap, \"accountEndpoint\", c.AccountEndpoint)\n\tpopulate(objectMap, \"accountKey\", c.AccountKey)\n\tpopulateAny(objectMap, \"azureCloudType\", c.AzureCloudType)\n\tpopulate(objectMap, \"connectionMode\", c.ConnectionMode)\n\tpopulateAny(objectMap, \"connectionString\", c.ConnectionString)\n\tpopulate(objectMap, \"credential\", c.Credential)\n\tpopulateAny(objectMap, \"database\", c.Database)\n\tpopulateAny(objectMap, \"encryptedCredential\", c.EncryptedCredential)\n\tpopulate(objectMap, \"servicePrincipalCredential\", c.ServicePrincipalCredential)\n\tpopulate(objectMap, \"servicePrincipalCredentialType\", c.ServicePrincipalCredentialType)\n\tpopulateAny(objectMap, \"servicePrincipalId\", c.ServicePrincipalID)\n\tpopulateAny(objectMap, \"tenant\", c.Tenant)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3d7b167982b1a5974888bcc59801f27c", "score": "0.73734", "text": "func (c CouchbaseLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"Couchbase\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3fa3867f34a5e40f28621866b285a037", "score": "0.73715574", "text": "func (a AzureSQLDWLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureSqlDW\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6e3cc4d687c00e1018b22640cbfd2e3c", "score": "0.73640126", "text": "func (o OracleServiceCloudLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"OracleServiceCloud\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "24064aac2372dcaccffa4172e5781754", "score": "0.7356683", "text": "func (a AmazonRedshiftLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonRedshift\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f3d69370044058cdd8f934f373cf5111", "score": "0.73522663", "text": "func (m MicrosoftAccessLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MicrosoftAccess\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f47593e2e56836366a82fc9e4376cf0b", "score": "0.73468626", "text": "func (s ServiceNowLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"ServiceNow\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5a3c503a5993559c8a67fa1285b73209", "score": "0.7343485", "text": "func (s SparkLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Spark\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1b4781f260121ff66b72edb3a3085ea5", "score": "0.73413104", "text": "func (p PrestoLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", p.Annotations)\n\tpopulate(objectMap, \"connectVia\", p.ConnectVia)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"parameters\", p.Parameters)\n\tobjectMap[\"type\"] = \"Presto\"\n\tpopulate(objectMap, \"typeProperties\", p.TypeProperties)\n\tif p.AdditionalProperties != nil {\n\t\tfor key, val := range p.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ba9ead587a44929d9acd559c9f8acb25", "score": "0.7334381", "text": "func (l LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", l.Annotations)\n\tpopulate(objectMap, \"connectVia\", l.ConnectVia)\n\tpopulate(objectMap, \"description\", l.Description)\n\tpopulate(objectMap, \"parameters\", l.Parameters)\n\tobjectMap[\"type\"] = l.Type\n\tif l.AdditionalProperties != nil {\n\t\tfor key, val := range l.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "feb1db327ab3d0a9a38fc332ca1cd9a5", "score": "0.7334329", "text": "func (s ShopifyLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Shopify\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d33fa646dafb82117ccffbcae39f15f2", "score": "0.73328173", "text": "func (a AmazonRedshiftLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonRedshift\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5fa074d0ea5d2a2bd3e6c03256436527", "score": "0.7328728", "text": "func (a AzurePostgreSQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzurePostgreSql\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "90d77009ecd0e87775398bee7bf48dd6", "score": "0.7323723", "text": "func (s SparkLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Spark\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b2a98ddfbc29a75ba180a63ac036269a", "score": "0.7319977", "text": "func (a AzureBlobStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureBlobStorage\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ac458d7eb396eaaeeb31d909e19e9f5e", "score": "0.73152596", "text": "func (r RestServiceLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", r.Annotations)\n\tpopulate(objectMap, \"connectVia\", r.ConnectVia)\n\tpopulate(objectMap, \"description\", r.Description)\n\tpopulate(objectMap, \"parameters\", r.Parameters)\n\tobjectMap[\"type\"] = \"RestService\"\n\tpopulate(objectMap, \"typeProperties\", r.TypeProperties)\n\tif r.AdditionalProperties != nil {\n\t\tfor key, val := range r.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f7a197425bca5129ef4a17da71934a36", "score": "0.73108184", "text": "func (m MongoDbAtlasLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MongoDbAtlas\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cfa6b7c59b036f246d328f3a98956432", "score": "0.73039204", "text": "func (a AmazonRdsForSQLServerLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonRdsForSqlServer\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7b3c6559c7971d855a001bf575fae0d2", "score": "0.7301537", "text": "func (s ShopifyLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Shopify\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7ad165afcf04c8e05ef28eaac94b2d49", "score": "0.72938854", "text": "func (l LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", l.Annotations)\n\tpopulate(objectMap, \"connectVia\", l.ConnectVia)\n\tpopulate(objectMap, \"description\", l.Description)\n\tpopulate(objectMap, \"parameters\", l.Parameters)\n\tobjectMap[\"type\"] = l.Type\n\tif l.AdditionalProperties != nil {\n\t\tfor key, val := range l.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5abcb026b75b9f0ffb23c7f5af749e40", "score": "0.7292673", "text": "func (a AzurePostgreSQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzurePostgreSql\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "18d1fdb622a5eb8010729973018dbdea", "score": "0.7288238", "text": "func (a AzureBlobStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureBlobStorage\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7f004319b465c75f56c11db0c738b994", "score": "0.7277452", "text": "func (a AmazonRdsForSQLServerLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonRdsForSqlServer\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2b32c04d235a0b902947b974548d4065", "score": "0.7277403", "text": "func (s SybaseLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Sybase\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "999551d4b8d33969bdf1e9e68abd1877", "score": "0.72715944", "text": "func (r RestServiceLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", r.Annotations)\n\tpopulate(objectMap, \"connectVia\", r.ConnectVia)\n\tpopulate(objectMap, \"description\", r.Description)\n\tpopulate(objectMap, \"parameters\", r.Parameters)\n\tobjectMap[\"type\"] = \"RestService\"\n\tpopulate(objectMap, \"typeProperties\", r.TypeProperties)\n\tif r.AdditionalProperties != nil {\n\t\tfor key, val := range r.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1ef443e671349939b1e0ae31721a0a02", "score": "0.72711945", "text": "func (m MongoDbV2LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MongoDbV2\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a33d62510d3e8de80d43f7a3b40b9087", "score": "0.72707504", "text": "func (a AmazonS3LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonS3\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "93733f9611a6938e75a77d5310a25218", "score": "0.7270156", "text": "func (a AmazonMWSLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonMWS\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "28a777ad7b8d2f8727a740c8bcf46c76", "score": "0.7267821", "text": "func (a AzureDataLakeStoreLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureDataLakeStore\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "46bfddaf376f1732c47c27c89840639e", "score": "0.72600675", "text": "func (t TeradataLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", t.Annotations)\n\tpopulate(objectMap, \"connectVia\", t.ConnectVia)\n\tpopulate(objectMap, \"description\", t.Description)\n\tpopulate(objectMap, \"parameters\", t.Parameters)\n\tobjectMap[\"type\"] = \"Teradata\"\n\tpopulate(objectMap, \"typeProperties\", t.TypeProperties)\n\tif t.AdditionalProperties != nil {\n\t\tfor key, val := range t.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0be542a1532a7eb6242af93853dcef69", "score": "0.725995", "text": "func (m MongoDbAtlasLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MongoDbAtlas\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "51dba5ff7ef0bf8d19b4c050fb4ca478", "score": "0.72578055", "text": "func (a AmazonS3CompatibleLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonS3Compatible\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7810e19076ee4f3982c779c71bb2f33d", "score": "0.72544605", "text": "func (g GoogleCloudStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", g.Annotations)\n\tpopulate(objectMap, \"connectVia\", g.ConnectVia)\n\tpopulate(objectMap, \"description\", g.Description)\n\tpopulate(objectMap, \"parameters\", g.Parameters)\n\tobjectMap[\"type\"] = \"GoogleCloudStorage\"\n\tpopulate(objectMap, \"typeProperties\", g.TypeProperties)\n\tif g.AdditionalProperties != nil {\n\t\tfor key, val := range g.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "65a961df0e0dab7b6e2094fbca5a47bd", "score": "0.725166", "text": "func (a AzureFunctionLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureFunction\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "88c8fa25ea074a172833827da85eefe3", "score": "0.72514445", "text": "func (m MySQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MySql\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cd08f3ef1a6df5934589eced36f6391a", "score": "0.7245277", "text": "func (a AmazonS3LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonS3\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8e9da0395761cd1989838642f473405d", "score": "0.7238103", "text": "func (a AmazonMWSLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonMWS\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0271a2891156f9ce8b217695b8dfdb3e", "score": "0.72361493", "text": "func (p PostgreSQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", p.Annotations)\n\tpopulate(objectMap, \"connectVia\", p.ConnectVia)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"parameters\", p.Parameters)\n\tobjectMap[\"type\"] = \"PostgreSql\"\n\tpopulate(objectMap, \"typeProperties\", p.TypeProperties)\n\tif p.AdditionalProperties != nil {\n\t\tfor key, val := range p.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0da22b522c93dc395f9ecc11aa4fbb47", "score": "0.7235154", "text": "func (a AmazonS3CompatibleLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AmazonS3Compatible\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4940ac7d88adcb885204559af31f46cb", "score": "0.7234161", "text": "func (m MongoDbV2LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MongoDbV2\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "03fb5ce4241534af42e601aad1f1bf56", "score": "0.72339153", "text": "func (a AzureDataLakeStoreLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureDataLakeStore\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4203e1a1012cb47ad2ef65d32aa8cba8", "score": "0.7228022", "text": "func (s SybaseLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", s.Annotations)\n\tpopulate(objectMap, \"connectVia\", s.ConnectVia)\n\tpopulate(objectMap, \"description\", s.Description)\n\tpopulate(objectMap, \"parameters\", s.Parameters)\n\tobjectMap[\"type\"] = \"Sybase\"\n\tpopulate(objectMap, \"typeProperties\", s.TypeProperties)\n\tif s.AdditionalProperties != nil {\n\t\tfor key, val := range s.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "bdc1f59ad5aefaf396534ecfbc50522a", "score": "0.72273594", "text": "func (m MySQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", m.Annotations)\n\tpopulate(objectMap, \"connectVia\", m.ConnectVia)\n\tpopulate(objectMap, \"description\", m.Description)\n\tpopulate(objectMap, \"parameters\", m.Parameters)\n\tobjectMap[\"type\"] = \"MySql\"\n\tpopulate(objectMap, \"typeProperties\", m.TypeProperties)\n\tif m.AdditionalProperties != nil {\n\t\tfor key, val := range m.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1388fcc5c5dc09c13a8747932292a438", "score": "0.7224143", "text": "func (a AzureTableStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureTableStorage\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8b6177d27fe01889a93fa9da6a4cc683", "score": "0.7216163", "text": "func (o ODataLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"OData\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "67f534ea4f5ee9b6700891869505d355", "score": "0.7216099", "text": "func (g GoogleCloudStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", g.Annotations)\n\tpopulate(objectMap, \"connectVia\", g.ConnectVia)\n\tpopulate(objectMap, \"description\", g.Description)\n\tpopulate(objectMap, \"parameters\", g.Parameters)\n\tobjectMap[\"type\"] = \"GoogleCloudStorage\"\n\tpopulate(objectMap, \"typeProperties\", g.TypeProperties)\n\tif g.AdditionalProperties != nil {\n\t\tfor key, val := range g.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3783a1d897d5683eec8380ff158a8707", "score": "0.7213346", "text": "func (o Office365LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", o.Annotations)\n\tpopulate(objectMap, \"connectVia\", o.ConnectVia)\n\tpopulate(objectMap, \"description\", o.Description)\n\tpopulate(objectMap, \"parameters\", o.Parameters)\n\tobjectMap[\"type\"] = \"Office365\"\n\tpopulate(objectMap, \"typeProperties\", o.TypeProperties)\n\tif o.AdditionalProperties != nil {\n\t\tfor key, val := range o.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4ad461e103c01511a16f275ce95c9ae2", "score": "0.72128695", "text": "func (p PostgreSQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", p.Annotations)\n\tpopulate(objectMap, \"connectVia\", p.ConnectVia)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"parameters\", p.Parameters)\n\tobjectMap[\"type\"] = \"PostgreSql\"\n\tpopulate(objectMap, \"typeProperties\", p.TypeProperties)\n\tif p.AdditionalProperties != nil {\n\t\tfor key, val := range p.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2535eb35a4611e2b81910725d4f1f8e1", "score": "0.7211322", "text": "func (a AzureFunctionLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureFunction\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "44e9ec18a83c27cdc2a8074f6d511a0e", "score": "0.7210025", "text": "func (d Db2LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", d.Annotations)\n\tpopulate(objectMap, \"connectVia\", d.ConnectVia)\n\tpopulate(objectMap, \"description\", d.Description)\n\tpopulate(objectMap, \"parameters\", d.Parameters)\n\tobjectMap[\"type\"] = \"Db2\"\n\tpopulate(objectMap, \"typeProperties\", d.TypeProperties)\n\tif d.AdditionalProperties != nil {\n\t\tfor key, val := range d.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cbf1975afe8c88ed29a4aad555aabcdc", "score": "0.72063637", "text": "func (c CassandraLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"Cassandra\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0755b953431e33f52e35037377d85a0a", "score": "0.72046506", "text": "func (t TeradataLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", t.Annotations)\n\tpopulate(objectMap, \"connectVia\", t.ConnectVia)\n\tpopulate(objectMap, \"description\", t.Description)\n\tpopulate(objectMap, \"parameters\", t.Parameters)\n\tobjectMap[\"type\"] = \"Teradata\"\n\tpopulate(objectMap, \"typeProperties\", t.TypeProperties)\n\tif t.AdditionalProperties != nil {\n\t\tfor key, val := range t.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "50eb9ae879050b5eec72a19355d88741", "score": "0.72011375", "text": "func (a AzureMySQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureMySql\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "59f5cabfe77264ac68b40e6d09b4dda0", "score": "0.71944386", "text": "func (a AzureTableStorageLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureTableStorage\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "72828ee79e2484e23df4c89d659e568b", "score": "0.717922", "text": "func (d Db2LinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", d.Annotations)\n\tpopulate(objectMap, \"connectVia\", d.ConnectVia)\n\tpopulate(objectMap, \"description\", d.Description)\n\tpopulate(objectMap, \"parameters\", d.Parameters)\n\tobjectMap[\"type\"] = \"Db2\"\n\tpopulate(objectMap, \"typeProperties\", d.TypeProperties)\n\tif d.AdditionalProperties != nil {\n\t\tfor key, val := range d.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "24594cf55fb7157170e529a7b2a69c67", "score": "0.7171426", "text": "func (c CassandraLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", c.Annotations)\n\tpopulate(objectMap, \"connectVia\", c.ConnectVia)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"parameters\", c.Parameters)\n\tobjectMap[\"type\"] = \"Cassandra\"\n\tpopulate(objectMap, \"typeProperties\", c.TypeProperties)\n\tif c.AdditionalProperties != nil {\n\t\tfor key, val := range c.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "799d011ac61f1fc48d8f8fe7167c9e4a", "score": "0.71709573", "text": "func (a AzureMySQLLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureMySql\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "977df5fb3bcc6f2d4fcfed33bf929df6", "score": "0.71672815", "text": "func (a AzureDataLakeAnalyticsLinkedService) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"annotations\", a.Annotations)\n\tpopulate(objectMap, \"connectVia\", a.ConnectVia)\n\tpopulate(objectMap, \"description\", a.Description)\n\tpopulate(objectMap, \"parameters\", a.Parameters)\n\tobjectMap[\"type\"] = \"AzureDataLakeAnalytics\"\n\tpopulate(objectMap, \"typeProperties\", a.TypeProperties)\n\tif a.AdditionalProperties != nil {\n\t\tfor key, val := range a.AdditionalProperties {\n\t\t\tobjectMap[key] = val\n\t\t}\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
3cb199ee695182b332db993bc9284074
SetDataPathLabelType sets the DataPathLabelType field's value.
[ { "docid": "ac4d97133c0c66e6c46a11cd5518ca81", "score": "0.747633", "text": "func (s *DataLabelType) SetDataPathLabelType(v *DataPathLabelType) *DataLabelType {\n\ts.DataPathLabelType = v\n\treturn s\n}", "title": "" } ]
[ { "docid": "932e21465aad8f64b2b04047c642916b", "score": "0.563162", "text": "func (o *BrowseOp) SetType(s string) error {\n\to.m.Lock()\n\tdefer o.m.Unlock()\n\tif o.started {\n\t\treturn ErrStarted\n\t}\n\to.stype = s\n\treturn nil\n}", "title": "" }, { "docid": "3b0bfbee04793208734830e69cb48276", "score": "0.54911906", "text": "func (p *Pool) SetDataPath(ctx context.Context, path []string, value interface{}) error {\n\tp.dataMtx.Lock()\n\tdefer p.dataMtx.Unlock()\n\treturn p.updateVMs(func(vm *VM, opts vmOpts) error {\n\t\treturn vm.SetDataPath(ctx, path, value)\n\t})\n}", "title": "" }, { "docid": "f81aaffc3096dc89592691c0ba41d1ca", "score": "0.54680765", "text": "func (m *AuthenticationAttributeCollectionOptionConfiguration) SetLabel(value *string)() {\n err := m.GetBackingStore().Set(\"label\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6e7534209d92c2a9cc18e1bf38dfaf75", "score": "0.5341208", "text": "func (m *Manager) SetDataPath(path string) {\n\tm.cfg.DataPath = path\n}", "title": "" }, { "docid": "4000db049a2328ee49f398a442186e58", "score": "0.53076226", "text": "func (m *jobData) SetType(val string) {\n}", "title": "" }, { "docid": "569b666ca42eab272353fb11d1d3f9f1", "score": "0.52862185", "text": "func (m *WorkbookChartDataLabels) SetFormat(value WorkbookChartDataLabelFormatable)() {\n m.format = value\n}", "title": "" }, { "docid": "9c5ae75d2746d27d41577235daa6e31d", "score": "0.52282536", "text": "func (field *Field) SetType(baseTypeName string) {\n\tfield._field.Type = ast.NewIdent(baseTypeName)\n\tfield.file.Save()\n}", "title": "" }, { "docid": "0d0a3e673dae7f495b7475570d5c2ffb", "score": "0.5227005", "text": "func (m *CloudPropertyJobData) SetType(val string) {\n}", "title": "" }, { "docid": "81f02c11b28d45a32c6c76c2eca63583", "score": "0.5179838", "text": "func (s *Storage) SetDataType(dataset string, varName string, varType string) error {\n\t// Fetch all existing variables\n\tvars, err := s.FetchVariables(dataset, true, true, false)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to fetch existing variable\")\n\t}\n\n\t// Update only the variable we care about\n\tfor _, v := range vars {\n\t\tif v.Key == varName {\n\t\t\tv.Type = varType\n\t\t}\n\t}\n\n\treturn s.updateVariables(dataset, vars)\n}", "title": "" }, { "docid": "d14b261f9e2edc6c1d50fba069ab0a2c", "score": "0.5138743", "text": "func (o *LabelAllOf) SetType(v string) {\n\to.Type = &v\n}", "title": "" }, { "docid": "67b68052ac96f4f855bd44a9a70dab64", "score": "0.5138276", "text": "func (m *IdentityUserFlowAttribute) SetDataType(value *IdentityUserFlowAttributeDataType)() {\n err := m.GetBackingStore().Set(\"dataType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fb6fd7e28d0c791fc43ecfcb7573d1d4", "score": "0.513381", "text": "func (m *transformationBase) SetType(val string) {\n\n}", "title": "" }, { "docid": "2ceeaaeedfb6cb06985d093525069fcb", "score": "0.51269215", "text": "func (d *DecLiteral) SetType(_type Type) {\n\td._type = _type.(*TypeOperator)\n}", "title": "" }, { "docid": "c8e92926c1429e3232d315dcded610eb", "score": "0.51208436", "text": "func (_options *UpdateGlobalRuleOptions) SetType(typeVar string) *UpdateGlobalRuleOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "6ab81ce52bbe1bdc67c16d6d681b0d2f", "score": "0.51123065", "text": "func (_options *CreateDatasourceOptions) SetType(typeVar string) *CreateDatasourceOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "f97bebe38ef0ce4af7f63773b033f9dc", "score": "0.50925887", "text": "func (o IncidentLabelResponseOutput) LabelType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IncidentLabelResponse) string { return v.LabelType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f97bebe38ef0ce4af7f63773b033f9dc", "score": "0.50925887", "text": "func (o IncidentLabelResponseOutput) LabelType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IncidentLabelResponse) string { return v.LabelType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a80af215a2cdd24897145d1d0fca4de1", "score": "0.5088879", "text": "func (s *SIDLabelLabel) Type() SIDLabelType {\n\treturn SIDLabelTypeLabel\n}", "title": "" }, { "docid": "38133b214097ed21e15a7c0a31b10dd5", "score": "0.50645185", "text": "func (s *StrLiteral) SetType(_type Type) {\n\ts._type = _type.(*TypeOperator)\n}", "title": "" }, { "docid": "dd1fa18e26e0ffc146e5755c7d72048c", "score": "0.5061386", "text": "func (o *Label) SetType(v string) {\n\to.Type = &v\n}", "title": "" }, { "docid": "8f26699e0087d525791a71483ff785d0", "score": "0.50053585", "text": "func (self *TraitLabel) SetLabel(str string) {\n\t__cgo__str := (*C.gchar)(unsafe.Pointer(C.CString(str)))\n\tC.gtk_label_set_label(self.CPointer, __cgo__str)\n\tC.free(unsafe.Pointer(__cgo__str))\n\treturn\n}", "title": "" }, { "docid": "51c6f65aec467a2283b2f3864f21ecdc", "score": "0.4992016", "text": "func (s DataPathLabelType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "92eec85f924a6404001db85ed8c44f98", "score": "0.4990255", "text": "func setLabel(resource k8s.Resource, key, value string) {\n\tswitch kubeType := resource.(type) {\n\tcase *k8s.PodV1:\n\t\tkubeType.Labels[key] = value\n\tcase *k8s.DeploymentV1:\n\t\tkubeType.Labels[key] = value\n\t}\n}", "title": "" }, { "docid": "7c51791a59180c9fbc01be6265a9db94", "score": "0.49824426", "text": "func (_this *HTMLObjectElement) SetType(value string) {\n\tinput := value\n\t_this.Value_JS.Set(\"type\", input)\n}", "title": "" }, { "docid": "d48135dd4b9dc4bfe86660eccdccae6c", "score": "0.4969322", "text": "func (o *Pool) SetType(v string) {\n\to.Type = &v\n}", "title": "" }, { "docid": "81220ee5763cd271ad24b19a2df1e94d", "score": "0.49685597", "text": "func (r *Root) PathType() tlfhandle.PathType {\n\treturn tlfhandle.KeybasePathType\n}", "title": "" }, { "docid": "018c21684ab70469d1a504fbaf194bec", "score": "0.49632078", "text": "func (m *widget) SetType(val string) {\n\n}", "title": "" }, { "docid": "059374ae810ec98fd214ba3a6ce7831f", "score": "0.49613872", "text": "func (b *BoolLiteral) SetType(_type Type) {\n\tb._type = _type.(*TypeOperator)\n}", "title": "" }, { "docid": "ded965a6d16a147a439b3d84c25a0042", "score": "0.4959453", "text": "func (m *SubjectRightsRequestHistory) SetType(value *string)() {\n m.type_escaped = value\n}", "title": "" }, { "docid": "65f5a2d68ad12198f5687b9adbd43b31", "score": "0.49438724", "text": "func (m *MonitoringCheck) SetType(val string) {\n}", "title": "" }, { "docid": "541c7b1a1622e14c42d596c53bfe8e6c", "score": "0.49372432", "text": "func (g *Path) SetData(data string) error {\n\tg.DataStr = data\n\tvar err error\n\tg.Data, err = PathDataParse(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = PathDataValidate(&g.Pnt, &g.Data, g.Path())\n\treturn err\n}", "title": "" }, { "docid": "735e3431b2287fb306141a6c350a1550", "score": "0.48856202", "text": "func (d *MenuModel) SetLabel(commandID int32, label string) int32 {\n\tlabel_ := C.cef_string_userfree_alloc()\n\tsetCEFStr(label, label_)\n\tdefer func() {\n\t\tC.cef_string_userfree_free(label_)\n\t}()\n\treturn int32(C.gocef_menu_model_set_label(d.toNative(), C.int(commandID), (*C.cef_string_t)(label_), d.set_label))\n}", "title": "" }, { "docid": "dcd8b1970fca1495e3f75c1459072af5", "score": "0.48832875", "text": "func (o *RegisterOp) SetType(s string) error {\n\to.m.Lock()\n\tdefer o.m.Unlock()\n\tif o.started {\n\t\treturn ErrStarted\n\t}\n\to.stype = s\n\treturn nil\n}", "title": "" }, { "docid": "0203c9d0029879658fa8d1e13a3c114c", "score": "0.4880689", "text": "func SetLabel(ctx context.Context, key string, value []byte) {\n\tv := ctx.Value(traceInfoKey)\n\tif v == nil {\n\t\treturn\n\t}\n\tinfo := v.(*traceInfo)\n\tinfo.labels[key] = value\n}", "title": "" }, { "docid": "fc5d435c250026b563485773d13510ed", "score": "0.48531717", "text": "func (l *SIDIndexLabelLabel) Type() SIDIndexLabelType {\n\treturn SIDIndexLabelTypeLabel\n}", "title": "" }, { "docid": "d8a9eec0055de51d9767f9a0976a3310", "score": "0.48381218", "text": "func (info FileInfo) SetFileType(type_ FileType) {\n\tC.g_file_info_set_file_type(info.native(), C.GFileType(type_))\n}", "title": "" }, { "docid": "85eea09eb2233b0c46f9f7e9b395e388", "score": "0.48299626", "text": "func (o *QueryOp) SetType(t uint16) error {\n\to.m.Lock()\n\tdefer o.m.Unlock()\n\tif o.started {\n\t\treturn ErrStarted\n\t}\n\to.rrtype = t\n\treturn nil\n}", "title": "" }, { "docid": "89d5123098d57ec1e6b30101bf11ff40", "score": "0.48227656", "text": "func (s *ReferenceLineLabelConfiguration) SetValueLabelConfiguration(v *ReferenceLineValueLabelConfiguration) *ReferenceLineLabelConfiguration {\n\ts.ValueLabelConfiguration = v\n\treturn s\n}", "title": "" }, { "docid": "c3f39c8c6f841f76e4b1a299049b74f1", "score": "0.48221081", "text": "func (f *LabelOrUUIDFlag) SetLabel(l string) error {\n\tif !f.validLabel(l) {\n\t\treturn errors.Errorf(\"invalid label %q\", l)\n\t}\n\n\tf.Label = l\n\treturn nil\n}", "title": "" }, { "docid": "e9ddafe2a9060d402c279ca50965c763", "score": "0.4810438", "text": "func (f *FuncLiteral) SetType(_type Type) {\n\tf._type = _type.(*FuncType)\n}", "title": "" }, { "docid": "a663da623a940f709c9dccc679c6a054", "score": "0.4808914", "text": "func (o *VirtualizationBaseDatastoreClusterAllOf) SetType(v string) {\n\to.Type = &v\n}", "title": "" }, { "docid": "9605e2d6a418013f3b96ca9b54ef5749", "score": "0.47993878", "text": "func (m *Event) SetType(value *EventType)() {\n m.type_escaped = value\n}", "title": "" }, { "docid": "e1b010929578691f07374a5f34d08138", "score": "0.47885248", "text": "func (l *ListLiteral) SetType(_type Type) {\n\tl._type = _type.(*ListType)\n}", "title": "" }, { "docid": "258bbf147223317b6c39a8e5238eb75c", "score": "0.47815958", "text": "func (d *DispatchExpr) SetType(_type Type) {\n\td._type = _type\n}", "title": "" }, { "docid": "23ba52951c927a8ce4f8070784c86b50", "score": "0.477739", "text": "func (_options *UpdateSchemaRuleOptions) SetType(typeVar string) *UpdateSchemaRuleOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "af26554b24fdfcec1f73712beb71cadd", "score": "0.47684002", "text": "func (s *TemplateLiteral) SetType(_type Type) {\n\ts._type = _type.(*TypeOperator)\n}", "title": "" }, { "docid": "4252b682436721ec67ed48a29090bc9c", "score": "0.4768385", "text": "func (v *Volume) SetLabel(label, value string) {\n\tv.Labels[label] = value\n}", "title": "" }, { "docid": "c9d499dfbc71154beb2ffb516c371a39", "score": "0.47580868", "text": "func (m *TeamworkDeviceOperation) SetOperationType(value *TeamworkDeviceOperationType)() {\n err := m.GetBackingStore().Set(\"operationType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ff416e9e0e968dda9b5939df5958b6e4", "score": "0.474239", "text": "func (o *EnvironmentVariable) SetType(v string) {\n\to.Type = v\n}", "title": "" }, { "docid": "50f07270b5bfdde90781c67656b32d1d", "score": "0.4741745", "text": "func (o *Featureprop) SetType(exec boil.Executor, insert bool, related *Cvterm) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"featureprop\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"type_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, featurepropPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.CvtermID, o.FeaturepropID}\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.TypeID = related.CvtermID\n\n\tif o.R == nil {\n\t\to.R = &featurepropR{\n\t\t\tType: related,\n\t\t}\n\t} else {\n\t\to.R.Type = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &cvtermR{\n\t\t\tTypeFeatureprop: o,\n\t\t}\n\t} else {\n\t\trelated.R.TypeFeatureprop = o\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a6a43a5122ec6f690fafc6c116c9c07d", "score": "0.4738445", "text": "func (_options *CreateResourceQueryOptions) SetType(typeVar string) *CreateResourceQueryOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "984737574b947419b5873021f4ac4d64", "score": "0.47353357", "text": "func (d *MethodDispatchExpr) SetType(_type Type) {\n\td._type = _type\n}", "title": "" }, { "docid": "527946939290e4e010888714c1c45a69", "score": "0.47350857", "text": "func (MusicLabel) Type() string {\n\treturn MusicLabelType\n}", "title": "" }, { "docid": "382d4e87ec323f4ec95e6be5f70a7dcd", "score": "0.47091237", "text": "func (m *ResourceVisualization) SetTypeEscaped(value *string)() {\n err := m.GetBackingStore().Set(\"typeEscaped\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a4269c9784bb433c1391d0be107f2285", "score": "0.47063088", "text": "func (t TemplateData) SetType(typ CertType) {\n\tt.Set(TypeKey, typ.String())\n}", "title": "" }, { "docid": "3a6e8318beaad7d6b406fc7c28763838", "score": "0.46910232", "text": "func (m *GeneralLedgerEntry) SetDocumentType(value *string)() {\n err := m.GetBackingStore().Set(\"documentType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "66f1c49099b3a2ce8a723e11bbf14fee", "score": "0.46878514", "text": "func (environ *Environ) SetType(tp byte) {\n\tenviron.Type = tp\n}", "title": "" }, { "docid": "76a451e04d6f53cea2e8d93fe16bbd50", "score": "0.46806377", "text": "func (o *NiatelemetryApicCoreFileDetails) SetDataType(v string) {\n\to.DataType = &v\n}", "title": "" }, { "docid": "f09303a4c5cd7c74b85ade23abdf6b32", "score": "0.46804512", "text": "func (o *Label) SetValue(v string) {\n\to.Value = v\n}", "title": "" }, { "docid": "7a1a52b94990f39c9a7039112de8567b", "score": "0.46746108", "text": "func (i *IntLiteral) SetType(_type Type) {\n\ti._type = _type.(*TypeOperator)\n}", "title": "" }, { "docid": "b2428e2c083dd2993e8dfa8a8a88a97e", "score": "0.46669778", "text": "func (s *PieChartConfiguration) SetValueLabelOptions(v *ChartAxisLabelOptions) *PieChartConfiguration {\n\ts.ValueLabelOptions = v\n\treturn s\n}", "title": "" }, { "docid": "e3df05b2e3a85d0e4630080b624723f4", "score": "0.4666173", "text": "func (e *Event) SetDataValue(dataType DataType, obj interface{}) (err error) {\n\tvar data DataValue\n\tswitch dataType {\n\tcase NOTIFICATION:\n\t\tdata.DataType = dataType\n\t\tdata.ValueType = ENUMERATION\n\t\tdata.Value = obj\n\tcase METRIC:\n\t\tdata.DataType = dataType\n\t\tdata.ValueType = DECIMAL\n\t\tdata.Value = obj\n\tdefault:\n\t\terr = fmt.Errorf(\"error setting Data %s - %v\", dataType, obj)\n\t}\n\te.Data.Values = append(e.Data.Values, data)\n\treturn\n}", "title": "" }, { "docid": "1493e7238add7de6867ea7092c698f2b", "score": "0.46539086", "text": "func (_options *CreateSchemaRuleOptions) SetType(typeVar string) *CreateSchemaRuleOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "b9f9fd0647f0c3773e5b9ea52e4980b9", "score": "0.46468", "text": "func (m *Win32LobAppRule) SetRuleType(value *Win32LobAppRuleType)() {\n m.ruleType = value\n}", "title": "" }, { "docid": "0e5723683be03a9c1176852e518718c1", "score": "0.4646038", "text": "func (m *DirectRoutingLogRow) SetCallType(value *string)() {\n err := m.GetBackingStore().Set(\"callType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "76221d2f63e793243ec640daa87f3b87", "score": "0.4640411", "text": "func (o *Disk) SetType(v *string) *Disk {\n\tif o.Type = v; o.Type == nil {\n\t\to.nullFields = append(o.nullFields, \"Type\")\n\t}\n\treturn o\n}", "title": "" }, { "docid": "15e686b94e17342243a8b209581432ce", "score": "0.46387428", "text": "func (m *Win32LobAppRule) SetRuleType(value *Win32LobAppRuleType)() {\n err := m.GetBackingStore().Set(\"ruleType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2e0d876abe9aedf18a0ebab4d91bfeb1", "score": "0.46360743", "text": "func (m *SubjectRightsRequest) SetType(value *SubjectRightsRequestType)() {\n m.type_escaped = value\n}", "title": "" }, { "docid": "4908d9f819a84f6ed9f6014c4bbd9bfc", "score": "0.46345362", "text": "func (b *BinaryExpr) SetType(_type Type) {\n\tb._type = _type\n}", "title": "" }, { "docid": "aea9aa7df03eadd099f7e339aa043d56", "score": "0.46339613", "text": "func (me *TxsdQandasetDefaultlabel) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "a815d47bf1712769143f8b59ef0d2d02", "score": "0.4631769", "text": "func (gn *gridNode) setLabel(label string) {\n\tgn.label = label\n\tgn.Refresh()\n}", "title": "" }, { "docid": "afc34681c09fd5501e077a807af8d6aa", "score": "0.46178174", "text": "func (rb *ResourceBuilder) SetHaproxyType(val string) {\n\tif rb.config.HaproxyType.Enabled {\n\t\trb.res.Attributes().PutStr(\"haproxy.type\", val)\n\t}\n}", "title": "" }, { "docid": "857a02ed863fabbde0f707fa8ce97b24", "score": "0.4602749", "text": "func (_options *ReplaceResourcesQueryOptions) SetType(typeVar string) *ReplaceResourcesQueryOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "fdb4f7b31c48e937b1d8afa48b6e01ed", "score": "0.45957693", "text": "func (m *SubjectRightsRequest) SetDataSubjectType(value *DataSubjectType)() {\n m.dataSubjectType = value\n}", "title": "" }, { "docid": "fe2db9438e722e763c523cc93a11f1d8", "score": "0.45929474", "text": "func (m *BookingBusiness) SetBusinessType(value *string)() {\n m.businessType = value\n}", "title": "" }, { "docid": "2290aab279c234d56719ea9ead3d1b7a", "score": "0.4591443", "text": "func (o *Label) GetType() string {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Type\n}", "title": "" }, { "docid": "571246bad8439c0efec93c330d99a13d", "score": "0.45790234", "text": "func (x *Tdh) Set(label string) error {\n\tswitch label {\n\tcase \"Tom\", \"tom\":\n\t\t*x = TdhTom\n\t\treturn nil\n\tcase \"Dick\", \"dick\":\n\t\t*x = TdhDick\n\t\treturn nil\n\tcase \"Harry\", \"harry\":\n\t\t*x = TdhHarry\n\t\treturn nil\n\t}\n\t*x = -1\n\treturn fmt.Errorf(\"unknown label %q in testdata.Tdh\", label)\n}", "title": "" }, { "docid": "480dd9319987d8f3f7483175101fa842", "score": "0.45773366", "text": "func SetCommentFieldDataViaCommentType(iCommentType string, comment_field_data *CommentFieldData) (int64, error) {\n\tcomment_field_data.CommentType = iCommentType\n\treturn Engine.Insert(comment_field_data)\n}", "title": "" }, { "docid": "814226384a73d2de8a6ab4961e5caca0", "score": "0.45736548", "text": "func (m *Win32LobAppPowerShellScriptRule) SetOperationType(value *Win32LobAppPowerShellScriptRuleOperationType)() {\n m.operationType = value\n}", "title": "" }, { "docid": "24c256a910bd68b9341f70715085d75e", "score": "0.45600674", "text": "func (m *AccessPackageSubject) SetTypeEscaped(value *string)() {\n err := m.GetBackingStore().Set(\"typeEscaped\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "877b41a5c215a0e15ba1f8187e88248e", "score": "0.45545456", "text": "func (m *Property) SetLabels(value []Label)() {\n err := m.GetBackingStore().Set(\"labels\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4c96511ee61ecbcc3c9b48bc1f537a0c", "score": "0.45507586", "text": "func (ftc *FileTypeCreate) SetNillableType(f *filetype.Type) *FileTypeCreate {\n\tif f != nil {\n\t\tftc.SetType(*f)\n\t}\n\treturn ftc\n}", "title": "" }, { "docid": "c78cc79547160615fe3d912c68c03a33", "score": "0.45500758", "text": "func (s *EntrySchema) SetLabel(label string) *EntrySchema {\n\tif len(label) == 0 {\n\t\tpanic(\"s.SetLabel called with an empty label\")\n\t}\n\ts.entrySchema.Label = label\n\treturn s\n}", "title": "" }, { "docid": "5c6078d674f134c004a82140963fdbe0", "score": "0.45378166", "text": "func (s *DataLabelType) SetFieldLabelType(v *FieldLabelType) *DataLabelType {\n\ts.FieldLabelType = v\n\treturn s\n}", "title": "" }, { "docid": "a5ea722be0ff005fc9aba0caed88dcee", "score": "0.45360798", "text": "func (db *DBCreds) SetDBType(t string) {\n\tif t == \"\" {\n\t\tlog.Println(\"Setting DBCreds dbtype to empty string.\")\n\t}\n\tdb.dbtype = t\n}", "title": "" }, { "docid": "9d309717dd1572bc022b50cc641fcea1", "score": "0.45336416", "text": "func (ftu *FileTypeUpdate) SetNillableType(f *filetype.Type) *FileTypeUpdate {\n\tif f != nil {\n\t\tftu.SetType(*f)\n\t}\n\treturn ftu\n}", "title": "" }, { "docid": "298bedd3b023934a723d689ea6f5e7db", "score": "0.45334482", "text": "func (m *CloudPcServicePlan) SetTypeEscaped(value *CloudPcServicePlanType)() {\n err := m.GetBackingStore().Set(\"typeEscaped\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5717e3747dbe5fa32a48ca9789d4b260", "score": "0.45331785", "text": "func (m *EndUserNotificationSetting) SetSettingType(value *EndUserNotificationSettingType)() {\n err := m.GetBackingStore().Set(\"settingType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8019d1e7dfb89a29e13494a1af07c004", "score": "0.4522815", "text": "func (o *AccessConfig) SetType(v *string) *AccessConfig {\n\tif o.Type = v; o.Type == nil {\n\t\to.nullFields = append(o.nullFields, \"Type\")\n\t}\n\treturn o\n}", "title": "" }, { "docid": "21d421c2de833bb5681f48087737a5c0", "score": "0.4522132", "text": "func (fpv *LabelDescriptor_FieldTerminalPathValue) SetTo(target **LabelDescriptor) {\n\tif *target == nil {\n\t\t*target = new(LabelDescriptor)\n\t}\n\tswitch fpv.selector {\n\tcase LabelDescriptor_FieldPathSelectorKey:\n\t\t(*target).Key = fpv.value.(string)\n\tcase LabelDescriptor_FieldPathSelectorValueType:\n\t\t(*target).ValueType = fpv.value.(LabelDescriptor_ValueType)\n\tcase LabelDescriptor_FieldPathSelectorDescription:\n\t\t(*target).Description = fpv.value.(string)\n\tcase LabelDescriptor_FieldPathSelectorDefaultValue:\n\t\t(*target).DefaultValue = fpv.value.(string)\n\tcase LabelDescriptor_FieldPathSelectorDisabled:\n\t\t(*target).Disabled = fpv.value.(bool)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for LabelDescriptor: %d\", fpv.selector))\n\t}\n}", "title": "" }, { "docid": "9a521514cd65bb290ffd25f6451f158f", "score": "0.45201847", "text": "func (m *DecisionMutation) SetType(s string) {\n\tm._type = &s\n}", "title": "" }, { "docid": "5ea4b24becc3eb7e7de78e6ce8cd4f6b", "score": "0.45098075", "text": "func (_options *CreatePolicyOptions) SetType(typeVar string) *CreatePolicyOptions {\n\t_options.Type = core.StringPtr(typeVar)\n\treturn _options\n}", "title": "" }, { "docid": "8748ee1f68c9414ec8e3d64eed5d6694", "score": "0.4509327", "text": "func (m *Metric) SetLabel(key, value string) {\n\tfor i, l := range m.Labels {\n\t\tif l.Name == key {\n\t\t\tm.Labels[i].Value = value\n\t\t\treturn\n\t\t}\n\t}\n\tm.AddLabel(key, value)\n}", "title": "" }, { "docid": "8a67176b8deb5174548937e76939078c", "score": "0.4508118", "text": "func (m *InformationProtectionPolicySetting) SetDefaultLabelId(value *string)() {\n err := m.GetBackingStore().Set(\"defaultLabelId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7844246d18cf3c880a76ee281d8c346c", "score": "0.45051372", "text": "func (l Labels) Set(label, value string) {\n\tl[label] = value\n}", "title": "" }, { "docid": "d364c499f3995bd2f2a779af80f9b225", "score": "0.4501619", "text": "func (t *GoType) Set(value string) error {\n\tif len(value) == 0 {\n\t\treturn nil\n\t}\n\n\tif i := strings.LastIndex(value, \".\"); i < 0 {\n\t\treturn fmt.Errorf(\"bad method argument type: %q\", value)\n\t} else {\n\t\tt.PkgPath, t.Name = value[:i], value[i+1:]\n\t\tif len(t.PkgPath) > 0 && t.PkgPath[0] == '*' {\n\t\t\tt.PkgPath = t.PkgPath[1:]\n\t\t\tt.IsPtr = true\n\t\t}\n\n\t\tt.IsSet = true\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "404748f0b17da94724a1cc6242032bdb", "score": "0.44927883", "text": "func (fc *FileCreate) SetType(f *FileType) *FileCreate {\n\treturn fc.SetTypeID(f.ID)\n}", "title": "" }, { "docid": "70b26812ca169db4f0ec554ccd039cbe", "score": "0.44892827", "text": "func (r *ResourceBase) SetType(Type string) {\n\tr.RType = Type\n}", "title": "" }, { "docid": "9b355263fa276f1dad602e7bf19a7d90", "score": "0.44872135", "text": "func (_options *UpdateWorkspaceOptions) SetType(typeVar []string) *UpdateWorkspaceOptions {\n\t_options.Type = typeVar\n\treturn _options\n}", "title": "" }, { "docid": "89d35d0b2166f54fd568244bd5f1f5a1", "score": "0.44731918", "text": "func (ftuo *FileTypeUpdateOne) SetNillableType(f *filetype.Type) *FileTypeUpdateOne {\n\tif f != nil {\n\t\tftuo.SetType(*f)\n\t}\n\treturn ftuo\n}", "title": "" } ]
9d14ac802afb1baeeca81d05d42b413f
var wg1 sync.WaitGroup SiteMap is the sitemap builder for the website
[ { "docid": "f18dba9f25de70c68dc35c73c40c2b54", "score": "0.64542013", "text": "func SiteMap(urlStr string, depth int, l *log.Logger) []string {\n\n\tl.Println(\"**** Initiate site map build*****\")\n\tseen := make(map[string]struct{})\n\tvar q map[string]struct{}\n\tnq := map[string]struct{}{\n\t\turlStr: struct{}{},\n\t}\n\tfor i := 0; i <= depth; i++ {\n\t\tq, nq = nq, make(map[string]struct{})\n\t\tfor url := range q {\n\t\t\tif _, ok := seen[url]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdup := url[:len(url)-1]\n\t\t\tif _, ok := seen[dup]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tl.Printf(\"Adding to seen: %v\", url)\n\t\t\tseen[url] = struct{}{}\n\t\t\tfor _, link := range getLinks(url, l) {\n\t\t\t\tnq[link] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\tret := make([]string, 0, len(seen))\n\tfor url := range seen {\n\t\tret = append(ret, url)\n\t}\n\tl.Println(\"**** finalizing site map build****\")\n\treturn ret\n}", "title": "" } ]
[ { "docid": "924be7f964c6fb73b3e4101eaeeddaae", "score": "0.68926", "text": "func fillSiteMap(sm *SiteMap, httpTimeout time.Duration) {\n\tclient := http.Client{\n\t\tTimeout: httpTimeout,\n\t}\n\tcheckDepth := 0\n\tfor checkDepth < sm.Depth {\n\t\tnodes := sm.GetNodesFromDepth(checkDepth)\n\t\turis := getURLsFromNodeSlice(nodes)\n\t\tjobResults := fetch.Links(&client, uris)\n\t\tfor i := 0; i < len(jobResults); i++ {\n\t\t\tutil.CleanURLS(jobResults[i].LinksTo)\n\t\t\tjobResults[i].LinksTo = util.FilterLinksByHostname(jobResults[i].LinksTo, sm.RootEffectiveTLDPlusOne)\n\t\t}\n\t\tseenSomethingNew := addToSiteMap(sm, jobResults)\n\t\tif !seenSomethingNew {\n\t\t\tbreak\n\t\t}\n\t\tcheckDepth++\n\t}\n\tsm.FinishedAt = time.Now().Unix()\n\tsm.Depth = checkDepth\n}", "title": "" }, { "docid": "ee1d89a0e0eb1381e5e9045ddb323287", "score": "0.6628644", "text": "func SiteMap(url string, httpGet HTTPGet, scraper Scraper, logger Logf) map[string]*Page {\n\tpages := make(map[string]*Page)\n\tcrawler := &crawler{\n\t\thttpGet: httpGet,\n\t\tscraper: scraper,\n\t\tprintf: logger,\n\t\tdomain: strings.TrimSuffix(url, \"/\"),\n\t\tpages: &SafePages{v: pages},\n\t}\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tcrawler.crawl(url, &wg)\n\twg.Wait()\n\treturn pages\n}", "title": "" }, { "docid": "5017360908f89040c5438b99f1169620", "score": "0.63559073", "text": "func CreateXMLSitemap() {\n\tlogrus.Info(\"Starting XML sitemap generation\")\n\tfolder := path.Join(GetConfig().Public, \"sitemap\")\n\t//domain := GetConfig().Domain\n\t//now := time.Now()\n\t//items := make([]sitemap.Item, 1)\n\t//\n\t////Home page\n\t//items = append(items, sitemap.Item{\n\t//\tLoc: fmt.Sprintf(\"%s\", domain),\n\t//\tLastMod: now,\n\t//\tChangefreq: \"daily\",\n\t//\tPriority: 1,\n\t//})\n\t//\n\t////Posts\n\t//posts, err := models.GetPublishedPosts()\n\t//if err != nil {\n\t//\tlogrus.Error(err)\n\t//\treturn\n\t//}\n\t//for i := range posts {\n\t//\titems = append(items, sitemap.Item{\n\t//\t\tLoc: fmt.Sprintf(\"%s/posts/%d\", domain, posts[i].ID),\n\t//\t\tLastMod: posts[i].UpdatedAt,\n\t//\t\tChangefreq: \"weekly\",\n\t//\t\tPriority: 0.9,\n\t//\t})\n\t//}\n\t//\n\t////Static pages\n\t//pages, err := models.GetPublishedPages()\n\t//if err != nil {\n\t//\tlogrus.Error(err)\n\t//\treturn\n\t//}\n\t//for i := range pages {\n\t//\titems = append(items, sitemap.Item{\n\t//\t\tLoc: fmt.Sprintf(\"%s/pages/%d\", domain, pages[i].ID),\n\t//\t\tLastMod: pages[i].UpdatedAt,\n\t//\t\tChangefreq: \"monthly\",\n\t//\t\tPriority: 0.8,\n\t//\t})\n\t//}\n\t//if err := sitemap.SiteMap(path.Join(folder, \"sitemap1.xml.gz\"), items); err != nil {\n\t//\tlogrus.Error(err)\n\t//\treturn\n\t//}\n\t//if err := sitemap.SiteMapIndex(folder, \"sitemap_index.xml\", domain+\"/public/sitemap/\"); err != nil {\n\t//\tlogrus.Error(err)\n\t//\treturn\n\t//}\n\tlogrus.Info(\"XML sitemap has been generated in \" + folder)\n}", "title": "" }, { "docid": "6d50283705cd570fb20b97a60e574c5a", "score": "0.62375", "text": "func (g *sitemapGenerator) Generate() (err error) {\n\tfmt.Println(\"\\tGenerating Sitemap...\")\n\tdoc := etree.NewDocument()\n\tdoc.CreateProcInst(\"xml\", `version=\"1.0\" encoding=\"UTF-8\"`)\n\turlSet := doc.CreateElement(\"urlset\")\n\turlSet.CreateAttr(\"xmlns\", \"http://www.sitemaps.org/schemas/sitemap/0.9\")\n\turlSet.CreateAttr(\"xmlns:image\", \"http://www.google.com/schemas/sitemap-image/1.1\")\n\n\turl := urlSet.CreateElement(\"url\")\n\tloc := url.CreateElement(\"loc\")\n\tloc.SetText(g.blogURL)\n\n\tg.addURL(urlSet, \"about\", nil)\n\tg.addURL(urlSet, \"archive\", nil)\n\tg.addURL(urlSet, \"tags\", nil)\n\tg.addURL(urlSet, \"categories\", nil)\n\n\tfor tag := range g.tagPostsMap {\n\t\tg.addURL(urlSet, tag, nil)\n\t}\n\n\tfor cat := range g.categoryPostsMap {\n\t\tg.addURL(urlSet, cat, nil)\n\t}\n\n\tfor _, post := range g.posts {\n\t\tg.addURL(urlSet, post.name[1:], post.images)\n\t}\n\n\tfilePath := fmt.Sprintf(\"%s/sitemap.xml\", g.destination)\n\tf, err := os.Create(filePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating file %s: %v\", filePath, err)\n\t}\n\tf.Close()\n\terr = doc.WriteToFile(filePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing to file %s: %v\", filePath, err)\n\t}\n\tfmt.Println(\"\\tFinished generating Sitemap...\")\n\treturn nil\n}", "title": "" }, { "docid": "0158b20b7d15948406854e700b866dbc", "score": "0.61711824", "text": "func addToSiteMap(sitemap *SiteMap, jobResults []fetch.JobResult) bool {\n\tseenSomethingNew := false\n\tfor i := 0; i < len(jobResults); i++ {\n\t\tfromNode := jobResults[i].FromURL\n\t\tfor j := 0; j < len(jobResults[i].LinksTo); j++ {\n\t\t\tadded, err := sitemap.AddLeaf(fromNode, jobResults[i].LinksTo[j])\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error adding entry %s from %s to Sitemap, err: %s\", jobResults[i].LinksTo[j].String(), fromNode.String(), err)\n\t\t\t}\n\t\t\tif added == true {\n\t\t\t\tseenSomethingNew = true\n\t\t\t}\n\t\t}\n\t}\n\treturn seenSomethingNew\n}", "title": "" }, { "docid": "afc3310cb2c23578878288b2b10aea5f", "score": "0.59471", "text": "func MakeSiteMap(seed string, depth int, httpTimeout time.Duration) *SiteMap {\n\tsm := SiteMap{}\n\tsm.CreatedAt = time.Now().Unix()\n\tsm.Depth = depth\n\tseedurl, err := url.Parse(seed)\n\tif err != nil {\n\t\tlog.Printf(\"The seed URL (%s) didn't parse. Error was %s\\n\", seed, err)\n\t\treturn &sm\n\t}\n\n\tsm.SetRootNode(seedurl)\n\tfillSiteMap(&sm, httpTimeout)\n\treturn &sm\n}", "title": "" }, { "docid": "f3ee9faffad558507baa05ef705f3276", "score": "0.5847697", "text": "func siteMap(context *router.Context) {\n\tSession.Subscribe(\"sitestatus\", _siteMap)\n\tSession.Subscribe(\"usersites\", _siteMap)\n\tgo _siteMap(\"show\", 1)\n}", "title": "" }, { "docid": "03f35d6d2d0192af2e7ae4e12a28a7a3", "score": "0.5790297", "text": "func main() {\n\t// set max limit on processes\n\t// measure performance\n\truntime.GOMAXPROCS(100)\n\n\tsourceURL := parseInput()\n\tlog.Println(\"Source Sitemap: \", sourceURL)\n\n\tvar si = &SitemapIndex{}\n\n\t// TODO: Write to file in the end\n\t// TODO: Show in a data table\n\t// TODO: Break into separate files\n\tsitemapURLs := si.getSitemapUrls(sourceURL)\n\n\t// with a type alias I do not need constructor function, still need make to initialize map\n\t// doing this to reduce allocations during adding data\n\tvar sm = make(Sitemaps, len(sitemapURLs))\n\tsm.parseSitemaps(sitemapURLs)\n\n\tlog.Println(\"Number of links gathered: \", len(sm))\n\t//log.Println(sm)\n}", "title": "" }, { "docid": "59a3ecb7b68fa2f86cbd15e09f3bae37", "score": "0.5703733", "text": "func GetSitemap(originURL string, maxDepth int, crossOrigin bool, w io.Writer) error {\n\n\tentries := crawl(originURL, maxDepth, crossOrigin)\n\n\ttoXML := urlset{\n\t\tURLs: make([]loc, len(entries)),\n\t\tXmlns: xmlns,\n\t}\n\n\tfor i, entry := range entries {\n\t\ttoXML.URLs[i] = loc{entry.URL}\n\t}\n\n\tenc := xml.NewEncoder(w)\n\n\tenc.Indent(\"\", \" \")\n\n\tfmt.Printf(xml.Header)\n\n\terr := enc.Encode(toXML)\n\n\tfmt.Printf(\"\\n\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// ret := xml.Header\n\t// ret += \"<urlset xmlns=\\\"http://www.sitemaps.org/schemas/sitemap/0.9\\\">\\n\"\n\n\t// xml := make([]string, len(entries))\n\n\t// for i, entry := range entries {\n\t// \txml[i] = fmt.Sprintf(\"\\t<url><loc>%s</loc>\"+ /*\"<referer>%s</referer>\" + */ \"<lastmod>%s</lastmod></url>\\n\", entry.URL /*entry.FirstReferer, */, time.Unix(entry.Timestamp, 0))\n\t// }\n\n\t// sort.Sort(sort.StringSlice(xml))\n\n\t// ret += strings.Join(xml, \"\")\n\n\t// ret += \"</urlset>\"\n\n\treturn nil\n\n}", "title": "" }, { "docid": "a9a0ad905c385badc74ae34483e7f939", "score": "0.5606614", "text": "func (site *SiteMap) TraverseSiteMap(ch chan<- MapTraversalNode) {\n\t// First we need to determine lowest height for each page (i.e the minimum number of steps from the sites\n\t// root to a page along any path). This is used to determine at which point we traverse the pages children\n\tdefer close(ch)\n\texpanded := make(map[*WebPage]bool)\n\tminPageHeights := site.getMinimumHeights()\n\t// now do the depth first traversal\n\tsite.doDepthFirstTraversal(ch, minPageHeights, expanded, 0, site.RootPage)\n}", "title": "" }, { "docid": "265a1d5ddf28fb057f2699364c89a47f", "score": "0.55922717", "text": "func write(path, xml string) (sitemapUrl string) {\n\tif len(xml) > 0 {\n\t\tsitemapUrl, _ = uploader.PutObject(path, []byte(xml))\n\t\tlog.Info(\"Upload sitemap success, %s\", sitemapUrl)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b4e2d119a51ff4cb13d60f06fc7bb9c0", "score": "0.55274755", "text": "func (r *Router) GenerateSitemaps() ([]string, error) {\n\tr.sitemapMutex.Lock()\n\tdefer r.sitemapMutex.Unlock()\n\n\tbuffer := NewBuffer(r.Options.Domain, r.Options.CachePath)\n\tfor _, entry := range r.staticEntries {\n\t\tbuffer.AddEntry(&Entry{\n\t\t\tFileReference: &FileReference{\n\t\t\t\tLocation: r.fullLocation(entry.Location),\n\t\t\t},\n\t\t\tPriority: &entry.Priority,\n\t\t})\n\t}\n\tfor _, entry := range r.paramEntries {\n\t\terr := entry.Enumerator(func(pairs ...string) error {\n\t\t\troute, err := entry.Route.URL(pairs...)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn buffer.AddEntry(&Entry{\n\t\t\t\tFileReference: &FileReference{\n\t\t\t\t\tLocation: r.fullLocation(route.String()),\n\t\t\t\t},\n\t\t\t\tPriority: &entry.Priority,\n\t\t\t})\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\terr := buffer.Flush()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfullLocations := make([]string, len(buffer.Locations))\n\tfor i, loc := range buffer.Locations {\n\t\tfullLocations[i] = r.Options.Domain + r.Options.ServerPath + loc\n\t}\n\n\tindex := NewSitemapIndex(fullLocations)\n\tpath := \"sitemapindex.xml\"\n\terr = index.WriteToFile(r.Options.CachePath + path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append(buffer.Locations, path), nil\n}", "title": "" }, { "docid": "6e4897950f0ac980d12ec4c6feb3f4e8", "score": "0.547198", "text": "func CreateSiteMap(start *url.URL) *SiteMap {\n\treturn &SiteMap{Domain: start.Host,\n\t\tRootPage: start.String(),\n\t\tPages: make(map[string]*WebPage),\n\t}\n}", "title": "" }, { "docid": "06b65ebc4e5b63ad20618860e7b64f47", "score": "0.54541653", "text": "func BuildXMLSitemap(pages []*domain.Page) ([]byte, error) {\n\tvar buf bytes.Buffer\n\n\t// Add the header with schema definition\n\tbuf.WriteString(sitemapTemplateHeader)\n\n\t// Add each page\n\tfor _, p := range pages {\n\t\tif p == nil || p.Url == nil {\n\t\t\tcontinue\n\t\t}\n\t\tbuf.WriteString(fmt.Sprintf(urlTemplate, p.Url.String(), time.Now().Format(\"2006-01-02\")))\n\t}\n\n\t// Append the footer closing tag\n\tbuf.WriteString(sitemapTemplateFooter)\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "cb720d7c03e5f182b04bb64a84e8d72c", "score": "0.54431105", "text": "func (p URLs) parseSitemapURL(url string, ch chan<- map[string]URLs) {\n\tlog.Println(\"Parsing: \", url)\n\tpages := getSitemapData(url)\n\t_ = xml.Unmarshal(pages, &p)\n\tm := make(map[string]URLs)\n\tm[url] = p\n\n\t// using select only to indicate if channel gets full\n\tselect {\n\tcase ch <- m:\n\tdefault:\n\t\tlog.Fatalln(\"Channel full. Discarding value\")\n\t}\n}", "title": "" }, { "docid": "b36b7b0468a77cf34fbdf99d1eb9f69d", "score": "0.5433647", "text": "func IngestSitemapXML(url string) URLSet {\n\t// read the sitemap into a []SiteMapEntry\n\n\tvar client http.Client\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tlog.Print(err) // not even being able to make a req instance.. might be a fatal thing?\n\t}\n\n\treq.Header.Set(\"User-Agent\", \"EarthCube_DataBot/1.0\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Print(\"Error reading sitemap: %s\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// var bodyString string\n\tvar bodyBytes []byte\n\tif resp.StatusCode == http.StatusOK {\n\t\tbodyBytes, err = ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t\t// bodyString = string(bodyBytes)\n\t}\n\n\t// Process XML into a struct\n\tvar sitemap URLSet\n\txml.Unmarshal(bodyBytes, &sitemap)\n\n\treturn sitemap\n}", "title": "" }, { "docid": "88419069b623614947a2d168ff24ba9c", "score": "0.53078234", "text": "func (s *SitemapGroup) Create(url_set URLSet) {\n\tvar path string\n\tvar remnant []URL\n\n\txml, err := createSitemapXml(url_set)\n\n\tif err == ErrMaxFileSize {\n\t\t//splits into two sitemaps recursively\n\t\tnewlimit := MAXURLSETSIZE / 2\n\t\ts.Create(URLSet{URLs: url_set.URLs[newlimit:]})\n\t\ts.Create(URLSet{URLs: url_set.URLs[:newlimit]})\n\t\treturn\n\t} else if err == ErrMaxUrlSetSize {\n\t\tremnant = url_set.URLs[MAXURLSETSIZE:]\n\t\turl_set.URLs = url_set.URLs[:MAXURLSETSIZE]\n\t\txml, err = createSitemapXml(url_set)\n\t}\n\n\tif err != nil {\n\t\tlog.Fatal(\"File not saved:\", err)\n\t}\n\n\tsitemap_name := s.getSitemapName()\n\tpath = filepath.Join(s.folder, sitemap_name)\n\n\terr = saveXml(xml, path)\n\tif err != nil {\n\t\tlog.Fatal(\"File not saved:\", err)\n\t}\n\n\tsavedSitemaps = append(savedSitemaps, sitemap_name)\n\ts.group_count++\n\ts.Clear()\n\n\t//append remnant urls if exists\n\tif len(remnant) > 0 {\n\t\ts.urls = append(s.urls, remnant...)\n\t}\n\n}", "title": "" }, { "docid": "e1c110345602dcf92888af61d5cb69c6", "score": "0.52149886", "text": "func crawl(logger hclog.Logger, fetcher fetchFn, rootURL string, parallelism int) (*Sitemap, int, error) {\n\tif parallelism < 1 {\n\t\treturn nil, 0, fmt.Errorf(\"Parallelism must be > 0 (got %d)\", parallelism)\n\t}\n\n\trobots, err := getRobots(fetcher, rootURL)\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Could not set up robots.txt filter: %v\", err)\n\t}\n\n\turls := make(urlChan, parallelism*10)\n\tresults := make(resultChan, parallelism)\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < parallelism; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tfor url := range urls {\n\t\t\t\tlinks, err := processPage(fetcher, rootURL, robots, url)\n\t\t\t\tresults <- &pageResult{\n\t\t\t\t\turl: url,\n\t\t\t\t\tlinks: links,\n\t\t\t\t\terr: err,\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\tsm := NewSitemap()\n\texpectedResults := 1\n\tbacklog := []string{rootURL}\n\twarnings := 0\n\tfor expectedResults > 0 {\n\t\t// Stuff the work queue with as much as we can fit in there, but we can't\n\t\t// block here otherwise we won't be able to process results.\n\tBACKLOG:\n\t\tfor len(backlog) > 0 {\n\t\t\tnextURL := backlog[0]\n\t\t\tselect {\n\t\t\tcase urls <- nextURL:\n\t\t\t\tbacklog = backlog[1:]\n\t\t\tdefault:\n\t\t\t\tbreak BACKLOG\n\t\t\t}\n\t\t}\n\n\t\t// Block for the next result, since we know there's outstanding work.\n\t\tresult := <-results\n\t\texpectedResults--\n\t\tif result.err != nil {\n\t\t\twarnings++\n\t\t\tlogger.Warn(\"Crawling problem\", \"url\", result.url, \"error\", result.err)\n\t\t\tcontinue\n\t\t}\n\n\t\tnewURLs := sm.AddLinks(result.url, result.links)\n\t\tfor _, newURL := range newURLs {\n\t\t\texpectedResults++\n\t\t\tbacklog = append(backlog, newURL)\n\t\t}\n\t\tlogger.Debug(\"Processed page\", \"url\", result.url,\n\t\t\t\"unique_links\", len(result.links),\n\t\t\t\"new_links\", len(newURLs))\n\t}\n\n\tclose(urls)\n\twg.Wait()\n\treturn sm, warnings, nil\n}", "title": "" }, { "docid": "8ee9f4eb14c61215ee083fe8f63159f5", "score": "0.51771265", "text": "func SitemapIndex(w http.ResponseWriter, r *http.Request) {\n\t// Display the view\n\t// w.Header().Set(\"Content-Type\", \"application/xml\")\n\tv := view.New(r)\n\tv.Name = \"sitemap_index\"\n\tv.Render(w)\n}", "title": "" }, { "docid": "4e90799a8b201b1189cc0bd593a5945f", "score": "0.51454866", "text": "func ScrapeSitemap(url string, parser Parser, concurrency int) []SeoData {\n\tresults := extractSitemapURLs(url)\n\tres := scrapeUrls(results, parser, concurrency)\n\treturn res\n}", "title": "" }, { "docid": "c095e74e1132b5039e604caf28efcd53", "score": "0.51002926", "text": "func Write(w io.Writer, u *URLSet) error {\n\tsetDefaultNamespace(u)\n\tif _, err := io.WriteString(w, xml.Header); err != nil {\n\t\treturn xerrors.Errorf(\"write sitemap: %w\", err)\n\t}\n\te := xml.NewEncoder(w)\n\tif err := e.Encode(u); err != nil {\n\t\treturn xerrors.Errorf(\"write sitemap: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45ca93d023a277926a29dd0134728952", "score": "0.5097235", "text": "func (sm *Sitemap) Write(w io.Writer) error {\n\turls := make([]string, 0, len(sm.outbounds))\n\tfor url := range sm.outbounds {\n\t\turls = append(urls, url)\n\t}\n\tsort.Strings(urls)\n\n\tfor _, url := range urls {\n\t\tif _, err := fmt.Fprintf(w, \"%s\\n\", url); err != nil {\n\t\t\treturn err\n\t\t}\n\t\toutbound := sm.outbounds[url]\n\t\tlinks := make([]string, 0, len(outbound))\n\t\tfor link := range outbound {\n\t\t\tlinks = append(links, link)\n\t\t}\n\t\tsort.Strings(links)\n\t\tfor _, link := range links {\n\t\t\tif _, err := fmt.Fprintf(w, \" -> %s\\n\", link); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif _, err := fmt.Fprintf(w, \"\\n\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16e480ca0511477cc4c24fa5b4cdbf42", "score": "0.5089207", "text": "func fillMap() (*cluster.Smap, error) {\n\twg := &sync.WaitGroup{}\n\tsmap, err := api.GetClusterMap(defaultAPIParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif smap.Primary.PublicNet.DirectURL != defaultAPIParams.URL {\n\t\t// TODO: cluster map (Smap) is replicated & synchronized across all nodes, and so\n\t\t// this step can be made optional/configurable with default='not doing it'\n\t\tsmapPrimary, err := api.GetNodeClusterMap(defaultAPIParams, smap.Primary.ID())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsmap = smapPrimary\n\t}\n\tproxyCount := smap.CountProxies()\n\ttargetCount := smap.CountTargets()\n\n\twg.Add(proxyCount + targetCount)\n\tretrieveStatus(smap.Pmap, proxy, wg)\n\tretrieveStatus(smap.Tmap, target, wg)\n\twg.Wait()\n\treturn smap, nil\n}", "title": "" }, { "docid": "73e8b561f7eab905ed0829a6ffefee74", "score": "0.50162554", "text": "func Crawl(logger hclog.Logger, rootURL string, parallelism int) (*Sitemap, int, error) {\n\treturn crawl(logger, webFetcher, rootURL, parallelism)\n}", "title": "" }, { "docid": "7103406422eebe656f09a8bc1ea256ee", "score": "0.4994891", "text": "func getSitemapURLList(domainURL string, robots *robotstxt.Group) ([]string, error) {\n\tvar us sitemaps.Sitemap\n\tvar s []string\n\n\tidxr, err := sitemaps.DomainIndex(domainURL)\n\tif err != nil {\n\t\tlog.Error(\"Error reading sitemap at:\", domainURL, err)\n\t\treturn s, err\n\t}\n\n\tif len(idxr) < 1 {\n\t\tlog.Info(domainURL, \" is not a sitemap index, checking to see if it is a sitemap\")\n\t\tus, err = sitemaps.DomainSitemap(domainURL)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Error parsing sitemap index at \", domainURL, err)\n\t\t\treturn s, err\n\t\t}\n\t} else {\n\t\tlog.Info(\"Walking the sitemap index for sitemaps\")\n\t\tfor _, idxv := range idxr {\n\t\t\tsubset, err := sitemaps.DomainSitemap(idxv)\n\t\t\tus.URL = append(us.URL, subset.URL...)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Error parsing sitemap index at: \", idxv, err)\n\t\t\t\treturn s, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Convert the array of sitemap package struct to simply the URLs in []string\n\tfor _, urlStruct := range us.URL {\n\t\tif urlStruct.Loc != \"\" { // TODO why did this otherwise add a nil to the array.. need to check\n\t\t\tloc := strings.TrimSpace(urlStruct.Loc)\n\t\t\tloc = strings.ReplaceAll(loc, \" \", \"\")\n\t\t\tloc = strings.ReplaceAll(loc, \"\\n\", \"\")\n\n\t\t\tif robots != nil && !robots.Test(loc) {\n\t\t\t\tlog.Error(\"Declining to index \", loc, \" because it is disallowed by robots.txt. Error information, if any:\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ts = append(s, loc)\n\t\t}\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "106a2ebd124e8b21f522be97360dd517", "score": "0.49424747", "text": "func (p *Page) PrintSitemap() {\n\tfmt.Println(\"Printing sitemap...\")\n\t// Generate a map to track visited nodes\n\tvisited := map[string]bool{}\n\ttraverse(p, \"\", visited, 0)\n}", "title": "" }, { "docid": "18aef092bde13409c311a17cfbbf3c48", "score": "0.49352935", "text": "func (g *Generator) Add(url SitemapURL) error {\n\tnode := g.formatURLNode(url)\n\tif !g.canFit(len(node)) {\n\t\tif err := g.nextTmp(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tl, err := g.tmpFile.Write([]byte(node))\n\tg.bodyLen += l\n\tg.bodyURLCount++\n\treturn err\n}", "title": "" }, { "docid": "293fa4cf6a599019335ab1725869cb52", "score": "0.49236944", "text": "func NewSitemap() *Sitemap {\n\treturn &Sitemap{\n\t\toutbounds: make(map[string]urlSet),\n\t}\n}", "title": "" }, { "docid": "5c7faeb65e23c3c918f09779a76fc47c", "score": "0.49227992", "text": "func buildMap(parsed *ptus) *map[string]string {\n\tret := make(map[string]string, len(parsed.ps))\n\n\tfor _, p := range parsed.ps {\n\t\tret[p.Path] = p.URL\n\t}\n\n\treturn &ret\n}", "title": "" }, { "docid": "8c131ce586060e5e0be9e4a82a688f40", "score": "0.49066913", "text": "func Crawl(o Options, ch chan DocumentResult, baseurl string) *URLMap {\n\tdm := &URLMap{\n\t\tURLs: map[string]DocumentResult{},\n\n\t\t_mu: &sync.Mutex{},\n\t\t_wg: &sync.WaitGroup{},\n\t}\n\n\tdm._wg.Add(1)\n\tgo crawl(o, ch, dm, baseurl)\n\tdm._wg.Wait()\n\n\tclose(ch)\n\n\treturn dm\n}", "title": "" }, { "docid": "77bf5282653c9645ede9d063e7679bc4", "score": "0.48660225", "text": "func TestMap(t *testing.T) {\n\t// we need to ensure a logger is initialized\n\tinstr := instrumentator.Instr{\n\t\tLogger: logrus.NewEntry(logrus.New()),\n\t}\n\tparser.Init(\"http\", \"example.com\", \"www\")\n\n\t// notice 'foo' assets appear twice but should be filtered out by the mapper\n\t// so that there is only one of them for each type (link/script).\n\t// also the canonical link should be filtered out too.\n\tpage := requester.Page{\n\t\tURL: \"http://www.example.com\",\n\t\tBody: []byte(`<html>\n\t<head>\n\t\t<link rel='canonical' href='http://www.example.com/'>\n\t\t<link href=\"foo.css\">\n\t\t<link href=\"foo.css\">\n\t\t<link href=\"bar.css\">\n\t\t<link href=\"baz.css\">\n\t\t<script src=\"foo.js\"></script>\n\t\t<script src=\"foo.js\"></script>\n\t\t<script src=\"bar.js\"></script>\n\t\t<script src=\"baz.js\"></script>\n\t</head>\n\t<body>\n\t\t<a href=\"/foo\">foo 1</a>\n\t\t<a href=\"/foo\">foo 2</a>\n\t\t<a href=\"/bar\">bar</a>\n\t\t<a href=\"/baz\">baz</a>\n\t</body>\n</html>`),\n\t\tStatus: 200,\n\t}\n\n\tinput := parser.Parse(page, &instr)\n\n\toutput := Page{\n\t\tURL: \"http://www.example.com\",\n\t\tAnchors: []string{\n\t\t\t\"http://www.example.com/foo\",\n\t\t\t\"http://www.example.com/bar\",\n\t\t\t\"http://www.example.com/baz\",\n\t\t},\n\t\tLinks: []string{\n\t\t\t\"http://www.example.com/foo.css\",\n\t\t\t\"http://www.example.com/bar.css\",\n\t\t\t\"http://www.example.com/baz.css\",\n\t\t},\n\t\tScripts: []string{\n\t\t\t\"http://www.example.com/foo.js\",\n\t\t\t\"http://www.example.com/bar.js\",\n\t\t\t\"http://www.example.com/baz.js\",\n\t\t},\n\t}\n\n\tactual := Map(input)\n\n\tif actual.URL != output.URL {\n\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", output.URL, actual.URL)\n\t}\n\n\tif len(actual.Anchors) != len(output.Anchors) {\n\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", len(output.Anchors), len(actual.Anchors))\n\t}\n\n\tif len(actual.Links) != len(output.Links) {\n\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", len(output.Links), len(actual.Links))\n\t}\n\n\tif len(actual.Scripts) != len(output.Scripts) {\n\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", len(output.Scripts), len(actual.Scripts))\n\t}\n\n\tfor i, v := range actual.Anchors {\n\t\tif v != output.Anchors[i] {\n\t\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", output.Anchors[i], v)\n\t\t}\n\t}\n\n\tfor i, v := range actual.Links {\n\t\tif v != output.Links[i] {\n\t\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", output.Links[i], v)\n\t\t}\n\t}\n\n\tfor i, v := range actual.Scripts {\n\t\tif v != output.Scripts[i] {\n\t\t\tt.Errorf(\"expected: %+v\\ngot: %+v\", output.Scripts[i], v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5fe5d49c18345f0580a7ab8d94c8a254", "score": "0.48451722", "text": "func (gss *GlobalSetting) UpdateSiteInfo() bool {\n\treturn gss.update(gokits.Struct2Map(gss.Si))\n}", "title": "" }, { "docid": "65d37ba5565c0ce6ab59a3f13d5a71ab", "score": "0.48414004", "text": "func (crawler *crawler) crawl(url string, wg *sync.WaitGroup) {\n\tcrawler.printf(\"getting page: %s\\n\", url)\n\tpage := crawler.getPage(url)\n\tcrawler.pages.Write(url, page)\n\tfor _, u := range page.links {\n\t\tif _, exists := crawler.pages.Read(u); exists {\n\t\t\tcontinue\n\t\t}\n\t\twg.Add(1)\n\t\tgo crawler.crawl(u, wg)\n\t}\n\twg.Done()\n}", "title": "" }, { "docid": "bfa46d93d60047a9e51ec1d5be7d5078", "score": "0.48312598", "text": "func expandBucketWebsiteMap(c *Client, f map[string]BucketWebsite, res *Bucket) (map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := make(map[string]interface{})\n\tfor k, item := range f {\n\t\ti, err := expandBucketWebsite(c, &item, res)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif i != nil {\n\t\t\titems[k] = i\n\t\t}\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "e5f3cf64c827098a5a09103e74fba70f", "score": "0.48285392", "text": "func (b *SharedDriveItemRequestBuilder) Site() *SiteRequestBuilder {\n\tbb := &SiteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/site\"\n\treturn bb\n}", "title": "" }, { "docid": "05077f6c3f3e208412ae9ed726c5ba85", "score": "0.48280755", "text": "func writeDestHtmlCatalog(groupArguments groupParameters, fg *geoautogroup.FindGroups, collected []map[string]interface{}, copyPath string, noEmbedImages bool, fileMappings map[string]imageFileMapping) (err error) {\n defer func() {\n if state := recover(); state != nil {\n err = log.Wrap(state.(error))\n }\n }()\n\n // TODO(dustin): !! Finish implementing `noEmbedImages`.\n\n sc := sitebuilder.NewSiteContext(copyPath)\n md := markdowndialect.NewMarkdownDialect()\n\n sb := sitebuilder.NewSiteBuilder(destHtmlCatalogDefaultName, md, sc)\n\n // Create content on root page.\n\n rootNode := sb.Root()\n\n nearestCityIndex := fg.NearestCityIndex()\n\n catalogItems := make([]catalogItem, 0)\n for _, item := range collected {\n groupKey := item[\"group_key\"].(geoautogroup.GroupKey)\n groupedItems := item[\"records\"].([]*geoindex.GeographicRecord)\n\n cityRecord := nearestCityIndex[groupKey.NearestCityKey]\n\n localTimeKey := groupKey.TimeKey.Local()\n\n tzName, _ := localTimeKey.Zone()\n timePhrase := fmt.Sprintf(\"%04d-%02d-%02d %02d:%02d:%02d %s\", localTimeKey.Year(), localTimeKey.Month(), localTimeKey.Day(), localTimeKey.Hour(), localTimeKey.Minute(), localTimeKey.Second(), tzName)\n childPageTitle := fmt.Sprintf(\"%s (%s) %s\", timePhrase, cityRecord.CityAndProvinceState(), groupKey.CameraModel)\n\n navbarTitle := fmt.Sprintf(\"%s (%d)\", childPageTitle, len(groupedItems))\n\n childPageId, err := writeDestHtmlCatalogGroup(rootNode, groupKey, cityRecord, childPageTitle, groupedItems, fileMappings)\n log.PanicIf(err)\n\n catalogLw := sitebuilder.NewLinkWidget(navbarTitle, sitebuilder.NewSitePageLocalResourceLocator(sb, childPageId))\n\n ci := catalogItem{\n groupKey: groupKey,\n linkWidget: catalogLw,\n }\n\n catalogItems = append(catalogItems, ci)\n }\n\n stl := sortableLinks(catalogItems)\n sort.Sort(stl)\n\n catalogLinks := make([]sitebuilder.LinkWidget, len(stl))\n for i, ci := range stl {\n catalogLinks[i] = ci.linkWidget\n }\n\n rootPb := rootNode.Builder()\n\n // Add navbar with page links.\n\n nw := sitebuilder.NewNavbarWidget(catalogLinks)\n\n // TODO(dustin): !! Replace this with a list of descriptions and the first image.\n err = rootPb.AddVerticalNavbar(nw, \"Groups\")\n log.PanicIf(err)\n\n // Render and write.\n\n err = sb.WriteToPath()\n log.PanicIf(err)\n\n return nil\n}", "title": "" }, { "docid": "713e5332707f7f6e0c8e8b84b3ed4ef7", "score": "0.4802189", "text": "func (a *DefaultApiService) CreateSiteMap(ctx _context.Context) ApiCreateSiteMapRequest {\n\treturn ApiCreateSiteMapRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "c11f1a85598deee2fab95a153c898944", "score": "0.4770511", "text": "func (site *SiteMap) getMinimumHeights() map[string]int {\n\n\t//\n\t// We do a breadth-first traversal of the tree, storing the height at which we see each url for the first time\n\t//\n\theights := make(map[string]int)\n\tif len(site.RootPage) == 0 {\n\t\treturn heights\n\t}\n\n\t//\n\t// Note we are using a very simple queue structure here with memory usage equal to number of items pushed\n\t// onto the queue (in this case, the number of pages) rather than the maximum number of elements on the\n\t// queue at any point in time. This could be improved using a ring buffer queue implementation however its\n\t// lifetime is very short.\n\t//\n\tqueue := make(heightQueue, 0)\n\tqueue = append(queue, heightQueueEntry{site.RootPage, 0})\n\tfor len(queue) != 0 {\n\t\tnext := queue[0] // top item from queue\n\t\tqueue = queue[1:] // pop top item\n\n\t\t// get the page details and process the links\n\t\tpage, found := site.Pages[next.url]\n\t\tif !found {\n\t\t\t// This page was never loaded. Could happen if we're only crawling part of the site\n\t\t\tcontinue\n\t\t}\n\n\t\t// store current height for this page\n\t\theights[next.url] = next.height\n\n\t\t//\n\t\t// Add any children we haven't already seen to the end of the queue for processing\n\t\t//\n\t\tnewHeight := next.height + 1\n\t\tfor child := range page.InternalLinks {\n\t\t\tif _, found := heights[child]; !found {\n\t\t\t\tqueue = append(queue, heightQueueEntry{child, newHeight})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn heights\n}", "title": "" }, { "docid": "cc060c387688adb542eec81ad2a01017", "score": "0.47398198", "text": "func (pg *Page) Crawl(siteMap *SiteMap) {\n\n\tif pg.Url == \"\"\t{\n\t\tfmt.Println(\"url is empty\")\n\t\treturn\n\t}\n\n\tif pg.IsCrawled {\n\t\treturn\n\t}\n\n\tdoc, err := goquery.NewDocument(pg.Url)\n\n\tif err != nil \t{\n\t\tlog.Fatal(err)\n\t}\n\tvar userURL = regexp.MustCompile(`.*/community/`)\n\n\tpg.Parse(doc, siteMap)\n\tpg.IsCrawled = true\n\tsiteMap.UrlSet[pg.Url] = *pg\n\n\n\t//can i put this in a seperate logic??\n\tfor _, url2crawl := range(pg.Links)\t{\n\t\t\n\t\t_, isVisited := siteMap.UrlSet[url2crawl]\n\n\t\tchildPage := NewPage(url2crawl)\n\n\t\t//crawl only if the page is not already visited.\n\t\tif ! isVisited && ! userURL.MatchString(url2crawl){\n\t\t\t//Crawl the child page\n\n\t\t\tchildPage.Crawl(siteMap)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bf8a43645279d5fb85db1470268058b9", "score": "0.47381666", "text": "func (c *SafeSiteData) setSiteData(url string, data SiteDataModel) {\n\tc.mu.Lock()\n\t// Lock so only one goroutine at a time can access the map\n\tc.siteData[url] = data\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "3ff1c54c3533d948d626fb4c4291cc02", "score": "0.47262403", "text": "func (a *DefaultApiService) ValidateSiteMap(ctx _context.Context) ApiValidateSiteMapRequest {\n\treturn ApiValidateSiteMapRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "773713f482131d67c40e874ffbf257f9", "score": "0.47224757", "text": "func newSite(mux *http.ServeMux, host string, content, goroot fs.FS) (*web.Site, error) {\n\tfsys := unionFS{content, &hideRootMDFS{&fixSpecsFS{goroot}}}\n\tsite := web.NewSite(fsys)\n\tsite.Funcs(template.FuncMap{\n\t\t\"googleAnalytics\": func() string { return googleAnalytics },\n\t\t\"googleCN\": func() bool { return host == \"golang.google.cn\" },\n\t\t\"gorebuild\": gorebuild.Get,\n\t\t\"json\": jsonUnmarshal,\n\t\t\"newest\": newest,\n\t\t\"now\": func() time.Time { return time.Now() },\n\t\t\"releases\": func() []*history.Major { return history.Majors },\n\t\t\"rfc3339\": parseRFC3339,\n\t\t\"section\": section,\n\t\t\"version\": func() string { return runtime.Version() },\n\t})\n\tdocs, err := pkgdoc.NewServer(fsys, site, googleCN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmux.Handle(host+\"/\", site)\n\tmux.Handle(host+\"/cmd/\", docs)\n\tmux.Handle(host+\"/pkg/\", docs)\n\tmux.Handle(host+\"/doc/codewalk/\", codewalk.NewServer(fsys, site))\n\treturn site, nil\n}", "title": "" }, { "docid": "64aeb4eef11f1c3bf601203c9d27b4e7", "score": "0.47163886", "text": "func getLocations(data map[float64][]dataMap) {\n\tfor _, v1 := range data {\n\t\tfor _, v := range v1 {\n\t\t\tvar s string\n\t\t\ts += strings.ReplaceAll(v.SITE_LATITUDE, \"\\\"\", \"\") + \",\"\n\t\t\ts += strings.ReplaceAll(v.SITE_LONGITUDE, \"\\\"\", \"\") + \",\"\n\t\t\ts += strings.ReplaceAll(strconv.FormatFloat(v.siteId, 'f', -1, 64), \"\\\"\", \"\") + \",\"\n\t\t\ts += strings.ReplaceAll(v.AQS_PARAMETER_DESC, \"\\\"\", \"\") + \",\"\n\t\t\ts += strings.ReplaceAll(v.Site_Name, \"\\\"\", \"\") + \";\"\n\t\t\tif !findElement(siteLocation, s) { // element not found so appending\n\t\t\t\tsiteLocation = append(siteLocation, s)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, v := range siteLocation {\n\t\tfmt.Println(v)\n\t}\n\tfmt.Println(\"JETSTREAM\")\n}", "title": "" }, { "docid": "bf0d280537e73c3eecb8e3a8fa1d5fd7", "score": "0.4715275", "text": "func ResourceURLs(v1 *viper.Viper, mc *minio.Client, headless bool, db *bolt.DB) (map[string][]string, error) {\n\tdomainsMap := make(map[string][]string)\n\tvar repoFatalErrors common.MultiError\n\t// Know whether we are running in diff mode, in order to exclude urls that have already\n\t// been summoned before\n\tmcfg, err := configTypes.ReadSummmonerConfig(v1.Sub(\"summoner\"))\n\tsources, err := configTypes.GetSources(v1)\n\tdomains := configTypes.GetActiveSourceByHeadless(sources, headless)\n\tif err != nil {\n\t\tlog.Error(\"Error getting sources to summon: \", err)\n\t\treturn domainsMap, err // if we can't read list, ok to return an error\n\t}\n\n\tsitemapDomains := configTypes.GetActiveSourceByType(domains, siteMapType)\n\n\tfor _, domain := range sitemapDomains {\n\t\tvar robots *robotstxt.RobotsData\n\t\tvar group *robotstxt.Group\n\n\t\tif v1.Get(\"rude\") == true {\n\t\t\trobots = nil\n\t\t\tgroup = nil\n\t\t\tlog.Info(\"Rude indexing mode enabled; ignoring robots.txt.\")\n\t\t} else {\n\t\t\trobots, err = getRobotsForDomain(domain.Domain)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Error getting robots.txt for \", domain.Name, \", continuing without it.\")\n\t\t\t\trobots = nil\n\t\t\t\tgroup = nil\n\t\t\t}\n\t\t}\n\t\tif robots != nil {\n\t\t\tgroup = robots.FindGroup(EarthCubeAgent)\n\t\t\tlog.Info(\"Got robots.txt group \", group)\n\t\t}\n\t\turls, err := getSitemapURLList(domain.URL, group)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Error getting sitemap urls for: \", domain.Name, err)\n\t\t\trepoFatalErrors = append(repoFatalErrors, err)\n\t\t\t//return domainsMap, err // returning means that domains after broken one do not get indexed.\n\t\t}\n\t\tif mcfg.Mode == \"diff\" {\n\t\t\turls = excludeAlreadySummoned(domain.Name, urls, db)\n\t\t}\n\t\toverrideCrawlDelayFromRobots(v1, domain.Name, mcfg.Delay, group)\n\t\tdomainsMap[domain.Name] = urls\n\t\tlog.Debug(domain.Name, \"sitemap size is :\", len(domainsMap[domain.Name]), \" mode: \", mcfg.Mode)\n\t}\n\n\trobotsDomains := configTypes.GetActiveSourceByType(domains, robotsType)\n\n\tfor _, domain := range robotsDomains {\n\n\t\tvar urls []string\n\t\t// first, get the robots file and parse it\n\t\trobots, err := getRobotsTxt(domain.URL)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Error getting sitemap location from robots.txt for: \", domain.Name, err)\n\t\t\trepoFatalErrors = append(repoFatalErrors, err)\n\t\t\t//return domainsMap, err // returning means that domains after broken one do not get indexed.\n\t\t}\n\t\tgroup := robots.FindGroup(EarthCubeAgent)\n\t\tlog.Debug(\"Found user agent group \", group)\n\t\tfor _, sitemap := range robots.Sitemaps {\n\t\t\tsitemapUrls, err := getSitemapURLList(sitemap, group)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Error getting sitemap urls for: \", domain.Name, err)\n\t\t\t\trepoFatalErrors = append(repoFatalErrors, err)\n\t\t\t\t//return domainsMap, err // returning means that domains after broken one do not get indexed.\n\t\t\t}\n\t\t\turls = append(urls, sitemapUrls...)\n\t\t}\n\t\tif mcfg.Mode == \"diff\" {\n\t\t\turls = excludeAlreadySummoned(domain.Name, urls, db)\n\t\t}\n\t\toverrideCrawlDelayFromRobots(v1, domain.Name, mcfg.Delay, group)\n\t\tdomainsMap[domain.Name] = urls\n\t\tlog.Debug(domain.Name, \"sitemap size from robots.txt is : \", len(domainsMap[domain.Name]), \" mode: \", mcfg.Mode)\n\t}\n\tif len(repoFatalErrors) == 0 {\n\t\treturn domainsMap, nil\n\t} else {\n\t\treturn domainsMap, repoFatalErrors\n\t}\n\n}", "title": "" }, { "docid": "7bf2cf23295b935cd54a64266f632921", "score": "0.46997097", "text": "func createSiteIndex(sites []site) map[string]*site {\n\tsiteIndex := make(map[string]*site)\n\tfor i, site := range sites {\n\t\tsiteIndex[site.Name] = &sites[i]\n\t}\n\treturn siteIndex\n}", "title": "" }, { "docid": "d0aa67e5bf0ade3a41746be279a23425", "score": "0.46946254", "text": "func WriteMap(seed string, urls []string, urlMaps *URLMaps) {\n\turlMaps.mtx.Lock()\n\turlMaps.CheckedURLs[seed] = urls\n\turlMaps.mtx.Unlock()\n}", "title": "" }, { "docid": "4003159d66c344887d993644cb218903", "score": "0.46916103", "text": "func (sp *Spider) Crawl(urlTask UrlTask) {\n\tdefer sp.Wg.Done()\n\n\tu, err := url.Parse(urlTask.Url)\n\tif err != nil {\n\t\tlog.Logger.Error(\"url is invaild:%+v\", err)\n\t\treturn\n\t}\n\n\t//same host,set Interval\n\tfor {\n\t\ttimestamp, ok := sp.HostCache.Get(u.Host)\n\t\tif !ok || (time.Now().Unix()-timestamp > sp.Conf.CrawlInterval) {\n\t\t\tsp.HostCache.Put(u.Host, time.Now().Unix())\n\t\t\tbreak\n\t\t} else {\n\t\t\ttime.Sleep(time.Duration(sp.Conf.CrawlInterval) * time.Second)\n\t\t}\n\t}\n\t//get page content\n\tdata, err := sp.HttpRequest(urlTask)\n\tif err != nil {\n\t\tlog.Logger.Error(\"get page data err:%+v\", err)\n\t\treturn\n\t}\n\n\t//save page data to file\n\terr = sp.SaveData(urlTask.Url, data)\n\tif err != nil {\n\t\tlog.Logger.Error(\"save data to file err:%+v\", err)\n\t\treturn\n\t}\n\n\t//parse page,get valid url\n\turls := ParsePage(urlTask.Url, data)\n\tvar taskUrl []string\n\tfor _, url := range urls {\n\t\tmatch := regexp.MustCompile(sp.Conf.TargetUrl).MatchString(url)\n\t\tif !match {\n\t\t\tlog.Logger.Warn(\"url:%s is not match given targetUrl:%s\", urlTask.Url, sp.Conf.TargetUrl)\n\t\t}\n\t\ttaskUrl = append(taskUrl, url)\n\t}\n\n\t//append to tasks chan\n\tfor _, url := range taskUrl {\n\t\t_, ok := sp.TaskCache.Get(url)\n\t\tif ok {\n\t\t\tlog.Logger.Info(\"url has exist:%s\", url)\n\t\t\tcontinue\n\t\t}\n\t\tvar task UrlTask\n\t\ttask.Url = url\n\t\ttask.Depth = urlTask.Depth + 1\n\t\tif task.Depth > sp.Conf.MaxDepth {\n\t\t\tlog.Logger.Info(\"url:%s has reach max depth\", url)\n\t\t\tbreak\n\t\t}\n\t\t//add first,async push\n\t\tsp.AddTask(task)\n\t}\n\tlog.Logger.Info(\"url:%s parse finished\", urlTask.Url)\n\treturn\n}", "title": "" }, { "docid": "4dd5a2457b92d504f92d6aebcee0ec10", "score": "0.46912166", "text": "func (a *DefaultApiService) UpdateSiteMap(ctx _context.Context, mapId int32) ApiUpdateSiteMapRequest {\n\treturn ApiUpdateSiteMapRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmapId: mapId,\n\t}\n}", "title": "" }, { "docid": "e1e2aca067af93ad913b36bb34b359fe", "score": "0.46838456", "text": "func (s *Spider) Scrape() {\n\tsitesToScrape := s.ToScrape.Site\n\tch := make(chan miniChan, len(sitesToScrape))\n\tfor _, st := range sitesToScrape {\n\t\tgo Scrape(st, ch) // WARNING:给的是值,协程中也只能传值\n\t}\n\tfor i := 0; i < len(sitesToScrape); i++ {\n\t\t<-ch\n\t}\n}", "title": "" }, { "docid": "0112b7d06c9b582c52d313523a7ae2f7", "score": "0.4672526", "text": "func (a *DefaultApiService) UpdateSiteMapContent(ctx _context.Context, mapId int32) ApiUpdateSiteMapContentRequest {\n\treturn ApiUpdateSiteMapContentRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmapId: mapId,\n\t}\n}", "title": "" }, { "docid": "88c826b9267fb14457ef1bb9292c1fde", "score": "0.46394557", "text": "func Parse(r io.Reader) (*Sitemap, error) {\n\tvar u Sitemap\n\terr := xml.NewDecoder(r).Decode(&u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &u, nil\n}", "title": "" }, { "docid": "444c375d271b228b4c1f9c1e9fdc7ba3", "score": "0.46340436", "text": "func CrawlAndProcessPage(url string, outChan chan map[string]int, wg *sync.WaitGroup, maxGoRoutinesChan chan struct{}, elem, uElem, bElem string, retryTimes int) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Printf(\"Goroutine panic: fetching %v : %v\\n\", url, err)\n\t\t}\n\t}()\n\n\tvar ungzipData *gzip.Reader\n\terr := try.Do(func(attempt int) (retry bool, err error) {\n\t\tretry = attempt < retryTimes\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\terr = fmt.Errorf(\"panic: %v\", r)\n\t\t\t}\n\t\t}()\n\n\t\tif attempt > 1 {\n\t\t\tlog.Println(utils.Fatal(attempt), \"time, crawling URL:\", utils.Info(url))\n\t\t} else {\n\t\t\tlog.Println(utils.Warning(attempt), \"time, crawling URL:\", utils.Info(url))\n\t\t}\n\n\t\tungzipData, err = crawler.Crawl(url, \"https://zh.greatfire.org\")\n\t\tutils.CheckError(err)\n\t\treturn\n\t})\n\tutils.CheckError(err)\n\tdefer ungzipData.Close()\n\n\tparser.HTMLParser(outChan, ungzipData, elem, uElem, bElem)\n\n\t// Decrement the counter when the goroutine completes\n\tdefer wg.Done()\n\t// Indicate that there is one free space in goroutine list\n\t<-maxGoRoutinesChan\n}", "title": "" }, { "docid": "2987dccc8dcd1c4cb9390353c9ed267b", "score": "0.46302083", "text": "func DoCrawler() chromedp.Tasks {\n\tfmt.Println(\"DoCrawler is begin!\")\n\tdefer func(){\n\t\tfmt.Println(\"DoCrawler is success!\")\n\t}()\n\treturn chromedp.Tasks{\n\t\tchromedp.Sleep(1 * time.Second),\n\t\t//wait \"id=from1\" page is view, ByQuery is user DOM select query\n\t\tchromedp.WaitVisible(`#form1`, chromedp.ByQuery),\n\t\tchromedp.Sleep(1 * time.Second),\n\t\tchromedp.Click(`.pagination li:nth-last-child(4) a`, chromedp.ByQuery), //click turn page\n\t\tchromedp.OuterHTML(`tbody`, &res, chromedp.ByQuery), // get tbody label html\n\t}\n}", "title": "" }, { "docid": "bb9a945005b7d52fd5e1b51dd90d0501", "score": "0.46242774", "text": "func makeAppendSite(m *map[string][]*Config, bind string, site *Config) {\n\tvar l []*Config\n\tvar ok bool\n\tif l, ok = (*m)[bind]; !ok {\n\t\tl = make([]*Config, 1)\n\t\tl[0] = site\n\t} else {\n\t\tl = append(l, site)\n\t}\n\t(*m)[bind] = l\n}", "title": "" }, { "docid": "36ad7f92faa4e6c1eb1b18a978f0d1dc", "score": "0.46167514", "text": "func Map(page parser.Page) Page {\n\tvar trackedURLs sync.Map\n\tvar anchors Assets\n\tvar links Assets\n\tvar scripts Assets\n\n\tanchors = appendWhenNotTracked(\"href\", anchors, page.Anchors, &trackedURLs)\n\tlinks = appendWhenNotTracked(\"href\", links, page.Links, &trackedURLs)\n\tscripts = appendWhenNotTracked(\"src\", scripts, page.Scripts, &trackedURLs)\n\n\treturn Page{\n\t\tURL: page.URL,\n\t\tAnchors: anchors,\n\t\tLinks: links,\n\t\tScripts: scripts,\n\t}\n}", "title": "" }, { "docid": "adfa2f2e6ca82638f1fc8bd4345dafe5", "score": "0.46092963", "text": "func Generate() {\n\t// Limpa o diretório\n\tabsPath, _ := filepath.Abs(\"web/sitemaps/\")\n\tos.RemoveAll(absPath)\n\tos.Mkdir(absPath, os.ModePerm)\n\n\tt := time.Now()\n\tlastModify := fmt.Sprintf(\"%d-%02d-%02d\", t.Year(), t.Month(), t.Day())\n\tvar wr *os.File\n\n\t//\n\t// Documentos\n\t//\n\n\tlog.Info.Println(\"Starting Documentos...\")\n\trows, err := db.Instance.Query(\"SELECT `doc_contribuinte_1` as doc_contribuinte FROM iptu WHERE `doc_contribuinte_1` != \\\"\\\" GROUP BY `doc_contribuinte_1` UNION DISTINCT SELECT `doc_contribuinte_2` as doc_contribuinte FROM iptu WHERE `visivel` = 1 AND `doc_contribuinte_2` != \\\"\\\" GROUP BY `doc_contribuinte_2`\")\n\tif err != nil {\n\t\tlog.Error.Printf(\"Failed to query database: %s\", err.Error())\n\t}\n\tdefer rows.Close()\n\tdocs := make([][]string, 0, maxRecordCount)\n\tinnerDocs := make([]string, 0, maxRecordsPerPage)\n\tindex := 0\n\tfor rows.Next() {\n\t\tindex++\n\t\tvar doc string\n\t\trows.Scan(&doc)\n\t\tinnerDocs = append(innerDocs, doc)\n\t\tif index%maxRecordsPerPage == 0 {\n\t\t\tlog.Info.Printf(\"index: %d\\n\", index)\n\t\t\tdocs = append(docs, innerDocs)\n\t\t\tinnerDocs = make([]string, 0, maxRecordsPerPage)\n\t\t}\n\t}\n\ttemplateDocs, err := template.New(\"tplDocs\").Parse(tplDocs)\n\tif err != nil {\n\t\tlog.Error.Println(err.Error())\n\t}\n\tfor index, innerDoc := range docs {\n\t\tabsPath, _ = filepath.Abs(\"web/sitemaps/docs_\" + strconv.Itoa(index) + \".xml.gz\")\n\t\twr, err = os.Create(absPath)\n\t\twrGzip := gzip.NewWriter(wr)\n\t\tif err != nil {\n\t\t\tlog.Error.Println(err.Error())\n\t\t\treturn\n\t\t}\n\t\terr = templateDocs.Execute(wrGzip, Docs{\n\t\t\tLastModify: lastModify,\n\t\t\tDocs: &innerDoc,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Error.Println(err.Error())\n\t\t}\n\t\twrGzip.Close()\n\t\twr.Close()\n\t}\n\n\t//\n\t// Nomes\n\t//\n\n\tlog.Info.Println(\"Starting Nomes...\")\n\trows, err = db.Instance.Query(\"SELECT `nome_contribuinte_1` as nome_contribuinte FROM iptu WHERE `nome_contribuinte_1` != \\\"\\\" GROUP BY `nome_contribuinte_1` UNION DISTINCT SELECT `nome_contribuinte_2` as nome_contribuinte FROM iptu WHERE `visivel` = 1 AND `nome_contribuinte_2` != \\\"\\\" GROUP BY `nome_contribuinte_2`\")\n\tif err != nil {\n\t\tlog.Error.Printf(\"Failed to query database: %s\", err.Error())\n\t}\n\tdefer rows.Close()\n\tnomes := make([][]string, 0, maxRecordCount)\n\tinnerNomes := make([]string, 0, maxRecordsPerPage)\n\tindex = 0\n\tregexWords := regexp.MustCompile(`[^\\w ]+`)\n\tregexWords2 := regexp.MustCompile(`[_]+`)\n\tregexSpaces := regexp.MustCompile(` +`)\n\tfor rows.Next() {\n\t\tindex++\n\t\tvar nome string\n\t\trows.Scan(&nome)\n\t\tnome = regexWords.ReplaceAllString(nome, \"\")\n\t\tnome = regexWords2.ReplaceAllString(nome, \" \")\n\t\tnome = regexSpaces.ReplaceAllString(nome, \"-\")\n\t\tinnerNomes = append(innerNomes, nome)\n\t\tif index%maxRecordsPerPage == 0 {\n\t\t\tlog.Info.Printf(\"index: %d\\n\", index)\n\t\t\tnomes = append(nomes, innerNomes)\n\t\t\tinnerNomes = make([]string, 0, maxRecordsPerPage)\n\t\t}\n\t}\n\ttemplateNomes, err := template.New(\"tplNomes\").Parse(tplNomes)\n\tif err != nil {\n\t\tlog.Error.Println(err.Error())\n\t}\n\tfor index, innerNomes := range nomes {\n\t\tabsPath, _ = filepath.Abs(\"web/sitemaps/nomes_\" + strconv.Itoa(index) + \".xml.gz\")\n\t\twr, err = os.Create(absPath)\n\t\twrGzip := gzip.NewWriter(wr)\n\t\tif err != nil {\n\t\t\tlog.Error.Println(err.Error())\n\t\t\treturn\n\t\t}\n\t\terr = templateNomes.Execute(wrGzip, Nomes{\n\t\t\tLastModify: lastModify,\n\t\t\tNomes: &innerNomes,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Error.Println(err.Error())\n\t\t}\n\t\twrGzip.Close()\n\t\twr.Close()\n\t}\n\n\t//\n\t// Sitemap\n\t//\n\n\tlog.Info.Println(\"Starting Sitemap...\")\n\ttemplateSitemap, err := template.New(\"tplSitemaps\").Parse(tplSitemaps)\n\tif err != nil {\n\t\tlog.Error.Println(err.Error())\n\t}\n\tabsPath, _ = filepath.Abs(\"web/sitemaps/sitemap.xml\")\n\twr, err = os.Create(absPath)\n\tif err != nil {\n\t\tlog.Error.Println(err.Error())\n\t\treturn\n\t}\n\tdefer wr.Close()\n\terr = templateSitemap.Execute(wr, Sitemap{\n\t\tLastModify: lastModify,\n\t\tDocs: &docs,\n\t\tNomes: &nomes,\n\t})\n\tif err != nil {\n\t\tlog.Error.Println(err.Error())\n\t}\n\tlog.Info.Println(\"Done!\")\n}", "title": "" }, { "docid": "522d5e6ee44742bb7e75d1bf9e9ed8b8", "score": "0.46004626", "text": "func (r *Router) HandleSitemaps() http.Handler {\n\tsitemapHandler := r.SitemapHandler()\n\tr.Handle(r.Options.ServerPath+`{file:sitemap(index|_\\d+)\\.xml}`, sitemapHandler)\n\treturn sitemapHandler\n}", "title": "" }, { "docid": "05f5dc49cce37b9cc7ec1763f6d47e82", "score": "0.45824882", "text": "func Work( link string, uList chan string, domain *url.URL ) (Page, error) {\n\n t0 := time.Now()\n var page Page\n\n if govalidator.IsURL(link) == false {\n return page, errors.New( fmt.Sprintf(\"Not a url %s.\",link))\n }\n if err:= DomainCheck(domain); err!= nil{\n return page, err\n }\n \n // Make a request \n glog.Info( fmt.Sprintf(\"Requesting to URL %s.\", link ) )\n //timeout := time.Duration( 6 * time.Second)\n //client := http.Client{ Timeout: timeout, } \n resp, err := http.Get(link)\n \n if err != nil {\n\n // Try one more time, but be respectful of websites! Do not send too many requests.\n resp, err = http.Get(link)\n if err != nil {\n glog.Warning( fmt.Sprintf(\"No response from %s. Error is %s. Skipping URL.\\n\", link, err))\n return page, errors.New( fmt.Sprintf(\"No response form %s. Error is %s.\", link, err))\n }\n }\n defer resp.Body.Close()\n \n // If we have an error, log it and return\n if resp.StatusCode != 200 {\n glog.Warning( fmt.Sprintf(\"Bad response from http request to page %s. Error code %d. Skipping URL\\n\", link, resp.StatusCode))\n return page, errors.New( fmt.Sprintf(\"Bad response code from request to page %s. Error code %d.\", link, resp.StatusCode))\n }\n\n // Parse the body of the response\n doc, err := html.Parse( resp.Body )\n if err != nil {\n glog.Warning( fmt.Sprintf(\"Unable to parse html from page %s. Error is %s. Skipping URL.\\n\", link, err))\n return page, errors.New( fmt.Sprintf(\"Unable to parse html of page %s.\", link))\n }\n\n // Search the html structure for links, static assets\n err = CheckNode( doc, uList, domain, &page, t0 )\n page.MyUrl = link\n\n glog.Info( fmt.Sprintf(\"Done crawling link %s\\n\", link))\n if err != nil{ \n return page, errors.New( fmt.Sprintf(\"Error parsing html page %s.\", link))\n } else {\n return page, nil\n }\n}", "title": "" }, { "docid": "5a34fbe7cc79fb8dfe4ba8099464ca49", "score": "0.45821318", "text": "func buildMap(routes []route) map[string]string {\n\n\tm := make(map[string]string)\n\n\tfor _, r := range routes {\n\t\tm[r.Path] = r.URL\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "f679d68b4c2166cd5c267f0ce3741a2c", "score": "0.45539123", "text": "func (c *Controller) BeginMapBuilder() {\n\n\tlookupBuilder := FunctionLookupBuilder{\n\t\tGatewayURL: c.Config.GatewayURL,\n\t\tClient: MakeClient(c.Config.UpstreamTimeout),\n\t\tCredentials: c.Credentials,\n\t}\n\n\tticker := time.NewTicker(c.Config.RebuildInterval)\n\tgo synchronizeLookups(ticker, &lookupBuilder, c.TopicMap)\n}", "title": "" }, { "docid": "e2137e10ef7f5af3357d55bb8fdccb0c", "score": "0.45410678", "text": "func (b *GroupRequestBuilder) Sites() *GroupSitesCollectionRequestBuilder {\n\tbb := &GroupSitesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/sites\"\n\treturn bb\n}", "title": "" }, { "docid": "abe4a902bd8356b82d2dbe8f7fc6b069", "score": "0.45376256", "text": "func BuildMap() (USMap, error) {\n\tfullMap := USMap{}\n\tfullMap.valTop = [5]int{-400, -400, -400, -400, -400}\n\tdata, err := buildWeatherMap()\n\tif err != nil {\n\t\treturn fullMap, err\n\t}\n\tzips, err := makeMap()\n\tif err != nil {\n\t\treturn fullMap, err\n\t}\n\n\tfor x, b := range fullMap.Map {\n\t\tfor y := range b {\n\t\t\tif len(zips[x][y]) > 0 {\n\t\t\t\tfullMap.Map[x][y].City = zips[x][y][0].name\n\t\t\t\tfullMap.Map[x][y].zipcodes = zips[x][y]\n\t\t\t\tfor _, a := range zips[x][y] {\n\t\t\t\t\tif len(a.zipcode) > 0 {\n\t\t\t\t\t\ti, err := strconv.Atoi(a.zipcode)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn fullMap, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfullMap.Map[x][y].ShortZip = append(fullMap.Map[x][y].ShortZip, i)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfullMap.Map[x][y].State = zips[x][y][0].state\n\t\t\t\tfullMap.Map[x][y].Weather = totalWeathertoSmall(data[x][y].Weather)\n\t\t\t\tfullMap = findTopBot(fullMap, x, y, data)\n\t\t\t}\n\t\t}\n\t}\n\treturn fullMap, nil\n}", "title": "" }, { "docid": "f22012e4f45c93e9d6ba576ac23e867b", "score": "0.4525167", "text": "func (c *Crawler) crawl() {\n\tfor {\n\t\tt := <-c.tasks\n\t\tu := t.url\n\t\tuStr := u.String()\n\n\t\tlog.Logger.Info(\"crawl(): start crawling %s\", uStr)\n\n\t\tc.limitFrequency(u.Host)\n\n\t\tfetchRes, err := c.fetcher.Fetch(uStr)\n\t\tif err != nil {\n\t\t\tlog.Logger.Error(\"crawl(): fetch url failed: %s, fetcher.Fetch(): %v\", uStr, err)\n\t\t\tc.taskManager.Done()\n\t\t\tcontinue\n\t\t} else {\n\t\t\t// output to file\n\t\t\terr := c.outputer.OutputFile(url.QueryEscape(uStr), fetchRes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Logger.Warn(\"crawl(): write url: %s to file failed, outputer.Output(): %v\", uStr, err)\n\t\t\t}\n\t\t}\n\n\t\t// parse html\n\t\tr := bytes.NewReader(fetchRes)\n\t\tnode, err := html.Parse(r)\n\t\tif err != nil {\n\t\t\tlog.Logger.Error(\"crawl(): url: %s, html.Parse(): %v\", t.url, err)\n\t\t}\n\n\t\t// get deeper URLs\n\t\tdeeperURLs := []*url.URL{}\n\t\tparser.Parse(node, u, &deeperURLs)\n\n\t\t// add further tasks\n\t\tdepth := t.depth - 1\n\t\tif depth >= 0 && len(deeperURLs) > 0 {\n\t\t\tfor _, url := range deeperURLs {\n\t\t\t\tfurtherTask := task{url, depth}\n\t\t\t\tif _, exist := c.fetchedURL.LoadOrStore(url.String(), true); !exist {\n\t\t\t\t\tc.taskManager.Add(1)\n\t\t\t\t\tgo c.addTask(furtherTask)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tc.taskManager.Done()\n\t}\n}", "title": "" }, { "docid": "3f227cfc3ddbe06d3d25d450793c07dc", "score": "0.45178908", "text": "func (r *RobotsTxt) Sitemaps() []string {\n\treturn r.sitemaps\n}", "title": "" }, { "docid": "e8381f9b851898adcb1abc59b8176783", "score": "0.45155537", "text": "func Scrape(s site, ch chan miniChan) {\n\tdefer func() {\n\t\tch <- getMCElement()\n\t}()\n\tname, url := s.Name, s.URL\n\tc := make(chan miniChan, 1)\n\tgo scrape(name, url, c)\n\t<-c\n}", "title": "" }, { "docid": "67cb6775b39267621ab507e9bc592677", "score": "0.45131472", "text": "func NewGetSitemapByNameRequest(server string, sitemapname string, params *GetSitemapByNameParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"sitemapname\", runtime.ParamLocationPath, sitemapname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := originalURL.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/sitemaps/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params != nil && params.Type != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"type\", runtime.ParamLocationQuery, *params.Type); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := originalURL.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params != nil && params.Jsoncallback != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"jsoncallback\", runtime.ParamLocationQuery, *params.Jsoncallback); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := originalURL.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params != nil && params.IncludeHidden != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"includeHidden\", runtime.ParamLocationQuery, *params.IncludeHidden); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := originalURL.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif params != nil && params.AcceptLanguage != nil {\n\t\tvar headerParam0 string\n\n\t\theaderParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"Accept-Language\", runtime.ParamLocationHeader, *params.AcceptLanguage)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treq.Header.Set(\"Accept-Language\", headerParam0)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "2d30ed86c58d178b07c18cc5db625527", "score": "0.4512515", "text": "func (c *crawler) visit(u string) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.pages[u] = true\n}", "title": "" }, { "docid": "e0810061d4b6d08aa8bfe2cd11216858", "score": "0.45091948", "text": "func (m *EdgeInternetExplorerModeRequestBuilder) SiteLists()(*EdgeInternetExplorerModeSiteListsRequestBuilder) {\n return NewEdgeInternetExplorerModeSiteListsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "1cfac5bad0cd7d5dccb3d8a19f068c8b", "score": "0.45086458", "text": "func newSourcesMap(client *http.Client, srcs []sourceURL) *sourcesMap {\n\treturn &sourcesMap{\n\t\turls: srcs,\n\t\tsourceMap: make(map[string]map[string]map[string]struct{}),\n\t\tetagMap: make(map[string]string),\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "c58e3665d41086fe02ce164e64f3a802", "score": "0.44956598", "text": "func flattenBucketWebsiteMap(c *Client, i interface{}, res *Bucket) map[string]BucketWebsite {\n\ta, ok := i.(map[string]interface{})\n\tif !ok {\n\t\treturn map[string]BucketWebsite{}\n\t}\n\n\tif len(a) == 0 {\n\t\treturn map[string]BucketWebsite{}\n\t}\n\n\titems := make(map[string]BucketWebsite)\n\tfor k, item := range a {\n\t\titems[k] = *flattenBucketWebsite(c, item.(map[string]interface{}), res)\n\t}\n\n\treturn items\n}", "title": "" }, { "docid": "c7f36f0fd9b1b3c39ef2d49f0dceee7e", "score": "0.44876304", "text": "func (a *DefaultApiService) CreateSiteMapExecute(r ApiCreateSiteMapRequest) (SiteMapReadDetailed, *_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 SiteMapReadDetailed\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.CreateSiteMap\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/site-maps\"\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{\"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\tif r.metadata != nil {\n\t\tparamJson, err := parameterToJson(*r.metadata)\n\t\tif err != nil {\n\t\t\treturn localVarReturnValue, nil, err\n\t\t}\n\t\tlocalVarFormParams.Add(\"metadata\", paramJson)\n\t}\n\tif r.config != nil {\n\t\tlocalVarFormParams.Add(\"config\", parameterToString(*r.config, \"\"))\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": "a3e17353173cf01b21d0abd0f43b2c67", "score": "0.44831336", "text": "func (h *goqueryParser) Parse(ctx context.Context, site *types.Site) (err error) {\n\n\t// Local visited urls\n\tseenURLs := make(map[string]struct{})\n\n\tretry := types.RetryingClient{\n\t\tClient: h.client,\n\t\tMaxAttempts: 2,\n\t}\n\n\t// Get Page from URL\n\tresp, err := retry.Get(site.URL.String())\n\tif err != nil {\n\t\t// Logged in the caller function\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\t// Create a goquery document from the HTTP response\n\tdocument, err := goquery.NewDocumentFromReader(resp.Body)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"Error\": err,\n\t\t\t\"URL\": site.URL.String()}).Error(cerror.ErrCreateDocumentFailed)\n\t\treturn err\n\t}\n\n\t// Parse page to get links\n\tdocument.Find(\"a\").Each(func(index int, element *goquery.Selection) {\n\t\t// Check whther the href attribute exists on the element or not\n\t\thref, exists := element.Attr(\"href\")\n\t\tif exists {\n\t\t\ttempURL, err := utils.Parse(href)\n\t\t\tif err != nil {\n\t\t\t\t// Debug logs\n\t\t\t\tlog.WithFields(log.Fields{\"Error\": err,\n\t\t\t\t\t\"URL\": href}).Debug(\"Failed to parse href\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tchildURL := utils.ResolveURL(tempURL, site.URL)\n\n\t\t\tif childURL.Host != site.URL.Host {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif _, ok := seenURLs[childURL.String()]; ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Storing the URL as seen URL\n\t\t\tseenURLs[childURL.String()] = struct{}{}\n\n\t\t\ttempSite := types.Site{URL: childURL}\n\t\t\tsite.Links = append(site.Links, &tempSite)\n\t\t}\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "68517037c2cc2c13028033d09ba96cac", "score": "0.44673795", "text": "func generateSite() error {\n\t// First compile the template(s)\n\tif err := compileTemplates(); err != nil {\n\t\treturn err\n\t}\n\t// Now read the posts\n\tfis, err := ioutil.ReadDir(PostsDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Remove directories from the list, keep only .md files\n\tfis = filter(fis)\n\t// Get all posts.\n\tall, recent := getPosts(fis)\n\t// Delete current public directory files\n\tif err := clearPublicDir(); err != nil {\n\t\treturn err\n\t}\n\t// Generate the static files\n\tindex := siteIndex(all)\n\tfor i, p := range all {\n\t\tif err := generateFile(p, i == index); err != nil {\n\t\t\tfmt.Printf(\"DEBUG: template %v genration failed (%v)\\n\", p.D[\"Slug\"], err)\n\t\t}\n\t}\n\t// Generate the RSS feed\n\treturn generateRss(recent)\n}", "title": "" }, { "docid": "dcc33ca23934187db504c9c64bb575a4", "score": "0.44620955", "text": "func Issm(nam string) bool {\n\treturn nam == \"SITEMAP.sitemap\"\n}", "title": "" }, { "docid": "970a31b1fd3819e54b7ed3fdc6eda8ac", "score": "0.44588977", "text": "func (wm *WebsiteManager) Run(statsConfigs []*common.StatConfig) {\n\n\tfor _, sConf := range statsConfigs {\n\t\twStats := stats.NewWebsiteStats(wm.monitor.WebsiteConfig.Url, sConf.TimeFrameDuration)\n\t\twm.WebsiteStatsMap[sConf.String()] = wStats\n\t}\n\n\tgo wm.processWebsiteMeasures()\n\tgo wm.monitor.PeriodicallyMonitorWebsite()\n}", "title": "" }, { "docid": "5923ac614b33d109ec47ccd43962635b", "score": "0.44581342", "text": "func (a *DefaultApiService) ListSiteMapsExecute(r ApiListSiteMapsRequest) (SiteMapCollection, *_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 SiteMapCollection\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.ListSiteMaps\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/site-maps\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.view != nil {\n\t\tlocalVarQueryParams.Add(\"view\", parameterToString(*r.view, \"\"))\n\t}\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.sortBy != nil {\n\t\tlocalVarQueryParams.Add(\"sortBy\", parameterToString(*r.sortBy, \"\"))\n\t}\n\tif r.pageNumber != nil {\n\t\tlocalVarQueryParams.Add(\"pageNumber\", parameterToString(*r.pageNumber, \"\"))\n\t}\n\tif r.pageSize != nil {\n\t\tlocalVarQueryParams.Add(\"pageSize\", parameterToString(*r.pageSize, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\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": "0ef44586f6f9b6479f148d2a24d8d410", "score": "0.4457759", "text": "func NewStaticSpritemap(s *Sprite) *StaticMap {\n\treturn &StaticMap{s}\n}", "title": "" }, { "docid": "7e8765787fe25b44fc4ce835922842c9", "score": "0.44524884", "text": "func (e *GoogleSearch) Site(site string) *GoogleSearch {\n\te.tags = append(e.tags, e.join(siteTag, site, false))\n\treturn e\n}", "title": "" }, { "docid": "19366e03ad1b79299b42474fb94d2329", "score": "0.44519907", "text": "func WithSitemap(startURL string) Configurator {\n\tsitemaps := sitemap.New(startURL)\n\treturn func(app *Application) {\n\t\tvar defaultLang string\n\t\tif tags := app.I18n.Tags(); len(tags) > 0 {\n\t\t\tdefaultLang = tags[0].String()\n\t\t\tsitemaps.DefaultLang(defaultLang)\n\t\t}\n\n\t\tfor _, r := range app.GetRoutes() {\n\t\t\tif !r.IsStatic() || r.Subdomain != \"\" || !r.IsOnline() || r.NoSitemap {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tloc := r.StaticPath()\n\t\t\tvar translatedLinks []sitemap.Link\n\n\t\t\tfor _, tag := range app.I18n.Tags() {\n\t\t\t\tlang := tag.String()\n\t\t\t\tlangPath := lang\n\t\t\t\thref := \"\"\n\t\t\t\tif lang == defaultLang {\n\t\t\t\t\t// http://domain.com/en-US/path to just http://domain.com/path if en-US is the default language.\n\t\t\t\t\tlangPath = \"\"\n\t\t\t\t}\n\n\t\t\t\tif app.I18n.PathRedirect {\n\t\t\t\t\t// then use the path prefix.\n\t\t\t\t\t// e.g. http://domain.com/el-GR/path\n\t\t\t\t\tif langPath == \"\" { // fix double slashes http://domain.com// when self-included default language.\n\t\t\t\t\t\thref = loc\n\t\t\t\t\t} else {\n\t\t\t\t\t\thref = \"/\" + langPath + loc\n\t\t\t\t\t}\n\t\t\t\t} else if app.I18n.Subdomain {\n\t\t\t\t\t// then use the subdomain.\n\t\t\t\t\t// e.g. http://el.domain.com/path\n\t\t\t\t\tscheme := netutil.ResolveSchemeFromVHost(startURL)\n\t\t\t\t\thost := strings.TrimLeft(startURL, scheme)\n\t\t\t\t\tif langPath != \"\" {\n\t\t\t\t\t\thref = scheme + strings.Split(langPath, \"-\")[0] + \".\" + host + loc\n\t\t\t\t\t} else {\n\t\t\t\t\t\thref = loc\n\t\t\t\t\t}\n\n\t\t\t\t} else if p := app.I18n.URLParameter; p != \"\" {\n\t\t\t\t\t// then use the URL parameter.\n\t\t\t\t\t// e.g. http://domain.com/path?lang=el-GR\n\t\t\t\t\thref = loc + \"?\" + p + \"=\" + lang\n\t\t\t\t} else {\n\t\t\t\t\t// then skip it, we can't generate the link at this state.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\ttranslatedLinks = append(translatedLinks, sitemap.Link{\n\t\t\t\t\tRel: \"alternate\",\n\t\t\t\t\tHreflang: lang,\n\t\t\t\t\tHref: href,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tsitemaps.URL(sitemap.URL{\n\t\t\t\tLoc: loc,\n\t\t\t\tLastMod: r.LastMod,\n\t\t\t\tChangeFreq: r.ChangeFreq,\n\t\t\t\tPriority: r.Priority,\n\t\t\t\tLinks: translatedLinks,\n\t\t\t})\n\t\t}\n\n\t\tfor _, s := range sitemaps.Build() {\n\t\t\tcontentCopy := make([]byte, len(s.Content))\n\t\t\tcopy(contentCopy, s.Content)\n\n\t\t\thandler := func(ctx Context) {\n\t\t\t\tctx.ContentType(context.ContentXMLHeaderValue)\n\t\t\t\tctx.Write(contentCopy) // nolint:errcheck\n\t\t\t}\n\t\t\tif app.builded {\n\t\t\t\troutes := app.CreateRoutes([]string{MethodGet, MethodHead, MethodOptions}, s.Path, handler)\n\n\t\t\t\tfor _, r := range routes {\n\t\t\t\t\tif err := app.Router.AddRouteUnsafe(r); err != nil {\n\t\t\t\t\t\tapp.Logger().Errorf(\"sitemap route: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tapp.HandleMany(\"GET HEAD OPTIONS\", s.Path, handler)\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e718cecdee5932a81359cd1eecf60a75", "score": "0.4450407", "text": "func (a *DefaultApiService) ListSiteMaps(ctx _context.Context) ApiListSiteMapsRequest {\n\treturn ApiListSiteMapsRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "d9a35aa51e99db7d124a74ef6ab9981d", "score": "0.44273117", "text": "func (s *SitemapGroup) Clear() {\n\ts.urls = []URL{}\n}", "title": "" }, { "docid": "60f3fe138aafaad5728f14bcb2d68a36", "score": "0.44250932", "text": "func main() {\n\tp := NewPocket()\n\n\tfor i, site := range sites {\n\t\tif !site.Handle {\n\t\t\tfmt.Printf(\"%3d: [skip] %s\\n\", i+1, site.URL)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(\"Started:\", site.URL)\n\t\tif site.Handler2 == nil {\n\t\t\tpanic(fmt.Sprintf(\"missing handler for site: %s\\n\", site.URL))\n\t\t}\n\t\tsite.Handler2(site.URL, p)\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "6f60800efff2ee2c99981d22f2e5d8ad", "score": "0.4424497", "text": "func (w *worker) Process(s Site) Site {\n\tif w.loadArchive {\n\t\tw.lockArchive.Lock()\n\n\t\tarchive := ArchiveClient{w.client}\n\t\t// The auction ended in Jan 2006, so we fetch archives after Feb\n\t\tresults, err := archive.History(s.Href, Param{\"limit\", \"1\"}, Param{\"from\", \"200602\"})\n\t\tarch := &Archive{}\n\t\tif err != nil {\n\t\t\tarch.Error = err.Error()\n\t\t\tlog.Printf(\"archive error: %s\", err)\n\t\t} else if len(results) > 0 {\n\t\t\tarch.ArchiveResult = &results[0]\n\t\t} else {\n\t\t\tarch = nil\n\t\t}\n\t\ts.Archive = arch\n\n\t\tgo func() {\n\t\t\t// Archve.org gets upset if we hammer too aggressively\n\t\t\ttime.Sleep(time.Millisecond * 150)\n\t\t\tw.lockArchive.Unlock()\n\t\t}()\n\t}\n\n\tresp, err := w.client.Get(s.Href)\n\tif err != nil {\n\t\ts.Response.Error = err.Error()\n\t\treturn s\n\t}\n\tdefer resp.Body.Close()\n\n\t// Fill in the response\n\ts.Response.Status = resp.StatusCode\n\tif resp.ContentLength >= 0 {\n\t\ts.Response.Size = resp.ContentLength\n\t}\n\n\t// Is it a redirect?\n\turl := resp.Request.URL.String()\n\tif url != s.Href {\n\t\ts.Response.Redirected = url\n\t}\n\n\t// What's in the body?\n\treadcount := &CountingReader{Reader: resp.Body}\n\tparsed := ParseHTML(readcount)\n\ts.Response.Title = parsed.Title\n\ts.Response.Squatter = parsed.MentionsDomain\n\n\t// Should we try to guess the content size?\n\tif s.Response.Redirected == \"\" && s.Response.Size == 0 {\n\t\t// Consume the body until completion to measure the body\n\t\tfor {\n\t\t\tif _, err := readcount.Read(nil); err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif readcount.Count() > maxReadSize {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\ts.Response.Size = int64(readcount.Count())\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "2cd5af8806c29dcd2cf9a4287afa3ac5", "score": "0.44170845", "text": "func (e *Engine) CrawlSite(site string) (models.Site, error) {\n\tsiteURL, err := url.ParseRequestURI(site)\n\n\tif err != nil {\n\t\treturn models.Site{}, err\n\t}\n\n\tpagesToBeCrawled := []string{}\n\tcrawledPages := map[string]struct{}{}\n\n\tpagesToBeCrawled = append(pagesToBeCrawled, site)\n\n\treturnPages := []models.Page{}\n\n\tfor i := 0; i < e.crawlingDeph; i++ {\n\t\tparsedPages := crawlPages(pagesToBeCrawled)\n\n\t\tfor _, page := range pagesToBeCrawled {\n\t\t\tcrawledPages[page] = struct{}{}\n\t\t}\n\n\t\tpagesToBeCrawled = pagesToBeCrawled[:0]\n\n\t\tfor _, page := range parsedPages {\n\t\t\treturnPages = append(returnPages, page.page)\n\n\t\t\tfilterLinks(siteURL, &crawledPages, &page.links)\n\t\t\tfor link := range page.links {\n\t\t\t\tpagesToBeCrawled = append(pagesToBeCrawled, link)\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn models.Site{Address: site, Pages: returnPages}, nil\n}", "title": "" }, { "docid": "1e82d0adae4033711871c2ea7d1a5bc0", "score": "0.44100323", "text": "func CheckNode( n *html.Node, uList chan string, domain *url.URL, page *Page, t0 time.Time) error {\n \n if n == nil {\n return nil \n }\n if page == nil{\n return errors.New(\"Bad page struct pointer.\")\n }\n if err:= DomainCheck(domain); err!= nil{\n return err\n }\n\n // Search for links, images, scripts\n if n.Type == html.ElementNode && ( n.Data == \"a\" || n.Data == \"img\" || n.Data == \"link\" || n.Data == \"script\") { \n\n\n // Iterate through the attributes of each html element node\n for _, a := range n.Attr { \n if time.Since(t0) >= time.Duration(5)*time.Second{ return errors.New(\"Timeout\")}\n\n // Record sources of images, links, and scripts\n if a.Key == \"src\" {\n page.Assets = append( page.Assets, a.Val )\n break\n }\n\n // Record new URLs found, and send them back to the parent crawler\n if a.Key == \"href\" { \n // If we can't parse the URL and find the domain, skip this URL, since we can't understand it\n str := a.Val\n if len(a.Val) >0 && a.Val[0] == '.' {\n str = str[1:]\n }\n u,err := url.Parse( str )\n if err != nil {\n continue\n }\n\n if u.Host == \"\" {\n u.Host = domain.Host\n }\n if u.Scheme == \"javascript\" {\n page.Assets = append( page.Assets, a.Val )\n break\n }\n if strings.Contains(u.String(), \".png\") || strings.Contains(u.String(), \".jpg\")|| strings.Contains(u.String(), \".ico\") || strings.Contains(u.String(), \".css\") {\n page.Assets = append( page.Assets, a.Val )\n break\n }\n\n // Check to see if the discovered URL is within the original domain\n if (u.Host == domain.Host || u.Host == domain.Path) && strings.Contains(u.String(), \"mailto\") == false {\n url := a.Val\n\n // Check to see if the URL is absolute, if not, specify a scheme\n if u.IsAbs() == false {\n u.Scheme = domain.Scheme\n url = u.String()\n }\n\n // Record this info in the Page, send to crawler with URL channel\n page.BabyUrls = append( page.BabyUrls, url )\n select{ \n case <-time.After(2*time.Second):\n return errors.New(\"Timeout waiting for write to channel\") \n case uList <- url:\n }\n }\n break\n }\n }\n }\n\n // Recursively iterate over all nodes in the html parse tree\n for c := n.FirstChild; c != nil; c = c.NextSibling { \n err := CheckNode(c, uList, domain, page, t0)\n if err != nil { return err}\n }\n return nil\n}", "title": "" }, { "docid": "56a6213c97dfbce85f6a9d7ea90ef38c", "score": "0.44023153", "text": "func buildMapfromYAML(pathUrls []pathURLYAML) map[string]string {\n\tpathsToURLs := make(map[string]string)\n\tfor _, u := range pathUrls {\n\t\tpathsToURLs[u.Path] = u.URL\n\t}\n\n\treturn pathsToURLs\n}", "title": "" }, { "docid": "700722e54874422cf915894410fa0152", "score": "0.43941587", "text": "func (a *DefaultApiService) ReadSiteMap(ctx _context.Context, mapId int32) ApiReadSiteMapRequest {\n\treturn ApiReadSiteMapRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmapId: mapId,\n\t}\n}", "title": "" }, { "docid": "a46a831dc3a8d7fece9f9459ed8ea934", "score": "0.43793723", "text": "func (m *Manager) Do(site, path, version string, w http.ResponseWriter, req *http.Request) {\r\n\r\n}", "title": "" }, { "docid": "29d1b2a3868af85f86ce3acea684be2c", "score": "0.43627247", "text": "func MapCollection(pages []parser.Page, instr *instrumentator.Instr) []Page {\n\tvar wg sync.WaitGroup\n\tvar mappedPages []Page\n\n\t// dynamically determine the worker pool size, we'll either set a default or\n\t// use a smaller value if the number of tasks is smaller than the default.\n\ttoProcess := len(pages)\n\tworkerPool := defaultWorkerPool\n\tif toProcess < defaultWorkerPool {\n\t\tworkerPool = toProcess\n\t}\n\n\tstartTime := time.Now()\n\ttasks := make(chan parser.Page, workerPool)\n\n\t// spin up our worker pool as goroutines awaiting tasks to be processed\n\tfor i := 0; i < workerPool; i++ {\n\t\twg.Add(1)\n\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\n\t\t\tfor page := range tasks {\n\t\t\t\tmappedPage := Map(page)\n\n\t\t\t\t// we use a mutex to ensure thread safety, not only for the correctness\n\t\t\t\t// of the program but also because the Go language can trigger a panic!\n\t\t\t\tmutex.Lock()\n\t\t\t\tmappedPages = append(mappedPages, mappedPage)\n\t\t\t\tmutex.Unlock()\n\t\t\t}\n\t\t}(i)\n\t}\n\n\tfor _, page := range pages {\n\t\ttasks <- page\n\t}\n\n\tclose(tasks)\n\n\twg.Wait()\n\tinstr.Logger.Debug(\"time spent mapping:\", time.Since(startTime))\n\n\treturn mappedPages\n}", "title": "" }, { "docid": "569c26bfd8cd0d52734831ddc6d82cc3", "score": "0.43581873", "text": "func homeHandler(w http.ResponseWriter, r *http.Request) {\n\t// Response defines the data structure for the web UI\n\ttype Response struct {\n\t\t// Success is used to maintain application state\n\t\tSuccess bool\n\t\tLeafyUrl string\n\t\tLongUrl string\n\t\tAppUrl string\n\t}\n\n\tlog.Println(\"WEB: Home page served\")\n\n\tif r.Method != http.MethodPost {\n\t\ttmpl.Execute(w, nil)\n\t\treturn\n\t}\n\n\tlongUrl := r.FormValue(\"longUrl\")\n\tlongUrlLower := strings.ToLower(longUrl)\n\n\tif !strings.Contains(longUrlLower, \"https://\") && !strings.Contains(longUrlLower, \"http://\") {\n\t\tlongUrl = fmt.Sprintf(\"%s%s\", \"http://\", longUrl)\n\t}\n\n\t// Mapping key is computed based on the first six characters of the longUrl MD5 hash\n\tnewMappingKey := urlHash(longUrl)\n\n\t// Mapping data structure is assembled prior to being loaded into Atlas\n\tnewMapping := Mapping{\n\t\tCreateDate: time.Now(),\n\t\tKey: newMappingKey,\n\t\tRedirect: longUrl,\n\t\tLeafyUrl: os.Getenv(\"APP_URL\") + \"/\" + newMappingKey,\n\t\tUseCount: 0,\n\t}\n\n\tcheckMapping := retrieveMappingByKey(newMapping.Key)\n\n\t// Instantiate a Response specific to the event being handled\n\tmappingResponse := Response{\n\t\tSuccess: true,\n\t\tLeafyUrl: newMapping.LeafyUrl,\n\t\tLongUrl: longUrl,\n\t\tAppUrl: os.Getenv(\"APP_URL\"),\n\t}\n\n\t// Switch statement to determine if there are duplicates\n\tswitch checkMapping.Redirect {\n\n\t// Case 1: Identical mapping already exists\n\tcase newMapping.Redirect:\n\t\tmappingResponse.Success = true\n\n\t\tlog.Printf(\"WEB: Attempted creation for %s but a matching mapping was found with key %s\",\n\t\t\tnewMapping.Redirect, newMapping.Key)\n\n\t\t// Identical mapping is returned to the user\n\t\tw.WriteHeader(http.StatusOK)\n\t\ttmpl.Execute(w, mappingResponse)\n\n\t// Case 2: No duplicate is found\n\tcase \"\":\n\t\tmappingResponse.Success = true\n\n\t\t// Mapping is inserted into the database\n\t\tinsertMapping(newMapping)\n\t\tw.WriteHeader(http.StatusCreated)\n\t\ttmpl.Execute(w, mappingResponse)\n\n\t// Case 3: Catch all, but mostly to catch if a Mapping exists with the same key, but different Redirect\n\t// This can occur because the first 6 chars of the MD5 hash of two different longUrls could be the same\n\tdefault:\n\t\tvar (\n\t\t\thashCounter int\n\t\t\toriginalHashKey string\n\t\t)\n\n\t\tmappingResponse.Success = true\n\n\t\t// A new hash is computed by hashing the existing hash\n\t\t// This repeats until a new unique hash is computed\n\t\t// Once this is done, the newly computed hash replaces the original key\n\t\toriginalHashKey = newMapping.Key\n\t\tfor retrieveMappingByKey(newMapping.Key).Redirect != \"\" {\n\t\t\tnewMapping.Key = urlHash(newMapping.Key)\n\t\t\thashCounter++\n\t\t}\n\n\t\tlog.Printf(\"WEB: Namespace collision occurred:\\nOriginal: key %s / longUrl %s\\nRehashed: key %s / longUrl %s / hash iterations %v\",\n\t\t\toriginalHashKey, newMapping.Redirect, newMapping.Key, newMapping.Redirect, hashCounter)\n\n\t\t// Mapping is inserted into the database\n\t\tinsertMapping(newMapping)\n\t\tw.WriteHeader(http.StatusCreated)\n\t\ttmpl.Execute(w, mappingResponse)\n\t}\n\n}", "title": "" }, { "docid": "be6b10beaa2728090395479759cf4439", "score": "0.43375328", "text": "func main() {\n\tvar queue GameResources.Queue\n\tvar newMap [][]GameResources.GameTile\n\tvar blueRobot GameResources.Robot\n\tvar redRobot GameResources.Robot\n\tvar yellowRobot GameResources.Robot\n\tvar greenRobot GameResources.Robot\n\tvar GameDataInstance = GameUI.GetGameMapDataSingleton()\n\tnodesInstance := GameResources.GetNodesSingleton()\n\tInitMapTile(&newMap)\n\tSetWall(newMap)\n\tSetDestination(newMap)\n\tSetDefaultRobot(newMap, &blueRobot, &redRobot, &yellowRobot, &greenRobot)\n\n\tvar startNode = GameResources.Node{0, blueRobot, redRobot, yellowRobot, greenRobot, newMap, nil, \"\", \"\"}\n\t// nodesInstance.CurrNode = startNode\n\tnodesInstance.SetCurrNode(startNode)\n\t// GameResources.CURR_NODE = startNode\n\tMakeGameMap(startNode, newMap, &queue)\n\t// ShowNodeState(startNode)\n\t// startNode.ShowNodeState()\n\tGameUI.ShowNodeState(&startNode)\n\n\tGameDataInstance.GameWindow.ShowAndRun()\n\n\t// findNode := FindPath(startNode)\n\t// fmt.Println(findNode.Depth)\n\n\t// startTime := time.Now()\n\t// var node *GameResources.Node\n\t// var count = 0\n\t// // var wg sync.WaitGroup\n\t// // messages := make(chan *GameResources.Node)\n\t// for {\n\t// // wg.Add(1)\n\t//\n\t// // go func() {\n\t// // defer wg.Done()\n\t// // messages <- startNode.MoveRobots(&queue, count)\n\t// // }()\n\t//\n\t// findNode := startNode.MoveRobots(&queue, count)\n\t// if findNode != nil {\n\t// node = findNode\n\t// break\n\t// }\n\t// count++\n\t// }\n\t// // go func() {\n\t// // for i := range messages {\n\t// // fmt.Println(\"??????????????????????\")\n\t// // fmt.Println(i)\n\t// // fmt.Println(\"??????????????????????\")\n\t// // }\n\t// // }()\n\t// // wg.Wait()\n\t// nn := node\n\t// for {\n\t// fmt.Println(\"------------------HISTORY-----------------\")\n\t// nn.PrintCurrentPosition()\n\t// if nn.ParentNode == nil {\n\t// fmt.Println(\"PARENT NIL\")\n\t// break\n\t// }\n\t// nn = nn.ParentNode\n\t// }\n\t// endTime := time.Now()\n\t// fmt.Println(\"################################\")\n\t// fmt.Println(endTime.Sub(startTime))\n\t// fmt.Println(\"COUNT : \", count)\n\t// fmt.Println(\"DEPTH : \", node.Depth)\n\t// fmt.Println(\"################################\")\n}", "title": "" }, { "docid": "c17386fe82724edab6316879612aaab4", "score": "0.43351397", "text": "func NewPollDataForSitemapRequest(server string, sitemapname string, pageid string, params *PollDataForSitemapParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"sitemapname\", runtime.ParamLocationPath, sitemapname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pathParam1 string\n\n\tpathParam1, err = runtime.StyleParamWithLocation(\"simple\", false, \"pageid\", runtime.ParamLocationPath, pageid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := originalURL.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/sitemaps/%s/%s\", pathParam0, pathParam1)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params != nil && params.Subscriptionid != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"subscriptionid\", runtime.ParamLocationQuery, *params.Subscriptionid); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := originalURL.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params != nil && params.IncludeHidden != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"includeHidden\", runtime.ParamLocationQuery, *params.IncludeHidden); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := originalURL.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif params != nil && params.AcceptLanguage != nil {\n\t\tvar headerParam0 string\n\n\t\theaderParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"Accept-Language\", runtime.ParamLocationHeader, *params.AcceptLanguage)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treq.Header.Set(\"Accept-Language\", headerParam0)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "cf6bb6afd96d6dc4d2fc2e047b2b3426", "score": "0.4317889", "text": "func (s *SitemapGroup) Add(url URL) {\n\ts.url_channel <- url\n}", "title": "" }, { "docid": "779a770a506566434cd25ef196e20da8", "score": "0.43173686", "text": "func (body POSTGenerateSitemapRequest) Host() string {\n\treturn \"s-sitemap-generator\"\n}", "title": "" }, { "docid": "4f2659f51759e23a4d0aa93d835c3dab", "score": "0.43156272", "text": "func (p *ProcessList) MakeMap() {\n\tn := len(p.FedServers)\n\tindx := int(p.DBHeight*131) % n\n\n\tfor i := 0; i < 10; i++ {\n\t\tindx = (indx + 1) % n\n\t\tfor j := 0; j < len(p.FedServers); j++ {\n\t\t\tp.ServerMap[i][j] = indx\n\t\t\tindx = (indx + 1) % n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b30c893e4a2d0187ef0813b3ebd46ab", "score": "0.43152308", "text": "func (m Miner) GoogleCrawl(config googleConfig, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\t// Create directories in which data from sites will be saved\n\terr := CreateDirs(config.Path, m.industryFolders)\n\tif err != nil {\n\t\tfmt.Printf(\"[CollyCrawl] Fatal error occured: %v\\n\", err)\n\t\treturn\n\t}\n\n\t// Initialize variables\n\tlogger := logToFile(config.Path + \"/google_log.txt\")\n\tresChan := make(chan GoogleResultChan)\n\tcompanies := m.db.GetGoogle()\n\tworkers := 0\n\tvar innerWg sync.WaitGroup\n\tinnerWg.Add(len(companies) + 1)\n\n\t// Track progress from goroutines via channel\n\tgo func() {\n\t\tdone := 0\n\t\tfor r := range resChan {\n\t\t\tif r.Error != nil {\n\t\t\t\tlogger.Printf(\"Error occured [%v]: %v\\n\", r.URL, r.Error)\n\t\t\t\tdone++\n\t\t\t\tworkers--\n\t\t\t\tinnerWg.Done()\n\t\t\t} else if r.Done {\n\t\t\t\tm.db.GoogleFinished(r.URL)\n\t\t\t\tlogger.Printf(\"Google done: %v\\n\", r.URL)\n\t\t\t\tdone++\n\t\t\t\tworkers--\n\t\t\t\tinnerWg.Done()\n\t\t\t} else if r.Warning != nil {\n\t\t\t\tlogger.Printf(\"Warning [%v]: %v\\n\", r.URL, r.Warning)\n\t\t\t}\n\n\t\t\t// Debug output\n\t\t\tif config.Debug && r.Error != nil {\n\t\t\t\tfmt.Printf(\"Error occured [%v]: %v\\n\", r.URL, r.Error)\n\t\t\t} else if config.Debug && r.Progress > 0 {\n\t\t\t\tfmt.Printf(\"Progress %v: %v/%v\\n\", r.URL, r.Progress, r.Total)\n\t\t\t} else if config.Debug && r.Done {\n\t\t\t\tfmt.Printf(\"Google done: %v\\n\", r.URL)\n\t\t\t} else if config.Debug && r.Warning != nil {\n\t\t\t\tfmt.Printf(\"Warning [%v]: %v\\n\", r.URL, r.Warning)\n\t\t\t}\n\n\t\t\t// If amount of `Dones` equal to amount of companies, then exit loop\n\t\t\tif done == len(companies) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tinnerWg.Done()\n\t}()\n\n\tfor _, c := range companies {\n\t\tfor workers >= config.Workers {\n\t\t\ttime.Sleep(time.Second * 1)\n\t\t}\n\n\t\tsaveFolder := path.Join(config.Path, getCompanyIndustry(c), url.PathEscape(c.URL))\n\t\terr := CreateDir(saveFolder)\n\t\tif err != nil && config.Debug {\n\t\t\tfmt.Println(\"[GoogleCrawl] error: \", err)\n\t\t}\n\n\t\t// Google search queries should not be too ofter, therefore launch goroutine with intervals\n\t\twaitTime := time.Second * time.Duration(config.SearchInterval)\n\t\tstart := time.Now()\n\n\t\tgo FetchURLFiles(c.URL, config.Extension, saveFolder, config.MaxFileSize, resChan)\n\t\tworkers++\n\n\t\t// Wait time before next cycle\n\t\telapsed := time.Since(start)\n\t\tif elapsed < waitTime {\n\t\t\ttime.Sleep(waitTime - elapsed)\n\t\t}\n\t}\n\tinnerWg.Wait()\n}", "title": "" }, { "docid": "0f29ad5d4c87ff6f6469f60446d7817a", "score": "0.43123883", "text": "func Details() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\thost := c.Request.Host\n\n\t\tmu.RLock()\n\t\t// check the sitemap to see if its cached\n\t\tsite := sitemap[host]\n\t\tmu.RUnlock()\n\n\t\t// if not query the database\n\t\tif site == nil {\n\n\t\t\tsitedata := &SiteData{}\n\n\t\t\t// Get Database handle\n\t\t\tdbase, err := db.GetDb()\n\t\t\tif err != nil {\n\t\t\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\t\t\tc.Error(err).SetMeta(\"Details.GetDb\")\n\t\t\t\tc.Abort()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// get the info about the imageboard\n\t\t\terr = dbase.QueryRow(`SELECT ib_id,ib_title,ib_description,ib_nsfw,ib_api,ib_img,ib_style,ib_logo,ib_discord FROM imageboards WHERE ib_domain = ?`, host).Scan(&sitedata.Ib, &sitedata.Title, &sitedata.Desc, &sitedata.Nsfw, &sitedata.API, &sitedata.Img, &sitedata.Style, &sitedata.Logo, &sitedata.Discord)\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\tc.JSON(e.ErrorMessage(e.ErrNotFound))\n\t\t\t\tc.Error(err).SetMeta(\"Details.QueryRow\")\n\t\t\t\tc.Abort()\n\t\t\t\treturn\n\t\t\t} else if err != nil {\n\t\t\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\t\t\tc.Error(err).SetMeta(\"Details.QueryRow\")\n\t\t\t\tc.Abort()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// collect the links to the other imageboards for nav menu\n\t\t\trows, err := dbase.Query(`SELECT ib_title,ib_domain FROM imageboards WHERE ib_id != ?`, sitedata.Ib)\n\t\t\tif err != nil {\n\t\t\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\t\t\tc.Error(err).SetMeta(\"Details.Query\")\n\t\t\t\tc.Abort()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer rows.Close()\n\n\t\t\tfor rows.Next() {\n\n\t\t\t\tib := Imageboard{}\n\n\t\t\t\terr = rows.Scan(&ib.Title, &ib.Address)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tsitedata.Imageboards = append(sitedata.Imageboards, ib)\n\t\t\t}\n\t\t\tif rows.Err() != nil {\n\t\t\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\t\t\tc.Error(err).SetMeta(\"Details.Query\")\n\t\t\t\tc.Abort()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmu.Lock()\n\t\t\tsitemap[host] = sitedata\n\t\t\tmu.Unlock()\n\n\t\t}\n\n\t\tc.Set(\"host\", host)\n\n\t\tc.Next()\n\n\t}\n\n}", "title": "" }, { "docid": "59f7f05262b38b6a7c6865701101fc2f", "score": "0.43069285", "text": "func (m *sourcesMap) Update(ctx context.Context) error {\n\tg, ctx := errgroup.WithContext(ctx)\n\tfor _, source := range m.urls {\n\t\t// Required as source is overwritten upon each iteration,\n\t\t// which may cause a race condition when used below in g.Go.\n\t\tsrc := source\n\t\tfor _, r := range sourceRepos {\n\t\t\tu, err := source.url.Parse(path.Join(r, `source`, `Sources.gz`))\n\t\t\tg.Go(func() error {\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"unable to construct URL: %w\", err)\n\t\t\t\t}\n\t\t\t\tif err := m.fetchSources(ctx, src.distro, u.String()); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"unable to fetch sources: %w\", err)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\t}\n\treturn g.Wait()\n}", "title": "" }, { "docid": "6029d65e0c72dc8354e47098910f9934", "score": "0.43022448", "text": "func (t *Transplantor) GenerateSite(dst string) (err error) {\n\t// src := \"../examples/simple.site\"\n\tsrcroot, _ := t.Roots()\n\n\t// Scan the source tree\n\tif err = srcroot.ScanSubdirs(); err != nil {\n\t\tlog.Fatal(\"rats scanning the sources failed\")\n\t}\n\n\t// Check our destination make sure it can be made and written to\n\tif err = t.DstCheckAndSet(dst); err != nil {\n\t\tlog.Fatalf(\"failed to check and set the dst: %s err %v\", dst, err)\n\t}\n\n\t// Build destination directory structure\n\tif err = t.BuildDstDir(); err != nil {\n\t\tlog.Fatalf(\"oh man, failed to build the directory structure... %s\", err)\n\t}\n\n\t// Translate markdown files to html snippets\n\tif err = t.processMarkdown(); err != nil {\n\t\tlog.Fatalf(\"failed to translate some md files %s\", err)\n\t}\n\n\t// Produce the final HTML and write to destination\n\tif err = t.executeTmpl8s(); err != nil {\n\t\tlog.Fatalf(\"failed to execute tempaltes %s\", err)\n\t}\n\n\t// Now move remaining assests (files: .css, .jpg, .pdf, etc.)\n\tif err = t.CopySources(); err != nil {\n\t\tlog.Fatal(\"failed to copy sources\")\n\t}\n\n\tif err = t.VerifySite(); err != nil {\n\t\tlog.Fatal(\"bummer the destinaiton is broken? \")\n\t}\n\n\tlog.Println(\"We are done! All is well methinks... \")\n\treturn err\n}", "title": "" }, { "docid": "cf8563bc1c9268ad05b11b373f23aaca", "score": "0.43015745", "text": "func BuildMap(lines <-chan string) (m Map) {\n\ty := 0\n\n\tfor line := range lines {\n\t\tfor x, b := range line {\n\t\t\tif b == '#' {\n\t\t\t\tm = append(m, Asteroid{Vector{x, y}})\n\t\t\t}\n\t\t}\n\t\ty++\n\t}\n\n\treturn\n}", "title": "" } ]
325e83af9271f128d62eac9f2dcffff4
UpdateWorkflowDefinition updates an existing workflow definition. The version will be set to the version following the latest definition. The workflow definition returned contains this new version number.
[ { "docid": "67947527bebc5d8553db0b56c4c8435c", "score": "0.805721", "text": "func (d DynamoDB) UpdateWorkflowDefinition(ctx context.Context, def models.WorkflowDefinition) (models.WorkflowDefinition, error) {\n\t// TODO we should change this to use the latest-workflows table with a projection expressions\n\tlatest, err := d.LatestWorkflowDefinition(ctx, def.Name) // TODO: only need version here, can optimize query\n\tif err != nil {\n\t\treturn def, err\n\t}\n\n\t// TODO: this isn't thread safe...\n\tnewVersion := resources.NewWorkflowDefinitionVersion(&def, int(latest.Version+1))\n\tif err := d.SaveWorkflowDefinition(ctx, *newVersion); err != nil {\n\t\treturn def, err\n\t}\n\n\t// need to perform a get to return any mutations that happened in Save, e.g. CreatedAt\n\treturn d.GetWorkflowDefinition(ctx, newVersion.Name, int(newVersion.Version))\n}", "title": "" } ]
[ { "docid": "d693a541ebeae7e5c12e9f1998d96762", "score": "0.5812557", "text": "func (d DynamoDB) LatestWorkflowDefinition(ctx context.Context, name string) (models.WorkflowDefinition, error) {\n\tres, err := d.ddb.QueryWithContext(ctx, &dynamodb.QueryInput{\n\t\tTableName: aws.String(d.latestWorkflowDefinitionsTable()),\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#N\": aws.String(\"name\"),\n\t\t},\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":name\": {\n\t\t\t\tS: aws.String(name),\n\t\t\t},\n\t\t},\n\t\tKeyConditionExpression: aws.String(\"#N = :name\"),\n\t\tConsistentRead: aws.Bool(true),\n\t})\n\tif err != nil {\n\t\treturn models.WorkflowDefinition{}, err\n\t}\n\tif len(res.Items) != 1 {\n\t\treturn models.WorkflowDefinition{}, store.NewNotFound(name)\n\t}\n\tvar wf models.WorkflowDefinition\n\tif err := DecodeWorkflowDefinition(res.Items[0], &wf); err != nil {\n\t\treturn models.WorkflowDefinition{}, err\n\t}\n\treturn wf, nil\n}", "title": "" }, { "docid": "ec4c3afe677b1dc544896e1a9f3bab8e", "score": "0.5604808", "text": "func (m *MockController) UpdateWorkflowDefinition(ctx context.Context, i *models.UpdateWorkflowDefinitionInput) (*models.WorkflowDefinition, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateWorkflowDefinition\", ctx, i)\n\tret0, _ := ret[0].(*models.WorkflowDefinition)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1a3ca1ec62ece0b6eef12a2f1f16d8ac", "score": "0.5553428", "text": "func (mr *MockControllerMockRecorder) UpdateWorkflowDefinition(ctx, i interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateWorkflowDefinition\", reflect.TypeOf((*MockController)(nil).UpdateWorkflowDefinition), ctx, i)\n}", "title": "" }, { "docid": "d0e2aa0c372be0765283cd6fac4d7fe8", "score": "0.53460944", "text": "func (d DynamoDB) GetWorkflowDefinition(ctx context.Context, name string, version int) (models.WorkflowDefinition, error) {\n\tkey, err := dynamodbattribute.MarshalMap(ddbWorkflowDefinitionPrimaryKey{\n\t\tName: name,\n\t\tVersion: int64(version),\n\t})\n\tif err != nil {\n\t\treturn models.WorkflowDefinition{}, err\n\t}\n\tres, err := d.ddb.GetItemWithContext(ctx, &dynamodb.GetItemInput{\n\t\tKey: key,\n\t\tTableName: aws.String(d.workflowDefinitionsTable()),\n\t\tConsistentRead: aws.Bool(true),\n\t})\n\tif err != nil {\n\t\treturn models.WorkflowDefinition{}, err\n\t}\n\n\tif len(res.Item) == 0 {\n\t\treturn models.WorkflowDefinition{}, store.NewNotFound(fmt.Sprintf(\"%s@%d\", name, version))\n\t}\n\n\tvar wf models.WorkflowDefinition\n\tif err := DecodeWorkflowDefinition(res.Item, &wf); err != nil {\n\t\treturn models.WorkflowDefinition{}, err\n\t}\n\n\treturn wf, nil\n}", "title": "" }, { "docid": "7af8bc723df283c5813303a0197b1dc5", "score": "0.52045494", "text": "func Update(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store cache.Store, proj sdk.Project, wf *sdk.Workflow, uptOption UpdateOptions) error {\n\tctx, end := telemetry.Span(ctx, \"workflow.Update\", telemetry.Tag(telemetry.TagProjectKey, proj.Key), telemetry.Tag(telemetry.TagWorkflow, wf.Name))\n\tdefer end()\n\n\tif err := CompleteWorkflow(ctx, db, wf, proj, LoadOptions{}); err != nil {\n\t\treturn err\n\t}\n\tif err := CheckValidity(ctx, db, wf); err != nil {\n\t\treturn err\n\t}\n\n\tif err := DeleteNotifications(db, wf.ID); err != nil {\n\t\treturn sdk.WrapError(err, \"unable to delete all notifications on workflow(%d - %s)\", wf.ID, wf.Name)\n\t}\n\n\tif err := DeleteIntegrationsFromWorkflow(db, wf.ID); err != nil {\n\t\treturn sdk.WrapError(err, \"unable to delete all integrations on workflow(%d - %s)\", wf.ID, wf.Name)\n\t}\n\t// reload workflow to delete the current workflow data\n\toldWf, err := LoadByID(ctx, db, store, proj, wf.ID, LoadOptions{Minimal: true})\n\tif err != nil {\n\t\treturn sdk.WrapError(err, \"Unable to load existing workflow with proj:%s ID:%d\", proj.Key, wf.ID)\n\t}\n\n\t// Set or keep HistoryLength\n\tif wf.HistoryLength == 0 {\n\t\tif oldWf.HistoryLength == 0 {\n\t\t\twf.HistoryLength = sdk.DefaultHistoryLength\n\t\t} else {\n\t\t\twf.HistoryLength = oldWf.HistoryLength\n\t\t}\n\t}\n\n\t// Keep MaxRun\n\twf.MaxRuns = oldWf.MaxRuns\n\tif err := DeleteWorkflowData(db, *oldWf); err != nil {\n\t\treturn sdk.WrapError(err, \"unable to delete from old workflow data(%d - %s)\", wf.ID, wf.Name)\n\t}\n\n\t// Delete all nodes,joins, integration ID\n\twf.ResetIDs()\n\n\tfilteredPurgeTags := make([]string, 0)\n\tfor _, t := range wf.PurgeTags {\n\t\tif t != \"\" {\n\t\t\tfilteredPurgeTags = append(filteredPurgeTags, t)\n\t\t}\n\t}\n\twf.PurgeTags = filteredPurgeTags\n\tif wf.WorkflowData.Node.Context != nil && wf.WorkflowData.Node.Context.ApplicationID != 0 {\n\t\tvar err error\n\t\tif wf.WorkflowData.Node.Context.DefaultPayload, err = DefaultPayload(ctx, db, store, proj, wf); err != nil {\n\t\t\tlog.Warn(ctx, \"workflow.Update> Cannot set default payload : %v\", err)\n\t\t}\n\t}\n\n\tif !uptOption.DisableHookManagement {\n\t\tif err := hookRegistration(ctx, db, store, proj, wf, oldWf); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif oldWf != nil {\n\t\t\thookToDelete := computeHookToDelete(wf, oldWf)\n\t\t\tif err := hookUnregistration(ctx, db, store, proj, hookToDelete); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor i := range wf.WorkflowData.Node.Hooks {\n\t\t\th := &wf.WorkflowData.Node.Hooks[i]\n\t\t\tif h.UUID == \"\" {\n\t\t\t\th.UUID = sdk.UUID()\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := InsertWorkflowData(db, wf); err != nil {\n\t\treturn sdk.WrapError(err, \"Update> Unable to insert workflow data\")\n\t}\n\n\t// Insert notifications\n\tfor i := range wf.Notifications {\n\t\tn := &wf.Notifications[i]\n\t\tif err := InsertNotification(db, wf, n); err != nil {\n\t\t\treturn sdk.WrapError(err, \"Unable to update workflow(%d) notification (%#v)\", wf.ID, n)\n\t\t}\n\t}\n\n\twf.LastModified = time.Now()\n\tdbw := Workflow{Workflow: *wf}\n\tif _, err := db.UpdateColumns(func(c *gorp.ColumnMap) bool { return c.ColumnName != \"project_key\" }, &dbw); err != nil {\n\t\treturn sdk.WrapError(err, \"Unable to update workflow\")\n\t}\n\t*wf = dbw.Get()\n\treturn nil\n}", "title": "" }, { "docid": "78bd240e6a67fdb415306d385f9d21a0", "score": "0.5147456", "text": "func UpdateWorkflowById(m *Workflow) (err error) {\n\to := orm.NewOrm()\n\tv := Workflow{Id: m.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.Update(m); err == nil {\n\t\t\tfmt.Println(\"Number of records updated in database:\", num)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c26f9039c02d8f22344d17b8fcbcd377", "score": "0.50333077", "text": "func (client *Client) UpdateWorkFlow(request *UpdateWorkFlowRequest) (response *UpdateWorkFlowResponse, err error) {\n\tresponse = CreateUpdateWorkFlowResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "3d62e5c9c26a1004a40a34f0beb084bc", "score": "0.4914115", "text": "func Update(ctx context.Context, db gorp.SqlExecutor, store cache.Store, proj sdk.Project, w *sdk.Workflow, uptOption UpdateOptions) error {\n\tctx, end := observability.Span(ctx, \"workflow.Update\")\n\tdefer end()\n\tif err := IsValid(ctx, store, db, w, proj, LoadOptions{}); err != nil {\n\t\treturn err\n\t}\n\n\tif err := DeleteNotifications(db, w.ID); err != nil {\n\t\treturn sdk.WrapError(err, \"unable to delete all notifications on workflow(%d - %s)\", w.ID, w.Name)\n\t}\n\n\tif err := integration.DeleteFromWorkflow(db, w.ID); err != nil {\n\t\treturn sdk.WrapError(err, \"unable to delete all integrations on workflow(%d - %s)\", w.ID, w.Name)\n\t}\n\n\t// Delete workflow data\n\tif uptOption.OldWorkflow != nil && uptOption.OldWorkflow.ID != 0 {\n\t\tif err := DeleteWorkflowData(db, *uptOption.OldWorkflow); err != nil {\n\t\t\treturn sdk.WrapError(err, \"unable to delete from old workflow data(%d - %s)\", w.ID, w.Name)\n\t\t}\n\t} else {\n\t\toldW, err := Load(ctx, db, store, proj, w.Name, LoadOptions{})\n\t\tif err != nil && !sdk.ErrorIs(err, sdk.ErrWorkflowNotFound) {\n\t\t\treturn sdk.WrapError(err, \"unable to load old workflow to delete workflow data\")\n\t\t}\n\t\tif err == nil {\n\t\t\tif err := DeleteWorkflowData(db, *oldW); err != nil {\n\t\t\t\treturn sdk.WrapError(err, \"unable to delete from workflow data(%d - %s)\", oldW.ID, oldW.Name)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Delete all node ID\n\tw.ResetIDs()\n\n\tfilteredPurgeTags := []string{}\n\tfor _, t := range w.PurgeTags {\n\t\tif t != \"\" {\n\t\t\tfilteredPurgeTags = append(filteredPurgeTags, t)\n\t\t}\n\t}\n\tw.PurgeTags = filteredPurgeTags\n\n\tif w.WorkflowData.Node.Context != nil && w.WorkflowData.Node.Context.ApplicationID != 0 {\n\t\tvar err error\n\t\tif w.WorkflowData.Node.Context.DefaultPayload, err = DefaultPayload(ctx, db, store, proj, w); err != nil {\n\t\t\tlog.Warning(ctx, \"workflow.Update> Cannot set default payload : %v\", err)\n\t\t}\n\t}\n\n\tif !uptOption.DisableHookManagement {\n\t\tif err := hookRegistration(ctx, db, store, proj, w, uptOption.OldWorkflow); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif uptOption.OldWorkflow != nil {\n\t\t\thookToDelete := computeHookToDelete(w, uptOption.OldWorkflow)\n\t\t\tif err := hookUnregistration(ctx, db, store, proj, hookToDelete); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := InsertWorkflowData(db, w); err != nil {\n\t\treturn sdk.WrapError(err, \"Update> Unable to insert workflow data\")\n\t}\n\n\t// Insert notifications\n\tfor i := range w.Notifications {\n\t\tn := &w.Notifications[i]\n\t\tif err := InsertNotification(db, w, n); err != nil {\n\t\t\treturn sdk.WrapError(err, \"Unable to update workflow(%d) notification (%#v)\", w.ID, n)\n\t\t}\n\t}\n\n\tw.LastModified = time.Now()\n\tdbw := Workflow(*w)\n\tif _, err := db.Update(&dbw); err != nil {\n\t\treturn sdk.WrapError(err, \"Unable to update workflow\")\n\t}\n\t*w = sdk.Workflow(dbw)\n\n\treturn nil\n}", "title": "" }, { "docid": "c9241afd24e3a5ebe2853229411d539f", "score": "0.48590627", "text": "func (c *Operator) UpdateWorkflowRun(workflowID string, wfRun ChaosWorkflowRun) (int, error) {\n\tctx, _ := context.WithTimeout(backgroundContext, 10*time.Second)\n\n\tcount, err := c.operator.CountDocuments(ctx, mongodb.WorkflowCollection, bson.D{\n\t\t{\"workflow_id\", workflowID},\n\t\t{\"workflow_runs.workflow_run_id\", wfRun.WorkflowRunID},\n\t})\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tupdateCount := 1\n\tif count == 0 {\n\t\tquery := bson.D{{\"workflow_id\", workflowID}}\n\t\tupdate := bson.D{\n\t\t\t{\"$push\", bson.D{\n\t\t\t\t{\"workflow_runs\", wfRun},\n\t\t\t}}}\n\n\t\tresult, err := c.operator.Update(ctx, mongodb.WorkflowCollection, query, update)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif result.MatchedCount == 0 {\n\t\t\treturn 0, errors.New(\"workflow not found\")\n\t\t}\n\t} else if count == 1 {\n\t\tquery := bson.D{\n\t\t\t{\"workflow_id\", workflowID},\n\t\t\t{\"workflow_runs\", bson.D{\n\t\t\t\t{\"$elemMatch\", bson.D{\n\t\t\t\t\t{\"workflow_run_id\", wfRun.WorkflowRunID},\n\t\t\t\t\t{\"completed\", false},\n\t\t\t\t}},\n\t\t\t}}}\n\t\tupdate := bson.D{\n\t\t\t{\"$set\", bson.D{\n\t\t\t\t{\"workflow_runs.$.last_updated\", wfRun.LastUpdated},\n\t\t\t\t{\"workflow_runs.$.phase\", wfRun.Phase},\n\t\t\t\t{\"workflow_runs.$.resiliency_score\", wfRun.ResiliencyScore},\n\t\t\t\t{\"workflow_runs.$.experiments_passed\", wfRun.ExperimentsPassed},\n\t\t\t\t{\"workflow_runs.$.experiments_failed\", wfRun.ExperimentsFailed},\n\t\t\t\t{\"workflow_runs.$.experiments_awaited\", wfRun.ExperimentsAwaited},\n\t\t\t\t{\"workflow_runs.$.experiments_stopped\", wfRun.ExperimentsStopped},\n\t\t\t\t{\"workflow_runs.$.experiments_na\", wfRun.ExperimentsNA},\n\t\t\t\t{\"workflow_runs.$.total_experiments\", wfRun.TotalExperiments},\n\t\t\t\t{\"workflow_runs.$.execution_data\", wfRun.ExecutionData},\n\t\t\t\t{\"workflow_runs.$.completed\", wfRun.Completed},\n\t\t\t\t{\"workflow_runs.$.isRemoved\", wfRun.IsRemoved},\n\t\t\t}}}\n\n\t\tresult, err := c.operator.Update(ctx, mongodb.WorkflowCollection, query, update)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tupdateCount = int(result.MatchedCount)\n\t}\n\n\treturn updateCount, nil\n}", "title": "" }, { "docid": "8063c78b23ea774c8feb34d2239c872d", "score": "0.47366163", "text": "func (rc *RefCreate) SetWorkflow(w *Workflow) *RefCreate {\n\treturn rc.SetWorkflowID(w.ID)\n}", "title": "" }, { "docid": "2eae4e117a53192bd51d987f125ef319", "score": "0.47273058", "text": "func (m *mutableStateWorkflowTaskManagerImpl) UpdateWorkflowTask(\n\tworkflowTask *workflowTaskInfo,\n) {\n\tm.msb.executionInfo.WorkflowTaskVersion = workflowTask.Version\n\tm.msb.executionInfo.WorkflowTaskScheduleId = workflowTask.ScheduleID\n\tm.msb.executionInfo.WorkflowTaskStartedId = workflowTask.StartedID\n\tm.msb.executionInfo.WorkflowTaskRequestId = workflowTask.RequestID\n\tm.msb.executionInfo.WorkflowTaskTimeout = workflowTask.WorkflowTaskTimeout\n\tm.msb.executionInfo.WorkflowTaskAttempt = workflowTask.Attempt\n\tm.msb.executionInfo.WorkflowTaskStartedTime = workflowTask.StartedTime\n\tm.msb.executionInfo.WorkflowTaskScheduledTime = workflowTask.ScheduledTime\n\tm.msb.executionInfo.WorkflowTaskOriginalScheduledTime = workflowTask.OriginalScheduledTime\n\n\t// NOTE: do not update taskqueue in execution info\n\n\tm.msb.logger.Debug(\"Workflow task updated\",\n\t\ttag.WorkflowScheduleID(workflowTask.ScheduleID),\n\t\ttag.WorkflowStartedID(workflowTask.StartedID),\n\t\ttag.WorkflowTaskRequestId(workflowTask.RequestID),\n\t\ttag.WorkflowTaskTimeout(workflowTask.WorkflowTaskTimeout),\n\t\ttag.Attempt(workflowTask.Attempt),\n\t\ttag.WorkflowStartedTimestamp(workflowTask.StartedTime))\n}", "title": "" }, { "docid": "63468270417f4b6e778513ec37211b0c", "score": "0.47142372", "text": "func PublishWorkflowUpdate(ctx context.Context, projKey string, w sdk.Workflow, oldw sdk.Workflow, u sdk.Identifiable) {\n\te := sdk.EventWorkflowUpdate{\n\t\tNewWorkflow: w,\n\t\tOldWorkflow: oldw,\n\t}\n\tpublishWorkflowEvent(ctx, e, projKey, w.Name, w.GetEventIntegration(), u)\n}", "title": "" }, { "docid": "66f9931318ca689ae98acab6264a1f9c", "score": "0.47056475", "text": "func (d DynamoDB) GetWorkflowDefinitionVersions(ctx context.Context, name string) ([]models.WorkflowDefinition, error) {\n\tresults, err := d.ddb.QueryWithContext(ctx, &dynamodb.QueryInput{\n\t\tTableName: aws.String(d.workflowDefinitionsTable()),\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#N\": aws.String(\"name\"),\n\t\t},\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":name\": {\n\t\t\t\tS: aws.String(name),\n\t\t\t},\n\t\t},\n\t\tKeyConditionExpression: aws.String(\"#N = :name\"),\n\t\tConsistentRead: aws.Bool(true),\n\t})\n\tif err != nil {\n\t\treturn []models.WorkflowDefinition{}, err\n\t}\n\tif len(results.Items) == 0 {\n\t\treturn []models.WorkflowDefinition{}, store.NewNotFound(name)\n\t}\n\n\treturn d.dynamoItemsToWorkflowDefinitions(results.Items)\n}", "title": "" }, { "docid": "aeed9aab45b2efc2eaf9cae1f864a398", "score": "0.46941534", "text": "func SetWorkflowUpgrade() {\n\tdm.Workflow = workflowUpgrade\n}", "title": "" }, { "docid": "dbb6bb21ba11df744dfc212c72a72a35", "score": "0.46928328", "text": "func (_e *MockDataRegistryServiceClient_Expecter) UpdateDefinition(ctx interface{}, in interface{}, opts ...interface{}) *MockDataRegistryServiceClient_UpdateDefinition_Call {\n\treturn &MockDataRegistryServiceClient_UpdateDefinition_Call{Call: _e.mock.On(\"UpdateDefinition\",\n\t\tappend([]interface{}{ctx, in}, opts...)...)}\n}", "title": "" }, { "docid": "ff0c871f557be9da46f79127136f97c8", "score": "0.46785533", "text": "func (o AutomationRulesFindingFieldsUpdateOutput) Workflow() AutomationRuleWorkflowUpdatePtrOutput {\n\treturn o.ApplyT(func(v AutomationRulesFindingFieldsUpdate) *AutomationRuleWorkflowUpdate { return v.Workflow }).(AutomationRuleWorkflowUpdatePtrOutput)\n}", "title": "" }, { "docid": "2c8e07c58bfa314152cb8cd3c246d945", "score": "0.45971978", "text": "func (w *Workflow) Update() *WorkflowUpdateOne {\n\treturn (&WorkflowClient{config: w.config}).UpdateOne(w)\n}", "title": "" }, { "docid": "f8ca4cb3df94a732837c4d75a8546a91", "score": "0.4568992", "text": "func (wc *WorkflowCreate) SetWorkflow(b []byte) *WorkflowCreate {\n\twc.mutation.SetWorkflow(b)\n\treturn wc\n}", "title": "" }, { "docid": "8790ae3df63990b37b3de3e7ab7f70f5", "score": "0.45231348", "text": "func (c *Operator) UpdateChaosWorkflow(query bson.D, update bson.D) error {\n\tctx, _ := context.WithTimeout(backgroundContext, 10*time.Second)\n\n\t_, err := c.operator.Update(ctx, mongodb.WorkflowCollection, query, update)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3c9fb8aad115593f1c6f436232bff57d", "score": "0.45068222", "text": "func (c *ChaosWorkflowService) ProcessWorkflowUpdate(workflow *model.ChaosWorkFlowRequest, username string, wfType *dbSchemaWorkflow.ChaosWorkflowType, r *store.StateData) error {\n\targs := c.Called(workflow, username, wfType, r)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "062dcab78a3bc06e7a306a29cd909f03", "score": "0.44711533", "text": "func (c *Client) UpdateFlow(ctx context.Context, params *UpdateFlowInput, optFns ...func(*Options)) (*UpdateFlowOutput, error) {\n\tif params == nil {\n\t\tparams = &UpdateFlowInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"UpdateFlow\", params, optFns, addOperationUpdateFlowMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*UpdateFlowOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "c422265fa239a6ebe718dcbe9a988422", "score": "0.44528386", "text": "func UpdateSameAsFlowOnDraftChangeHook() ent.Hook {\n\thk := func(next ent.Mutator) ent.Mutator {\n\t\treturn hook.FlowDraftFunc(func(ctx context.Context, m *ent.FlowDraftMutation) (ent.Value, error) {\n\t\t\tm.SetSameAsFlow(false)\n\t\t\treturn next.Mutate(ctx, m)\n\t\t})\n\t}\n\treturn hook.If(hk,\n\t\thook.And(\n\t\t\thook.Not(hook.HasFields(flowdraft.FieldSameAsFlow)),\n\t\t\thook.HasOp(ent.OpUpdateOne),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "f5b66aac05dea4e818575d90646d773d", "score": "0.44194975", "text": "func (_e *MockDataRegistryServiceServer_Expecter) UpdateDefinition(_a0 interface{}, _a1 interface{}) *MockDataRegistryServiceServer_UpdateDefinition_Call {\n\treturn &MockDataRegistryServiceServer_UpdateDefinition_Call{Call: _e.mock.On(\"UpdateDefinition\", _a0, _a1)}\n}", "title": "" }, { "docid": "b71f16d944d8c27c74f08479fd744e5e", "score": "0.4419326", "text": "func (s *UpdateFlowTemplateInput) SetDefinition(v *DefinitionDocument) *UpdateFlowTemplateInput {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "9b61b0cae8d40b756fc1f6228f0e4140", "score": "0.44132957", "text": "func (mr *MockControllableContextMockRecorder) UpdateWorkflowExecution(ctx, request interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateWorkflowExecution\", reflect.TypeOf((*MockControllableContext)(nil).UpdateWorkflowExecution), ctx, request)\n}", "title": "" }, { "docid": "7a8f167b66d091112b5c2a93a18aff48", "score": "0.4384889", "text": "func (s *VtctldServer) WorkflowUpdate(ctx context.Context, req *vtctldatapb.WorkflowUpdateRequest) (resp *vtctldatapb.WorkflowUpdateResponse, err error) {\n\tspan, ctx := trace.NewSpan(ctx, \"VtctldServer.WorkflowUpdate\")\n\tdefer span.Finish()\n\n\tdefer panicHandler(&err)\n\n\tspan.Annotate(\"keyspace\", req.Keyspace)\n\tspan.Annotate(\"workflow\", req.TabletRequest.Workflow)\n\tspan.Annotate(\"cells\", req.TabletRequest.Cells)\n\tspan.Annotate(\"tablet_types\", req.TabletRequest.TabletTypes)\n\tspan.Annotate(\"on_ddl\", req.TabletRequest.OnDdl)\n\n\tresp, err = s.ws.WorkflowUpdate(ctx, req)\n\treturn resp, err\n}", "title": "" }, { "docid": "9576302d3a3e10b0de9591750e4ffeb8", "score": "0.4349989", "text": "func (c *PostgresScheduledWorkflowCompleter) EnqueueAndUpdateScheduledWorkflow(s *cereal.Schedule) error {\n\tdefer c.cancel()\n\twrapErr := func(err error, msg string) error {\n\t\tif isPGConflict(err) {\n\t\t\treturn cereal.ErrWorkflowInstanceExists\n\t\t}\n\t\treturn errors.Wrap(err, msg)\n\t}\n\n\trow := c.tx.QueryRowContext(\n\t\tc.ctx,\n\t\tenqueueWorkflowQuery,\n\t\ts.InstanceName,\n\t\ts.WorkflowName,\n\t\ts.Parameters)\n\n\tvar count sql.NullInt64\n\terr := row.Scan(&count)\n\tif err != nil {\n\t\treturn wrapErr(err, \"failed to enqueue workflow\")\n\t}\n\n\tif count.Int64 == 0 {\n\t\t_, err = c.tx.ExecContext(\n\t\t\tc.ctx,\n\t\t\tupdateSlowScheduledWorkflowQuery,\n\t\t\ts.ID,\n\t\t\ts.NextDueAt,\n\t\t\ts.Enabled)\n\t\tif err != nil {\n\t\t\treturn wrapErr(err, \"failed to update workflow schedule\")\n\t\t}\n\n\t\terr := c.tx.Commit()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to commit workflow instance\")\n\t\t}\n\t\treturn cereal.ErrWorkflowInstanceExists\n\t} else {\n\t\t_, err = c.tx.ExecContext(\n\t\t\tc.ctx,\n\t\t\tupdateScheduledWorkflowQuery,\n\t\t\ts.ID,\n\t\t\ts.NextDueAt,\n\t\t\ts.LastEnqueuedAt,\n\t\t\ts.Enabled)\n\t\tif err != nil {\n\t\t\treturn wrapErr(err, \"failed to update workflow schedule\")\n\t\t}\n\n\t\treturn wrapErr(c.tx.Commit(), \"failed to commit workflow instance\")\n\t}\n}", "title": "" }, { "docid": "dcc45b864721b2200e13405e45ae9a89", "score": "0.43468574", "text": "func (tm *TabletManager) UpdateVRWorkflow(ctx context.Context, req *tabletmanagerdatapb.UpdateVRWorkflowRequest) (*tabletmanagerdatapb.UpdateVRWorkflowResponse, error) {\n\tbindVars := map[string]*querypb.BindVariable{\n\t\t\"wf\": sqltypes.StringBindVariable(req.Workflow),\n\t}\n\tparsed := sqlparser.BuildParsedQuery(sqlSelectVRWorkflowConfig, sidecardb.GetIdentifier(), \":wf\")\n\tstmt, err := parsed.GenerateQuery(bindVars, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := tm.VREngine.Exec(stmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res == nil || len(res.Rows) == 0 {\n\t\t// No streams on this tablet to update. This is\n\t\t// expected e.g. on source tablets for Reshard\n\t\t// workflows. If callers want to treat this\n\t\t// scenario as an error they can.\n\t\treturn &tabletmanagerdatapb.UpdateVRWorkflowResponse{Result: nil}, nil\n\t}\n\n\trow := res.Named().Row()\n\tid := row.AsInt64(\"id\", 0)\n\tcells := strings.Split(row.AsString(\"cell\", \"\"), \",\")\n\ttabletTypes := strings.Split(row.AsString(\"tablet_types\", \"\"), \",\")\n\tbls := &binlogdatapb.BinlogSource{}\n\tsource := row.AsBytes(\"source\", []byte{})\n\t// For the string based values, we use NULL to differentiate\n\t// from an empty string. The NULL value indicates that we\n\t// should keep the existing value.\n\tif !textutil.ValueIsSimulatedNull(req.Cells) {\n\t\tcells = req.Cells\n\t}\n\tif !textutil.ValueIsSimulatedNull(req.TabletTypes) {\n\t\ttabletTypes = req.TabletTypes\n\t}\n\tif err = prototext.Unmarshal(source, bls); err != nil {\n\t\treturn nil, err\n\t}\n\t// If we don't want to update the existing value then pass\n\t// the simulated NULL value of -1.\n\tif !textutil.ValueIsSimulatedNull(req.OnDdl) {\n\t\tbls.OnDdl = req.OnDdl\n\t}\n\tsource, err = prototext.Marshal(bls)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbindVars = map[string]*querypb.BindVariable{\n\t\t\"sc\": sqltypes.StringBindVariable(string(source)),\n\t\t\"cl\": sqltypes.StringBindVariable(strings.Join(cells, \",\")),\n\t\t\"tt\": sqltypes.StringBindVariable(strings.Join(tabletTypes, \",\")),\n\t\t\"id\": sqltypes.Int64BindVariable(id),\n\t}\n\tparsed = sqlparser.BuildParsedQuery(sqlUpdateVRWorkflowConfig, sidecardb.GetIdentifier(), \":sc\", \":cl\", \":tt\", \":id\")\n\tstmt, err = parsed.GenerateQuery(bindVars, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err = tm.VREngine.Exec(stmt)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &tabletmanagerdatapb.UpdateVRWorkflowResponse{Result: sqltypes.ResultToProto3(res)}, nil\n}", "title": "" }, { "docid": "8dc34034308c2396c2cf1ec6aecddd48", "score": "0.43359548", "text": "func (d DynamoDB) UpdateWorkflowAttributes(ctx context.Context, workflowID string, update store.UpdateWorkflowAttributesInput) error {\n\tvar updateExpr expression.UpdateBuilder\n\tif update.LastUpdated != nil {\n\t\tupdateExpr = expression.Set(\n\t\t\texpression.Name(\"Workflow.lastUpdated\"),\n\t\t\texpression.Value(time.Time(*update.LastUpdated).Format(time.RFC3339Nano)),\n\t\t)\n\t}\n\tif update.Status != nil {\n\t\tupdateExpr = updateExpr.Set(\n\t\t\texpression.Name(\"Workflow.status\"),\n\t\t\texpression.Value(*update.Status),\n\t\t)\n\t}\n\tif update.StatusReason != nil {\n\t\tupdateExpr = updateExpr.Set(\n\t\t\texpression.Name(\"Workflow.statusReason\"),\n\t\t\texpression.Value(*update.StatusReason),\n\t\t)\n\t}\n\tif update.StoppedAt != nil {\n\t\tupdateExpr = updateExpr.Set(\n\t\t\texpression.Name(\"Workflow.stoppedAt\"),\n\t\t\texpression.Value(time.Time(*update.StoppedAt).Format(time.RFC3339Nano)),\n\t\t)\n\t}\n\tif update.ResolvedByUser != nil {\n\t\tupdateExpr = updateExpr.Set(\n\t\t\texpression.Name(\"Workflow.resolvedByUser\"),\n\t\t\texpression.Value(*update.ResolvedByUser),\n\t\t)\n\t}\n\tif update.Output != nil {\n\t\tupdateExpr = updateExpr.Set(\n\t\t\texpression.Name(\"Workflow.output\"),\n\t\t\texpression.Value(*update.Output),\n\t\t)\n\t}\n\tif update.LastJob != nil {\n\t\tupdateExpr = updateExpr.Set(\n\t\t\texpression.Name(\"Workflow.lastJob\"),\n\t\t\texpression.Value(*update.LastJob),\n\t\t)\n\t}\n\n\tbuilder := expression.NewBuilder().WithUpdate(updateExpr)\n\n\t// add a condition expression to protect against events out of order and\n\t// accidentally setting a workflow to a non-terminal state if it is already in a terminal state\n\tif update.Status != nil && !store.TerminalState(*update.Status) {\n\t\tbuilder = builder.WithCondition(notTerminalStateCondition())\n\t}\n\n\texpr, err := builder.Build()\n\tif err != nil {\n\t\tvar unsetError expression.UnsetParameterError\n\t\tif errors.As(err, &unsetError) {\n\t\t\treturn fmt.Errorf(\"no updates provided to UpdateWorkflowAttributes\")\n\t\t}\n\t\treturn err\n\t}\n\tif _, err := d.ddb.UpdateItem(&dynamodb.UpdateItemInput{\n\t\tConditionExpression: expr.Condition(),\n\t\tExpressionAttributeNames: expr.Names(),\n\t\tExpressionAttributeValues: expr.Values(),\n\t\tKey: map[string]*dynamodb.AttributeValue{\"id\": {S: aws.String(workflowID)}},\n\t\tReturnValues: aws.String(dynamodb.ReturnValueNone),\n\t\tTableName: aws.String(d.workflowsTable()),\n\t\tUpdateExpression: expr.Update(),\n\t}); err != nil {\n\t\tif strings.Contains(err.Error(), \"conditional request failed\") {\n\t\t\treturn fmt.Errorf(\"%w: attempted to update workflow to state %q: %s\", store.ErrUpdatingWorkflowFromTerminalToNonTerminalState, *update.Status, err)\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "649388eedd8b63e1de877b45ce0585ac", "score": "0.43342006", "text": "func (w *WorkflowResource) WorkflowRunningHandler(rw http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tname := params[\"name\"]\n\tversion := 1\n\tversionRaw := req.URL.Query().Get(\"version\")\n\tstartTimeRaw := req.URL.Query().Get(\"start_time\")\n\tendTimeRaw := req.URL.Query().Get(\"end_time\")\n\tif versionRaw != \"\" {\n\t\ti, err := strconv.Atoi(versionRaw)\n\t\tif err != nil {\n\t\t\tw.Error(rw, fmt.Sprintf(\"Cannot convert to int: %v\", err), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tversion = i\n\t}\n\tif startTimeRaw != \"\" && endTimeRaw != \"\" {\n\t\tstartTime, err := utils.ParseUnixTimestamp(startTimeRaw)\n\t\tif err != nil {\n\t\t\tw.Error(rw, fmt.Sprintf(\"Cannot convert to time: %v\", err), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tendTime, err := utils.ParseUnixTimestamp(endTimeRaw)\n\t\tif err != nil {\n\t\t\tw.Error(rw, fmt.Sprintf(\"Cannot convert to time: %v\", err), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\twfIDs, err := w.executor.GetWorkflows(name, version, startTime, endTime)\n\t\tif err != nil {\n\t\t\tw.Error(rw, fmt.Sprintf(\"GetWorkflows error: %v\", err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.SuccessOK(rw, wfIDs)\n\t\treturn\n\t}\n\twfIDs, err := w.executor.GetRunningWorkflowIDs(name)\n\tif err != nil {\n\t\tw.Error(rw, fmt.Sprintf(\"GetRunningWorkflowIDs error: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.SuccessOK(rw, wfIDs)\n}", "title": "" }, { "docid": "bcd65cac785984a9016db329cb14d86c", "score": "0.43310562", "text": "func (s *CreateFlowTemplateInput) SetDefinition(v *DefinitionDocument) *CreateFlowTemplateInput {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "a52b38e0f1926643290efc5bc81e2a8c", "score": "0.4320308", "text": "func (d DynamoDB) SaveWorkflow(ctx context.Context, workflow models.Workflow) error {\n\tworkflow.CreatedAt = strfmt.DateTime(time.Now())\n\tworkflow.LastUpdated = workflow.CreatedAt\n\n\tdata, err := EncodeWorkflow(workflow)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = d.ddb.PutItemWithContext(ctx, &dynamodb.PutItemInput{\n\t\tTableName: aws.String(d.workflowsTable()),\n\t\tItem: data,\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#I\": aws.String(\"id\"),\n\t\t},\n\t\tConditionExpression: aws.String(\"attribute_not_exists(#I)\"),\n\t})\n\tif err != nil {\n\t\tif awsErr, ok := err.(awserr.Error); ok {\n\t\t\tif awsErr.Code() == dynamodb.ErrCodeConditionalCheckFailedException {\n\t\t\t\treturn store.NewConflict(workflow.ID)\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c9a484a32880a0a0029019e6f3603f99", "score": "0.43138102", "text": "func (mr *MockContextMockRecorder) UpdateWorkflowExecution(ctx, request interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateWorkflowExecution\", reflect.TypeOf((*MockContext)(nil).UpdateWorkflowExecution), ctx, request)\n}", "title": "" }, { "docid": "cd9c3690ab8fbb87318f7e1295f929aa", "score": "0.4288242", "text": "func (s *FlowTemplateDescription) SetDefinition(v *DefinitionDocument) *FlowTemplateDescription {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "247e70308b18cf0452962a8264215057", "score": "0.42846048", "text": "func (m *MockContext) UpdateWorkflowExecution(ctx context.Context, request *persistence.UpdateWorkflowExecutionRequest) (*persistence.UpdateWorkflowExecutionResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateWorkflowExecution\", ctx, request)\n\tret0, _ := ret[0].(*persistence.UpdateWorkflowExecutionResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "dc60a643dad18c5b598da39b36300e69", "score": "0.42706335", "text": "func (s *SystemInstanceDescription) SetDefinition(v *DefinitionDocument) *SystemInstanceDescription {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "26b7d895428a49c0af79baf6bad10491", "score": "0.42243257", "text": "func (s *UpdateSystemTemplateInput) SetDefinition(v *DefinitionDocument) *UpdateSystemTemplateInput {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "0a18d0464e2bdc7b640e16aeac1b4348", "score": "0.41972905", "text": "func (m *MockControllableContext) UpdateWorkflowExecution(ctx context.Context, request *persistence.UpdateWorkflowExecutionRequest) (*persistence.UpdateWorkflowExecutionResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateWorkflowExecution\", ctx, request)\n\tret0, _ := ret[0].(*persistence.UpdateWorkflowExecutionResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6a1cb7d0305268a7e323db5dd4886792", "score": "0.41686326", "text": "func (s *EntityDescription) SetDefinition(v *DefinitionDocument) *EntityDescription {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "4b55b7ff95eccba4796f48036adeb2ff", "score": "0.41521764", "text": "func (s *CreateSystemInstanceInput) SetDefinition(v *DefinitionDocument) *CreateSystemInstanceInput {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "ae5bdb7b7a876a39785eddb866155374", "score": "0.41416433", "text": "func Change(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\n\tvar uuid string\n\tif uuid = params[\"uuid\"]; uuid == \"\" {\n\t\tutils.HTTPResponse(w, http.StatusInternalServerError, \"Workflow's uuid was not passed\", false)\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tutils.HTTPResponse(w, http.StatusInternalServerError, \"It wasn't possible convert Request Body to JSON\", false)\n\t\treturn\n\t}\n\n\tvar status models.WorkflowStatus\n\terr = json.Unmarshal(body, &status)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tutils.HTTPResponse(w, http.StatusInternalServerError, \"An error was ocurred while updating workflow. Please, try again.\", false)\n\t\treturn\n\t}\n\n\tif status.Status == \"inserted\" || status.Status == \"consumed\" {\n\t\tsql := utils.BuildString(`UPDATE workflows SET \"status\" = '`, status.Status, `' WHERE \"uuid\" = '`, uuid, `'`)\n\n\t\t//Updating workflow's status in database\n\t\tstmt, err := database.Conn.Exec(sql)\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\tutils.HTTPResponse(w, http.StatusInternalServerError, \"An error was ocurred while updating data. Please, try again.\", false)\n\t\t\treturn\n\t\t}\n\n\t\t//Checking if workflow was updated successfully\n\t\trows, _ := stmt.RowsAffected()\n\t\tif rows == 0 {\n\t\t\tlog.Println(err.Error())\n\t\t\tutils.HTTPResponse(w, http.StatusInternalServerError, \"It wasn't possible to update workflow\", false)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tlog.Println(err.Error())\n\t\tutils.HTTPResponse(w, http.StatusInternalServerError, \"Invalid value for status. It must be 'inserted' or 'consumed'.\", false)\n\t\treturn\n\t}\n\n\tutils.HTTPResponse(w, http.StatusOK, \"Workflow updated successfully!\", false)\n}", "title": "" }, { "docid": "aa5f005a454d176e681848dfee48c776", "score": "0.4123351", "text": "func KitchenSinkWorkflowDefinition(t *testing.T) *models.WorkflowDefinition {\n\n\twfd, err := NewWorkflowDefinition(fmt.Sprintf(\"kitchensink-%s\", time.Now().Format(time.RFC3339Nano)),\n\t\tmodels.ManagerStepFunctions,\n\t\t&models.SLStateMachine{\n\t\t\tComment: \"description\",\n\t\t\tStartAt: \"start-state\",\n\t\t\tStates: map[string]models.SLState{\n\t\t\t\t\"start-state\": models.SLState{\n\t\t\t\t\tType: models.SLStateTypeTask,\n\t\t\t\t\tNext: \"second-state\",\n\t\t\t\t\tResource: \"fake-resource-1\",\n\t\t\t\t\tEnd: false,\n\t\t\t\t\tRetry: []*models.SLRetrier{{\n\t\t\t\t\t\tErrorEquals: []models.SLErrorEquals{\"States.ALL\"},\n\t\t\t\t\t\tMaxAttempts: swag.Int64(2),\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\t\"second-state\": models.SLState{\n\t\t\t\t\tType: models.SLStateTypeTask,\n\t\t\t\t\tNext: \"end-state\",\n\t\t\t\t\tResource: \"fake-resource-2\",\n\t\t\t\t\tEnd: false,\n\t\t\t\t\tRetry: []*models.SLRetrier{},\n\t\t\t\t},\n\t\t\t\t\"end-state\": models.SLState{\n\t\t\t\t\tType: models.SLStateTypeTask,\n\t\t\t\t\tResource: \"fake-resource-3\",\n\t\t\t\t\tEnd: true,\n\t\t\t\t\tRetry: []*models.SLRetrier{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tmap[string]interface{}{\n\t\t\t\"tag1\": \"val1\",\n\t\t\t\"tag2\": \"val2\",\n\t\t\t\"tag3\": \"val3\",\n\t\t},\n\t)\n\tassert.Nil(t, err)\n\n\treturn wfd\n}", "title": "" }, { "docid": "c716151e14c7c2a75de8c9e1bfe769ce", "score": "0.41173202", "text": "func (w *WorkflowTemplate) Update(data WorkflowTemplate) {\n\tw.Name = data.Name\n\tw.Slug = data.Slug\n\tw.GroupID = data.GroupID\n\tw.Description = data.Description\n\tw.Workflow = data.Workflow\n\tw.Parameters = data.Parameters\n\tw.Pipelines = data.Pipelines\n\tw.Applications = data.Applications\n\tw.Environments = data.Environments\n\tw.Version = w.Version + 1\n}", "title": "" }, { "docid": "c76e4e613bcf3847aee9b9a128e64319", "score": "0.409274", "text": "func (a FlowApi) UpdateFlow(processId string, flowId string, flowUpdateItem FlowUpdateItem) (*FlowItem, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Put\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/processes/{process_id}/flows/{flow_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"process_id\"+\"}\", fmt.Sprintf(\"%v\", processId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"flow_id\"+\"}\", fmt.Sprintf(\"%v\", flowId), -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 '(PasswordGrant)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"Authorization\"] = a.Configuration.GetAPIKeyWithPrefix(\"Authorization\")\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\t// body params\n\tlocalVarPostBody = &flowUpdateItem\n\tvar successPayload = new(FlowItem)\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: \"UpdateFlow\", 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 successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "title": "" }, { "docid": "6b424e70d408078edc2575fc29ce8409", "score": "0.40921998", "text": "func (g *Given) Workflow(text string) *Given {\n\tvar file string\n\tif strings.HasPrefix(text, \"@\") {\n\t\tfile = strings.TrimPrefix(text, \"@\")\n\t} else {\n\t\tf, err := ioutil.TempFile(\"\", \"argo_e2e\")\n\t\tif err != nil {\n\t\t\tg.t.Fatal(err)\n\t\t}\n\t\t_, err = f.Write([]byte(text))\n\t\tif err != nil {\n\t\t\tg.t.Fatal(err)\n\t\t}\n\t\terr = f.Close()\n\t\tif err != nil {\n\t\t\tg.t.Fatal(err)\n\t\t}\n\t\tfile = f.Name()\n\t}\n\t// read the file in\n\t{\n\t\tfile, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\tg.t.Fatal(err)\n\t\t}\n\t\tg.wf = &wfv1.Workflow{}\n\t\terr = yaml.Unmarshal(file, g.wf)\n\t\tif err != nil {\n\t\t\tg.t.Fatal(err)\n\t\t}\n\t\tif g.wf.GetLabels() == nil {\n\t\t\tg.wf.SetLabels(map[string]string{})\n\t\t}\n\t\tg.wf.GetLabels()[label] = \"true\"\n\t}\n\treturn g\n}", "title": "" }, { "docid": "d662301446a395db4dec7d379bfeb77f", "score": "0.4085844", "text": "func (s *CreateSystemTemplateInput) SetDefinition(v *DefinitionDocument) *CreateSystemTemplateInput {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "142f15e83bde876372732b95379afcfd", "score": "0.40770668", "text": "func (mr *MockBuildClientMockRecorder) UpdateDefinition(ctx, args interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateDefinition\", reflect.TypeOf((*MockBuildClient)(nil).UpdateDefinition), ctx, args)\n}", "title": "" }, { "docid": "3b681faecf5efc678bc2c33b0b115e0b", "score": "0.4073271", "text": "func (epuo *EquipmentPortUpdateOne) SetDefinition(e *EquipmentPortDefinition) *EquipmentPortUpdateOne {\n\treturn epuo.SetDefinitionID(e.ID)\n}", "title": "" }, { "docid": "bb32ef04c9070ec6bc90d8981ae9eef9", "score": "0.40461245", "text": "func UpdateMetadata(db gorp.SqlExecutor, workflowID int64, metadata sdk.Metadata) error {\n\tb, err := json.Marshal(metadata)\n\tif err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\tif _, err := db.Exec(\"update workflow set metadata = $1 where id = $2\", b, workflowID); err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bb32ef04c9070ec6bc90d8981ae9eef9", "score": "0.40461245", "text": "func UpdateMetadata(db gorp.SqlExecutor, workflowID int64, metadata sdk.Metadata) error {\n\tb, err := json.Marshal(metadata)\n\tif err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\tif _, err := db.Exec(\"update workflow set metadata = $1 where id = $2\", b, workflowID); err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "543a1020a068dbf41527d4147620665f", "score": "0.4044712", "text": "func (epu *EquipmentPortUpdate) SetDefinition(e *EquipmentPortDefinition) *EquipmentPortUpdate {\n\treturn epu.SetDefinitionID(e.ID)\n}", "title": "" }, { "docid": "0c7fc9a3b6f77f22ef9fd0066ad6f23b", "score": "0.40443748", "text": "func NewWorkflow(wfd *models.WorkflowDefinition, input string, namespace string, queue string, tags map[string]interface{}) *models.Workflow {\n\treturn &models.Workflow{\n\t\tWorkflowSummary: models.WorkflowSummary{\n\t\t\tID: uuid.NewV4().String(),\n\t\t\tCreatedAt: strfmt.DateTime(time.Now()),\n\t\t\tLastUpdated: strfmt.DateTime(time.Now()),\n\t\t\tWorkflowDefinition: wfd,\n\t\t\tStatus: models.WorkflowStatusQueued,\n\t\t\tNamespace: namespace,\n\t\t\tQueue: queue,\n\t\t\tInput: input,\n\t\t\tTags: tags,\n\t\t\tResolvedByUser: false,\n\t\t\tRetries: []string{},\n\t\t\tRetryFor: \"\",\n\t\t},\n\t\tJobs: []*models.Job{},\n\t}\n}", "title": "" }, { "docid": "3a78feebc8e66bba59bac73f99e32b8b", "score": "0.40297413", "text": "func (s *SystemTemplateDescription) SetDefinition(v *DefinitionDocument) *SystemTemplateDescription {\n\ts.Definition = v\n\treturn s\n}", "title": "" }, { "docid": "a2063e404615de8d066f604d3fd0c995", "score": "0.40090486", "text": "func (s *FrameworkStore) UpdateVersion(ctx context.Context, appId string, version *types.Version, cb func()) error {\n\tapp, err := s.GetApp(appId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif app == nil {\n\t\treturn ErrAppNotFound\n\t}\n\n\tvar storeActions []*types.StoreAction\n\tupdateVersionAction := &types.StoreAction{\n\t\tAction: types.StoreActionKindCreate,\n\t\tTarget: &types.StoreAction_Version{app.Version},\n\t}\n\tstoreActions = append(storeActions, updateVersionAction)\n\n\tversion.PerviousVersionID = app.Version.ID\n\tapp.Version = version\n\tupdateAppAction := &types.StoreAction{\n\t\tAction: types.StoreActionKindUpdate,\n\t\tTarget: &types.StoreAction_Application{app},\n\t}\n\tstoreActions = append(storeActions, updateAppAction)\n\n\treturn s.RaftNode.ProposeValue(ctx, storeActions, cb)\n}", "title": "" }, { "docid": "c4fc18f5d6938a7055ddfeccf92e4cdf", "score": "0.40089926", "text": "func (m *MockBuildClient) UpdateDefinition(ctx context.Context, args build.UpdateDefinitionArgs) (*build.BuildDefinition, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateDefinition\", ctx, args)\n\tret0, _ := ret[0].(*build.BuildDefinition)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7b3ba37058e526c8cb936b1d881ed497", "score": "0.40005797", "text": "func (m *executionManagerImpl) CreateWorkflowExecution(\n\tctx context.Context,\n\trequest *CreateWorkflowExecutionRequest,\n) (*CreateWorkflowExecutionResponse, error) {\n\n\tnewSnapshot := request.NewWorkflowSnapshot\n\tnewWorkflowXDCKVs, newWorkflowNewEvents, newHistoryDiff, err := m.serializeWorkflowEventBatches(\n\t\tctx,\n\t\trequest.ShardID,\n\t\trequest.NewWorkflowSnapshot.ExecutionInfo,\n\t\trequest.NewWorkflowEvents,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewSnapshot.ExecutionInfo.ExecutionStats.HistorySize += int64(newHistoryDiff.SizeDiff)\n\n\tif err := ValidateCreateWorkflowModeState(\n\t\trequest.Mode,\n\t\tnewSnapshot,\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := ValidateCreateWorkflowStateStatus(\n\t\tnewSnapshot.ExecutionState.State,\n\t\tnewSnapshot.ExecutionState.Status,\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\tserializedNewWorkflowSnapshot, err := m.SerializeWorkflowSnapshot(&newSnapshot)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewRequest := &InternalCreateWorkflowExecutionRequest{\n\t\tShardID: request.ShardID,\n\t\tRangeID: request.RangeID,\n\t\tMode: request.Mode,\n\t\tPreviousRunID: request.PreviousRunID,\n\t\tPreviousLastWriteVersion: request.PreviousLastWriteVersion,\n\t\tNewWorkflowSnapshot: *serializedNewWorkflowSnapshot,\n\t\tNewWorkflowNewEvents: newWorkflowNewEvents,\n\t}\n\n\tif _, err := m.persistence.CreateWorkflowExecution(ctx, newRequest); err != nil {\n\t\treturn nil, err\n\t}\n\tm.addXDCCacheKV(newWorkflowXDCKVs)\n\treturn &CreateWorkflowExecutionResponse{\n\t\tNewMutableStateStats: *statusOfInternalWorkflowSnapshot(\n\t\t\tserializedNewWorkflowSnapshot,\n\t\t\tnewHistoryDiff,\n\t\t),\n\t}, nil\n}", "title": "" }, { "docid": "88f9cbc105c03999df8584b9b37eaf88", "score": "0.39759183", "text": "func (w *WorkflowResource) WorkflowHandler(rw http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tworkflowID := params[\"workflow_id\"]\n\tincludeTasks := false\n\tif req.URL.Query().Get(\"include_tasks\") == \"1\" {\n\t\tincludeTasks = true\n\t}\n\tworkflow, err := w.service.GetExecutionStatus(workflowID, includeTasks)\n\tif err != nil {\n\t\tw.Error(rw, fmt.Sprintf(\"GetExecutionStatus error: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.SuccessOK(rw, workflow)\n}", "title": "" }, { "docid": "654256118986f2ed88d3fc788bdeb291", "score": "0.39665532", "text": "func (cli *CLI) CallWorkflowsUpdateStep() int {\n\treturn cli.PrintJSON(cli.api.WorkflowsUpdateStep(slackapi.WorkflowsUpdateStepInput{\n\t\tWorkflowStepExecuteID: flag.Arg(1),\n\t\tStepImageURL: flag.Arg(2),\n\t\tStepName: flag.Arg(3),\n\t}))\n}", "title": "" }, { "docid": "a2b7d1963f9477f06157f6cd3381f986", "score": "0.3965934", "text": "func (e *Endpoints) gittarPipelineDefinitionUpdate(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error) {\n\tvar req apistructs.GittarPushPayloadEvent\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\tlogrus.Errorf(\"gittarPipelineDefinitionUpdate decode error %v\", err)\n\t\treturn apierrors.ErrUpdatePipelineDefinition.InvalidParameter(err).ToResp(), nil\n\t}\n\n\tif err := e.pipeline.PipelineDefinitionUpdate(req); err != nil {\n\t\tlogrus.Errorf(\"gittarPipelineDefinitionUpdate pipelineDefinitionUpdate error %v\", err)\n\t\treturn apierrors.ErrUpdatePipelineDefinition.InternalError(err).ToResp(), nil\n\t}\n\n\treturn httpserver.OkResp(nil)\n}", "title": "" }, { "docid": "82ab60259419f5593e966d2c7484afeb", "score": "0.3955469", "text": "func (s *AssetTransferSmartContract) UpdateStep(ctx contractapi.TransactionContextInterface, stepID string, stepName string, stepOrder uint, actorType string, aditionalInfoMap []AditionalInfo) error {\n\tstepJSON, err := ctx.GetStub().GetState(\"STEP_\" + stepID)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to read the data from world state: %s\", err)\n\t}\n\n\tif stepJSON == nil {\n\t\treturn fmt.Errorf(\"The step %s does not exists\", stepID)\n\t}\n\n\tstep := Step{\n\t\tStepID: stepID,\n\t\tStepName: stepName,\n\t\tStepOrder: stepOrder,\n\t\tActorType: actorType,\n\t\tDeleted: false,\n\t\tAditionalInfoMap: aditionalInfoMap,\n\t}\n\n\tstepAsBytes, err := json.Marshal(step)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctx.GetStub().PutState(\"STEP_\"+stepID, stepAsBytes)\n}", "title": "" }, { "docid": "dbfc9e08c9379dda4371845c85d2db58", "score": "0.39535668", "text": "func (c *Client) UpdateFirewallPolicy(ctx context.Context, updateFirewallPolicy FirewallPolicyOptions) (*FirewallPolicy, error) {\n\treturn apiPut[FirewallPolicy](ctx, c, path.Join(firewallpolicyAPIPath, updateFirewallPolicy.ID), updateFirewallPolicy)\n}", "title": "" }, { "docid": "5e9f79f0b8467d318529336018c31606", "score": "0.39531824", "text": "func (c *Client) UpdateDeployment(deployment *appsv1.Deployment) (*appsv1.Deployment, error) {\n\tif err := c.initClient(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.apps.Deployments(deployment.Namespace).Update(context.TODO(), deployment, metav1.UpdateOptions{})\n}", "title": "" }, { "docid": "64ea5b5c4575e5ab069389f66db8896d", "score": "0.3945534", "text": "func (r *BusinessFlowRequest) Update(ctx context.Context, reqObj *BusinessFlow) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "64ea5b5c4575e5ab069389f66db8896d", "score": "0.3945534", "text": "func (r *BusinessFlowRequest) Update(ctx context.Context, reqObj *BusinessFlow) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "983a7d2fd02a8ca05a6978f5cf8b1c17", "score": "0.39377177", "text": "func (r *Revision) QueryWorkflow() *WorkflowQuery {\n\treturn (&RevisionClient{config: r.config}).QueryWorkflow(r)\n}", "title": "" }, { "docid": "58d81156423d825819d9e9f455a8cf41", "score": "0.39375344", "text": "func (t ThriftHandler) DescribeWorkflowExecution(ctx context.Context, request *shared.DescribeWorkflowExecutionRequest) (*shared.DescribeWorkflowExecutionResponse, error) {\n\tresponse, err := t.h.DescribeWorkflowExecution(ctx, thrift.ToDescribeWorkflowExecutionRequest(request))\n\treturn thrift.FromDescribeWorkflowExecutionResponse(response), thrift.FromError(err)\n}", "title": "" }, { "docid": "932e30f685ae780f8cda493fdf3ba472", "score": "0.3928161", "text": "func (adh *AdminHandler) deleteWorkflowExecution(\n\tctx context.Context,\n\trequest *adminservice.DeleteWorkflowExecutionRequest,\n) (_ *adminservice.DeleteWorkflowExecutionResponse, err error) {\n\tnamespaceID, err := adh.namespaceRegistry.GetNamespaceID(namespace.Name(request.GetNamespace()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\texecution := request.Execution\n\n\tshardID := common.WorkflowIDToHistoryShard(\n\t\tnamespaceID.String(),\n\t\texecution.GetWorkflowId(),\n\t\tadh.numberOfHistoryShards,\n\t)\n\tlogger := log.With(adh.logger,\n\t\ttag.WorkflowNamespace(request.Namespace),\n\t\ttag.WorkflowID(execution.WorkflowId),\n\t\ttag.WorkflowRunID(execution.RunId),\n\t)\n\n\tif execution.RunId == \"\" {\n\t\tresp, err := adh.persistenceExecutionManager.GetCurrentExecution(ctx, &persistence.GetCurrentExecutionRequest{\n\t\t\tShardID: shardID,\n\t\t\tNamespaceID: namespaceID.String(),\n\t\t\tWorkflowID: execution.WorkflowId,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texecution.RunId = resp.RunID\n\t}\n\n\tvar warnings []string\n\tvar branchTokens [][]byte\n\tvar startTime, closeTime *time.Time\n\tcassVisBackend := adh.visibilityMgr.HasStoreName(cassandra.CassandraPersistenceName)\n\n\tresp, err := adh.persistenceExecutionManager.GetWorkflowExecution(ctx, &persistence.GetWorkflowExecutionRequest{\n\t\tShardID: shardID,\n\t\tNamespaceID: namespaceID.String(),\n\t\tWorkflowID: execution.WorkflowId,\n\t\tRunID: execution.RunId,\n\t})\n\tif err != nil {\n\t\tif common.IsContextCanceledErr(err) || common.IsContextDeadlineExceededErr(err) {\n\t\t\treturn nil, err\n\t\t}\n\t\t// continue to deletion\n\t\twarnMsg := \"Unable to load mutable state when deleting workflow execution, \" +\n\t\t\t\"will skip deleting workflow history and cassandra visibility record\"\n\t\tlogger.Warn(warnMsg, tag.Error(err))\n\t\twarnings = append(warnings, fmt.Sprintf(\"%s. Error: %v\", warnMsg, err.Error()))\n\t} else {\n\t\t// load necessary information from mutable state\n\t\texecutionInfo := resp.State.GetExecutionInfo()\n\t\thistories := executionInfo.GetVersionHistories().GetHistories()\n\t\tbranchTokens = make([][]byte, 0, len(histories))\n\t\tfor _, historyItem := range histories {\n\t\t\tbranchTokens = append(branchTokens, historyItem.GetBranchToken())\n\t\t}\n\n\t\tif cassVisBackend {\n\t\t\tif resp.State.ExecutionState.State != enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED {\n\t\t\t\tstartTime = executionInfo.GetStartTime()\n\t\t\t} else if executionInfo.GetCloseTime() != nil {\n\t\t\t\tcloseTime = executionInfo.GetCloseTime()\n\t\t\t} else {\n\t\t\t\tcompletionEvent, err := adh.getWorkflowCompletionEvent(ctx, shardID, resp.State)\n\t\t\t\tif err != nil {\n\t\t\t\t\twarnMsg := \"Unable to load workflow completion event, will skip deleting visibility record\"\n\t\t\t\t\tadh.logger.Warn(warnMsg, tag.Error(err))\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\"%s. Error: %v\", warnMsg, err.Error()))\n\t\t\t\t} else {\n\t\t\t\t\tcloseTime = completionEvent.GetEventTime()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif !cassVisBackend || (startTime != nil || closeTime != nil) {\n\t\t// if using cass visibility, then either start or close time should be non-nil\n\t\t// NOTE: the deletion is best effort, for sql and cassandra visibility implementation,\n\t\t// we can't guarantee there's no update or record close request for this workflow since\n\t\t// visibility queue processing is async. Operator can call this api again to delete visibility\n\t\t// record again if this happens.\n\t\tif _, err := adh.historyClient.DeleteWorkflowVisibilityRecord(ctx, &historyservice.DeleteWorkflowVisibilityRecordRequest{\n\t\t\tNamespaceId: namespaceID.String(),\n\t\t\tExecution: execution,\n\t\t\tWorkflowStartTime: startTime,\n\t\t\tWorkflowCloseTime: closeTime,\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := adh.persistenceExecutionManager.DeleteCurrentWorkflowExecution(ctx, &persistence.DeleteCurrentWorkflowExecutionRequest{\n\t\tShardID: shardID,\n\t\tNamespaceID: namespaceID.String(),\n\t\tWorkflowID: execution.WorkflowId,\n\t\tRunID: execution.RunId,\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := adh.persistenceExecutionManager.DeleteWorkflowExecution(ctx, &persistence.DeleteWorkflowExecutionRequest{\n\t\tShardID: shardID,\n\t\tNamespaceID: namespaceID.String(),\n\t\tWorkflowID: execution.WorkflowId,\n\t\tRunID: execution.RunId,\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, branchToken := range branchTokens {\n\t\tif err := adh.persistenceExecutionManager.DeleteHistoryBranch(ctx, &persistence.DeleteHistoryBranchRequest{\n\t\t\tShardID: shardID,\n\t\t\tBranchToken: branchToken,\n\t\t}); err != nil {\n\t\t\twarnMsg := \"Failed to delete history branch, skip\"\n\t\t\tadh.logger.Warn(warnMsg, tag.WorkflowBranchID(string(branchToken)), tag.Error(err))\n\t\t\twarnings = append(warnings, fmt.Sprintf(\"%s. BranchToken: %v, Error: %v\", warnMsg, branchToken, err.Error()))\n\t\t}\n\t}\n\n\treturn &adminservice.DeleteWorkflowExecutionResponse{\n\t\tWarnings: warnings,\n\t}, nil\n}", "title": "" }, { "docid": "16f54d98ea697771a648f7505a1c923f", "score": "0.39061", "text": "func (v *PollForDecisionTaskResponse) GetWorkflowExecution() (o *shared.WorkflowExecution) {\n\tif v != nil && v.WorkflowExecution != nil {\n\t\treturn v.WorkflowExecution\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3fa11fbc04fdea48c02301727851a3d1", "score": "0.38924903", "text": "func DeleteWorkflow(id int64) (err error) {\n\to := orm.NewOrm()\n\tv := Workflow{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(&Workflow{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": "26750d1ca7aff67fa51dea2e42c0a5a8", "score": "0.3892089", "text": "func (p *Packer) PackWorkflow(path string) (*WorkflowJSON, error) {\n\t// workflow gets packed into graph\n\n\tif _, err := p.PackCWLFile(path, \"\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// error if multiple cwl versions specified in workflow files\n\tif len(p.VersionCheck) > 1 {\n\t\tfmt.Println(\"pack operation failed - incompatible versions specified\")\n\t\tfmt.Println(\"version breakdown:\")\n\t\tPrintJSON(p.VersionCheck)\n\t\treturn nil, fmt.Errorf(\"version error\")\n\t}\n\n\t// get the one version listed\n\tvar cwlVersion string\n\tfor ver := range p.VersionCheck {\n\t\tcwlVersion = ver\n\t}\n\n\twf := &WorkflowJSON{\n\t\tGraph: p.Graph,\n\t\tCWLVersion: cwlVersion,\n\t}\n\treturn wf, nil\n}", "title": "" }, { "docid": "2a1fe244de285293b23bb1d4d93d28d4", "score": "0.38897997", "text": "func (api *API) UpdateFirewallRule(ctx context.Context, zoneID string, firewallRule FirewallRule) (FirewallRule, error) {\n\tif firewallRule.ID == \"\" {\n\t\treturn FirewallRule{}, errors.Errorf(\"firewall rule ID cannot be empty\")\n\t}\n\n\turi := fmt.Sprintf(\"/zones/%s/firewall/rules/%s\", zoneID, firewallRule.ID)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodPut, uri, firewallRule)\n\tif err != nil {\n\t\treturn FirewallRule{}, err\n\t}\n\n\tvar firewallRuleResponse FirewallRuleResponse\n\terr = json.Unmarshal(res, &firewallRuleResponse)\n\tif err != nil {\n\t\treturn FirewallRule{}, errors.Wrap(err, errUnmarshalError)\n\t}\n\n\treturn firewallRuleResponse.Result, nil\n}", "title": "" }, { "docid": "ccaf5c8ddf5f5ee3fef757d8843c6b60", "score": "0.38848937", "text": "func TestWorkflowCreate(t *testing.T) {\n\tctx, cancelFn := context.WithTimeout(context.Background(), testTimeout)\n\tdefer cancelFn()\n\tclient := setup(ctx)\n\n\t// Test workflow creation\n\tspec := &types.WorkflowSpec{\n\t\tApiVersion: types.WorkflowAPIVersion,\n\t\tOutputTask: \"fakeFinalTask\",\n\t\tTasks: map[string]*types.TaskSpec{\n\t\t\t\"fakeFinalTask\": {\n\t\t\t\tFunctionRef: \"noop\",\n\t\t\t},\n\t\t},\n\t}\n\twf, err := client.Workflow.CreateSync(ctx, spec)\n\tdefer client.Workflow.Delete(ctx, wf.Metadata)\n\tassert.NoError(t, err)\n\tassert.NotNil(t, wf)\n\tassert.NotEmpty(t, wf.ID())\n\tutil.AssertProtoEqual(t, wf.Spec, spec)\n\tassert.Equal(t, wf.Status.Status, types.WorkflowStatus_READY)\n\n\t// Test workflow list\n\tl, err := client.Workflow.List(ctx, &empty.Empty{})\n\tassert.NoError(t, err)\n\tif len(l.Workflows) != 1 || l.Workflows[0] != wf.ID() {\n\t\tt.Errorf(\"Listed workflows '%v' did not match expected workflow '%s'\", l.Workflows, wf.ID())\n\t}\n}", "title": "" }, { "docid": "6e628d6972ce6137929ea3fd2643eaef", "score": "0.38835582", "text": "func (v *RecordChildExecutionCompletedRequest) GetWorkflowExecution() (o *WorkflowExecution) {\n\tif v != nil && v.WorkflowExecution != nil {\n\t\treturn v.WorkflowExecution\n\t}\n\treturn\n}", "title": "" }, { "docid": "38d68b794399ce8fa7405546a9a3858e", "score": "0.38782066", "text": "func versionDefinition(failIfNotVersion bool) (*design.APIVersionDefinition, bool) {\n\ta, ok := ctxStack.current().(*design.APIVersionDefinition)\n\tif !ok && failIfNotVersion {\n\t\tincompatibleDSL(caller())\n\t}\n\treturn a, ok\n}", "title": "" }, { "docid": "d189da78cda7a66b365a164d122a57d2", "score": "0.3875388", "text": "func (c *CloudAPI) UpdateFirewallRule(fwRuleID, rule string, enabled bool) (*cloudapi.FirewallRule, error) {\n\tif err := c.ProcessFunctionHook(c, fwRuleID, rule, enabled); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, r := range c.firewallRules {\n\t\tif strings.EqualFold(r.Id, fwRuleID) {\n\t\t\tr.Rule = rule\n\t\t\tr.Enabled = enabled\n\t\t\treturn r, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Firewall rule %s not found\", fwRuleID)\n}", "title": "" }, { "docid": "48c66cb40493c8b044bc42384e6d9495", "score": "0.38737363", "text": "func (a *Client) UpdateDeployment(params *UpdateDeploymentParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateDeploymentOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateDeploymentParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"updateDeployment\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/deployments/{deploymentId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &UpdateDeploymentReader{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.(*UpdateDeploymentOK)\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 updateDeployment: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "bfe04405273143925a876c0f8363a2a6", "score": "0.3867737", "text": "func UpdateWord(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\tvar word models.WordJSON\n\terr := decoder.Decode(&word)\n\n\tif err != nil {\n\t\thttpext.AbortAPI(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tword, err = words.Update(word, r)\n\n\tif err != nil {\n\t\thttpext.AbortAPI(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\thttpext.SuccessDataAPI(w, \"Ok\", word)\n}", "title": "" }, { "docid": "6431dfeb58ca9bb8f9db524afcef2918", "score": "0.3854616", "text": "func (mr *MockControllerMockRecorder) NewWorkflowDefinition(ctx, i interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"NewWorkflowDefinition\", reflect.TypeOf((*MockController)(nil).NewWorkflowDefinition), ctx, i)\n}", "title": "" }, { "docid": "aed2083edbfaeb13f7185eb33b400c5a", "score": "0.38277635", "text": "func DefineWorkflow(workflow *flow.Workflow, context *flow.Context) error {\n\tdag := workflow.Dag()\n\tdag.Node(\"node1\", node1)\n\treturn nil\n}", "title": "" }, { "docid": "02fa303baa7e1fc759e222a50f55e6a7", "score": "0.3824103", "text": "func (m *RefMutation) SetWorkflowID(id uuid.UUID) {\n\tm.workflow = &id\n}", "title": "" }, { "docid": "4a7a0276f2d5cc2c9cc7b7254612ed18", "score": "0.3823238", "text": "func (c *Client) UpdateFirewallRule(fwRuleID string, opts CreateFwRuleOpts) (*FirewallRule, error) {\n\tvar resp FirewallRule\n\treq := request{\n\t\tmethod: client.POST,\n\t\turl: makeURL(apiFirewallRules, fwRuleID),\n\t\treqValue: opts,\n\t\tresp: &resp,\n\t}\n\tif _, err := c.sendRequest(req); err != nil {\n\t\treturn nil, errors.Newf(err, \"failed to update firewall rule with id %s to %s\", fwRuleID, opts.Rule)\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "9d8a59b3ec071dc9298e4f6e4f8f5225", "score": "0.38122913", "text": "func (v *RecordActivityTaskStartedRequest) GetWorkflowExecution() (o *WorkflowExecution) {\n\tif v != nil && v.WorkflowExecution != nil {\n\t\treturn v.WorkflowExecution\n\t}\n\treturn\n}", "title": "" }, { "docid": "5ced4de85d428ad5d9d7f1fa90cd85a4", "score": "0.38071075", "text": "func (in *Workflow) DeepCopy() *Workflow {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Workflow)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5ced4de85d428ad5d9d7f1fa90cd85a4", "score": "0.38071075", "text": "func (in *Workflow) DeepCopy() *Workflow {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Workflow)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3b4631180934ecbc4c0370e2eaab1011", "score": "0.3805517", "text": "func (d DynamoDB) GetWorkflowDefinitions(ctx context.Context) ([]models.WorkflowDefinition, error) {\n\t// Scan returns the entire table\n\tresults, err := d.ddb.ScanWithContext(ctx, &dynamodb.ScanInput{\n\t\tConsistentRead: aws.Bool(true),\n\t\tTableName: aws.String(d.latestWorkflowDefinitionsTable()),\n\t})\n\tif err != nil {\n\t\treturn []models.WorkflowDefinition{}, err\n\t}\n\titems := results.Items\n\tlastEvaluatedKey := results.LastEvaluatedKey\n\tfor len(lastEvaluatedKey) > 0 {\n\t\tresults, err = d.ddb.ScanWithContext(ctx, &dynamodb.ScanInput{\n\t\t\tExclusiveStartKey: lastEvaluatedKey,\n\t\t\tConsistentRead: aws.Bool(true),\n\t\t\tTableName: aws.String(d.latestWorkflowDefinitionsTable()),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn []models.WorkflowDefinition{}, err\n\t\t}\n\t\titems = append(items, results.Items...)\n\t\tlastEvaluatedKey = results.LastEvaluatedKey\n\t}\n\treturn d.dynamoItemsToWorkflowDefinitions(items)\n}", "title": "" }, { "docid": "0785bdb2371d6e94b2478026ee8702f6", "score": "0.37953386", "text": "func (ops *Operations) GetWorkflowAPIAnswer(wg lib.WebGetter, path string) (response *WorkflowAPIAnswer, err error) {\n\turl := path + \"/wfapi/\"\n\tresponse = new(WorkflowAPIAnswer)\n\terr = wg.DecodeRestJSON(response, url)\n\treturn\n}", "title": "" }, { "docid": "ca0db2d6ffbb3e0f6c7e22156583d9d6", "score": "0.37871644", "text": "func (o StatefulSetStatusPatchOutput) UpdateRevision() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StatefulSetStatusPatch) *string { return v.UpdateRevision }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7e852313596415919625b726e7600b15", "score": "0.37842432", "text": "func (m *RevisionMutation) SetWorkflowID(id uuid.UUID) {\n\tm.workflow = &id\n}", "title": "" }, { "docid": "2a310ba888814d8ad6f81af88c6fb6e3", "score": "0.3783893", "text": "func (v *ScheduleDecisionTaskRequest) GetWorkflowExecution() (o *WorkflowExecution) {\n\tif v != nil && v.WorkflowExecution != nil {\n\t\treturn v.WorkflowExecution\n\t}\n\treturn\n}", "title": "" }, { "docid": "bfc83efe11fbfaf668e3dce4b430d953", "score": "0.37830094", "text": "func (r *Etcd) UpdateDeployment(deployment *api.Deployment) error {\n\terr := r.SetObj(makeDeploymentKey(deployment.ID), deployment)\n\treturn etcderr.InterpretUpdateError(err, \"deployment\", deployment.ID)\n}", "title": "" }, { "docid": "8357a10cefcb090b250c0ad613bf4133", "score": "0.37814057", "text": "func (t ThriftHandler) ResetWorkflowExecution(ctx context.Context, request *shared.ResetWorkflowExecutionRequest) (*shared.ResetWorkflowExecutionResponse, error) {\n\tresponse, err := t.h.ResetWorkflowExecution(ctx, thrift.ToResetWorkflowExecutionRequest(request))\n\treturn thrift.FromResetWorkflowExecutionResponse(response), thrift.FromError(err)\n}", "title": "" }, { "docid": "704bc641f4f21e3730fbdb1edd201b4d", "score": "0.37795982", "text": "func (v *RemoveSignalMutableStateRequest) GetWorkflowExecution() (o *WorkflowExecution) {\n\tif v != nil && v.WorkflowExecution != nil {\n\t\treturn v.WorkflowExecution\n\t}\n\treturn\n}", "title": "" }, { "docid": "85724222dd3dd0b62bef5ce57612f960", "score": "0.37776768", "text": "func Write(writer io.Writer, workflow Workflow) error {\n\tb, err := yaml.Marshal(&workflow)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = writer.Write(b)\n\treturn err\n}", "title": "" }, { "docid": "070c64ddf788f647256c691a4d0dc942", "score": "0.37753257", "text": "func WorkflowStatus(wf *wfv1.Workflow) wfv1.NodePhase {\n\tswitch wf.Status.Phase {\n\tcase wfv1.NodeRunning:\n\t\tif util.IsWorkflowSuspended(wf) {\n\t\t\treturn \"Running (Suspended)\"\n\t\t}\n\t\treturn wf.Status.Phase\n\tcase wfv1.NodeFailed:\n\t\tif wf.Spec.Shutdown != \"\" {\n\t\t\treturn \"Failed (Terminated)\"\n\t\t}\n\t\treturn wf.Status.Phase\n\tcase \"\", wfv1.NodePending:\n\t\tif !wf.ObjectMeta.CreationTimestamp.IsZero() {\n\t\t\treturn wfv1.NodePending\n\t\t}\n\t\treturn \"Unknown\"\n\tdefault:\n\t\treturn wf.Status.Phase\n\t}\n}", "title": "" }, { "docid": "bab1ea61e5945cdc40ee8ddc15e2b2a0", "score": "0.37650466", "text": "func (o *PostWorkflowWorkflowInfosParams) WithBody(body *models.WorkflowWorkflowInfo) *PostWorkflowWorkflowInfosParams {\n\to.SetBody(body)\n\treturn o\n}", "title": "" }, { "docid": "56f86c1fca2809edfacec91d55878aa9", "score": "0.37576216", "text": "func (v *ReplicateEventsV2Request) GetWorkflowExecution() (o *WorkflowExecution) {\n\tif v != nil && v.WorkflowExecution != nil {\n\t\treturn v.WorkflowExecution\n\t}\n\treturn\n}", "title": "" }, { "docid": "0ea96bb6608c97ba99666f8e2bd751d0", "score": "0.3752795", "text": "func (c *ChaosWorkflowService) ProcessWorkflow(workflow *model.ChaosWorkFlowRequest) (*model.ChaosWorkFlowRequest, *dbSchemaWorkflow.ChaosWorkflowType, error) {\n\targs := c.Called(workflow)\n\treturn args.Get(0).(*model.ChaosWorkFlowRequest), args.Get(1).(*dbSchemaWorkflow.ChaosWorkflowType), args.Error(2)\n}", "title": "" }, { "docid": "496c7633464827397c900fbcb833931c", "score": "0.3746721", "text": "func (rc *RefCreate) SetWorkflowID(id uuid.UUID) *RefCreate {\n\trc.mutation.SetWorkflowID(id)\n\treturn rc\n}", "title": "" }, { "docid": "c3530d70f75750ed4be772347504afd3", "score": "0.37464678", "text": "func (w *Workflow) 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 workflowProperties WorkflowProperties\n\t\t\t\terr = json.Unmarshal(*v, &workflowProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tw.WorkflowProperties = &workflowProperties\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\tw.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\tw.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\tw.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\tw.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\tw.Tags = tags\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "478db324f4f71b0e2904201fd4330053", "score": "0.37379882", "text": "func (e RevisionEdges) WorkflowOrErr() (*Workflow, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Workflow == nil {\n\t\t\t// The edge workflow was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: workflow.Label}\n\t\t}\n\t\treturn e.Workflow, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"workflow\"}\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": "a15338e9c79f4ad5e29516fc8ea494e4", "score": "0.0", "text": "func (s DescribeAssessmentRunsInput) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "5a7ed8ec1b08670f51f2b47f2a75b0a4", "score": "0.6014045", "text": "func (p PlatformMember) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.5967518", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59667146", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59667146", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59667146", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "accd4137f896762440eab638351d91b7", "score": "0.5899865", "text": "func (s ExtraParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9f8a378296cb872e44ee10bc37ba985e", "score": "0.58929694", "text": "func (v *Parameter) String() string {\n\tfrom := v.Parent().relPkg()\n\treturn fmt.Sprintf(\"parameter %s : %s\", v.Name(), relType(v.Type(), from))\n}", "title": "" }, { "docid": "8c2d660f8b90ffb29b2d9a5b6f60c219", "score": "0.58916354", "text": "func (x Gvk) String() string {\n\tg := x.Group\n\tif g == \"\" {\n\t\tg = noGroup\n\t}\n\tv := x.Version\n\tif v == \"\" {\n\t\tv = noVersion\n\t}\n\tk := x.Kind\n\tif k == \"\" {\n\t\tk = noKind\n\t}\n\treturn strings.Join([]string{k, v, g}, fieldSep)\n}", "title": "" }, { "docid": "3c9cce961816c604d204076ed3d163e9", "score": "0.589156", "text": "func (p *Param) String() string {\n\treturn fmt.Sprintf(\"%s %s\", p.Type(), p.Ident())\n}", "title": "" }, { "docid": "6c50827d3c293a84af831c38d2aaae8a", "score": "0.5856803", "text": "func (a *API) String() string {\n\treturn fmt.Sprintf(\"v%d ≤ [%2d] %s ≤ v%d\", a.MinVersion, a.Key, a.Name, a.MaxVersion)\n}", "title": "" }, { "docid": "f561ee4f92401e31acc5e59bce3355b6", "score": "0.57987785", "text": "func (xp XParam) String() string {\n\treturn xp.Key + \"=\" + xp.Value\n}", "title": "" }, { "docid": "efe1a7c626f546ca34a4646e38f6f960", "score": "0.57863003", "text": "func (p PlatformMembers) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "b9d345cb612fe6d8ed84b53f53c008bf", "score": "0.57604825", "text": "func (t testAPI) String() string {\n\treturn fmt.Sprintf(\"%v.%v\", t.component, t.name)\n}", "title": "" }, { "docid": "84e80811963b163caee57474a9f39879", "score": "0.5746791", "text": "func (t *OpenApiStruct)String()string{\n\tif t.Type != \"\" {\n\t\treturn fmt.Sprintf(\"\\ntype %v %v \\n\", t.Name, t.Type)\n\t}\n\n\tvar str string\n\tif t.Fields != nil {\n\t\tstr = fmt.Sprintf(\"type %v struct { \\n\", t.Name)\n\n\t\tfor _,f := range t.Fields {\n\t\t\ttheType := f.Type\n\n\n\t\t\tif f.IsStructType && !f.IsMust && !f.IsArray {\n\t\t\t\ttheType = \"*\" + theType\n\t\t\t}\n\n\t\t\tif f.IsArray {\n\t\t\t\ttheType = \"[]\"+theType\n\t\t\t}\n\n\n\t\t\tstr += fmt.Sprintf(\n\t\t\t\t\"\\t%-20v %-20v %v\\n\", f.Name, theType, f.Tag)\n\n\t\t}\n\n\t\tstr += \"\\n}\"\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "c6798f40a796dba3d6f0c21300bd7cd9", "score": "0.5707343", "text": "func (s RequestBypassInterfaceStruct) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d7fc95d606254134e955842b97b614bb", "score": "0.569643", "text": "func (p scenarioParam) String() string {\n\treturn fmt.Sprintf(\"scenario %q with max. %d items and %d orders\", p.Id, p.Items, p.Orders)\n}", "title": "" }, { "docid": "12383bd99ec53e6acf25dd3d44405b3b", "score": "0.5687273", "text": "func WriteGoString(\n\tvalue interface{},\n\tuseGoStringer bool,\n\tindentAt int,\n\tbuf *bytes.Buffer,\n) {\n\t// write multiple strings to buffer\n\tws := func(a ...string) {\n\t\tfor _, s := range a {\n\t\t\tbuf.WriteString(s)\n\t\t}\n\t}\n\twriteGoString := func(value interface{}) {\n\t\tWriteGoString(value, useGoStringer, indentAt, buf)\n\t}\n\tif value == nil {\n\t\tws(\"nil\")\n\t\treturn\n\t}\n\tif useGoStringer {\n\t\tswitch v := value.(type) {\n\t\tcase GoStringerEx:\n\t\t\t{\n\t\t\t\tws(v.GoStringEx(indentAt))\n\t\t\t\treturn\n\t\t\t}\n\t\tcase fmt.GoStringer:\n\t\t\tws(v.GoString())\n\t\t\treturn\n\t\t}\n\t}\n\tv := reflect.ValueOf(value)\n\tt := reflect.TypeOf(value)\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\t{\n\t\t\tif v.Bool() {\n\t\t\t\tws(\"true\")\n\t\t\t} else {\n\t\t\t\tws(\"false\")\n\t\t\t}\n\t\t\treturn\n\t\t}\n\tcase reflect.Int, reflect.Int64, reflect.Int32,\n\t\treflect.Int16, reflect.Int8:\n\t\t{\n\t\t\tws(String(v.Int()))\n\t\t\treturn\n\t\t}\n\tcase reflect.Uint, reflect.Uint64, reflect.Uint32,\n\t\treflect.Uint16, reflect.Uint8:\n\t\t{\n\t\t\tws(String(v.Uint()))\n\t\t\treturn\n\t\t}\n\tcase reflect.Uintptr:\n\t\t{\n\t\t\t// TODO: handle Uintptr\n\t\t\tbreak\n\t\t}\n\tcase reflect.Float64, reflect.Float32:\n\t\t{\n\t\t\tws(String(v.Float()))\n\t\t\treturn\n\t\t}\n\tcase reflect.Complex64, reflect.Complex128, reflect.Array,\n\t\treflect.Chan, reflect.Func, reflect.Interface:\n\t\t{\n\t\t\t// TODO: handle multiple types\n\t\t\tbreak\n\t\t}\n\tcase reflect.Map:\n\t\t{\n\t\t\tws(\"map[\", t.Key().String(), \"]\", t.Elem().String(), \"{\")\n\t\t\t//\n\t\t\t// since MapKeys are returned in no specific order,\n\t\t\t// append each key-value in map to a string array\n\t\t\t// then sort it to ensure the result is consistent\n\t\t\tlines := make([]string, 0, v.Len())\n\t\t\tfor _, key := range v.MapKeys() {\n\t\t\t\tlines = append(lines,\n\t\t\t\t\tTabSpace+GoString(key.Interface())+\": \"+\n\t\t\t\t\t\tGoString(v.MapIndex(key).Interface())+\",\")\n\t\t\t}\n\t\t\tsort.Strings(lines)\n\t\t\t//\n\t\t\t// write out the array\n\t\t\tfor _, s := range lines {\n\t\t\t\tws(\"\\n\", s)\n\t\t\t}\n\t\t\tws(\"\\n}\")\n\t\t\treturn\n\t\t}\n\tcase reflect.Ptr:\n\t\t{\n\t\t\twriteGoString(v.Elem().Interface())\n\t\t\treturn\n\t\t}\n\tcase reflect.Slice:\n\t\t{\n\t\t\tws(t.String(), \"{\")\n\t\t\tmanyLines := v.Len() > 0 && v.Index(0).Kind() == reflect.Slice\n\t\t\tfor i, n := 0, v.Len(); i < n; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tws(\",\")\n\t\t\t\t}\n\t\t\t\tif manyLines {\n\t\t\t\t\tws(\"\\n\", TabSpace)\n\t\t\t\t} else if i > 0 {\n\t\t\t\t\tws(\" \")\n\t\t\t\t}\n\t\t\t\twriteGoString(v.Index(i).Interface())\n\t\t\t}\n\t\t\tif manyLines {\n\t\t\t\tws(\",\\n\")\n\t\t\t}\n\t\t\tws(\"}\")\n\t\t\treturn\n\t\t}\n\tcase reflect.String:\n\t\t{\n\t\t\tws(`\"`, strings.ReplaceAll(value.(string), `\"`, `\\\"`), `\"`)\n\t\t\treturn\n\t\t}\n\tcase reflect.Struct:\n\t\t{\n\t\t\tws(t.String(), \"{\")\n\t\t\tfor i, n := 0, t.NumField(); i < n; i++ {\n\t\t\t\tif !v.Field(i).CanInterface() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif i > 0 {\n\t\t\t\t\tws(\", \")\n\t\t\t\t}\n\t\t\t\tws(t.Field(i).Name, \": \")\n\t\t\t\twriteGoString(v.Field(i).Interface())\n\t\t\t}\n\t\t\tws(\"}\")\n\t\t\treturn\n\t\t}\n\tcase reflect.UnsafePointer:\n\t\tbreak // TODO: reflect.UnsafePointer\n\t}\n\t// finally, try using fmt.Stringer (treat value as a string)\n\tif v, ok := value.(fmt.Stringer); ok {\n\t\tws(GoString(v.String()))\n\t\treturn\n\t}\n\t// if value is still not processed, log an error, try to use fmt.Sprint()\n\tmod.Error(\"Type\", t, \"(kind:\", v.Kind(), \") not handled:\", value)\n\tws(\"(\", fmt.Sprint(value), \")\")\n}", "title": "" }, { "docid": "87cd485826e603a9141e4979e044d1c1", "score": "0.5684485", "text": "func (pt ParamType) String() string {\n\tswitch pt {\n\tcase SignatureType:\n\t\treturn \"Signature\"\n\tcase BoolType:\n\t\treturn \"Boolean\"\n\tcase IntegerType:\n\t\treturn \"Integer\"\n\tcase Hash160Type:\n\t\treturn \"Hash160\"\n\tcase Hash256Type:\n\t\treturn \"Hash256\"\n\tcase ByteArrayType:\n\t\treturn \"ByteArray\"\n\tcase PublicKeyType:\n\t\treturn \"PublicKey\"\n\tcase StringType:\n\t\treturn \"String\"\n\tcase ArrayType:\n\t\treturn \"Array\"\n\tcase MapType:\n\t\treturn \"Map\"\n\tcase InteropInterfaceType:\n\t\treturn \"InteropInterface\"\n\tcase VoidType:\n\t\treturn \"Void\"\n\tcase AnyType:\n\t\treturn \"Any\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "e8521db3a320a6453fa167795cf50cdb", "score": "0.56792593", "text": "func (s TeamMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e74ecbef4dcc68d074ac0c3b5ab75461", "score": "0.56670856", "text": "func (n NetworkMember) String() string {\n\treturn fmt.Sprintf(\"Endpoint: %s, InternalEndpoint: %s, PKI-ID: %s, Metadata: %x\", n.Endpoint, n.InternalEndpoint, n.PKIid, n.Metadata)\n}", "title": "" }, { "docid": "1b0dbc3cc319784ac96fd8b147a7eac9", "score": "0.56633645", "text": "func (s BypassInterface) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0dad5672418287d6d5aa396621f0f462", "score": "0.5656504", "text": "func (s GlobalClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e41a2f5fac11d92fa3c54a77427719ef", "score": "0.563906", "text": "func (params *Params) String() string {\n\tvar buf *C.char\n\tvar bufLen C.size_t\n\tif C.param_out_str_wrapper(&buf, &bufLen, params.cptr) == 0 {\n\t\treturn \"\"\n\t}\n\tstr := C.GoStringN(buf, C.int(bufLen))\n\tC.free(unsafe.Pointer(buf))\n\treturn str\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.56296515", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.56296515", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "7d25457a006edc37216b672b52731c92", "score": "0.5624007", "text": "func (s NiftyModifyWebProxyAttributeInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "0832fb0c89643238da7b4cd553a2fbee", "score": "0.56185085", "text": "func (b BandMember) String() string {\n\tjb, _ := json.Marshal(b)\n\treturn string(jb)\n}", "title": "" }, { "docid": "47cc9a93c4338f42f76e864154893e65", "score": "0.5599384", "text": "func (field ExtraField) String() string {\n\treturn field.Format(field.Name, field.Value)\n}", "title": "" }, { "docid": "e8ec90c7d3803454fa26a1609fe712fe", "score": "0.5573883", "text": "func (s ConformancePackInputParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3a6c060abdf30b99370c54f941b39db7", "score": "0.55560374", "text": "func (p NamedParam) String() string {\n\treturn fmt.Sprintf(\"$%s\", string(p))\n}", "title": "" }, { "docid": "757f8c625b42d3482ed24fcf69ec5e32", "score": "0.55471396", "text": "func (s NiftyModifyWebProxyAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "cac1759c5772fef91986aa9caec00833", "score": "0.5545551", "text": "func (a Attribute) String() string {\n\treturn fmt.Sprintf(\"\\t%s %s `json:\\\"%s\\\"`\", a.Ident.Pascalize(), a.GoType, a.Ident.Underscore())\n}", "title": "" }, { "docid": "bf32380c366315640028bf4a1f06d05d", "score": "0.55443805", "text": "func (params CheckerParams) String(pname string) string { return params[pname].Value.(string) }", "title": "" }, { "docid": "8e43cb2448e6938019f925ec4fd727f4", "score": "0.5525045", "text": "func (p provider) String() string {\n\treturn fmt.Sprintf(\"&provider{\\n%s,\\n%s\\n}\",\n\t\tindent(fmt.Sprintf(\"constructor: %s\", reflect.TypeOf(p.constructor)), 1),\n\t\tindent(fmt.Sprintf(\"argPtrs: %s\", p.fmtArgPtrs()), 1),\n\t)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55222315", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55222315", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55222315", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "22e6b75d4caabd7515ea4b7a6d047fd0", "score": "0.5513251", "text": "func (a AdmissionPluginArg) String() string {\n\treturn string(a)\n}", "title": "" }, { "docid": "534004fcc19377090dc7e89c742df8b2", "score": "0.55033165", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n NewMappingFee: %s`, p.NewMappingFee.String())\n}", "title": "" }, { "docid": "d4a5f9801967f366a83c3a7cd907c242", "score": "0.54934376", "text": "func (s NiftyModifyVpnGatewayAttributeInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "0748d04cf625e4ff758e26abfe905dae", "score": "0.5490268", "text": "func (s RequestParametersStruct) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eb2660481053d3795da4b69c08252e85", "score": "0.54764694", "text": "func (c ClassMembership) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "27d6dcbcc678aa7e58f8d39794716f77", "score": "0.54760146", "text": "func (o NvmeSubsystemCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "ab66a767551ab4d7b7f8e4f3293ea242", "score": "0.54506576", "text": "func (s NiftyModifyVpnGatewayAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "49127f92f7df69f150120055495de7f9", "score": "0.5449807", "text": "func (s RequestVpnGatewayStruct) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5e6bced0fe405449b48bd5f2e2d9aacf", "score": "0.54497206", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`\n\t// TODO: Return all the params as a string\n\t`)\n}", "title": "" }, { "docid": "3604a1d12813ce519872a998508d98c7", "score": "0.5447674", "text": "func (s GetMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5645b98d27ab43fcddf45cf0f14ffaee", "score": "0.54372305", "text": "func (v Version) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "8f6fa5ebe15736bba406379030eb7037", "score": "0.54274625", "text": "func (b BandMembers) String() string {\n\tjb, _ := json.Marshal(b)\n\treturn string(jb)\n}", "title": "" }, { "docid": "cd4f60f952746fb0640f5fc484e2a616", "score": "0.5415491", "text": "func (o NvmeSubsystemInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "52813ac5ae2108fcca313f381f978567", "score": "0.5402625", "text": "func (c ClassMemberships) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "04033eaaa50a21abe710eb55690938ea", "score": "0.5402429", "text": "func (n *Parameter) String() string {\n\tif n.Ident == nil {\n\t\treturn n.Type.String()\n\t}\n\tif n.Type == nil {\n\t\treturn n.Ident.Name\n\t}\n\treturn n.Ident.Name + \" \" + n.Type.String()\n}", "title": "" }, { "docid": "70140ac87aff30abd20b69092ccac057", "score": "0.540242", "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": "6119c066392074a64d33a8da4c90a138", "score": "0.54006934", "text": "func String(name string, value string) Field {\n\treturn &zapField{\n\t\tfield: zap.String(name, value),\n\t}\n}", "title": "" }, { "docid": "0fc6ed7b12530152124b5a0df73a40a5", "score": "0.53993434", "text": "func (s *Struct) String() string {\n\treturn typeToString(s, DefaultPrefixer)\n}", "title": "" }, { "docid": "5d29d6e0e0e0ab904e67c25cb99cc6eb", "score": "0.53894156", "text": "func (m *Module) String() string {\n\tvar lines []string\n\tfor key, val := range m.Params {\n\t\tlines = append(lines, fmt.Sprintf(\"%s: %s\", key, val))\n\t}\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "9c67a625c138ac7a358c67bd9671d262", "score": "0.5384898", "text": "func Stringp(name string, value *string) Field {\n\treturn &zapField{\n\t\tfield: zap.Stringp(name, value),\n\t}\n}", "title": "" }, { "docid": "f4d249827abc9456d0ca28689bd0bb4a", "score": "0.53765935", "text": "func (sp *StructProperty) String(nameLen, typeLen int) string {\n\tif sp == nil {\n\t\treturn \"\"\n\t}\n\n\tbuf := &bytes.Buffer{}\n\n\tbuf.WriteString(sp.Name)\n\tif nameLen > len(sp.Name) {\n\t\tbuf.WriteString(strings.Repeat(\" \", nameLen-len(sp.Name)+1))\n\t} else {\n\t\tbuf.WriteString(\" \")\n\t}\n\n\tbuf.WriteString(sp.Type)\n\tif typeLen > len(sp.Type) {\n\t\tbuf.WriteString(strings.Repeat(\" \", typeLen-len(sp.Type)+1))\n\t} else {\n\t\tbuf.WriteString(\" \")\n\t}\n\n\tbuf.WriteString(\"`\" + sp.Tags.String() + \"`\")\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "18ee86464b37eca502219bffda55108d", "score": "0.5367224", "text": "func (pub *Public) String() string {\n\n\tvar buf bytes.Buffer\n\tbuf.WriteString(pub.G1.Base64())\n\tbuf.WriteString(\",\")\n\tbuf.WriteString(pub.G2.Base64())\n\tbuf.WriteString(\",\")\n\tbuf.WriteString(pub.U.Base64())\n\tbuf.WriteString(\",\")\n\tbuf.WriteString(pub.V.Base64())\n\tbuf.WriteString(\",\")\n\tbuf.WriteString(pub.Z.Base64())\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "bd09e428e501e2184d02faeca8900c24", "score": "0.53631973", "text": "func (b Binding) String() string {\n\n\ts, sep := \"\", \"\"\n\tkeys := []string{}\n\n\tfor k := range b.Key2vvalue {\n\t\tkeys = append(keys, k)\n\t}\n\n\tsort.Strings(keys)\n\n\tfor _, k := range keys {\n\t\ts += sep + k + \":\" + b.Key2vvalue[k].String()\n\t\tsep = \", \"\n\t}\n\n\treturn \"{\" + s + \"}\"\n}", "title": "" }, { "docid": "d7f44fd5d8a4877e8cb88d194df9992e", "score": "0.53624713", "text": "func (s DBParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d7f44fd5d8a4877e8cb88d194df9992e", "score": "0.53624713", "text": "func (s DBParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9ea9f65eaf97a44e02904fcb935a4aec", "score": "0.5361138", "text": "func (s RequestTranslationStruct) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11a4e7851f5e03cc5470dce5aef81d39", "score": "0.5360816", "text": "func (s GetMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f8a86a25a55e4d24022f82c92438a0bf", "score": "0.53603625", "text": "func ValueAsString(value reflect.Value) string {\n\tb := &bytes.Buffer{}\n\n\twalker := func(path *FieldPath, field *reflect.StructField, v reflect.Value) error {\n\t\tif IsPrimitiveValue(v) || v.Kind() == reflect.String {\n\t\t\tfmt.Fprintf(b, \"%v\", v.Interface())\n\t\t\treturn SkipReflection\n\t\t}\n\n\t\tswitch v.Kind() {\n\t\tcase reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map:\n\t\t\tif v.IsNil() {\n\t\t\t\tfmt.Fprintf(b, \"<nil>\")\n\t\t\t\treturn SkipReflection\n\t\t\t}\n\t\t}\n\n\t\tswitch v.Kind() {\n\t\tcase reflect.Ptr, reflect.Interface:\n\t\t\treturn nil // descend into value\n\n\t\tcase reflect.Slice:\n\t\t\tlen := v.Len()\n\t\t\tfmt.Fprintf(b, \"[\")\n\t\t\tfor i := 0; i < len; i++ {\n\t\t\t\tav := v.Index(i)\n\n\t\t\t\tif i != 0 {\n\t\t\t\t\tfmt.Fprintf(b, \", \")\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(b, \"%s\", ValueAsString(av))\n\t\t\t}\n\t\t\tfmt.Fprintf(b, \"]\")\n\t\t\treturn SkipReflection\n\n\t\tcase reflect.Map:\n\t\t\tkeys := v.MapKeys()\n\t\t\tfmt.Fprintf(b, \"{\")\n\t\t\tfor i, key := range keys {\n\t\t\t\tmv := v.MapIndex(key)\n\n\t\t\t\tif i != 0 {\n\t\t\t\t\tfmt.Fprintf(b, \", \")\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(b, \"%s: %s\", ValueAsString(key), ValueAsString(mv))\n\t\t\t}\n\t\t\tfmt.Fprintf(b, \"}\")\n\t\t\treturn SkipReflection\n\n\t\tcase reflect.Struct:\n\t\t\tintf := v.Addr().Interface()\n\n\t\t\tdone := false\n\t\t\tfor _, p := range printers {\n\t\t\t\ts, ok := p(intf)\n\t\t\t\tif ok {\n\t\t\t\t\tfmt.Fprintf(b, \"%s\", s)\n\t\t\t\t\tdone = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !done {\n\t\t\t\tklog.V(4).Infof(\"Unhandled kind in asString for %q: %T\", path, v.Interface())\n\t\t\t\tfmt.Fprint(b, values.DebugAsJSONString(intf))\n\t\t\t}\n\n\t\t\treturn SkipReflection\n\n\t\tdefault:\n\t\t\tklog.Infof(\"Unhandled kind in asString for %q: %T\", path, v.Interface())\n\t\t\treturn fmt.Errorf(\"Unhandled kind for %q: %v\", path, v.Kind())\n\t\t}\n\t}\n\n\terr := ReflectRecursive(value, walker, &ReflectOptions{DeprecatedDoubleVisit: true})\n\tif err != nil {\n\t\tklog.Fatalf(\"unexpected error during reflective walk: %v\", err)\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.5356168", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0635219069bd9ad99e2673123075fffa", "score": "0.5353873", "text": "func (v *Vid) String() string {\n\treturn paramString(v)\n}", "title": "" }, { "docid": "63cd8c26d4af778871d8606b3be0b361", "score": "0.5351702", "text": "func (s NiftyModifyWebProxyAttributeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8e5503a1a7f97c0882cf5b25b62cea13", "score": "0.53478396", "text": "func (s ModifyDBParameterGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "04de487ad099bd11ab528c87e31d0c16", "score": "0.53470707", "text": "func String(v interface{}) string { return fmt.Sprintf(\"%v\", v) }", "title": "" }, { "docid": "9808912faec3732d85895a870d3b1fe1", "score": "0.53454226", "text": "func (pa PluginAttribute) String() string {\n\treturn fmt.Sprintf(\"%s => %s\", pa.Name(), pa.ValueString())\n}", "title": "" }, { "docid": "b8502c4bf6107da9d44dd54cf48dfaa2", "score": "0.5335322", "text": "func (s NiftyModifyWebProxyAttributeInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11c90d6ee574cda9903fc75bee8832a0", "score": "0.5335036", "text": "func (s DBClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e54ce517ec1542386fc022990a89be80", "score": "0.5325434", "text": "func AsJSONString(src *structpb.Struct) string {\n\tif src == nil {\n\t\treturn \"\"\n\t}\n\tm := jsonpb.Marshaler{}\n\ts, err := m.MarshalToString(src)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "62132f69fac5eea623282741c0a0cce3", "score": "0.5321532", "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": "5803e329c38823e0d67643049d5d0995", "score": "0.53203803", "text": "func (o PipelineOptions) String(name string, d string) string {\n\tif value, ok := o[name]; ok {\n\t\tif str, ok := value.(string); ok {\n\t\t\treturn str\n\t\t}\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "389eae9e9df9948c4919c9fd26166858", "score": "0.53163415", "text": "func (s GeoMatchParams) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "00024bb0ab152138422647c024b6a36d", "score": "0.53162575", "text": "func (rpv *RequestParamValue) String() string {\n\tif rpv.s == nil {\n\t\tif s, ok := rpv.i.(string); ok {\n\t\t\trpv.s = &s\n\t\t} else {\n\t\t\ts := fmt.Sprintf(\"%v\", rpv.i)\n\t\t\trpv.s = &s\n\t\t}\n\t}\n\n\treturn *rpv.s\n}", "title": "" }, { "docid": "413d4fbda32c6f6d9719e916cf1015d6", "score": "0.53148663", "text": "func (s FindingProviderFields) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5dc1251092fa7c347f6c411a6dec3376", "score": "0.5314124", "text": "func asString(v reflect.Value) string {\n\tif v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface {\n\t\tif v.IsNil() {\n\t\t\treturn \"<nil>\"\n\t\t}\n\t}\n\tif v.CanInterface() {\n\t\tiv := v.Interface()\n\t\t_, isResource := iv.(Resource)\n\t\tif isResource {\n\t\t\treturn \"<resource>\"\n\t\t}\n\t\t_, isHasID := iv.(CompareWithID)\n\t\tif isHasID {\n\t\t\tid := iv.(CompareWithID).CompareWithID()\n\t\t\tif id == nil {\n\t\t\t\treturn \"id:<nil>\"\n\t\t\t} else {\n\t\t\t\treturn \"id:\" + *id\n\t\t\t}\n\t\t}\n\t\tswitch typed := iv.(type) {\n\t\tcase *string:\n\t\t\treturn *typed\n\t\tcase *bool:\n\t\t\treturn fmt.Sprintf(\"%v\", *typed)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%T (%v)\", iv, iv)\n\t\t}\n\n\t} else {\n\t\treturn fmt.Sprintf(\"Unhandled: %T\", v.Type())\n\n\t}\n}", "title": "" }, { "docid": "3a1f67be91f5b4a58be464aab80edd0b", "score": "0.5310637", "text": "func (s AbpV11) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e0bac948738973608fb775a050356a4d", "score": "0.52948433", "text": "func (o LunMapGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "3f9d1dea1f2aba58105fd81c8f03a2d7", "score": "0.5283213", "text": "func (c Credential) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "411c111310b9589ec59e7d3e0bd5260c", "score": "0.5282", "text": "func String(key string, val string) zap.Field {\n\treturn zap.String(key, val)\n}", "title": "" }, { "docid": "daeda53d3394136b0b0686a9671382ae", "score": "0.52805966", "text": "func String(s string) string {\n\treturn fmt.Sprintf(\"%o\", ValueOf(s))\n}", "title": "" }, { "docid": "0f38203b29f334acc30ff0cba6f34ab3", "score": "0.5279911", "text": "func (v info) String() string {\n\treturn fmt.Sprintf(\"%#v\", v)\n}", "title": "" }, { "docid": "bb74654e5b76bf391c60ad10d65f4aa6", "score": "0.5270803", "text": "func (o VolumeCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5252523", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5252523", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "b842e2fdbe68d089a489cdc5bec6248b", "score": "0.5252523", "text": "func (s Member) GoString() string {\n\treturn s.String()\n}", "title": "" }, { "docid": "87cb12855e941b780a49cf524e0978e8", "score": "0.525197", "text": "func (s RequestOptionStruct) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "03900f1e47c2d3d3089d034abfdbcda0", "score": "0.5249979", "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": "e0b6b98d05d5331724b2ddbcfe6e151e", "score": "0.5249163", "text": "func (s UpdateTeamMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b30303dca846f470eb2efe6e9ecb18bb", "score": "0.5247211", "text": "func (s FieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37f061fd711936c7a11d7a95bdf4fbde", "score": "0.52407867", "text": "func (s UpdateProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "897028ea13c01a5f5414d686871d89bb", "score": "0.52385753", "text": "func (s ModifyVolumeAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "acea6a093cd77daf60242a314abeec11", "score": "0.5232095", "text": "func (o VolumeGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "95fa8cfbbff1e8c36281586eedddfbf5", "score": "0.523061", "text": "func (c Credentials) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "b5cc7266cd8154aba867226ec49686fa", "score": "0.5230532", "text": "func (o NvmeNamespaceModifyRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2e9f2c6cbcc624fe05bfec6e820d3589", "score": "0.523004", "text": "func (p Params) String(key string) string {\n\tv, ok := p[key]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tout, ok := v.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn out\n}", "title": "" }, { "docid": "8ed6e425f111d06043958014bb768c75", "score": "0.5228703", "text": "func String(key string, val string) zapcore.Field {\n\treturn zap.String(key, val)\n}", "title": "" } ]
7179eb0c880227b0bfc71a34e6681344
Make those previously set up multiplaying machines running
[ { "docid": "48c90655e1e6707322f3b4eb022e0ed9", "score": "0.6326553", "text": "func (m *Machine) multiplayingMachine() {\r\n\r\n\tif !Silent {\r\n\t\tfmt.Println(\"[Mach] #\", m.id, \"\\tmul machine setten up.\")\r\n\t}\r\n\r\n\tfor {\r\n\t\t// Backdoor\r\n\t\tselect {\r\n\t\tcase <-m.fix:\r\n\t\t\tm.status = true\r\n\t\tdefault:\r\n\t\t}\r\n\r\n\t\tif (rand.Float64() < MachFailure) && m.status {\r\n\t\t\tm.status = false\r\n\t\t}\r\n\r\n\t\tm.ready <- true\r\n\r\n\t\tt := <-m.todo\r\n\t\tif !Silent {\r\n\t\t\tfmt.Println(\"[Mach] #\", m.id, \"\\tmul machine started calculating: [\", t.taskInMachine.arg1, t.taskInMachine.arg2, \"]\")\r\n\t\t}\r\n\t\ttime.Sleep(time.Duration(MachPerf) * time.Second)\r\n\r\n\t\t// Machine works when it sees a task has been given by a worker\r\n\t\tif m.status {\r\n\t\t\tt.result <- t.taskInMachine.arg1 * t.taskInMachine.arg2\r\n\t\t} else {\r\n\t\t\tt.result <- ErrorSignal\r\n\t\t}\r\n\t}\r\n}", "title": "" } ]
[ { "docid": "d07d029ac7fef28f96ff2ce93cbb19cf", "score": "0.7123576", "text": "func setMultiplayingMachines() []Machine {\r\n\r\n\tmachines := make([]Machine, MachMulNum)\r\n\t//channels := make([]chan Machine, MachMulNum)\r\n\tfor i := 0; i < MachMulNum; i++ {\r\n\t\tmachines[i] = Machine{i, make(chan MachineTask), make(chan bool), true, make(chan bool)}\r\n\t\tgo machines[i].multiplayingMachine()\r\n\t}\r\n\treturn machines\r\n}", "title": "" }, { "docid": "78b6b1d3ffc985e3a630161bb517ab40", "score": "0.6025513", "text": "func setAddingMachines() []Machine {\r\n\r\n\tmachines := make([]Machine, MachAddNum)\r\n\t//channels := make([]chan Machine, MachAddNum)\r\n\tfor i := 0; i < MachAddNum; i++ {\r\n\t\tmachines[i] = Machine{i, make(chan MachineTask), make(chan bool), true, make(chan bool)}\r\n\t\tgo machines[i].addingMachine()\r\n\t}\r\n\treturn machines\r\n}", "title": "" }, { "docid": "8d6e8dca6c774a9371ed5608fdb60b86", "score": "0.56975263", "text": "func startNetworkComm(servers []*BayouServer) {\n for _, server := range servers {\n server.Start()\n }\n}", "title": "" }, { "docid": "9fe463a063fc5a0fb77aadf8dca8f63e", "score": "0.5491129", "text": "func main() {\n\tmode, err := strconv.Atoi(os.Args[1])\n\tResolveError(err,true)\n\tportnum,err := strconv.Atoi(os.Args[2])\n\tResolveError(err,true)\n\tserverPortNumber = portnum\n\n\t//TODO: Remove Machine Log Port Number\n\tlogfile,err := os.OpenFile(\"machine\" + os.Args[2] + \".log\",os.O_APPEND|os.O_CREATE,0644)\n\tResolveError(err, true)\n\n\tmw := io.MultiWriter(os.Stdout, logfile)\n\tlog.SetOutput(mw)\n\n\n\tgo memberList()\n\tgo clientManager()\n\tgo PingServer(portnum)\n\tgo FileSystem()\n\tif mode==0 {\n\t\tgo IntroduceServer(INTRODUCER_PORT)\n\t\tINTRODUCER_ID = selfID\n\t\tMASTER_ID = \"\"\n\t} else {\n\n\t\tselfaddress,err := net.ResolveUDPAddr(\"udp\",\":\"+strconv.Itoa(portnum))\n\t\tResolveError(err,false)\n\t\t//TODO: Add Introducer Port before ':' for demo\n\t\tintroaddr,err := net.ResolveUDPAddr(\"udp\",INTRODUCER_IP + \":\" +strconv.Itoa(INTRODUCER_PORT))\n\t\tResolveError(err,false)\n\t\tIntroduceClient(selfaddress,introaddr)\n\t}\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tif scanner.Text()==\"stop\" { //logic for leaving\n\t\t\tmList := MembershipListReadAll()\n\t\t\tif len(mList) <=4 {\n\t\t\t\tfor _,v := range mList {\n\t\t\t\t\tif v!=selfID {\n\t\t\t\t\t\t//targetaddr,err := net.ResolveUDPAddr(\"udp\",\":\"+getPortfromID(v))\n\t\t\t\t\t\t//ResolveError(err,false)\n\t\t\t\t\t\t//conn2,err := net.DialUDP(\"udp\",nil,targetaddr)\n\t\t\t\t\t\t////send the FAIL message here\n\t\t\t\t\t\tstopMessage := createMessage(selfID, \"LEAVE\", selfID , []string{\"None\"})\n\t\t\t\t\t\t//stopJSON := getJSONfromMessage(stopMessage)\n\t\t\t\t\t\t//_, err = conn2.Write(stopJSON)\n\t\t\t\t\t\t//ResolveError(err,false)\n\t\t\t\t\t\t//conn2.Close()\n\t\t\t\t\t\tsendMessageOverUDP(v, stopMessage)\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tselfidx:=0\n\t\t\t\tfor i,v := range mList {\n\t\t\t\t\tif v==selfID {\n\t\t\t\t\t\tselfidx=i\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttargets:=make([]string,3)\n\t\t\t\ttargets[0]=mList[(selfidx-1+len(mList))%len(mList)]\n\t\t\t\ttargets[1]=mList[(selfidx+1+len(mList))%len(mList)]\n\t\t\t\ttargets[2]=mList[(selfidx+1+len(mList))%len(mList)]\n\t\t\t\tfor _,id := range targets {\n\t\t\t\t\t//member_IP := getIPfromID(id)\n\t\t\t\t\t//member_Port := getPortfromID(id)\n\t\t\t\t\t////send the FAIL message here\n\t\t\t\t\t//targetaddr,err := net.ResolveUDPAddr(\"udp\",member_IP + \":\" + member_Port)\n\t\t\t\t\t//ResolveError(err,false)\n\t\t\t\t\t//conn2,err := net.DialUDP(\"udp\",nil,targetaddr)\n\t\t\t\t\t////send the FAIL message here\n\t\t\t\t\tstopMessage := createMessage(selfID, \"LEAVE\", selfID , []string{\"None\"})\n\t\t\t\t\t//stopJSON := getJSONfromMessage(stopMessage)\n\t\t\t\t\t//_, err = conn2.Write(stopJSON)\n\t\t\t\t\t//ResolveError(err,false)\n\t\t\t\t\t//conn2.Close()\n\t\t\t\t\tsendMessageOverUDP(id, stopMessage)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t} else {\n\t\t\tparts:=strings.Split(scanner.Text(),\" \")\n\t\t\tswitch parts[0] {\n\t\t\tcase \"put\":\n\t\t\t\tfschan <- FsCommand{Cmd: 0, SdfsFileName:parts[2], LocalFileName:parts[1], NumVersions:0}\n\t\t\tcase \"get\":\n\t\t\t\tfschan <- FsCommand{Cmd: 1, SdfsFileName:parts[1], LocalFileName:parts[2], NumVersions:0}\n\t\t\tcase \"delete\":\n\t\t\t\tfschan <- FsCommand{Cmd: 2, SdfsFileName:parts[1], LocalFileName:\"\", NumVersions:0}\n\t\t\tcase \"ls\":\n\t\t\t\tfschan <- FsCommand{Cmd: 3, SdfsFileName:parts[1], LocalFileName:\"\", NumVersions:0}\n\t\t\tcase \"store\":\n\t\t\t\tfschan <- FsCommand{Cmd: 4, SdfsFileName:\"\", LocalFileName:\"\", NumVersions:0}\n\t\t\tcase \"get-versions\", \"getversions\", \"get-version\", \"getversion\":\n\t\t\t\tnumversions, err := strconv.Atoi(parts[3])\n\t\t\t\tResolveError(err, true)\n\t\t\t\tfschan <- FsCommand{Cmd: 5, SdfsFileName:parts[1], LocalFileName:parts[2], NumVersions:numversions}\n\t\t\tcase \"list\":\n\t\t\t\tmListInput <-Command{cmd: 2,ID:\"\"}\n\t\t\t\tmList:=<-mListOutput\n\t\t\t\tfmt.Println(\"Membership List:\" , mList)\n\t\t\tcase \"selfid\":\n\t\t\t\tfmt.Println(\"Self ID:\", selfID)\n\t\t\tcase \"masterid\":\n\t\t\t\tfmt.Println(\"Master ID:\", MASTER_ID)\n\t\t\tcase \"introducerid\":\n\t\t\t\tfmt.Println(\"Introducer ID:\", INTRODUCER_ID)\n\t\t\tcase \"submit\":\n\t\t\t\tsubjob <- parts[1]\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c328d0f5c0c3644d160c19af33d84ebe", "score": "0.5430654", "text": "func (c *Cluster) ensureMonsRunning(mons []*monConfig, i, targetCount int, requireAllInQuorum bool) error {\n\tif requireAllInQuorum {\n\t\tlogger.Infof(\"creating mon %s\", mons[i].DaemonName)\n\t} else {\n\t\tlogger.Info(\"checking for basic quorum with existing mons\")\n\t}\n\n\t// Calculate how many mons we expected to exist after this method is completed.\n\t// If we are adding a new mon, we expect one more than currently exist.\n\t// If we haven't created all the desired mons already, we will be adding a new one with this iteration\n\texpectedMonCount := len(c.ClusterInfo.Monitors)\n\tif expectedMonCount < targetCount {\n\t\texpectedMonCount++\n\t}\n\n\t// Init the mon IPs\n\tif err := c.initMonIPs(mons[0:expectedMonCount]); err != nil {\n\t\treturn errors.Wrap(err, \"failed to init mon services\")\n\t}\n\n\t// save the mon config after we have \"initiated the IPs\"\n\tif err := c.saveMonConfig(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to save mons\")\n\t}\n\n\t// Start the deployment\n\tif err := c.startDeployments(mons[0:expectedMonCount], requireAllInQuorum); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start mon pods\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cf0640a54f94d43b90d5c4ed95923d2d", "score": "0.5407609", "text": "func StartMultiNode(logger log.Log, numOfInstances, layerAvgSize int, runTillLayer uint32, dbPath string) {\n\tcfg := getTestDefaultConfig()\n\tcfg.LayerAvgSize = layerAvgSize\n\tnet := service.NewSimulator()\n\tpath := dbPath + time.Now().Format(time.RFC3339)\n\n\tgenesisTime := time.Now().Add(20 * time.Second).Format(time.RFC3339)\n\n\tpoetHarness, err := activation.NewHTTPPoetHarness(false)\n\tif err != nil {\n\t\tlogger.With().Panic(\"failed creating poet client harness\", log.Err(err))\n\t}\n\tdefer func() {\n\t\terr := poetHarness.Teardown(true)\n\t\tif err != nil {\n\t\t\tlogger.With().Error(\"failed to tear down poet harness\", log.Err(err))\n\t\t}\n\t}()\n\n\trolacle := eligibility.New(logger)\n\tgTime, err := time.Parse(time.RFC3339, genesisTime)\n\tif err != nil {\n\t\tlogger.With().Error(\"cannot parse genesis time\", log.Err(err))\n\t}\n\tevents.CloseEventPubSub()\n\tpubsubAddr := \"tcp://localhost:55666\"\n\tif err := events.InitializeEventReporter(pubsubAddr); err != nil {\n\t\tlogger.With().Error(\"error initializing event reporter\", log.Err(err))\n\t}\n\tclock := NewManualClock(gTime)\n\n\tapps := make([]*App, 0, numOfInstances)\n\tname := 'a'\n\tfor i := 0; i < numOfInstances; i++ {\n\t\tdbStorepath := path + string(name)\n\t\tedSgn := signing.NewEdSigner()\n\t\tsmApp, err := InitSingleInstance(logger, *cfg, i, genesisTime, dbStorepath, rolacle, poetHarness.HTTPPoetClient, clock, net, edSgn)\n\t\tif err != nil {\n\t\t\tlogger.With().Error(\"cannot run multi node\", log.Err(err))\n\t\t\treturn\n\t\t}\n\t\tapps = append(apps, smApp)\n\t\tname++\n\t}\n\n\teventDb := collector.NewMemoryCollector()\n\tcollect := collector.NewCollector(eventDb, pubsubAddr)\n\tfor _, a := range apps {\n\t\ta.startServices(context.TODO())\n\t}\n\tcollect.Start(false)\n\tActivateGrpcServer(apps[0])\n\n\tgo func() {\n\t\tr := bufio.NewReader(poetHarness.Stdout)\n\t\tfor {\n\t\t\tline, _, err := r.ReadLine()\n\t\t\tif err == io.EOF || err == os.ErrClosed {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error(\"failed to read poet stdout: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlogger.Info(\"[poet stdout] %v\\n\", string(line))\n\t\t}\n\t}()\n\tgo func() {\n\t\tr := bufio.NewReader(poetHarness.Stderr)\n\t\tfor {\n\t\t\tline, _, err := r.ReadLine()\n\t\t\tif err == io.EOF || err == os.ErrClosed {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error(\"failed to read poet stderr: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlogger.Info(\"[poet stderr] %v\", string(line))\n\t\t}\n\t}()\n\n\tif err := poetHarness.Start(context.TODO(), []string{\"127.0.0.1:9094\"}); err != nil {\n\t\tlogger.Panic(\"failed to start poet server: %v\", err)\n\t}\n\n\tdefer GracefulShutdown(apps)\n\n\ttimeout := time.After(time.Duration(runTillLayer*60) * time.Second)\n\n\tstartLayer := time.Now()\n\tclock.Tick()\n\terrors := 0\nloop:\n\tfor {\n\t\tselect {\n\t\t// Got a timeout! fail with a timeout error\n\t\tcase <-timeout:\n\t\t\tlogger.Panic(\"run timed out\", err)\n\t\t\treturn\n\t\tdefault:\n\t\t\tif errors > 100 {\n\t\t\t\tlogger.Panic(\"too many errors and retries\")\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t\tlayer := clock.GetCurrentLayer()\n\n\t\t\tif layer.GetEpoch().IsGenesis() {\n\t\t\t\ttime.Sleep(20 * time.Second)\n\t\t\t\tclock.Tick()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif eventDb.GetBlockCreationDone(layer) < numOfInstances {\n\t\t\t\tlogger.Warning(\"blocks done in layer %v: %v\", layer, eventDb.GetBlockCreationDone(layer))\n\t\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t\t\terrors++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Info(\"all miners tried to create block in %v\", layer)\n\t\t\tif eventDb.GetNumOfCreatedBlocks(layer)*numOfInstances != eventDb.GetReceivedBlocks(layer) {\n\t\t\t\tlogger.Warning(\"finished: %v, block received %v layer %v\", eventDb.GetNumOfCreatedBlocks(layer), eventDb.GetReceivedBlocks(layer), layer)\n\t\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t\t\terrors++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogger.Info(\"all miners got blocks for layer: %v created: %v received: %v\", layer, eventDb.GetNumOfCreatedBlocks(layer), eventDb.GetReceivedBlocks(layer))\n\t\t\tepoch := layer.GetEpoch()\n\t\t\tif !(eventDb.GetAtxCreationDone(epoch) >= numOfInstances && eventDb.GetAtxCreationDone(epoch)%numOfInstances == 0) {\n\t\t\t\tlogger.Warning(\"atx not created %v in epoch %v, created only %v atxs\", numOfInstances-eventDb.GetAtxCreationDone(epoch), epoch, eventDb.GetAtxCreationDone(epoch))\n\t\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t\t\terrors++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogger.Info(\"all miners finished reading %v atxs, layer %v done in %v\", eventDb.GetAtxCreationDone(epoch), layer, time.Since(startLayer))\n\t\t\tfor _, atxID := range eventDb.GetCreatedAtx(epoch) {\n\t\t\t\tif !eventDb.AtxIDExists(atxID) {\n\t\t\t\t\tlogger.Warning(\"atx %v not propagated\", atxID)\n\t\t\t\t\terrors++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tbeacons := eventDb.GetTortoiseBeacon(epoch)\n\t\t\tlogger.Info(\"all miners finished calculating %v tortoise beacons, epoch %v done in %v\", len(beacons), epoch, time.Since(startLayer))\n\t\t\tif len(beacons) != 0 {\n\t\t\t\tfirst := beacons[0]\n\t\t\t\tfor _, beacon := range beacons {\n\t\t\t\t\tif first != beacon {\n\t\t\t\t\t\tlogger.Info(\"tortoise beacons %v and %v differ\", first, beacon)\n\t\t\t\t\t\terrors++\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terrors = 0\n\n\t\t\tstartLayer = time.Now()\n\t\t\tclock.Tick()\n\n\t\t\tif !apps[0].mesh.LatestLayer().Before(types.NewLayerID(runTillLayer)) {\n\t\t\t\tbreak loop\n\t\t\t}\n\t\t\ttime.Sleep(200 * time.Millisecond)\n\t\t}\n\t}\n\tevents.CloseEventReporter()\n\tevents.CloseEventPubSub()\n\tcollect.Stop()\n}", "title": "" }, { "docid": "2b2021b5aca8cd14723de179fdae31c4", "score": "0.54049885", "text": "func powerOnHostParallel(hostsToPowerOn []string) {\n\thostlist := \"\"\n\tfor _, host := range hostsToPowerOn {\n\t\tfor _, esxHost := range tbinfo.esxHosts {\n\t\t\tif esxHost[\"ip\"] == host {\n\t\t\t\thostlist += esxHost[\"vmName\"] + \" \"\n\t\t\t}\n\t\t}\n\t\tfds.hostsDown = append(fds.hostsDown, host)\n\t}\n\terr := vMPowerMgmt(tbinfo.user, tbinfo.location, hostlist, true)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\tfor _, host := range hostsToPowerOn {\n\t\terr = waitForHostToBeUp(host)\n\t\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\t}\n}", "title": "" }, { "docid": "f87b66c7cc1b71ff0cb46279cc63ca8b", "score": "0.53734547", "text": "func createInstanceScripts() {\n\tif 0 == UEnv.UhuraPort {\n\t\tUEnv.UhuraPort = 8100 // default port for Uhura\n\t}\n\t// Build the quartermaster script to create each environment instance...\n\tfor i := 0; i < len(UEnv.Instances); i++ {\n\t\tif UEnv.Instances[i].OS == \"Windows\" {\n\t\t\tmakeWindowsScript(i)\n\t\t} else {\n\t\t\tmakeLinuxScript(i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4fa373560f19d322a04443cd055bc25b", "score": "0.53653914", "text": "func setupTunnels(){\n\tnum_tunnels := 5\n\tREMOTE_ADDR := \"10.162.185.158\"\n\tcount := 100\n\tos.Setenv(\"PATH\", \"/usr/bin:/sbin\")\n\tfor idx := 0; idx < num_tunnels; idx++ {\n\t\tcount++\n\t\tcmd := \"ip link add name irlgeneve\"+strconv.Itoa(idx)+ \" type geneve id \" + strconv.Itoa(count) + \" remote \" + REMOTE_ADDR\n\t\tfmt.Println(\"cmd: \",cmd)\n\t\tname := \"irlgeneve\" + strconv.Itoa(idx)\n\t\texecCmd := exec.Command(\"ip\",\"link\", \"add\",\"name\",name,\"type\", \"geneve\",\"id\",strconv.Itoa(count),\"remote\",REMOTE_ADDR)\n\t\terr := execCmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b40bf7c714cafb67a1e60337471804c2", "score": "0.5356017", "text": "func StartupAllPlatforms(c *config.Config) {\n\tfor name, platform := range platforms {\n\t\tlog.Info.Printf(\"Starting up: %s\", name)\n\t\tplatforms[name] = platform.Startup(c)\n\t}\n}", "title": "" }, { "docid": "ce1dc7ea61b312eb70e1a1258ea61783", "score": "0.534824", "text": "func (pt *peerSelectionTest) setupServers(t testing.TB) {\n\tpt.servers = make([]*Channel, pt.numPeers)\n\n\t// Set up numPeers servers.\n\tfor i := 0; i < pt.numPeers; i++ {\n\t\tpt.servers[i], _ = pt.NewService(t, \"server\", fmt.Sprintf(\"server-%v\", i))\n\t\tpt.servers[i].Register(raw.Wrap(newTestHandler(pt.t)), \"echo\")\n\t}\n}", "title": "" }, { "docid": "a0db53805e054ba3525630d37b4335eb", "score": "0.53253335", "text": "func startStandAloneServer(destSCR string) {\n\tinitOnce.Do(func() {\n\t\tserver = new(Server)\n\t\tserver.scheduler = sc.GetScheduler()\n\t\tserver.http = hs.GetHTTPInstance()\n\t\t//conn := cm.GetDBConns(\"dbWC\") // get db connection\n\t\t//if len(conn) <= 0 {\n\t\t//\tlog.Fatal(\"can not get db connection, exit\")\n\t\t//\n\t\t//\treturn\n\t\t//}\n\t\t//// must have one register DataBase alias named `default` !!!\n\t\t//server.db = mc.GetMySQLClientInstance(conn)\n\n\t\t// GetStandAloneInstance will use task, GetTaskInstance should before GetStandAloneInstance\n\t\tserver.task = tk.GetTaskInstance(false, server.db)\n\t\tserver.standalone = sa.GetStandAloneInstance(server.db, server.task)\n\n\t\t//go supervise() // supervise status\n\n\t\t// two ways of running\n\t\tif destSCR == cm.DestStandAloneDB { // for using db to get page id\n\t\t\tgo server.standalone.GetProsFromDB()\n\t\t\t//go server.task.ResetService()\n\t\t} else { // for using file to get csv file\n\t\t\tgo server.standalone.GetPageURLFromFile(destSCR)\n\t\t}\n\n\t\t// not use go routine for block main process\n\t\tdispatchStandAlone(server)\n\n\t\tserver.standalone.CloseFileTGT()\n\t})\n}", "title": "" }, { "docid": "b5190e34245b725651698365e2c86264", "score": "0.5311646", "text": "func StartPbftServers() {\n\tsvList = make([]*pbft.Server, cfg.N)\n\tfor i := 0; i < cfg.N; i++ {\n\t\tfmt.Println(cfg.Network.IPList[i], cfg.Network.Ports[i], i)\n\t\tsvList[i] = pbft.BuildServer(cfg, i)\n\t}\n\n\tfor i := 0; i < cfg.N; i++ {\n\t\t<-svList[i].Nd.ListenReady\n\t}\n\n\ttime.Sleep(1 * time.Second) // wait for the servers to accept incoming connections\n\tfor i := 0; i < cfg.N; i++ {\n\t\tsvList[i].Nd.SetupReady <- true // make them to dial each other's RPCs\n\t}\n\n\t//fmt.Println(\"[!!!] Please allow the program to accept incoming connections if you are using Mac OS.\")\n\ttime.Sleep(1 * time.Second) // wait for the servers to accept incoming connections\n}", "title": "" }, { "docid": "887c004fbc891f30f824c5312729e610", "score": "0.5298318", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n\tpx := &Paxos{}\n\tpx.peers = peers\n\tpx.me = me\n\n\n\t// Your initialization code here.\n\tpx.instances = make(map[int]*Instance)\n\tpx.maxInstance = -1\t\t\t// highest instance seen\n\tpx.minInstance = -1\t\t\t// smallest instance remembered\n\tpx.done = make([]int, len(peers))\n\tfor i := range(px.done) {\n\t\tpx.done[i] = -1\n\t}\n\n\tif rpcs != nil {\n\t\t// caller will create socket &c\n\t\trpcs.Register(px)\n\t} else {\n\t\trpcs = rpc.NewServer()\n\t\trpcs.Register(px)\n\n\t\t// prepare to receive connections from clients.\n\t\t// change \"unix\" to \"tcp\" to use over a network.\n\t\tos.Remove(peers[me]) // only needed for \"unix\"\n\t\tl, e := net.Listen(\"unix\", peers[me])\n\t\tif e != nil {\n\t\t\tlog.Fatal(\"listen error: \", e)\n\t\t}\n\t\tpx.l = l\n\n\t\t// please do not change any of the following code,\n\t\t// or do anything to subvert it.\n\n\t\t// create a thread to accept RPC connections\n\t\tgo func() {\n\t\t\tfor px.isdead() == false {\n\t\t\t\tconn, err := px.l.Accept()\n\t\t\t\tif err == nil && px.isdead() == false {\n\t\t\t\t\tif px.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t\t// discard the request.\n\t\t\t\t\t\tconn.Close()\n\t\t\t\t\t} else if px.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t//fmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tatomic.AddInt32(&px.rpcCount, 1)\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tatomic.AddInt32(&px.rpcCount, 1)\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t}\n\t\t\t\t} else if err == nil {\n\t\t\t\t\tconn.Close()\n\t\t\t\t}\n\t\t\t\tif err != nil && px.isdead() == false {\n\t\t\t\t\t//fmt.Printf(\"Paxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\n\treturn px\n}", "title": "" }, { "docid": "9a34b1d45b1760c185115e740429e757", "score": "0.5288481", "text": "func (s *FakeJujuService) startMachine(machine *state.Machine) error {\n\n\tlog.Infof(\"Starting machine %s\", machine.Id())\n\n\tnow := time.Now()\n\n\t// Set network address\n\taddress := network.NewScopedAddress(\"127.0.0.1\", network.ScopeCloudLocal)\n\tif err := machine.SetProviderAddresses(address); err != nil {\n\t\treturn err\n\t}\n\n\t// Set instance state\n\tif err := machine.SetProvisioned(s.newInstanceId(), \"nonce\", nil); err != nil {\n\t\treturn err\n\t}\n\tif err := machine.SetInstanceStatus(status.StatusInfo{\n\t\tStatus: status.Running,\n\t\tMessage: \"\",\n\t\tSince: &now,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\t// Set agent version\n\tcurrentVersion := version.Current.String()\n\tagentVersion, err := semversion.ParseBinary(currentVersion + \"-xenial-amd64\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := machine.SetAgentVersion(agentVersion); err != nil {\n\t\treturn err\n\t}\n\n\t// Set agent status\n\tif err := machine.SetStatus(status.StatusInfo{\n\t\tStatus: status.Started,\n\t\tMessage: \"\",\n\t\tSince: &now,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\t// Set agent presence\n\tif _, err := machine.SetAgentPresence(); err != nil {\n\t\treturn err\n\t}\n\ts.state.StartSync()\n\tif err := machine.WaitAgentPresence(MediumWait); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c20b87ff30a6a759bda14f0df6008628", "score": "0.5235201", "text": "func (w *World) launch() {\n\tfor {\n\t\tmessage := <-w.broadcast\n\t\tfor _, n := range w.nets {\n\t\t\tn.broadcast <- message\n\t\t}\n\t}\n}", "title": "" }, { "docid": "064f72118068ccf539576be209b9fb69", "score": "0.5227786", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n\tpx := &Paxos{}\n\tpx.peers = peers\n\tpx.me = me\n\n\t// Your initialization code here.\n\tpx.ins = make(map[int]*Instance)\n\tpx.mins = make(map[int]int)\n\n\tif rpcs != nil {\n\t\t// caller will create socket &c\n\t\trpcs.Register(px)\n\t} else {\n\t\trpcs = rpc.NewServer()\n\t\trpcs.Register(px)\n\n\t\t// prepare to receive connections from clients.\n\t\t// change \"unix\" to \"tcp\" to use over a network.\n\t\tos.Remove(peers[me]) // only needed for \"unix\"\n\t\tl, e := net.Listen(\"unix\", peers[me])\n\t\tif e != nil {\n\t\t\tlog.Fatal(\"listen error: \", e)\n\t\t}\n\t\tpx.l = l\n\n\t\t// please do not change any of the following code,\n\t\t// or do anything to subvert it.\n\n\t\t// create a thread to accept RPC connections\n\t\tgo func() {\n\t\t\tfor px.isdead() == false {\n\t\t\t\tconn, err := px.l.Accept()\n\t\t\t\tif err == nil && px.isdead() == false {\n\t\t\t\t\tif px.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t\t// discard the request.\n\t\t\t\t\t\tconn.Close()\n\t\t\t\t\t} else if px.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tatomic.AddInt32(&px.rpcCount, 1)\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tatomic.AddInt32(&px.rpcCount, 1)\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t}\n\t\t\t\t} else if err == nil {\n\t\t\t\t\tconn.Close()\n\t\t\t\t}\n\t\t\t\tif err != nil && px.isdead() == false {\n\t\t\t\t\tfmt.Printf(\"Paxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn px\n}", "title": "" }, { "docid": "6065ae02c4999047e29e1ff7a6f6113f", "score": "0.5222845", "text": "func resourceMAASMachineCreate(d *schema.ResourceData, meta interface{}) error {\n\tlog.Println(\"[DEBUG] [resourceMAASMachineCreate] Launching new maas_machine\")\n\n\t/*\n\t\tAccording to the MAAS API documentation here: https://maas.ubuntu.com/docs/api.html\n\t\tWe need to acquire or allocate a node before we start it. We pass (as url.Values)\n\t\tsome parameters that could be used to narrow down our selection (cpu_count, memory, etc.)\n\t*/\n\n\tcontroller := meta.(*Config).controller\n\tacquireParams := convertConstraints(d)\n\n\tvar machine *gomaasapi.Machine\n\tm, _, err := controller.AllocateMachine(acquireParams)\n\tif err != nil {\n\t\tlog.Println(\"[ERROR] [resourceMAASMachineCreate] Unable to allocate machine.\")\n\t\treturn err\n\t}\n\tmachine = &m\n\n\t// set the node id\n\td.SetId((*machine).SystemID())\n\n\t// save original hostname\n\td.Set(\"original_hostname\", (*machine).Hostname())\n\n\t// Update networking interfaces, if set\n\tif v, ok := d.GetOk(\"deploy_interface\"); ok {\n\n\t\t// Need to loop through deploy_interface twice\n\t\t// first to look for bond type interfaces and create them\n\t\t// second loop link subnets, including bond interfaces that may have been created in the first loop\n\t\t// The reason we do this is because the vlan interfaces may belong to the bond interface that has yet to be created\n\n\t\t// Loop for bond interfaces\n\t\tfor _, nic := range v.(*schema.Set).List() {\n\t\t\tif err := doNIC(d, meta, \"bond\", nic.(map[string]interface{}), &machine); err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] Can't setup nic: %v\", nic.(map[string]interface{}))\n\t\t\t\tif err := resourceMAASMachineDelete(d, meta); err != nil {\n\t\t\t\t\tlog.Printf(\"[DEBUG] Unable to release node: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Loop for vlan and physical interfaces\n\t\tfor _, nic := range v.(*schema.Set).List() {\n\t\t\tif err := doNIC(d, meta, \"\", nic.(map[string]interface{}), &machine); err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] Can't setup nic: %v\", nic.(map[string]interface{}))\n\t\t\t\tif err := resourceMAASMachineDelete(d, meta); err != nil {\n\t\t\t\t\tlog.Printf(\"[DEBUG] Unable to release node: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif d.Get(\"deploy\").(bool) {\n\t\t// update machine attributes during allocated state\n\t\tparams := url.Values{}\n\t\tif hostname, ok := d.GetOk(\"deploy_hostname\"); ok {\n\t\t\tlog.Printf(\"[DEBUG] Setting deploy hostname=%s\", hostname.(string))\n\t\t\tparams.Add(\"hostname\", hostname.(string))\n\t\t}\n\n\t\tif len(params) > 0 {\n\t\t\terr = nodeUpdate(meta.(*Config).MAASObject, d.Id(), params)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"[DEBUG] Unable to update node\")\n\t\t\t}\n\t\t}\n\t\tif err := startMachine(d, meta, *machine); err != nil {\n\t\t\t// unable to perform action, release the node\n\t\t\tif err := resourceMAASMachineDelete(d, meta); err != nil {\n\t\t\t\tlog.Printf(\"[DEBUG] Unable to release node: %s\", err.Error())\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tparams = url.Values{}\n\t\tif !d.Get(\"sticky_hostname\").(bool) {\n\t\t\tlog.Printf(\"[DEBUG] reverting hostname to '%s'\", d.Get(\"original_hostname\").(string))\n\t\t\tparams.Add(\"hostname\", d.Get(\"original_hostname\").(string))\n\t\t}\n\n\t\tif len(params) > 0 {\n\t\t\terr = nodeUpdate(meta.(*Config).MAASObject, d.Id(), params)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"[DEBUG] Unable to update node\")\n\t\t\t}\n\t\t}\n\t}\n\t// update node tags\n\tif tags, ok := d.GetOk(\"deploy_tags\"); ok {\n\t\tfor i := range tags.([]interface{}) {\n\t\t\terr := nodeTagsUpdate(meta.(*Config).MAASObject, d.Id(), tags.([]interface{})[i].(string))\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] Unable to update node (%s) with tag (%s)\", d.Id(), tags.([]interface{})[i].(string))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resourceMAASMachineUpdate(d, meta)\n\n}", "title": "" }, { "docid": "87dd2eea85924a188cdd4e19b92913ca", "score": "0.52130103", "text": "func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, role, userDataSecret string) ([]machineapi.Machine, error) {\n\tif configPlatform := config.Platform.Name(); configPlatform != libvirt.Name {\n\t\treturn nil, fmt.Errorf(\"non-Libvirt configuration: %q\", configPlatform)\n\t}\n\tif poolPlatform := pool.Platform.Name(); poolPlatform != libvirt.Name {\n\t\treturn nil, fmt.Errorf(\"non-Libvirt machine-pool: %q\", poolPlatform)\n\t}\n\tplatform := config.Platform.Libvirt\n\n\ttotal := int64(1)\n\tif pool.Replicas != nil {\n\t\ttotal = *pool.Replicas\n\t}\n\tprovider := provider(clusterID, config.Networking.MachineNetwork[0].CIDR.String(), platform, userDataSecret)\n\tvar machines []machineapi.Machine\n\tfor idx := int64(0); idx < total; idx++ {\n\t\tmachine := machineapi.Machine{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"machine.openshift.io/v1beta1\",\n\t\t\t\tKind: \"Machine\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: \"openshift-machine-api\",\n\t\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterID, pool.Name, idx),\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": role,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-type\": role,\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: machineapi.MachineSpec{\n\t\t\t\tProviderSpec: machineapi.ProviderSpec{\n\t\t\t\t\tValue: &runtime.RawExtension{Object: provider},\n\t\t\t\t},\n\t\t\t\t// we don't need to set Versions, because we control those via cluster operators.\n\t\t\t},\n\t\t}\n\t\tmachines = append(machines, machine)\n\t}\n\n\treturn machines, nil\n}", "title": "" }, { "docid": "5ce2e3010f70f55af8a6e80738e5b127", "score": "0.5189217", "text": "func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]machineapi.Machine, *machinev1.ControlPlaneMachineSet, error) {\n\tif configPlatform := config.Platform.Name(); configPlatform != openstack.Name {\n\t\treturn nil, nil, fmt.Errorf(\"non-OpenStack configuration: %q\", configPlatform)\n\t}\n\tif poolPlatform := pool.Platform.Name(); poolPlatform != openstack.Name {\n\t\treturn nil, nil, fmt.Errorf(\"non-OpenStack machine-pool: %q\", poolPlatform)\n\t}\n\n\tmpool := pool.Platform.OpenStack\n\tplatform := config.Platform.OpenStack\n\ttrunkSupport, err := checkNetworkExtensionAvailability(platform.Cloud, \"trunk\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttotal := int64(1)\n\tif pool.Replicas != nil {\n\t\ttotal = *pool.Replicas\n\t}\n\tmachines := make([]machineapi.Machine, 0, total)\n\tfailureDomains := failureDomainsFromSpec(*mpool)\n\tfor idx := int64(0); idx < total; idx++ {\n\t\tfailureDomain := failureDomains[uint(idx)%uint(len(failureDomains))]\n\n\t\tproviderSpec := generateProviderSpec(\n\t\t\tclusterID,\n\t\t\tplatform,\n\t\t\tmpool,\n\t\t\tosImage,\n\t\t\trole,\n\t\t\tuserDataSecret,\n\t\t\ttrunkSupport,\n\t\t\tfailureDomain,\n\t\t)\n\n\t\tmachine := machineapi.Machine{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"machine.openshift.io/v1beta1\",\n\t\t\t\tKind: \"Machine\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: \"openshift-machine-api\",\n\t\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterID, pool.Name, idx),\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": role,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-type\": role,\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: machineapi.MachineSpec{\n\t\t\t\tProviderSpec: machineapi.ProviderSpec{\n\t\t\t\t\tValue: &runtime.RawExtension{Object: providerSpec},\n\t\t\t\t},\n\t\t\t\t// we don't need to set Versions, because we control those via operators.\n\t\t\t},\n\t\t}\n\t\tmachines = append(machines, machine)\n\t}\n\n\tmachineSetProviderSpec := generateProviderSpec(\n\t\tclusterID,\n\t\tplatform,\n\t\tmpool,\n\t\tosImage,\n\t\trole,\n\t\tuserDataSecret,\n\t\ttrunkSupport,\n\t\tmachinev1.OpenStackFailureDomain{RootVolume: &machinev1.RootVolume{}},\n\t)\n\n\treplicas := int32(total)\n\n\tcontrolPlaneMachineSet := &machinev1.ControlPlaneMachineSet{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"machine.openshift.io/v1\",\n\t\t\tKind: \"ControlPlaneMachineSet\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"openshift-machine-api\",\n\t\t\tName: \"cluster\",\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t},\n\t\t},\n\t\tSpec: machinev1.ControlPlaneMachineSetSpec{\n\t\t\tState: machinev1.ControlPlaneMachineSetStateActive,\n\t\t\tReplicas: &replicas,\n\t\t\tSelector: metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": role,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-type\": role,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: machinev1.ControlPlaneMachineSetTemplate{\n\t\t\t\tMachineType: machinev1.OpenShiftMachineV1Beta1MachineType,\n\t\t\t\tOpenShiftMachineV1Beta1Machine: &machinev1.OpenShiftMachineV1Beta1MachineTemplate{\n\t\t\t\t\tObjectMeta: machinev1.ControlPlaneMachineSetTemplateObjectMeta{\n\t\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": role,\n\t\t\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-type\": role,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tSpec: machineapi.MachineSpec{\n\t\t\t\t\t\tProviderSpec: machineapi.ProviderSpec{\n\t\t\t\t\t\t\tValue: &runtime.RawExtension{Object: machineSetProviderSpec},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif CPMSFailureDomains := pruneFailureDomains(failureDomains); CPMSFailureDomains != nil {\n\t\tcontrolPlaneMachineSet.Spec.Template.OpenShiftMachineV1Beta1Machine.FailureDomains = machinev1.FailureDomains{\n\t\t\tPlatform: v1.OpenStackPlatformType,\n\t\t\tOpenStack: CPMSFailureDomains,\n\t\t}\n\t}\n\treturn machines, controlPlaneMachineSet, nil\n}", "title": "" }, { "docid": "a8b5de4a15aa9cf7c453db82271e3a31", "score": "0.5186035", "text": "func host(hungryPhilosophers chan int, fedPhilosophers chan int) {\n\tvar a, b sync.Mutex\n\n\tcounter := 0\n\tfor {\n\t\t<-hungryPhilosophers\n\t\ta.Lock()\n\t\tcounter++\n\t\tif counter < 15 {\n\t\t\tb.Lock()\n\t\t\t<-hungryPhilosophers\n\t\t\tcounter++\n\t\t\t<-fedPhilosophers\n\t\t\tb.Unlock()\n\t\t}\n\t\t<-fedPhilosophers\n\t\ta.Unlock()\n\t}\n}", "title": "" }, { "docid": "535e129898a7b7566c3db7f60a13515b", "score": "0.51852566", "text": "func StartServer(servers []string, me int) *ShardMaster {\n\tsm := new(ShardMaster)\n\tsm.me = me\n\n\n\t//fmt.Printf(\"First Group GID = %d seq = %d \\n\" ,args.GID,sm.currentSeq)\n\t\n\tship1 := new(Op)\n\t//ship.Conf := new (Config)\n\tship1.Conf.Num = 0\n\tship1.Conf.Groups = make(map[int64][]string)\n\tship1.Conf.Groups[0] = []string{}\n\t//ship.Conf.Shards = []int64{}\n\t\n\t\n\t\n\t//sm.currentSeq = 0\n\n\n\t//sm.configs = make([]Config, 1)\n\t//sm.configs[0].Groups = map[int64][]string{}\n\t//sm.activeGroups = make([]int64,1)\n\t//sm.seenGID = make(map[int64]int)\n\n\trpcs := rpc.NewServer()\n\n\tgob.Register(Op{})\n\trpcs.Register(sm)\n\tsm.px = paxos.Make(servers, me, rpcs)\n\t\n\t// if sm.me == 0 {\n\t\t// fmt.Printf(\"Server %d send 0000000 \\n\" ,sm.me)\n\t\t// sm.px.Start(sm.currentSeq,ship1)\n\t// }\n\t\n\tsm.px.SetLog(0,*ship1)\n\t\n\t//fmt.Printf(\"Server %d send 0000000 \\n\" ,sm.me)\n\t//sm.px.Start(sm.currentSeq,ship1)\n\t\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tsm.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor sm.isdead() == false {\n\t\t\tconn, err := sm.l.Accept()\n\t\t\tif err == nil && sm.isdead() == false {\n\t\t\t\tif sm.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if sm.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && sm.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tsm.Kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn sm\n}", "title": "" }, { "docid": "f1192f785d4979f62969cad98d9f3a8c", "score": "0.51736504", "text": "func updateVirtualMachineLists() {\n\tcmd := exec.Command(\"pidof\", QEMU_BINARY_NAME)\n\tvar pids bytes.Buffer\n\tcmd.Stdout = &pids\n\terr := cmd.Run()\n\tif err != nil {\n\t\tif !OUT_BATCH {\n\t\t\tscreen.MovePrint(1, 0, fmt.Sprintf(\"no virtual machines for %s\", QEMU_BINARY_NAME))\n\t\t}\n\t\treturn\n\t}\n\tvmPpids := strings.Split(pids.String(), \" \")\n\t// run through all VMs' parent process ids (ppid)\n\tfor _, ppid := range vmPpids {\n\t\tppid = strings.Replace(ppid, \"\\n\", \"\", -1)\n\t\tif(ppid == \"\"){\n\t\t\tcontinue\n\t\t}\n\t\t// if vm is known\n\t\tif vmName, ok := ppid2vmname[ppid]; ok {\n\t\t\tvm := virtualmachines[vmName]\n\t\t\t// collect VM details in non-force-mode\n\t\t\tvm.CollectDetails(false)\n\t\t}else{\n\t\t\t// if vm is NOT known, create one\n\t\t\tvm := models.CreateVM(ppid)\n\t\t\t// collect VM details in force-mode\n\t\t\tvm.CollectDetails(true)\n\t\t\t// store VM in lists for later lookup\n\t\t\tvirtualmachines[vm.Name()] = vm\n\t\t\tppid2vmname[ppid] = vm.Name()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7356c86b95c298303c6d5043c2874571", "score": "0.51672035", "text": "func init() {\n\t//intialize free VNC port pool\n\tfor i := VNC_MIN_PORT; i <= VNC_MAX_PORT; i++ {\n\t\tfreeVNCPortPool = append(freeVNCPortPool,i)\n\t}\n\t//intialize free SSH port pool\n\tfor i := SSH_MIN_PORT; i <= SSH_MAX_PORT; i++ {\n\t\tfreeSSHPortPool = append(freeSSHPortPool,i)\n\t}\n\t//intialize free emulator port pool\n\tfor i := EMULATOR_MIN_PORT; i <= EMULATOR_MAX_PORT; i = i+2 {\n\t\tfreeEmulatorPortPool = append(freeEmulatorPortPool,i)\n\t}\n\n\t//intialize devices list\n\tRepoCreateDevice(Device{IMEI:\"357288042352104\", Status:\"available\", ADBName:\"4e640638\", IP:\"10.189.146.231\", ConnectedHostname: THIS_HOST_NAME})\n\t//RepoCreateDevice(Device{IMEI:\"353188020902633\", Status:\"available\", ADBName:\"G1002de5a083\", IP:\"192.168.1.17\", ConnectedHostname: THIS_HOST_NAME})\n\t//RepoCreateDevice(Device{IMEI:\"353188020902634\", Status:\"available\", ADBName:\"G1002de5a084\", IP:\"192.168.1.18\", ConnectedHostname: THIS_HOST_NAME})\n\n\n\t//fmt.Println(inventories)\n\t//fmt.Println(freeVNCPortPool)\n\t//fmt.Println(freeSSHPortPool)\n\t//fmt.Println(freeEmulatorPortPool)\n}", "title": "" }, { "docid": "4dcd8ac8fc3cb61e522122c11e3d3dfd", "score": "0.5149457", "text": "func startMachine(cfg *config.ClusterConfig, node *config.Node, delOnFail bool) (runner command.Runner, preExists bool, machineAPI libmachine.API, host *host.Host, err error) {\n\tm, err := machine.NewAPIClient()\n\tif err != nil {\n\t\treturn runner, preExists, m, host, errors.Wrap(err, \"Failed to get machine client\")\n\t}\n\thost, preExists, err = startHostInternal(m, cfg, node, delOnFail)\n\tif err != nil {\n\t\treturn runner, preExists, m, host, errors.Wrap(err, \"Failed to start host\")\n\t}\n\trunner, err = machine.CommandRunner(host)\n\tif err != nil {\n\t\treturn runner, preExists, m, host, errors.Wrap(err, \"Failed to get command runner\")\n\t}\n\n\tip, err := validateNetwork(host, runner, cfg.KubernetesConfig.ImageRepository)\n\tif err != nil {\n\t\treturn runner, preExists, m, host, errors.Wrap(err, \"Failed to validate network\")\n\t}\n\n\tif driver.IsQEMU(host.Driver.DriverName()) && network.IsBuiltinQEMU(cfg.Network) {\n\t\tapiServerPort, err := getPort()\n\t\tif err != nil {\n\t\t\treturn runner, preExists, m, host, errors.Wrap(err, \"Failed to find apiserver port\")\n\t\t}\n\t\tcfg.APIServerPort = apiServerPort\n\t}\n\n\t// Bypass proxy for minikube's vm host ip\n\terr = proxy.ExcludeIP(ip)\n\tif err != nil {\n\t\tout.FailureT(\"Failed to set NO_PROXY Env. Please use `export NO_PROXY=$NO_PROXY,{{.ip}}`.\", out.V{\"ip\": ip})\n\t}\n\n\treturn runner, preExists, m, host, err\n}", "title": "" }, { "docid": "6e5887d3b7772b25d5e7eabe2fd531c0", "score": "0.5147835", "text": "func TestServerAll(t *testing.T) {\n\tes1 := NewEchoServer(server1)\n\tes2 := NewEchoServer(server2)\n\tes3 := NewEchoServer(server3)\n\ttime.Sleep(1 * time.Second)\n\ttestServer(t, proxy, server1)\n\tes1.stop()\n\n\tif backends[0].failed == true {\n\t\tt.Fatal(\"server1 failed\")\n\t}\n\n\ttime.Sleep(1 * time.Second)\n\ttestServer(t, proxy, server2)\n\tes2.stop()\n\n\tif backends[0].failed == false {\n\t\tt.Fatal(\"server1 didn't fail\")\n\t}\n\tif backends[1].failed == true {\n\t\tt.Fatal(\"server2 failed\")\n\t}\n\n\ttime.Sleep(1 * time.Second)\n\ttestServer(t, proxy, server3)\n\tes3.stop()\n\n\tif backends[0].failed == false {\n\t\tt.Fatal(\"server1 didn't fail\")\n\t}\n\tif backends[1].failed == false {\n\t\tt.Fatal(\"server2 didn't fail\")\n\t}\n\tif backends[2].failed == true {\n\t\tt.Fatal(\"server3 failed\")\n\t}\n\n}", "title": "" }, { "docid": "664829a71ea62fb291343e1db24ddbcc", "score": "0.5139186", "text": "func genMaster1Deploy(c *cluster.Cluster,m *cluster.Machine) *cluster.Deploy {\n\n d := c.NewDeploy(\"first master\")\n\n m.Cluster().FindMachine(\"haproxy-0\")\n\n\n\n\n d.AddCommand(\"kubeadm init --apiserver-advertise-address=%s --apiserver-cert-extra-sans=%s --node-name %s --pod-network-cidr=172.16.0.0/16\",\n m.IP,m.IP,m.Fqdn())\n d.AddCommand(\"export KUBECONFIG=/etc/kubernetes/admin.conf\")\n d.AddCommand(\"kubectl apply -f https://raw.githubusercontent.com/ecomm-integration-ballerina/kubernetes-cluster/master/calico/rbac-kdd.yaml\")\n d.AddCommand(\"kubectl apply -f https://raw.githubusercontent.com/ecomm-integration-ballerina/kubernetes-cluster/master/calico/calico.yaml\")\n d.AddCommand(\"kubeadm token create --print-join-command > /vagrant/join.sh\")\n d.AddCommand(\"kubeadm token create --print-join-command > /vagrant/mjoin.sh\")\n d.AddCommand(\"echo '--experimental-control-plane' >> /vagrant/mjoin.sh\")\n d.AddCommand(\"chmod +x /vagrant/join.sh\")\n d.AddCommand(\"chmod +x /vagrant/mjoin.sh\")\n d.AddCommand(\"cp /etc/kubernetes/admin.conf /vagrant/config.kube\")\n d.AddCommand(\"tar zcvf /vagrant/certs.tar.gz /etc/kubernetes/admin.conf /etc/kubernetes/pki/ca.crt /etc/kubernetes/pki/ca.key /etc/kubernetes/pki/sa.key /etc/kubernetes/pki/sa.pub /etc/kubernetes/pki/front-proxy-ca.crt /etc/kubernetes/pki/front-proxy-ca.key /etc/kubernetes/pki/etcd/ca.crt /etc/kubernetes/pki/etcd/ca.key\")\n return d\n}", "title": "" }, { "docid": "36a038ea6f3ad18224e1649d494ec2f7", "score": "0.51339406", "text": "func (md *machineDeployment) deployMachinesApp(ctx context.Context) error {\n\tif err := md.runReleaseCommand(ctx); err != nil {\n\t\treturn fmt.Errorf(\"release command failed - aborting deployment. %w\", err)\n\t}\n\n\tif err := md.machineSet.AcquireLeases(ctx, md.leaseTimeout); err != nil {\n\t\treturn err\n\t}\n\tdefer md.machineSet.ReleaseLeases(ctx) // skipcq: GO-S2307\n\tmd.machineSet.StartBackgroundLeaseRefresh(ctx, md.leaseTimeout, md.leaseDelayBetween)\n\n\tprocessGroupMachineDiff := md.resolveProcessGroupChanges()\n\tmd.warnAboutProcessGroupChanges(ctx, processGroupMachineDiff)\n\n\tif md.strategy == \"canary\" && !md.isFirstDeploy {\n\t\tcanaryMachines := []machine.LeasableMachine{}\n\t\tgroupsInConfig := md.appConfig.ProcessNames()\n\t\ttotal := len(groupsInConfig)\n\t\tfor idx, name := range groupsInConfig {\n\t\t\tfmt.Fprintf(md.io.Out, \"Creating canary machine for group %s\\n\", md.colorize.Bold(name))\n\t\t\tmachine, err := md.spawnMachineInGroup(ctx, name, idx, total, nil,\n\t\t\t\twithMeta(metadata{key: \"fly_canary\", value: \"true\"}),\n\t\t\t\twithGuest(md.inferCanaryGuest(name)),\n\t\t\t\twithDns(&api.DNSConfig{SkipRegistration: true}),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcanaryMachines = append(canaryMachines, machine)\n\t\t}\n\n\t\tfmt.Fprintf(md.io.Out, \"Canary machines successfully created and healthy, destroying before continuing\\n\")\n\t\tfor _, mach := range canaryMachines {\n\t\t\tif err := machcmd.Destroy(ctx, md.app, mach.Machine(), true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Destroy machines that don't fit the current process groups\n\tif err := md.machineSet.RemoveMachines(ctx, processGroupMachineDiff.machinesToRemove); err != nil {\n\t\treturn err\n\t}\n\tfor _, mach := range processGroupMachineDiff.machinesToRemove {\n\t\tif err := machcmd.Destroy(ctx, md.app, mach.Machine(), true); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !md.updateOnly {\n\n\t\t// Create machines for new process groups\n\t\tgroupsWithAutostopEnabled := make(map[string]bool)\n\t\tgroups := maps.Keys(processGroupMachineDiff.groupsNeedingMachines)\n\t\ttotal := len(groups)\n\t\tslices.Sort(groups)\n\t\tfor idx, name := range groups {\n\t\t\tfmt.Fprintf(md.io.Out, \"No machines in group %s, launching a new machine\\n\", md.colorize.Bold(name))\n\t\t\tleasableMachine, err := md.spawnMachineInGroup(ctx, name, idx, total, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tgroupConfig, err := md.appConfig.Flatten(name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tservices := groupConfig.AllServices()\n\t\t\tfor _, s := range services {\n\t\t\t\tif s.AutoStopMachines != nil && *s.AutoStopMachines == true {\n\t\t\t\t\tgroupsWithAutostopEnabled[name] = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Create spare machines that increases availability unless --ha=false was used\n\t\t\tif !md.increasedAvailability {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// We strive to provide a HA setup according to:\n\t\t\t// - Create only 1 machine if the group has mounts\n\t\t\t// - Create 2 machines for groups with services\n\t\t\t// - Create 1 always-on and 1 standby machine for groups without services\n\t\t\tswitch {\n\t\t\tcase len(groupConfig.Mounts) > 0:\n\t\t\t\tcontinue\n\t\t\tcase len(services) > 0:\n\t\t\t\tfmt.Fprintf(md.io.Out, \"Creating a second machine to increase service availability\\n\")\n\t\t\t\tif _, err := md.spawnMachineInGroup(ctx, name, idx, total, nil); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfmt.Fprintf(md.io.Out, \"Creating a standby machine for %s\\n\", md.colorize.Bold(leasableMachine.Machine().ID))\n\t\t\t\tstandbyFor := []string{leasableMachine.Machine().ID}\n\t\t\t\tif _, err := md.spawnMachineInGroup(ctx, name, idx, total, standbyFor); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif total > 0 {\n\t\t\tfmt.Fprintf(md.io.ErrOut, \"Finished launching new machines\\n\")\n\t\t}\n\n\t\tif len(groupsWithAutostopEnabled) > 0 {\n\t\t\tgroupNames := lo.Keys(groupsWithAutostopEnabled)\n\t\t\tslices.Sort(groupNames)\n\t\t\tfmt.Fprintf(md.io.Out,\n\t\t\t\t\"\\n%s The machines for [%s] have services with 'auto_stop_machines = true' that will be stopped when idling\\n\\n\",\n\t\t\t\tmd.colorize.Yellow(\"NOTE:\"),\n\t\t\t\tmd.colorize.Bold(strings.Join(groupNames, \",\")),\n\t\t\t)\n\t\t}\n\t}\n\n\tvar machineUpdateEntries []*machineUpdateEntry\n\tfor _, lm := range md.machineSet.GetMachines() {\n\t\tli, err := md.launchInputForUpdate(lm.Machine())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to update machine configuration for %s: %w\", lm.FormattedMachineId(), err)\n\t\t}\n\t\tmachineUpdateEntries = append(machineUpdateEntries, &machineUpdateEntry{leasableMachine: lm, launchInput: li})\n\t}\n\n\treturn md.updateExistingMachines(ctx, machineUpdateEntries)\n}", "title": "" }, { "docid": "4427814d5016cc9c9da55194b393146e", "score": "0.5131756", "text": "func Launch(config qemu.MachineConfig) error {\n\n\tports, err := utils.ParsePort(config.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\thostports := make([]string, len(ports))\n\tfor i, p := range ports {\n\t\thostports[i] = strconv.Itoa(p.Host)\n\t}\n\tallPorts := append([]string{config.SSHPort}, hostports...)\n\n\tfor _, p := range allPorts {\n\t\terr := utils.Ping(\"localhost\", p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = config.Launch()\n\tif err != nil {\n\t\tconfig.Stop()\n\t\tconfig.CleanPIDFile()\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc9b79d631adfdf67e9e1673083bc16d", "score": "0.5120767", "text": "func StartServer(gid int64, shardmasters []string,\n\tservers []string, me int) *ShardKV {\n\tgob.Register(Op{})\n gob.Register(GetArgs{})\n gob.Register(GetReply{})\n gob.Register(PutAppendReply{})\n gob.Register(DummyArgs{})\n gob.Register(DeleteShardArgs{}) \n gob.Register(Pair{})\n gob.Register(PutAppendArgs{})\n gob.Register(SendShardArgs{})\n\tkv := new(ShardKV)\n\tkv.me = me\n\tkv.gid = gid\n\tkv.sm = shardmaster.MakeClerk(shardmasters)\n kv.muSeq = make(map[string]*sync.Mutex)\n\t// Your initialization code here.\n\t// Don't call Join().\n kv.current_config =shardmaster.Config{}\n\tkv.previous_config = shardmaster.Config{}\n kv.storage =map[string]string{}\n kv.next_config_num= -1\n kv.shards =make ([]bool,shardmaster.NShards)\n kv.current_config.Groups = map[int64][]string{}\n kv.previous_config.Groups = map[int64][]string{}\n kv.ops= map[int] Op{}\n kv.seen = map[int64]bool{}\n kv.applied = map[int64] bool{}\n kv.cache = map[int64] Err{}\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n \n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.isdead() == false {\n\t\t\t\tif kv.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor kv.isdead() == false {\n\t\t\tkv.tick()\n\t\t\ttime.Sleep(250 * time.Millisecond)\n\t\t}\n\t}()\n\n\treturn kv\n}", "title": "" }, { "docid": "11ff784d9994e9c77cf694c4408b9388", "score": "0.5118273", "text": "func (srv *Launcher) startServers(wg *sync.WaitGroup) {\n\tfor name, server := range srv.servers {\n\t\tgo func(n string, s Server) {\n\t\t\tlog.Printf(\"Start server %s\", n)\n\t\t\tif err := s.Serve(); err != nil {\n\t\t\t\tlog.Printf(\"Server %s has been stoped or failed to start, %+v\", n, err)\n\t\t\t}\n\t\t\tlog.Println(\"Server terminated successfully\")\n\t\t\twg.Done()\n\t\t}(name, server)\n\t}\n}", "title": "" }, { "docid": "95130afd3b8663ced75bfe753307853c", "score": "0.5112702", "text": "func runMN(cmd *Command, args []string) bool {\n\tif *mn.MaxCPU < 1 {\n\t\t*mn.MaxCPU = runtime.NumCPU()\n\t}\n\truntime.GOMAXPROCS(*mn.MaxCPU)\n\n\tif err := util.TestFolderWritable(*mn.MetaFolder); err != nil {\n\t\tglog.Fatalf(\"Check Meta Folder (-mdir) Writable %s : %s\", *mn.MetaFolder, err)\n\t}\n\tmn.RegistRouter()\n\tmn.StartServer()\n\n\treturn true\n}", "title": "" }, { "docid": "e66533418edd3cfb454ebf2f1daa6b35", "score": "0.5111201", "text": "func (p *proxyrunner) bootstrap() {\n\tvar (\n\t\tsmap *smapX\n\t\turl string\n\t\tpname = p.si.Name()\n\t\tconfig = cmn.GCO.Get()\n\t\tsecondary, loaded bool\n\t)\n\t// 1: load a local copy and try to utilize it for discovery\n\tsmap = newSmap()\n\tsmap.Pmap[p.si.DaemonID] = p.si\n\tif err := p.smapowner.load(smap, config); err == nil {\n\t\tloaded = true\n\t}\n\t// 2: am primary (tentative)\n\tprimaryEnv, _ := cmn.ParseBool(os.Getenv(\"AIS_PRIMARYPROXY\"))\n\tglog.Infof(\"%s: %s, loaded=%t, primary-env=%t\", pname, smap.StringEx(), loaded, primaryEnv)\n\tif loaded {\n\t\tsecondary = !smap.isPrimary(p.si)\n\t\tif secondary {\n\t\t\turl = smap.ProxySI.IntraControlNet.DirectURL\n\t\t\t// TODO if disagreement: url2 = found.ProxySI.IntraControlNet.DirectURL - and use it\n\t\t}\n\t} else {\n\t\tsecondary = !primaryEnv\n\t\tsmap = nil\n\t\tif secondary {\n\t\t\turl = config.Proxy.PrimaryURL // NOTE: PublicNet, not IntraControlNet\n\t\t}\n\t}\n\t// 4: join cluster as secondary\n\tif secondary {\n\t\tglog.Infof(\"%s: starting up as non-primary, joining via %s\", pname, url)\n\t\tvar err error\n\t\tif err = p.secondaryStartup(url); err != nil {\n\t\t\tif loaded {\n\t\t\t\tmaxVerSmap, _ := p.uncoverMeta(smap)\n\t\t\t\tif maxVerSmap != nil && maxVerSmap.ProxySI != nil {\n\t\t\t\t\turl = maxVerSmap.ProxySI.IntraControlNet.DirectURL\n\t\t\t\t\tglog.Infof(\"%s: second attempt - join via %s\", pname, url)\n\t\t\t\t\terr = p.secondaryStartup(url)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tglog.Fatalf(\"FATAL: %s failed to join, err: %v\", pname, err)\n\t\t}\n\t\treturn\n\t}\n\t// 5: keep starting up as a primary\n\tglog.Infof(\"%s: assuming the primary role for now, starting up...\", pname)\n\tgo p.primaryStartup(smap, config, clivars.ntargets)\n}", "title": "" }, { "docid": "8fff39726a3d1216fa6e4cf351a9064f", "score": "0.51021945", "text": "func Run() {\n\tjump_host_connection := ConnectToJumpHost()\n\tsecondary_host_connection := ConnectToSecondary( jump_host_connection )\n\tfmt.Println( secondary_host_connection )\n\n\tSOCKS_HOST_IP := \"127.0.0.1\"\n\tSOCKS_PROXY_PORT := 10017\n\n\tsocks_address_string := fmt.Sprintf( \"%s:%d\" , SOCKS_HOST_IP , SOCKS_PROXY_PORT )\n\tsocks_listener , err := net.Listen( \"tcp\" , socks_address_string )\n\tif err != nil {\n\t\tlog.Fatalf( \"unable to listen on SOCKS port [%s]: %v\" , socks_address_string , err )\n\t}\n\tdefer socks_listener.Close()\n\tlog.Printf( \"listening for incoming SOCKS connections on [%s]\\n\" , socks_address_string )\n\n\tfor {\n\t\tsocks_connection , socks_connection_error := socks_listener.Accept()\n\t\tif socks_connection_error != nil {\n\t\t\tlog.Fatalf( \"failed to accept incoming SOCKS connection: %v\" , socks_connection_error )\n\t\t}\n\t\tgo HandleSOCKS5Connection( socks_connection.( *net.TCPConn ) , secondary_host_connection )\n\t}\n\tlog.Println( \"waiting for all existing connections to finish\" )\n\tconnections.Wait()\n\tlog.Println( \"shutting down\" )\n}", "title": "" }, { "docid": "7f8849a29950d66f75851b2576b021fa", "score": "0.5099926", "text": "func iniReplicate() {\n\tif Master == \"\" {\n\t\ttime.Sleep(time.Duration(2) * time.Second)\n\t\tfileSet := make(map[string]bool)\n\t\tfor _, fileList := range Metas {\n\t\t\tfor _, file := range fileList {\n\t\t\t\tif _, ok := fileSet[file.FileName]; !ok {\n\t\t\t\t\tfileSet[file.FileName] = true\n\t\t\t\t\tdst, src := checkFileReplica(file)\n\t\t\t\t\tif len(src) < replica && len(dst) > 0 {\n\t\t\t\t\t\treReplicate(file.FileName, dst, src)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2e8c74fed391d70ee87e95545a576f01", "score": "0.50872415", "text": "func (server *Server) initPerLaunchData() {\n\tserver.pool = sessionpool.New()\n\tserver.clients = make(map[uint32]*Client)\n\tserver.hclients = make(map[string][]*Client)\n\tserver.hpclients = make(map[string]*Client)\n\n\tserver.bye = make(chan bool)\n\tserver.incoming = make(chan *Message)\n\tserver.voicebroadcast = make(chan *VoiceBroadcast)\n\tserver.cfgUpdate = make(chan *KeyValuePair)\n\tserver.tempRemove = make(chan *Channel, 1)\n\tserver.clientAuthenticated = make(chan *Client)\n}", "title": "" }, { "docid": "d8047c4c96ec4717458e16b1585012ea", "score": "0.508649", "text": "func (sp *SlavePool) setRunning(set bool) {\n\tif set {\n\t\tatomic.StoreUint32(&sp.running, 1)\n\t} else {\n\t\tatomic.StoreUint32(&sp.running, 0)\n\t}\n}", "title": "" }, { "docid": "e42cd2ae3f7db5fd35a13a36e7450d14", "score": "0.5080219", "text": "func (c *MachineConfig) Start() error {\n\n\texposedPorts := \"user,id=net0,hostfwd=tcp::\" + c.SSHPort + \"-:22\"\n\n\tports, err := utils.ParsePort(c.Port)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error configuring ports: %v\\n\", err)\n\t}\n\tfor _, p := range ports {\n\t\thostp := strconv.Itoa(p.Host)\n\t\tguestp := strconv.Itoa(p.Guest)\n\t\tif p.Proto == utils.Tcp {\n\t\t\texposedPorts += \",hostfwd=tcp::\" + hostp + \"-:\" + guestp\n\t\t} else { // Udp\n\t\t\texposedPorts += \",hostfwd=udp::\" + hostp + \"-:\" + guestp\n\t\t}\n\t}\n\n\tqemuCmd := \"qemu-system-\" + c.Arch\n\n\tvar qemuArgs []string\n\n\thostCPU := \"\"\n\n\tif c.IsNativeArch() {\n\t\tif c.HasHostCPU() {\n\t\t\thostCPU = \"_host\"\n\t\t}\n\t}\n\n\thostCPUType := c.Arch + hostCPU\n\thugePages := \"\"\n\n\tif hostCPUType == \"x86_64_host\" {\n\t\tsupports, err := utils.SupportsHugePages()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !supports {\n\t\t\thugePages = \",pdpe1gb=off\"\n\t\t}\n\t}\n\n\tcpuType := map[string]string{\n\t\t\"aarch64\": \"cortex-a72\",\n\t\t\"x86_64\": \"qemu64,+avx,+avx2\",\n\t\t\"x86_64_host\": \"host\" + hugePages,\n\t\t\"aarch64_host\": \"host\"}\n\n\tcpu := cpuType[c.Arch+hostCPU]\n\n\thighmem := \"off\"\n\tintMem, err := strconv.Atoi(c.Memory)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif intMem > 2000 {\n\t\thighmem = \"on\"\n\t}\n\n\taarch64Args := []string{\n\t\t\"-M\", \"virt,highmem=\" + highmem,\n\t\t\"-bios\", filepath.Join(c.Location, \"qemu_efi.fd\")}\n\n\tx86Args := []string{\n\t\t\"-global\", \"PIIX4_PM.disable_s3=1\",\n\t\t\"-global\", \"ICH9-LPC.disable_s3=1\",\n\t}\n\n\tmountArgs := []string{\"-fsdev\", \"local,path=\" + c.Mount + \",security_model=mapped-xattr,id=host0\",\n\t\t\"-device\", \"virtio-9p-pci,fsdev=host0,mount_tag=host0\"}\n\n\tcommonArgs := []string{\n\t\t\"-m\", c.Memory,\n\t\t\"-cpu\", cpu,\n\t\t\"-accel\", c.GetAccel(),\n\t\t\"-smp\", \"cpus=\" + c.CPU + \",sockets=1,cores=\" + c.CPU + \",threads=1\",\n\t\t\"-drive\", \"if=virtio,file=\" + filepath.Join(c.Location, c.Image),\n\t\t\"-nographic\",\n\t\t\"-netdev\", exposedPorts,\n\t\t\"-device\", \"e1000,netdev=net0,mac=\" + c.MACAddress,\n\t\t\"-pidfile\", filepath.Join(c.Location, \"alpine.pid\"),\n\t\t\"-chardev\", \"socket,id=char-serial,path=\" + filepath.Join(c.Location,\n\t\t\t\"alpine.sock\") + \",server=on,wait=off,logfile=\" + filepath.Join(c.Location, \"alpine.log\"),\n\t\t\"-serial\", \"chardev:char-serial\",\n\t\t\"-chardev\", \"socket,id=char-qmp,path=\" + filepath.Join(c.Location, \"alpine.qmp\") + \",server=on,wait=off\",\n\t\t\"-qmp\", \"chardev:char-qmp\",\n\t\t\"-parallel\", \"none\",\n\t\t\"-device\", \"virtio-rng-pci\",\n\t\t\"-rtc\", \"base=utc,clock=host\",\n\t\t\"-daemonize\",\n\t\t\"-name\", c.Alias}\n\n\tif c.Arch == \"aarch64\" {\n\t\tqemuArgs = append(aarch64Args, commonArgs...)\n\t}\n\tif c.Arch == \"x86_64\" {\n\t\tqemuArgs = append(x86Args, commonArgs...)\n\t}\n\n\tif c.Mount != \"\" {\n\t\tqemuArgs = append(qemuArgs, mountArgs...)\n\t}\n\n\tcmd := exec.Command(qemuCmd, qemuArgs...)\n\n\tcmd.Stdout = os.Stdout\n\n\t// Uncomment to debug qemu messages\n\tcmd.Stderr = os.Stderr\n\n\tlog.Println(\"booting \" + c.Alias)\n\terr = cmd.Run()\n\tif err != nil {\n\t\tc.Stop()\n\t\tc.CleanPIDFile()\n\t\treturn err\n\t}\n\n\tlog.Println(\"awaiting ssh server...\")\n\terr = c.Exec(\"hwclock -s\", true) // root=true i.e. run as root\n\tif err != nil {\n\t\tc.Stop()\n\t\tc.CleanPIDFile()\n\t\treturn err\n\t}\n\n\tif c.Mount != \"\" {\n\t\tbasename := filepath.Base(c.Mount)\n\t\tmntcmd := make([]string, 3)\n\t\tmntcmd[0] = \"mkdir -p /mnt/\" + basename\n\t\tmntcmd[1] = \"chmod 777 /mnt/\" + basename\n\t\tmntcmd[2] = \"mount -t 9p -o trans=virtio,version=9p2000.L,msize=104857600 host0 /mnt/\" + basename\n\t\tif err := c.Exec(strings.Join(mntcmd, \" && \"), true); err != nil {\n\t\t\tlog.Println(\"error mounting directory: \" + err.Error())\n\t\t} else {\n\t\t\tlog.Println(\"mounted \" + c.Mount + \" on /mnt/\" + basename)\n\t\t}\n\t}\n\n\tstatus, pid := c.Status()\n\tif status != \"Running\" {\n\t\treturn errors.New(\"unable to start instance\")\n\t}\n\n\tlog.Println(c.Alias + \" started (\" + strconv.Itoa(pid) + \")\")\n\treturn nil\n}", "title": "" }, { "docid": "e1eac95816d8a1ab2e15e47dc81ba6bf", "score": "0.5076126", "text": "func main() {\n\n\tif os.Getenv(\"C\") == \"\" {\n\t\tlog.Fatalf(\"Must declare environement variable $C with compartment-id\")\n\t\treturn\n\t}\n\n\t// run 4ever to scan for running instances then stop them\n\tfor {\n\n\t\t// every 5 seconds scan for instances in compartment\n\t\t// change this timer to some time after 6 pm CST\n\t\tlog.Printf(\"Waiting 5 seconds\\n\")\n\t\ttime.Sleep(5 * time.Second)\n\n\t\tlistOfRunningInstances := scan.OciEnv()\n\n\t\t// stop compute instances that are running\n\t\tadmin.StopOCIComputeInstances(listOfRunningInstances)\n\n\t}\n\n}", "title": "" }, { "docid": "9295a2f48d886472d6d432cbf2cd2aed", "score": "0.5066407", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n px := &Paxos{}\n px.peers = peers\n px.me = me\n\n // Your initialization code here.\n px.instances = make(map[int]*instance)\n px.done = make(map[int]int)\n\n for i := range px.peers {\n px.done[i] = -1\n }\n px.max = -1\n\n if rpcs != nil {\n // caller will create socket &c\n rpcs.Register(px)\n } else {\n rpcs = rpc.NewServer()\n rpcs.Register(px)\n\n // prepare to receive connections from clients.\n // change \"unix\" to \"tcp\" to use over a network.\n //os.Remove(peers[me]) // only needed for \"unix\"\n\n strs := strings.Split(peers[me], \":\")\n if (len(strs) != 2) {\n log.Fatal(\"Bad IP address and port number format!\")\n }\n port := strs[1]\n l, e := net.Listen(\"tcp\", \":\" + port);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n px.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n // create a thread to accept RPC connections\n go func() {\n for px.dead == false {\n conn, err := px.l.Accept()\n if err == nil && px.dead == false {\n if px.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if px.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.TCPConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n px.rpcCount++\n go rpcs.ServeConn(conn)\n } else {\n px.rpcCount++\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && px.dead == false {\n fmt.Printf(\"Paxos(%v) accept: %v\\n\", me, err.Error())\n }\n }\n }()\n }\n\n return px\n}", "title": "" }, { "docid": "4403a4659b797b221c22d28e600bbd1e", "score": "0.50620407", "text": "func newMachine(meta MachineMeta, cmdnums int) (*Machine, error) {\n\tm := &Machine{}\n\tif meta.IP == \"\" {\n\t\treturn m, errors.New(\"IP can not be empty\")\n\t}\n\tif meta.Port == 0 {\n\t\tmeta.Port = 22\n\t}\n\tif meta.Host == \"\" {\n\t\tmeta.Host = meta.IP\n\t}\n\tm.MachineMeta = meta\n\tm.statistic.total = cmdnums\n\tm.commandResult = make(chan CommandResult, cmdnums)\n\tm.done = make(chan struct{})\n\treturn m, nil\n}", "title": "" }, { "docid": "32140ac8f5fd76965225cf951fb3bd18", "score": "0.5059089", "text": "func StartServer(gid int64, shardmasters []string,\n servers []string, me int) *ShardKV {\n gob.Register(Op{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n\n // Your initialization code here.\n kv.doneSeq = 0\n kv.config.Groups = map[int64][]string{}\n kv.KVData = make(map[string] string)\n kv.dupRPC = make(map[string] RPCResult)\n // Don't call Join().\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n\n return kv\n}", "title": "" }, { "docid": "d46498b0a9d18270e561a8ee1982ddf6", "score": "0.5050172", "text": "func (m *Master) server() {\n\tmaptasks = make(chan string, 5)\n\treducetasks = make(chan int, 5)\n\t\n\trpc.Register(m)\n\trpc.HandleHTTP()\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\t\t\n\tgo m.generateTask()\n\tsockname := masterSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "b0d31c567b6b08029428552e7c5f7fea", "score": "0.5049956", "text": "func main() {\n\tlog.SetOutput(os.Stdout)\n\n\tconfigure()\n\n\tgo func() {\n\t\tlog.Println(http.ListenAndServe(\":9091\", nil))\n\t}()\n\n\tnetViewMap := make(map[string]*seed.ChainView)\n\n\tif *bitcoinNodeHost != \"\" && *bitcoinTLSPath != \"\" && *bitcoinMacPath != \"\" {\n\t\tlog.Infof(\"Creating BTC chain view\")\n\n\t\tlndNode, err := initLightningClient(\n\t\t\t*bitcoinNodeHost, *bitcoinTLSPath, *bitcoinMacPath,\n\t\t)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"unable to connect to btc lnd: %v\", err))\n\t\t}\n\n\t\tnView := seed.NewNetworkView(\"bitcoin\")\n\t\tgo poller(lndNode, nView)\n\n\t\tlog.Infof(\"BTC chain view active\")\n\n\t\tnetViewMap[\"\"] = &seed.ChainView{\n\t\t\tNetView: nView,\n\t\t\tNode: lndNode,\n\t\t}\n\n\t}\n\n\tif *monacoinNodeHost != \"\" && *monacoinTLSPath != \"\" && *monacoinMacPath != \"\" {\n\t\tlog.Infof(\"Creating MONA chain view\")\n\n\t\tlndNode, err := initLightningClient(\n\t\t\t*monacoinNodeHost, *monacoinTLSPath, *monacoinMacPath,\n\t\t)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"unable to connect to mona lnd: %v\", err))\n\t\t}\n\n\t\tnView := seed.NewNetworkView(\"monacoin\")\n\t\tgo poller(lndNode, nView)\n\n\t\tnetViewMap[\"\"] = &seed.ChainView{\n\t\t\tNetView: nView,\n\t\t\tNode: lndNode,\n\t\t}\n\n\t}\n\tif *testNodeHost != \"\" && *testTLSPath != \"\" && *testMacPath != \"\" {\n\t\tlog.Infof(\"Creating MONA testnet chain view\")\n\n\t\tlndNode, err := initLightningClient(\n\t\t\t*testNodeHost, *testTLSPath, *testMacPath,\n\t\t)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"unable to connect to test lnd: %v\", err))\n\t\t}\n\n\t\tnView := seed.NewNetworkView(\"testnet\")\n\t\tgo poller(lndNode, nView)\n\n\t\tlog.Infof(\"TMONA chain view active\")\n\n\t\tnetViewMap[\"test.\"] = &seed.ChainView{\n\t\t\tNetView: nView,\n\t\t\tNode: lndNode,\n\t\t}\n\t}\n\n\tif len(netViewMap) == 0 {\n\t\tpanic(fmt.Sprintf(\"must specify at least one node type\"))\n\t}\n\n\trootIP := net.ParseIP(*authoritativeIP)\n\tdnsServer := seed.NewDnsServer(\n\t\tnetViewMap, *listenAddr, *rootDomain, rootIP,\n\t)\n\n\tdnsServer.Serve()\n}", "title": "" }, { "docid": "12bd6d9062e4ce36029f9c6acb709aa5", "score": "0.50378674", "text": "func manage_connection(nodes int) {\n\tquit_timer := time.NewTimer(time.Duration(10*nodes) * time.Second)\n\n\t// Wait timer\n\t<-quit_timer.C\n\n\tos.Exit(0)\n}", "title": "" }, { "docid": "be30c438d497b01a2819a97849f58184", "score": "0.5035918", "text": "func main() {\n\tvar err error\n\n\tst := get_settings()\n\n\ts, err := get_scheduler(st)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to get scheduler: %v\", err)\n\t\treturn\n\t}\n\n\ttasks := get_tasks(st)\n\n\t// Let the scheduler know about the task types.\n\tfor name, task := range tasks {\n\t\terr = s.InitScheduler(name, &task)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to start task %s: %v\", name, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check if there are already any of these containers running\n\terr = s.CountAllTasks(tasks)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to count containers. %v\", err)\n\t}\n\n\t// Prepare for cleanup when we receive an interrupt\n\tclosedown := make(chan os.Signal, 1)\n\tsignal.Notify(closedown, os.Interrupt)\n\tsignal.Notify(closedown, syscall.SIGTERM)\n\n\t// Listen for demand on a websocket (we'll also use this to send metrics)\n\tdemandUpdate := make(chan []api.TaskDemand, 1)\n\tws, err := api.InitWebSocket()\n\tgo api.Listen(ws, demandUpdate)\n\n\t// Periodically send state to the API if required\n\tvar sendMetricsTimeout *time.Ticker\n\tif st.sendMetrics {\n\t\tsendMetricsTimeout = time.NewTicker(const_sendMetrics_sleep * time.Millisecond)\n\t}\n\n\t// Only allow one scaling command and one metrics send to be outstanding at a time\n\tready := make(chan struct{}, 1)\n\tmetrics_ready := make(chan struct{}, 1)\n\tvar scaling_ready bool = true\n\tvar sendMetrics_ready bool = true\n\tvar cleanup_when_ready bool = false\n\tvar exit_when_ready bool = false\n\n\t// Loop, continually checking for changes in demand that need to be scheduled\n\t// At the moment we plough on regardless in the face of errors, simply logging them out\n\tfor {\n\t\tselect {\n\t\tcase td := <-demandUpdate:\n\t\t\t// Don't do anything if we're about to exit\n\t\t\tif cleanup_when_ready || exit_when_ready {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// If we already have a scaling change outstanding, we can't do another one\n\t\t\tif scaling_ready {\n\t\t\t\tscaling_ready = false\n\t\t\t\tgo func() {\n\t\t\t\t\terr = handleDemandChange(td, s, tasks)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Failed to handle demand change. %v\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Notify the channel when the scaling command has completed\n\t\t\t\t\tready <- struct{}{}\n\t\t\t\t}()\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Scale still outstanding\")\n\t\t\t}\n\n\t\tcase <-sendMetricsTimeout.C:\n\t\t\tif sendMetrics_ready {\n\t\t\t\tlog.Println(\"Sending metrics\")\n\t\t\t\tsendMetrics_ready = false\n\t\t\t\tgo func() {\n\t\t\t\t\t// Find out how many instances of each task are running\n\t\t\t\t\terr = s.CountAllTasks(tasks)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Failed to count containers. %v\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\terr = api.SendMetrics(ws, st.userID, tasks)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Failed to send metrics. %v\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Notify the channel when the API call has completed\n\t\t\t\t\tmetrics_ready <- struct{}{}\n\t\t\t\t}()\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Not ready to send metrics\")\n\t\t\t}\n\n\t\tcase <-ready:\n\t\t\tif exit_when_ready {\n\t\t\t\tlog.Printf(\"All finished\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\t// An outstanding scale command has finished so we are OK to send another one\n\t\t\tif cleanup_when_ready {\n\t\t\t\tlog.Printf(\"Cleaning up\")\n\t\t\t\texit_when_ready = true\n\t\t\t\tgo func() {\n\t\t\t\t\tcleanup(s, tasks)\n\t\t\t\t\tready <- struct{}{}\n\t\t\t\t}()\n\t\t\t} else {\n\t\t\t\tscaling_ready = true\n\t\t\t}\n\n\t\tcase <-metrics_ready:\n\t\t\t// Finished sending metrics so we are OK to send another one\n\t\t\tsendMetrics_ready = true\n\n\t\tcase <-closedown:\n\t\t\tlog.Printf(\"Clean up when ready\")\n\t\t\tcleanup_when_ready = true\n\t\t\tif scaling_ready {\n\t\t\t\t// Trigger it now\n\t\t\t\tready <- struct{}{}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6ccf8866b9e7f35a0c6cd94198dc79ef", "score": "0.50323933", "text": "func podmanNetworksReliably(c cluster.TestCluster) {\n\tm := c.Machines()[0]\n\n\ttutil.GenPodmanScratchContainer(c, m, \"ping\", []string{\"sh\", \"ping\"})\n\n\toutput := c.MustSSH(m, `for i in $(seq 1 100); do\n\t\techo -n \"$i: \"\n\t\tsudo podman run --rm ping sh -c 'ping -i 0.2 10.88.0.1 -w 1 >/dev/null && echo PASS || echo FAIL'\n\tdone`)\n\n\tnumPass := strings.Count(string(output), \"PASS\")\n\n\tif numPass <= 98 {\n\t\tc.Fatalf(\"Expected more than or equal to 98/100 passes, but output was: %s\", output)\n\t}\n}", "title": "" }, { "docid": "f9d9f41c8485ab01ec3e3a001280aa55", "score": "0.5031574", "text": "func powerOffHostParallel(hostsToPowerOff []string) {\n\thostlist := \"\"\n\tfor _, host := range hostsToPowerOff {\n\t\tfor _, esxHost := range tbinfo.esxHosts {\n\t\t\tif esxHost[\"ip\"] == host {\n\t\t\t\thostlist += esxHost[\"vmName\"] + \" \"\n\t\t\t}\n\t\t}\n\t\tfds.hostsDown = append(fds.hostsDown, host)\n\t}\n\n\terr := vMPowerMgmt(tbinfo.user, tbinfo.location, hostlist, false)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tfor _, host := range hostsToPowerOff {\n\t\terr = waitForHostToBeDown(host)\n\t\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\t}\n}", "title": "" }, { "docid": "c1de29e84586632c7de006e574ad3d78", "score": "0.50270134", "text": "func initAndRunServer(pid processID, gridSz uint16,\n\tmstrPort uint16, serverInChan chan string, masterInChan chan string) {\n\tmyPhysID = pid\n\tgridSize = gridSz\n\tmasterIP = \"127.0.0.1\"\n\tmasterPort = mstrPort\n\tgridIP = \"127.0.0.1\"\n\tshouldRun = true\n\tknownProcesses := make([]processID, gridSz)\n\tfor i := 0; i < int(gridSz); i++ {\n\t\tknownProcesses[i] = processID(i)\n\t}\n\tlinkMgr = newLinkManager(knownProcesses, serverInChan, masterInChan)\n\tmsgLog = newMessageLog()\n\tlinkMgr.run()\n}", "title": "" }, { "docid": "1d016df6fc1baa506f07d7862093e833", "score": "0.502469", "text": "func (o *os) setup() {\n\tfor i := 0; i < 10; i++ {\n\t\t// wait till there's a valid address from the server\n\t\tif p := strings.Split(o.address(), \":\"); len(p) < 2 {\n\t\t\ttime.Sleep(GossipEvent / 100.0)\n\t\t\tcontinue\n\t\t}\n\t\t// have a valid address, setup, now\n\t\to.subscriber(context.Background(), &Announcement{\n\t\t\tNamespace: o.opts.Namespace,\n\t\t\tAddress: o.address(),\n\t\t\tTimestamp: time.Now().Unix(),\n\t\t})\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "83d71df36a49d6b12df4df3a6e3832ec", "score": "0.5016812", "text": "func Start() {\n\tarch := \"lamp\"\n\tlistener = make(chan gotocol.Message) // listener for lamp\n\teurekachan = make(chan gotocol.Message, archaius.Conf.Population) // listener for lamp\n\tif archaius.Conf.Population < 1 {\n\t\tlog.Fatal(\"lamp: can't create less than 1 microservice\")\n\t} else {\n\t\tlog.Printf(\"lamp: scaling to %v%%\", archaius.Conf.Population)\n\t}\n\t// create map of channels\n\tnoodles = make(map[string]chan gotocol.Message, archaius.Conf.Population)\n\n\t// start the service registry first, TODO needs to be one per region\n\tgo eureka.Start(eurekachan, \"lamp.eureka\")\n\n\t// we need a DNS service to create a global multi-region architecture\n\tdnsname := names.Make(arch, \"*\", \"*\", \"www-dns\", \"denominator\", 0)\n\tnoodles[dnsname] = make(chan gotocol.Message)\n\tgo denominator.Start(noodles[dnsname])\n\t// setup the dns name and logging, set chat rate after everything else is started\n\tnoodles[dnsname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), dnsname}\n\tnoodles[dnsname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t// pause at this point to generate partial config for demonstrations\n\tif archaius.Conf.StopStep == 1 {\n\t\trun(dnsname)\n\t\treturn\n\t}\n\n\t// Build the configuration bottom up\n\n\t// we need elb as a front end in each region to spread request traffic around each endpoint\n\trnames := [...]string{\"us-east-1\", \"us-west-2\", \"eu-west-1\", \"eu-east-1\", \"ap-south-1\", \"ap-south-2\"}\n\t// remember them in the global config\n\tfor i, s := range rnames {\n\t\tarchaius.Conf.RegionNames[i] = s\n\t}\n\t// lamp usually needs two zones\n\tznames := [...]string{\"zoneA\", \"zoneB\"}\n\t// elb for api endpoint\n\telbcnt := 0\n\tfor r := 0; r < archaius.Conf.Regions; r++ {\n\t\trname := rnames[r]\n\t\telbname := names.Make(arch, rname, \"AB\", \"www-elb\", \"elb\", elbcnt)\n\t\telbcnt++\n\t\tnoodles[elbname] = make(chan gotocol.Message)\n\t\tgo elb.Start(noodles[elbname])\n\t\t// setup the elb's name and logging, set chat rate after everything else is started\n\t\tnoodles[elbname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), elbname}\n\t\tnoodles[elbname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t// tell denominator how to talk to the elb\n\t\tnoodles[dnsname] <- gotocol.Message{gotocol.NameDrop, noodles[elbname], time.Now(), elbname}\n\t\tif archaius.Conf.StopStep == 2 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start mysql data store layer\n\t\tmysqlcount := 2\n\t\tsname := \"rds-mysql\"\n\t\tspkg := \"store\"\n\t\tfor i := r * mysqlcount; i < (r+1)*mysqlcount; i++ {\n\t\t\tmysqlname := names.Make(arch, rname, znames[i%2], sname, spkg, i)\n\t\t\tnoodles[mysqlname] = make(chan gotocol.Message)\n\t\t\tgo store.Start(noodles[mysqlname])\n\t\t\tnoodles[mysqlname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), mysqlname}\n\t\t\tnoodles[mysqlname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t}\n\t\t// connect master mysql in a zone to slave mysql in second zone\n\t\tmaster := names.Make(arch, rname, znames[0], sname, spkg, (r * 2))\n\t\tslave := names.Make(arch, rname, znames[1], sname, spkg, (r*2)+1)\n\t\tnoodles[master] <- gotocol.Message{gotocol.NameDrop, noodles[slave], time.Now(), slave}\n\n\t\tif archaius.Conf.StopStep == 3 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start memcached layer, one per region\n\t\tmname := \"memcache\"\n\t\tmpkg := \"store\"\n\t\tmemname := names.Make(arch, rname, znames[0], mname, mpkg, r)\n\t\tnoodles[memname] = make(chan gotocol.Message)\n\t\tgo store.Start(noodles[memname])\n\t\tnoodles[memname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), memname}\n\t\tnoodles[memname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\n\t\tif archaius.Conf.StopStep == 4 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start php business logic, we can create a network of simple services from the karyon package\n\t\tphpcount := 27 * archaius.Conf.Population / 100\n\t\tpname := \"php\"\n\t\tppkg := \"karyon\" // karyon randomly calls its dependencies which isn't really right for master/slave/cache\n\t\tfor i := r * phpcount; i < (r+1)*phpcount; i++ {\n\t\t\tphpname := names.Make(arch, rname, znames[i%2], pname, ppkg, i)\n\t\t\tnoodles[phpname] = make(chan gotocol.Message)\n\t\t\tgo karyon.Start(noodles[phpname])\n\t\t\tnoodles[phpname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), phpname}\n\t\t\tnoodles[phpname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t\t// connect all the php to mysql and memcached in one zone only\n\t\t\tnoodles[phpname] <- gotocol.Message{gotocol.NameDrop, noodles[master], time.Now(), master}\n\t\t\tnoodles[phpname] <- gotocol.Message{gotocol.NameDrop, noodles[slave], time.Now(), slave}\n\t\t\tnoodles[phpname] <- gotocol.Message{gotocol.NameDrop, noodles[memname], time.Now(), memname}\n\t\t\tnoodles[elbname] <- gotocol.Message{gotocol.NameDrop, noodles[phpname], time.Now(), phpname}\n\t\t}\n\t}\n\t// stop here for 5 for single region, then add second region for step 6\n\tif archaius.Conf.StopStep == 5 || archaius.Conf.StopStep == 6 {\n\t\trun(dnsname)\n\t\treturn\n\t}\n\trun(dnsname)\n}", "title": "" }, { "docid": "4df7d6ce2ef422a751e48166b67df173", "score": "0.5008793", "text": "func getSetUpCores() {\n\tmaxCPU := runtime.NumCPU()\n\tfmt.Println(\"Number max of CPUs\", maxCPU)\n\t//runtime.GOMAXPROCS(cfgConfig.Service.Cpus)\n\truntime.GOMAXPROCS(maxCPU)\n\tfmt.Printf(\"Number of GOMAXPROCS %v \\n\", maxCPU)\n}", "title": "" }, { "docid": "431886ae28b031835374113347891b6b", "score": "0.50067276", "text": "func (sbd *State) startScoring() {\n\tnewTime := time.Now()\n\n\tfor hostIndex := range sbd.Hosts {\n\t\thost := &sbd.Hosts[hostIndex]\n\n\t\thost.previousUpdateTime = newTime\n\t\thost.isUp = sbd.Config.DefaultServiceState\n\n\t\tfor serviceIndex := range host.Services {\n\t\t\tservice := &host.Services[serviceIndex]\n\n\t\t\tservice.previousUpdateTime = newTime\n\t\t\tservice.isUp = sbd.Config.DefaultServiceState\n\t\t}\n\t}\n\n\tsbd.Config.StartTime = newTime\n\tsbd.Config.StopTime = sbd.Config.StartTime.Add(sbd.Config.CompetitionDuration)\n\tsbd.Config.CompetitionEnded = false\n}", "title": "" }, { "docid": "286b6a538a72e0a631fa388218a3f907", "score": "0.49966517", "text": "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n sm.configs[0].Groups = map[int64][]string{}\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n return sm\n}", "title": "" }, { "docid": "286b6a538a72e0a631fa388218a3f907", "score": "0.49966517", "text": "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n sm.configs[0].Groups = map[int64][]string{}\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n return sm\n}", "title": "" }, { "docid": "c1ca88268de023527f55993cfebcbfca", "score": "0.49847612", "text": "func (s *Server) manager() {\n\tcheckTicker := time.NewTicker(50 * time.Millisecond)\n\tnotifyTicker := time.NewTicker(s.config.NotifyInterval)\n\tfor {\n\t\tselect {\n\t\tcase configs := <-s.configs:\n\n\t\t\t// Remove healthchecks that have been deleted.\n\t\t\tfor id, hc := range s.healthchecks {\n\t\t\t\tif configs[id] == nil {\n\t\t\t\t\thc.Stop()\n\t\t\t\t\tdelete(s.healthchecks, id)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Spawn new healthchecks.\n\t\t\tfor id := range configs {\n\t\t\t\tif s.healthchecks[id] == nil {\n\t\t\t\t\thc := NewCheck(s.notify)\n\t\t\t\t\thc.Dryrun(s.config.DryRun)\n\t\t\t\t\ts.healthchecks[id] = hc\n\t\t\t\t\tgo hc.Run(checkTicker.C)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update configurations.\n\t\t\tfor id, hc := range s.healthchecks {\n\t\t\t\thc.Update(configs[id])\n\t\t\t}\n\t\tcase <-notifyTicker.C:\n\t\t\t// Send status notifications for all healthchecks.\n\t\t\tfor _, hc := range s.healthchecks {\n\t\t\t\thc.Notify()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0e33b1bca0277d42d9305e2540ad241f", "score": "0.49827185", "text": "func resourceMAASMachineUpdate(d *schema.ResourceData, meta interface{}) error {\n\tlog.Printf(\"[DEBUG] [resourceMAASMachineUpdate] Modifying machine %s\\n\", d.Id())\n\n\tcontroller := meta.(*Config).controller\n\tvar ids []string\n\tmachines, err := controller.Machines(gomaasapi.MachinesArgs{\n\t\tSystemIDs: append(ids, d.Id()),\n\t})\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] [resourceMAASMachineUpdate] cannnot list machines\")\n\t\treturn err\n\t}\n\tif len(machines) != 1 {\n\t\treturn fmt.Errorf(\"[ERROR] [resourceMAASMachineUpdate] machine no longer exists\")\n\t}\n\td.Partial(true)\n\n\tif d.HasChange(\"deploy\") {\n\t\toraw, nraw := d.GetChange(\"deploy\")\n\t\tnewDeploy := nraw.(bool)\n\t\toldDeploy := oraw.(bool)\n\t\tif newDeploy {\n\t\t\tswitch machines[0].StatusName() {\n\t\t\tcase \"Allocated\":\n\t\t\t\t// Start Deploy\n\t\t\t\tif err := startMachine(d, meta, machines[0]); err != nil {\n\t\t\t\t\tlog.Printf(\"[WARN] Unable to start machine: %s\", err.Error())\n\t\t\t\t\tif err := reAllocate(d, meta); err != nil {\n\t\t\t\t\t\tlog.Printf(\"[ERROR] Unable to reallocate machine\")\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\td.Set(\"deploy\", oldDeploy)\n\t\t\t\t\td.SetPartial(\"deploy\")\n\t\t\t\t}\n\n\t\t\tcase \"Deployed\":\n\t\t\t\t// This shouldn't happen\n\t\t\t\tlog.Printf(\"[WARN] [resourceMAASMachineUpdate] unexpected Deployed state\")\n\t\t\t}\n\t\t} else {\n\t\t\tswitch machines[0].StatusName() {\n\t\t\tcase \"Allocated\":\n\t\t\t\t// This shouldn't happen\n\t\t\t\tlog.Printf(\"[WARN] [resourceMAASMachineUpdate] unexpected Deployed state\")\n\t\t\tcase \"Deployed\":\n\t\t\t\t// Release and then re-allocate, there is a tiny window chance where before re-allocating, the machine could have been acquired by someone else\n\t\t\t\tif err := reAllocate(d, meta); err != nil {\n\t\t\t\t\td.Set(\"deploy\", oldDeploy)\n\t\t\t\t\td.SetPartial(\"deploy\")\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\td.Partial(false)\n\n\tlog.Printf(\"[DEBUG] Done Modifying machine %s\", d.Id())\n\treturn resourceMAASMachineRead(d, meta)\n}", "title": "" }, { "docid": "dec78597f1ef3b34982d28fe5f61ce69", "score": "0.4981844", "text": "func TestManyPersistent(t *testing.T) {\n runtime.GOMAXPROCS(4)\n\n fmt.Printf(\"Test: Persistent: Many instances ...\\n\")\n\n const npaxos = 3\n var pxa []*Paxos = make([]*Paxos, npaxos)\n var pxh []string = make([]string, npaxos)\n defer cleanup(pxa)\n\n for i := 0; i < npaxos; i++ {\n pxh[i] = port(\"many\", i)\n }\n for i := 0; i < npaxos; i++ {\n pxa[i] = Make(pxh, i, nil)\n pxa[i].FastStart(0, 0)\n }\n\n const ninst = 50\n for seq := 1; seq < ninst; seq++ {\n // only 5 active instances, to limit the\n // number of file descriptors.\n for seq >= 5 && ndecided(t, pxa, seq - 5) < npaxos {\n time.Sleep(20 * time.Millisecond)\n }\n for i := 0; i < npaxos; i++ {\n pxa[i].FastStart(seq, (seq * 10) + i)\n }\n // RESET\n pxa[(seq + 0) % npaxos].HardReset()\n pxa[(seq + 1) % npaxos].HardReset()\n }\n\n // RESET\n pxa[0].HardReset()\n pxa[1].HardReset()\n pxa[2].HardReset()\n\n for {\n done := true\n for seq := 1; seq < ninst; seq++ {\n if ndecided(t, pxa, seq) < npaxos {\n done = false\n }\n }\n if done {\n break\n }\n time.Sleep(100 * time.Millisecond)\n }\n\n fmt.Printf(\" ... Passed\\n\")\n}", "title": "" }, { "docid": "391d547d6fd6c5f620fb2bf3aff70fb5", "score": "0.4980897", "text": "func ConfigMasters(machines []machineapi.Machine, clusterID string) {\n\t/*for _, machine := range machines {\n\t\tproviderSpec := machine.Spec.ProviderSpec.Value.Object.(*openstackprovider.OpenstackProviderSpec)\n\t}*/\n}", "title": "" }, { "docid": "7e04b9bfc908e2265ee30e0b5f515c22", "score": "0.4966454", "text": "func (m *Master) server() {\n\tmapTasks = make(chan string)\n\treduceTasks = make(chan int)\n\n\trpc.Register(m)\n\trpc.HandleHTTP()\n\n\tgo m.createTasks()\n\n\t//l, e := net.Listen(\"tcp\", \":1234\")\n\tsockname := masterSock()\n\tos.Remove(sockname)\n\tl, e := net.Listen(\"unix\", sockname)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tgo http.Serve(l, nil)\n}", "title": "" }, { "docid": "59da33758034f0408af01cf0488f29c5", "score": "0.49574482", "text": "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n sm.configs[0].Groups = map[int64][]string{}\n sm.logTail = -1\n sm.configNum = 0\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n return sm\n}", "title": "" }, { "docid": "4f0e4d1db36b744fe758cdb38cb9406f", "score": "0.4950415", "text": "func CreateVM() string {\n\tfingerprint := getFingerPrint()\n\tmachineName := GetCurrentDirName()\n\tfingerPrintCreate := godo.DropletCreateSSHKey{\n\t\tFingerprint: fingerprint,\n\t}\n\tvar fingerprints []godo.DropletCreateSSHKey\n\tfingerprints = append(fingerprints, fingerPrintCreate)\n\tcreateRequest := &godo.DropletCreateRequest{\n\t\tName: machineName,\n\t\tRegion: \"blr1\",\n\t\tSize: \"s-1vcpu-1gb\",\n\t\tSSHKeys: fingerprints,\n\t\tImage: godo.DropletCreateImage{\n\t\t\tSlug: \"ubuntu-18-04-x64\",\n\t\t},\n\t}\n\tctx := context.TODO()\n\tclient := godo.NewFromToken(os.Getenv(\"DIGITALOCEAN_SECRET_KEY\"))\n\tnewDroplet, _, err := client.Droplets.Create(ctx, createRequest)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tfmt.Println(\"Machine created, waiting to get machine ready\")\n\tfor {\n\t\tgetDroplet, _, err := client.Droplets.Get(ctx, newDroplet.ID)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err.Error())\n\t\t}\n\t\tif getDroplet.Status == \"active\" {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(10 * time.Second)\n\t}\n\tfor {\n\t\tgetDroplet, _, err := client.Droplets.Get(ctx, newDroplet.ID)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err.Error())\n\t\t}\n\t\tipaddr, err := getDroplet.PublicIPv4()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err.Error())\n\t\t}\n\t\tfmt.Println(\"Checking machine ip\")\n\t\tisUp := CheckPing(ipaddr)\n\t\tif isUp {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(10 * time.Second)\n\t}\n\tgetDroplet, _, err := client.Droplets.Get(ctx, newDroplet.ID)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tipaddr, err := getDroplet.PublicIPv4()\n\tfmt.Println(\"Machine ip: \" + ipaddr)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tfmt.Println(\"Machine ready\")\n\treturn ipaddr\n}", "title": "" }, { "docid": "1b20f74fe14e77c8edba0988b9cdd7a2", "score": "0.4949207", "text": "func servers(ws worker.WatchService, ep eventdb.EventProvider, opts *Options) []*ServerConf {\n\treturn []*ServerConf{\n\t\tNewServerConf(\":8080\", \"watchapi\", opts.verbosity,\n\t\t\tweb.NewWatchHandler(ws)),\n\t\tNewServerConf(\":8081\", \"data-access-service\", opts.verbosity,\n\t\t\tweb.NewMatchHandler(\"data-access-service\", ws, ep)),\n\t}\n}", "title": "" }, { "docid": "c7f54c8fc8fdfd460dfc04321710fa69", "score": "0.49438187", "text": "func (p *proxyrunner) primaryStartup(loadedSmap *smapX, config *cmn.Config, ntargets int) {\n\tconst (\n\t\tmetaction1 = \"early-start-have-registrations\"\n\t\tmetaction2 = \"primary-started-up\"\n\t)\n\tvar (\n\t\tsmap = newSmap()\n\t\tpname = p.si.Name()\n\t\thaveRegistratons bool\n\t)\n\n\t// 1: init Smap to accept reg-s\n\tp.smapowner.Lock()\n\tsmap.Pmap[p.si.DaemonID] = p.si\n\tsmap.ProxySI = p.si\n\tp.smapowner.put(smap)\n\tp.smapowner.Unlock()\n\n\tmaxVerSmap := p.acceptRegistrations(smap, loadedSmap, config, ntargets)\n\tif maxVerSmap != nil {\n\t\tmaxVerSmap.Pmap[p.si.DaemonID] = p.si\n\t\tp.smapowner.put(maxVerSmap)\n\t\tglog.Infof(\"%s: change-of-mind #1: registering with %s(%s)\",\n\t\t\tpname, maxVerSmap.ProxySI.DaemonID, maxVerSmap.ProxySI.IntraControlNet.DirectURL)\n\t\tp.secondaryStartup(maxVerSmap.ProxySI.IntraControlNet.DirectURL)\n\t\treturn\n\t}\n\n\tsmap = p.smapowner.get()\n\thaveRegistratons = smap.CountTargets() > 0 || smap.CountProxies() > 1\n\n\t// 2: merging local => boot\n\tif haveRegistratons {\n\t\tvar added int\n\t\tif loadedSmap != nil {\n\t\t\tadded = smap.merge(loadedSmap)\n\t\t\tp.smapowner.Lock()\n\t\t\tsmap = loadedSmap\n\t\t\tif added > 0 {\n\t\t\t\tsmap.Version = smap.Version + int64(added) + 1\n\t\t\t}\n\t\t\tp.smapowner.put(smap)\n\t\t\tp.smapowner.Unlock()\n\t\t}\n\t\tglog.Infof(\"%s: initial %s, curr %s, added=%d\", pname, loadedSmap, smap.StringEx(), added)\n\t\tbmd := p.bmdowner.get()\n\t\tmsgInt := p.newActionMsgInternalStr(metaction1, smap, bmd)\n\t\tp.metasyncer.sync(true, revspair{smap, msgInt}, revspair{bmd, msgInt})\n\t} else {\n\t\tglog.Infof(\"%s: no registrations yet\", pname)\n\t\tif loadedSmap != nil {\n\t\t\tglog.Infof(\"%s: keep going w/ local %s\", pname, loadedSmap.StringEx())\n\t\t\tp.smapowner.Lock()\n\t\t\tsmap = loadedSmap\n\t\t\tp.smapowner.put(smap)\n\t\t\tp.smapowner.Unlock()\n\t\t}\n\t}\n\n\t// 3: discover cluster meta and resolve remaining conflicts, if any\n\tp.discoverMeta(smap)\n\n\t// 4: still primary?\n\tp.smapowner.Lock()\n\tsmap = p.smapowner.get()\n\tif !smap.isPrimary(p.si) {\n\t\tp.smapowner.Unlock()\n\t\tglog.Infof(\"%s: registering with %s(%s)\", pname, smap.ProxySI.DaemonID, smap.ProxySI.IntraControlNet.DirectURL)\n\t\tp.secondaryStartup(smap.ProxySI.IntraControlNet.DirectURL)\n\t\treturn\n\t}\n\n\t// 5: persist and finalize w/ sync + BMD\n\tif smap.Origin == 0 {\n\t\tclone := smap.clone()\n\t\tclone.Origin, clone.CreationTime = newOriginMD() // new origin\n\t\tclone.Version++\n\t\tp.smapowner.put(clone)\n\t\tsmap = clone\n\t}\n\tif err := p.smapowner.persist(smap); err != nil {\n\t\tglog.Fatalf(\"FATAL: %s\", err)\n\t}\n\tp.smapowner.Unlock()\n\n\tp.bmdowner.Lock()\n\tbmd := p.bmdowner.get()\n\tif bmd.Version == 0 {\n\t\tclone := bmd.clone()\n\t\tclone.Version = 1 // init BMD\n\t\tclone.Origin = smap.Origin\n\t\tp.bmdowner.put(clone)\n\t\tbmd = clone\n\t}\n\tp.bmdowner.Unlock()\n\n\tmsgInt := p.newActionMsgInternalStr(metaction2, smap, bmd)\n\tp.setGlobRebID(smap, msgInt, false /*set*/)\n\tp.metasyncer.sync(false, revspair{smap, msgInt}, revspair{bmd, msgInt})\n\n\t// 6: started up as primary\n\tglog.Infof(\"%s: primary/cluster startup complete, %s\", pname, smap.StringEx())\n\tp.startedUp.Store(true)\n}", "title": "" }, { "docid": "50f19696671b68e5bb5d2d9ef1138776", "score": "0.4939289", "text": "func main() {\n\tflag.Parse()\n\n\tif *kubeconfig == \"\" {\n\t\tuser, err := user.Current()\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\t*kubeconfig = user.HomeDir + \"/.kube/config\"\n\t}\n\n\tif *label == \"\" {\n\t\tpanic(\"--label cannot be empty\")\n\t}\n\n\tif *replicas < 0 {\n\t\tpanic(\"--replicas must be >= 0\")\n\t}\n\n\tmachines, err := machinesClient()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tif err := scale(machines, *label, *replicas); err != nil {\n\t\tpanic(err.Error())\n\t}\n}", "title": "" }, { "docid": "eb2dbee1b68d21fc75faa4b12c4e48b5", "score": "0.49376172", "text": "func StartServer(gid int64, shardmasters []string,\n servers []string, me int) *ShardKV {\n gob.Register(Op{})\n\n kv := new(ShardKV)\n kv.cfg = &shardmaster.Config{Num: 0}\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n // Your initialization code here.\n kv.data = make(map[string]Value)\n kv.state.data = make(map[string]kvdata)\n kv.state.reqmap = make(map[string]string)\n kv.state.size = 1024\n kv.state.queue = make([]string, 1024)\n // Don't call Join().\n\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me])\n if e != nil {\n log.Fatal(\"listen error: \", e)\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63()%1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63()%1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n return kv\n}", "title": "" }, { "docid": "b68f5e52c76f16e16854ef529c09e2b7", "score": "0.49345237", "text": "func testProcesses(t *testing.T, c client.API, mode, starterEndpoint string, isSecure bool,\n\texpectAgencyOnly bool, syncEnabled bool, singleTimeout, reachableTimeout time.Duration) {\n\t// Give the deployment a little bit of time:\n\tctx := context.Background()\n\n\t// Wait until starter restarts\n\twaitForStarter(t, c)\n\tlog := GetLogger(t)\n\n\tlog.Log(\"Starter is responding: %s\", starterEndpoint)\n\n\t// Fetch version\n\tif info, err := c.Version(ctx); err != nil {\n\t\tt.Errorf(\"Failed to get starter version: %s\", describe(err))\n\t} else {\n\t\tif isVerbose {\n\t\t\tt.Logf(\"Found starter version %s, %s\", info.Version, info.Build)\n\t\t}\n\t}\n\n\t// Fetch server processes\n\tprocesses, err := c.Processes(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to get server processes: %s\", describe(err))\n\t}\n\n\t// Check agent\n\tif sp, ok := processes.ServerByType(client.ServerTypeAgent); ok {\n\t\tif sp.IsSecure != isSecure {\n\t\t\tt.Errorf(\"Invalid IsSecure on agent. Expected %v, got %v\", isSecure, sp.IsSecure)\n\t\t}\n\t\tif mode == \"single\" {\n\t\t\tt.Errorf(\"Found agent, not allowed in single mode\")\n\t\t} else {\n\t\t\tif isVerbose {\n\t\t\t\tt.Logf(\"Found agent at %s:%d\", sp.IP, sp.Port)\n\t\t\t}\n\t\t\ttestArangodReachable(t, sp, reachableTimeout)\n\t\t}\n\t}\n\n\t// Check coordinator\n\tif sp, ok := processes.ServerByType(client.ServerTypeCoordinator); ok {\n\t\tif sp.IsSecure != isSecure {\n\t\t\tt.Errorf(\"Invalid IsSecure on coordinator. Expected %v, got %v\", isSecure, sp.IsSecure)\n\t\t}\n\t\tif mode == \"single\" || mode == \"resilientsingle\" {\n\t\t\tt.Errorf(\"Found coordinator, not allowed in single|resilientsingle mode\")\n\t\t} else {\n\t\t\tif isVerbose {\n\t\t\t\tt.Logf(\"Found coordinator at %s:%d\", sp.IP, sp.Port)\n\t\t\t}\n\t\t\ttestArangodReachable(t, sp, reachableTimeout)\n\t\t}\n\t} else if mode == \"cluster\" {\n\t\tt.Errorf(\"No coordinator found in %s\", starterEndpoint)\n\t}\n\n\t// Check dbserver\n\tif sp, ok := processes.ServerByType(client.ServerTypeDBServer); ok {\n\t\tif sp.IsSecure != isSecure {\n\t\t\tt.Errorf(\"Invalid IsSecure on dbserver. Expected %v, got %v\", isSecure, sp.IsSecure)\n\t\t}\n\t\tif mode == \"single\" || mode == \"resilientsingle\" {\n\t\t\tt.Errorf(\"Found dbserver, not allowed in single|resilientsingle mode\")\n\t\t} else {\n\t\t\tif isVerbose {\n\t\t\t\tt.Logf(\"Found dbserver at %s:%d\", sp.IP, sp.Port)\n\t\t\t}\n\t\t\ttestArangodReachable(t, sp, reachableTimeout)\n\t\t}\n\t} else if mode == \"cluster\" {\n\t\tt.Errorf(\"No dbserver found in %s\", starterEndpoint)\n\t}\n\n\t// Check single\n\t{\n\t\tdeadline := time.Now().Add(singleTimeout)\n\t\tfor {\n\t\t\tif sp, ok := processes.ServerByType(client.ServerTypeSingle); ok {\n\t\t\t\tif sp.IsSecure != isSecure {\n\t\t\t\t\tt.Errorf(\"Invalid IsSecure on single. Expected %v, got %v\", isSecure, sp.IsSecure)\n\t\t\t\t}\n\t\t\t\tif mode == \"cluster\" || expectAgencyOnly {\n\t\t\t\t\tt.Errorf(\"Found single, not allowed in cluster mode\")\n\t\t\t\t} else {\n\t\t\t\t\tif isVerbose {\n\t\t\t\t\t\tt.Logf(\"Found single at %s:%d\", sp.IP, sp.Port)\n\t\t\t\t\t}\n\t\t\t\t\ttestArangodReachable(t, sp, reachableTimeout)\n\t\t\t\t}\n\t\t\t} else if (mode == \"single\" || mode == \"resilientsingle\") && !expectAgencyOnly {\n\t\t\t\tif time.Now().Before(deadline) {\n\t\t\t\t\t// For activefailover not all starters have to be ready when we're called,\n\t\t\t\t\t// so we allow for some time to pass until we call it a failure.\n\t\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tt.Errorf(\"No single found in %s\", starterEndpoint)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Check syncmaster\n\tif sp, ok := processes.ServerByType(client.ServerTypeSyncMaster); ok {\n\t\tif sp.IsSecure != isSecure {\n\t\t\tt.Errorf(\"Invalid IsSecure on single. Expected %v, got %v\", isSecure, sp.IsSecure)\n\t\t}\n\t\tif mode != \"cluster\" || !syncEnabled {\n\t\t\tt.Errorf(\"Found syncmaster, not allowed in cluster mode without sync\")\n\t\t} else {\n\t\t\tif isVerbose {\n\t\t\t\tt.Logf(\"Found syncmaster at %s:%d\", sp.IP, sp.Port)\n\t\t\t}\n\t\t\ttestArangoSyncReachable(t, sp, reachableTimeout)\n\t\t}\n\t} else if (mode == \"cluster\") && syncEnabled {\n\t\tt.Errorf(\"No syncmaster found in %s\", starterEndpoint)\n\t}\n\n\t// Check syncworker\n\tif sp, ok := processes.ServerByType(client.ServerTypeSyncWorker); ok {\n\t\tif sp.IsSecure != isSecure {\n\t\t\tt.Errorf(\"Invalid IsSecure on single. Expected %v, got %v\", isSecure, sp.IsSecure)\n\t\t}\n\t\tif mode != \"cluster\" || !syncEnabled {\n\t\t\tt.Errorf(\"Found syncworker, not allowed in cluster mode without sync\")\n\t\t} else {\n\t\t\tif isVerbose {\n\t\t\t\tt.Logf(\"Found syncworker at %s:%d\", sp.IP, sp.Port)\n\t\t\t}\n\t\t\ttestArangoSyncReachable(t, sp, reachableTimeout)\n\t\t}\n\t} else if (mode == \"cluster\") && syncEnabled {\n\t\tt.Errorf(\"No syncworker found in %s\", starterEndpoint)\n\t}\n}", "title": "" }, { "docid": "13acce326acb72fa92c9f653fe067a13", "score": "0.49319056", "text": "func main() {\n\t// Setup cancellable context.\n\tctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)\n\tdefer cancel()\n\n\t// Use a custom network to avoid needing to use sync.WaitGroup etc.\n\tvar network Network\n\n\t// create components\n\thello := NewHello(time.Second)\n\tupper := NewUpper()\n\tlower := NewLower()\n\tprinter := NewPrinter()\n\n\t// add components to the network\n\tnetwork.Add(hello)\n\tnetwork.Add(upper)\n\tnetwork.Add(lower)\n\tnetwork.Add(printer)\n\n\tvar group errgroup.Group\n\tgroup.Go(func() error { return network.Run(ctx) })\n\n\t// configure the network live:\n\tgroup.Go(func() error {\n\t\t// connect both upper and lower to the printer\n\t\tConnectString(upper.Out, printer.In)\n\t\tConnectString(lower.Out, printer.In)\n\n\t\t// This starts changing the Hello connection between upper and lower.\n\t\tfor {\n\t\t\thelloToUpper := ConnectString(hello.Out, upper.In)\n\n\t\t\tselect {\n\t\t\tcase <-time.After(3 * time.Second):\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn ctx.Err()\n\t\t\t}\n\n\t\t\thelloToUpper.Cut()\n\n\t\t\thelloToLower := ConnectString(hello.Out, lower.In)\n\t\t\tselect {\n\t\t\tcase <-time.After(3 * time.Second):\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn ctx.Err()\n\t\t\t}\n\t\t\thelloToLower.Cut()\n\t\t}\n\t\treturn nil\n\t})\n\n\t// start the network\n\terr := group.Wait()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t}\n}", "title": "" }, { "docid": "a547ade6dbefbec6ac2d0d929013a500", "score": "0.4926365", "text": "func (app *App) prefork(network, addr string, tlsConfig *tls.Config) error {\n\t// 👶 child process 👶\n\tif IsChild() {\n\t\t// use 1 cpu core per child process\n\t\truntime.GOMAXPROCS(1)\n\t\t// Linux will use SO_REUSEPORT and Windows falls back to SO_REUSEADDR\n\t\t// Only tcp4 or tcp6 is supported when preforking, both are not supported\n\t\tln, err := reuseport.Listen(network, addr)\n\t\tif err != nil {\n\t\t\tif !app.config.DisableStartupMessage {\n\t\t\t\tconst sleepDuration = 100 * time.Millisecond\n\t\t\t\ttime.Sleep(sleepDuration) // avoid colliding with startup message\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"prefork: %w\", err)\n\t\t}\n\t\t// wrap a tls config around the listener if provided\n\t\tif tlsConfig != nil {\n\t\t\tln = tls.NewListener(ln, tlsConfig)\n\t\t}\n\n\t\t// kill current child proc when master exits\n\t\tgo watchMaster()\n\n\t\t// prepare the server for the start\n\t\tapp.startupProcess()\n\n\t\t// listen for incoming connections\n\t\treturn app.server.Serve(ln)\n\t}\n\n\t// 👮 master process 👮\n\ttype child struct {\n\t\tpid int\n\t\terr error\n\t}\n\t// create variables\n\tmax := runtime.GOMAXPROCS(0)\n\tchilds := make(map[int]*exec.Cmd)\n\tchannel := make(chan child, max)\n\n\t// kill child procs when master exits\n\tdefer func() {\n\t\tfor _, proc := range childs {\n\t\t\tif err := proc.Process.Kill(); err != nil {\n\t\t\t\tif !errors.Is(err, os.ErrProcessDone) {\n\t\t\t\t\tlog.Errorf(\"prefork: failed to kill child: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\t// collect child pids\n\tvar pids []string\n\n\t// launch child procs\n\tfor i := 0; i < max; i++ {\n\t\tcmd := exec.Command(os.Args[0], os.Args[1:]...) //nolint:gosec // It's fine to launch the same process again\n\t\tif testPreforkMaster {\n\t\t\t// When test prefork master,\n\t\t\t// just start the child process with a dummy cmd,\n\t\t\t// which will exit soon\n\t\t\tcmd = dummyCmd()\n\t\t}\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\n\t\t// add fiber prefork child flag into child proc env\n\t\tcmd.Env = append(os.Environ(),\n\t\t\tfmt.Sprintf(\"%s=%s\", envPreforkChildKey, envPreforkChildVal),\n\t\t)\n\t\tif err := cmd.Start(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to start a child prefork process, error: %w\", err)\n\t\t}\n\n\t\t// store child process\n\t\tpid := cmd.Process.Pid\n\t\tchilds[pid] = cmd\n\t\tpids = append(pids, strconv.Itoa(pid))\n\n\t\t// execute fork hook\n\t\tif app.hooks != nil {\n\t\t\tif testOnPrefork {\n\t\t\t\tapp.hooks.executeOnForkHooks(dummyPid)\n\t\t\t} else {\n\t\t\t\tapp.hooks.executeOnForkHooks(pid)\n\t\t\t}\n\t\t}\n\n\t\t// notify master if child crashes\n\t\tgo func() {\n\t\t\tchannel <- child{pid, cmd.Wait()}\n\t\t}()\n\t}\n\n\t// Run onListen hooks\n\t// Hooks have to be run here as different as non-prefork mode due to they should run as child or master\n\tapp.runOnListenHooks(app.prepareListenData(addr, tlsConfig != nil))\n\n\t// Print startup message\n\tif !app.config.DisableStartupMessage {\n\t\tapp.startupMessage(addr, tlsConfig != nil, \",\"+strings.Join(pids, \",\"))\n\t}\n\n\t// return error if child crashes\n\treturn (<-channel).err\n}", "title": "" }, { "docid": "fa0417e1c68cf7af715b1d3ab4a8b8b4", "score": "0.49262312", "text": "func StartServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persister) *ShardMaster {\n\tsm := new(ShardMaster)\n\tsm.me = me\n\n\tsm.configs = make([]Config, 1)\n\tsm.configs[0].Groups = map[int][]string{}\n\n\tlabgob.Register(&Op{})\n\tsm.applyCh = make(chan raft.ApplyMsg)\n\tsm.rf = raft.Make(servers, me, persister, sm.applyCh)\n\n\t// Your code here.\n\n\tsm.notifyChannels = make(map[int]chan struct{})\n\tsm.checkDuplicates = make(map[int64]*RecentReply)\n\n\tvar waitGroup sync.WaitGroup\n\twaitGroup.Add(1)\n\tgo func() {\n\t\tdefer waitGroup.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg, ok := <-sm.applyCh:\n\t\t\t\tif ok {\n\t\t\t\t\tif msg.Command != nil {\n\t\t\t\t\t\tcmd := msg.Command.(*Op)\n\t\t\t\t\t\tsm.mu.Lock()\n\t\t\t\t\t\tdup, ok := sm.checkDuplicates[cmd.ClientID]\n\t\t\t\t\t\tif !ok || dup.Seq < cmd.OpIdx {\n\t\t\t\t\t\t\tsm.checkDuplicates[cmd.ClientID] = &RecentReply{Seq: cmd.OpIdx}\n\t\t\t\t\t\t\tif cmd.Op == \"Leave\" {\n\n\t\t\t\t\t\t\t\tconfig := Config{}\n\t\t\t\t\t\t\t\tsm.ConfigCopying(-1, &config)\n\t\t\t\t\t\t\t\tconfig.Num = config.Num + 1\n\n\t\t\t\t\t\t\t\tfor _, k := range cmd.GIDs {\n\t\t\t\t\t\t\t\t\tdelete(config.Groups, k)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsm.BalancingOfShard(&config)\n\t\t\t\t\t\t\t\tsm.configs = append(sm.configs, config)\n\n\t\t\t\t\t\t\t} else if cmd.Op == \"Move\" {\n\n\t\t\t\t\t\t\t\tconfig := Config{}\n\t\t\t\t\t\t\t\tsm.ConfigCopying(-1, &config)\n\t\t\t\t\t\t\t\tconfig.Num = config.Num + 1\n\t\t\t\t\t\t\t\tconfig.Shards[cmd.Shard] = cmd.GID\n\n\t\t\t\t\t\t\t\tsm.configs = append(sm.configs, config)\n\n\t\t\t\t\t\t\t} else if cmd.Op == \"Join\" {\n\n\t\t\t\t\t\t\t\tconfig := Config{}\n\t\t\t\t\t\t\t\tsm.ConfigCopying(-1, &config)\n\t\t\t\t\t\t\t\tconfig.Num = config.Num + 1\n\n\t\t\t\t\t\t\t\tfor k, v := range cmd.Servers {\n\t\t\t\t\t\t\t\t\tvar servers = make([]string, len(v))\n\t\t\t\t\t\t\t\t\tcopy(servers, v)\n\t\t\t\t\t\t\t\t\tconfig.Groups[k] = servers\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsm.BalancingOfShard(&config)\n\t\t\t\t\t\t\t\tsm.configs = append(sm.configs, config)\n\n\t\t\t\t\t\t\t} else if cmd.Op == \"Query\" {\n\t\t\t\t\t\t\t\t// no configuration change\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tpanic(\"Operation is not valid\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tnotifyCh, ok := sm.notifyChannels[msg.CommandIndex]\n\t\t\t\t\t\tif ok {\n\t\t\t\t\t\t\tif notifyCh != nil {\n\t\t\t\t\t\t\t\tclose(notifyCh)\n\t\t\t\t\t\t\t\tdelete(sm.notifyChannels, msg.CommandIndex)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsm.mu.Unlock()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn sm\n}", "title": "" }, { "docid": "956daced1087174a5f27eec4e99c05a7", "score": "0.4921771", "text": "func init() {\n\traft.RegisterCommand(&SetCommand{})\n\traft.RegisterCommand(&DeleteCommand{})\n\tactiveServers = make(map[string][]interface{})\n}", "title": "" }, { "docid": "9c8b5324242e9a920245e07e6e1b6f26", "score": "0.49204978", "text": "func Run(conn db.Conn, creds connection.Credentials, minionTLSDir string) {\n\tcfg.MinionTLSDir = minionTLSDir\n\tforeman.Credentials = creds\n\n\tgo updateMachineStatuses(conn)\n\n\tvar ns string\n\tforeman.Init(conn)\n\tstop := make(chan struct{})\n\tfor range conn.TriggerTick(60, db.BlueprintTable, db.MachineTable).C {\n\t\tnewns, _ := conn.GetBlueprintNamespace()\n\t\tif newns == ns {\n\t\t\tforeman.RunOnce(conn)\n\t\t\tsleep(5 * time.Second) // Rate-limit the foreman.\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Debugf(\"Namespace change from \\\"%s\\\", to \\\"%s\\\".\", ns, newns)\n\t\tns = newns\n\n\t\tif ns != \"\" {\n\t\t\tclose(stop)\n\t\t\tstop = make(chan struct{})\n\t\t\tmakeClouds(conn, ns, stop)\n\t\t\tforeman.Init(conn)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "827e838db28d7de17d6d8e97cf892139", "score": "0.49125797", "text": "func StartServer(servers []string, me int) *ShardMaster {\n\tsm := new(ShardMaster)\n\tsm.me = me\n\n\t// sm.debug = true\n\tsm.configs = make([]Config, 1)\n\tsm.configs[0].Groups = map[int64][]string{}\n\n\tsm.processed = make(map[int64]bool)\n\n\trpcs := rpc.NewServer()\n\n\tgob.Register(Op{})\n\trpcs.Register(sm)\n\tsm.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tsm.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor sm.isdead() == false {\n\t\t\tconn, err := sm.l.Accept()\n\t\t\tif err == nil && sm.isdead() == false {\n\t\t\t\tif sm.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if sm.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && sm.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tsm.Kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn sm\n}", "title": "" }, { "docid": "0fcd456c4f2cd3923d5d517e5d15796b", "score": "0.49120066", "text": "func (hub *Hub) launch() {\n\tfor {\n\t\tselect {\n\t\t// receive connections from client and pass to hub to store\n\t\tcase connection := <-hub.createConnection:\n\t\t\thub.connections[connection] = true\n\t\t// receive disconnects from client and pass to hub to delete\n\t\tcase connection := <-hub.destroyConnection:\n\t\t\tif _, ok := hub.connections[connection]; ok {\n\t\t\t\tdelete(hub.connections, connection)\n\t\t\t\tclose(connection.send)\n\t\t\t}\n\t\t// receive messages from client and pass to hub to broadcast\n\t\tcase message := <-hub.broadcast:\n\t\t\tfor connection := range hub.connections {\n\t\t\t\tselect {\n\t\t\t\tcase connection.send <- message:\n\t\t\t\tdefault:\n\t\t\t\t\tclose(connection.send)\n\t\t\t\t\tdelete(hub.connections, connection)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "efd48a28ba2fbb1014f0ec111f9dc799", "score": "0.49110433", "text": "func startTMData(mach, app string) error {\n\targs := []string{\"ssh\", mach, Fmt(`docker run --name %v_tmdata --volumes-from %v_tmcommon -d `+\n\t\t`tendermint/tmbase /data/tendermint/data/init.sh`, app, app)}\n\tif !runProcess(\"start-tmdata-\"+mach, \"docker-machine\", args, true) {\n\t\treturn errors.New(\"Failed to start tmdata on machine \" + mach)\n\t}\n\tfor i := 1; i < 20; i++ { // TODO configure\n\t\ttime.Sleep(time.Duration(i) * time.Second)\n\t\tif checkFileExists(mach, app+\"_tmdata\", \"/data/tendermint/data/data.sock\") {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"Failed to start tmdata on machine \" + mach + \" (timeout)\")\n}", "title": "" }, { "docid": "303b8781fca12fb34bc89dbee69a954d", "score": "0.4910308", "text": "func main() {\n\t// A := AuctionSystem.AuctionAllocate()\n\t// U := AuctionSystem.UserAllocate()\n\tserverInit()\n\t// temp := AuctionSystem.MainTimeline()\n\n}", "title": "" }, { "docid": "56626a55cf5ebe349f275ee344bc965c", "score": "0.49025264", "text": "func StartServer(servers []string, me int) *ShardMaster {\n\tsm := new(ShardMaster)\n\tsm.me = me\n\n\tsm.configs = make([]Config, 1)\n\tsm.configs[0].Groups = map[int64][]string{}\n\n\trpcs := rpc.NewServer()\n\n\tgob.Register(Op{})\n\tgob.Register(JoinArgs{})\n\tgob.Register(LeaveArgs{})\n\tgob.Register(MoveArgs{})\n\tgob.Register(QueryArgs{})\n\trpcs.Register(sm)\n\tsm.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tsm.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor sm.isdead() == false {\n\t\t\tconn, err := sm.l.Accept()\n\t\t\tif err == nil && sm.isdead() == false {\n\t\t\t\tif sm.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if sm.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && sm.isdead() == false {\n\t\t\t\tfmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tsm.Kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn sm\n}", "title": "" }, { "docid": "51a1aa3d3d23cc4435efa82d93eac0d7", "score": "0.4902286", "text": "func (b *Baremetal) setup(hosts []HostInfo) error {\n\tb.nodes = make(map[string]TestbedNode)\n\n\tfor _, h := range hosts {\n\t\tlog.Infof(\"Adding node: %q(%s:%s:%s:%s)\", h.Name, h.SSHAddr, h.SSHPort, h.User, h.PrivKeyFile)\n\t\tvar (\n\t\t\tnode *SSHNode\n\t\t\terr error\n\t\t)\n\t\tif node, err = NewSSHNode(h.Name, h.User, h.Env, h.SSHAddr, h.SSHPort, h.PrivKeyFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.nodes[node.GetName()] = TestbedNode(node)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0371b9dcfd3481a02c836fac2a7be58e", "score": "0.48990434", "text": "func startServers(config *types.Config) error {\n mux := getCorsMux()\n \n for _, server := range config.Servers {\n if server.SSL { \n go startServer(mux, config.Cors, server.PortToString(), server.CACert, server.CAKey)\n \n tools.Log(fmt.Sprintf(\"cas-server is now started up and binding to all interfaces with port `%d` using SSL\", server.Port))\n } else { \n go startServer(mux, config.Cors, server.PortToString(), \"\", \"\")\n \n tools.Log(fmt.Sprintf(\"cas-server is now started up and binding to all interfaces with port `%d`\", server.Port))\n }\n }\n \n return nil\n}", "title": "" }, { "docid": "242cb2f47d2627f6aafafb9edaceec61", "score": "0.48927587", "text": "func (r *Reconciler) setMachineCloudProviderSpecifics(instance *vpcv1.Instance) {\n\t// Make sure machine labels are present before any updates\n\tif r.machine.Labels == nil {\n\t\tr.machine.Labels = make(map[string]string)\n\t}\n\n\t// Make sure machine Annotations are present before any updates\n\tif r.machine.Annotations == nil {\n\t\tr.machine.Annotations = make(map[string]string)\n\t}\n\n\t// Update annotations\n\tr.machine.Annotations[machinecontroller.MachineInstanceStateAnnotationName] = *instance.Status\n\n\t// Update labels\n\tr.machine.Labels[machinecontroller.MachineRegionLabelName] = r.providerSpec.Region\n\tr.machine.Labels[machinecontroller.MachineAZLabelName] = r.providerSpec.Zone\n\tr.machine.Labels[machinecontroller.MachineInstanceTypeLabelName] = r.providerSpec.Profile\n\n}", "title": "" }, { "docid": "f8dc7f420a3cb6cb93017546ce10e22f", "score": "0.48906454", "text": "func configureRuntimes(runner cruntime.CommandRunner, cc config.ClusterConfig, kv semver.Version) cruntime.Manager {\n\tco := cruntime.Config{\n\t\tType: cc.KubernetesConfig.ContainerRuntime,\n\t\tSocket: cc.KubernetesConfig.CRISocket,\n\t\tRunner: runner,\n\t\tNetworkPlugin: cc.KubernetesConfig.NetworkPlugin,\n\t\tImageRepository: cc.KubernetesConfig.ImageRepository,\n\t\tKubernetesVersion: kv,\n\t\tInsecureRegistry: cc.InsecureRegistry,\n\t}\n\tcr, err := cruntime.New(co)\n\tif err != nil {\n\t\texit.Error(reason.InternalRuntime, \"Failed runtime\", err)\n\t}\n\n\t// 87-podman.conflist cni conf potentially conflicts with others and is created by podman on its first invocation,\n\t// so we \"provoke\" it here to ensure it's generated and that we can disable it\n\t// note: using 'help' or '--help' would be cheaper, but does not trigger that; 'version' seems to be next best option\n\tif co.Type == constants.CRIO {\n\t\t_, _ = runner.RunCmd(exec.Command(\"sudo\", \"sh\", \"-c\", `podman version >/dev/null`))\n\t}\n\t// ensure loopback is properly configured\n\t// make sure container runtime is restarted afterwards for these changes to take effect\n\tdisableLoopback := co.Type == constants.CRIO\n\tif err := cni.ConfigureLoopbackCNI(runner, disableLoopback); err != nil {\n\t\tklog.Warningf(\"unable to name loopback interface in configureRuntimes: %v\", err)\n\t}\n\t// ensure all default CNI(s) are properly configured on each and every node (re)start\n\t// make sure container runtime is restarted afterwards for these changes to take effect\n\tif err := cni.ConfigureDefaultBridgeCNIs(runner, cc.KubernetesConfig.NetworkPlugin); err != nil {\n\t\tklog.Errorf(\"unable to disable preinstalled bridge CNI(s): %v\", err)\n\t}\n\n\tinUserNamespace := strings.Contains(cc.KubernetesConfig.FeatureGates, \"KubeletInUserNamespace=true\")\n\t// for docker container runtime: ensure containerd is properly configured by calling Enable(), as docker could be bound to containerd\n\t// it will also \"soft\" start containerd, but it will not disable others; docker will disable containerd if not used in the next step\n\tif co.Type == constants.Docker {\n\t\tcontainerd, err := cruntime.New(cruntime.Config{\n\t\t\tType: constants.Containerd,\n\t\t\tSocket: \"\", // use default\n\t\t\tRunner: co.Runner,\n\t\t\tImageRepository: co.ImageRepository,\n\t\t\tKubernetesVersion: co.KubernetesVersion,\n\t\t\tInsecureRegistry: co.InsecureRegistry})\n\t\tif err == nil {\n\t\t\terr = containerd.Enable(false, cgroupDriver(cc), inUserNamespace) // do not disableOthers, as it's not primary cr\n\t\t}\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"cannot ensure containerd is configured properly and reloaded for docker - cluster might be unstable: %v\", err)\n\t\t}\n\t}\n\n\tdisableOthers := !driver.BareMetal(cc.Driver)\n\tif err = cr.Enable(disableOthers, cgroupDriver(cc), inUserNamespace); err != nil {\n\t\texit.Error(reason.RuntimeEnable, \"Failed to enable container runtime\", err)\n\t}\n\n\t// Wait for the CRI to be \"live\", before returning it\n\tif err = waitForCRISocket(runner, cr.SocketPath(), 60, 1); err != nil {\n\t\texit.Error(reason.RuntimeEnable, \"Failed to start container runtime\", err)\n\t}\n\n\t// Wait for the CRI to actually work, before returning\n\tif err = waitForCRIVersion(runner, cr.SocketPath(), 60, 10); err != nil {\n\t\texit.Error(reason.RuntimeEnable, \"Failed to start container runtime\", err)\n\t}\n\n\treturn cr\n}", "title": "" }, { "docid": "5115b27a35cbe5f4e0696cc1c4030516", "score": "0.48880014", "text": "func GrabServers() {\n\tfor {\n\t\treader := bufio.NewReader(os.Stdin)\n\t\ttext, _ := reader.ReadString('\\n')\n\t\ttext = strings.TrimRight(string(text), \" \\n\")\n\t\ttext = strings.TrimSpace(string(text))\n\n\t\tswitch text {\n\t\tcase \"add\":\n\t\t\tfmt.Println(\"Grab Servers By Entering in a full address such as Host:Port\")\n\n\t\t\treader := bufio.NewReader(os.Stdin)\n\t\t\ttext, _ := reader.ReadString('\\n')\n\t\t\ttext = strings.TrimRight(string(text), \" \\n\")\n\t\t\ttext = strings.TrimSpace(string(text))\n\t\t\tconn := text\n\n\t\t\tconnectionsPerServer[conn] = 0\n\t\t\tfmt.Println(\"Added\")\n\n\t\tcase \"Log\":\n\t\t\tfmt.Println(\"Grab logging server By Entering in a full address such as Host:Port\")\n\n\t\t\treader := bufio.NewReader(os.Stdin)\n\t\t\ttext, _ := reader.ReadString('\\n')\n\t\t\ttext = strings.TrimRight(string(text), \" \\n\")\n\t\t\ttext = strings.TrimSpace(string(text))\n\n\t\t\tconn, _ := net.Dial(\"tcp\", text)\n\t\t\tlogConn = conn\n\n\t\tcase \"Launch\":\n\t\t\tfmt.Println(\"Enter in a port\")\n\n\t\t\treader := bufio.NewReader(os.Stdin)\n\t\t\ttext, _ := reader.ReadString('\\n')\n\t\t\ttext = strings.TrimRight(string(text), \" \\n\")\n\t\t\ttext = strings.TrimSpace(string(text))\n\n\t\t\tport = text\n\n\t\t\tgo StartLoadBalancer(text)\n\n\t\tcase \"Remove\":\n\t\t\tfmt.Println(\"Remove Server By Entering in a full address such as Host:Port\")\n\n\t\t\treader := bufio.NewReader(os.Stdin)\n\t\t\ttext, _ := reader.ReadString('\\n')\n\t\t\ttext = strings.TrimRight(string(text), \" \\n\")\n\t\t\ttext = strings.TrimSpace(string(text))\n\n\t\t\ttemp := make(map[string]int)\n\t\t\tfor k, v := range connectionsPerServer {\n\t\t\t\tif k != text {\n\t\t\t\t\ttemp[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tconnectionsPerServer = temp\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "7935b46bb269066e7a28893dd9ac1f77", "score": "0.48831668", "text": "func StartServer(servers []string, me int) *ShardMaster {\n gob.Register(Op{})\n\n sm := new(ShardMaster)\n sm.me = me\n\n sm.configs = make([]Config, 1)\n sm.configs[0].Groups = map[int64][]string{}\n\n sm.maxProcessedSeq = -1\n sm.maxConfigNum = 0\n\n rpcs := rpc.NewServer()\n rpcs.Register(sm)\n\n sm.px = paxos.Make(servers, me, rpcs)\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me])\n if e != nil {\n log.Fatal(\"listen error: \", e)\n }\n sm.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for sm.dead == false {\n conn, err := sm.l.Accept()\n if err == nil && sm.dead == false {\n if sm.unreliable && (rand.Int63()%1000) < 100 {\n // discard the request.\n conn.Close()\n } else if sm.unreliable && (rand.Int63()%1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && sm.dead == false {\n fmt.Printf(\"ShardMaster(%v) accept: %v\\n\", me, err.Error())\n sm.Kill()\n }\n }\n }()\n\n return sm\n}", "title": "" }, { "docid": "8d5a8858f336bde8f275c52cc3ce4c55", "score": "0.4882935", "text": "func StartServer(gid int64, shardmasters []string,\n servers []string, me int, doLoadBalance bool) *ShardKV {\n gob.Register(Op{})\n\n kv := new(ShardKV)\n kv.me = me\n kv.gid = gid\n kv.sm = shardmaster.MakeClerk(shardmasters)\n\n // Your initialization code here.\n // Don't call Join().\n // start off asking for config 0, so set lastConfig seen to -1\n kv.lastConfig = -1\n // mapping of shard num -> list of filenames in that shard\n kv.store = make(map[int][]string)\n kv.seen = make(map[int]map[int64]*Reply)\n kv.shardConfigs = make(map[int]int)\n kv.popularities = make(map[int]*PopularityStatus)\n for i := 0; i < shardmaster.NShards; i++ {\n kv.popularities[i] = &PopularityStatus{}\n }\n kv.reconfigs = make(map[int]int)\n kv.shardsToTransfer = make(map[int]map[int64]*ReshardArgs)\n\n kv.root = servers[me] + \"-root\"\n os.MkdirAll(path.Join(kv.root, \"tmp\"), 0777)\n\n rpcs := rpc.NewServer()\n rpcs.Register(kv)\n\n kv.px = paxos.Make(servers, me, rpcs)\n\n\n os.Remove(servers[me])\n l, e := net.Listen(\"unix\", servers[me]);\n if e != nil {\n log.Fatal(\"listen error: \", e);\n }\n kv.l = l\n\n // please do not change any of the following code,\n // or do anything to subvert it.\n\n go func() {\n for kv.dead == false {\n conn, err := kv.l.Accept()\n if err == nil && kv.dead == false {\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n } else if kv.unreliable && (rand.Int63() % 1000) < 200 {\n // process the request but force discard of reply.\n c1 := conn.(*net.UnixConn)\n f, _ := c1.File()\n err := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n if err != nil {\n fmt.Printf(\"shutdown: %v\\n\", err)\n }\n go rpcs.ServeConn(conn)\n } else {\n go rpcs.ServeConn(conn)\n }\n } else if err == nil {\n conn.Close()\n }\n if err != nil && kv.dead == false {\n fmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n kv.Kill()\n }\n }\n }()\n\n go func() {\n for kv.dead == false {\n kv.tick()\n kv.cleanTmp()\n time.Sleep(250 * time.Millisecond)\n }\n }()\n\n go func() {\n for kv.dead == false {\n if doLoadBalance {\n kv.popularityPing()\n }\n time.Sleep(5000 * time.Millisecond)\n }\n }()\n\n go func() {\n for kv.dead == false {\n time.Sleep(3 * time.Second)\n kv.checkpoint()\n //kv.recoverMemory()\n }\n }()\n\n os.Remove(servers[me] + \"-net\")\n ln, err := net.Listen(\"unix\", servers[me] + \"-net\")\n if err != nil {\n log.Println(err.Error())\n }\n kv.fileL = ln\n go func() {\n for kv.dead == false {\n conn, err := kv.fileL.Accept()\n if !(err == nil && kv.dead == false) {\n return\n }\n if kv.unreliable && (rand.Int63() % 1000) < 100 {\n // discard the request.\n conn.Close()\n }\n //go func(c net.Conn) {\n // kv.mu.Lock()\n kv.receiveFile(conn)\n // kv.mu.Unlock()\n //}(conn)\n }\n }()\n\n return kv\n}", "title": "" }, { "docid": "b24ea7f29ef10253497c24f27ee6fd5c", "score": "0.48763487", "text": "func StartServer(gid int64, shardmasters []string,\n\tservers []string, me int) *ShardKV {\n\tgob.Register(Op{})\n\n // needed to marshal these structs into RPCs\n\tgob.Register(GetArgs{})\n gob.Register(PutArgs{})\n gob.Register(ReconfigArgs{})\n\n\tkv := new(ShardKV)\n\tkv.me = me\n\tkv.gid = gid\n\tkv.sm = shardmaster.MakeClerk(shardmasters)\n\n\t// Your initialization code here.\n\t// Don't call Join().\n\tkv.store = map[string]string{}\n kv.ids = map[int64]int64{}\n kv.ret = map[int64]string{}\n kv.seq = 0\n kv.config = shardmaster.Config{Num:-1}\n\n\trpcs := rpc.NewServer()\n\trpcs.Register(kv)\n\n\tkv.px = paxos.Make(servers, me, rpcs)\n\n\tos.Remove(servers[me])\n\tl, e := net.Listen(\"unix\", servers[me])\n\tif e != nil {\n\t\tlog.Fatal(\"listen error: \", e)\n\t}\n\tkv.l = l\n\n\t// please do not change any of the following code,\n\t// or do anything to subvert it.\n\n\tgo func() {\n\t\tfor kv.dead == false {\n\t\t\tconn, err := kv.l.Accept()\n\t\t\tif err == nil && kv.dead == false {\n\t\t\t\tif kv.unreliable && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t// discard the request.\n\t\t\t\t\tconn.Close()\n\t\t\t\t} else if kv.unreliable && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t}\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t} else {\n\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t}\n\t\t\t} else if err == nil {\n\t\t\t\tconn.Close()\n\t\t\t}\n\t\t\tif err != nil && kv.dead == false {\n\t\t\t\tfmt.Printf(\"ShardKV(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\tkv.kill()\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor kv.dead == false {\n\t\t\tkv.tick()\n\t\t\ttime.Sleep(250 * time.Millisecond)\n\t\t}\n\t}()\n\n\treturn kv\n}", "title": "" }, { "docid": "85d2379e61a28d8e5895b859d5fc9b7b", "score": "0.4872538", "text": "func main() {\n\tgo server()\n\t//go swimDetect()\n\tgo rpcServer()\n\t//go MasterServer()\n\tgo handleInput()\n\n\tinitialize()\n\tprintList(membership)\n\tprintID(myid)\n\tswimDetect()\n\t//test()\n\n}", "title": "" }, { "docid": "cc026bbf8e95bc040573a5bd134fd13b", "score": "0.4871914", "text": "func siteRestore(primarySite bool) {\n\thostsToPowerOn := fds.secondarySiteHosts\n\tif primarySite {\n\t\thostsToPowerOn = fds.primarySiteHosts\n\t}\n\tframework.Logf(\"hosts to power on: %v\", hostsToPowerOn)\n\tpowerOnHostParallel(hostsToPowerOn)\n}", "title": "" }, { "docid": "986fe76fac70f84c5376203b5e890eb1", "score": "0.4871789", "text": "func mk_machine() *Machine {\n\tm := new(Machine)\n\t(*FlagsRegister)(m.C(FL)).SetS(true)\n\treturn m\n}", "title": "" }, { "docid": "08e3930e2d0384cabb54cef205914e24", "score": "0.48693448", "text": "func Provision(cc *config.ClusterConfig, n *config.Node, apiServer bool, delOnFail bool) (command.Runner, bool, libmachine.API, *host.Host, error) {\n\tregister.Reg.SetStep(register.StartingNode)\n\tname := config.MachineName(*cc, *n)\n\n\t// Be explicit with each case for the sake of translations\n\tif cc.KubernetesConfig.KubernetesVersion == constants.NoKubernetesVersion {\n\t\tout.Step(style.ThumbsUp, \"Starting minikube without Kubernetes in cluster {{.cluster}}\", out.V{\"cluster\": cc.Name})\n\t} else {\n\t\tif apiServer {\n\t\t\tout.Step(style.ThumbsUp, \"Starting control plane node {{.name}} in cluster {{.cluster}}\", out.V{\"name\": name, \"cluster\": cc.Name})\n\t\t} else {\n\t\t\tout.Step(style.ThumbsUp, \"Starting worker node {{.name}} in cluster {{.cluster}}\", out.V{\"name\": name, \"cluster\": cc.Name})\n\t\t}\n\n\t}\n\n\tif driver.IsKIC(cc.Driver) {\n\t\tbeginDownloadKicBaseImage(&kicGroup, cc, viper.GetBool(\"download-only\"))\n\t}\n\n\tif !driver.BareMetal(cc.Driver) {\n\t\tbeginCacheKubernetesImages(&cacheGroup, cc.KubernetesConfig.ImageRepository, n.KubernetesVersion, cc.KubernetesConfig.ContainerRuntime, cc.Driver)\n\t}\n\n\t// Abstraction leakage alert: startHost requires the config to be saved, to satistfy pkg/provision/buildroot.\n\t// Hence, SaveProfile must be called before startHost, and again afterwards when we know the IP.\n\tif err := config.SaveProfile(viper.GetString(config.ProfileName), cc); err != nil {\n\t\treturn nil, false, nil, nil, errors.Wrap(err, \"Failed to save config\")\n\t}\n\n\thandleDownloadOnly(&cacheGroup, &kicGroup, n.KubernetesVersion, cc.KubernetesConfig.ContainerRuntime, cc.Driver)\n\tif driver.IsKIC(cc.Driver) {\n\t\twaitDownloadKicBaseImage(&kicGroup)\n\t}\n\n\treturn startMachine(cc, n, delOnFail)\n}", "title": "" }, { "docid": "c617d15f159abb5fac0f9c2bf54eb8a2", "score": "0.48656595", "text": "func TestSetup() {\n\tIt(\"should complete on all boot servers\", func(done Done) {\n\t\tenv := well.NewEnvironment(context.Background())\n\t\tenv.Go(func(ctx context.Context) error {\n\t\t\tstdout, stderr, err := execAt(\n\t\t\t\tboot0, \"sudo\", \"neco\", \"setup\", \"--no-revoke\", \"--proxy=\"+proxy, \"0\", \"1\", \"2\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"neco setup failed\", map[string]interface{}{\n\t\t\t\t\t\"host\": \"boot-0\",\n\t\t\t\t\t\"stdout\": string(stdout),\n\t\t\t\t\t\"stderr\": string(stderr),\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tenv.Go(func(ctx context.Context) error {\n\t\t\tstdout, stderr, err := execAt(\n\t\t\t\tboot1, \"sudo\", \"neco\", \"setup\", \"--no-revoke\", \"--proxy=\"+proxy, \"0\", \"1\", \"2\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"neco setup failed\", map[string]interface{}{\n\t\t\t\t\t\"host\": \"boot-1\",\n\t\t\t\t\t\"stdout\": string(stdout),\n\t\t\t\t\t\"stderr\": string(stderr),\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tenv.Go(func(ctx context.Context) error {\n\t\t\tstdout, stderr, err := execAt(\n\t\t\t\tboot2, \"sudo\", \"neco\", \"setup\", \"--no-revoke\", \"--proxy=\"+proxy, \"0\", \"1\", \"2\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"neco setup failed\", map[string]interface{}{\n\t\t\t\t\t\"host\": \"boot-2\",\n\t\t\t\t\t\"stdout\": string(stdout),\n\t\t\t\t\t\"stderr\": string(stderr),\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tenv.Stop()\n\n\t\tExpect(env.Wait()).NotTo(HaveOccurred())\n\t\tclose(done)\n\t}, 300)\n\n\tIt(\"should install files\", func() {\n\t\tfor _, h := range []string{boot0, boot1, boot2} {\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.NecoConfFile)\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.NecoCertFile)\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.NecoKeyFile)\n\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.EtcdBackupCertFile)\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.EtcdBackupKeyFile)\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.TimerFile(\"etcd-backup\"))\n\t\t\texecSafeAt(h, \"test\", \"-f\", neco.ServiceFile(\"etcd-backup\"))\n\n\t\t\texecSafeAt(h, \"test\", \"-f\", \"/lib/systemd/system/neco-updater.service\")\n\t\t\texecSafeAt(h, \"test\", \"-f\", \"/lib/systemd/system/neco-worker.service\")\n\t\t\texecSafeAt(h, \"test\", \"-f\", \"/lib/systemd/system/node-exporter.service\")\n\t\t\texecSafeAt(h, \"test\", \"-f\", \"/lib/systemd/system/sabakan-state-setter.service\")\n\t\t\texecSafeAt(h, \"test\", \"-f\", \"/lib/systemd/system/rkt-gc.service\")\n\t\t\texecSafeAt(h, \"test\", \"-f\", \"/lib/systemd/system/rkt-gc.timer\")\n\t\t}\n\t})\n\n\tIt(\"should run services\", func() {\n\t\tfor _, h := range []string{boot0, boot1, boot2} {\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", \"neco-updater.service\")\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", \"neco-worker.service\")\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", \"node-exporter.service\")\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", \"rkt-gc.timer\")\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", \"etcd-backup.timer\")\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", neco.EtcdService+\".service\")\n\t\t\texecSafeAt(h, \"systemctl\", \"-q\", \"is-active\", neco.VaultService+\".service\")\n\t\t}\n\t})\n\n\tIt(\"should complete updates\", func() {\n\t\tBy(\"Waiting for request to complete\")\n\t\twaitRequestComplete(\"\")\n\n\t\tBy(\"Installing sshd_config and sudoers\")\n\t\tfor _, h := range []string{boot0, boot1, boot2} {\n\t\t\texecSafeAt(h, \"grep\", \"-q\", \"'^PasswordAuthentication.no$'\", \"/etc/ssh/sshd_config\")\n\t\t\texecSafeAt(h, \"sudo\", \"test\", \"-f\", \"/etc/sudoers.d/cybozu\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "10c6e6d303208b4c9cce4f8d305a0ef3", "score": "0.48648712", "text": "func CheckForMultipleWatchtowerInstances(client container.Client, cleanup bool, scope string) error {\n\tcontainers, err := client.ListContainers(filters.FilterByScope(scope, filters.WatchtowerContainersFilter))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(containers) <= 1 {\n\t\tlog.Debug(\"There are no additional watchtower containers\")\n\t\treturn nil\n\t}\n\n\tlog.Info(\"Found multiple running watchtower instances. Cleaning up.\")\n\treturn cleanupExcessWatchtowers(containers, client, cleanup)\n}", "title": "" }, { "docid": "20ba103be4cc4e2f89597d73f8daee51", "score": "0.48588544", "text": "func anteros(arguments []string) int {\n\t//\n\t// Initialize the server environment: command-line flags, Viper, logging, and the WebPA instance\n\t//\n\n\tvar (\n\t\tf = pflag.NewFlagSet(applicationName, pflag.ContinueOnError)\n\t\tv = viper.New()\n\n\t\tlogger, webPA, err = server.Initialize(applicationName, arguments, f, v)\n\t)\n\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Unable to initialize Viper environment: %s\\n\", err)\n\t\treturn 1\n\t}\n\n\tlogger.Log(level.Key(), level.InfoValue(), \"configurationFile\", v.ConfigFileUsed())\n\n\tprimaryHandler, err := NewPrimaryHandler(logger, v)\n\tif err != nil {\n\t\tlogger.Log(level.Key(), level.ErrorValue(), logging.ErrorKey(), err, logging.MessageKey(), \"unable to create primary handler\")\n\t\treturn 2\n\t}\n\n\tvar (\n\t\t_, runnable = webPA.Prepare(logger, nil, primaryHandler)\n\t\tsignals = make(chan os.Signal, 1)\n\t)\n\n\t//\n\t// Execute the runnable, which runs all the servers, and wait for a signal\n\t//\n\n\tif err := concurrent.Await(runnable, signals); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error when starting %s: %s\", applicationName, err)\n\t\treturn 4\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "4f3345822774690bc907f1d834b5a748", "score": "0.4851568", "text": "func Make(peers []string, me int, rpcs *rpc.Server) *Paxos {\n\tpx := &Paxos{}\n\tpx.peers = peers\n\tpx.me = me\n\n\t// Your initialization code here.\n\n\t// intialize log\n\t// px.logs := list.New()\n\n\t// haven't called done before\n\tpx.log = map[int]*entry{}\n\tpx.done = map[string]int{}\n\tfor _, peer := range px.peers {\n\t\tpx.done[peer] = -1\n\t}\n\n\tif rpcs != nil {\n\t\t// caller will create socket &c\n\t\trpcs.Register(px)\n\t} else {\n\t\trpcs = rpc.NewServer()\n\t\trpcs.Register(px)\n\n\t\t// prepare to receive connections from clients.\n\t\t// change \"unix\" to \"tcp\" to use over a network.\n\t\tos.Remove(peers[me]) // only needed for \"unix\"\n\t\tl, e := net.Listen(\"unix\", peers[me])\n\t\tif e != nil {\n\t\t\tlog.Fatal(\"listen error: \", e)\n\t\t}\n\t\tpx.l = l\n\n\t\t// please do not change any of the following code,\n\t\t// or do anything to subvert it.\n\n\t\t// create a thread to accept RPC connections\n\t\tgo func() {\n\t\t\tfor px.isdead() == false {\n\t\t\t\tconn, err := px.l.Accept()\n\t\t\t\tif err == nil && px.isdead() == false {\n\t\t\t\t\tif px.isunreliable() && (rand.Int63()%1000) < 100 {\n\t\t\t\t\t\t// discard the request.\n\t\t\t\t\t\tconn.Close()\n\t\t\t\t\t} else if px.isunreliable() && (rand.Int63()%1000) < 200 {\n\t\t\t\t\t\t// process the request but force discard of reply.\n\t\t\t\t\t\tc1 := conn.(*net.UnixConn)\n\t\t\t\t\t\tf, _ := c1.File()\n\t\t\t\t\t\terr := syscall.Shutdown(int(f.Fd()), syscall.SHUT_WR)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tfmt.Printf(\"shutdown: %v\\n\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tatomic.AddInt32(&px.rpcCount, 1)\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tatomic.AddInt32(&px.rpcCount, 1)\n\t\t\t\t\t\tgo rpcs.ServeConn(conn)\n\t\t\t\t\t}\n\t\t\t\t} else if err == nil {\n\t\t\t\t\tconn.Close()\n\t\t\t\t}\n\t\t\t\tif err != nil && px.isdead() == false {\n\t\t\t\t\tfmt.Printf(\"Paxos(%v) accept: %v\\n\", me, err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn px\n}", "title": "" }, { "docid": "e9695b5fdc219f7ba141414732d8213e", "score": "0.48498118", "text": "func TestMultiControlPlane(t *testing.T) {\n\tframework.NewTest(t).\n\t\tFeatures(\"installation.multiplecontrolplanes\").\n\t\tRun(func(t framework.TestContext) {\n\t\t\t// configure peerauthentication per system namespace\n\t\t\trestrictUserGroups(t)\n\n\t\t\ttestCases := []struct {\n\t\t\t\tname string\n\t\t\t\tstatusCode int\n\t\t\t\tfrom echo.Instances\n\t\t\t\tto echo.Instances\n\t\t\t}{\n\t\t\t\t{\n\t\t\t\t\tname: \"workloads within same usergroup can communicate, same namespace\",\n\t\t\t\t\tstatusCode: http.StatusOK,\n\t\t\t\t\tfrom: apps.NS[0].A,\n\t\t\t\t\tto: apps.NS[0].B,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"workloads within same usergroup can communicate, different namespaces\",\n\t\t\t\t\tstatusCode: http.StatusOK,\n\t\t\t\t\tfrom: apps.NS[1].A,\n\t\t\t\t\tto: apps.NS[2].B,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"workloads within different usergroups cannot communicate, registry only\",\n\t\t\t\t\tstatusCode: http.StatusBadGateway,\n\t\t\t\t\tfrom: apps.NS[0].A,\n\t\t\t\t\tto: apps.NS[1].B,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"workloads within different usergroups cannot communicate, default passthrough\",\n\t\t\t\t\tstatusCode: http.StatusServiceUnavailable,\n\t\t\t\t\tfrom: apps.NS[2].B,\n\t\t\t\t\tto: apps.NS[0].B,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfor _, tc := range testCases {\n\t\t\t\tt.NewSubTest(tc.name).Run(func(t framework.TestContext) {\n\t\t\t\t\ttc.from[0].CallOrFail(t, echo.CallOptions{\n\t\t\t\t\t\tTo: tc.to,\n\t\t\t\t\t\tPort: echo.Port{\n\t\t\t\t\t\t\tProtocol: protocol.HTTP,\n\t\t\t\t\t\t\tServicePort: 80,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tCheck: check.And(\n\t\t\t\t\t\t\tcheck.ErrorOrStatus(tc.statusCode),\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}", "title": "" }, { "docid": "a03573a550d77da3b2cf4c843501f7c2", "score": "0.48440146", "text": "func (m *Machine) addingMachine() {\r\n\r\n\tif !Silent {\r\n\t\tfmt.Println(\"[Mach] #\", m.id, \"\\tadd machine setten up.\")\r\n\t}\r\n\r\n\tfor {\r\n\t\t// Backdoor\r\n\t\tselect {\r\n\t\tcase <-m.fix:\r\n\t\t\tm.status = true\r\n\t\tdefault:\r\n\t\t}\r\n\r\n\t\tif (rand.Float64() < MachFailure) && m.status {\r\n\t\t\tm.status = false\r\n\t\t}\r\n\r\n\t\tm.ready <- true\r\n\t\tt := <-m.todo\r\n\r\n\t\tif !Silent {\r\n\t\t\tfmt.Println(\"[Mach] #\", m.id, \"\\tadd machine started calculating: [\", t.taskInMachine.arg1, t.taskInMachine.arg2, \"]\")\r\n\t\t}\r\n\r\n\t\ttime.Sleep(time.Duration(MachPerf) * time.Second)\r\n\r\n\t\t// Machine works when it sees a task has been given by a worker\r\n\t\tif m.status {\r\n\t\t\tt.result <- t.taskInMachine.arg1 + t.taskInMachine.arg2\r\n\t\t} else {\r\n\t\t\tt.result <- ErrorSignal\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "ad231ce633ce9d93a1e85a6f2bd718f2", "score": "0.48382026", "text": "func (gState *State) StartManagers() {\n\tif gState.Cfg.NoUI {\n\t\tgState.PrintBanner()\n\t\tgo gState.StatusPrinter()\n\t} else {\n\t\tgo gState.UIPrinter()\n\t}\n\tgo gState.ManageRequests()\n\tgo gState.ManageNewURLs()\n\tgo gState.OutputWriter(gState.Cfg.Localpath)\n\tgo gState.StatsTracker()\n\tfor x := 0; x < gState.Cfg.Threads; x++ {\n\t\tgo gState.StartTestWorker()\n\t}\n}", "title": "" }, { "docid": "679656d863070de5c109a60e0613dfe5", "score": "0.48378924", "text": "func testRebootAllBootServers() {\n\tIt(\"runs systemd service on all boot servers after reboot\", func() {\n\t\tBy(\"rebooting all boot servers\")\n\t\tfor _, host := range bootServers {\n\t\t\t// Exit code is 255 when ssh is disconnected\n\t\t\texecAt(host, \"sudo\", \"reboot\")\n\t\t}\n\n\t\tBy(\"waiting all boot servers are online\")\n\t\terr := prepareSSHClients(bootServers...)\n\t\tExpect(err).NotTo(HaveOccurred())\n\n\t\tBy(\"checking services on the boot servers are running after reboot\")\n\t\tcheckSystemdServicesOnBoot()\n\n\t\tBy(\"checking sabakan is available\")\n\t\tEventually(func() error {\n\t\t\tstdout, stderr, err := execAt(bootServers[0], \"sabactl\", \"machines\", \"get\")\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"stdout: %s, stderr: %s, err: %v\", stdout, stderr, err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}).Should(Succeed())\n\n\t\t// .kube directory is mounted by tmpfs, so reissuing config file is necessary\n\t\tBy(\"generating kubeconfig for cluster admin\")\n\t\tEventually(func() error {\n\t\t\t_, stderr, err := execAt(bootServers[0], \"ckecli\", \"kubernetes\", \"issue\", \">\", \".kube/config\")\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"err: %v, stderr: %s\", err, stderr)\n\t\t\t}\n\t\t\treturn nil\n\t\t}).Should(Succeed())\n\t})\n}", "title": "" }, { "docid": "7f283a4ec6373c27a185a1ff3bebfb73", "score": "0.48348254", "text": "func changeTargetServer() {\n\tif serverId >= maxServers {\n\t\tserverId = 1\n\t} else {\n\t\tserverId++\n\t}\n\n\t// Keep going until an active server is found\n\tif isIgnored() {\n\t\tfmt.Printf(\"Target server %d has been marked as ignored: %s\\n\", serverId, servers[serverId-1].Url)\n\t\tchangeTargetServer()\n\t} else {\n\t\tfmt.Printf(\"Set next target server to server: %d\\n\\n\", serverId)\n\t}\n}", "title": "" }, { "docid": "80bacd3ab8072bd2d3997268bf32fdcc", "score": "0.4829785", "text": "func (dbq *DBQueue2) startConnectors() {\n\t// wait some time for all channels inited\n\ttime.Sleep(3 * time.Second)\n\n\tdbq.connector = &DBQueueConnector{\n\t\tname: dbq.hostname + \"/connector\",\n\t\tqueueDB: dbq.queueDB,\n\t\tchannels: dbq.channels,\n\t}\n\n\tdbq.connector.version = os.Getenv(\"version\")\n\tif dbq.connector.version == \"\" {\n\t\tdbq.connector.version = strconv.Itoa((1000000 + rand.Int()) % 999999)\n\t}\n\tgo dbq.connector.start()\n}", "title": "" }, { "docid": "a76ab1ef3360534f01c78e25a752642f", "score": "0.4828346", "text": "func TestMasterAndSlave(t *testing.T) {\n\taddr1 := types.NewAddress(\"0x53143B153321E9cBC268C806aFeF444346AA6522\" /*\"0x2acaac851b020ceb644bc506a3a932f4d0867afd\"*/)\n\tpri1 := \"52533c066a5b3ddc6848fd692b93abc6025d06aa5a220f67213c619a6ded8d3a\" //\"3b82b9641714c4bb9a3e3a23ca9e8170772fcdeedd9e4591e7d03ebe564a579e\"\n\taddr2 := types.NewAddress(\"0xe3b2d0E78a88cB0139aFC7A08733766F5C788A12\" /*\"0x9c67d6e615fb9fb28ddad773fbcfa8e5dad092f3\"*/)\n\tpri2 := \"680771f89fa288c71a113846de2b953bfedb6da300e1747a1d1b51f2a43a10c5\" //\"ee09c465edc1674d382157f9edb26681707b79b31cab452450776a2a1ad57be5\"\n\tacco1 := types.NewAccount(addr1, pri1)\n\tacco2 := types.NewAccount(addr2, pri2)\n\tns := net.NewNetSimulator()\n\tpl := peer_list.NewPeerList(addr1, ns)\n\tpl.Run()\n\teg, _ := vcfs.NewRedisKVStore(\"localhost:6379\", 1)\n\tfs := vcfs.NewFileSystem(eg, pl)\n\tfs.Serve()\n\tbc, _ := blockchain.NewEthBlockChainHandler(\"ws://127.0.0.1:8546\", acco1)\n\tls, _ := log.NewLogSystem(\"\")\n\tcli, _ := master_side.NewMasterClient(pl, fs /*\"ws://127.0.0.1:8546\"*/, bc /*, acco1, ns*/, ls)\n\tcli.PeerList.Peers = append(cli.PeerList.Peers, addr2)\n\tcli.Run(\":8080\")\n\tsch := getSch(acco2, ns, ls)\n\tsch.Run()\n\tfmt.Println(\"INITOK\")\n\tfor {\n\t}\n}", "title": "" } ]
80b9effa569a7dbc1bf0c7a340a9e67f
GetUser get a user
[ { "docid": "9e832185da14123d1e9514691cade957", "score": "0.78022367", "text": "func GetUser(c *fiber.Ctx) error {\n\tid := c.Params(\"id\")\n\tdb := database.DB\n\tvar user model.User\n\tdb.Find(&user, id)\n\tif user.Username == \"\" {\n\t\treturn c.Status(404).JSON(fiber.Map{\"status\": \"error\", \"message\": \"No user found with ID\", \"data\": nil})\n\t}\n\treturn c.JSON(fiber.Map{\"status\": \"success\", \"message\": \"User found\", \"data\": user})\n}", "title": "" } ]
[ { "docid": "f7bbc8dec750e38b43ac55f91b02a582", "score": "0.8165511", "text": "func (s *Service) GetUser(id string) (*User, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "008a9f49de9fbd100d398896ff0563ae", "score": "0.8028738", "text": "func (u *userService) GetUser(userId int64) (*users.User, *errors.RestErr){\n\tresult := &users.User{Id: userId}\n\tif err := result.Get(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "edf5b649ab75e9ff46c09c413cbd87e4", "score": "0.8000885", "text": "func (c *Client) GetUser(ctx context.Context, id string) (*User, error) {\n\n\turi := \"/users/\" + id\n\treq, err := c.newRequest(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"notion: invalid request: %w\", err)\n\t}\n\n\tvar res User\n\tres.RawJSON, err = c.doHTTPAndUnmarshalResponse(req, &res, \"find user\")\n\treturn &res, err\n}", "title": "" }, { "docid": "7701c6aaaffedabe2be35ba82a498624", "score": "0.7993329", "text": "func (u UserController) GetUser(c *gin.Context) {\n\tparam := getUser{}\n\tif err := c.ShouldBindUri(&param); err != nil {\n\t\texception.BadRequest(\"Param must be of type integer, required\", \"INVALID_BODY\")\n\t}\n\n\tuser := entity.User{}\n\tdatabase.GetDB().Select(\"name, email, address, age\").First(&user, param.ID)\n\n\tif (user == entity.User{}) {\n\t\texception.Empty(\"User not found\", \"User with this ID not enough\", \"USER_NOT_FOUND\")\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": \"Success get user\",\n\t\t\"result\": user,\n\t})\n}", "title": "" }, { "docid": "9057a5bacae7af3c36ebfac5b61181eb", "score": "0.79572654", "text": "func (s *Obj) GetUser(ctx context.Context, in *sea.GetUserRequest) (*sea.User, error) {\n\tvar(\n\t\tid int64\n\t)\n\n\tid, err := strconv.ParseInt(in.GetId(), 10, 64)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\tuser, err := user.Get(s.DB, id)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\tout := userToRpcUser(user)\n\n\treturn &out, nil\n}", "title": "" }, { "docid": "82d37cc7d78b1d66837a879ea10ec92e", "score": "0.7947366", "text": "func (u *UserHandler) GetUser(ctx context.Context, req *user.GetUserRequest, resp *user.UserInfo) error {\n\t//\tvar user models.User\n\t// user.ID = req.UserId\n\n\t// _, err := u.srv.Login()\n\t// if err != nil {\n\t// \tlogger.Error(err)\n\t// \treturn err\n\t// }\n\n\treturn nil\n}", "title": "" }, { "docid": "f2976cadbeadf5ea975d6f73e83a8d57", "score": "0.79416", "text": "func (s SecurityServiceOp) GetUser(n string) (User, error) {\n\n\tvar u User\n\n\turl := securityBasePath + \"/user/\" + n\n\n\treq, err := s.client.NewRequest(url, \"GET\", nil)\n\n\tif err != nil {\n\t\treturn u, err\n\t}\n\n\tresp, err := s.client.Do(req, &u)\n\n\tif err != nil {\n\t\treturn u, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn u, nil\n}", "title": "" }, { "docid": "8d6e97447180c6b69d0190f56f6bf4f7", "score": "0.7933494", "text": "func (client *Client) GetUser() (user User, err error) {\n\terr = client.Request(\"GET\", \"/user\", nil, nil, &user)\n\treturn\n}", "title": "" }, { "docid": "fa06488e56bc6c3160d89f893bca176b", "score": "0.79215044", "text": "func GetUser(c context.Context, id string) (*model.User, error) {\n\treturn FromContext(c).GetUser(id)\n}", "title": "" }, { "docid": "a7d615c538a6298a2e21b683203327e0", "score": "0.7854402", "text": "func (u UserController) GetUser(c *gin.Context) {\n\tparam := validation.GetUserParamSchema{}\n\t_ = c.ShouldBindUri(&param)\n\n\tuser := userService.GetUser(int64(param.ID))\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": \"Success get user\",\n\t\t\"result\": user,\n\t})\n}", "title": "" }, { "docid": "2e7ee3149384bd1b0bdc996971218c0a", "score": "0.7846403", "text": "func GetUser(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tlogUrl(r)\n\n\t// get form value\n\tuser_id, _ := strconv.Atoi(r.FormValue(\"user_id\"))\n\tlogin_name := r.FormValue(\"login_name\")\n\n\tuser := User{}\n\tvar err error\n\n\t// get user\n\tif user_id != 0 {\n\t\tuser, err = getUser(user_id)\n\t} else if login_name != \"\" {\n\t\tuser, err = getUserWithLoginName(login_name)\n\t} else {\n\t\trespondError(w, \"invalid form value\")\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\trespondError(w, \"failed to get user\")\n\t\treturn\n\t}\n\n\t// return json\n\trespondJson(w, user)\n}", "title": "" }, { "docid": "37f111988929c4e3b586edd99bffd932", "score": "0.7830778", "text": "func (s *Service) GetUser() (*User, error) {\n\tresModel := struct {\n\t\tData struct {\n\t\t\tUser *User `json:\"user\"`\n\t\t} `json:\"data\"`\n\t}{}\n\n\tif err := s.c.GET(\"/user\", &resModel); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resModel.Data.User, nil\n}", "title": "" }, { "docid": "d2f3603282695af6b35e9444d88ab0f8", "score": "0.78263", "text": "func GetUser(c *gin.Context) {\n\tdbmap := c.MustGet(\"DBmap\").(*gorp.DbMap)\n\tid := c.Params.ByName(\"id\")\n\n\tvar user User\n\terr := dbmap.SelectOne(&user, \"SELECT * FROM user WHERE id=? LIMIT 1\", id)\n\n\tif err == nil {\n\t\tc.JSON(200, user)\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"user not found\"})\n\t}\n\n\t// curl -i http://localhost:8080/api/v1/users/1\n}", "title": "" }, { "docid": "9d740e7bd6e5ad8d3c2edb00b56b814e", "score": "0.78254277", "text": "func (s *hyUsersrvc) GetUser(ctx context.Context, p *hyuser.GetUserPayload) (res *hyuser.User, view string, err error) {\n\tlog.Info().Msg(\"hyUser.getUser\")\n\n\tuser, err := s.userRepo.GetUser(p.UserID)\n\tif err != nil {\n\t\t// Not Found\n\t\tif strings.Contains(err.Error(), \"no rows in result set\") {\n\t\t\treturn nil, \"\", hyuser.MakeNotFound(errors.New(\"user not found\"))\n\t\t}\n\t\treturn nil, \"\", errors.Wrapf(err, \"fail to call userRepo.GetUser(%d)\", p.UserID)\n\t}\n\tres = user\n\tview = \"default\"\n\n\treturn\n}", "title": "" }, { "docid": "a4942789e9158dc844e8a9dc37d654da", "score": "0.78082466", "text": "func (*Server) GetUser(ctx context.Context, r *user.GetUserRequest) (*user.GetUserResponse, error) {\n\tsingleUser, err := models.GetUser(r.ID)\n\tif err != nil {\n\t\tlog.Printf(\"An error occured: %v\", err)\n\t\treturn &user.GetUserResponse{}, err\n\t}\n\tvar test user.GetUserResponse\n\tcopier.Copy(&test, singleUser)\n\treturn &test, nil\n}", "title": "" }, { "docid": "e94c9768e7f30ba939bd6122160d3afa", "score": "0.77928346", "text": "func (c *Client) GetUser(userID int) (User, error) {\n\treturnUser := User{}\n\terr := c.sendRequest(\"GET\", \"get_user/\"+strconv.Itoa(userID), nil, &returnUser)\n\treturn returnUser, err\n}", "title": "" }, { "docid": "8e281be5aa75a7bdc1d405775d00e947", "score": "0.7785427", "text": "func GetUser(id uint) (*entity.User,error){\n\tclient := &http.Client{}\n\n\tURL := fmt.Sprintf(\"%s%d\",baseUserURL,id)\n\treq,_ := http.NewRequest(\"GET\",URL,nil)\n\t//DO return an http response\n\tres,err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tuserdata := &entity.User{}\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(body,userdata)\n\tif err != nil{\n\t\treturn nil,err\n\t}\n\treturn userdata,nil\n}", "title": "" }, { "docid": "349dc474e56f40fef2dfd459b5d05833", "score": "0.7772461", "text": "func (s service) GetUser(uid string) (*entities.User, error) {\n\treturn s.repository.GetUser(uid)\n}", "title": "" }, { "docid": "266a7412e9596a6237d11ea2656c625c", "score": "0.7768605", "text": "func (c *Client) GetUser(id string) (*User, error) {\n\treq, err := createHTTPRequest(httpPut, c, \"/v1/user/\"+id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar value User\n\terr = parseBody(resp, value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &value, nil\n}", "title": "" }, { "docid": "660b63309bdce2b34d6f50fa436f0617", "score": "0.7760697", "text": "func GetUser(context *gin.Context) {\n\t// Get model if exist\n\tvar user models.User\n\tif err := datasource.DB.Where(\"id = ?\", context.Param(\"id\")).First(&user).Error; err != nil {\n\t\tresponse.ERROR(context, http.StatusBadRequest)\n\t\t// c.JSON(http.StatusBadRequest, gin.H{\"error\": \"Record not found!\"})\n\t\treturn\n\t}\n\n\tresponse.JSON(context, http.StatusOK, user)\n}", "title": "" }, { "docid": "f1dc5e00419844bd966570e819d8fdd6", "score": "0.77604824", "text": "func (u User) Get(ctx *gw.Context) {\n\n}", "title": "" }, { "docid": "ccc01e3cffa30403534696e69c4bca52", "score": "0.77555054", "text": "func UserGET(id string) (*model.User, error) {\n\taID, _ := strconv.Atoi(id)\n\n\tdata, err := UserModel.GetUserByID(aID)\n\tif err != nil {\n\t\tutils.LOG(fmt.Sprintf(\"Data error: %s\", err.Error()))\n\t\treturn nil, err\n\t}\n\n\tutils.LOG(\"User was found successfully\")\n\treturn &data, nil\n}", "title": "" }, { "docid": "72633d72aecea80dabf54aa2c57734da", "score": "0.7749848", "text": "func (u *userUseCaseImpl) GetUser(id string) (*entity.User, error) {\n\t// Get user from repository & handle error if necessary\n\tuser, err := u.userRepo.Get(id)\n\tif err!= nil{\n\t\treturn nil, err\n\t}\n\n\treturn user, err\n}", "title": "" }, { "docid": "a15ee2baf81ec99a6d71de40caa446c8", "score": "0.77374166", "text": "func (s ServiceImpl) GetUser(email string) (*models.User, error) {\n\treturn s.RetrieveRepo.GetUser(email)\n}", "title": "" }, { "docid": "0fc62cd0fa2c2acfbd72865ca5c371c6", "score": "0.77317274", "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": "9ab07bb0a4345f8223d4223c53089304", "score": "0.77312225", "text": "func GetUser(c *gin.Context) *User {\n\tu, ok := c.Get(\"user\")\n\tif !ok {\n\t\treturn nil\n\t}\n\tuser, ok := u.(*User)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn user\n}", "title": "" }, { "docid": "629e43316bf39fde4749476edc19a17f", "score": "0.7716501", "text": "func (db *DatabaseService) GetUser(user *models.User) error {\n\terr := db.db.Model(user).Where(\"id = ?\", user.ID).Select()\n\treturn err\n}", "title": "" }, { "docid": "3911a37eea4d6f655e44c36cae451d03", "score": "0.77017397", "text": "func getUser() (*user, error) {\n\treturn &user{1432, \"Betty\"}, nil\n}", "title": "" }, { "docid": "960f7e6468ea48e961f5cb9e59e0c7df", "score": "0.76989067", "text": "func Getuser(c *gin.Context) {\n\tuser, err := lib.GetPerson(c.Param(\"personcd\"))\n\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tc.Status(http.StatusNoContent)\n\t\treturn\n\tcase err != nil:\n\t\tc.Status(http.StatusInternalServerError)\n\t\treturn\n\n\t}\n\tc.JSON(http.StatusOK, *user)\n}", "title": "" }, { "docid": "4beba850fde6fbe79b26c86c68f5e995", "score": "0.76937836", "text": "func (a *AApi) GetUser(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tentry := a.logger.WithField(\"func\", \"GetUser\")\n\tentry.Debugf(\"Request from %s, userID: %s\", r.RemoteAddr, vars[\"id\"])\n\n\tuser, err := a.sqlManager.GetUser(vars[\"id\"])\n\n\tif err != nil {\n\t\tentry.Errorf(\"Respond to %s, error: %v\", r.RemoteAddr, err)\n\t\tapi_common.RespondWithError(\n\t\t\tw,\n\t\t\thttp.StatusUnprocessableEntity,\n\t\t\tfmt.Sprintf(\"GetUser(): %v\", err),\n\t\t\ta.logger,\n\t\t)\n\n\t\treturn\n\t}\n\t// Id user is nil == doesn't exists\n\tif user == nil {\n\t\tentry.Warnf(\"Respond to %s, error: %v\", r.RemoteAddr, err)\n\t\tapi_common.RespondWithError(w, http.StatusNotFound, \"user doesn't exists\", a.logger)\n\n\t\treturn\n\t}\n\n\tentry.Debugf(\"Responding to %s with: %+v\", r.RemoteAddr, user)\n\tapi_common.RespondWithJson(w, http.StatusOK, &user, a.logger)\n}", "title": "" }, { "docid": "6e3a30a7fba9b0dc8e5e5c0b4d2f127e", "score": "0.76910037", "text": "func GetUser(c *gin.Context) {\n\t// parsing param from URL\n\t// c.Query(\"caller\") if url like /users/:user_id?caller=123\n\tuserID, err := strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\tif err != nil {\n\t\t// return the bad request to the client\n\t\tapiErr := &utils.ApplicationError{\n\t\t\tMessage: \"user id must be a number\",\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t\tCode: \"bad_request\",\n\t\t}\n\n\t\t// c.JSON(apiErr.StatusCode, apiErr)\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// calling user service\n\tuser, apiErr := services.UsersService.GetUser(userID)\n\n\tif apiErr != nil {\n\t\t// handle error and return to the client\n\t\t// c.JSON(apiErr.StatusCode, apiErr)\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// return user to client\n\t// c.JSON(http.StatusOK, user)\n\tutils.Respond(c, http.StatusOK, user)\n}", "title": "" }, { "docid": "ee8191e1ab33d2513875191cf6d7a628", "score": "0.7688674", "text": "func (env *Env) GetUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tparams := mux.Vars(r)\n\n\tvar user m.User\n\n\tuser, err := env.User.GetUserFromDB(params[\"userid\"])\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(500), 500)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "f0b913a7ac2d5c4e90f2cadd80afc16e", "score": "0.76841295", "text": "func (s *Service) GetUser(c *gin.Context) {\n\tmobile := c.GetString(\"mobile\")\n\n\tvar profile ebs_fields.UserProfile\n\tif res := s.Db.Model(&ebs_fields.User{}).Where(\"mobile = ?\", mobile).First(&profile); res.Error != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": res.Error.Error(), \"code\": \"database_error\"})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, profile)\n}", "title": "" }, { "docid": "f5099268c3215ac4371ae9f92dd03dcf", "score": "0.7681403", "text": "func (u *userUseCaseImpl) GetUser(id string) (*domain.User, error) {\n\t// Get user from repository & handle error if necessary\n\tuser, err := u.userRepo.Get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn user, err\n}", "title": "" }, { "docid": "95e9ca45b4077a0afc202e6f350c4e35", "score": "0.76786107", "text": "func GetUser(db *gorm.DB, User *User, id string) (err error) {\n\terr = db.Where(\"id = ?\", id).First(User).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "131f0ee40e0d59a14597003b5efec880", "score": "0.76759887", "text": "func GetUser(c *gin.Context) {\n\n\tvar (\n\t\tUser models.Users\n\t)\n\n\tclaims := c.MustGet(\"decoded\").(*models.Claims)\n\n\tif claims.IsAdmin() {\n\t\tfmt.Println(\"You have permission for this access\")\n\t} else {\n\t\tc.JSON(500, gin.H{\n\t\t\t\"Message\": \"You don't have the permission \",\n\t\t})\n\t\treturn\n\t}\n\n\t_id, _ := primitive.ObjectIDFromHex(c.Param(\"id\"))\n\n\t// Memilih Tabel\n\tcollection := db.Collection(\"users\")\n\n\t// Menentukan waktu koneksi query\n\tctx, _ := context.WithTimeout(context.Background(), 30*time.Second)\n\n\tfilter := bson.D{{\"_id\", _id}}\n\terrSQL := collection.FindOne(ctx, filter).Decode(&User)\n\tif errSQL != nil {\n\t\t// If the structure of the body is wrong, return an HTTP error\n\t\tfmt.Println(errSQL)\n\t\tc.JSON(500, gin.H{\n\t\t\t\"Message\": \"Internal Server Error \",\n\t\t})\n\t\treturn\n\t}\n\n\tresult := gin.H{\n\t\t\"data\": User,\n\t}\n\tc.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "25f636f5e66e252843984d98fd175f91", "score": "0.76728296", "text": "func GetUser(c *gin.Context) {\n\t// take the requested id from the URL query\n\tuserID, err := strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\n\t// validate for errors\n\tif err != nil {\n\t\tapiErr := &utils.ApplicationError{\n\t\t\tMessage: \"user_id must be a positive number\",\n\t\t\tStatusCode: http.StatusNotFound,\n\t\t\tCode: \"bad_request\",\n\t\t}\n\t\t// encode request to json\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// now that we have a valid id, we\n\t// pass the requested id to the service\n\tuser, apiErr := services.UserService.GetUser(uint64(userID))\n\n\t// validate for errors from service\n\tif apiErr != nil {\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// return user to client\n\tutils.Respond(c, http.StatusOK, user)\n}", "title": "" }, { "docid": "fcbb1b5454d60ca5cd799a772c91943a", "score": "0.7670677", "text": "func (p userService) GetUser(user *entities.User, id string) error {\n\tif err := p.db.First(&user, &entities.User{Model: entities.Model{ID: id}}).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\treturn errors.New(\"user not found\")\n\t\t}\n\t\tlog.Error(\"GetUser\", err)\n\t\treturn errors.New(\"unknown error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "943857f092d29c3c13edf33eb83c5d44", "score": "0.76677114", "text": "func (u userSerivce) GetUser(userID int64) (*domain.User, *utils.ApplicationErr) {\n\treturn domain.UserDao.GetUser(userID)\n}", "title": "" }, { "docid": "310e277246beefb65deb3a57a11c2e7d", "score": "0.76592326", "text": "func (h *Handler) GetUser(w http.ResponseWriter, r *http.Request) {\n\tid, err := strconv.Atoi(mux.Vars(r)[\"id\"])\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif id < 1 {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tuserdata, err := h.Users.Get(id)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tglog.Infof(\"Error loading user %d\", id)\n\t\treturn\n\t}\n\n\tif userdata == nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tglog.Infof(\"User %d not found\", id)\n\t\treturn\n\t}\n\n\tuser := ConvertUserToUserResponse(userdata)\n\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "fd109a423ea0e5da543ee9fd3cff92b4", "score": "0.76572764", "text": "func (m *Malscraper) GetUser(username string) (*model.User, int, error) {\n\treturn m.api.GetUser(username)\n}", "title": "" }, { "docid": "dc173bbc0d49020a3f96894f4b110ef1", "score": "0.76517504", "text": "func (s *usersService) GetUser(userID int64) (*users.User, *errors.RestErr) {\n\tresult := &users.User{ID: userID}\n\tif err := result.Get(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9f06153f9bff76d9a2ff3f81c0aff2cc", "score": "0.76502895", "text": "func (u *UserAppInterface) GetUser(userId uint64) (*entity.User, error) {\n\treturn u.GetUserFn(userId)\n}", "title": "" }, { "docid": "6fbc1ea53e1b8406376e70f8708e42fd", "score": "0.764394", "text": "func GetUser(r *http.Request) *data.User {\n\tuser := r.Context().Value(userKey)\n\tif user == nil {\n\t\treturn nil\n\t}\n\treturn user.(*data.User)\n}", "title": "" }, { "docid": "f475b6854ad31a39a698bf2f598bc28d", "score": "0.7632045", "text": "func (db *Database) GetUser(r *requests.Request) error {\n\tdb.mu.RLock()\n\tdefer db.mu.RUnlock()\n\tuser, err := db.validateUserIdentity(r.User.Username, r.User.Email)\n\tif err != nil {\n\t\treturn errors.ErrGetUsers.WithArgs(err)\n\t}\n\tr.Response.Payload = user\n\treturn nil\n}", "title": "" }, { "docid": "236b158b0418d01450ca51381032a766", "score": "0.76258665", "text": "func getUser() (*user, error) {\n\treturn &user{65499, \"john\"}, nil\n}", "title": "" }, { "docid": "cd2f837e0e44dffa89ef6ba9aa919d8f", "score": "0.7621027", "text": "func (a Access) GetUser(userID int) (*User, ErrorResponse) {\n\tvar userRes UserRes\n\tresp, errRes := NewRequest(a, fmt.Sprintf(\"users/%d.json\", userID), \"GET\", nil, 200)\n\tif errRes.IsError {\n\t\tlog.Printf(\"Error in fetching the user details \\n%s\", errRes.Message)\n\t\treturn &userRes.User, errRes\n\t}\n\terr := json.Unmarshal(resp, &userRes)\n\tif err != nil {\n\t\tlog.Printf(\"Error in unmarshalling the response on the user \\n%v\", err)\n\t\treturn &userRes.User, ErrorResponse{IsError: true, Message: err.Error(), Code: 400}\n\t}\n\treturn &userRes.User, ErrorResponse{IsError: false}\n}", "title": "" }, { "docid": "e39035d585f4c0f130968e13cbd26b9c", "score": "0.76059633", "text": "func (c *Users) GetUser(id uint) revel.Result {\n\ttid, _, err := services.ValidateToken(c.Request.Header.Get(\"Authorization\"))\n\tif err != nil {\n\t\treturn c.RenderJSON(map[string]string{\"status\": \"Invalid Auth Credentials\"})\n\t}\n\n\tif id == tid {\n\t\tuser, err := services.QueryUser(id)\n\t\tif err != nil {\n\t\t\tc.Response.Status = http.StatusBadRequest\n\t\t\treturn c.RenderJSON(map[string]string{\"status\": \"Invalid Request\"})\n\t\t}\n\t\treturn c.RenderJSON(user)\n\t}\n\n\tisAllowed, err := services.ValidateUser(c.Request.Header.Get(\"Authorization\"), \"root\")\n\tif !isAllowed {\n\t\treturn c.RenderJSON(map[string]string{\"status\": \"Not Authorised\"})\n\t}\n\n\tuser, err := services.QueryUser(id)\n\tif err != nil {\n\t\tc.Response.Status = http.StatusBadRequest\n\t\treturn c.RenderJSON(map[string]string{\"status\": \"Invalid Request\"})\n\t}\n\treturn c.RenderJSON(user)\n}", "title": "" }, { "docid": "ae4397d7117a2664e67e35d94bc3262d", "score": "0.75916207", "text": "func GetUser(id string) (user *User, err error) {\n\tresp, err := Call(id, RequestMetadata)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar value User\n\terr = json.Unmarshal(resp.Data, &value)\n\tuser = &value\n\treturn\n}", "title": "" }, { "docid": "773c5ab5ac7c429cf284701ea9a049d3", "score": "0.7589816", "text": "func GetUser(ctx echo.Context) (*aaa.User, bool) {\n\trd, ok := ctx.Get(userData).(*aaa.User)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\n\treturn rd, true\n}", "title": "" }, { "docid": "5cecc7cbab6b11d71c25e94a0ae3775f", "score": "0.75877315", "text": "func GetUser(options OptionsDef, userID string) (*terraUser.User, error) {\n\tclient := http.Client{}\n\tnsReq, authReqErr := http.NewRequest(\"GET\", fmt.Sprintf(\"%s/auth/user/%s\", options.URL, userID), nil)\n\tnsReq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", options.Token))\n\tnsReq.Header.Add(\"Content-Type\", \"application/json\")\n\tif authReqErr != nil {\n\t\treturn nil, authReqErr\n\n\t}\n\tnsResp, nsRespErr := client.Do(nsReq)\n\tif nsRespErr != nil {\n\t\treturn nil, authReqErr\n\n\t}\n\tdefer nsResp.Body.Close()\n\tif nsResp.StatusCode != 200 {\n\t\tvar data map[string]interface{}\n\t\tjson.NewDecoder(nsResp.Body).Decode(&data)\n\t\treturn nil, fmt.Errorf(\"Failed to get namespace: %s\", data[\"message\"].(string))\n\t}\n\n\tvar nsResult map[string]terraUser.User\n\tjson.NewDecoder(nsResp.Body).Decode(&nsResult)\n\tnsData := nsResult[\"user\"]\n\treturn &nsData, nil\n}", "title": "" }, { "docid": "bef6dc8649b6c75b24a21ee54d9f8cf6", "score": "0.75844026", "text": "func GetUser(id int64, o orm.Ormer) (ret *User, err error) {\n\tvar ok bool\n\n\tif ret, ok = moduleCache[CTL_M_USER].get(id).(*User); ok {\n\t\treturn ret, nil\n\t}\n\n\tret = &User{}\n\terr = o.Raw(\"select a.id, a.muid, a.uuid, a.name, a.cname, a.email, a.phone, a.qq, a.disabled, a.extra, a.avatarurl, b.name as mname from user a left join user b on a.muid = b.id where a.id = ?\", id).QueryRow(ret)\n\tif err == nil {\n\t\tmoduleCache[CTL_M_USER].set(id, ret)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e6541213d6d3afab3f6b8319d8585ec9", "score": "0.7581905", "text": "func (sc *SC) GetUser(id int, fields ...string) (*User, error) {\n\tvar (\n\t\tresp userResp\n\t\tuser *User\n\t\treq = prepUserRequest(sc, id, -1, fields...)\n\t\tscResp, err = req.Do()\n\t)\n\n\tfmt.Println(\"get user\", id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(scResp.RespBody, &resp)\n\tif err != nil {\n\t\treturn &resp.Response, err\n\t}\n\n\tuser = &resp.Response\n\n\terr = user.readAttr()\n\n\treturn user, err\n}", "title": "" }, { "docid": "2d795142885da2e4b126f075d51c158d", "score": "0.7580918", "text": "func (ct *Controller) GetUser(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tfmt.Println(id)\n\n\tusers := &models.User{}\n\n\tresult := ct.db.Where(\"id = ?\", id).First(&users)\n\t// result := ct.db.Where(\"first_name = ?\", \"Jhonny\").First(users)\n\tif result.Error != nil {\n\t\tc.AbortWithStatus(404)\n\t\tfmt.Println(result.Error.Error())\n\t} else {\n\t\tc.JSON(200, &users)\n\t}\n}", "title": "" }, { "docid": "f71838451ead4d66f9243bbaacd038c0", "score": "0.75754815", "text": "func (r *UserRest) GetUser(w http.ResponseWriter, req *http.Request) {\n\tid := mux.Vars(req)[\"id\"]\n\tif id == \"\" {\n\t\tWriteErr(w, errors.New(\"please provide User id\"), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\trow := r.db.QueryRow(\"SELECT * FROM users WHERE id = ?\", id)\n\tvar uid int\n\tvar firstName string\n\tvar secondName string\n\tvar birthDate time.Time\n\terr := row.Scan(&uid, &firstName, &secondName, &birthDate)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tWriteErr(w, errors.New(\"can't find user with id: \"+id), http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tWriteErr(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tuser := User{ID: uid, FirstName: firstName, SecondName: secondName, BirthDate: birthDate}\n\n\tWriteJSON(w, user)\n}", "title": "" }, { "docid": "35404ccd5bfa42d42365bbb6b9c39ea8", "score": "0.75663877", "text": "func (r *usersResource) getUser(request *restful.Request, response *restful.Response, user schema.User) (error, interface{}) {\n\temail := request.PathParameter(\"email\")\n\n\tif email == \"\" {\n\t\treturn app.ErrInvalid, nil\n\t}\n\n\tuser, err := r.users.GetUserByEmail(email)\n\tif err != nil {\n\t\treturn err, nil\n\t}\n\n\treturn nil, &user\n}", "title": "" }, { "docid": "8a11b81c4b89855b742d8b50e9b9e61f", "score": "0.7566115", "text": "func GetUser(c echo.Context) error {\n\tid, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, map[string]interface{}{\n\t\t\t\"message\": \"invalid id\",\n\t\t})\n\t}\n\n\tvar count int64\n\tDB.Model(&User{}).Where(\"id = ?\", id).Count(&count)\n\n\tif count == 0 {\n\t\treturn c.JSON(http.StatusNotFound, map[string]interface{}{\n\t\t\t\"message\": \"id not found\",\n\t\t})\n\t} else {\n\t\tvar user User\n\t\tif tx := DB.Find(&user, \"id=?\", id); tx.Error != nil {\n\t\t\treturn c.JSON(http.StatusInternalServerError, map[string]interface{}{\n\t\t\t\t\"message\": \"cannot fetch data\",\n\t\t\t})\n\t\t}\n\t\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\t\"message\": \"success\",\n\t\t\t\"data\": &user,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "91eab426b22aa3c2c1005ecc5323ebfc", "score": "0.7563931", "text": "func (v *Validator) GetUser(ctx context.Context) (auth.User, error) {\n\treturn v.Credentials.GetUser(ctx)\n}", "title": "" }, { "docid": "3a0d3e0559cbee761f5cda2f18356986", "score": "0.7561081", "text": "func GetUser(userID int64) (*domain.User, *errors.RestError) {\n\tuser := domain.User{ID: userID}\n\terr := user.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user, nil\n}", "title": "" }, { "docid": "7789c5633e33a3d4a6310f910584b227", "score": "0.7560265", "text": "func (repository *UserRepo) GetUser(c *gin.Context) {\n\tid, _ := c.Params.Get(\"id\")\n\tvar user entity.User\n\terr := entity.GetUser(repository.Db, &user, id)\n\tif err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tc.AbortWithStatus(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\t//c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err})\n\t\tc.JSON(http.StatusOK, gin.H{\"message\": \"User not found\"})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, user)\n\n}", "title": "" }, { "docid": "8d02f45dd1086ababb4e12f7430953e2", "score": "0.7558836", "text": "func GetUser(w http.ResponseWriter, r *http.Request) (*User, error) {\n\tif !isConnected(w, r) {\n\t\treturn nil, ErrUserNotConnected\n\t}\n\n\t// Not need to get err since isConnected() already tested it\n\tc, _ := r.Cookie(\"session-id\")\n\tid, _ := config.Session.Get(c.Value)\n\tu, err := getUserByID(id.(int))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn u, nil\n}", "title": "" }, { "docid": "81b5af283c6ea6a08981ac228f3e7eca", "score": "0.7552695", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t// get the userid from he equest params, key is \"id\"\n\tparams := mux.Vars(r)\n\n\t// convert the id type from string to int\n\tid, err := strconv.Atoi(params[\"id\"])\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to convert the string to int. %v\", err)\n\t}\n\n\t// call the getUser function with user id to retrieve a single user\n\tuser, err := getUser(int64(id))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get ser. %v\", err)\n\t}\n\n\t// send he esponse\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "c015a316665ee04abeb2fba0fc3bedd5", "score": "0.754982", "text": "func (p *Parser) GetUser(user string) (*model.User, int, error) {\n\tdoc, code, err := p.getDoc(utils.BuildURL(malURL, \"profile\", user), \"#content\")\n\tif err != nil {\n\t\treturn nil, code, err\n\t}\n\treturn p.user.GetDetails(doc), http.StatusOK, nil\n}", "title": "" }, { "docid": "74d07974c15c1a7939cd202b793c740e", "score": "0.7541148", "text": "func (p userService) GetUser(id string) (*entities.User, error) {\n\tuser := &entities.User{}\n\tif err := p.db.First(user, &entities.User{Model: entities.Model{ID: id}}).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\treturn nil, errors.New(\"user not found\")\n\t\t}\n\t\treturn nil, errors.New(\"unknown error\")\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "15fcdb308bdf383791685fd0cdab612d", "score": "0.75332814", "text": "func (store *Store) GetUser(uid string) (store.User, error) {\n\treturn store.User{\n\t\tUID: uid,\n\t\tEmail: uid + \"@anu.edu.au\",\n\t\tFirstName: \"Jonathan\",\n\t\tLastName: \"Smith\",\n\t\tPasswordHash: \"dummy-password-hash\",\n\t}, nil\n}", "title": "" }, { "docid": "68e7f1ef3f3143b3645cd5b9eb5390f1", "score": "0.7530095", "text": "func (s *Session) GetUser(r *http.Request) (*models.User, error) {\n\tsession, _ := s.session.Get(r, \"s\")\n\tval := session.Values[\"user\"]\n\tvar u *models.User\n\n\tif val == nil {\n\t\treturn nil, errors.New(\"User not found\")\n\t}\n\n\tjson.Unmarshal([]byte(val.(string)), &u)\n\treturn u, nil\n}", "title": "" }, { "docid": "b5b2b51ab15c726e007d5f553ca59497", "score": "0.7528173", "text": "func (c Client) GetUser(ctx context.Context, name string) (*User, int64, error) {\n\tkey := KeyUsers + name\n\n\tresp, err := c.Get(ctx, key)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tif resp.Count == 0 {\n\t\treturn nil, 0, ErrNotFound\n\t}\n\n\tu := new(User)\n\terr = json.Unmarshal(resp.Kvs[0].Value, u)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treturn u, resp.Kvs[0].ModRevision, nil\n}", "title": "" }, { "docid": "58f56318711f3ce004e7837c02224c24", "score": "0.75263214", "text": "func (u *UserSvc) GetUser(ctx context.Context, in *pb.UserRequest) (*pb.UserMessage, error) {\n\tcateg := in.GetCateg()\n\tuser := new(models.User)\n\tvar err error\n\t// If the expected value is a number instead of a string\n\t// Switch by search category\n\tswitch categ {\n\tcase \"id\":\n\t\tuser, err = u.Db.GetUserByID(in.GetValue())\n\t\tbreak\n\tcase \"email\":\n\t\tuser, err = u.Db.GetUserByEmail(in.GetValue())\n\t\tbreak\n\tcase \"login\":\n\t\tuser, err = u.Db.GetUserByLogin(in.GetValue())\n\t\tbreak\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Error: unknown search category\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := new(pb.UserMessage)\n\t// Encodes the user as an array of bytes, so it can be read by the client\n\tenc, err := json.Marshal(user)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres.User = enc\n\treturn res, nil\n}", "title": "" }, { "docid": "a288bb9901243c0b5ffd7e7d03068278", "score": "0.75238186", "text": "func (user *User) Get() *errors.RestErr {\n\tstmt, err := users_db.UsersDB.Prepare((queryGetUser))\n\tif err != nil {\n\t\tlogger.Error(\"error trying to prepare get user statement\", err)\n\t\treturn errors.NewInternalServerError(\"database error\")\n\t}\n\tdefer stmt.Close()\n\n\tresult := stmt.QueryRow(user.Id)\n\n\tif getErr := result.Scan(&user.Id, &user.FirstName, &user.LastName, &user.Email, &user.DateCreated, &user.Status); getErr != nil {\n\t\tlogger.Error(\"error trying to get user by id\", getErr)\n\t\treturn errors.NewInternalServerError(\"database error\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1fc31fa23c49ce3e25473afb6261874f", "score": "0.7513521", "text": "func (h *Handlers) getUser(c *gin.Context) {\n\tvar user Usuario\n\terr := c.BindJSON(&user)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tuserRetrieved, err := h.Repo.GetUser(user.Id)\n\tif err != nil {\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": userRetrieved,\n\t})\n}", "title": "" }, { "docid": "38a384779ff6de49b2b2e39dae9b6acf", "score": "0.7510005", "text": "func (s *DatabaseAccessServer) GetUser(ctx context.Context, in *pb.UserID) (*pb.User, error) {\n\tu, err := s.UserRepository.FindByID(in.UserID)\n\tif err != nil {\n\t\treturn &pb.User{}, err\n\t}\n\n\treturn &pb.User{\n\t\tID: u.ID,\n\t\tUsername: u.Username,\n\t\tPassword: u.Password,\n\t}, nil\n}", "title": "" }, { "docid": "ae3cd067c8505fd074da6bf16e7003ac", "score": "0.75089437", "text": "func GetUser(c *gin.Context) {\n\tuser, err := store.GetUser(c.Param(\"id\"))\n\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"Cannot find user. %s\", err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "ec3fb502630ef9959167d062fd50565d", "score": "0.75079656", "text": "func (t *T) GetUser(ID int) model.User {\n\tExpect(t.ReqCtx).ToNot(BeNil(), callers())\n\tusr, e := user.BLUser{}.Get(t.ReqCtx, ID)\n\tExpect(e).To(BeNil(), callers())\n\treturn usr\n}", "title": "" }, { "docid": "a5ca5433ce4183657824ff5876358b55", "score": "0.7504178", "text": "func GetUser(id int64) (*model.User, error) {\n\tuser := &model.User{\n\t\tID: id,\n\t}\n\terr := model.DB.Select(user)\n\treturn user, err\n}", "title": "" }, { "docid": "7f73e450cdf1d5ee4160517b795ba33e", "score": "0.7492231", "text": "func (t *Tyk) GetUser(userID string) (*User, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "35185dfa63a54bd7e757f270c708dd8a", "score": "0.7483116", "text": "func UserGet(conn *gorm.DB, id string) (*User, error) {\n\tuser := &User{ID: id}\n\terr := conn.First(user).Error\n\treturn user, err\n}", "title": "" }, { "docid": "39540bd71c4d198f9f6c2ae31cf43564", "score": "0.7480073", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tdb, err := models.GetDB()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvars := mux.Vars(r)\n\t// TODO: Fix types of id and discriminator\n\tdiscordID := vars[\"discordid\"]\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfilter := filters.GetUserByDiscordID(discordID)\n\n\tuser, err := db.ReadUser(filter)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := json.NewEncoder(w).Encode(user); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f1cd34987f9230efd6f965f2a3948bd4", "score": "0.7476498", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tvar user model.User\n\tmodel.DB().Where(\"id = ?\", vars[\"id\"]).First(&user)\n\tif user.ID != uuid.Nil {\n\t\tjson.NewEncoder(w).Encode(singleUserResponse{\n\t\t\tID: user.ID.String(),\n\t\t\tFirstName: user.FirstName,\n\t\t\tLastName: user.LastName,\n\t\t\tUsername: user.Username,\n\t\t\tEmail: user.Email,\n\t\t\tPictureID: user.PictureID,\n\t\t\tIsCPU: user.IsCPU,\n\t\t\tCreatedAt: user.CreatedAt.Unix(),\n\t\t\tUpdatedAt: user.CreatedAt.Unix(),\n\t\t})\n\t} else {\n\t\trbody.JSONError(w, http.StatusNotFound, language.MustGetRest(\"error.userNotFound\", r))\n\t}\n}", "title": "" }, { "docid": "c9218fe7436406767c42f1d77e3c416d", "score": "0.7474831", "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": "88e066560c97fa60d7702a29f44d2da4", "score": "0.74744433", "text": "func (pm *Manager) GetUser(id string) (*User, error) {\n\tif id == \"\" {\n\t\treturn nil, errors.New(\"id cannot be empty\")\n\t}\n\n\texists, err := pm.db.CheckUser(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif exists {\n\t\treturn &User{\n\t\t\tID: id,\n\t\t\tpm: pm,\n\t\t}, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "cf0268466bd2aa896167a7d9f7a458a6", "score": "0.7473947", "text": "func (user *User) Get() *errors.RestErr {\n\tstmt, err := users_db.Client.Prepare(queryGetUser)\n\tif err != nil {\n\t\tlogger.Error(\"Error when preparing get user statement\", err)\n\t\treturn errors.NewInternalServerError(\"database error\")\n\t}\n\tdefer stmt.Close()\n\n\tresult := stmt.QueryRow(user.ID)\n\tif getErr := result.Scan(&user.ID, &user.FirstName, &user.LastName, &user.Email, &user.DateCreated, &user.Status); getErr != nil {\n\t\tlogger.Error(\"Error when trying to get user by ID\", getErr)\n\t\treturn errors.NewInternalServerError(\"database error\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e471ceef3b27dc664e762e15c17ea0e1", "score": "0.74738765", "text": "func (d *Accessor) GetUser(id string, attrs []string) (user.User, error) {\n\tlog.Debugf(\"DB: Getting identity %s\", id)\n\n\terr := d.checkDB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar userRec cadbuser.Record\n\terr = d.db.Get(\"GetUser\", &userRec, d.db.Rebind(getUser), id)\n\tif err != nil {\n\t\treturn nil, cadbutil.GetError(err, \"User\")\n\t}\n\n\treturn cadbuser.New(&userRec, d.db), nil\n}", "title": "" }, { "docid": "fbf8884b384daa75c5551c05c7c7fcf6", "score": "0.7471297", "text": "func (g *getter) GetUser(id string) (*sidebar.User, error) {\n\treturn g.DB.GetUser(id)\n}", "title": "" }, { "docid": "370c110dd34e2fbf51d225f0fa7d6a1d", "score": "0.74706805", "text": "func UserGet(c *gin.Context) {\n id := c.Param(\"id\")\n Id, err := strconv.Atoi(id)\n if err != nil {\n c.JSON(http.StatusUnprocessableEntity, common.NewError(\"user get\", errors.New(\"DB: Invalid Id\")))\n return\n }\n\n user, err := FindOneUser(&UserModel{ID: Id}) // models.go function\n\n if err != nil {\n c.JSON(http.StatusUnprocessableEntity, common.NewError(\"user get\", errors.New(\"DB: Invalid Id\")))\n return\n }\n\n UpdateContextUserModel(c, user.ID)\n serializer := UnthSerializer{c} // serializer struct for working with a different user's data.\n c.JSON(http.StatusOK, gin.H{\"user\": serializer.Response()})\n}", "title": "" }, { "docid": "6151d0a7e7bd8d404dc7ffc7248ab5a5", "score": "0.746927", "text": "func (sa *Authenticator) GetUser(r *requests.Request) error {\n\tsa.mux.Lock()\n\tdefer sa.mux.Unlock()\n\treturn sa.db.GetUser(r)\n}", "title": "" }, { "docid": "7816e65f08b2a57f2689ee01e76478a8", "score": "0.74568015", "text": "func (user *User) Get() *errors.RestErr {\n\tstmt, err := userdatabase.Client.Prepare(queryGetUser)\n\tif err != nil {\n\t\tlogger.Error(\"Error getting user\", err)\n\t\treturn errors.NewInternalServerError(\"Database Error\")\n\t}\n\tdefer stmt.Close()\n\n\tresult := stmt.QueryRow(user.ID)\n\tif getErr := result.Scan(&user.ID, &user.FirstName, &user.LastName, &user.Email, &user.DateCreated); getErr != nil {\n\t\treturn mysqlutils.ParseError(getErr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "facb95d41210f6da0fcd84ed7051a5d6", "score": "0.7455847", "text": "func (h *AuthHandler) GetUser(email string) (User, string) {\n\tterm.Write(\"Login user email\"+email, term.Debug)\n\tterm.Write(Config.UserName, term.Debug)\n\temail = strings.ToLower(email)\n\tbytes, err := client.Go(\"ignore\", \"com.duosoftware.auth\", \"users\").GetOne().ByUniqueKey(email).Ok()\n\tvar user User\n\tif err == \"\" {\n\t\tif bytes != nil {\n\t\t\tvar uList User\n\t\t\terr := json.Unmarshal(bytes, &uList)\n\t\t\tif err == nil {\n\t\t\t\t//uList.Password = \"-------------\"\n\t\t\t\t//uList.ConfirmPassword = \"-------------\"\n\t\t\t\treturn uList, \"\"\n\t\t\t} else {\n\t\t\t\tif err != nil {\n\t\t\t\t\tterm.Write(\"Login user Error \"+err.Error(), term.Error)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tterm.Write(\"Login user Error \"+err, term.Error)\n\t}\n\n\treturn user, \"Error Validating user\"\n}", "title": "" }, { "docid": "4a5392f130a7f8f0a14e23b1f0cbbfcf", "score": "0.74530476", "text": "func GetUser(mobile string, db *gorm.DB) (*User, error) {\n\tvar user User\n\t// Get user model and preload Cards and order the model relation Cards.is_main\n\t// This trick is really super important: it will allow us to get a user's main card\n\t// with ease, without having to do a second fetch and then filter the main card\n\tresult := db.Model(&User{}).First(&user, \"mobile = ?\", mobile)\n\tuser.db = db\n\treturn &user, result.Error\n}", "title": "" }, { "docid": "f9403d4d7a2b2ab5b9f6c8ebbe191200", "score": "0.7452253", "text": "func GetUser(c *gin.Context) {\n\tID, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\tcheckErr(err, 400, c)\n\t\treturn\n\t}\n\tselectedUser, _ := selectUserID(ID, c)\n\tc.JSON(200, selectedUser)\n}", "title": "" }, { "docid": "96f580e5f3c9471ccaba17b3932854d2", "score": "0.74489844", "text": "func (c Authentication) getUser(username string) (user *models.User) {\n\tuser = &models.User{}\n\t_, err := c.Session.GetInto(\"fulluser\", user, false)\n\n\tif user.Name == username {\n\t\treturn user\n\t}\n\n\t*user, err = services.GetSingleUserByName(username)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to find user\", \"user\", username, \"error\", err)\n\t\treturn nil\n\t}\n\tc.Session[\"fulluser\"] = user\n\treturn\n}", "title": "" }, { "docid": "aaf1775779b6c75b951b4b11e3491f28", "score": "0.74443793", "text": "func GetUser(pgRepo users.Repository) fiber.Handler {\n\treturn func(c *fiber.Ctx) error {\n\t\tid, _ := strconv.Atoi(c.Params(\"id\"))\n\n\t\tuser, err := pgRepo.Get(id)\n\t\tif err != nil {\n\t\t\treturn c.Status(http.StatusBadRequest).JSON(fiber.Map{\n\t\t\t\t\"error\": fiber.Map{\n\t\t\t\t\t\"message\": \"An error occured while retrieiving data\",\n\t\t\t\t\t\"details\": err,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tif user.ID == 0 {\n\t\t\treturn c.Status(http.StatusNotFound).JSON(fiber.Map{\n\t\t\t\t\"error\": fiber.Map{\n\t\t\t\t\t\"message\": \"User is invalid\",\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\treturn c.Status(http.StatusOK).JSON(&user)\n\t}\n}", "title": "" }, { "docid": "e4bfea7381b60d55241041d3c89046ef", "score": "0.7441602", "text": "func (db *Database) GetUser(userID string) (model.User, error) {\n\tu := model.User{}\n\terr := db.db.Get(&u, \"SELECT * FROM user WHERE user_id=$1\", userID)\n\treturn u, err\n}", "title": "" }, { "docid": "7e1b04ca6c71e1333703047128569aa4", "score": "0.7438385", "text": "func GetUser(c echo.Context) error {\n\tuserID := c.Param(\"userID\")\n\tme := c.Get(\"me\").(*model.User)\n\n\tuser, err := model.GetUserByID(userID, false)\n\tif err != nil {\n\t\tif err == model.ErrUserNotFound {\n\t\t\treturn echo.NewHTTPError(http.StatusNotFound)\n\t\t}\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t}\n\n\tjson := newUserJSON(me, user)\n\n\treturn c.JSON(http.StatusOK, json)\n}", "title": "" }, { "docid": "335fa835dd4e3389f0640fdd66a8c92f", "score": "0.7434462", "text": "func (s Service) GetUser(userID int) (*model.User, error) {\n\tuser, err := s.userRepository.GetByID(userID)\n\tif err != nil {\n\t\treturn nil, httperrors.InternalServerError.WithCause(err)\n\t}\n\n\tif user == nil {\n\t\treturn nil, httperrors.EntityNotFoundError(\"user\")\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "4b741dd36a817eb8ed02409a825bc942", "score": "0.74343723", "text": "func (u *UserDB) GetUser(email, mobile *string) (*models.User, error) {\n\tuser := &models.User{}\n\tmyData, err := u.DB.FindRecord(\"users\", primitive.M{\"mobile\": mobile, \"email\": email})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := mapstructure.Decode(myData, &user); err != nil {\n\t\treturn nil, err\n\t}\n\t//_id := myData.(map[string]interface{})[\"_id\"].(primitive.ObjectID).Hex()\n\t//user.ID = _id\n\treturn user, nil\n}", "title": "" }, { "docid": "9e478b2ea22967fbb049d0568be10e21", "score": "0.74338895", "text": "func GetUser(c *gin.Context) {\n\tvar err error\n\tvar output *user.Basic\n\tusrEmail := c.Param(\"userEmail\")\n\tctx, _ := authcontext.NewAuthContext(c)\n\n\tif output, err = user.GetByEmail(ctx, usrEmail); err == nil {\n\t\tc.JSON(http.StatusOK, output)\n\t}\n\tif err != nil {\n\t\tc.JSON(http.StatusPreconditionFailed, ResponseObject{\"error\": err.Error()})\n\t}\n}", "title": "" }, { "docid": "02a268fb6fe049cbace8fdceed8c7c97", "score": "0.7427653", "text": "func (db *sqlstore) GetUser(ID int64) (*models.User, error) {\n\tu := &models.User{}\n\tquery := db.Rebind(\"SELECT * FROM users WHERE id = ? LIMIT 1\")\n\terr := db.Get(u, query, ID)\n\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, ErrNoResults\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn u, err\n}", "title": "" }, { "docid": "3187302d4a505a76873d534c6504a3af", "score": "0.742474", "text": "func (m *userStorage) GetUser(\n\tgtx context.Context, userID string) (user *teak.User, err error) {\n\tuser = &teak.User{}\n\tquery := `SELECT * FROM teak_user WHERE id = $1`\n\t// defDB.Select(user, query, userID)\n\terr = defDB.GetContext(gtx, user, query, userID)\n\treturn user, teak.LogError(\"t.user.pg\", err)\n}", "title": "" }, { "docid": "3fcc93ef59d2586a0f4f765ff9b373fe", "score": "0.74225605", "text": "func UserGet(w http.ResponseWriter, r *http.Request) *AppError {\n\tlogin := mux.Vars(r)[\"id\"]\n\tuser, err := github.FindUserByLogin(login)\n\tif err != nil {\n\t\treturn appErrorf(err, \"No such user: %v\", login)\n\t}\n\twriteJSON(w, user)\n\treturn nil\n}", "title": "" }, { "docid": "ebff72edd97c9ad7fc5d095922a42170", "score": "0.7416574", "text": "func (loginModel UsernameLoginModel) GetUser(_id string) (*entites.User, error) {\n\tuser, err := loginModel.services.userRepo.GetUserByName(loginModel.username)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}", "title": "" } ]
18250d5a6c1c02680ad6ddd70ffccc7c
TestGetPadWidths is a function.
[ { "docid": "9026f1050d0d95a989cfe17d9ae0a5c8", "score": "0.79525036", "text": "func TestGetPadWidths(t *testing.T) {\n\ttype scenario struct {\n\t\tstringArrays [][]string\n\t\texpected []int\n\t}\n\n\tscenarios := []scenario{\n\t\t{\n\t\t\t[][]string{{\"\"}, {\"\"}},\n\t\t\t[]int{},\n\t\t},\n\t\t{\n\t\t\t[][]string{{\"a\"}, {\"\"}},\n\t\t\t[]int{},\n\t\t},\n\t\t{\n\t\t\t[][]string{{\"aa\", \"b\", \"ccc\"}, {\"c\", \"d\", \"e\"}},\n\t\t\t[]int{2, 1},\n\t\t},\n\t}\n\n\tfor _, s := range scenarios {\n\t\tassert.EqualValues(t, s.expected, getPadWidths(s.stringArrays))\n\t}\n}", "title": "" } ]
[ { "docid": "b9f4dcbfdcc6f2d2224079a5d45e20d0", "score": "0.60781753", "text": "func TestGetPaddedDisplayStrings(t *testing.T) {\n\ttype scenario struct {\n\t\tstringArrays [][]string\n\t\tpadWidths []int\n\t\texpected []string\n\t}\n\n\tscenarios := []scenario{\n\t\t{\n\t\t\t[][]string{{\"a\", \"b\"}, {\"c\", \"d\"}},\n\t\t\t[]int{1},\n\t\t\t[]string{\"a b\", \"c d\"},\n\t\t},\n\t}\n\n\tfor _, s := range scenarios {\n\t\tassert.EqualValues(t, s.expected, getPaddedDisplayStrings(s.stringArrays, s.padWidths))\n\t}\n}", "title": "" }, { "docid": "c5501f332a664650318cf8e9a2c8f21f", "score": "0.5692043", "text": "func TestPad(t *testing.T) {\n\tplan := []string{\n\t\t\"ab\",\n\t\t\"cd\",\n\t}\n\tf := New(plan, 100, 100, \"pad 10 10 10 10\").(*form)\n\td := f.sects[\"d\"]\n\tif !(d.x == 70 && d.y == 30 && d.w == 40 && d.h == 40) {\n\t\tt.Errorf(\"Invalid layout %f %f %f %f\", d.x, d.y, d.w, d.h)\n\t}\n}", "title": "" }, { "docid": "057095810c5102a5d42e85841121e9a2", "score": "0.5476429", "text": "func getTextWidth(text string, margin int) int {\n\tconst emWidth = 11\n\tconst medWidth = 9\n\tconst narrowWidth = 4\n\tlength := len(text)\n\tnarrow := length - len(narrowChars.ReplaceAllLiteralString(text, \"\"))\n\tmed := length - len(medChars.ReplaceAllLiteralString(text, \"\"))\n\twide := length - narrow - med\n\treturn wide*emWidth + narrow*narrowWidth + med*medWidth + margin\n}", "title": "" }, { "docid": "b2a317fd177090b3aab309c2c53bd4e9", "score": "0.5467006", "text": "func (p *Panel) Paddings() RectBounds {\n\n\treturn p.paddingSizes\n}", "title": "" }, { "docid": "420497c7cfc0123ad6e249273daa4630", "score": "0.5368209", "text": "func (f Font) Widths() []float64 {\n\tx := f.V.Key(\"Widths\")\n\tvar out []float64\n\tfor i := 0; i < x.Len(); i++ {\n\t\tout = append(out, x.Index(i).Float64())\n\t}\n\treturn out\n}", "title": "" }, { "docid": "9c4f45f8e345d2a477fed9357153a7ac", "score": "0.53175515", "text": "func getWidthsFromLines(config *Config, lines []string) []int {\n\tvar widths []int\n\n\tfor _, line := range lines {\n\t\telems := getElementsFromLine(config, line)\n\t\tfor i := 0; i < len(elems); i++ {\n\t\t\t// remove color code for counting the length\n\t\t\tl := runeLenWithoutANSII(elems[i].(string))\n\t\t\tif len(widths) <= i {\n\t\t\t\twidths = append(widths, l)\n\t\t\t} else if widths[i] < l {\n\t\t\t\twidths[i] = l\n\t\t\t}\n\t\t}\n\t}\n\treturn widths\n}", "title": "" }, { "docid": "812e360ed24bca3c7ab2b33d2e63830b", "score": "0.5303113", "text": "func (f *FmtPrintWriter) Width() (wid int, ok bool) {\n\treturn f.fs.Width()\n}", "title": "" }, { "docid": "44637155ac8479fc5a0636dea5553faa", "score": "0.5298746", "text": "func (d *DumpWriter) Width() (wid int, ok bool) {\n\treturn 0, true\n}", "title": "" }, { "docid": "ac8ef1bd164c02610c70868ae8561d64", "score": "0.52889043", "text": "func tabwidth(tabs [][2]int, offset, tab int) int {\n\t//log.Printf(\"tabs: %v, offset: %d, tab: %d\", tabs, offset, tab)\n\twidth := offset\n\tfor i := 0; i < len(tabs); i++ {\n\t\twidth += tabs[i][1]\n\t\twidth += (tab - width%tab)\n\t}\n\t//log.Printf(\"res: %d\", width-offset)\n\treturn width - offset\n}", "title": "" }, { "docid": "7650392ca995481e5184df8af813dd7b", "score": "0.52161443", "text": "func (v *Entry) GetWidthChars() int {\n\tc := C.gtk_entry_get_width_chars(v.native())\n\treturn int(c)\n}", "title": "" }, { "docid": "3f4661fe607ae67af28c1425efc777f2", "score": "0.5161777", "text": "func (accessor Accessor) CharWidth() float64 {\n\tif accessor.IsWindows() {\n\t\treturn charWidthWindows\n\t}\n\treturn charWidthOther\n}", "title": "" }, { "docid": "74ca48f21c39698d1b7a5f152368ac22", "score": "0.51188517", "text": "func TestWithPadding(t *testing.T) {\n\ttype scenario struct {\n\t\tstr string\n\t\tpadding int\n\t\texpected string\n\t}\n\n\tscenarios := []scenario{\n\t\t{\n\t\t\t\"hello world !\",\n\t\t\t1,\n\t\t\t\"hello world !\",\n\t\t},\n\t\t{\n\t\t\t\"hello world !\",\n\t\t\t14,\n\t\t\t\"hello world ! \",\n\t\t},\n\t}\n\n\tfor _, s := range scenarios {\n\t\tassert.EqualValues(t, s.expected, WithPadding(s.str, s.padding))\n\t}\n}", "title": "" }, { "docid": "396e76aa8765468d33cc870fde92203c", "score": "0.51152694", "text": "func getILMColumnWidthTable() map[string]int {\n\tcolWidth := make(map[string]int)\n\n\tcolWidth[idLabel] = idColumnWidth\n\tcolWidth[prefixLabel] = prefixColumnWidth\n\tcolWidth[statusLabelKey] = statusColumnWidth\n\tcolWidth[expiryLabel] = expiryColumnWidth\n\tcolWidth[expiryDatesLabelKey] = expiryDatesColumnWidth\n\tcolWidth[transitionLabel] = transitionColumnWidth\n\tcolWidth[transitionDatesLabelKey] = transitionDateColumnWidth\n\tcolWidth[storageClassLabelKey] = storageClassColumnWidth\n\tcolWidth[tagLabel] = tagsColumnWidth\n\n\treturn colWidth\n}", "title": "" }, { "docid": "401c7d8ae5735b73544b6127902cd10a", "score": "0.50897044", "text": "func (cg *CompactGrid) calcWidths() []int {\n\tvar autoCols int\n\twidth := cg.Width\n\tcolWidths := make([]int, len(cg.cols))\n\n\tfor n, w := range cg.cols {\n\t\tcolWidths[n] = w.FixedWidth()\n\t\twidth -= w.FixedWidth()\n\t\tif w.FixedWidth() == 0 {\n\t\t\tautoCols++\n\t\t}\n\t}\n\n\tspacing := colSpacing * len(cg.cols)\n\tautoWidth := (width - spacing) / autoCols\n\tfor n, val := range colWidths {\n\t\tif val == 0 {\n\t\t\tcolWidths[n] = autoWidth\n\t\t}\n\t}\n\treturn colWidths\n}", "title": "" }, { "docid": "bc62073c42499f48a400f90f54f41956", "score": "0.5058064", "text": "func paddedLabelLength(graphWidth, longest, cellWidth int) (l, index int) {\n\treturn\n}", "title": "" }, { "docid": "0a66803f2fe64f5ac6837d020971eb95", "score": "0.5018355", "text": "func (router *Router) GetWidth(inp string) uint {\n\tout64, err := strconv.ParseUint(inp, 10, 0)\n\tout := uint(out64)\n\tif err != nil {\n\t\treturn DefaultWidth\n\t} else if out > MaxWidth {\n\t\treturn MaxWidth\n\t} else if out < MinWidth {\n\t\treturn MinWidth\n\t}\n\treturn out\n\n}", "title": "" }, { "docid": "154ec4be5777b9521518949a27bc16e8", "score": "0.5005399", "text": "func TestPad(t *testing.T) {\n\t// create a new Collection with some elements\n\tcoll := NewCollection([]int{1, 2, 3})\n\n\t// pad the collection with 2 elements\n\tpaddedColl := coll.Pad(5, 0)\n\n\t// check if the length of the padded collection is correct\n\tif len(paddedColl.value) != 5 {\n\t\tt.Errorf(\"Pad did not return the correct number of elements\")\n\t}\n\n\t// check if the padded collection contains the correct elements\n\tif paddedColl.value[0] != 1 || paddedColl.value[1] != 2 || paddedColl.value[2] != 3 || paddedColl.value[3] != 0 || paddedColl.value[4] != 0 {\n\t\tt.Errorf(\"Pad did not return the correct elements\")\n\t}\n}", "title": "" }, { "docid": "0ffcccb0e4879a690dc900f971d67fac", "score": "0.49980918", "text": "func (s *Screenboard) GetWidthOk() (string, bool) {\n\tif s == nil || s.Width == nil {\n\t\treturn \"\", false\n\t}\n\treturn *s.Width, true\n}", "title": "" }, { "docid": "ffab7dfed58476e8e748e5dc44f77768", "score": "0.49796432", "text": "func (k *Kern) Width() float64 { return k.width }", "title": "" }, { "docid": "d67102bc0da6635f3f38298f64447a76", "score": "0.49698812", "text": "func ConfigurationGetScreenWidthDp(config *Configuration) int32 {\n\tcconfig, _ := (*C.AConfiguration)(unsafe.Pointer(config)), cgoAllocsUnknown\n\t__ret := C.AConfiguration_getScreenWidthDp(cconfig)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "73299df96132ccc1b7d17451338404d0", "score": "0.4965201", "text": "func (a *AppConfig) GetWidth() int {\n\treturn a.Width\n}", "title": "" }, { "docid": "fb507a2c7f221575baee12f8738a217c", "score": "0.49532655", "text": "func GetWidth() int {\n\tw, _ := GetSize()\n\treturn w\n}", "title": "" }, { "docid": "aae3379b01c6c9349a473139faf6ccc3", "score": "0.49340907", "text": "func (b Board) Width() int {\n\tfor _, row := range b {\n\t\treturn len(row)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "3f56c54aca603e08bdfbe92058078d37", "score": "0.49280933", "text": "func defaultListingWidths() listing {\n\tself := listing{}\n\tself.blockTIMWidth = 11\n\tself.errWidth = 38\n\tself.lastUpdatedWidth = 27\n\tself.nameWidth = 25\n\tself.priceWidth = 28\n\tself.symbolWidth = 9\n\tself.volumeWidth = 18\n\treturn self\n}", "title": "" }, { "docid": "028f9a781071031233a7260cfc1d9f50", "score": "0.49186054", "text": "func getMeasurements(cols, rows int) (int, int, int, int, int, int) {\n\tvar scaler int\n\tif rows > cols {\n\t\tscaler = rows / 50\n\t} else {\n\t\tscaler = cols / 50\n\t}\n\n\tcellWidth, cellHeight := 2+scaler, 2+scaler\n\twallWidth := 1 + scaler\n\txOffset, yOffset := 5+scaler, 5+scaler\n\tmargin := 5 + scaler\n\treturn cellWidth, cellHeight, wallWidth, xOffset, yOffset, margin\n}", "title": "" }, { "docid": "39e7b5b67892ec938b6bb0d31e444442", "score": "0.49160817", "text": "func (v *Calendar) GetDetailWidthChars() int {\n\tc := C.gtk_calendar_get_detail_width_chars(v.native())\n\treturn int(c)\n}", "title": "" }, { "docid": "67d2ea7cb174967db0094a1b8d51d688", "score": "0.4901735", "text": "func (f Font) Width(code int) float64 {\n\tfirst := f.FirstChar()\n\tlast := f.LastChar()\n\tif code < first || last < code {\n\t\treturn 0\n\t}\n\treturn f.V.Key(\"Widths\").Index(code - first).Float64()\n}", "title": "" }, { "docid": "788c6ec65b08c5962626b043894cbfd6", "score": "0.48937863", "text": "func (s *state) Width() (wid int, ok bool) {\n\treturn 0, false\n}", "title": "" }, { "docid": "6cad3026a5955b77650aeab21d53bd71", "score": "0.4887068", "text": "func (o *CapabilityEquipmentPhysicalDefAllOf) GetWidthOk() (*float32, bool) {\n\tif o == nil || o.Width == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Width, true\n}", "title": "" }, { "docid": "5dfeb8c6625a5bc3a4d1cf3c19d27a8a", "score": "0.48705125", "text": "func CIDWidths(ttf font.TTFLight) Array {\n\tgids := make([]int, 0, len(ttf.UsedGIDs))\n\tfor gid := range ttf.UsedGIDs {\n\t\tgids = append(gids, int(gid))\n\t}\n\tsort.Ints(gids)\n\ta := Array{}\n\tfor _, gid := range gids {\n\t\ta = append(a, Integer(gid), Array{Integer(ttf.GlyphWidths[gid])})\n\t}\n\treturn a\n}", "title": "" }, { "docid": "9dac5cc4e684fc412197dd915fa79847", "score": "0.4867391", "text": "func (m *HorizontalSectionColumn) GetWidth()(*int32) {\n val, err := m.GetBackingStore().Get(\"width\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "e81793855a8dce3dd24558da3e660ef8", "score": "0.48437032", "text": "func Width() int { return viewWidth }", "title": "" }, { "docid": "b5dce79e04553b9a6abece97294a4bb6", "score": "0.48403347", "text": "func jsGetWidthInCells(this js.Value, args []js.Value) interface{} {\n\treturn games[this.Get(\"id\").String()].width - 2\n}", "title": "" }, { "docid": "0d9b43ca5cc84d31b5c3b24e3573820b", "score": "0.48249546", "text": "func (a AvalancheTestSuite) GetNetworkWidthBits() uint32 {\n\treturn networkWidthBits\n}", "title": "" }, { "docid": "47e3fb867f8aa3e69bd09e550b11499f", "score": "0.48238584", "text": "func paddedLen(ptlen, blockSize int) int {\n\tif ptlen <= blockSize {\n\t\treturn blockSize\n\t}\n\tsize := ptlen / blockSize * blockSize\n\tif ptlen%blockSize != 0 {\n\t\tsize += blockSize\n\t}\n\treturn size\n}", "title": "" }, { "docid": "125ef7017f8b2cd1a5fd6716c7c04820", "score": "0.48184937", "text": "func ClipPad(rect [4]int, padding int, dims [2]int) [4]int {\n rect = [4]int{\n\t rect[0]-padding,\n\t rect[1]-padding,\n\t rect[2]+padding,\n\t rect[3]+padding,\n }\n if rect[0] < 0 {\n\t rect[0] = 0\n }\n if rect[1] < 0 {\n\t rect[1] = 0\n }\n if rect[2] >= dims[0] {\n\t rect[2] = dims[0]-1\n }\n if rect[3] >= dims[1] {\n\t rect[3] = dims[1]-1\n }\n return rect\n}", "title": "" }, { "docid": "46e2c55803b12d9c9f64e82f6bd82b38", "score": "0.48149973", "text": "func (p *BoardDescription) GetWidth() int {\n\treturn (p.CellsHoriz - 1) * 4\n}", "title": "" }, { "docid": "238aca564ecc08bc97ca0eb6f87adce0", "score": "0.47996238", "text": "func (m Map) Width() int {\n\treturn m.width\n}", "title": "" }, { "docid": "da8823981242ea9d9ec19f67de300335", "score": "0.47680172", "text": "func TestGetSlideWithFormatInvalidwidth(t *testing.T) {\n request := createGetSlideWithFormatRequest()\n request.width = invalidizeTestParamValue(request.width, \"width\", \"int32\").(int32)\n e := initializeTest(\"GetSlideWithFormat\", \"width\", request.width)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := getTestApiClient().SlidesApi.GetSlideWithFormat(request)\n assertError(t, \"GetSlideWithFormat\", \"width\", int32(r.StatusCode), e)\n}", "title": "" }, { "docid": "c3630514e3bf43f0897cb7ec02d99276", "score": "0.47593978", "text": "func getWinsize() (int, int) {\n\t// ioctl winsize struct definition\n\t// https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/libc-ddefs.html\n\tws := struct {\n\t\tws_row uint16\n\t\tws_col uint16\n\t\tws_xpixel uint16\n\t\tws_ypixel uint16\n\t}{}\n\n\t_, _, e := syscall.Syscall(syscall.SYS_IOCTL, os.Stdin.Fd(),\n\t\tsyscall.TIOCGWINSZ, uintptr(unsafe.Pointer(&ws)))\n\tif e != 0 {\n\t\tlog.Fatalf(\"Syscall error: %v\\n\", e)\n\t}\n\n\treturn int(ws.ws_row), int(ws.ws_col)\n}", "title": "" }, { "docid": "1b8be96e090cc142e39053f1fe6fb219", "score": "0.47531742", "text": "func (w *Widget) GetWidthOk() (int, bool) {\n\tif w == nil || w.Width == nil {\n\t\treturn 0, false\n\t}\n\treturn *w.Width, true\n}", "title": "" }, { "docid": "c5d82512c092ad28157d4ee11817e8d6", "score": "0.47506252", "text": "func (self *RetroFont) FixedWidth() int{\n return self.Object.Get(\"fixedWidth\").Int()\n}", "title": "" }, { "docid": "2d71904d38aa32bb0ef6cad542e64428", "score": "0.47424066", "text": "func getVerticalKeyWidth(request *models.RenderRequest, breaks []*breakInfo) float64 {\n\tmissingWidth := getTextWidth(MissingDataText, 12)\n\ttitleWidth := getTextWidth(request.Choropleth.ValuePrefix+\" \"+request.Choropleth.ValueSuffix, 0)\n\tmaxWidth := math.Max(float64(missingWidth), float64(titleWidth))\n\treturn math.Max(maxWidth, getTickTextWidth(request, breaks)) + 10\n}", "title": "" }, { "docid": "28ed4a9edcb0057729151053b322387d", "score": "0.47269976", "text": "func (c *Char) Width() float64 { return c.width }", "title": "" }, { "docid": "f740cc6dee655de8810b00c92fc9db52", "score": "0.4724037", "text": "func (_m *Math) GetWidthPerCol(percent float64) float64 {\n\tret := _m.Called(percent)\n\n\tvar r0 float64\n\tif rf, ok := ret.Get(0).(func(float64) float64); ok {\n\t\tr0 = rf(percent)\n\t} else {\n\t\tr0 = ret.Get(0).(float64)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "1218c01b67567ec0da6c9ded827d9680", "score": "0.47208723", "text": "func (b Bounds) Width() int {\n\treturn b.w\n}", "title": "" }, { "docid": "5eea49db9d7c926826af8710a716d734", "score": "0.4720015", "text": "func (e *Element) GetPads() *glib.List {\n\treturn glib.WrapList(uintptr(unsafe.Pointer(e.g().pads)))\n}", "title": "" }, { "docid": "44db0822a70618a5d8fb5dc5970b104c", "score": "0.47167936", "text": "func (t *Table) Width() int {\n\treturn len(t.columns)\n}", "title": "" }, { "docid": "636deeedc7efe37b6871767b004bfaff", "score": "0.4711877", "text": "func (grid Grid) Width() int {\n\treturn len(grid)\n}", "title": "" }, { "docid": "f565d121ce7b93d2d9867ee83f9d5a56", "score": "0.4711433", "text": "func getOffset(width int) int {\n\tw, _, err := terminal.GetSize(int(os.Stdout.Fd()))\n\tif err != nil {\n\t\treturn 0\n\t}\n\toffset := int((w - width) / 2)\n\tif offset < 0 {\n\t\treturn 0\n\t}\n\treturn offset\n}", "title": "" }, { "docid": "f88943116f61fee9ea2b284cd9ef197f", "score": "0.46753636", "text": "func (fwtSch *FWTSchema) GetTotalWidth(charsBetweenFields int) int {\n\treturn fwtSch.totalWidth + ((fwtSch.dispColCount - 1) * charsBetweenFields)\n}", "title": "" }, { "docid": "aeacf1018fd61f3ad2ed98413d109bf6", "score": "0.46671364", "text": "func (o *CapabilityEquipmentSlotArray) GetWidthOk() (*float32, bool) {\n\tif o == nil || o.Width == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Width, true\n}", "title": "" }, { "docid": "65354dabf0d5a680936a6dbbce7894a6", "score": "0.466661", "text": "func (r IDRange) width() uint64 {\n\treturn r.Last - r.First\n}", "title": "" }, { "docid": "88b8713087b2de3ac7fa2aa1ff82ec5a", "score": "0.46519026", "text": "func (lst *List) Width() float64 { return lst.box.Width() }", "title": "" }, { "docid": "7763b98792ef32727bba4b63c2370a00", "score": "0.46349606", "text": "func (swk *SwitchingKey) GetDataLen(WithMetadata bool) (dataLen int) {\n\n\tif WithMetadata {\n\t\tdataLen++\n\t}\n\n\tfor j := uint64(0); j < uint64(len(swk.Value)); j++ {\n\t\tdataLen += swk.Value[j][0].GetDataLen(WithMetadata)\n\t\tdataLen += swk.Value[j][1].GetDataLen(WithMetadata)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "47448c83c8f556d2ff9ad596c6db2de1", "score": "0.4633387", "text": "func getTerminalSize(h, w int) Dimensions {\n\treturn Dimensions{Length: (h - 5) / 4, Width: (w - 10) / 2}\n}", "title": "" }, { "docid": "e30606fb0410d5734d779616c6d24a0e", "score": "0.46134263", "text": "func (acc *Accent) Width() float64 { return acc.char.width }", "title": "" }, { "docid": "003f4877e11655160e2267ebd8cb4189", "score": "0.46130288", "text": "func cellDisplayWidth(cell string, nthCol int, prevWidth int) int {\n\t// `| ` at the front and ` | ` in the middle\n\tsX := prevWidth + nthCol*3 + 2\n\twidth := 0\n\tlines := strings.Split(cell, \"\\n\")\n\tfor _, line := range lines {\n\t\tdisplayWidth := 0\n\t\tx := sX\n\t\tfor _, c := range line {\n\t\t\tincr := 0\n\t\t\tif c != '\\t' {\n\t\t\t\tincr = runeDisplayWidth(c)\n\t\t\t} else {\n\t\t\t\t// terminal with have the char TabWidth aligned\n\t\t\t\tincr = TabWidth - (x & (TabWidth - 1))\n\t\t\t}\n\t\t\tdisplayWidth += incr\n\t\t\tx += incr\n\t\t}\n\t\tif width < displayWidth {\n\t\t\twidth = displayWidth\n\t\t}\n\t}\n\treturn width\n}", "title": "" }, { "docid": "003f4877e11655160e2267ebd8cb4189", "score": "0.46130288", "text": "func cellDisplayWidth(cell string, nthCol int, prevWidth int) int {\n\t// `| ` at the front and ` | ` in the middle\n\tsX := prevWidth + nthCol*3 + 2\n\twidth := 0\n\tlines := strings.Split(cell, \"\\n\")\n\tfor _, line := range lines {\n\t\tdisplayWidth := 0\n\t\tx := sX\n\t\tfor _, c := range line {\n\t\t\tincr := 0\n\t\t\tif c != '\\t' {\n\t\t\t\tincr = runeDisplayWidth(c)\n\t\t\t} else {\n\t\t\t\t// terminal with have the char TabWidth aligned\n\t\t\t\tincr = TabWidth - (x & (TabWidth - 1))\n\t\t\t}\n\t\t\tdisplayWidth += incr\n\t\t\tx += incr\n\t\t}\n\t\tif width < displayWidth {\n\t\t\twidth = displayWidth\n\t\t}\n\t}\n\treturn width\n}", "title": "" }, { "docid": "02e46e3e47e331a4a52aa6764269fec4", "score": "0.4602431", "text": "func recordPadding(length int) int {\n\tlast := length & 0x7\n\treturn (8 - last) & 0x7\n}", "title": "" }, { "docid": "f8ec6d0e5a66e9ce077a39e69e65fa91", "score": "0.46005532", "text": "func (obj *FileChooser) GetPadding() (top, bottom, left, right uint) {\n\tfields := obj.Candy().Guify(\"gtk_alignment_get_padding\", obj, 0, 0, 0, 0).Fields()\n\ttop = fields[0].MustUint()\n\tbottom = fields[1].MustUint()\n\tleft = fields[2].MustUint()\n\tright = fields[3].MustUint()\n\treturn\n}", "title": "" }, { "docid": "c3ab8f56fdcace4c289ea9b2c0842330", "score": "0.45933735", "text": "func (mtr *Ptptptdintgrp2Metrics) getOffset(fldName string) int {\n\tvar offset int\n\n\tif fldName == \"WrInvalidCmd\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrInvalidCmd.Size()\n\n\tif fldName == \"WrPendSz\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrPendSz.Size()\n\n\tif fldName == \"WrAxiRdResp\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrAxiRdResp.Size()\n\n\tif fldName == \"PktErrEopForced\" {\n\t\treturn offset\n\t}\n\toffset += mtr.PktErrEopForced.Size()\n\n\tif fldName == \"PktNoEopErrSeen\" {\n\t\treturn offset\n\t}\n\toffset += mtr.PktNoEopErrSeen.Size()\n\n\tif fldName == \"PktCmdEopNoData\" {\n\t\treturn offset\n\t}\n\toffset += mtr.PktCmdEopNoData.Size()\n\n\tif fldName == \"RdrspAxi\" {\n\t\treturn offset\n\t}\n\toffset += mtr.RdrspAxi.Size()\n\n\tif fldName == \"WrrspAxi\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrrspAxi.Size()\n\n\tif fldName == \"SpuriousRdResp\" {\n\t\treturn offset\n\t}\n\toffset += mtr.SpuriousRdResp.Size()\n\n\tif fldName == \"SpuriousWrResp\" {\n\t\treturn offset\n\t}\n\toffset += mtr.SpuriousWrResp.Size()\n\n\tif fldName == \"WrreqInfoFirstMissing\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrreqInfoFirstMissing.Size()\n\n\tif fldName == \"WrreqNumBytesZero\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrreqNumBytesZero.Size()\n\n\tif fldName == \"WrreqNumBytesMoreThan_64\" {\n\t\treturn offset\n\t}\n\toffset += mtr.WrreqNumBytesMoreThan_64.Size()\n\n\treturn offset\n}", "title": "" }, { "docid": "ff93d69200446924dfefd9609041f252", "score": "0.4590137", "text": "func jsGetWidthInPx(this js.Value, args []js.Value) interface{} {\n\treturn (games[this.Get(\"id\").String()].width - 2) * games[this.Get(\"id\").String()].cell\n}", "title": "" }, { "docid": "32562e0373d45ce94ab0f275985da2e7", "score": "0.45896736", "text": "func _requestPathWidth(w http.ResponseWriter, r *http.Request) (_width uint64, err error) {\n\n\tvar _rawWidth = mux.Vars(r)[\"width\"]\n\n\tif __width, err := strconv.ParseUint(_rawWidth, 0, 0); err == nil {\n\t\t_width = uint64(__width)\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 400)\n\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "18480f272c887d5d730f1cf7b849ea94", "score": "0.45867908", "text": "func (self *RetroFont) CharacterWidth() int{\n return self.Object.Get(\"characterWidth\").Int()\n}", "title": "" }, { "docid": "d820b226dfb02cc9a4d1edbddbb11de1", "score": "0.45784923", "text": "func gpuSetCountPadding(gpuSet []int) int {\n\tcount := 0\n\t\n\tfor i := range gpuSet {\n\t\tif gpuSet[i] == -1 {\n\t\t\tcount++\n\t\t}\n\t}\n\t\n\treturn count\n}", "title": "" }, { "docid": "06fd5d10915e39a5750313c76c174e70", "score": "0.45723963", "text": "func (m *Grid) Width() int {\n\treturn len(m.Data[0])\n}", "title": "" }, { "docid": "a8b62df465918d1c300ccf6c14f95bb4", "score": "0.45599687", "text": "func (impl *FancyImplementation) terminalWidth() int {\n\timpl.termM.Lock()\n\tdefer impl.termM.Unlock()\n\tif impl.termCheck.IsZero() || time.Since(impl.termCheck) > time.Second {\n\t\timpl.termCheck = time.Now()\n\t\timpl.termWidth, _, _ = terminal.GetSize(int(impl.Out.Fd()))\n\t\tif impl.termWidth == 0 {\n\t\t\timpl.termWidth = 100\n\t\t}\n\t}\n\treturn impl.termWidth\n}", "title": "" }, { "docid": "db84c036c3695fd831ab95c5a745f2f8", "score": "0.45557308", "text": "func (s *math) GetWidthPerCol(qtdCols float64) float64 {\n\twidth, _ := s.pdf.GetPageSize()\n\tleft, _, right, _ := s.pdf.GetMargins()\n\treturn (width - right - left) / qtdCols\n}", "title": "" }, { "docid": "a7b2d4f58544c148d46c88ba680072e2", "score": "0.4543387", "text": "func (p *Panel) Margins() RectBounds {\n\n\treturn p.marginSizes\n}", "title": "" }, { "docid": "d210e64d9880b817be7659fba953b6f0", "score": "0.45411032", "text": "func NativeWindowGetWidth(window *NativeWindow) int32 {\n\tcwindow, _ := (*C.ANativeWindow)(unsafe.Pointer(window)), cgoAllocsUnknown\n\t__ret := C.ANativeWindow_getWidth(cwindow)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "517c80e4bed651f3de2e5d47937f26dd", "score": "0.45329484", "text": "func BorderWidth() int {\n\treturn int(borderWidth)\n}", "title": "" }, { "docid": "c6dcec2959a96c536a887bd7e64565a5", "score": "0.45259377", "text": "func (cs *cellScanner) wordWidth() int {\n\tvar b strings.Builder\n\tfor _, wc := range cs.wordCells() {\n\t\tb.WriteRune(wc.Rune)\n\t}\n\treturn runewidth.StringWidth(b.String())\n}", "title": "" }, { "docid": "e9fe427ccf2ca970393151c8bf3b67d8", "score": "0.4519492", "text": "func StringWidth(b []byte, n, tabsize int) int {\n\tif n <= 0 {\n\t\treturn 0\n\t}\n\ti := 0\n\twidth := 0\n\tfor len(b) > 0 {\n\t\tr, _, size := DecodeCharacter(b)\n\t\tb = b[size:]\n\n\t\tswitch r {\n\t\tcase '\\t':\n\t\t\tts := tabsize - (width % tabsize)\n\t\t\twidth += ts\n\t\tdefault:\n\t\t\twidth += runewidth.RuneWidth(r)\n\t\t}\n\n\t\ti++\n\n\t\tif i == n {\n\t\t\treturn width\n\t\t}\n\t}\n\treturn width\n}", "title": "" }, { "docid": "fd4a857d4cc95cb34eb46c36e6b47eae", "score": "0.4510597", "text": "func numberOfSpaces(input string, start int, end int) (count int) {\n\tfor i := start; i < end; i++ {\n\t\tif input[i] == 32 {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c900ee00e48e2b1da88a06aafb2518e", "score": "0.45001143", "text": "func runeWidth(r rune, graphemeProperty int) int {\n\tswitch graphemeProperty {\n\tcase prControl, prCR, prLF, prExtend, prZWJ:\n\t\treturn 0\n\tcase prRegionalIndicator:\n\t\treturn 2\n\tcase prExtendedPictographic:\n\t\tif property(emojiPresentation, r) == prEmojiPresentation {\n\t\t\treturn 2\n\t\t}\n\t\treturn 1\n\t}\n\n\tswitch r {\n\tcase 0x2e3a:\n\t\treturn 3\n\tcase 0x2e3b:\n\t\treturn 4\n\t}\n\n\tswitch property(eastAsianWidth, r) {\n\tcase prW, prF:\n\t\treturn 2\n\t}\n\n\treturn 1\n}", "title": "" }, { "docid": "193fcfe258c37295fa387cb7604eb466", "score": "0.4498506", "text": "func (m *MockProxyMounter) GetDeviceSize(devicePath string) (int64, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetDeviceSize\", devicePath)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d5bfde99ebb118e30072cdba05009cb4", "score": "0.44959846", "text": "func (m *MockHost) GetPodPortMappings(containerID string) ([]*hostport.PortMapping, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPodPortMappings\", containerID)\n\tret0, _ := ret[0].([]*hostport.PortMapping)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1249c3841fbd9b125f5e2e28d753ade2", "score": "0.4490365", "text": "func TestBufferPadding(t *testing.T) {\n\tbufs := newTestBuffers(t, 1<<10)\n\tfor _, buf := range bufs {\n\t\tname := fmt.Sprintf(\"Using buffer type: %s\", buf.bufType)\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tsz := rand.Int31n(100)\n\n\t\t\twriteOffset := buf.AllocateOffset(int(sz))\n\t\t\trequire.Equal(t, buf.StartOffset(), writeOffset)\n\n\t\t\tb := make([]byte, sz)\n\t\t\trand.Read(b)\n\n\t\t\tcopy(buf.Bytes(), b)\n\t\t\tdata := buf.Data(buf.StartOffset())\n\t\t\trequire.Equal(t, b, data[:sz])\n\t\t})\n\t}\n}", "title": "" }, { "docid": "243fe50a7b96016edb7abc2033b5d941", "score": "0.448513", "text": "func (d *Dictionary) figureWidth(s string) float64 {\n\tw := 0.0\n\tfor _, r := range s {\n\t\tw += d.getInfo(r).Advance\n\t}\n\treturn w\n}", "title": "" }, { "docid": "ef76f782ca42fc34647dc801312f0981", "score": "0.44841334", "text": "func (s *Screenboard) GetWidth() string {\n\tif s == nil || s.Width == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Width\n}", "title": "" }, { "docid": "b83a0c39aee1c401e4dc2293dce6bced", "score": "0.44752818", "text": "func (h Header) PchStrapLength() uint32 {\n\treturn (h.FlMap1 >> 24) & 0xff\n}", "title": "" }, { "docid": "e775fcd656d5a2d9294cf957840c13fb", "score": "0.44681197", "text": "func getResizeWidthAndHeight(rw, rh, aw, ah int) (int, int) {\n\tif rh == 0 {\n\t\th := (rw * ah) / aw\n\t\treturn rw, h\n\t} else if rw == 0 {\n\t\tw := (rh * aw) / ah\n\t\treturn w, rh\n\t} else {\n\t\th := (rw * ah) / aw\n\t\tif h <= rh {\n\t\t\treturn rw, h\n\t\t}\n\t\tw := (rh * aw) / ah\n\t\treturn w, rh\n\t}\n}", "title": "" }, { "docid": "bd68620091bb544742f6fe5d012ca667", "score": "0.44491172", "text": "func (s String) Width() int {\n\tvar iter norm.Iter\n\titer.InitString(norm.NFC, string(s))\n\n\tcount := 0\n\tfor !iter.Done() {\n\t\tcount = count + utf8.RuneCount(iter.Next())\n\t}\n\treturn count\n}", "title": "" }, { "docid": "175c76c358ec7d9fd9982c6767020649", "score": "0.44422892", "text": "func (lst *HList) Width() float64 { return lst.lst.Width() }", "title": "" }, { "docid": "2bace6bf4edea6aac440e108a7f63b24", "score": "0.4440961", "text": "func PaddingChars(pad int) string {\n\treturn defaultPadding.PaddingChars(pad)\n}", "title": "" }, { "docid": "c806c8352eba3d116027caf9616006fa", "score": "0.4437439", "text": "func (m *wasiSnapshotPreview1) wasiArgsSizesGet(p0 int32, p1 int32) int32 {\n\trv0, rv1, err := m.impl.argsSizesGet()\n\tres := int32(wasiErrnoSuccess)\n\tif err == wasiErrnoSuccess {\n\t\tm.mem().PutUint32(uint32(rv1), uint32(p1), 0)\n\t\tm.mem().PutUint32(uint32(rv0), uint32(p0), 0)\n\t} else {\n\t\tres = int32(err)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "d66fb55db8a07de96b05645782991182", "score": "0.44357717", "text": "func TestWallpaperHandler_ErrSizer(t *testing.T) {\n\tsizer := func(exec boxer.CommandExecutor) (w, h int, err error) {\n\t\treturn 0, 0, errors.New(\"no size found\")\n\t}\n\n\th := boxer.NewWallpaperHandler(nil, sizer, nil, \"\")\n\tif err := h(0, 10); err == nil || err.Error() != `desktop size: no size found` {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "f5b55d18fd62b2fba0082adf1e2c89ee", "score": "0.44200727", "text": "func (d *Dataset) Width() int {\n\treturn d.cols\n}", "title": "" }, { "docid": "7f5faa00b1838c0fa8f90924b4ced032", "score": "0.44150192", "text": "func (mtr *DbwaintdbMetrics) getOffset(fldName string) int {\n\tvar offset int\n\n\tif fldName == \"DbPidChkFail\" {\n\t\treturn offset\n\t}\n\toffset += mtr.DbPidChkFail.Size()\n\n\tif fldName == \"DbQidOverflow\" {\n\t\treturn offset\n\t}\n\toffset += mtr.DbQidOverflow.Size()\n\n\tif fldName == \"HostRingAccessErr\" {\n\t\treturn offset\n\t}\n\toffset += mtr.HostRingAccessErr.Size()\n\n\tif fldName == \"TotalRingAccessErr\" {\n\t\treturn offset\n\t}\n\toffset += mtr.TotalRingAccessErr.Size()\n\n\tif fldName == \"RrespErr\" {\n\t\treturn offset\n\t}\n\toffset += mtr.RrespErr.Size()\n\n\tif fldName == \"BrespErr\" {\n\t\treturn offset\n\t}\n\toffset += mtr.BrespErr.Size()\n\n\treturn offset\n}", "title": "" }, { "docid": "42961beee7d6671008032f537a689d5e", "score": "0.44100592", "text": "func (gameImpl *GameImpl) MapWidth() int64 {\n\treturn gameImpl.mapWidthImpl\n}", "title": "" }, { "docid": "336ff4126abeaaaa120d6cbd868c7794", "score": "0.440966", "text": "func NewFWTSchemaWithWidths(sch schema.Schema, tagToPrintWidth map[uint64]int, tagToMaxRunes map[uint64]int) (*FWTSchema, error) {\n\tallCols := sch.GetAllCols()\n\n\tif len(tagToPrintWidth) != allCols.Size() {\n\t\tpanic(\"Invalid tagToPrintWidth map should have a value for every field.\")\n\t}\n\tif len(tagToMaxRunes) != allCols.Size() {\n\t\tpanic(\"Invalid tagToMaxRunes map should have a value for every field.\")\n\t}\n\n\terr := allCols.Iter(func(tag uint64, col schema.Column) (stop bool, err error) {\n\t\tif col.Kind != types.StringKind {\n\t\t\tpanic(\"Invalid schema argument. Has non-String fields. Use a rowconverter, or mapping reader / writer\")\n\t\t}\n\n\t\treturn false, nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttotalWidth := 0\n\tdispColCount := 0\n\n\tfor _, width := range tagToPrintWidth {\n\t\tif width > 0 {\n\t\t\ttotalWidth += width\n\t\t\tdispColCount++\n\t\t}\n\t}\n\n\tnoFitStrs := make(map[uint64]string, allCols.Size())\n\terr = allCols.Iter(func(tag uint64, col schema.Column) (stop bool, err error) {\n\t\tchars := make([]byte, tagToPrintWidth[tag])\n\t\tfor j := 0; j < tagToPrintWidth[tag]; j++ {\n\t\t\tchars[j] = '#'\n\t\t}\n\n\t\tnoFitStrs[tag] = string(chars)\n\t\treturn false, nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &FWTSchema{\n\t\tSch: sch,\n\t\tTagToWidth: tagToPrintWidth,\n\t\tTagToMaxRunes: tagToMaxRunes,\n\t\tNoFitStrs: noFitStrs,\n\t\ttotalWidth: totalWidth,\n\t\tdispColCount: dispColCount,\n\t}, nil\n}", "title": "" }, { "docid": "d9cf321ceea7d2aaac0a0d838b9e9926", "score": "0.4407954", "text": "func (self *RetroFont) Width() int{\n return self.Object.Get(\"width\").Int()\n}", "title": "" }, { "docid": "af01eebdba03c7579b8b58e3170ac08a", "score": "0.44074413", "text": "func TerminalDimensions() (columns, rows int, err error) {\n\tin, err := syscall.Open(\"CONOUT$\", syscall.O_RDWR, 0)\n\tif err != nil {\n\t\treturn -1, -1, err\n\t}\n\n\tvar info windows.ConsoleScreenBufferInfo\n\tif err := windows.GetConsoleScreenBufferInfo(windows.Handle(in), &info); err != nil {\n\t\treturn -1, -1, err\n\t}\n\treturn int(info.Size.X), int(info.Size.Y), nil\n}", "title": "" }, { "docid": "3dfaef67d03a81ef41bfcbbda3539cef", "score": "0.44066757", "text": "func (self *RetroFont) CharacterPerRow() int{\n return self.Object.Get(\"characterPerRow\").Int()\n}", "title": "" }, { "docid": "81c4d3addcb6c13075b4356682f3e353", "score": "0.44058856", "text": "func TerminalWidth() int {\n\tif tWidth < 0 {\n\t\treturn 0\n\t}\n\n\treturn tWidth\n}", "title": "" }, { "docid": "30c852cb8391ca4ef7f0807cb1f549e2", "score": "0.44041747", "text": "func (f Frame) Width() string {\n\treturn strings.Split(f.Name[:strings.Index(f.Name, \".\")], \"x\")[0]\n}", "title": "" }, { "docid": "11b746d52d0d47fae44f47427529bb32", "score": "0.44005856", "text": "func (ms *MinimalSurface) Dims() (nx, ny int) {\n\treturn len(ms.bottom), len(ms.left)\n}", "title": "" }, { "docid": "5c90422a1cfc72eb9a71a1c6d6d74770", "score": "0.44005516", "text": "func paddedLen(n int) int {\n\tconst k = aes.BlockSize\n\treturn k*(n/k) + k\n}", "title": "" }, { "docid": "5a3ea4fe7d63860b61f1948cbb9dac4d", "score": "0.4394406", "text": "func discoverPrefixSize(bs int, oracle EncryptionOracleFn) int {\n\t// We can find out how long the random prefix is by:\n\t// - create an n block long attack text\n\tattackText := createECBDetectingPlainText(bs)\n\n\t// - search for a n block long cipher text out\n\tfor i := 0; i < bs; i++ {\n\t\tpadding := make([]byte, i)\n\t\tplainText := append(padding, attackText...)\n\n\t\t// - keep prepending a padding byte until we find a n block long cipher text\n\t\tcipherText := askOracle(oracle, plainText)\n\n\t\tblockText, location := findRepeatingBlock(cipherText, bs, len(attackText)/bs)\n\n\t\tif location != -1 {\n\t\t\t// - change the attack text content (but not the prefix padding) and confirm that\n\t\t\t// we get a different n block long cipher text AT THE SAME LOCATION\n\t\t\tattackText = bytes.Repeat([]byte{'B'}, len(attackText))\n\t\t\tplainText := append(padding, attackText...)\n\t\t\tcipherText := askOracle(oracle, plainText)\n\t\t\tnewBlock, newLocation := findRepeatingBlock(cipherText, bs, len(attackText)/bs)\n\t\t\tif newLocation == location && !bytes.Equal(blockText, newBlock) {\n\t\t\t\t// profit!\n\t\t\t\treturn location*bs - i\n\t\t\t}\n\t\t}\n\n\t\t// - repeat until we know the prefix size\n\t}\n\n\tpanic(\"Could not determine the prefix size\")\n}", "title": "" } ]
b829287efc3817f8f9ffdf041be8ea64
NewPrintablePipelineInfo constructs a PrintablePipelineInfo from just a PipelineInfo.
[ { "docid": "ce009ebe1ef086c25458771354c716cc", "score": "0.84329224", "text": "func NewPrintablePipelineInfo(pi *ppsclient.PipelineInfo) *PrintablePipelineInfo {\n\treturn &PrintablePipelineInfo{\n\t\tPipelineInfo: pi,\n\t}\n}", "title": "" } ]
[ { "docid": "bdbd82048dd05fd14116fdfb53c84dfe", "score": "0.6694056", "text": "func PrintPipelineInfo(w io.Writer, pipelineInfo *ppsclient.PipelineInfo, fullTimestamps bool) {\n\tfmt.Fprintf(w, \"%s\\t\", pipelineInfo.Pipeline.Project.Name)\n\tfmt.Fprintf(w, \"%s\\t\", pipelineInfo.Pipeline.Name)\n\tfmt.Fprintf(w, \"%d\\t\", pipelineInfo.Version)\n\tif pipelineInfo.Details == nil {\n\t\tfmt.Fprint(w, \"-\\t\") // INPUT\n\t\tfmt.Fprint(w, \"-\\t\") // CREATED\n\t\tfmt.Fprintf(w, \"%s / %s\\t\", pipelineState(pipelineInfo.State), JobState(pipelineInfo.LastJobState))\n\t\tfmt.Fprint(w, \"pipeline details unavailable\\t\")\n\t} else {\n\t\tfmt.Fprintf(w, \"%s\\t\", ShorthandInput(pipelineInfo.Details.Input))\n\t\tif fullTimestamps {\n\t\t\tfmt.Fprintf(w, \"%s\\t\", pretty.Timestamp(pipelineInfo.Details.CreatedAt))\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s\\t\", pretty.Ago(pipelineInfo.Details.CreatedAt))\n\t\t}\n\t\tfmt.Fprintf(w, \"%s / %s\\t\", pipelineState(pipelineInfo.State), JobState(pipelineInfo.LastJobState))\n\t\tfmt.Fprintf(w, \"%s\\t\", pipelineInfo.Details.Description)\n\t}\n\tfmt.Fprintln(w)\n}", "title": "" }, { "docid": "bb9fd1cfcd79ef1fe0ce0b51e4d92b2e", "score": "0.6582372", "text": "func PrintDetailedPipelineInfo(w io.Writer, pipelineInfo *PrintablePipelineInfo) error {\n\ttemplate, err := template.New(\"PipelineInfo\").Funcs(funcMap).Parse(\n\t\t`Name: {{.Pipeline.Name}}{{if .Details.Description}}\nDescription: {{.Details.Description}}{{end}}{{if .FullTimestamps }}\nCreated: {{prettyTime .Details.CreatedAt}}{{ else }}\nCreated: {{prettyAgo .Details.CreatedAt}} {{end}}\nState: {{pipelineState .State}}\nReason: {{.Reason}}\nWorkers Available: {{.Details.WorkersAvailable}}/{{.Details.WorkersRequested}}\nStopped: {{ .Stopped }}\nParallelism Spec: {{.Details.ParallelismSpec}}\n{{- if .Details.ResourceRequests }}\nResourceRequests:\n CPU: {{ .Details.ResourceRequests.Cpu }}\n Memory: {{ .Details.ResourceRequests.Memory }} {{end}}\n{{- if .Details.ResourceLimits }}\nResourceLimits:\n CPU: {{ .Details.ResourceLimits.Cpu }}\n Memory: {{ .Details.ResourceLimits.Memory }}\n {{ if .Details.ResourceLimits.Gpu }}GPU:\n Type: {{ .Details.ResourceLimits.Gpu.Type }}\n Number: {{ .Details.ResourceLimits.Gpu.Number }} {{end}} {{end}}\nDatum Timeout: {{.Details.DatumTimeout}}\nJob Timeout: {{.Details.JobTimeout}}\nInput: {{pipelineInput .PipelineInfo.GetDetails.Input}}\nOutput Branch: {{.Details.OutputBranch}}\nTransform: {{prettyTransform .Details.Transform}}\n{{ if .Details.Egress -}}\nEgress: {{ egress .Details.Egress }}\n{{ end -}}\n{{ if .Details.RecentError -}}\nRecent Error: {{ .Details.RecentError }}\n{{ end -}}\n{{ if .UserSpecJson -}}\nUser Spec: {{ .UserSpecJson | json \" \" \" \" }}\n{{ end -}}\n{{ if .EffectiveSpecJson -}}\nEffective Spec: {{ .EffectiveSpecJson | json \" \" \" \" }}\n{{ end -}}\n`)\n\tif err != nil {\n\t\treturn errors.EnsureStack(err)\n\t}\n\treturn errors.EnsureStack(template.Execute(w, pipelineInfo))\n}", "title": "" }, { "docid": "dde98f14f94bb739a29139d793ed6abe", "score": "0.62157905", "text": "func NewPrintableJobInfo(ji *ppsclient.JobInfo, full bool) *PrintableJobInfo {\n\treturn &PrintableJobInfo{\n\t\tJobInfo: ji,\n\t\tFullTimestamps: full,\n\t}\n}", "title": "" }, { "docid": "206fce36d66b2071faffc178b82d224e", "score": "0.5712964", "text": "func PrintCreatePipelineRequest(w io.Writer, req *ppsclient.CreatePipelineRequest) error {\n\ttemplate, err := template.New(\"CreatePipelineRequest\").Funcs(funcMap).Parse(\n\t\t`Name: {{.Pipeline.Name}}{{if .Description}}\nDescription: {{.Description}}{{end}}\nParallelism Spec: {{.ParallelismSpec}}\n{{- if .ResourceRequests }}\nResourceRequests:\n CPU: {{ .ResourceRequests.Cpu }}\n Memory: {{ .ResourceRequests.Memory }} {{end}}\n{{- if .ResourceLimits }}\nResourceLimits:\n CPU: {{ .ResourceLimits.Cpu }}\n Memory: {{ .ResourceLimits.Memory }}\n {{ if .ResourceLimits.Gpu }}GPU:\n Type: {{ .ResourceLimits.Gpu.Type }}\n Number: {{ .ResourceLimits.Gpu.Number }} {{end}} {{end}}\nDatum Timeout: {{.DatumTimeout}}\nJob Timeout: {{.JobTimeout}}\nInput: {{pipelineInput .Input}}\nOutput Branch: {{.OutputBranch}}\nTransform: {{prettyTransform .Transform}}\n{{ if .Egress }}Egress: {{egress .Egress}} {{end}}\n`)\n\tif err != nil {\n\t\treturn errors.EnsureStack(err)\n\t}\n\treturn errors.EnsureStack(template.Execute(w, req))\n}", "title": "" }, { "docid": "c5a7df5248068d9d0de641345e047991", "score": "0.5529186", "text": "func NewPipeline(tb testing.TB, opts ...launcher.OptSetter) *Pipeline {\n\ttb.Helper()\n\n\ttl := launcher.NewTestLauncher()\n\tp := &Pipeline{\n\t\tLauncher: tl,\n\t}\n\n\ttl.RunOrFail(tb, context.Background(), opts...)\n\n\t// setup default operator\n\tres := p.Launcher.OnBoardOrFail(tb, &influxdb.OnboardingRequest{\n\t\tUser: DefaultUsername,\n\t\tPassword: DefaultPassword,\n\t\tOrg: DefaultOrgName,\n\t\tBucket: DefaultBucketName,\n\t\tRetentionPeriodSeconds: influxdb.InfiniteRetention,\n\t\tToken: OperToken,\n\t})\n\n\tp.DefaultOrgID = res.Org.ID\n\tp.DefaultUserID = res.User.ID\n\tp.DefaultBucketID = res.Bucket.ID\n\n\treturn p\n}", "title": "" }, { "docid": "2ec6ee5a9ffcd10a43cc40e2be5bf6d0", "score": "0.5514481", "text": "func NewPipeline() *Pipeline {\n\treturn &Pipeline{}\n}", "title": "" }, { "docid": "45678d997a688899cb7a238a6440cc94", "score": "0.5489062", "text": "func NewPipeline() *Pipeline {\n\treturn &Pipeline{\n\t\tcommands: []*Command{},\n\t}\n}", "title": "" }, { "docid": "9cb45c6da26cf06b2d224a847f60daa8", "score": "0.5450128", "text": "func NewPipelineDescriber(pipeline deploy.Pipeline, showResources bool) (*PipelineDescriber, error) {\n\tsess, err := sessions.ImmutableProvider().Default()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpipelineSvc := codepipeline.New(sess)\n\n\treturn &PipelineDescriber{\n\t\tpipeline: pipeline,\n\n\t\tpipelineSvc: pipelineSvc,\n\t\tshowResources: showResources,\n\t\tcfn: describestack.NewStackDescriber(stack.NameForPipeline(pipeline.AppName, pipeline.Name, pipeline.IsLegacy), sess),\n\t}, nil\n}", "title": "" }, { "docid": "10e7a1b9ee44c879e88d9620248185f8", "score": "0.54267186", "text": "func (c *Client) NewPipeline(pipelineName string) *Pipeline {\n\tpipe := &Pipeline{\n\t\tc.Client.Pipeline(),\n\t\tc.cluster,\n\t\tc.psm,\n\t\tc.metricsServiceName,\n\t\tpipelineName,\n\t}\n\treturn pipe\n}", "title": "" }, { "docid": "82c9e26ffe9c83ce5cbb5afdff8edb3c", "score": "0.538663", "text": "func NewSimplePipeline() *SimplePipeline {\n\treturn &SimplePipeline{\n\t\tch: make(chan Meta),\n\t}\n}", "title": "" }, { "docid": "82c9e26ffe9c83ce5cbb5afdff8edb3c", "score": "0.538663", "text": "func NewSimplePipeline() *SimplePipeline {\n\treturn &SimplePipeline{\n\t\tch: make(chan Meta),\n\t}\n}", "title": "" }, { "docid": "23cf3f1ea75ded042db9f2243e59be18", "score": "0.53697795", "text": "func NewPipeline() *pipeline {\n\tp := &pipeline{\n\t\tmake(chan interface{}),\n\t\tmake(chan struct{}, 1), make(chan struct{}, 1), make(chan struct{}, 1),\n\t\tfalse, false, make([]*pipe, 0),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "9be147f0f6d99749a0f89240f35786d9", "score": "0.5295381", "text": "func NewPipeline(e Element) *Pipeline {\n\tp := &Pipeline{\n\t\telement: e,\n\t\tbuilders: make(map[string]*samples.Builder),\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "89bc704512c432729af109d1531b88c9", "score": "0.52640915", "text": "func NewPipeline(cfg *viper.Viper) (*Pipeline, error) {\n\tmangler, err := ManglerHandlers.Init(cfg, \"mangle\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttransformer, err := TransformerHandlers.Init(cfg, \"transform\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclassifier, err := ClassifierHandlers.Init(cfg, \"classify\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfilterer, err := FiltererHandlers.Init(cfg, \"filter\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstoreHeader, err := StoreHeaderHandlers.Init(cfg, \"storeheader\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tencoder, err := EncoderHandlers.Init(cfg, \"encode\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcompressor, err := CompressorHandlers.Init(cfg, \"compress\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstorer, err := StorerHandlers.Init(cfg, \"store\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccounter, err := AccounterHandlers.Init(cfg, \"account\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twriter, err := WriterHandlers.Init(cfg, \"write\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := &Pipeline{\n\t\tMangler: mangler.(Mangler),\n\t\tTransformer: transformer.(Transformer),\n\t\tClassifier: classifier.(Classifier),\n\t\tFilterer: filterer.(Filterer),\n\t\tStoreHeader: storeHeader.(StoreHeader),\n\t\tEncoder: encoder.(Encoder),\n\t\tCompressor: compressor.(Compressor),\n\t\tStorer: storer.(Storer),\n\t\tAccounter: accounter.(Accounter),\n\t\tWriter: writer.(Writer),\n\t}\n\tstorer.(Storer).SetPipeline(p)\n\n\treturn p, nil\n}", "title": "" }, { "docid": "396cb8249235d945000a56b8208cbc16", "score": "0.52536595", "text": "func newPipelineStructures(c *JenkinsV1Client, namespace string) *pipelineStructures {\n\treturn &pipelineStructures{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "d0c53522d64b758ab776f542d7fbba86", "score": "0.5216777", "text": "func NewPipeline(repo *git.Repository) *Pipeline {\n\treturn &Pipeline{\n\t\trepo: repo,\n\t\top: OpEmpty,\n\t}\n}", "title": "" }, { "docid": "fd14c2a205ff0ccd540e922b8bb687c0", "score": "0.5157124", "text": "func NewPipeline(steps ...NamedStep) *Pipeline {\n\tp := &Pipeline{NamedSteps: steps}\n\treturn p\n}", "title": "" }, { "docid": "323c177d5b3c45a89ebd75c6709e5cb1", "score": "0.5144208", "text": "func NewPipeline() Pipeline {\n\treturn &pipeline{handlers: nil}\n}", "title": "" }, { "docid": "1287b5eea8f255eac0e1113a98a48d9a", "score": "0.5120896", "text": "func (m *GRPCClient) GetPipelineInfo(request *proto.GetPipelineInfoRequest) (*proto.GetPipelineInfoResponse, error) {\n\tresponse, err := m.client.GetPipelineInfo(context.Background(), request)\n\tif err != nil {\n\t\treturn &proto.GetPipelineInfoResponse{}, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "5e5995c37de248134c3c5c631aa8d5b7", "score": "0.5109945", "text": "func newPipeline() *pipeline {\n\tpipe := &pipeline{}\n\tpipe.errors = make(chan error, 3)\n\tpipe.input = make(chan nodePackage, 10)\n\tpipe.results = pipe.input // short-curcuit, will be filled with filters\n\treturn pipe\n}", "title": "" }, { "docid": "c08cf904523bd6a26bc269f73e1984a0", "score": "0.50993854", "text": "func NewPipeline(filters []Filter) *Pipeline {\n\treturn &Pipeline{\n\t\tfilters: filters,\n\t}\n}", "title": "" }, { "docid": "92e783cf8b34d7699b4fbdbc1344078e", "score": "0.5085648", "text": "func NewPipeline(pipelineName string) *pps.Pipeline {\n\treturn &pps.Pipeline{Name: pipelineName}\n}", "title": "" }, { "docid": "6be483903ee1ff94860ce0787e7d89d5", "score": "0.5077435", "text": "func NewPipeline(kind state.Kind) (state.Pipeline, error) {\n\tif kind.String() == globals.NaplesPipelineIris {\n\t\tret, _ := iris.NewPipeline()\n\t\treturn ret, nil\n\t} else if kind.String() == globals.NaplesPipelineApollo {\n\t\tret, _ := apollo.NewPipeline()\n\t\treturn ret, nil\n\t}\n\treturn nil, errors.New(\"Unknown pipeline \" + kind.String())\n\n}", "title": "" }, { "docid": "b4d20eb526b900c48913dbd4bbbca2ac", "score": "0.50590134", "text": "func NewPipelineStackDescriber(appName, name string, isLegacy bool) (*PipelineStackDescriber, error) {\n\tsess, err := sessions.ImmutableProvider().Default()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &PipelineStackDescriber{\n\t\tcfn: describestack.NewStackDescriber(stack.NameForPipeline(appName, name, isLegacy), sess),\n\t}, nil\n}", "title": "" }, { "docid": "2ad7a7ff66748eecdd54ac6a7ad294c2", "score": "0.5026153", "text": "func (gp *gpuImpl) NewPipeline(name string) gpu.Pipeline {\n\tpl := &glgpu.Pipeline{}\n\tpl.SetName(name)\n\treturn pl\n}", "title": "" }, { "docid": "3055cc9bc850dbdbff99c525cff31561", "score": "0.50187165", "text": "func NewPipeline(name string, processes []*Process, fns ...PipelineOptionFn) (*Pipeline, error) {\n\tif len(processes) < 2 {\n\t\treturn nil, fmt.Errorf(\"Pipelines require at least 2 processes, got [%d] process(es)\", len(processes))\n\t}\n\tp := &Pipeline{\n\t\tname: name,\n\t\tprocesses: processes,\n\t}\n\tp.exec = newExec(p.startFn, p.stopFn)\n\n\treturn p, nil\n}", "title": "" }, { "docid": "8d76c9e0de556c72545c4d0bd5c5b4d9", "score": "0.4980302", "text": "func NewPipeline() *Pipeline {\n\treturn &Pipeline{\n\t\tconcurrency: 1,\n\n\t\tclient: NewDefaultClient(),\n\t\treqs: make(chan request),\n\n\t\trunning: false,\n\n\t\trl: newRateLimiter(0),\n\t\trateLimited: false,\n\t}\n}", "title": "" }, { "docid": "59176e5649300c83416fd836e938b076", "score": "0.4974858", "text": "func NewPrinter(client *APIClient, cmd *cobra.Command, colors *yaml.Colors) (*Printer, error) {\n\treturn &Printer{client: client, cmd: cmd, colors: colors}, nil\n}", "title": "" }, { "docid": "8219b20cc9386504c52313fff185e936", "score": "0.4956886", "text": "func NewPipeline(ctx *pulumi.Context,\n\tname string, args *PipelineArgs, opts ...pulumi.ResourceOption) (*Pipeline, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.PipelineActivities == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'PipelineActivities'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Pipeline\n\terr := ctx.RegisterResource(\"aws-native:iotanalytics:Pipeline\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "eab980854c30bab030ff57390671c6f7", "score": "0.49044594", "text": "func New(p BasePrinter) Printer {\n\treturn Printer{pp: p}\n}", "title": "" }, { "docid": "77afeee68c00d3bd0d6832bb5378b27a", "score": "0.48910403", "text": "func NewPrinter(delim string, header, onlyPvtIP, withColor bool, w interface{}) *Printer {\n\tpr := new(Printer)\n\n\tif delim == \"\" {\n\t\tdelim = defaultDelimiter\n\t}\n\tpr.Delimiter = delim\n\tpr.PrintHeader = header\n\tpr.OnlyPrivateIP = onlyPvtIP\n\tpr.WithColor = withColor\n\n\tif writer, ok := w.(io.Writer); ok {\n\t\tpr.Writer = writer\n\t} else {\n\t\tpr.Writer = defaultWriter(delim)\n\t}\n\n\treturn pr\n}", "title": "" }, { "docid": "8b8342818ecc1c8e66fd6232b9c3cc94", "score": "0.48861644", "text": "func NewInfo() info {\n\treturn info{\n\t\tVersion: Version,\n\t\tRevision: Revision,\n\t\tBranch: Branch,\n\t\tBuildUser: BuildUser,\n\t\tBuildDate: BuildDate,\n\t\tGoVersion: goVersion,\n\t}\n}", "title": "" }, { "docid": "9dcab7b51896bf723c2a50b02383e760", "score": "0.48608932", "text": "func New(in chan Request) (pipeline *Pipeline) {\n\tp := simple.New(in)\n\treturn &Pipeline{pipe: p}\n}", "title": "" }, { "docid": "854b9980fe11af6c240b17d7cf207ed3", "score": "0.4859301", "text": "func NewPrinter(arch *arch.Architecture, dwarf *dwarf.Data, server *Server) *Printer {\n\treturn &Printer{\n\t\tserver: server,\n\t\tarch: arch,\n\t\tdwarf: dwarf,\n\t\tvisited: make(map[typeAndAddress]bool),\n\t}\n}", "title": "" }, { "docid": "799669b4eaf7dbd18d16608f062ec75e", "score": "0.48586395", "text": "func NewPI() *Coder {\n\treturn &Coder{Kind: PaneInfo, T: typex.New(typex.PaneInfoType)}\n}", "title": "" }, { "docid": "cee5a9b6cd187364292c99d23f4e37f8", "score": "0.48555684", "text": "func NewPipeline(cfg PipeConfig) *RqPipeline {\n\tpool := RqPool{\n\t\tnDownload: cfg.Download,\n\t\tnSummarize: cfg.Summarize,\n\t\tnCleanup: cfg.Cleanup,\n\t\twg: sync.WaitGroup{},\n\t\tdownloadChn: make(chan RqJob),\n\t\tsummarizeChn: make(chan RqJob),\n\t\tcleanupChn: make(chan RqJob),\n\t\tsaveChn: make(chan RqJob),\n\t\terrorChn: make(chan RqError, 1000),\n\t\tdoneChn: make(chan int),\n\t\tclient: newClient(defaultTimeout),\n\t\tstopOnce: sync.Once{},\n\t}\n\n\treturn &RqPipeline{\n\t\tpool: &pool,\n\t\tsourceURLs: nil,\n\t\toutFile: nil,\n\t\timageCount: 0,\n\t}\n}", "title": "" }, { "docid": "8ea849c835d70f6fc780b9138472f889", "score": "0.48511082", "text": "func newPipelineHandler(t *Transport, r Raft, cid types.ID) http.Handler {\n\th := &pipelineHandler{\n\t\tlg: t.Logger,\n\t\tlocalID: t.ID,\n\t\ttr: t,\n\t\tr: r,\n\t\tcid: cid,\n\t}\n\tif h.lg == nil {\n\t\th.lg = zap.NewNop()\n\t}\n\treturn h\n}", "title": "" }, { "docid": "468a5fbe8ee05929f9aab8056fa5fc0a", "score": "0.48348176", "text": "func NewPipelineViewCmd(client dynamic.Interface) (cmd *cobra.Command) {\n\tctx := context.TODO()\n\tcmd = &cobra.Command{\n\t\tUse: \"view\",\n\t\tShort: \"Output the YAML format of a Pipeline\",\n\t\tRunE: func(cmd *cobra.Command, args []string) (err error) {\n\t\t\tvar pips []string\n\t\t\tvar ns string\n\t\t\tif ns, pips, err = getPipelinesWithConfirm(client, args); err == nil {\n\t\t\t\tfor _, pip := range pips {\n\t\t\t\t\tvar rawPip *unstructured.Unstructured\n\t\t\t\t\tvar data []byte\n\t\t\t\t\tbuf := bytes.NewBuffer(data)\n\t\t\t\t\tif rawPip, err = client.Resource(types.GetPipelineSchema()).Namespace(ns).Get(ctx, pip, metav1.GetOptions{}); err == nil {\n\t\t\t\t\t\tenc := json.NewEncoder(buf)\n\t\t\t\t\t\tenc.SetIndent(\"\", \" \")\n\t\t\t\t\t\tif err = enc.Encode(rawPip); err != nil {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = fmt.Errorf(\"cannot get pipeline, error: %#v\", err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tvar yamlData []byte\n\t\t\t\t\tif yamlData, err = yaml.JSONToYAML(buf.Bytes()); err != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tcmd.Println(string(yamlData))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t},\n\t}\n\treturn\n}", "title": "" }, { "docid": "3878d49b5d368d311aa7a6d7fd2f9017", "score": "0.48341882", "text": "func (p *Pipeline) String() string {\n\treturn fmt.Sprintf(`{\n Commit: %s,\n Data: %s,\n Flavor: %s,\n ID: %d,\n Platform: %s,\n Ref: %s,\n RepoID: %d,\n ExternalSecrets: %t,\n InternalSecrets: %t,\n Services: %t,\n Stages: %t,\n Steps: %t,\n Templates: %t,\n Type: %s,\n Version: %s,\n}`,\n\t\tp.GetCommit(),\n\t\tp.GetData(),\n\t\tp.GetFlavor(),\n\t\tp.GetID(),\n\t\tp.GetPlatform(),\n\t\tp.GetRef(),\n\t\tp.GetRepoID(),\n\t\tp.GetExternalSecrets(),\n\t\tp.GetInternalSecrets(),\n\t\tp.GetServices(),\n\t\tp.GetStages(),\n\t\tp.GetSteps(),\n\t\tp.GetTemplates(),\n\t\tp.GetType(),\n\t\tp.GetVersion(),\n\t)\n}", "title": "" }, { "docid": "0a69944e53a5b424b49e6586bb3aee86", "score": "0.4822374", "text": "func CreatePipeline(codecName string, tracks []*webrtc.TrackLocalStaticSample, pipelineSrc string) *Pipeline {\n\tpipelineStr := \"appsink name=appsink\"\n\tvar clockRate float32\n\n\tswitch codecName {\n\tcase \"vp8\":\n\t\tpipelineStr = pipelineSrc + \" ! vp8enc error-resilient=partitions keyframe-max-dist=10 auto-alt-ref=true cpu-used=5 deadline=1 ! \" + pipelineStr\n\t\tclockRate = videoClockRate\n\n\tcase \"vp9\":\n\t\tpipelineStr = pipelineSrc + \" ! vp9enc ! \" + pipelineStr\n\t\tclockRate = videoClockRate\n\n\tcase \"h264\":\n\t\tpipelineStr = pipelineSrc + \" ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast tune=zerolatency key-int-max=20 ! video/x-h264,stream-format=byte-stream ! \" + pipelineStr\n\t\tclockRate = videoClockRate\n\n\tcase \"opus\":\n\t\tpipelineStr = pipelineSrc + \" ! opusenc ! \" + pipelineStr\n\t\tclockRate = audioClockRate\n\n\tcase \"g722\":\n\t\tpipelineStr = pipelineSrc + \" ! avenc_g722 ! \" + pipelineStr\n\t\tclockRate = audioClockRate\n\n\tcase \"pcmu\":\n\t\tpipelineStr = pipelineSrc + \" ! audio/x-raw, rate=8000 ! mulawenc ! \" + pipelineStr\n\t\tclockRate = pcmClockRate\n\n\tcase \"pcma\":\n\t\tpipelineStr = pipelineSrc + \" ! audio/x-raw, rate=8000 ! alawenc ! \" + pipelineStr\n\t\tclockRate = pcmClockRate\n\n\tdefault:\n\t\tpanic(\"Unhandled codec \" + codecName)\n\t}\n\n\tpipelineStrUnsafe := C.CString(pipelineStr)\n\tdefer C.free(unsafe.Pointer(pipelineStrUnsafe))\n\n\tpipelinesLock.Lock()\n\tdefer pipelinesLock.Unlock()\n\n\tpipeline := &Pipeline{\n\t\tPipeline: C.gstreamer_send_create_pipeline(pipelineStrUnsafe),\n\t\ttracks: tracks,\n\t\tid: len(pipelines),\n\t\tcodecName: codecName,\n\t\tclockRate: clockRate,\n\t}\n\n\tpipelines[pipeline.id] = pipeline\n\treturn pipeline\n}", "title": "" }, { "docid": "7df2729db53fb28851a2a8434c7e7f3d", "score": "0.48005897", "text": "func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) {\n\terrors := make([]error, 0)\n\tx := &Info{}\n\tm, ok := compiler.UnpackMap(in)\n\tif !ok {\n\t\tmessage := fmt.Sprintf(\"has unexpected value: %+v (%T)\", in, in)\n\t\terrors = append(errors, compiler.NewError(context, message))\n\t} else {\n\t\trequiredKeys := []string{\"title\", \"version\"}\n\t\tmissingKeys := compiler.MissingKeysInMap(m, requiredKeys)\n\t\tif len(missingKeys) > 0 {\n\t\t\tmessage := fmt.Sprintf(\"is missing required %s: %+v\", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, \", \"))\n\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t}\n\t\tallowedKeys := []string{\"contact\", \"description\", \"license\", \"summary\", \"termsOfService\", \"title\", \"version\"}\n\t\tallowedPatterns := []*regexp.Regexp{pattern1}\n\t\tinvalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)\n\t\tif len(invalidKeys) > 0 {\n\t\t\tmessage := fmt.Sprintf(\"has invalid %s: %+v\", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, \", \"))\n\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t}\n\t\t// string title = 1;\n\t\tv1 := compiler.MapValueForKey(m, \"title\")\n\t\tif v1 != nil {\n\t\t\tx.Title, ok = compiler.StringForScalarNode(v1)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for title: %s\", compiler.Display(v1))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// string description = 2;\n\t\tv2 := compiler.MapValueForKey(m, \"description\")\n\t\tif v2 != nil {\n\t\t\tx.Description, ok = compiler.StringForScalarNode(v2)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for description: %s\", compiler.Display(v2))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// string terms_of_service = 3;\n\t\tv3 := compiler.MapValueForKey(m, \"termsOfService\")\n\t\tif v3 != nil {\n\t\t\tx.TermsOfService, ok = compiler.StringForScalarNode(v3)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for termsOfService: %s\", compiler.Display(v3))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// Contact contact = 4;\n\t\tv4 := compiler.MapValueForKey(m, \"contact\")\n\t\tif v4 != nil {\n\t\t\tvar err error\n\t\t\tx.Contact, err = NewContact(v4, compiler.NewContext(\"contact\", v4, context))\n\t\t\tif err != nil {\n\t\t\t\terrors = append(errors, err)\n\t\t\t}\n\t\t}\n\t\t// License license = 5;\n\t\tv5 := compiler.MapValueForKey(m, \"license\")\n\t\tif v5 != nil {\n\t\t\tvar err error\n\t\t\tx.License, err = NewLicense(v5, compiler.NewContext(\"license\", v5, context))\n\t\t\tif err != nil {\n\t\t\t\terrors = append(errors, err)\n\t\t\t}\n\t\t}\n\t\t// string version = 6;\n\t\tv6 := compiler.MapValueForKey(m, \"version\")\n\t\tif v6 != nil {\n\t\t\tx.Version, ok = compiler.StringForScalarNode(v6)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for version: %s\", compiler.Display(v6))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// string summary = 7;\n\t\tv7 := compiler.MapValueForKey(m, \"summary\")\n\t\tif v7 != nil {\n\t\t\tx.Summary, ok = compiler.StringForScalarNode(v7)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for summary: %s\", compiler.Display(v7))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// repeated NamedAny specification_extension = 8;\n\t\t// MAP: Any ^x-\n\t\tx.SpecificationExtension = make([]*NamedAny, 0)\n\t\tfor i := 0; i < len(m.Content); i += 2 {\n\t\t\tk, ok := compiler.StringForScalarNode(m.Content[i])\n\t\t\tif ok {\n\t\t\t\tv := m.Content[i+1]\n\t\t\t\tif strings.HasPrefix(k, \"x-\") {\n\t\t\t\t\tpair := &NamedAny{}\n\t\t\t\t\tpair.Name = k\n\t\t\t\t\tresult := &Any{}\n\t\t\t\t\thandled, resultFromExt, err := compiler.CallExtension(context, v, k)\n\t\t\t\t\tif handled {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbytes := compiler.Marshal(v)\n\t\t\t\t\t\t\tresult.Yaml = string(bytes)\n\t\t\t\t\t\t\tresult.Value = resultFromExt\n\t\t\t\t\t\t\tpair.Value = result\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpair.Value, err = NewAny(v, compiler.NewContext(k, v, context))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tx.SpecificationExtension = append(x.SpecificationExtension, pair)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn x, compiler.NewErrorGroupOrNil(errors)\n}", "title": "" }, { "docid": "19a88a1368e150529d8def371e32c7bc", "score": "0.47948113", "text": "func NewProposer(id, nrOfNodes, adu int, ld detector.LeaderDetector, prepareOut chan<- Prepare, acceptOut chan<- Accept) *Proposer {\n\treturn &Proposer{\n\t\tid: id,\n\t\tquorum: (nrOfNodes / 2) + 1,\n\t\tn: nrOfNodes,\n\n\t\tcrnd: Round(id),\n\t\tadu: SlotID(adu),\n\t\tnextSlot: 0,\n\n\t\tpromises: make([]*Promise, nrOfNodes),\n\t\tnonNILprm: make([]*Promise, 0),\n\n\t\tphaseOneProgressTicker: time.NewTicker(time.Second),\n\n\t\tacceptsOut: list.New(),\n\t\trequestsIn: list.New(),\n\n\t\tld: ld,\n\t\tleader: ld.Leader(),\n\n\t\tprepareOut: prepareOut,\n\t\tacceptOut: acceptOut,\n\t\tpromiseIn: make(chan Promise, 429496),\n\t\tcvalIn: make(chan Value, 429496),\n\n\t\tincDcd: make(chan struct{}),\n\t\tstop: make(chan struct{}),\n\t}\n\n}", "title": "" }, { "docid": "42021349f9cf3383b4bfb9ab9cc9f801", "score": "0.47740492", "text": "func NewInfo() *Info {\n\treturn &Info{\n\t\tContext: \"http://iiif.io/api/image/2/context.json\",\n\t\tProtocol: \"http://iiif.io/api/image\",\n\t}\n}", "title": "" }, { "docid": "beb59630c9a860301d5f28f5de1f4dd1", "score": "0.4759014", "text": "func NewPipelineInput(repoName string, method *pps.Method) *pps.PipelineInput {\n\treturn &pps.PipelineInput{\n\t\tRepo: NewRepo(repoName),\n\t\tMethod: method,\n\t}\n}", "title": "" }, { "docid": "0a94ea05190b09b8eae47eb54c77ea0e", "score": "0.47483727", "text": "func NewPipeline(pipes ...Pipe) Pipeline {\n\thead := make(chan interface{})\n\tvar next_chan chan interface{}\n\tfor _, pipe := range pipes {\n\t\tif next_chan == nil {\n\t\t\tnext_chan = pipe.Process(head)\n\t\t} else {\n\t\t\tnext_chan = pipe.Process(next_chan)\n\t\t}\n\t}\n\treturn Pipeline{head: head, tail: next_chan}\n}", "title": "" }, { "docid": "a443d663b34bd8878b112348f8e742e8", "score": "0.47477087", "text": "func newPipelineRunTest(data test.Data, t *testing.T) *PipelineRunTest {\n\tt.Helper()\n\ttestAssets, cancel := getPipelineRunController(t, data)\n\treturn &PipelineRunTest{\n\t\tData: data,\n\t\tTest: t,\n\t\tTestAssets: testAssets,\n\t\tCancel: cancel,\n\t}\n}", "title": "" }, { "docid": "38098cf3c7aab6894e869067b7445cda", "score": "0.47428522", "text": "func New(\n\tv,\n\tgitCommit,\n\tgitBranch,\n\tgitAuthor,\n\tgitDescribe,\n\tbuildDate,\n\tversionPrerelease,\n\tversionMetaData,\n\tbuildUser,\n\tbuildHost string,\n\tstartTime time.Time) Info {\n\n\tver := v\n\trel := versionPrerelease\n\n\tif gitDescribe != \"\" {\n\t\tver = gitDescribe\n\t}\n\tif gitDescribe == \"\" && rel == \"\" {\n\t\trel = \"dev\"\n\t}\n\n\treturn Info{\n\t\tRevision: gitCommit,\n\t\tAuthor: gitAuthor,\n\t\tVersion: ver,\n\t\tVersionPrerelease: rel,\n\t\tVersionMetadata: versionMetaData,\n\t\tBuildDate: buildDate,\n\t\tBuildUser: buildUser,\n\t\tBranch: gitBranch,\n\t\tBuildHost: buildHost,\n\t\tServerStartTime: startTime,\n\t}\n}", "title": "" }, { "docid": "849493d6d7d9e8ee3be95b8d1d9bfb09", "score": "0.47176552", "text": "func newLibp2pPipeline(tr *Libp2pTransport, target string) (*libp2pPipeline, error) {\n\tlogger.Debugf(\"%s: New pipeline to %s\", tr.LocalAddr(), target)\n\tp, err := peer.IDB58Decode(target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstream, err := tr.host.NewStream(tr.ctx, p, RaftPipelineProtocol)\n\tif err != nil {\n\t\tlogger.Debugf(\"%s: %s\", tr.LocalAddr(), err)\n\t\treturn nil, err\n\t}\n\twrap := wrapStream(stream)\n\n\tpipeline := &libp2pPipeline{\n\t\ttrans: tr,\n\t\tsWrap: wrap,\n\n\t\tdoneCh: make(chan raft.AppendFuture, rpcMaxPipeline),\n\t\tinProgressCh: make(chan *appendFuture, rpcMaxPipeline),\n\t\tshutdownCh: make(chan struct{}),\n\t}\n\n\tgo pipeline.decodeResponses()\n\treturn pipeline, nil\n}", "title": "" }, { "docid": "38bc3f46d85969715f19503933785aad", "score": "0.47027987", "text": "func NewIPv4Info(config *core.Config, bus *core.EventBus) *IPv4Info {\n\ti := &IPv4Info{\n\t\tbaseURL: \"http://ipv4info.com\",\n\t\tSourceType: core.SCRAPE,\n\t}\n\n\ti.BaseService = *core.NewBaseService(i, \"IPv4Info\", config, bus)\n\treturn i\n}", "title": "" }, { "docid": "da5532f67126a81d35760950bf3a27a4", "score": "0.46934307", "text": "func NewPokemonInfo() *PokemonInfo {\n\treturn &PokemonInfo{nil}\n}", "title": "" }, { "docid": "dda482d0b4148651a6282d52a99b56d9", "score": "0.469115", "text": "func NewInfo() *Info {\n\tdsn := &Info{}\n\tdsn.PacketReadTimeout = 50\n\tdsn.ConnectProps = url.Values{}\n\treturn dsn\n}", "title": "" }, { "docid": "de399c817040ae935870b81056b7a848", "score": "0.46782044", "text": "func NewSimplePipelineWithBuf(bufSize int) *SimplePipeline {\n\treturn &SimplePipeline{\n\t\tch: make(chan Meta, bufSize),\n\t}\n}", "title": "" }, { "docid": "de399c817040ae935870b81056b7a848", "score": "0.46782044", "text": "func NewSimplePipelineWithBuf(bufSize int) *SimplePipeline {\n\treturn &SimplePipeline{\n\t\tch: make(chan Meta, bufSize),\n\t}\n}", "title": "" }, { "docid": "7cee53e9e430b302b4ac2b65680dd4fc", "score": "0.46770808", "text": "func CreatePipeline(payloadType webrtc.PayloadType, codecName string) *Pipeline {\n\tpipelineStr := \"appsrc format=time is-live=true do-timestamp=true name=src ! application/x-rtp\"\n\tswitch strings.ToLower(codecName) {\n\tcase \"vp8\":\n\t\tpipelineStr += fmt.Sprintf(\", payload=%d, encoding-name=VP8-DRAFT-IETF-01 ! rtpvp8depay ! decodebin ! autovideosink\", payloadType)\n\tcase \"opus\":\n\t\tpipelineStr += fmt.Sprintf(\", payload=%d, encoding-name=OPUS ! rtpopusdepay ! decodebin ! autoaudiosink\", payloadType)\n\tcase \"vp9\":\n\t\tpipelineStr += \" ! rtpvp9depay ! decodebin ! autovideosink\"\n\tcase \"h264\":\n\t\tpipelineStr += \" ! rtph264depay ! decodebin ! autovideosink\"\n\tcase \"g722\":\n\t\tpipelineStr += \" clock-rate=8000 ! rtpg722depay ! decodebin ! autoaudiosink\"\n\tdefault:\n\t\tpanic(\"Unhandled codec \" + codecName)\n\t}\n\n\tpipelineStrUnsafe := C.CString(pipelineStr)\n\tdefer C.free(unsafe.Pointer(pipelineStrUnsafe))\n\treturn &Pipeline{Pipeline: C.gstreamer_receive_create_pipeline(pipelineStrUnsafe)}\n}", "title": "" }, { "docid": "412fae3d5cbfd212c172693dae7d8518", "score": "0.46722093", "text": "func NewInfo(offset, page int) *Info {\n\treturn &Info{\n\t\tOffset: offset,\n\t\tPage: page,\n\t}\n}", "title": "" }, { "docid": "86490c0101c4b667950fa3ae77e15b27", "score": "0.46675098", "text": "func NewPrinter(ioStreams genericclioptions.IOStreams, printData *printer.PrintData) *Printer {\n\treturn &Printer{\n\t\tFormatter: jsonprinter.NewFormatter(ioStreams, common.DryRunNone),\n\t\tIOStreams: ioStreams,\n\t\tData: printData,\n\t}\n}", "title": "" }, { "docid": "f402715ed437767245f993d5984c7587", "score": "0.46587464", "text": "func NewInfo() *Info {\n\tcinfo := C.CloneImageInfo(nil)\n\tinfo := new(Info)\n\tinfo.info = cinfo\n\truntime.SetFinalizer(info, func(i *Info) {\n\t\tif i.info != nil {\n\t\t\tC.DestroyImageInfo(i.info)\n\t\t\ti.info = nil\n\t\t}\n\t})\n\treturn info\n}", "title": "" }, { "docid": "0ba1f94f536edd18ac5c9b58e9b4d08e", "score": "0.46582106", "text": "func NewDefaultPipeline(t *testing.T, opts ...launcher.OptSetter) *DefaultPipeline {\n\tsetDefaultLogLevel := func(o *launcher.InfluxdOpts) {\n\t\t// This is left here mainly for retro compatibility\n\t\tif VeryVerbose {\n\t\t\to.LogLevel = zap.DebugLevel\n\t\t} else {\n\t\t\to.LogLevel = zap.InfoLevel\n\t\t}\n\n\t}\n\t// Set the default log level as the FIRST option here so users can override\n\t// it with passed-in setters.\n\topts = append([]launcher.OptSetter{setDefaultLogLevel}, opts...)\n\treturn &DefaultPipeline{Pipeline: NewPipeline(t, opts...)}\n}", "title": "" }, { "docid": "24d39bc0e371e3d41f9885f9521a8f3b", "score": "0.4654395", "text": "func NewPipeline(ctx *pulumi.Context,\n\tname string, args *PipelineArgs, opts ...pulumi.ResourceOption) (*Pipeline, 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\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Pipeline\n\terr := ctx.RegisterResource(\"azure:datafactory/pipeline:Pipeline\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "0e20ce87cacaaa46adfd752a2823017d", "score": "0.46519887", "text": "func NewProjectInfo(ctx *pulumi.Context,\n\tname string, args *ProjectInfoArgs, opts ...pulumi.ResourceOption) (*ProjectInfo, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.BillingAccount == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'BillingAccount'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ProjectInfo\n\terr := ctx.RegisterResource(\"gcp:billing/projectInfo:ProjectInfo\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "0643619faf4ed86eb4ed74d1b4f199af", "score": "0.46467292", "text": "func newDefaultPipeline(o pipelineOptions) azcore.Pipeline {\n\treturn azcore.NewPipeline(\n\t\to.HTTPClient,\n\t\tazcore.NewTelemetryPolicy(&o.Telemetry),\n\t\tazcore.NewRetryPolicy(&o.Retry),\n\t\tazcore.NewLogPolicy(&o.Logging))\n}", "title": "" }, { "docid": "a50b0abbfcf88247a13cc6c1b05b7e1e", "score": "0.46446326", "text": "func (s PowerboxDisplayInfo) NewTitle() (util.LocalizedText, error) {\n\tss, err := util.NewLocalizedText(s.Struct.Segment())\n\tif err != nil {\n\t\treturn util.LocalizedText{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "30c9c0b4a56b751dc848649f0fc46ae3", "score": "0.46403405", "text": "func NewInfo(format string, args ...any) WrapFunc {\n\treturn With(&Info{\n\t\tformat: format,\n\t\targs: args,\n\t})\n}", "title": "" }, { "docid": "5eb535ee10fe8af7dffd3f07f4c3104f", "score": "0.4624723", "text": "func New(\n\tctx context.Context,\n\tfetchCommittedEntry fetchFunc,\n\tnotifyGap notifyGapFunc) *Pipeline {\n\tr := &Pipeline{\n\t\trootCtx: ctx,\n\t\tfetchCommittedEntry: fetchCommittedEntry,\n\t\tnotifyGap: notifyGap,\n\t\tp: make(map[storage.Stream]*stream),\n\t}\n\treturn r\n}", "title": "" }, { "docid": "8f4332da15d12479989b7d267566bcfc", "score": "0.46134707", "text": "func New(opts Options, provider PrintProvider) *Printer {\n\treturn &Printer{\n\t\toptions: opts,\n\t\tprintProvider: provider,\n\t\tclusterIndex: 0,\n\t}\n}", "title": "" }, { "docid": "9b002c6f87cc890f853b7e91a8dc5467", "score": "0.4607125", "text": "func NewProgressInfo(agentID int, agents comm.ConnList, l *log.Logger) *ProgressInfo {\n\treturn &ProgressInfo{\n\t\tagentID: agentID,\n\t\tagentCount: len(agents),\n\t\tplanCost: -1,\n\t\tplanLength: -1,\n\t\tplanMakespan: -1,\n\t\tsmallestH: ints.MaxValue,\n\t\tt: time.Now(),\n\t\tlogger: l,\n\t}\n}", "title": "" }, { "docid": "f2ed5374e54edf509d7f813121102074", "score": "0.46023777", "text": "func NewBuildInfo(version, date, commit string) (*BuildInfo, error) {\n\tif version == \"\" {\n\t\treturn nil, errors.New(\"version cannot be empty\")\n\t}\n\n\td, err := time.Parse(time.RFC3339, date)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse date %s: %w\", date, err)\n\t}\n\n\tif len(commit) < 8 {\n\t\treturn nil, errors.New(\"commit hash has to be at least 8 characters long\")\n\t}\n\n\treturn &BuildInfo{\n\t\tversion: version,\n\t\tdate: d,\n\t\tcommit: commit,\n\t\truntimeVersion: runtime.Version,\n\t}, nil\n}", "title": "" }, { "docid": "865bfd20ee2d0111820ddedef0de494e", "score": "0.46021926", "text": "func NewCmdCreateMetaPipeline(commonOpts *opts.CommonOptions) *cobra.Command {\n\toptions := &StepCreatePipelineOptions{\n\t\tCommonOptions: commonOpts,\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"pipeline\",\n\t\tShort: \"Creates the Tekton meta pipeline for a given build pipeline.\",\n\t\tLong: createPipelineLong,\n\t\tExample: createPipelineExample,\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\thelper.CheckErr(err)\n\t\t},\n\t\tHidden: true,\n\t}\n\n\tcmd.Flags().StringVar(&options.SourceURL, sourceURLOptionName, \"\", \"Specify the git URL for the source (required)\")\n\tcmd.Flags().StringVar(&options.Branch, branchOptionName, \"\", \"The git branch to trigger the build in. Defaults to the current local branch name (required)\")\n\tcmd.Flags().StringVarP(&options.PipelineKind, pipelineKindOptionName, \"k\", \"\", \"The kind of pipeline to create such as: \"+strings.Join(jenkinsfile.PipelineKinds, \", \"))\n\tcmd.Flags().StringVar(&options.Job, jobOptionName, \"\", \"The Prow job name in order to identify all pipelines belonging to a single trigger event (required)\")\n\n\tcmd.Flags().StringVar(&options.PullRefs, pullRefOptionName, \"\", \"The Prow pull ref specifying the references to merge into the source\")\n\tcmd.Flags().StringVarP(&options.Context, contextOptionName, \"c\", \"\", \"The pipeline context if there are multiple separate pipelines for a given branch\")\n\n\tcmd.Flags().StringVar(&options.DefaultImage, defaultImageOptionName, syntax.DefaultContainerImage, \"Specify the docker image to use if there is no image specified for a step. Default \"+syntax.DefaultContainerImage)\n\tcmd.Flags().StringArrayVarP(&options.CustomLabels, labelOptionName, \"l\", nil, \"List of custom labels to be applied to the generated PipelineRun (can be use multiple times)\")\n\tcmd.Flags().StringArrayVarP(&options.CustomEnvs, envOptionName, \"e\", nil, \"List of custom environment variables to be applied to resources that are created (can be use multiple times)\")\n\n\tcmd.Flags().StringVar(&options.PullRequestNumber, pullRequestOptionName, \"\", \"If a pull request this is it's number\")\n\tcmd.Flags().StringVar(&options.ServiceAccount, serviceAccountOptionName, \"tekton-bot\", \"The Kubernetes ServiceAccount to use to run the pipeline\")\n\n\t// options to control the output, mainly for development\n\tcmd.Flags().BoolVar(&options.NoApply, noApplyOptionName, false, \"Disables creating the pipeline resources in the cluster and just outputs the generated resources to file\")\n\tcmd.Flags().StringVarP(&options.OutDir, outputOptionName, \"o\", \"out\", \"Used in conjunction with --no-apply to determine the directory into which to write the output\")\n\n\toptions.AddCommonFlags(cmd)\n\treturn cmd\n}", "title": "" }, { "docid": "6dcb05c7f8a1ec883129aba1304314ee", "score": "0.45890382", "text": "func NewTrainInfo(hex string) *TrainInfo {\n\tt := new(TrainInfo)\n\tt.L2 = GenLayer2(hex)\n\tvar err error\n\tt.L3, err = GenLayer3(hex, t.L2.Info.End)\n\tif err != nil { // Then stop\n\t\treturn nil\n\t}\n\tt.L4P = GenLayer4to7(hex, t.L3.LayerEndIndex)\n\treturn t\n}", "title": "" }, { "docid": "7291a551adc439b55e5362ab7f76787d", "score": "0.4588681", "text": "func NewPubSubPipeline(projID *string, queue *string, resultQueue *string, subscriptionName *string, handler pipeline.Handler) *PubSubPipeline {\n\treturn &PubSubPipeline{\n\t\tprojID: projID,\n\t\tqueue: queue,\n\t\tresultQueue: resultQueue,\n\t\tsubscriptionName: subscriptionName,\n\t\thandler: handler,\n\n\t\tCreateTopics: false,\n\t\tCreateSubscription: false,\n\t}\n}", "title": "" }, { "docid": "10e78671bd78a7ad27f030adedccf6a0", "score": "0.4586368", "text": "func New(version string, commit string, date string) *Info {\n\treturn &Info{\n\t\tVersion: version,\n\t\tCommit: commit,\n\t\tDate: date,\n\t}\n}", "title": "" }, { "docid": "10e78671bd78a7ad27f030adedccf6a0", "score": "0.4586368", "text": "func New(version string, commit string, date string) *Info {\n\treturn &Info{\n\t\tVersion: version,\n\t\tCommit: commit,\n\t\tDate: date,\n\t}\n}", "title": "" }, { "docid": "10e78671bd78a7ad27f030adedccf6a0", "score": "0.4586368", "text": "func New(version string, commit string, date string) *Info {\n\treturn &Info{\n\t\tVersion: version,\n\t\tCommit: commit,\n\t\tDate: date,\n\t}\n}", "title": "" }, { "docid": "f4b691256276cd465ff35ffc272bf250", "score": "0.4580248", "text": "func NewInfo(contract string, eventID uuid.ID) *Info {\n\treturn &Info{\n\t\tContract: contract,\n\t\tEventID: eventID,\n\t}\n}", "title": "" }, { "docid": "89473274293dfc61a671024ebc73ff32", "score": "0.45801413", "text": "func NewPipelineAPI(pipelineService PipelineService) PipelineAPI {\n\treturn PipelineAPI{\n\t\tpipelineService: pipelineService,\n\t}\n}", "title": "" }, { "docid": "cc128f1bfd8b12e3151249206e9b7e08", "score": "0.45793578", "text": "func newStdoutPrinter(forMachines bool) tablePrinter {\n\tif forMachines {\n\t\treturn newMachineReadable(os.Stdout)\n\t}\n\treturn newHumanReadable(os.Stdout)\n}", "title": "" }, { "docid": "ca7d922228235ea07b9f70cc48b910f5", "score": "0.45679113", "text": "func newProber(runtimeService criapi.RuntimeService) *prober {\n\treturn &prober{\n\t\texec: execprobe.New(),\n\t\truntimeService: runtimeService,\n\t}\n}", "title": "" }, { "docid": "2642f14c772d22d00c449b05e2ee7ead", "score": "0.45638582", "text": "func New(options ...Option) *Info {\n\ti := &Info{\n\t\thyperlink: &ml.Hyperlink{},\n\t}\n\ti.Set(options...)\n\treturn i\n}", "title": "" }, { "docid": "baf72b6480d0a4a5fdd74b3859d9c4d3", "score": "0.45601818", "text": "func newInfoCommand(m *Main) *InfoCommand {\n\treturn &InfoCommand{\n\t\tStdin: m.Stdin,\n\t\tStdout: m.Stdout,\n\t\tStderr: m.Stderr,\n\t}\n}", "title": "" }, { "docid": "c20351f0dd981712dbbf790cbd15fee1", "score": "0.4556453", "text": "func New(stages ...StageRunner) *Pipeline {\n\treturn &Pipeline{\n\t\tstages: stages,\n\t}\n}", "title": "" }, { "docid": "7088a0383c53f55d695c4d70c84b8397", "score": "0.45514703", "text": "func (c *Coder) NewPlane(width uint32) {\n\tc.w = width\n\tc.run_index = 0\n}", "title": "" }, { "docid": "3e62c1c5bf01b338016c259c9f285afd", "score": "0.45504358", "text": "func NewInfo() *Info {\n\treturn &Info{\n\t\tAppName: AppName,\n\t\tAppVersion: AppVersion,\n\t\tGitRevision: GitRevision,\n\t\tUser: User,\n\t\tBuiltTime: BuiltTime,\n\t\tTag: Tag,\n\t\tType: Type,\n\t\tGoVersion: runtime.Version(),\n\t\tPlatform: fmt.Sprintf(\"%s %s\", runtime.GOOS, runtime.GOARCH),\n\t}\n}", "title": "" }, { "docid": "3f00e1f6f57e5c8b8cdc456ea0fa938d", "score": "0.45450556", "text": "func NewInfo(args ...interface{}) *LogMessage {\n\treturn NewMessage(field_severity.Type(field_severity.Info), args...)\n}", "title": "" }, { "docid": "fe34882e97aaffc2fa7289a8a7719298", "score": "0.45441735", "text": "func NewExportPipeline(config Config, options ...controller.Option) (*Exporter, error) {\n\treturn NewExporter(config, defaultController(config, options...))\n}", "title": "" }, { "docid": "0d659104da32efaebb1620ae7cc06ca7", "score": "0.4540641", "text": "func NewPipeline(ctx *pulumi.Context,\n\tname string, args *PipelineArgs, opts ...pulumi.ResourceOption) (*Pipeline, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ArtifactStores == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ArtifactStores'\")\n\t}\n\tif args.RoleArn == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RoleArn'\")\n\t}\n\tif args.Stages == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Stages'\")\n\t}\n\tvar resource Pipeline\n\terr := ctx.RegisterResource(\"aws:codepipeline/pipeline:Pipeline\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "8ed06ec529c627ffc964d71b57db05f5", "score": "0.45388857", "text": "func NewPipe(capacity int) (c *Pipe) {\n c = new(Pipe)\n c.quantity = 0\n c.capacity = capacity\n c.output = nil\n return c\n}", "title": "" }, { "docid": "7925388e1d2fd29c976cb424094c0341", "score": "0.45339236", "text": "func NewPipeline(logger log.Logger, stgs PipelineStages, plObserverMicroSeconds *prometheus.Observer) (*Pipeline, error) {\n\tst := []stages.Stage{}\n\tfor _, s := range stgs {\n\t\tstage, ok := s.(map[interface{}]interface{})\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"invalid YAML config, \"+\n\t\t\t\t\"make sure each stage of your pipeline is a YAML object (must end with a `:`), check stage `- %s`\", s)\n\t\t}\n\t\tif len(stage) > 1 {\n\t\t\treturn nil, errors.New(\"pipeline stage must contain only one key\")\n\t\t}\n\t\tfor key, config := range stage {\n\t\t\tname, ok := key.(string)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"pipeline stage key must be a string\")\n\t\t\t}\n\t\t\tswitch name {\n\t\t\tcase \"json\":\n\t\t\t\tjson, err := stages.NewJSON(logger, config)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"invalid json stage config\")\n\t\t\t\t}\n\t\t\t\tst = append(st, json)\n\t\t\tcase \"regex\":\n\t\t\t\tregex, err := stages.NewRegex(logger, config)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"invalid regex stage config\")\n\t\t\t\t}\n\t\t\t\tst = append(st, regex)\n\t\t\tcase \"docker\":\n\t\t\t\tdocker, err := stages.NewDocker(logger)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"invalid docker stage config\")\n\t\t\t\t}\n\t\t\t\tst = append(st, docker)\n\t\t\tcase \"cri\":\n\t\t\t\tcri, err := stages.NewCRI(logger)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"invalid cri stage config\")\n\t\t\t\t}\n\t\t\t\tst = append(st, cri)\n\t\t\t}\n\t\t}\n\t}\n\treturn &Pipeline{\n\t\tlogger: log.With(logger, \"component\", \"pipeline\"),\n\t\tstages: st,\n\t\tplObs: plObserverMicroSeconds,\n\t}, nil\n}", "title": "" }, { "docid": "0b5fcabc59abaf379b3a41201a13aed8", "score": "0.45257345", "text": "func NewTablePrinter(io *IO) TablePrinter {\n\tif io.isStdoutTTY {\n\t\treturn &ttyTablePrinter{\n\t\t\tout: io.out,\n\t\t\tmaxWidth: io.TerminalWidth(),\n\t\t}\n\t}\n\treturn &tsvTablePrinter{\n\t\tout: io.out,\n\t}\n}", "title": "" }, { "docid": "a1c7d19b3bf3c589a4e768e4add209ee", "score": "0.45203394", "text": "func (s GatewayRouter_routeForeignHostname_Results) NewInfo() (GatewayRouter_ForeignHostnameInfo, error) {\n\tss, err := NewGatewayRouter_ForeignHostnameInfo(capnp.Struct(s).Segment())\n\tif err != nil {\n\t\treturn GatewayRouter_ForeignHostnameInfo{}, err\n\t}\n\terr = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "46a1dd07ff6f657c7bb40d2b2b9ec86f", "score": "0.45161137", "text": "func NewPrinter(logger log.Logger, key string) *Printer {\n\treturn &Printer{\n\t\tlogger: logger,\n\t\tkey: key,\n\t}\n}", "title": "" }, { "docid": "123294458790303610b16e9d18fe7858", "score": "0.45103732", "text": "func NewMockPipeline(ctrl *gomock.Controller) *MockPipeline {\n\tmock := &MockPipeline{ctrl: ctrl}\n\tmock.recorder = &MockPipelineMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "123294458790303610b16e9d18fe7858", "score": "0.45103732", "text": "func NewMockPipeline(ctrl *gomock.Controller) *MockPipeline {\n\tmock := &MockPipeline{ctrl: ctrl}\n\tmock.recorder = &MockPipelineMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "d975f9337eb9f1147d3edf782e4216c2", "score": "0.45095846", "text": "func NewExportPipeline(\n\tconfig *upconfig.Config, options ...controller.Option,\n) *controller.Controller {\n\texporter := NewRawExporter(config)\n\toptions = append(options, controller.WithPusher(exporter))\n\n\t// Not stateful.\n\tctrl := controller.New(\n\t\tprocessor.New(simple.NewWithInexpensiveDistribution(), export.DeltaExportKindSelector()),\n\t\toptions...,\n\t)\n\n\treturn ctrl\n}", "title": "" }, { "docid": "cc70e0856f48426419ea8da32b9885f8", "score": "0.4493244", "text": "func CreatePipeline(p *gaia.CreatePipeline) {\n\tgitToken := p.GitHubToken\n\tp.GitHubToken = \"\"\n\tstoreService, _ := services.StorageService()\n\t// Define build process for the given type\n\tbP := newBuildPipeline(p.Pipeline.Type)\n\tif bP == nil {\n\t\t// Pipeline type is not supported\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"create pipeline failed. Pipeline type is not supported %s is not supported\", p.Pipeline.Type)\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Setup environment before cloning repo and command\n\terr := bP.PrepareEnvironment(p)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"cannot prepare build: %s\", err.Error())\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Clone git repo\n\terr = gitCloneRepo(p.Pipeline.Repo)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"cannot prepare build: %s\", err.Error())\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Update status of our pipeline build\n\tp.Status = pipelineCloneStatus\n\terr = storeService.CreatePipelinePut(p)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tgaia.Cfg.Logger.Error(\"cannot put create pipeline into store\", \"error\", err.Error())\n\t\treturn\n\t}\n\n\t// Run compile process\n\terr = bP.ExecuteBuild(p)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Update status of our pipeline build\n\tp.Status = pipelineCompileStatus\n\terr = storeService.CreatePipelinePut(p)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tgaia.Cfg.Logger.Error(\"cannot put create pipeline into store\", \"error\", err.Error())\n\t\treturn\n\t}\n\n\t// Run update if needed\n\terr = updatePipeline(&p.Pipeline)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"cannot update pipeline: %s\", err.Error())\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Try to get pipeline jobs to check if this pipeline is valid.\n\tschedulerService, _ := services.SchedulerService()\n\tif err = schedulerService.SetPipelineJobs(&p.Pipeline); err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"cannot validate pipeline: %s\", err.Error())\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Update status of our pipeline build\n\tp.Status = pipelineValidateStatus\n\terr = storeService.CreatePipelinePut(p)\n\tif err != nil {\n\t\tgaia.Cfg.Logger.Error(\"cannot put create pipeline into store\", \"error\", err.Error())\n\t\treturn\n\t}\n\n\tp.Pipeline.TriggerToken = security.GenerateRandomUUIDV5()\n\n\t// Save the generated pipeline data\n\terr = bP.SavePipeline(&p.Pipeline)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"failed to save the created pipeline: %s\", err.Error())\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Copy compiled binary to plugins folder which is the final step\n\terr = bP.CopyBinary(p)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tp.Output = fmt.Sprintf(\"cannot copy compiled binary: %s\", err.Error())\n\t\t_ = storeService.CreatePipelinePut(p)\n\t\treturn\n\t}\n\n\t// Set create pipeline status to complete\n\tp.Status = pipelineCompleteStatus\n\tp.StatusType = gaia.CreatePipelineSuccess\n\terr = storeService.CreatePipelinePut(p)\n\tif err != nil {\n\t\tp.StatusType = gaia.CreatePipelineFailed\n\t\tgaia.Cfg.Logger.Error(\"cannot put create pipeline into store\", \"error\", err.Error())\n\t\treturn\n\t}\n\n\tif !gaia.Cfg.Poll && len(gitToken) > 0 {\n\t\t// if there is a githubtoken provided, that means that a webhook was requested to be added.\n\t\terr = createGithubWebhook(gitToken, p.Pipeline.Repo, nil)\n\t\tif err != nil {\n\t\t\tgaia.Cfg.Logger.Error(\"error while creating webhook for repository\", \"error\", err.Error())\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e130b2376d00cf2b5711f7094e00828", "score": "0.44931003", "text": "func NewPipe(s Stage) *Pipe {\n return &Pipe{ Vertex{ Data: s, } }\n}", "title": "" }, { "docid": "10bf1b9ebdf4dc204cc8ee31a8f2ab24", "score": "0.44894013", "text": "func newPipelineConfig(cfg rest.Config, stop <-chan struct{}) (*pipelineConfig, error) {\n\tbc, err := pipelineset.NewForConfig(&cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Ensure the pipeline CRD is deployed\n\t// TODO(fejta): probably a better way to do this\n\tif _, err := bc.TektonV1beta1().PipelineRuns(\"\").List(context.TODO(), metav1.ListOptions{Limit: 1}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Assume watches receive updates, but resync every 30m in case something wonky happens\n\tbif := pipelineinfo.NewSharedInformerFactory(bc, 30*time.Minute)\n\tbif.Tekton().V1beta1().PipelineRuns().Lister()\n\tgo bif.Start(stop)\n\treturn &pipelineConfig{\n\t\tclient: bc,\n\t\tinformer: bif.Tekton().V1beta1().PipelineRuns(),\n\t}, nil\n}", "title": "" }, { "docid": "e00a70af73a2589a8fabe8c1e4fe6fdd", "score": "0.4485482", "text": "func newInfo() *info {\n\tinf := new(info)\n\tinf.Pos = make(map[string]int)\n\tinf.Dicts = make(map[string]map[string]uint64)\n\tinf.DictsRev = make(map[string]map[uint64]string)\n\treturn inf\n}", "title": "" }, { "docid": "ad19b9ac15ffb65ffcb2afe0661f9f37", "score": "0.44838485", "text": "func NewGroovePipeline(qs query.QueriesSource, ss stats.StatisticsSource, components ...func() interface{}) Pipeline {\n\tgp := Pipeline{\n\t\tQueriesSource: qs,\n\t\tStatisticsSource: ss,\n\t}\n\n\tfor _, component := range components {\n\t\tval := component()\n\t\tswitch v := val.(type) {\n\t\tcase []preprocess.QueryProcessor:\n\t\t\tgp.Preprocess = v\n\t\tcase []analysis.Measurement:\n\t\t\tgp.Measurements = v\n\t\tcase []output.MeasurementFormatter:\n\t\t\tgp.MeasurementFormatters = v\n\t\tcase preprocess.QueryTransformations:\n\t\t\tgp.Transformations = v\n\t\t}\n\t}\n\n\treturn gp\n}", "title": "" }, { "docid": "0e9be933ce86fab58101a41325796ec1", "score": "0.4479289", "text": "func (x *fastReflection_ProjectInfo) New() protoreflect.Message {\n\treturn new(fastReflection_ProjectInfo)\n}", "title": "" }, { "docid": "5cd5d4ee3e70c31e63383dc9c1d86bcb", "score": "0.4478946", "text": "func NewCfnPipeline(scope awscdk.Construct, id *string, props *CfnPipelineProps) CfnPipeline {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnPipeline{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_sagemaker.CfnPipeline\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" } ]
ebde757d6b137d107847101b841c0840
create the reproduction pool that creates the next generation
[ { "docid": "60cc69fcd5afe12c0524eeba1f35389d", "score": "0.63263047", "text": "func createPool(population []Organism, target *image.RGBA) (pool []Organism) {\n\tpool = make([]Organism, 0)\n\t// get top best fitting organisms\n\tsort.SliceStable(population, func(i, j int) bool {\n\t\treturn population[i].Fitness < population[j].Fitness\n\t})\n\ttop := population[0 : PoolSize+1]\n\t// if there is no difference between the top organisms, the population is stable\n\t// and we can't get generate a proper breeding pool so we make the pool equal to the\n\t// population and reproduce the next generation\n\tif top[len(top)-1].Fitness-top[0].Fitness == 0 {\n\t\tpool = population\n\t\treturn\n\t}\n\t// create a pool for next generation\n\tfor i := 0; i < len(top)-1; i++ {\n\t\tnum := (top[PoolSize].Fitness - top[i].Fitness)\n\t\tfor n := int64(0); n < num; n++ {\n\t\t\tpool = append(pool, top[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "d94ade4e3c3c82972aed754720f611fc", "score": "0.6434193", "text": "func GenerateNewPool(numOfRoutines int, isResultProcessorRequired bool) *Pool {\n\tpoolObj := &Pool{NumOfRoutines: numOfRoutines}\n\tpoolObj.JobChannel = make(chan Job, numOfRoutines)\n\tpoolObj.ResultChannel = make(chan Result, numOfRoutines)\n\tif isResultProcessorRequired {\n\t\tpoolObj.IsResultProcessorRequired = true\n\t}\n\tpoolObj.Done = make(chan bool)\n\treturn poolObj\n}", "title": "" }, { "docid": "a99f92a85b4197b3a7f4955708eb34ad", "score": "0.63928634", "text": "func createPool(population []Organism, target *image.RGBA) (pool []Organism) {\n\tpool = make([]Organism, 0)\n\n\t// get top 10 best fitting DNAs\n\tsort.SliceStable(population, func(i, j int) bool {\n\t\treturn population[i].Fitness < population[j].Fitness\n\t})\n\ttop := population[0 : PoolSize+1]\n\tif top[len(top)-1].Fitness-top[0].Fitness == 0 {\n\t\tpool = population\n\t\treturn\n\t}\n\t// create a pool for next generation\n\tfor i := 0; i < len(top)-1; i++ {\n\t\tnum := (top[PoolSize].Fitness - top[i].Fitness)\n\t\tfor n := int64(0); n < num; n++ {\n\t\t\tpool = append(pool, top[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "fb1c091f9e8401c80b6cbbc767fda3d6", "score": "0.5987323", "text": "func newPool(capacity int, octopus *Octopus) *pool {\n\tnewPool := pool{\n\t\tstatus: PoolOpen,\n\t\tcapacity: capacity,\n\t\tavailableWorkers: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn new(worker)\n\t\t\t},\n\t\t},\n\t\toctopus: octopus,\n\t}\n\n\treturn &newPool\n}", "title": "" }, { "docid": "c67960518240fe55a312e6e32d35974a", "score": "0.5944674", "text": "func NewPool(n int) *Pool {\n\twork := make(chan func())\n\n\tp := &Pool{work: work, finish: make(chan struct{})}\n\n\tfor ; n > 0; n-- {\n\t\tp.wg.Add(1)\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase f := <-work:\n\t\t\t\t\tf()\n\t\t\t\tcase <-p.finish:\n\t\t\t\t\tp.wg.Done()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "fab80e9fc0f42277d254568d81d7f852", "score": "0.5918152", "text": "func NewPool(c Conveyor, num int, options Options) (workers Workers) {\n\tfor i := 0; i < num; i++ {\n\t\tw := New(c, options)\n\t\tworkers = append(workers, w)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7162653ad877b083c53e16037c5e37fe", "score": "0.5843875", "text": "func NewPool(logger log.Logger, numWorkers int, src capture.PacketSource, handler Handler) *Pool {\n\tp := &Pool{\n\t\tlogger: logger,\n\t\tnumWorkers: numWorkers,\n\t\tsrc: src,\n\t\treadyQ: make(workerQueue, numWorkers),\n\t}\n\n\tfor i := 0; i < numWorkers; i++ {\n\t\tdecoder := newDecoder(logger, handler)\n\t\tp.startWorker(p.readyQ, decoder.decodeBatch, 1000, 8*1024*1024, i)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "586c355245a9d73df76508a11bac9cf1", "score": "0.5664671", "text": "func DynamicPool(id string, task Task, max int) Stage {\n\tif max <= 0 {\n\t\treturn nil\n\t}\n\n\ttokenPool := make(chan struct{}, max)\n\tfor i := 0; i < max; i++ {\n\t\ttokenPool <- struct{}{}\n\t}\n\n\treturn &dynamicPool{\n\t\tid: id,\n\t\ttask: task,\n\t\ttokenPool: tokenPool,\n\t}\n}", "title": "" }, { "docid": "7f078fdac7bf29183caa2c7bec60654b", "score": "0.56244767", "text": "func Create(numVals int, numNormVals int) *RandPool {\n\trp := RandPool{\n\t\tmake([]float64, numVals),\n\t\t0,\n\t\tmake([]float64, numNormVals),\n\t\t0,\n\t}\n\n\tfor i := 0; i < numVals; i++ {\n\t\trp.vals[i] = rand.Float64()\n\t}\n\tfor i := 0; i < numNormVals; i++ {\n\t\trp.normVals[i] = rand.NormFloat64()\n\t}\n\treturn &rp\n}", "title": "" }, { "docid": "55136e42ef488a9dee9db5a3a5004d42", "score": "0.5603171", "text": "func randomSetup(r *rand.Rand) (Pool, Candidate) {\n\tpool := Pool{\n\t\tTotalSupply: 0,\n\t\tBondedShares: sdk.ZeroRat,\n\t\tUnbondedShares: sdk.ZeroRat,\n\t\tBondedPool: 0,\n\t\tUnbondedPool: 0,\n\t\tInflationLastTime: 0,\n\t\tInflation: sdk.NewRat(7, 100),\n\t}\n\n\tcandidate := randomCandidate(r)\n\tif candidate.Status == Bonded {\n\t\tpool.BondedShares = pool.BondedShares.Add(candidate.Assets)\n\t\tpool.BondedPool += candidate.Assets.Evaluate()\n\t} else {\n\t\tpool.UnbondedShares = pool.UnbondedShares.Add(candidate.Assets)\n\t\tpool.UnbondedPool += candidate.Assets.Evaluate()\n\t}\n\treturn pool, candidate\n}", "title": "" }, { "docid": "009cf69b9f0eb823d193333be3e42601", "score": "0.55030483", "text": "func NewPool(n int, prespawn bool) *WorkerPool {\n\tp := &WorkerPool{\n\t\twork: make(chan func()),\n\t\tlimiter: make(chan struct{}, n),\n\t\ttimeout: make(chan struct{}),\n\t\twait: sync.WaitGroup{},\n\t\tcloseonce: sync.Once{},\n\t\tclose: make(chan struct{}),\n\t}\n\n\tif prespawn {\n\t\t// Make a wait group to ensure all the workers get started and pend\n\t\tvar w sync.WaitGroup\n\t\tw.Add(1)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tp.Do(func() {\n\t\t\t\tw.Wait()\n\t\t\t})\n\t\t}\n\t\tw.Done()\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "b2570f5f7f4ec323835adff21ab6fe52", "score": "0.5497227", "text": "func NewPool() Pool {\n\treturn &pool{\n\t\t// xor: sync.Pool{\n\t\t// \tNew: func() interface{} {\n\t\t// \t\treturn &XORChunk{b: bstream{}}\n\t\t// \t},\n\t\t// },\n\t\tgdc: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &GroupDiskChunk1{b: &bstream{}}\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6ceb66ec6ebf0e395e33476c19c8cadd", "score": "0.5494499", "text": "func initPool() {\n\tpool = &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\tfmt.Println(\"Returning new A\")\n\t\t\treturn new(A)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "df93c957de1cc240f28ad083fafa0bc9", "score": "0.5485792", "text": "func NewPool(tokens sdk.BigInt) Pool {\n\treturn Pool{\n\t\tTokens: tokens,\n\t}\n}", "title": "" }, { "docid": "9b4585fa318531abf597f9e1b889b42e", "score": "0.5472034", "text": "func Gen(size int) []*G {\n\tgraphs := map[int][]*G{}\n\tgraphs[1] = []*G{\n\t\t&G{\n\t\t\tEs: []*E{pool.Get(1, 1)},\n\t\t},\n\t}\n\tfor i := 2; i <= size; i++ {\n\t\tch := make(chan []*G)\n\n\t\t// For each graph of size n - 1, we can add a node N and generate\n\t\t// multiple new graphs of size n.\n\t\t//\n\t\t// If we have k graph of size n - 1, then we start k async processes\n\t\t// where each of them creates multiple graphs by adding new node N.\n\t\tn := i // new node N we are adding.\n\t\tk := len(graphs[n-1]) // number of n - 1 graphs we have where we need to ad new node N.\n\t\tfor j := 0; j < k; j++ {\n\t\t\t// k async processes.\n\t\t\tgo genUsing(graphs[n-1][j], n, ch)\n\n\t\t\t// Setting the used value (graph) to nil improves memory.\n\t\t\tgraphs[n-1][j] = nil\n\t\t}\n\n\t\t// Since the number of graphs exponentially increases, let's remove\n\t\t// the generation n - 1 since we don't need it any more, and save some\n\t\t// (a lot) of memory.\n\t\tdelete(graphs, n-1)\n\n\t\t// Aggregates all graph from all parallel processes.\n\t\t// Reads output from the k async processes.\n\t\tfor j := 0; j < k; j++ {\n\t\t\ttoAdd := <-ch\n\t\t\tgraphs[n] = append(graphs[n], toAdd...)\n\t\t}\n\t}\n\n\tch := make(chan *G)\n\tfor _, g := range graphs[size] {\n\t\tgo clean(g, ch)\n\t}\n\n\txs := []*G{}\n\tfor range graphs[size] {\n\t\tcleaned := <-ch\n\t\txs = append(xs, cleaned)\n\t}\n\n\treturn xs\n}", "title": "" }, { "docid": "902125af8b799bd5fa72ebb788331dcc", "score": "0.5453235", "text": "func initPool(ac *atmi.ATMICtx) error {\n\n\tM_freechan = make(chan int, M_workers)\n\n\tfor i := 0; i < M_workers; i++ {\n\n\t\tctx, err := atmi.NewATMICtx()\n\n\t\tif err != nil {\n\t\t\tac.TpLogError(\"Failed to create context: %s\", err.Message())\n\t\t\treturn err\n\t\t}\n\n\t\tM_ctxs = append(M_ctxs, ctx)\n\n\t\t//Submit the free ATMI context\n\t\tM_freechan <- i\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d08c9e29966fe6630b7c97b362f7d5d", "score": "0.5453065", "text": "func initPool() {\n\t// avoid 0.0\n\tindexOfPool = uint16(1)\n\tfor ; indexOfPool <= uint16(255); indexOfPool++ {\n\t\tip := defaultNetworkPrefix + getSubNet(indexOfPool)\n\t\tunused = append(unused, ip)\n\t}\n}", "title": "" }, { "docid": "1ed590203b1e8003fb72380406df01f7", "score": "0.5448804", "text": "func NewGoroutinePool(N int) *GoroutinePool {\n\treturn &GoroutinePool{\n\t\tpool: make(chan struct{}, N),\n\t\twg: sync.WaitGroup{},\n\t\tresCh: make(chan int64, N),\n\t\tcounter: 0,\n\t}\n}", "title": "" }, { "docid": "7e07fdc948d125da47cf4133eb305b57", "score": "0.5429513", "text": "func createWorkerPool(noOfWorkers int) {\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < noOfWorkers; i++ {\n\t\twg.Add(1)\n\t\tgo createWorker(&wg)\n\t}\n\twg.Wait()\n\tclose(results)\n}", "title": "" }, { "docid": "e6be8ad9c04706348a1d766b152c92a1", "score": "0.5415457", "text": "func FillPool(num int) {\n\tif num <= 0 {\n\t\tnum = 5\n\t}\n\n\tRiakPool.index = 0\n\tRiakPool.ConnQueue = make([]*RiakConn, num)\n\tserverString := riakServerString()\n\tfor i := 0; i < num; i++ {\n\t\tconn, err := dialServer(serverString)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tRiakPool.Push(&RiakConn{conn, SLEEPING, bytes.NewBuffer(make([]byte, 64000)), 0})\n\t}\n}", "title": "" }, { "docid": "aed4670f4b1c5394790dfb963a19570d", "score": "0.5390988", "text": "func initPool() {\n\tpool = &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\t//fmt.Println(\"返回A\")\n\t\t\treturn new(Person)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8d2c4825f3fd941243097851f1ebb955", "score": "0.538273", "text": "func NewIntPool(min int, count int, step int, reserved []int) chan int {\n\tpool := make(chan int, count+1) // +1 means the last write doesn't block\n\n\t// fill pool\n\tfor i := 0; i < count; i++ {\n\t\tnum := min + (i * step)\n\t\tif indexOfInt(reserved, num) == -1 {\n\t\t\tpool <- num\n\t\t}\n\t}\n\n\treturn pool\n}", "title": "" }, { "docid": "e4691900681d2972b3fc956cc89c4403", "score": "0.5380035", "text": "func newGenerator(state common.Hash, database *tileDatabase, stat *statistic) *generator {\n\tg := &generator{\n\t\tstate: state,\n\t\trequests: make(map[common.Hash]*tileRequest),\n\t\tdeliveries: make(map[common.Hash]*tileDelivery),\n\t\texternRefs: make(map[common.Hash]map[common.Hash]int),\n\t\tdatabase: database,\n\t\tqueue: prque.New(nil),\n\t\tstat: stat,\n\t}\n\tlog.Debug(\"New generator\", \"state\", state)\n\treturn g\n}", "title": "" }, { "docid": "2a7a1e6555f7857d7f200425deb40037", "score": "0.53764343", "text": "func (p *policy) buildPoolsByTopology() error {\n\tvar n Node\n\n\tif err := p.checkHWTopology(); err != nil {\n\t\treturn err\n\t}\n\n\tsocketCnt := p.sys.SocketCount()\n\tdieCnt := 0\n\tnodeCnt := p.sys.NUMANodeCount()\n\tif nodeCnt < 2 {\n\t\tnodeCnt = 0\n\t}\n\tmemNodeCnt := 0\n\tif nodeCnt > 0 {\n\t\tfor _, id := range p.sys.NodeIDs() {\n\t\t\tif p.sys.Node(id).GetMemoryType() == system.MemoryTypePMEM {\n\t\t\t\tmemNodeCnt++\n\t\t\t}\n\t\t}\n\t}\n\tfor _, id := range p.sys.PackageIDs() {\n\t\tpkg := p.sys.Package(id)\n\t\tif n := len(pkg.DieIDs()); n > 1 {\n\t\t\tdieCnt += n\n\t\t}\n\t}\n\tpoolCnt := socketCnt + dieCnt + nodeCnt - memNodeCnt + map[bool]int{false: 0, true: 1}[socketCnt > 1]\n\n\tp.nodes = make(map[string]Node, poolCnt)\n\tp.pools = make([]Node, poolCnt)\n\n\t// create virtual root if necessary\n\tif socketCnt > 1 {\n\t\tp.root = p.NewVirtualNode(\"root\", nilnode)\n\t\tp.nodes[p.root.Name()] = p.root\n\t}\n\n\t// die nodes by NUMA id\n\tdies := map[system.ID]Node{}\n\n\t// create nodes for sockets\n\tsockets := make(map[system.ID]Node, socketCnt)\n\tfor _, id := range p.sys.PackageIDs() {\n\t\tif socketCnt > 1 {\n\t\t\tn = p.NewSocketNode(id, p.root)\n\t\t} else {\n\t\t\tn = p.NewSocketNode(id, nilnode)\n\t\t\tp.root = n\n\t\t}\n\t\tp.nodes[n.Name()] = n\n\t\tsockets[id] = n\n\n\t\tif dieCnt > 0 {\n\t\t\tpkg := p.sys.Package(id)\n\t\t\tfor _, dieid := range pkg.DieIDs() {\n\t\t\t\tdie := p.NewDieNode(dieid, n)\n\t\t\t\tfor _, nodeid := range pkg.DieNodeIDs(dieid) {\n\t\t\t\t\tdies[nodeid] = die\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpmemNodes := map[system.ID]system.Node{}\n\tdramNodes := map[system.ID]system.Node{}\n\n\t// create nodes for NUMA nodes\n\tif nodeCnt > 0 {\n\t\tfor _, id := range p.sys.NodeIDs() {\n\t\t\tvar parent Node\n\n\t\t\tsysnode := p.sys.Node(id)\n\t\t\tswitch sysnode.GetMemoryType() {\n\t\t\tcase system.MemoryTypePMEM:\n\t\t\t\tpmemNodes[id] = sysnode\n\t\t\t\tcontinue // don't create pool nodes for CPU-less NUMA nodes\n\t\t\tcase system.MemoryTypeDRAM:\n\t\t\t\tdramNodes[id] = sysnode\n\t\t\t}\n\n\t\t\tif len(dies) > 0 {\n\t\t\t\tparent = dies[id]\n\t\t\t} else {\n\t\t\t\tparent = sockets[p.sys.Node(id).PackageID()]\n\t\t\t}\n\n\t\t\tn = p.NewNumaNode(id, parent)\n\t\t\tp.nodes[n.Name()] = n\n\t\t}\n\t}\n\n\t// get closest per-PMEM DRAM nodes (sorted by system.ID if there are multiple)\n\tpmemClosest := map[system.ID][]system.Node{}\n\tfor id, sysnode := range pmemNodes {\n\t\tvar closest []system.Node\n\t\tfor _, dram := range dramNodes {\n\t\t\tif len(closest) < 1 {\n\t\t\t\tclosest = []system.Node{dram}\n\t\t\t} else {\n\t\t\t\tcurr := closest[0]\n\t\t\t\tcurrDist := sysnode.DistanceFrom(curr.ID())\n\t\t\t\tdramDist := sysnode.DistanceFrom(dram.ID())\n\t\t\t\tswitch {\n\t\t\t\tcase currDist == dramDist:\n\t\t\t\t\tclosest = append(closest, dram)\n\t\t\t\tcase dramDist < currDist:\n\t\t\t\t\tclosest = []system.Node{dram}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsort.Slice(closest, func(i, j int) bool {\n\t\t\tiid := closest[i].ID()\n\t\t\tjid := closest[j].ID()\n\t\t\treturn iid < jid\n\t\t})\n\t\tpmemClosest[id] = closest\n\t}\n\n\t// assign PMEM nodes to closest DRAM node with least PMEM assigned\n\tassigned := map[system.ID][]system.ID{}\n\tfor id, closest := range pmemClosest {\n\t\tvar taker system.Node\n\t\tfor _, dram := range closest {\n\t\t\tif taker == nil {\n\t\t\t\ttaker = dram\n\t\t\t} else {\n\t\t\t\tif len(assigned[taker.ID()]) > len(assigned[dram.ID()]) {\n\t\t\t\t\ttaker = dram\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif taker == nil {\n\t\t\tlog.Panic(\"failed to assign CPU-less PMEM node #%d to any DRAM node with CPUs\", id)\n\t\t}\n\t\tassigned[taker.ID()] = append(assigned[taker.ID()], id)\n\t\tlog.Info(\"*** PMEM node #%d assigned to #%d (distance %v)\", id, taker.ID(),\n\t\t\ttaker.DistanceFrom(id))\n\t}\n\n\t// enumerate nodes, calculate tree depth, discover node resource capacity\n\tp.root.DepthFirst(func(n Node) error {\n\t\tp.pools[p.nodeCnt] = n\n\t\tn.(*node).id = p.nodeCnt\n\t\tp.nodeCnt++\n\n\t\tif p.depth < n.(*node).depth {\n\t\t\tp.depth = n.(*node).depth\n\t\t}\n\n\t\tn.DiscoverSupply()\n\t\tn.DiscoverMemset()\n\n\t\t// assign CPU-less PMEM nodes if we have any\n\t\tif n.Kind() == NumaNode {\n\t\t\t// gosh, this whole Node/*node is seriously fscked up...\n\t\t\tnuma := n.(*node).self.node.(*numanode)\n\t\t\tnuma.AssignPMEMNodes(assigned[numa.id])\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "b88b7e9f2bca022aae1eda73bef4d7e8", "score": "0.53708076", "text": "func newProcessorPool(stage *stage) *processorPool {\n\n\tprocMsgPaths := make(map[MsgRouteParam][]IProcessorForPool)\n\n\treturn &processorPool{\n\t\tstg: stage,\n\t\tshortCircuit: false,\n\t\tprocessorFactory: newProcessorFactory(stage),\n\t\tprocMsgPaths: procMsgPaths,\n\t}\n}", "title": "" }, { "docid": "dbf7f05292160118a98bd19a7b321628", "score": "0.53486407", "text": "func New(n, queueSize int) *Pool {\n\tpool := &Pool{\n\t\tconcurrency: n,\n\t\tqueue: make(chan Job, queueSize),\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tw := newWorker(i+1, pool.queue, &pool.wg)\n\t\tw.start()\n\t}\n\n\treturn pool\n}", "title": "" }, { "docid": "6b59aafe6c6af7ea6661d5952b5ebfda", "score": "0.53410524", "text": "func NewPool(builder Builder, opts ...Option) (pool *Pool, err error) {\n\topt := getDefaultOpt()\n\tfor _, f := range opts {\n\t\tf(opt)\n\t}\n\n\tif opt.Debug {\n\t\tprometheus.MustRegister(statistics)\n\t\t//prometheus.MustRegister(statistics_put)\n\t\tprometheus.MustRegister(connection)\n\t}\n\n\tpool = &Pool{\n\t\tmux: new(sync.RWMutex),\n\t\tbuilder: builder,\n\t\tcond: sync.NewCond(internal.NewSpinLock()),\n\t\tconns: make([]*grpcConn, 0, opt.MaxIdle),\n\t\topt: opt,\n\t\tr: rand.New(rand.NewSource(time.Now().UnixNano())),\n\t\tch: make(chan struct{}, 0),\n\t}\n\n\tfor i := 0; i < pool.opt.MaxIdle; i++ {\n\t\tconn, err := pool.builder()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tgconn := newGrpcConn(pool, conn)\n\t\tpool.conns = append(pool.conns, gconn)\n\t\tif opt.Debug {\n\t\t\tconnection.WithLabelValues(\"conn\").Add(1)\n\t\t}\n\t}\n\n\tgo pool.cleanPeriodically()\n\treturn\n}", "title": "" }, { "docid": "1c8999232a59e7d5921d05c6edc61a8a", "score": "0.5336043", "text": "func NewPool(concurrency int) *Pool {\n\treturn &Pool{\n\t\tconcurrency: concurrency,\n\t\tCollector: make(chan *Task, 1000),\n\t}\n}", "title": "" }, { "docid": "360670efe36ee8917e4b737c783ac85b", "score": "0.533325", "text": "func newPool(sensor instana.TracerLogger) *redis.Pool {\n\treturn &redis.Pool{\n\t\tMaxIdle: 3,\n\t\tIdleTimeout: 200 * time.Second,\n\t\tDial: func() (redis.Conn, error) {\n\t\t\treturn &instaRedigoConn{Conn: &MockConn{}, sensor: sensor, address: \":7001\", prevSpan: nil}, nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "723af4a44818450b59e5fbb848d7b297", "score": "0.5326683", "text": "func (p *poolPolicy) createPools() error {\n\tlog.Info(\"initializing CPU pools\")\n\n\tmetrics, err := p.createMetricsApi()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.pools, err = pool.NewPoolSet(nil, metrics)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3778ce7bd02d7ebd02f999ac146c5fbf", "score": "0.5289944", "text": "func NewPool(\n\tdialer DialFunc,\n\tcapacity int,\n\tlogger Logger,\n\tbreakerFunc BreakerFunc,\n\tclock glock.Clock,\n) Pool {\n\tp := &pool{\n\t\tdialer: dialer,\n\t\tcapacity: capacity,\n\t\tlogger: logger,\n\t\tbreakerFunc: breakerFunc,\n\t\tclock: clock,\n\t\tconnections: make(chan Conn, capacity),\n\t\tnilConnections: make(chan Conn, capacity),\n\t}\n\n\t// Set the capacity of the pool. Each time a nil value is borrowed, a new\n\t// connection is established and used in its place.\n\n\tfor i := 0; i < p.capacity; i++ {\n\t\tp.nilConnections <- nil\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "b2e55e79c47c1cf2ee86074fe0212072", "score": "0.5282588", "text": "func NewPool(notBonded, bonded sdk.Int) Pool {\n\treturn Pool{\n\t\tNotBondedTokens: notBonded,\n\t\tBondedTokens: bonded,\n\t}\n}", "title": "" }, { "docid": "e8c29d0270b769b0a68103dbdbc58942", "score": "0.5279403", "text": "func NewParameterPool[T any](\n\tlogger log.StandardLogger,\n\tscheduler *Scheduler,\n\tpersistence Persistence[T],\n\tpoolSize int,\n\tgenerateFn func(context.Context) *T,\n\tgenerateDelay time.Duration,\n) *ParameterPool[T] {\n\tpool := make(chan *Persisted[T], poolSize)\n\n\tall, err := persistence.ReadAll()\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to read parameters from persistence: [%w]\", err)\n\t}\n\n\tlogger.Debugf(\"read [%d] parameters from persistence\", len(all))\n\n\tfor i, parameter := range all {\n\t\t// Load to the pool only the number of the parameters read from the persistence\n\t\t// that can fit within the pool's size, to avoid locking on writing to the\n\t\t// channel.\n\t\tif i >= poolSize {\n\t\t\tbreak\n\t\t}\n\n\t\tpool <- parameter\n\t}\n\n\tlogger.Infof(\"loaded [%d] parameters from persistence\", len(pool))\n\n\tscheduler.compute(func(ctx context.Context) {\n\t\tstart := time.Now()\n\n\t\tgenerated := generateFn(ctx)\n\n\t\t// The generateFn returns nil when the context is done. We should not\n\t\t// add nil element to the pool.\n\t\tif generated == nil {\n\t\t\treturn\n\t\t}\n\n\t\tpersisted, err := persistence.Save(generated)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\n\t\t\t\t\"failed to persist generated parameter: [%w]\",\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\n\t\tselect {\n\t\tcase pool <- persisted:\n\t\tcase <-ctx.Done():\n\t\t\t// Do not wait on writing to the full channel if the context for\n\t\t\t// the generateFn was cancelled. This way we can avoid multiple\n\t\t\t// generator goroutines hanging on writing to the channel in case\n\t\t\t// the generator was stopped and resumed multiple times and the\n\t\t\t// pool was full for all that time.\n\t\t\treturn\n\t\t}\n\n\t\tlogger.Infof(\n\t\t\t\"generated new parameters, took: [%s] current pool size: [%d]\",\n\t\t\ttime.Since(start),\n\t\t\tlen(pool),\n\t\t)\n\n\t\t// Wait some time after delivering the result regardless if the delivery\n\t\t// took some time or not. We want to ensure all other processes of the\n\t\t// client receive access to CPU.\n\t\ttime.Sleep(generateDelay)\n\t})\n\n\treturn &ParameterPool[T]{\n\t\tpersistence: persistence,\n\t\tpool: pool,\n\t}\n}", "title": "" }, { "docid": "f76f9fa31b83a51bad040a3fe4219dcd", "score": "0.52737504", "text": "func Prng(t interface{ Name() string }, args ...interface{}) *rand.Rand {\n\treturn rand.New(rand.NewSource(Seed(t.Name(), args...)))\n}", "title": "" }, { "docid": "6cad679164b3ce0f6fdcb1108d8e5901", "score": "0.5267159", "text": "func createPool(dbIndex int) (*pool.Pool, error) {\n\tp, err := pool.NewCustom(gRedisConfig.Network, gRedisConfig.Addr, gRedisConfig.PoolSize,\n\t\tfunc(network, addr string) (*redis.Client, error) {\n\t\t\tconn, err := redis.Dial(network, addr)\n\t\t\tif err == nil {\n\t\t\t\tconn.Cmd(\"SELECT\", dbIndex)\n\t\t\t}\n\t\t\treturn conn, err\n\t\t},\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//simple tests\n\tconn, err := p.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer p.Put(conn)\n\treturn p, nil\n}", "title": "" }, { "docid": "70a97a134ba08b604a2a18891d0b7292", "score": "0.52615494", "text": "func Pconnect(PoolSize string) (*Pool){\n var Size int\n count:=len(PoolSize)\n\tif count>0{\n opt:=strings.Split(PoolSize,\"=\")\n\t if(opt[0] == \"PoolSize\"){ \n\t\t Size,_=strconv.Atoi(opt[1])\n\t }else{\n\t fmt.Println(\"Not a valid parameter\")\n\t }\n\t} else {\n\t Size=100\n\t}\n p:=&Pool{\n\t availablePool: make(map[string] []*DBP),\n\t\tusedPool : make(map[string] []*DBP),\n\t\tPoolSize : Size,\n }\n\tb=p\n\t\n return p\n}", "title": "" }, { "docid": "2bdd1ee17e9c7d7821d0cd2cc4b7fe6a", "score": "0.52568716", "text": "func NewPool(concurrency int) *Pool {\r\n\treturn &Pool{\r\n\t\tconcurrency: concurrency,\r\n\t\tJobsChan: make(chan *Job, 100),\r\n\t}\r\n}", "title": "" }, { "docid": "eb0b213f3423c9f585b19f3e1b4e3ae0", "score": "0.52497417", "text": "func NewPool(ctx *pulumi.Context,\n\tname string, args *PoolArgs, opts ...pulumi.ResourceOption) (*Pool, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AccountName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AccountName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.ServiceLevel == nil {\n\t\targs.ServiceLevel = pulumi.String(\"Premium\")\n\t}\n\tif args.Size == nil {\n\t\targs.Size = pulumi.Float64(4398046511104)\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20190501:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20170815:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20170815:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20190601:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20190601:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20190701:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20190701:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20190801:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20190801:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20191001:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20191001:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20191101:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20191101:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200201:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200201:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200301:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200301:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200501:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200501:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200601:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200601:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200701:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200701:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200801:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200801:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20200901:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20200901:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20201101:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20201101:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20201201:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20201201:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20210201:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20210201:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20210401:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20210401:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:netapp/v20210401preview:Pool\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:netapp/v20210401preview:Pool\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Pool\n\terr := ctx.RegisterResource(\"azure-native:netapp/v20190501:Pool\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "399786e4459cf8a4df03918acc5f5dee", "score": "0.5246995", "text": "func newResourcePool(maxSize uint64, expiredFn expiredFunc, closeFn closeFunc, pruneInterval time.Duration) *resourcePool {\r\n\trp := &resourcePool{\r\n\t\tdeque: list.New(),\r\n\t\tmaxSize: maxSize,\r\n\t\texpiredFn: expiredFn,\r\n\t\tcloseFn: closeFn,\r\n\t\tpruneInterval: pruneInterval,\r\n\t}\r\n\trp.pruneTimer = time.AfterFunc(rp.pruneInterval, rp.Prune)\r\n\treturn rp\r\n}", "title": "" }, { "docid": "764f83dc0c32c56e6a6afcb7963a6edd", "score": "0.5219451", "text": "func main() {\n\n\t//the pool pattern is a way to create and make available a fixed number, a pool, of things for use. It's commonly used to constrain the creation of things that are expensive\n\tmyPool := sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\tfmt.Println(\"Creating a new instance\")\n\t\t\treturn struct{}{}\n\t\t},\n\t}\n\n\tmyPool.Get() // this data type can be safely used by multiple goroutines\n\tinstance := myPool.Get()\n\n\tmyPool.Put(instance) //put back to the pool, the pool maintain the reference so it will not be cleaned up by the garbage collector\n\n\tmyPool.Get() // first check wether there are any available instances within the pool to return to the caller, and if not, call its New member variable to create one\n\n\tvar numCalcsCreated int\n\n\tcalcPool := &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\tnumCalcsCreated += 1\n\t\t\tmem := make([]byte, 1024)\n\t\t\treturn &mem\n\t\t},\n\t}\n\n\t// set the pool with 4KB\n\tcalcPool.Put(calcPool.New())\n\tcalcPool.Put(calcPool.New())\n\tcalcPool.Put(calcPool.New())\n\tcalcPool.Put(calcPool.New())\n\n\tconst numWorkers = 1024 * 1024\n\tvar wg sync.WaitGroup\n\twg.Add(numWorkers)\n\n\tfor i := numWorkers; i > 0; i-- {\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tmem := calcPool.Get().(*[]byte)\n\t\t\tdefer calcPool.Put(mem)\n\t\t\ttime.Sleep(10 * time.Millisecond) //doing something\n\t\t}()\n\n\t}\n\n\twg.Wait()\n\tfmt.Printf(\"the #Calcs is %d\\n\", numCalcsCreated)\n}", "title": "" }, { "docid": "53533a2776f2a57a4a0052b5c80250a0", "score": "0.52186376", "text": "func NewPool(network, addr string, size int, df ConnFunc) (*Pool, error) {\n\tsp := &Pool{\n\t\tnetwork: network,\n\t\taddr: addr,\n\t\tdf: df,\n\t\tpool: make(chan *staticPoolConn, size),\n\t\tcloseCh: make(chan bool),\n\t\tinitDone: make(chan struct{}),\n\t}\n\tif sp.df == nil {\n\t\tsp.df = Dial\n\t}\n\n\t// make one Conn synchronously to ensure there's actually a redis instance\n\t// present. The rest will be created asynchronously\n\tspc, err := sp.newConn()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsp.put(spc)\n\n\tgo func() {\n\t\tfor i := 0; i < size-1; i++ {\n\t\t\tspc, err := sp.newConn()\n\t\t\tif err == nil {\n\t\t\t\tsp.put(spc)\n\t\t\t}\n\t\t}\n\t\tclose(sp.initDone)\n\t}()\n\n\tgo sp.pingSpin()\n\treturn sp, nil\n}", "title": "" }, { "docid": "30f313d2f7d02777b6afe515d7c75cd6", "score": "0.5210707", "text": "func buildWorkers(gr g.Graph, poolSize int, mainChannel chan myChannelData, debug int) []chan myChannelData {\n\tdefaultPool := math.Floor(math.Sqrt(float64(len(gr.Nodes)))) //TODO: ADJUST DEFAULT AS NECESSARY\n\tvar numWorkers int\n\tif poolSize <= 0 {\n\t\tnumWorkers = int(defaultPool)\n\t} else {\n\t\tnumWorkers = int(math.Min(float64(poolSize), defaultPool))\n\t}\n\n\tif debug%2 == 1 {\n\t\tfmt.Printf(\"\\tBuilding %d workers for %d nodes \\n\", numWorkers, len(gr.Nodes))\n\t}\n\n\tvar myChannels []chan myChannelData\n\tfor i := 0; i < numWorkers; i++ {\n\t\tc := make(chan myChannelData)\n\t\tmyChannels = append(myChannels, c)\n\t\tgo workerWait(&gr, c, mainChannel)\n\t}\n\treturn myChannels\n}", "title": "" }, { "docid": "2e9eb34c87888aab775e0ae79f0f3713", "score": "0.5199477", "text": "func NewPool() chunkenc.Pool {\n\treturn &pool{\n\t\twrapped: chunkenc.NewPool(),\n\t\taggr: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &AggrChunk{}\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c23bda3447f9e98991b4f0df40e585ce", "score": "0.51847595", "text": "func New(slicesize int, nitems int) Pool {\n\treturn Pool{make(chan []byte, nitems), slicesize}\n}", "title": "" }, { "docid": "4d5eb3a792af17f3cdc6a6facdfc8f0b", "score": "0.51846427", "text": "func newClientPool(initializeClient func() (*storage.Client, error), numClients int) (*clientPool, func()) {\n\tp := &clientPool{\n\t\tclients: make([]*storage.Client, numClients),\n\t\tclientQueue: make(chan *storage.Client, numClients),\n\t}\n\n\tfor i := 0; i < numClients; i++ {\n\t\tvar err error\n\t\tp.clients[i], err = initializeClient()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"initializeClient: %v\", err)\n\t\t}\n\n\t\t// Fill the queue with clients as they are created\n\t\tp.clientQueue <- p.clients[i]\n\t}\n\n\treturn p, func() {\n\t\tfor _, c := range p.clients {\n\t\t\tc.Close()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b93826e65122638aa365442e9ec2bc1", "score": "0.5165386", "text": "func (p *policy) allocatePool(container cache.Container) (Grant, error) {\n\tvar pool Node\n\n\trequest := newRequest(container)\n\n\t// Assumption: in the beginning the CPUs and memory will be allocated from\n\t// the same pool. This assumption can be relaxed later, requires separate\n\t// (but connected) scoring of memory and CPU.\n\n\tif container.GetNamespace() == kubernetes.NamespaceSystem {\n\t\tpool = p.root\n\t} else {\n\t\taffinity := p.calculatePoolAffinities(request.GetContainer())\n\t\tscores, pools := p.sortPoolsByScore(request, affinity)\n\n\t\tif log.DebugEnabled() {\n\t\t\tlog.Debug(\"* node fitting for %s\", request)\n\t\t\tfor idx, n := range pools {\n\t\t\t\tlog.Debug(\" - #%d: node %s, score %s, affinity: %d\",\n\t\t\t\t\tidx, n.Name(), scores[n.NodeID()], affinity[n.NodeID()])\n\t\t\t}\n\t\t}\n\n\t\tif len(pools) == 0 {\n\t\t\treturn nil, policyError(\"no suitable pool found for container %s\",\n\t\t\t\tcontainer.PrettyName())\n\t\t}\n\n\t\tpool = pools[0]\n\t}\n\n\tsupply := pool.FreeSupply()\n\tgrant, err := supply.Allocate(request)\n\tif err != nil {\n\t\treturn nil, policyError(\"failed to allocate %s from %s: %v\",\n\t\t\trequest, supply.DumpAllocatable(), err)\n\t}\n\n\tlog.Debug(\"allocated req '%s' to memory node '%s' (memset %s,%s)\", container.GetCacheID(), grant.GetMemoryNode().Name(), grant.GetMemoryNode().GetMemset(memoryDRAM), grant.GetMemoryNode().GetMemset(memoryPMEM))\n\n\t// In case the workload is assigned to a memory node with multiple\n\t// child nodes, there is no guarantee that the workload will\n\t// allocate memory \"nicely\". Instead we'll have to make the\n\t// conservative assumption that the memory will all be allocated\n\t// from one single node, and that node can be any of the child\n\t// nodes in the system. Thus, we'll need to reserve the memory\n\t// from all child nodes, and move the containers already\n\t// assigned to the child nodes upwards in the topology tree, if\n\t// they no longer fit to the child node that they are in. In\n\t// other words, they'll need to have a wider range of memory\n\t// node options in order to fit to memory.\n\t//\n\t//\n\t// Example:\n\t//\n\t// Workload 1 and Workload 2 are running on the leaf nodes:\n\t//\n\t// +----------------+\n\t// |Total mem: 4G |\n\t// |Total CPUs: 4 | Workload 1:\n\t// |Reserved: |\n\t// | 1.5G | 1G mem\n\t// | |\n\t// | | Workload 2:\n\t// | |\n\t// +----------------+ 0.5G mem\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// +----------------+ +----------------+\n\t// |Total mem: 2G | |Total mem: 2G |\n\t// |Total CPUs: 2 | |Total CPUs: 2 |\n\t// |Reserved: | |Reserved: |\n\t// | 1G | | 0.5G |\n\t// | | | |\n\t// | | | |\n\t// | * WL 1 | | * WL 2 |\n\t// +----------------+ +----------------+\n\t//\n\t//\n\t// Then Workload 3 comes in and is assigned to the root node. Memory\n\t// reservations are done on the leaf nodes:\n\t//\n\t// +----------------+\n\t// |Total mem: 4G |\n\t// |Total CPUs: 4 | Workload 1:\n\t// |Reserved: |\n\t// | 3G | 1G mem\n\t// | |\n\t// | | Workload 2:\n\t// | * WL 3 |\n\t// +----------------+ 0.5G mem\n\t// / \\\n\t// / \\ Workload 3:\n\t// / \\\n\t// / \\ 1.5G mem\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// +----------------+ +----------------+\n\t// |Total mem: 2G | |Total mem: 2G |\n\t// |Total CPUs: 2 | |Total CPUs: 2 |\n\t// |Reserved: | |Reserved: |\n\t// | 2.5G | | 2G |\n\t// | | | |\n\t// | | | |\n\t// | * WL 1 | | * WL 2 |\n\t// +----------------+ +----------------+\n\t//\n\t//\n\t// Workload 1 no longer fits to the leaf node, because the total\n\t// reservation from the leaf node is over the memory maximum.\n\t// Thus, it's moved upwards in the tree to the root node. Memory\n\t// resevations are again updated accordingly:\n\t//\n\t// +----------------+\n\t// |Total mem: 4G |\n\t// |Total CPUs: 4 | Workload 1:\n\t// |Reserved: |\n\t// | 3G | 1G mem\n\t// | |\n\t// | * WL 1 | Workload 2:\n\t// | * WL 3 |\n\t// +----------------+ 0.5G mem\n\t// / \\\n\t// / \\ Workload 3:\n\t// / \\\n\t// / \\ 1.5G mem\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// +----------------+ +----------------+\n\t// |Total mem: 2G | |Total mem: 2G |\n\t// |Total CPUs: 2 | |Total CPUs: 2 |\n\t// |Reserved: | |Reserved: |\n\t// | 2.5G | | 3G |\n\t// | | | |\n\t// | | | |\n\t// | | | * WL 2 |\n\t// +----------------+ +----------------+\n\t//\n\t//\n\t// Now Workload 2 doesn't fit to the leaf node either. It's also moved\n\t// to the root node:\n\t//\n\t// +----------------+\n\t// |Total mem: 4G |\n\t// |Total CPUs: 4 | Workload 1:\n\t// |Reserved: |\n\t// | 3G | 1G mem\n\t// | * WL 2 |\n\t// | * WL 1 | Workload 2:\n\t// | * WL 3 |\n\t// +----------------+ 0.5G mem\n\t// / \\\n\t// / \\ Workload 3:\n\t// / \\\n\t// / \\ 1.5G mem\n\t// / \\\n\t// / \\\n\t// / \\\n\t// / \\\n\t// +----------------+ +----------------+\n\t// |Total mem: 2G | |Total mem: 2G |\n\t// |Total CPUs: 2 | |Total CPUs: 2 |\n\t// |Reserved: | |Reserved: |\n\t// | 3G | | 3G |\n\t// | | | |\n\t// | | | |\n\t// | | | |\n\t// +----------------+ +----------------+\n\t//\n\n\t// We need to analyze all existing containers which are a subset of current grant.\n\tmemset := grant.GetMemoryNode().GetMemset(grant.MemoryType())\n\n\t// Add an extra memory reservation to all subnodes.\n\t// TODO: no need to do any of this if no memory request\n\tgrant.UpdateExtraMemoryReservation()\n\n\t// See how much memory reservations the workloads on the\n\t// nodes up from this one cause to the node. We only need to\n\t// analyze the workloads up until this node, because it's\n\t// guaranteed that the subtree can hold the workloads.\n\n\t// If it turns out that the current workloads no longer fit\n\t// to the node with the reservations from nodes from above\n\t// in the tree, move all nodes upward. Note that this\n\t// creates a reservation of the same size to the node, so in\n\t// effect the node has to be empty of its \"own\" workloads.\n\t// In this case move all the workloads one level up in the tree.\n\n\tchanged := true\n\tfor changed {\n\t\tchanged = false\n\t\tfor _, oldGrant := range p.allocations.grants {\n\t\t\toldMemset := oldGrant.GetMemoryNode().GetMemset(grant.MemoryType())\n\t\t\tif oldMemset.Size() < memset.Size() && memset.Has(oldMemset.Members()...) {\n\t\t\t\tchanged, err = oldGrant.ExpandMemset()\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 changed {\n\t\t\t\t\tlog.Debug(\"* moved container %s upward to node %s to guarantee memory\", oldGrant.GetContainer().GetCacheID(), oldGrant.GetMemoryNode().Name())\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tp.allocations.grants[container.GetCacheID()] = grant\n\n\tp.saveAllocations()\n\n\treturn grant, nil\n}", "title": "" }, { "docid": "449b15b4efba1f141d81eb0f718ddd10", "score": "0.51635915", "text": "func NewPool(network, addr string, size int) (*Pool, error) {\n\tvar err error\n\tpool := make([]*redis.Client, size)\n\tfor i := range pool {\n\t\tif pool[i], err = redis.Dial(network, addr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tp := Pool{\n\t\tnetwork: network,\n\t\taddr: addr,\n\t\tpool: make(chan *redis.Client, len(pool)),\n\t}\n\treturn &p, nil\n}", "title": "" }, { "docid": "2bc8db116f2f461889bf5c49aef0a097", "score": "0.5156493", "text": "func newEncodePool(f EncoderFactory) *encoderPool {\n\t// get a new encoder and type assert to see if it can be reset\n\tencoder := f.NewEncoder(nil)\n\tre, ok := encoder.(ResettableEncoder)\n\n\tp := &encoderPool{\n\t\tfactory: f,\n\t}\n\n\t// if the encoder can be reset, create a pool and put the typed encoder in\n\tif ok {\n\t\tp.pool = &sync.Pool{\n\t\t\tNew: func() interface{} { return f.NewEncoder(nil) },\n\t\t}\n\t\tp.pool.Put(re)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "2bc8db116f2f461889bf5c49aef0a097", "score": "0.5156493", "text": "func newEncodePool(f EncoderFactory) *encoderPool {\n\t// get a new encoder and type assert to see if it can be reset\n\tencoder := f.NewEncoder(nil)\n\tre, ok := encoder.(ResettableEncoder)\n\n\tp := &encoderPool{\n\t\tfactory: f,\n\t}\n\n\t// if the encoder can be reset, create a pool and put the typed encoder in\n\tif ok {\n\t\tp.pool = &sync.Pool{\n\t\t\tNew: func() interface{} { return f.NewEncoder(nil) },\n\t\t}\n\t\tp.pool.Put(re)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "55fa15fee69d845833da1664da63ccf6", "score": "0.51550835", "text": "func NewPool(max int) *Pool {\n\treturn &Pool{\n\t\tpool: make(chan *Thing, max),\n\t}\n}", "title": "" }, { "docid": "743ddae2e499ba5563e787fa9cbc5750", "score": "0.51535714", "text": "func createWorkerPool(jobs chan Job, results chan Result, noOfWorkers int) {\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < noOfWorkers; i++ {\n\t\twg.Add(1)\n\t\tgo worker(jobs, results, &wg)\n\t}\n\twg.Wait()\n\tclose(results)\n}", "title": "" }, { "docid": "9823a0f2ad53b02b825371487eb97809", "score": "0.5150789", "text": "func New(N int, collector stat.Collector) *Pool {\n\tpool := &Pool{\n\t\ttasks: make(chan Task),\n\t\tcollector: collector,\n\t}\n\n\tsessionID := time.Now().UnixNano()\n\n\trunAndMeasure := func(run func() *record.Record) *record.Record {\n\t\tstart := time.Now()\n\t\tstat := run()\n\t\tstat.Start, stat.Finish = start, time.Now()\n\n\t\tstat.SessionID = sessionID\n\t\treturn stat\n\t}\n\n\tid := func(run func() *record.Record) *record.Record {\n\t\treturn run()\n\t}\n\n\t//goroutines pool\n\tpool.Add(N)\n\tfor i := 0; i < N; i++ {\n\t\tgo func() {\n\t\t\tdefer pool.Done()\n\t\t\tfor task := range pool.tasks {\n\n\t\t\t\trunAndMeasure := runAndMeasure\n\n\t\t\t\tif collector == nil {\n\t\t\t\t\trunAndMeasure = id\n\t\t\t\t}\n\n\t\t\t\tstat := runAndMeasure(task.Run)\n\n\t\t\t\tif collector != nil {\n\t\t\t\t\tcollector.Collect(stat)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\treturn pool\n}", "title": "" }, { "docid": "3d766dffc9ec5657ece6e1db133f2ac5", "score": "0.5134956", "text": "func NewPool(workers, queueLen int) *Pool {\n\tp := &Pool{RequestCh: make(chan *Request, queueLen)}\n\n\tif workers <= 0 {\n\t\tworkers = runtime.NumCPU()\n\t}\n\n\tp.wg.Add(workers)\n\n\tfor i := 0; i < workers; i++ {\n\t\tgo p.worker()\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "3308d85f188ac0e7b534d9623a55fe0a", "score": "0.51318306", "text": "func New(n int, f Func, jobChan <-chan Job, resultChan chan<- Job) *Pool {\n\tp := &Pool{\n\t\tf: f,\n\t\tdone: make(chan struct{}),\n\t\tworkersExit: make(chan struct{}),\n\t\tallWorkersDone: make(chan struct{}),\n\t\tnumWorkers: n,\n\t\tjobCh: jobChan,\n\t\tresCh: resultChan,\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tgo p.runWorker(i)\n\t}\n\n\tgo p.waitForExit()\n\n\treturn p\n}", "title": "" }, { "docid": "6e953f65a6074c8757b6fa7b685e9d25", "score": "0.5129933", "text": "func DynamicWorkerPool(proc Processor, maxWorkers int) StageRunner {\n\tif maxWorkers <= 0 {\n\t\tpanic(\"DynamicWorkerPool: maxWorkers must be > 0\")\n\t}\n\n\t//pre-populate token pool with max number of workers we wish to allow\n\ttokenPool := make(chan struct{}, maxWorkers)\n\tfor i := 0; i < maxWorkers; i++ {\n\t\ttokenPool <- struct{}{}\n\t}\n\n\treturn &dynamicWorkerPool{\n\t\tproc: proc,\n\t\ttokenPool: tokenPool,\n\t}\n}", "title": "" }, { "docid": "7b8a2705c17a95262f0d8cccbe6ced92", "score": "0.5127931", "text": "func Generator(pending chan<- Candidate, ready <-chan bool) {\n\tfor {\n\t\t<-ready // blocking read\n\t\tnc := Candidate(randInt(capacityMin, capacityMax))\n\t\tlog.Println(\"new candidate:\", int(nc))\n\t\tpending <- nc\n\t}\n}", "title": "" }, { "docid": "24f1b940af74ec050cc5ae36ebd43845", "score": "0.5109971", "text": "func main() {\n jobs := make(chan int)\n wait := func(i int) { time.Sleep(time.Duration(i) * time.Millisecond) }\n pool := New(3, jobs, wait)\n\n pool.Start()\n\n go func() {\n wait(1700)\n println(\"oh no...\")\n pool.Dec(2)\n }()\n go func() {\n wait(10700)\n println(\"OH MYYYYY!!! \\\\ʕ◔ϖ◔ʔ/\")\n pool.Inc(8)\n }()\n for i := 1; i <= 100; i++ {\n jobs <- i\n }\n close(jobs)\n\n pool.Wait()\n}", "title": "" }, { "docid": "d548f1a1dd2054ec5b95c229c36ce3cf", "score": "0.5109736", "text": "func NewPool(conn *radix.Pool) *Cyclone {\n\treturn &Cyclone{Raw: conn}\n}", "title": "" }, { "docid": "7d1dc2f7946fafc49046e6c095ea609a", "score": "0.51096183", "text": "func CreatePool(pairs map[string]int) *Pool {\n\tpool := &Pool{\n\t\tcurrent: 0,\n\t\tdownNum: 0,\n\t}\n\tfor addr, weight := range pairs {\n\t\tpool.Add(addr, weight)\n\t}\n\treturn pool\n}", "title": "" }, { "docid": "b9b71b8f427656cbf4af731b616d5550", "score": "0.5086389", "text": "func (p *pool) generatePID() uint32 {\n\tatomic.AddUint32(&p.pidCounter, 1)\n\treturn p.pidCounter\n}", "title": "" }, { "docid": "5330eb24c37b9d660cb105fd78f2e992", "score": "0.5054964", "text": "func NewPool(minThreshold int, maxThreshold int) *Pool {\n\treturn &Pool{\n\t\tproxies: make([]common.Proxy, 0),\n\t\tindexer: make(map[string]int),\n\t\tminThreshold: minThreshold,\n\t\tmaxThreshold: maxThreshold,\n\t}\n}", "title": "" }, { "docid": "89b1f766f050e24330a5dd93b927f4bc", "score": "0.50380087", "text": "func NewChannelPool(initialCap, maxCap int, factory Factory) (Pool, error) {\n\tif initialCap < 0 || maxCap <= 0 || initialCap > maxCap {\n\t\treturn nil, errors.New(\"invalid capacity settings\")\n\t}\n\n\tc := &channelPool{\n\t\tconns: make(chan net.Conn, maxCap),\n\t\tfactory: factory,\n\t}\n\n\t// create initial connections, if something goes wrong,\n\t// just close the pool error out.\n\tfor i := 0; i < initialCap; i++ {\n\t\tconn, err := factory()\n\t\tif err != nil {\n\t\t\tc.Close()\n\t\t\treturn nil, fmt.Errorf(\"factory is not able to fill the pool: %s\", err)\n\t\t}\n\t\tatomic.AddInt64(&c.nOpenConns, 1)\n\t\tc.conns <- conn\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "87ecad9634d61de30122435048ec2e63", "score": "0.50360423", "text": "func prngTester(size int, testFunc func()) {\n\tprng := rand.Reader\n\tbuf := &bytes.Buffer{}\n\n\trand.Reader = buf\n\tdefer func() { rand.Reader = prng }()\n\n\tfor i := 0; i < size; i++ {\n\t\ttmp := make([]byte, i)\n\t\tbuf.Write(tmp)\n\t\ttestFunc()\n\t}\n}", "title": "" }, { "docid": "a26cbd42eb9ae12e29013cb3ea40b4a2", "score": "0.50306255", "text": "func genRandom(gr chan<- []int, size int, kill <-chan int) {\n\ts, i := size/10, 0\n\tkilled := false\n\tfor !killed {\n\t\tselect {\n\t\tcase <-kill:\n\t\t\t{\n\t\t\t\tkilled = true\n\t\t\t\tbreak\n\t\t\t}\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t\tif killed {\n\t\t\tbreak\n\t\t}\n\t\ti = rand.Intn(s)\n\t\tt := make([]int, i)\n\t\tfor j := range t {\n\t\t\tt[j] = rand.Intn(4) + 1\n\t\t}\n\t\tgr <- t\n\t}\n}", "title": "" }, { "docid": "2cad706476c6d7383d814aca517c4607", "score": "0.50193584", "text": "func (p NodePoolProcessors) ProcessNew(\n\tctx context.Context,\n\tcluster Cluster,\n\trawNodePool NewRawNodePool,\n) (NewRawNodePool, error) {\n\tfor _, processor := range p {\n\t\tvar err error\n\n\t\trawNodePool, err = processor.ProcessNew(ctx, cluster, rawNodePool)\n\t\tif err != nil {\n\t\t\treturn rawNodePool, err\n\t\t}\n\t}\n\n\treturn rawNodePool, nil\n}", "title": "" }, { "docid": "97e0d7176848eadd13e3491dc451c5ba", "score": "0.50189424", "text": "func NewPool(tasks []*Task, concurrency int) *Pool {\n\treturn &Pool{\n\t\tTasks: tasks,\n\t\tconcurrency: concurrency,\n\t\ttasksChan: make(chan *Task),\n\t}\n}", "title": "" }, { "docid": "4009d2931f73de0107f471d7e52b90b5", "score": "0.5008194", "text": "func genNodes(N int, SpaceMax int, K int) []Node{\n\tnodes := make([]Node, N)\n\tfor i := 0 ; i < N ; i++ {\n\t\tnodes[i].X = RndSrc.Intn(SpaceMax)\n\t\t//nodes[i].Y = RndSrc.Intn(SpaceMax)\n\t\tnodes[i].Y = RndSrc.Intn(SpaceMax)\n\t\tnodes[i].Name = strconv.Itoa(i)\n\t\tnodes[i].ADist = make([]float64, K)\n\t\tfor j := 0 ; j < K ; j++ {\n\t\t\tnodes[i].ADist[j] = math.MaxInt64\n\t\t}\n\t\tnodes[i].pDist = make([]string, K)\n\t\tnodes[i].cluster = make(map[string]bool, 0)\n\t\tnodes[i].Bunch = make(map[string]bool, 0)\n\t}\n\n\n\n\treturn nodes\n}", "title": "" }, { "docid": "83cec12036ce5416806df13b1520c166", "score": "0.5006234", "text": "func NewPool(max int) *Pool {\n\treturn &Pool{\n\t\tpool: make(chan []byte, max),\n\t}\n}", "title": "" }, { "docid": "7fd2fd7fa9d67e7611cf70c8e275838f", "score": "0.49927133", "text": "func FixedPool(id string, task Task, num int) Stage {\n\tif num <= 0 {\n\t\treturn nil\n\t}\n\n\tfifos := make([]Stage, num)\n\tfor i := 0; i < num; i++ {\n\t\tfifos[i] = FIFO(\"\", task)\n\t}\n\n\treturn &fixedPool{\n\t\tid: id,\n\t\tfifos: fifos,\n\t}\n}", "title": "" }, { "docid": "e55ba1c3ef68cdc71efc80e74e412cb8", "score": "0.4990935", "text": "func NewRoundRobinPool(zkConn *zk.Conn, zkProxyDir string, options redis.Options) (*RoundRobinPool, error) {\n\tpool := &RoundRobinPool{\n\t\tzkConn: zkConn,\n\t\tzkProxyDir: zkProxyDir,\n\t\tnextIdx: -1,\n\t\tpools: atomic.Value{},\n\t\toptions: options,\n\t\tstopChan: make(chan struct{}),\n\t\trwMutex: sync.RWMutex{},\n\t}\n\tpool.pools.Store([]*PooledObject{})\n\t_, _, childCh, err := zkConn.ChildrenW(zkProxyDir)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"failed to watch %s\", zkProxyDir))\n\t}\n\tpool.childCh = childCh\n\tpool.resetPools()\n\n\tgo pool.watch()\n\treturn pool, nil\n}", "title": "" }, { "docid": "6d5b3c04ad089f73abb0a5966fbcfab2", "score": "0.49857745", "text": "func NewPool(tasks []*task.Task, concurrency int) *Pool {\n\treturn &Pool{\n\t\tTasks: tasks,\n\t\tconcurrency: concurrency,\n\t\ttasksChan: make(chan *task.Task),\n\t}\n}", "title": "" }, { "docid": "aa0701a118d9fb832a924d54a8262324", "score": "0.49843565", "text": "func MockPopulatePortPool(\n\tmockRedisClient *redismocks.MockRedisClient,\n\tfreePortsKey string,\n\tbegin, end int,\n\terr error,\n) (calls *Calls) {\n\tcalls = NewCalls()\n\n\tcalls.Add(mockRedisClient.EXPECT().\n\t\tEval(`\nif redis.call(\"EXISTS\", KEYS[1]) == 0 then\n for i=ARGV[1],ARGV[2] do\n redis.call(\"SADD\", KEYS[1], i)\n end\nend\nreturn \"OK\"\n`, []string{freePortsKey}, begin, end).\n\t\tReturn(goredis.NewCmdResult(nil, err)))\n\n\treturn\n}", "title": "" }, { "docid": "ef33a0359f0d4a90673716a68fabd919", "score": "0.49708048", "text": "func NewPool(capacity int, chain blockchain, getObjectFromBlock getObjectFromBlockFunc,\n\tcanRemove canRemoveFunc, log *log.WuyaLog, objectValidation objectValidationFunc, afterAdd afterAddFunc, cachedTxs *CachedTxs) *Pool {\n\tpool := &Pool{\n\t\tcapacity: capacity,\n\t\tchain: chain,\n\t\thashToTxMap: make(map[common.Hash]*poolItem),\n\t\t pendingQueue: newPendingQueue(),\n\t\tprocessingObjects: make(map[common.Hash]struct{}),\n\t\tlog: log,\n\t\tgetObjectFromBlock: getObjectFromBlock,\n\t\tcanRemove: canRemove,\n\t\tobjectValidation: objectValidation,\n\t\tafterAdd: afterAdd,\n\t\t// cachedTxs: NewCachedTxs(CachedCapacity),\n\t\tcachedTxs: cachedTxs,\n\t}\n\t// pool.cachedTxs.init(chain)\n\n\tgo pool.loopCheckingPool()\n\n\treturn pool\n}", "title": "" }, { "docid": "0cce87cdf3f0cd616d792a79c08e5599", "score": "0.49690703", "text": "func newBytePool(logger *logrus.Logger) *bytePool {\n\tpools := make([]*sync.Pool, 0)\n\n\tfor i := minChunkPower; i <= maxChunkPower; i++ {\n\t\tcurrentPool := &sync.Pool{\n\t\t\tNew: func(pow int) func() interface{} {\n\t\t\t\treturn func() interface{} {\n\t\t\t\t\treturn make([]byte, 1<<uint(pow))\n\t\t\t\t}\n\t\t\t}(i),\n\t\t}\n\n\t\tpools = append(pools, currentPool)\n\t}\n\n\treturn &bytePool{\n\t\tpools,\n\t\tlogger,\n\t}\n}", "title": "" }, { "docid": "a34dc16e77c8a40223f466d6241b1952", "score": "0.4965091", "text": "func (r *Rail) resizePool(num int, workCh chan *Channel, responseCh chan bool, closeCh chan int) {\n\tidealPoolSize := int(float64(num) * 0.25)\n\tif idealPoolSize < 1 {\n\t\tidealPoolSize = 1\n\t} else if idealPoolSize > r.c.QueueScanWorkerPoolMax {\n\t\tidealPoolSize = r.c.QueueScanWorkerPoolMax\n\t}\n\n\tfor {\n\t\tif idealPoolSize == r.poolSize {\n\t\t\tbreak\n\t\t} else if idealPoolSize < r.poolSize {\n\t\t\t// contract\n\t\t\tcloseCh <- 1\n\t\t\tr.poolSize--\n\t\t\tlog.Debugf(\"resize pool minus: size(%d)\", r.poolSize)\n\t\t} else {\n\t\t\t// expand\n\t\t\tr.waitGroup.Wrap(func() {\n\t\t\t\tr.queueScanWorker(workCh, responseCh, closeCh)\n\t\t\t})\n\t\t\tr.poolSize++\n\t\t\tlog.Debugf(\"resize pool add: size(%d)\", r.poolSize)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "67d3197c9ea683f3ce1937653485ffe1", "score": "0.495947", "text": "func NewPool(max int) *Pool {\n\treturn &Pool{\n\t\tpool: make(chan *Client, max),\n\t}\n}", "title": "" }, { "docid": "67d3197c9ea683f3ce1937653485ffe1", "score": "0.495947", "text": "func NewPool(max int) *Pool {\n\treturn &Pool{\n\t\tpool: make(chan *Client, max),\n\t}\n}", "title": "" }, { "docid": "916f71d6c53ee0a89ae8ea8936ae8aa3", "score": "0.49497852", "text": "func nextGeneration(current_grid [GRID_X][GRID_Y]int) [GRID_X][GRID_Y]int {\n\t// new grid declared with each call (inefficient)\n\tvar next_grid [GRID_X][GRID_Y]int\n\tvar current Cell\n\t// populate new grid\n\tfor i := 1; i < GRID_X-1; i++ {\n\t\tfor j := 1; j < GRID_Y-1; j++ {\n\t\t\tcurrent.state = current_grid[i][j]\n\t\t\tcurrent.x = i\n\t\t\tcurrent.y = j\n\t\t\tnext_grid[i][j] = lifeEvaluation(current_grid, current).state\n\t\t}\n\t}\n\treturn next_grid\n\t// TODO: declare two grids and swap between them for memory efficinecy\n\t// TODO: better method for dealing with grid edges\n}", "title": "" }, { "docid": "a33236fab1997ef6d6da271ed733c05c", "score": "0.4945996", "text": "func NewPool(newFunc func() interface{}, capacity int) Pool {\n\treturn &pool{\n\t\tsp: sync.Pool{New: newFunc},\n\t\tcapacity: int32(capacity),\n\t\tcurrent: int32(0),\n\t}\n}", "title": "" }, { "docid": "68cc89c55f0e9fb0b461c7010d3f32af", "score": "0.49458382", "text": "func GeneratePopulation[T any](fac Factory[T], n int, rng *rand.Rand) []T {\n\tpop := make([]T, 0, n)\n\tfor i := 0; i < n; i++ {\n\t\tpop = append(pop, fac.New(rng))\n\t}\n\treturn pop\n}", "title": "" }, { "docid": "506633096086cd411f515f00323056c4", "score": "0.4942892", "text": "func New(amount int32, jobs <-chan int, f func(int)) *WorkerPool {\n return &WorkerPool{\n wg: sync.WaitGroup{},\n sz: amount,\n ch: jobs,\n fn: f,\n }\n}", "title": "" }, { "docid": "30a38889c53ee8ae162ace85842d215f", "score": "0.49373114", "text": "func expandPool() {\n\tend := indexOfPool + uint16(255)\n\tfor ; indexOfPool <= end; indexOfPool++ {\n\t\t// avoid 255.255\n\t\tif indexOfPool > maxPoolSize {\n\t\t\treturn\n\t\t}\n\t\tip := defaultNetworkPrefix + getSubNet(indexOfPool)\n\t\t// if ip is not used, append it to unused\n\t\tif svcDesc.getSvcPorts(ip) == \"\" {\n\t\t\tunused = append(unused, ip)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c006ae6c170295abbcaac74457b94fb2", "score": "0.49363822", "text": "func (r *DockerRunner) CreatePool() (string, error) {\n\tif r.IsRunning() {\n\t\treturn \"\", ErrPoolAlreadyCreated\n\t}\n\n\tr.poolID = util.GenerateKey()\n\n\tlogrus.WithField(\"concurrency\", r.options.Concurrency).Info(\"Creating pool\")\n\n\t// Reset reserved memory and reserve memory margin.\n\tr.sys.Reset()\n\n\tif err := r.sys.ReserveMemory(r.options.MemoryMargin); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Create pool semaphore and reserve memory for each concurrency.\n\tr.poolSemaphore = semaphore.NewWeighted(int64(r.options.Concurrency))\n\tfor i := uint(0); i < r.options.Concurrency; i++ {\n\t\tif err := r.sys.ReserveMemory(uint64(r.options.Constraints.MemoryLimit)); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\t// Set free resources counter.\n\tr.metrics.WorkerCPU().Set(int64(r.options.MCPU - r.dockerMgr.Options().ReservedMCPU))\n\n\t// Create and fill container pool.\n\tr.containerPool = make(map[string]chan *Container)\n\tsem := make(chan struct{}, 4) // create only 4 at a time\n\tdone := make(chan error, r.options.Concurrency)\n\n\t// Store codewrapper in repo.\n\tf, err := os.Open(os.Getenv(wrapperPathEnv)) // nolint: gosec\n\tutil.Must(err)\n\n\tif _, err := r.fileRepo.PermStore(wrapperName, bufio.NewReader(f), wrapperName, os.ModePerm); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Process concurrently each runtime.\n\tfor runtime, rInfo := range SupportedRuntimes {\n\t\t// Store wrappers.\n\t\tif _, err := r.fileRepo.PermStore(runtime, rInfo.Wrapper(), rInfo.FileName, 0); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// Create containers.\n\t\tr.containerPool[runtime] = make(chan *Container, r.options.Concurrency)\n\n\t\tfor i := uint(0); i < r.options.Concurrency; i++ {\n\t\t\tgo func(runtime string) {\n\t\t\t\tsem <- struct{}{}\n\n\t\t\t\tdefer func() {\n\t\t\t\t\t<-sem\n\t\t\t\t}()\n\n\t\t\t\tctx, cancel := context.WithTimeout(context.Background(), r.options.CreateTimeout)\n\t\t\t\tdefer cancel()\n\n\t\t\t\tcontainerID, err := r.createFreshContainer(ctx, runtime)\n\t\t\t\tif err != nil {\n\t\t\t\t\tdone <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tr.containerPool[runtime] <- containerID\n\t\t\t\tdone <- nil\n\t\t\t}(runtime)\n\t\t}\n\n\t\tfor i := uint(0); i < r.options.Concurrency; i++ {\n\t\t\terr := <-done\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\n\tr.setRunning(true)\n\n\treturn r.poolID, nil\n}", "title": "" }, { "docid": "34834cf68f3ba71b68f3b544d1b88c31", "score": "0.49203983", "text": "func newDecodePool(f DecoderFactory) *decoderPool {\n\t// get a new decoder and type assert to see if it can be reset\n\tdecoder := f.NewDecoder(nil)\n\trd, ok := decoder.(ResettableDecoder)\n\n\tp := &decoderPool{\n\t\tfactory: f,\n\t}\n\n\t// if the decoder can be reset, create a pool and put the typed decoder in\n\tif ok {\n\t\tp.pool = &sync.Pool{\n\t\t\tNew: func() interface{} { return f.NewDecoder(nil) },\n\t\t}\n\t\tp.pool.Put(rd)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "34834cf68f3ba71b68f3b544d1b88c31", "score": "0.49203983", "text": "func newDecodePool(f DecoderFactory) *decoderPool {\n\t// get a new decoder and type assert to see if it can be reset\n\tdecoder := f.NewDecoder(nil)\n\trd, ok := decoder.(ResettableDecoder)\n\n\tp := &decoderPool{\n\t\tfactory: f,\n\t}\n\n\t// if the decoder can be reset, create a pool and put the typed decoder in\n\tif ok {\n\t\tp.pool = &sync.Pool{\n\t\t\tNew: func() interface{} { return f.NewDecoder(nil) },\n\t\t}\n\t\tp.pool.Put(rd)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "57dea492c01ce2d1e6fbaced56749457", "score": "0.49193704", "text": "func (p Plants) GenerateNext() Plants {\n\tmin, max := p.minMax()\n\tnew := make(Plants)\n\tfor i := (min - Buffer); i <= max; i++ {\n\t\tscan := [RuleSize]bool{}\n\t\tfor el := range scan {\n\t\t\tscan[el] = p[i+el]\n\t\t}\n\t\tif rules[scan] {\n\t\t\tnew[i+Middle] = true\n\t\t}\n\t}\n\treturn new\n}", "title": "" }, { "docid": "60e7b56a1b1e0b6c868bbd6ad01df03e", "score": "0.49180058", "text": "func testPool() cfg.Pool {\n\treturn cfg.Pool{\n\t\tName: \"swimming\",\n\t\tInternal: true,\n\t\tHosts: map[string]cfg.Host{},\n\t\tConfig: cfg.PoolConfig{\n\t\t\tHealthzEvery: \"0s\",\n\t\t\tHealthzTimeout: \"0s\",\n\t\t\tRequestTimeout: \"0s\",\n\t\t\tStatus: \"ITSCOMPLICATED\",\n\t\t},\n\t}\n\n}", "title": "" }, { "docid": "6e9e749a39691e6c1457cae2a71949b6", "score": "0.4915519", "text": "func NewPool(max int) *Pool {\n\treturn &Pool{\n\t\tResponses: make(chan *Response, max),\n\t\tIgnoreBadURL: false,\n\t}\n}", "title": "" }, { "docid": "4fa60de7697c068db4b2df899beb7516", "score": "0.49152616", "text": "func ReplPopns(hostpop, parpop Population, hrep, prep float64) (Population, Population) {\n\n\tnewhostpop := make(Population, int(float64(len(hostpop))*hrep))\n\tnewparpop := make(Population, int(float64(len(parpop))*prep))\n\n\thkillfreq := CountKillFreq(hostpop)\n\tpkillfreq := CountKillFreq(parpop)\n\n\t//assign strategies in new population as per parent population (randomized)\n\n\tfor k := range newhostpop { //for all host cells\n\t\tnewhostpop[k].status = \"alive\"\n\t\tstrategy := rand.Float64()\n\t\tif strategy <= hkillfreq {\n\t\t\tnewhostpop[k].strategy = \"k\"\n\n\t\t} else {\n\t\t\tnewhostpop[k].strategy = \"d\"\n\t\t}\n\n\t}\n\tfor l := range newparpop { //for all parasite cells\n\t\tnewparpop[l].status = \"alive\"\n\t\tstrategy := rand.Float64()\n\t\tif strategy <= pkillfreq {\n\t\t\tnewparpop[l].strategy = \"k\"\n\t\t} else {\n\t\t\tnewparpop[l].strategy = \"d\"\n\t\t}\n\t}\n\treturn newhostpop, newparpop\n}", "title": "" }, { "docid": "ba71e63a70275a9bc37212bd1d657f3a", "score": "0.4906718", "text": "func NewPool(size int) (*Pool, error) {\n\treturn NewTimingPool(size, DefaultCleanIntervalTime)\n}", "title": "" }, { "docid": "41b5a17b29f5d6f23efaa4dddaca86fe", "score": "0.49008662", "text": "func newPool(addr string) *redis.Pool {\n\treturn &redis.Pool{\n\t\tMaxIdle: 5,\n\t\tIdleTimeout: 240 * time.Second,\n\t\tDial: func() (redis.Conn, error) { return redis.Dial(\"tcp\", addr) },\n\t}\n}", "title": "" }, { "docid": "6e5ebbdec899f8ef0ab1c7f9fbb8ef6d", "score": "0.4899211", "text": "func (np *NodePool) Reseed() {\n\tnp.rw.Lock()\n\tdefer np.rw.Unlock()\n\n\tfor _, p := range np.reseedNodes {\n\t\tnp.nodes[p] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "cf1cfb346166b54fbe2b2875f8399e31", "score": "0.48964447", "text": "func New(workers, queue int) *Pool {\n\tvar wg sync.WaitGroup\n\n\tpool := &Pool{\n\t\twg: &wg,\n\t\tTasks: make(chan Task, queue),\n\t\tWorkers: make(chan chan Task, workers),\n\t\tResults: make(chan Result),\n\t}\n\n\tfor i := 0; i < workers; i++ {\n\t\tgo func() {\n\t\t\tworker := make(chan Task)\n\t\t\tpool.Workers <- worker\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase t := <-worker:\n\t\t\t\t\tres, err := t()\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tpool.Results <- Result{Value: res, Err: err}\n\t\t\t\t\t}()\n\t\t\t\t\tpool.Workers <- worker\n\t\t\t\t\tpool.wg.Done()\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn pool\n}", "title": "" }, { "docid": "984fac2c341d3640e86c0e270f132447", "score": "0.48952058", "text": "func NewRBPool(max uint64) *RBPool {\n\treturn &RBPool{\n\t\tpool: queue.NewRingBuffer(max),\n\t}\n}", "title": "" }, { "docid": "f539a562452466628df02efd1c7dfbe1", "score": "0.4892902", "text": "func NewPool(h workfn) *pool {\n\tch := make(chan task) // intentionally unbuffered\n\treturn &pool{ch: ch, h: h}\n}", "title": "" }, { "docid": "88307fc8cc08a61490d6a02c5ee3d8a4", "score": "0.48882994", "text": "func InitPool(maxConn int, maxIdleConn int) (Pool, error) {\n\tvar err error\n\tif maxConn < maxIdleConn {\n\t\terr = errors.New(\"maxIdleConn不能大于maxIdleConn\")\n\t}\n\tpool := Pool{\n\t\tConns: make(chan net.Conn, maxConn),\n\t\tMaxConn: maxConn,\n\t\tMaxIdleConn: maxIdleConn,\n\t}\n\treturn pool, err\n}", "title": "" }, { "docid": "9d756f32f6e26b41c151f0fe6313a0c6", "score": "0.48869482", "text": "func (rcc RemoteCacheConfig) createPool(addr string, opts ...redis.DialOption) (*redis.Pool, error) {\n\treturn &redis.Pool{\n\t\tMaxIdle: 5,\n\t\tMaxActive: 10,\n\t\tIdleTimeout: time.Minute,\n\t\tDial: func() (redis.Conn, error) {\n\t\t\tc, err := redis.Dial(\"tcp\", addr, opts...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, nil\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "236533e00045cb717c29af98fab9d248", "score": "0.4879058", "text": "func newReceiverPool(stage *stage) *receivePool {\n\treturn &receivePool{\n\t\tstage: stage,\n\t\treceiveFrom: []IProcessorForReceiver{},\n\t\terrorSender: stage.pipeline.errorReceiver,\n\t}\n}", "title": "" }, { "docid": "435ab082a965fd6ee5c3cd80e0ed9cb7", "score": "0.48759052", "text": "func RandomizedGenState(simState *module.SimulationState) {\n\tstartingProposalID := uint64(simState.Rand.Intn(100))\n\n\tvar minDeposit sdk.Coins\n\tsimState.AppParams.GetOrGenerate(MinDeposit, &minDeposit, simState.Rand, func(r *rand.Rand) { minDeposit = GenMinDeposit(r, simState.BondDenom) })\n\n\tvar expeditedMinDeposit sdk.Coins\n\tsimState.AppParams.GetOrGenerate(ExpeditedMinDeposit, &expeditedMinDeposit, simState.Rand, func(r *rand.Rand) { expeditedMinDeposit = GenExpeditedMinDeposit(r, simState.BondDenom) })\n\n\tvar depositPeriod time.Duration\n\tsimState.AppParams.GetOrGenerate(DepositPeriod, &depositPeriod, simState.Rand, func(r *rand.Rand) { depositPeriod = GenDepositPeriod(r) })\n\n\tvar minInitialDepositRatio sdkmath.LegacyDec\n\tsimState.AppParams.GetOrGenerate(MinInitialRatio, &minInitialDepositRatio, simState.Rand, func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) })\n\n\tvar proposalCancelRate sdkmath.LegacyDec\n\tsimState.AppParams.GetOrGenerate(ProposalCancelRate, &proposalCancelRate, simState.Rand, func(r *rand.Rand) { proposalCancelRate = GenProposalCancelRate(r) })\n\n\tvar votingPeriod time.Duration\n\tsimState.AppParams.GetOrGenerate(VotingPeriod, &votingPeriod, simState.Rand, func(r *rand.Rand) { votingPeriod = GenVotingPeriod(r) })\n\n\tvar expeditedVotingPeriod time.Duration\n\tsimState.AppParams.GetOrGenerate(ExpeditedVotingPeriod, &expeditedVotingPeriod, simState.Rand, func(r *rand.Rand) { expeditedVotingPeriod = GenExpeditedVotingPeriod(r) })\n\n\tvar quorum sdkmath.LegacyDec\n\tsimState.AppParams.GetOrGenerate(Quorum, &quorum, simState.Rand, func(r *rand.Rand) { quorum = GenQuorum(r) })\n\n\tvar threshold sdkmath.LegacyDec\n\tsimState.AppParams.GetOrGenerate(Threshold, &threshold, simState.Rand, func(r *rand.Rand) { threshold = GenThreshold(r) })\n\n\tvar expitedVotingThreshold sdkmath.LegacyDec\n\tsimState.AppParams.GetOrGenerate(ExpeditedThreshold, &expitedVotingThreshold, simState.Rand, func(r *rand.Rand) { expitedVotingThreshold = GenExpeditedThreshold(r) })\n\n\tvar veto sdkmath.LegacyDec\n\tsimState.AppParams.GetOrGenerate(Veto, &veto, simState.Rand, func(r *rand.Rand) { veto = GenVeto(r) })\n\n\tgovGenesis := v1.NewGenesisState(\n\t\tstartingProposalID,\n\t\tv1.NewParams(minDeposit, expeditedMinDeposit, depositPeriod, votingPeriod, expeditedVotingPeriod, quorum.String(), threshold.String(), expitedVotingThreshold.String(), veto.String(), minInitialDepositRatio.String(), proposalCancelRate.String(), \"\", simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0),\n\t)\n\n\tbz, err := json.MarshalIndent(&govGenesis, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"Selected randomly generated governance parameters:\\n%s\\n\", bz)\n\tsimState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(govGenesis)\n}", "title": "" }, { "docid": "464832c0a96703d0ba2d223209fb52fb", "score": "0.48730022", "text": "func NewConnPool(size, capacity int, factory Factory) (*Pool, error) {\n\tif size <= 0 || capacity <= 0 || size > capacity {\n\t\treturn nil, errors.New(\"invalid capacity settings\")\n\t}\n\n\tpool := &Pool{\n\t\telements: make(chan interface{}, capacity),\n\t\tfactory: factory,\n\t}\n\n\t// create initial connections, if something goes wrong,\n\t// just close the pool error out.\n\tfor i := 0; i < size; i++ {\n\t\telement, err := factory()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"factory is not able to fill the pool: %s\", err)\n\t\t}\n\t\tpool.elements <- element\n\t}\n\n\treturn pool, nil\n}", "title": "" }, { "docid": "bcd1797e3c925d7bbc7a5760bbc3456a", "score": "0.4864123", "text": "func NewPool(server *string, redisMaxActive int) *redigoredis.Pool {\n\tredis := &redigoredis.Pool{\n\t\tMaxActive: redisMaxActive,\n\t\tMaxIdle: redisMaxActive,\n\t\tIdleTimeout: 15 * time.Second,\n\t\tDial: func() (redigoredis.Conn, error) {\n\t\t\tc, err := redigoredis.Dial(\"tcp\", *server,\n\t\t\t\tredigoredis.DialConnectTimeout(2000*time.Millisecond))\n\t\t\t//redigoredis.DialReadTimeout(20*time.Second))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn c, err\n\t\t},\n\t\tTestOnBorrow: func(c redigoredis.Conn, t time.Time) error {\n\t\t\t_, err := c.Do(\"PING\")\n\t\t\treturn err\n\t\t},\n\t}\n\n\treturn redis\n}", "title": "" } ]
bfd199fa185a1d2aee3ea8a5ab39a083
testPreflightFails calls the endpoint's Preflight method with a destination of the given flow, verifying that it fails with the provided error.
[ { "docid": "3fca866d2bb5bfd41c63beae7b025d93", "score": "0.78662276", "text": "func testPreflightFails(c *context.Context, flow context.TestFlow, wantErr tcpip.Error) {\n\tc.T.Helper()\n\ttestPreflightImpl(c, flow, true, wantErr)\n}", "title": "" } ]
[ { "docid": "8c93bf1b137c297315a4d7890345383e", "score": "0.6274243", "text": "func testPreflightSucceeds(c *context.Context, flow context.TestFlow) {\n\tc.T.Helper()\n\ttestPreflightImpl(c, flow, true, nil)\n}", "title": "" }, { "docid": "27704671625d6f5cf3a0e46be7d8a518", "score": "0.5647439", "text": "func (e *Endpoint) forceFailure() {\n\te.transport.Fail()\n}", "title": "" }, { "docid": "e6bd75f77ee0b16e3a1735b00455278a", "score": "0.5445295", "text": "func TestInvalidEndpoint(t *testing.T) {\n\tres := startEndpoint(\"/fakeUrl\")\n\tassert.Equal(t, 404, res.Code, \"Expected 404 response\")\n\tassert.Contains(t, res.Body.String(), \"page not found\",\n\t\t\"Expected proper error message\")\n\n\tres = startEndpoint(\"/fakeUrl/partTwo\")\n\tassert.Equal(t, 404, res.Code, \"Expected 404 response\")\n}", "title": "" }, { "docid": "d3712375be1ede41e63a56f48872c901", "score": "0.5409639", "text": "func TestCreateTransferToInvalidUser(t *testing.T) {\r\n\txfer := []byte(`{\"to\": \"test100@test.com\",\"status\": \"Requested\"}`)\r\n\r\n\treq, _ := http.NewRequest(\"POST\", \"http://localhost:8080/certificates/2/transfers\", bytes.NewBuffer(xfer))\r\n\tresponse := executeRequest(req)\r\n\r\n\tcheckResponseCode(t, http.StatusBadRequest, response.Code)\r\n\r\n\texpected := \"Target test100@test.com isn't valid.\\n\"\r\n\tif body := response.Body.String(); body != expected {\r\n\t\tt.Errorf(\"\\nExpected %sGot\\t %s\", expected, body)\r\n\t}\r\n}", "title": "" }, { "docid": "004cfe1e9118aee631478baa3ca0068d", "score": "0.53915894", "text": "func TestFailedTransfer(t *testing.T) {\n\ts := NewTestServer(true)\n\tdefer s.Stop()\n\n\tconf := goftp.Config{\n\t\tUser: \"test\",\n\t\tPassword: \"test\",\n\t}\n\n\tvar err error\n\tvar c *goftp.Client\n\n\tif c, err = goftp.DialConfig(conf, s.Addr()); err != nil {\n\t\tt.Fatal(\"Couldn't connect\", err)\n\t}\n\tdefer c.Close()\n\n\t// We create a 1KB file and upload it\n\tfile := createTemporaryFile(t, 1*1024)\n\tif err = c.Store(\"/non/existing/path/file.bin\", file); err == nil {\n\t\tt.Fatal(\"This upload should have failed\")\n\t}\n\n\tif err = c.Store(\"file.bin\", file); err != nil {\n\t\tt.Fatal(\"This upload should have succeeded\", err)\n\t}\n}", "title": "" }, { "docid": "f212356c5d03035af6abb10dc6e46bab", "score": "0.53214693", "text": "func (s *ConnLimiterSuite) TestFailure(c *C) {\n\tl, err := NewClientIpLimiter(1)\n\tc.Assert(err, IsNil)\n\tre, err := l.ProcessRequest(makeRequest(\"\"))\n\tc.Assert(err, NotNil)\n\tc.Assert(re, IsNil)\n}", "title": "" }, { "docid": "76d2430788ce237501f95f97de913797", "score": "0.5285886", "text": "func testOAuthBadGateway(t *testing.T, fn func(t *testing.T, w http.ResponseWriter, r *http.Request)) {\n\toauthHost, done := testOAuthServer(t, fn)\n\tdefer done()\n\n\turl, done2 := testAuthHandler(t, \"http://foo.com\", oauthHost, nil)\n\tdefer done2()\n\n\tres, err := http.Get(url + \"?code=foo\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif got, want := res.StatusCode, http.StatusBadGateway; got != want {\n\t\tt.Fatalf(\"unexpected HTTP status code: %d != %d\", got, want)\n\t}\n}", "title": "" }, { "docid": "d90361d005647c30e9394c7e4aa00abe", "score": "0.52299637", "text": "func TestAcceptNonExistingTransfer(t *testing.T) {\r\n\treq, _ := http.NewRequest(\"PUT\", \"http://localhost:8080/certificates/2/transfers\", nil)\r\n\tresponse := executeRequest(req)\r\n\r\n\tcheckResponseCode(t, http.StatusBadRequest, response.Code)\r\n\r\n\texpected := \"No transfer has been requested for certificate 2.\\n\"\r\n\tif body := response.Body.String(); body != expected {\r\n\t\tt.Errorf(\"\\nExpected %sGot\\t %s\", expected, body)\r\n\t}\r\n}", "title": "" }, { "docid": "032cd3aa15aa7b18946d1fcbb38dd7c2", "score": "0.5171844", "text": "func TestAcceptTransferInvalidCert(t *testing.T) {\r\n\treq, _ := http.NewRequest(\"PUT\", \"http://localhost:8080/certificates/4/transfers\", nil)\r\n\tresponse := executeRequest(req)\r\n\r\n\tcheckResponseCode(t, http.StatusBadRequest, response.Code)\r\n\r\n\texpected := \"Certificate ID 4 doesn't exist. Cannot accept transfer.\\n\"\r\n\tif body := response.Body.String(); body != expected {\r\n\t\tt.Errorf(\"\\nExpected %sGot\\t %s\", expected, body)\r\n\t}\r\n}", "title": "" }, { "docid": "8fc448073b426d96b33128512026f202", "score": "0.5167909", "text": "func TestInvalidHTTPTrafficPayload(t *testing.T) {\n\tagent, err := New(\"h2\", \"https://127.0.0.1:8080\", \"\", \"test\", \"\", false, false)\n\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tm := messages.Base{\n\t\tVersion: 1.0,\n\t\tID: agent.ID,\n\t\tType: \"BadPayload\",\n\t\tToken: agent.JWT,\n\t}\n\n\t_, errHandler := agent.sendMessage(\"POST\", m)\n\tif errHandler == nil {\n\t\tt.Error(\"the agent handled a message with a wrong UUID without returning an error\")\n\t}\n}", "title": "" }, { "docid": "9cae340619d1df1fe78096606c4ff6a1", "score": "0.51395786", "text": "func TestSendRequestFailure(t *testing.T) {\n\thttpClient := NewHTTPClient()\n\tif httpClient == nil {\n\t\tt.Fatal(\"Failed to build HTTP client\")\n\t}\n\n\treq, err := http.NewRequest(Method, URL, bytes.NewReader([]byte{}))\n\tif err != nil {\n\t\tt.Errorf(\"Error in creating new http request message: %v\", err)\n\t\treturn\n\t}\n\n\tresp, respErr := SendRequest(req, httpClient)\n\tif resp != nil && respErr == nil {\n\t\tt.Errorf(\"Error, response should not come as data is not valid\")\n\t}\n\tif respErr == nil {\n\t\t_ = resp.Body.Close()\n\t}\n}", "title": "" }, { "docid": "3cfa913533cc99c5f7e14074f50b33ee", "score": "0.51107675", "text": "func TestServiceEndpointIncomingWebhook_Delete_DoesNotSwallowError(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tr := ResourceServiceEndpointIncomingWebhook()\n\tresourceData := schema.TestResourceDataRaw(t, r.Schema, nil)\n\tflattenServiceEndpointIncomingWebhook(resourceData, &incomingWebhookTestServiceEndpoint, incomingWebhookTestServiceEndpointProjectID)\n\n\tbuildClient := azdosdkmocks.NewMockServiceendpointClient(ctrl)\n\tclients := &client.AggregatedClient{ServiceEndpointClient: buildClient, Ctx: context.Background()}\n\n\texpectedArgs := serviceendpoint.DeleteServiceEndpointArgs{\n\t\tEndpointId: incomingWebhookTestServiceEndpoint.Id,\n\t\tProjectIds: &[]string{\n\t\t\tincomingWebhookTestServiceEndpointProjectID.String(),\n\t\t},\n\t}\n\tbuildClient.\n\t\tEXPECT().\n\t\tDeleteServiceEndpoint(clients.Ctx, expectedArgs).\n\t\tReturn(errors.New(\"DeleteServiceEndpoint() Failed\")).\n\t\tTimes(1)\n\n\terr := r.Delete(resourceData, clients)\n\trequire.Contains(t, err.Error(), \"DeleteServiceEndpoint() Failed\")\n}", "title": "" }, { "docid": "4133b2c795b2de28056bfae855cd8950", "score": "0.50882727", "text": "func TestDoesClientWhiteListRedirect(t *testing.T) {\n\tfor k, c := range []struct {\n\t\tclient fosite.Client\n\t\turl string\n\t\tisError bool\n\t\texpected string\n\t}{\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"\"}},\n\t\t\turl: \"https://foo.com/cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"wta://auth\"}},\n\t\t\turl: \"wta://auth\",\n\t\t\texpected: \"wta://auth\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"wta:///auth\"}},\n\t\t\turl: \"wta:///auth\",\n\t\t\texpected: \"wta:///auth\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"wta://foo/auth\"}},\n\t\t\turl: \"wta://foo/auth\",\n\t\t\texpected: \"wta://foo/auth\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"https://bar.com/cb\"}},\n\t\t\turl: \"https://foo.com/cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"https://bar.com/cb\"}},\n\t\t\turl: \"\",\n\t\t\tisError: false,\n\t\t\texpected: \"https://bar.com/cb\",\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"\"}},\n\t\t\turl: \"\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"https://bar.com/cb\"}},\n\t\t\turl: \"https://bar.com/cb\",\n\t\t\tisError: false,\n\t\t\texpected: \"https://bar.com/cb\",\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"https://bar.com/cb\"}},\n\t\t\turl: \"https://bar.com/cb123\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://[::1]\"}},\n\t\t\turl: \"http://[::1]:1024\",\n\t\t\texpected: \"http://[::1]:1024\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://[::1]\"}},\n\t\t\turl: \"http://[::1]:1024/cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://[::1]/cb\"}},\n\t\t\turl: \"http://[::1]:1024/cb\",\n\t\t\texpected: \"http://[::1]:1024/cb\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://[::1]\"}},\n\t\t\turl: \"http://foo.bar/bar\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1\"}},\n\t\t\turl: \"http://127.0.0.1:1024\",\n\t\t\texpected: \"http://127.0.0.1:1024\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1/cb\"}},\n\t\t\turl: \"http://127.0.0.1:64000/cb\",\n\t\t\texpected: \"http://127.0.0.1:64000/cb\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1\"}},\n\t\t\turl: \"http://127.0.0.1:64000/cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1\"}},\n\t\t\turl: \"http://127.0.0.1\",\n\t\t\texpected: \"http://127.0.0.1\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1/Cb\"}},\n\t\t\turl: \"http://127.0.0.1:8080/Cb\",\n\t\t\texpected: \"http://127.0.0.1:8080/Cb\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1\"}},\n\t\t\turl: \"http://foo.bar/bar\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1\"}},\n\t\t\turl: \":/invalid.uri)bar\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1:8080/cb\"}},\n\t\t\turl: \"http://127.0.0.1:8080/Cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1:8080/cb\"}},\n\t\t\turl: \"http://127.0.0.1:8080/cb?foo=bar\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1:8080/cb?foo=bar\"}},\n\t\t\turl: \"http://127.0.0.1:8080/cb?foo=bar\",\n\t\t\texpected: \"http://127.0.0.1:8080/cb?foo=bar\",\n\t\t\tisError: false,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1:8080/cb?foo=bar\"}},\n\t\t\turl: \"http://127.0.0.1:8080/cb?baz=bar&foo=bar\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1:8080/cb?foo=bar&baz=bar\"}},\n\t\t\turl: \"http://127.0.0.1:8080/cb?baz=bar&foo=bar\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"https://www.ory.sh/cb\"}},\n\t\t\turl: \"http://127.0.0.1:8080/cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"http://127.0.0.1:8080/cb\"}},\n\t\t\turl: \"https://www.ory.sh/cb\",\n\t\t\tisError: true,\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"web+application://callback\"}},\n\t\t\turl: \"web+application://callback\",\n\t\t\tisError: false,\n\t\t\texpected: \"web+application://callback\",\n\t\t},\n\t\t{\n\t\t\tclient: &fosite.DefaultClient{RedirectURIs: []string{\"https://google.com/?foo=bar%20foo+baz\"}},\n\t\t\turl: \"https://google.com/?foo=bar%20foo+baz\",\n\t\t\tisError: false,\n\t\t\texpected: \"https://google.com/?foo=bar%20foo+baz\",\n\t\t},\n\t} {\n\t\tredir, err := fosite.MatchRedirectURIWithClientRedirectURIs(c.url, c.client)\n\t\tassert.Equal(t, c.isError, err != nil, \"%d: %+v\", k, c)\n\t\tif err == nil {\n\t\t\trequire.NotNil(t, redir, \"%d\", k)\n\t\t\tassert.Equal(t, c.expected, redir.String(), \"%d\", k)\n\t\t}\n\t\tt.Logf(\"Passed test case %d\", k)\n\t}\n}", "title": "" }, { "docid": "37fd3708396c50fb36c37cc0bff5e3ee", "score": "0.5087542", "text": "func ExpectationFailed(w http.ResponseWriter, data ...interface{}) {\n\trespond(w, http.StatusExpectationFailed, data...)\n}", "title": "" }, { "docid": "1001c321d8c3131a07f48dc7918f9d4a", "score": "0.5068923", "text": "func TestFailoverErrorPageAllServersDown(t *testing.T) {\n\tcheckForSkipFailover(t)\n\tResetBackends(backendsByPriority)\n\n\tconst expectedStatusCode = http.StatusServiceUnavailable\n\tvar expectedBody string\n\n\tswitch {\n\tcase vendorFastly:\n\t\texpectedBody = \"Sorry! We're having issues right now. Please try again later.\"\n\tdefault:\n\t\texpectedBody = \"Guru Meditation\"\n\t}\n\n\toriginServer.Stop()\n\tbackupServer1.Stop()\n\tbackupServer2.Stop()\n\n\treq := NewUniqueEdgeGET(t)\n\tresp := RoundTripCheckError(t, req)\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != expectedStatusCode {\n\t\tt.Errorf(\n\t\t\t\"Invalid StatusCode received. Expected %d, got %d\",\n\t\t\texpectedStatusCode,\n\t\t\tresp.StatusCode,\n\t\t)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif bodyStr := string(body); !strings.Contains(bodyStr, expectedBody) {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect response body. Expected to contain %q, got %q\",\n\t\t\texpectedBody,\n\t\t\tbodyStr,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "3ca7619cab62f9a130dd5188bcfb68a7", "score": "0.5040865", "text": "func IsEndpointListeningMockedFailure(address string, timeout time.Duration) bool {\n\treturn false\n}", "title": "" }, { "docid": "f14d4ec7289bcd8403ae28569d2b5665", "score": "0.49907547", "text": "func testRetryTransportRetryPredicate(err error) (bool, string) {\n\tif gerr, ok := err.(*googleapi.Error); ok {\n\t\tif gerr.Code == testRetryTransportCodeRetry {\n\t\t\treturn true, \"retryable error\"\n\t\t}\n\t}\n\treturn false, \"\"\n}", "title": "" }, { "docid": "2cfa63c14f86771ead1378fd024755c2", "score": "0.49547938", "text": "func TestErrorConditions(t *testing.T) {\n\t// A request without a valid authorization header should return with status code 401 - Unauthorized\n\tres, _ := request(\"GET\", \"\", \"\", nil)\n\tcheckResponse(t, res, http.StatusUnauthorized, \"\")\n\n\t// Requests with unsupported HTTP methods should return with 405 - method not allowed\n\tres, _ = request(\"POST\", \"\", \"\", nil)\n\tcheckResponse(t, res, http.StatusMethodNotAllowed, \"\")\n\tres, _ = request(\"DELETE\", \"\", \"\", nil)\n\tcheckResponse(t, res, http.StatusMethodNotAllowed, \"\")\n\tres, _ = request(\"GET\", \"/auth\", \"\", nil)\n\tcheckResponse(t, res, http.StatusMethodNotAllowed, \"\")\n\n\t// Requests to unsupported paths should return with 404 - not found\n\tres, _ = request(\"GET\", \"/invalidpath\", \"\", nil)\n\tcheckResponse(t, res, http.StatusNotFound, \"\")\n\n\t// In case `RequireTLS` is set to true, requests via http should be rejected with status code 403 - forbidden\n\tapp.RequireTLS = true\n\tres, _ = request(\"GET\", \"\", \"\", nil)\n\tcheckResponse(t, res, http.StatusForbidden, \"\")\n}", "title": "" }, { "docid": "7a4d035768899d3d4481fac0b60693ea", "score": "0.49533656", "text": "func TestRetryTransport_SingleRequestError(t *testing.T) {\n\tts, client := setUpRetryTransportServerClient(\n\t\t// Request fails immediately\n\t\ttestRetryTransportHandler_noRetries(t, testRetryTransportCodeFailure))\n\tdefer ts.Close()\n\n\tresp, err := client.Get(ts.URL)\n\ttestRetryTransport_checkFailure(t, resp, err, 400)\n}", "title": "" }, { "docid": "e95cf01d212b6cc829ca202223164eb9", "score": "0.49527803", "text": "func TestShouldReturn202AcceptedOnTemporaryFailure(t *testing.T) {\n\n\tvar testcases = []struct {\n\t\tid string\n\t\tresponseError error\n\t\tresponseStatusCode int\n\t\tresponseLimits *Limits\n\t}{\n\t\t{\"ShouldReturn202OnPostError\", errors.New(\"post error\"), 0, nil},\n\t\t{\"ShouldReturn202OnInternalServerError\", nil, 500, nil},\n\t\t{\"ShouldReturn202OnGatewayTimeOut504\", nil, 504, nil},\n\t\t{\"ShouldReturn202OnNetworkReadTimeOut598\", nil, 598, nil},\n\t\t{\"ShouldReturn202OnNetworkTimeOut599\", nil, 599, nil},\n\t}\n\t// **** GIVEN ****\n\n\t// The REST API server is initialized and connected to the message handler mock\n\tpcm := NewPushNotificationsSenderMock()\n\tprocessor := NewProcessor(pcm, NewLimitsCounterImpl())\n\n\ttestMessage := PushNotification{Token: \"<dummy token>\", User: \"<dummy user>\", Message: \"\"}\n\n\t// start the processor\n\tgo processor.Run()\n\n\tfor _, tc := range testcases {\n\n\t\tt.Run(tc.id, func(t *testing.T) {\n\n\t\t\t// **** WHEN ****\n\n\t\t\t// set the response in the mock\n\t\t\tpcm.ForceResponse(tc.responseError, tc.responseStatusCode, tc.responseLimits, \"{\\\"status\\\": 1}\")\n\n\t\t\t// a push notification is obtained by the process (via IncommingPushNotificationMessageHandler interface method HandleMessage())\n\t\t\tvar response = PushNotificationHandlingResponse{}\n\t\t\terr := processor.HandleMessage(&response, testMessage)\n\n\t\t\t// **** THEN ****\n\n\t\t\t// the request should respond correctly\n\t\t\tif err == nil {\n\n\t\t\t\t// check the response code\n\t\t\t\tif response.responseCode != 202 {\n\t\t\t\t\tt.Errorf(\"The handling of the message returned response code %d, but expected was 202\", response.responseCode)\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tt.Errorf(\"Handling of the message failed with error %s, response code %d.\", err, response.responseCode)\n\t\t\t}\n\n\t\t\t// if the limits match the expected limits\n\t\t\tif response.limits != tc.responseLimits {\n\n\t\t\t\tt.Errorf(\"Returned limits %s don't match the expected value %s.\", response.limits, tc.responseLimits)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "10737385eee1d8444e0f5d2d7156bb69", "score": "0.49518636", "text": "func TestAppRequestSendFailed(t *testing.T) {\n\trequire := require.New(t)\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tnetworkClient := NewMockNetworkClient(ctrl)\n\n\tclient := NewClient(\n\t\t&ClientConfig{\n\t\t\tNetworkClient: networkClient,\n\t\t\tLog: logging.NoLog{},\n\t\t\tMetrics: &mockMetrics{},\n\t\t},\n\t)\n\n\t// Mock failure to send app request\n\tnetworkClient.EXPECT().RequestAny(\n\t\tgomock.Any(),\n\t\tgomock.Any(),\n\t\tgomock.Any(),\n\t).Return(ids.NodeID{}, nil, errAppSendFailed).Times(2)\n\n\t_, err := client.GetChangeProof(\n\t\tcontext.Background(),\n\t\t&pb.SyncGetChangeProofRequest{},\n\t\tnil, // database is unused\n\t)\n\trequire.ErrorIs(err, errAppSendFailed)\n\n\t_, err = client.GetRangeProof(\n\t\tcontext.Background(),\n\t\t&pb.SyncGetRangeProofRequest{},\n\t)\n\trequire.ErrorIs(err, errAppSendFailed)\n}", "title": "" }, { "docid": "602ef0f9d5731718c3eb278f1c98de81", "score": "0.49236333", "text": "func TestRequestForwarding(t *testing.T) {\n\tfakeCloudPoolProxy := &FakeCloudPoolProxy{}\n\tproxyServer := NewServer(fakeCloudPoolProxy, 8080, 0)\n\thttpServer := httptest.NewServer(proxyServer.httpServer.Handler)\n\tdefer httpServer.Close()\n\n\ttests := []struct {\n\t\tmethod string\n\t\tpath string\n\t\tbody string\n\t\tfakeResponseStatus int\n\t\tfakeResponseBody string\n\t}{\n\t\t{method: \"GET\", path: \"/config\", body: \"\", fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/config\", body: `{\"a\": 1}`, fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/start\", body: \"\", fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/stop\", body: \"\", fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"GET\", path: \"/status\", body: \"\", fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"GET\", path: \"/pool\", body: \"\", fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"GET\", path: \"/pool/size\", body: \"\", fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/pool/detach\", body: `{\"machineId\": \"i-123\", \"decrementDesiredSize\": true}`, fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/pool/attach\", body: `{\"machineId\": \"i-123\"}`, fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/pool/serviceState\", body: `{\"machineId\": \"i-123\", \"serviceState\": \"IN_SERVICE\"}`, fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t\t{method: \"POST\", path: \"/pool/membershipStatus\", body: `{\"machineId\": \"i-123\", \"membershipStatus\": {\"active\": false, \"evictable\": false}}`, fakeResponseStatus: 200, fakeResponseBody: `{\"ok\": true}`},\n\t}\n\n\tfor _, test := range tests {\n\n\t\tvar calledWithPath string\n\t\tvar calledWithMethod string\n\t\tvar calledWithBody string\n\n\t\t// a fake CloudPoolProxy.Forward method that records the request it\n\t\t// was called with and responds according to the fake response it has\n\t\t// that the test has been set up to use\n\t\tforwardHandler := func(request *http.Request) (*http.Response, error) {\n\t\t\tdefer request.Body.Close()\n\t\t\tbodyBytes, _ := ioutil.ReadAll(request.Body)\n\t\t\tcalledWithBody = string(bodyBytes)\n\t\t\tcalledWithMethod = request.Method\n\t\t\tcalledWithPath = request.RequestURI\n\n\t\t\tresponse := &http.Response{\n\t\t\t\tStatusCode: test.fakeResponseStatus,\n\t\t\t\tBody: ioutil.NopCloser(strings.NewReader(test.fakeResponseBody)),\n\t\t\t}\n\t\t\treturn response, nil\n\t\t}\n\t\tfakeCloudPoolProxy.ForwardHandler = forwardHandler\n\n\t\treq, _ := http.NewRequest(test.method, httpServer.URL+test.path,\n\t\t\tioutil.NopCloser(strings.NewReader(test.body)))\n\t\tresp, err := doJSONRequest(req)\n\t\tdefer resp.Body.Close()\n\t\trequire.Nil(t, err, \"server unexpectedly failed to forward request\")\n\t\tassert.Equal(t, test.method, calledWithMethod, \"server forwarded request with unexpected method\")\n\t\tassert.Equal(t, test.path, calledWithPath, \"server forwarded request with unexpected path\")\n\t\tassert.Equal(t, test.body, calledWithBody, \"server forwarded request with unexpected body\")\n\t\tbodyBytes, _ := ioutil.ReadAll(resp.Body)\n\t\tassert.Equal(t, test.fakeResponseBody, string(bodyBytes), \"server responded with unexpected body\")\n\t}\n}", "title": "" }, { "docid": "6f03e3003d0e923c96f9c00de7b70119", "score": "0.49226084", "text": "func TestGetRequestWrongResource(t *testing.T) {\n\tsetupIntegration()\n\tdefer tearDownIntegration()\n\n\tresp, _ := session.Get(strings.Join([]string{defaultResourcesUrl, \"you shall not pass\"}, \"/\"), nil, defaultHttpClient)\n\n\tif resp.StatusCode != 400 {\n\t\tt.Errorf(\"Response status error should be: %v\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "d9ada356bfde5387112d5142b7accc27", "score": "0.49218222", "text": "func TestFabricsMethodNotAllowed(t *testing.T) {\n\trouter := iris.New()\n\tredfishRoutes := router.Party(\"/redfish/v1\")\n\tredfishRoutes.Any(\"/Fabrics\", FabricsMethodNotAllowed)\n\te := httptest.New(t, router)\n\n\t//Check for status code 405 for http methods which are not allowed on Task service URLs\n\te.POST(\"/redfish/v1/Fabrics\").Expect().Status(http.StatusMethodNotAllowed)\n\te.PUT(\"/redfish/v1/Fabrics\").Expect().Status(http.StatusMethodNotAllowed)\n\te.DELETE(\"/redfish/v1/Fabrics\").Expect().Status(http.StatusMethodNotAllowed)\n}", "title": "" }, { "docid": "f39221a5997f6859b1c740c112137925", "score": "0.49187404", "text": "func TestRouteNotFound(t *testing.T) {\n\treq, _ := http.NewRequest(\"GET\", \"/ilalded\", nil)\n\tresponse := executeRequest(req)\n\tcheckResponseCode(t, http.StatusNotFound, response.Code)\n\tcheckContentType(t, JsonContentType, response.HeaderMap.Get(\"Content-Type\"))\n\n\texpected := ErrorRep{fmt.Sprintf(ErrRouteNotFound, req.Method, req.URL.Path)}\n\n\tvar result ErrorRep\n\tcheckJsonBody(t, req, response.Body.Bytes(), &expected, &result)\n}", "title": "" }, { "docid": "7a48565fb17a070ccdbd541bca5ca22f", "score": "0.4917182", "text": "func TestFailoverErrorPageAllServers5xx(t *testing.T) {\n\tcheckForSkipFailover(t)\n\tResetBackends(backendsByPriority)\n\n\tconst expectedStatusCode = http.StatusServiceUnavailable\n\tconst expectedBody = \"lucky golden ticket\"\n\n\toriginServer.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tw.Write([]byte(originServer.Name))\n\t})\n\tbackupServer1.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tw.Write([]byte(backupServer1.Name))\n\t})\n\tbackupServer2.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tw.Write([]byte(expectedBody))\n\t})\n\n\treq := NewUniqueEdgeGET(t)\n\tresp := RoundTripCheckError(t, req)\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != expectedStatusCode {\n\t\tt.Errorf(\n\t\t\t\"Invalid StatusCode received. Expected %d, got %d\",\n\t\t\texpectedStatusCode,\n\t\t\tresp.StatusCode,\n\t\t)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif bodyStr := string(body); bodyStr != expectedBody {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect response body. Expected %q, got %q\",\n\t\t\texpectedBody,\n\t\t\tbodyStr,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "e22eaddf556aa7b492005f0355dc2e9b", "score": "0.49123216", "text": "func TestServiceEndpointIncomingWebhook_Create_DoesNotSwallowError(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tr := ResourceServiceEndpointIncomingWebhook()\n\tresourceData := schema.TestResourceDataRaw(t, r.Schema, nil)\n\tflattenServiceEndpointIncomingWebhook(resourceData, &incomingWebhookTestServiceEndpoint, incomingWebhookTestServiceEndpointProjectID)\n\n\tbuildClient := azdosdkmocks.NewMockServiceendpointClient(ctrl)\n\tclients := &client.AggregatedClient{ServiceEndpointClient: buildClient, Ctx: context.Background()}\n\n\texpectedArgs := serviceendpoint.CreateServiceEndpointArgs{Endpoint: &incomingWebhookTestServiceEndpoint}\n\tbuildClient.\n\t\tEXPECT().\n\t\tCreateServiceEndpoint(clients.Ctx, expectedArgs).\n\t\tReturn(nil, errors.New(\"CreateServiceEndpoint() Failed\")).\n\t\tTimes(1)\n\n\terr := r.Create(resourceData, clients)\n\trequire.Contains(t, err.Error(), \"CreateServiceEndpoint() Failed\")\n}", "title": "" }, { "docid": "18df54907baefa9a3f2da3f2fbe861e1", "score": "0.49011782", "text": "func TestCreateTransferOnExistingTransfer(t *testing.T) {\r\n\txfer := []byte(`{\"to\": \"test11@test.com\",\"status\": \"Requested\"}`)\r\n\r\n\treq, _ := http.NewRequest(\"POST\", \"http://localhost:8080/certificates/1/transfers\", bytes.NewBuffer(xfer))\r\n\tresponse := executeRequest(req)\r\n\r\n\tcheckResponseCode(t, http.StatusBadRequest, response.Code)\r\n\r\n\texpected := \"Certificate 1 is already being transferred to test12@test.com.\\n\"\r\n\tif body := response.Body.String(); body != expected {\r\n\t\tt.Errorf(\"\\nExpected %sGot\\t %s\", expected, body)\r\n\t}\r\n}", "title": "" }, { "docid": "b49f1549710c02f7717f544634a1d0c3", "score": "0.4896162", "text": "func AssertRequestFail(t *testing.T, response interface{}, err error, check_fn func()) {\n\tif err == nil {\n\t\tresponse_json, _ := json.MarshalIndent(response, \"\", \" \")\n\t\tt.Fatalf(\"Request succeeded unexpectedly. Response:\\n%s\", response_json)\n\t} else {\n\t\tif check_fn != nil {\n\t\t\tcheck_fn()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0b4db3bc75535bf00f491d0a3c3272d1", "score": "0.4879579", "text": "func TestServiceEndpointIncomingWebhook_Read_DoesNotSwallowError(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tr := ResourceServiceEndpointIncomingWebhook()\n\tresourceData := schema.TestResourceDataRaw(t, r.Schema, nil)\n\tflattenServiceEndpointIncomingWebhook(resourceData, &incomingWebhookTestServiceEndpoint, incomingWebhookTestServiceEndpointProjectID)\n\n\tbuildClient := azdosdkmocks.NewMockServiceendpointClient(ctrl)\n\tclients := &client.AggregatedClient{ServiceEndpointClient: buildClient, Ctx: context.Background()}\n\n\texpectedArgs := serviceendpoint.GetServiceEndpointDetailsArgs{\n\t\tEndpointId: incomingWebhookTestServiceEndpoint.Id,\n\t\tProject: converter.String(incomingWebhookTestServiceEndpointProjectID.String()),\n\t}\n\tbuildClient.\n\t\tEXPECT().\n\t\tGetServiceEndpointDetails(clients.Ctx, expectedArgs).\n\t\tReturn(nil, errors.New(\"GetServiceEndpoint() Failed\")).\n\t\tTimes(1)\n\n\terr := r.Read(resourceData, clients)\n\trequire.Contains(t, err.Error(), \"GetServiceEndpoint() Failed\")\n}", "title": "" }, { "docid": "a9a26d658f5103cb58cfc4e6a1aa9cf9", "score": "0.48752898", "text": "func TestTriggerDeliveryNonExistingService(t *testing.T) {\n\n\tcredentialmanager.MockAuthCreds = true\n\tprojectName := \"sockshop\"\n\tts := httptest.NewServer(\n\t\thttp.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(200)\n\t\t\tif strings.Contains(r.RequestURI, \"v1/event\") {\n\t\t\t\tdefer r.Body.Close()\n\t\t\t\tdefer r.Body.Close()\n\t\t\t\tw.Write([]byte(eventContextMockResponse))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif strings.Contains(r.RequestURI, \"/v1/metadata\") {\n\t\t\t\tdefer r.Body.Close()\n\t\t\t\tw.Write([]byte(metadataMockResponse))\n\t\t\t\treturn\n\t\t\t} else if strings.Contains(r.RequestURI, \"service\") {\n\t\t\t\tres := fmt.Sprintf(getSvcMockResponse, \"helloservice\")\n\t\t\t\tw.Write([]byte(res))\n\t\t\t\treturn\n\t\t\t} else if strings.Contains(r.RequestURI, \"/controlPlane/v1/project/\") {\n\t\t\t\tres := fmt.Sprintf(getProjectMockResponse, projectName, \"carts\", \"dev\")\n\t\t\t\tw.Write([]byte(res))\n\t\t\t\treturn\n\t\t\t}\n\t\t}),\n\t)\n\tdefer ts.Close()\n\tt.Setenv(\"MOCK_SERVER\", ts.URL)\n\n\ttests := []struct {\n\t\tservice string\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\tservice: \"some-service\",\n\t\t\twantErr: true,\n\t\t},\n\t\t{\n\t\t\tservice: \"helloservice\",\n\t\t\twantErr: false,\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tcmd := fmt.Sprintf(\"trigger delivery --project=%s --service=%s --image=%s:%s --values=a.b.c=d --mock\",\n\t\t\t\tprojectName,\n\t\t\t\ttt.service,\n\t\t\t\t\"someregistry/carts\",\n\t\t\t\t\"0.9.1\")\n\t\t\t_, err := executeActionCommandC(cmd)\n\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"wanted error: %t, got: %v\", tt.wantErr, err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b70b4aad66217cacb815c56b30f99519", "score": "0.48552188", "text": "func TestFailoverNoFallbackHeader(t *testing.T) {\n\tcheckForSkipFailover(t)\n\tResetBackends(backendsByPriority)\n\n\tconst headerName = \"No-Fallback\"\n\tconst expectedStatus = http.StatusServiceUnavailable\n\tconst expectedBody = \"custom error page\"\n\n\toriginServer.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(headerName, \"\")\n\t\tw.WriteHeader(expectedStatus)\n\t\tw.Write([]byte(expectedBody))\n\t})\n\tbackupServer1.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tname := backupServer1.Name\n\t\tt.Errorf(\"Server %s received request and it shouldn't have\", name)\n\t\tw.Write([]byte(name))\n\t})\n\tbackupServer2.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tname := backupServer2.Name\n\t\tt.Errorf(\"Server %s received request and it shouldn't have\", name)\n\t\tw.Write([]byte(name))\n\t})\n\n\treq := NewUniqueEdgeGET(t)\n\tresp := RoundTripCheckError(t, req)\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != expectedStatus {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect status code. Expected %d, got %d\",\n\t\t\texpectedStatus,\n\t\t\tresp.StatusCode,\n\t\t)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif bodyStr := string(body); bodyStr != expectedBody {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect response body. Expected %q, got %q\",\n\t\t\texpectedBody,\n\t\t\tbodyStr,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "3b66b6f080b8b2ac7ca97f1323dfb462", "score": "0.4817591", "text": "func TestServiceEndpointIncomingWebhook_Update_DoesNotSwallowError(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\tr := ResourceServiceEndpointIncomingWebhook()\n\tresourceData := schema.TestResourceDataRaw(t, r.Schema, nil)\n\tflattenServiceEndpointIncomingWebhook(resourceData, &incomingWebhookTestServiceEndpoint, incomingWebhookTestServiceEndpointProjectID)\n\n\tbuildClient := azdosdkmocks.NewMockServiceendpointClient(ctrl)\n\tclients := &client.AggregatedClient{ServiceEndpointClient: buildClient, Ctx: context.Background()}\n\n\texpectedArgs := serviceendpoint.UpdateServiceEndpointArgs{\n\t\tEndpoint: &incomingWebhookTestServiceEndpoint,\n\t\tEndpointId: incomingWebhookTestServiceEndpoint.Id,\n\t}\n\n\tbuildClient.\n\t\tEXPECT().\n\t\tUpdateServiceEndpoint(clients.Ctx, expectedArgs).\n\t\tReturn(nil, errors.New(\"UpdateServiceEndpoint() Failed\")).\n\t\tTimes(1)\n\n\terr := r.Update(resourceData, clients)\n\trequire.Contains(t, err.Error(), \"UpdateServiceEndpoint() Failed\")\n}", "title": "" }, { "docid": "4f514a90277653471c8b6d55027f8003", "score": "0.4811267", "text": "func TestFailoverOriginDownUseFirstMirror(t *testing.T) {\n\tcheckForSkipFailover(t)\n\tResetBackends(backendsByPriority)\n\n\texpectedBody := \"lucky golden ticket\"\n\texpectedStatus := http.StatusOK\n\n\toriginServer.Stop()\n\tbackupServer1.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(expectedBody))\n\t})\n\tbackupServer2.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tname := backupServer2.Name\n\t\tt.Errorf(\"Server %s received a request and it shouldn't have\", name)\n\t\tw.Write([]byte(name))\n\t})\n\n\treq := NewUniqueEdgeGET(t)\n\tresp := RoundTripCheckError(t, req)\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != expectedStatus {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect status code. Expected %d, got %d\",\n\t\t\texpectedStatus,\n\t\t\tresp.StatusCode,\n\t\t)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif bodyStr := string(body); bodyStr != expectedBody {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect response body. Expected %q, got %q\",\n\t\t\texpectedBody,\n\t\t\tbodyStr,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "23a32a43694e9adbfc84024969dff7d8", "score": "0.4788967", "text": "func (mrf *mockRaftFuture) Error() error { return mrf.err }", "title": "" }, { "docid": "23a32a43694e9adbfc84024969dff7d8", "score": "0.4788967", "text": "func (mrf *mockRaftFuture) Error() error { return mrf.err }", "title": "" }, { "docid": "88bef7be05ecfb86acba2f04a36c6f22", "score": "0.47678858", "text": "func TestDo_redirectLoop(t *testing.T) {\n\tclient, mux, teardown := setup()\n\tdefer teardown()\n\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.Redirect(w, r, baseURLPath, http.StatusFound)\n\t})\n\n\treq, _ := client.NewRequest(ctx, http.MethodGet, \".\", nil)\n\t_, err := client.Do(context.Background(), req, nil)\n\n\tif err == nil {\n\t\tt.Error(\"Expected error to be returned.\")\n\t}\n\tvar target *url.Error\n\tif !errors.As(err, &target) {\n\t\tt.Errorf(\"Expected a URL error; got %#v.\", err)\n\t}\n}", "title": "" }, { "docid": "1189d98cdae1a75db31dbccc1f96c52e", "score": "0.47615272", "text": "func expectResetStreamError(t *testing.T, err error) {\n\tif err == nil {\n\t\tt.Fatalf(\"expected the server to send an error, but got nil\")\n\t}\n\tif isStreamReset(err) {\n\t\treturn\n\t}\n\tt.Fatalf(\"expected a stream reset error, but got %#+v=%s\", err, err.Error())\n}", "title": "" }, { "docid": "b0f3dd3436ff3b51a3c6a0410addd010", "score": "0.4759522", "text": "func TestIncorrectPath(t *testing.T) {\n\n\tresponse := retrieveHTTPResponse(t, rootPath, \"/foo\")\n\n\tif response != \"ERROR: Path not recognized. Use /fib.\\n\" {\n\t\tt.Errorf(\"Incorrect response to /foo path request. Got %s\", response)\n\t}\n}", "title": "" }, { "docid": "989393fe8b383f1154ddce0d02f47aca", "score": "0.47409427", "text": "func TestRetryTransport_DoesNotRetryEmptyGetBody(t *testing.T) {\n\tmsg := \"non empty body\"\n\tattempted := false\n\n\tts, client := setUpRetryTransportServerClient(http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\t// Check for request body\n\t\t\tdump, err := ioutil.ReadAll(r.Body)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(testRetryTransportCodeFailure)\n\t\t\t\tif _, werr := w.Write([]byte(fmt.Sprintf(\"got error: %v\", err))); werr != nil {\n\t\t\t\t\tt.Errorf(\"[ERROR] unable to write to response writer: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tdumpS := string(dump)\n\t\t\tif dumpS != msg {\n\t\t\t\tw.WriteHeader(testRetryTransportCodeFailure)\n\t\t\t\tif _, werr := w.Write([]byte(fmt.Sprintf(\"got unexpected body: %s\", dumpS))); werr != nil {\n\t\t\t\t\tt.Errorf(\"[ERROR] unable to write to response writer: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif attempted {\n\t\t\t\tw.WriteHeader(testRetryTransportCodeFailure)\n\t\t\t\tif _, werr := w.Write([]byte(\"expected only one try\")); werr != nil {\n\t\t\t\t\tt.Errorf(\"[ERROR] unable to write to response writer: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tattempted = true\n\t\t\tw.WriteHeader(testRetryTransportCodeRetry)\n\t\t}))\n\tdefer ts.Close()\n\n\t// Create request\n\treq, err := http.NewRequest(\"GET\", ts.URL, strings.NewReader(msg))\n\tif err != nil {\n\t\tt.Errorf(\"[ERROR] unable to make test request: %v\", err)\n\t}\n\t// remove GetBody\n\treq.GetBody = nil\n\n\tresp, err := client.Do(req)\n\ttestRetryTransport_checkFailedWhileRetrying(t, resp, err)\n}", "title": "" }, { "docid": "4a240af9872b13f2e7c9e448fe1445df", "score": "0.4725112", "text": "func preferRemoteNodeOnlyFailedSchedulingTest(t *testing.T) {\n\tnodes := &v1.NodeList{}\n\tnodes.Items = append(nodes.Items, *newNode(\"node1\", \"node1\", \"192.168.0.1\", \"rack1\", \"a\", \"zone1\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"node2\", \"node2\", \"192.168.0.2\", \"rack1\", \"a\", \"zone1\"))\n\tnodes.Items = append(nodes.Items, *newNode(\"node3\", \"node3\", \"192.168.0.3\", \"rack1\", \"a\", \"zone1\"))\n\n\tif err := driver.CreateCluster(3, nodes); err != nil {\n\t\tt.Fatalf(\"Error creating cluster: %v\", err)\n\t}\n\tpod := newPod(\"preferRemoteNodeOnlyFailedSchedulingTest\", map[string]bool{\"preferRemoteNodeOnlyFailedSchedulingTest\": false})\n\n\tprovNodes := []int{0, 1, 2}\n\tif err := driver.ProvisionVolume(\"preferRemoteNodeOnlyFailedSchedulingTest\", provNodes, 3, map[string]string{preferRemoteNodeOnlyParameter: \"true\"}, true, false); err != nil {\n\t\tt.Fatalf(\"Error provisioning volume: %v\", err)\n\t}\n\n\t_, err := sendFilterRequest(pod, nodes)\n\trequire.Error(t, err, \"Expected error since scheduling on local node is not allowed with preferRemoteNodeOnly\")\n}", "title": "" }, { "docid": "40f6a205b2f697a2673b931acefcdc85", "score": "0.47179836", "text": "func (c *APIClient) PingFailure(uuid string, body io.Reader) error {\n\treturn c.ping(uuid, body, \"/fail\")\n}", "title": "" }, { "docid": "0e2068c00f85401ce987b43a3cea30e1", "score": "0.4713449", "text": "func TestNoAuthorization(t *testing.T) {\n\tctx, cancelCtx := context.WithCancel(context.Background())\n\tdefer cancelCtx()\n\n\tlocalChain := local.Connect(ctx)\n\tcoreFirewall := newMockCoreFirewall()\n\tpolicy := createNewPolicy(localChain, coreFirewall)\n\n\tremotePeerPublicKey, remotePeerID, _ := newPeer(t, localChain)\n\n\texpectedError := fmt.Sprintf(\n\t\t\"remote peer [%v] has no authorization on the factory\",\n\t\tremotePeerID,\n\t)\n\n\tif err := policy.Validate(\n\t\tkey.NetworkKeyToECDSAKey(remotePeerPublicKey),\n\t); err.Error() != expectedError {\n\t\tt.Fatalf(\n\t\t\t\"unexpected validation error\\nactual: [%v]\\nexpected: [%v]\",\n\t\t\terr,\n\t\t\texpectedError,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "0d06290051f31094e771d583ad44d9a9", "score": "0.47116357", "text": "func TestDo_redirectLoop(t *testing.T) {\n\tsetup()\n\tdefer teardown()\n\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\t})\n\n\treq, _ := client.NewRequest(\"GET\", \"/\", nil)\n\t_, err := client.Do(req, nil)\n\n\tif err == nil {\n\t\tt.Fatal(\"Expected error to be returned.\")\n\t}\n\tif err, ok := err.(*url.Error); !ok {\n\t\tt.Errorf(\"Expected a URL error; got %#v.\", err)\n\t}\n}", "title": "" }, { "docid": "dc609e695895c201c6df81ad87ae6385", "score": "0.47087127", "text": "func TestNotFound(t *testing.T) {\n\n\tserverError := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.NotFound(w, r)\n\t}))\n\turltemplate = serverError.URL\n\tdefer serverError.Close()\n\tlog.Printf(\"Mock Mapbox Studio: %s\", urltemplate)\n\n\tonce.Do(tileserverSetup)\n\tts := httptest.NewServer(tsv)\n\tdefer ts.Close()\n\n\tmapproxy_url := ts.URL + \"/street/1/0/0.png\"\n\tlog.Printf(\"Mock go-mapproxy: %s\\n\", mapproxy_url)\n\tres, err := http.Get(mapproxy_url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Info(\"StatusCode: \", res.StatusCode)\n\tif res.StatusCode != 404 {\n\t\tt.Errorf(\"StatusCode: got %d; want %d\", res.StatusCode, 404)\n\t}\n\tcontent, err := ioutil.ReadAll(res.Body)\n\tres.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Info(\"Content length: \", len(content))\n\tlog.Info(\"Content: \", string(content))\n}", "title": "" }, { "docid": "897a6e6bc308f67e019b6a9d4a64be29", "score": "0.4698345", "text": "func HttpFailure(w http.ResponseWriter, httpStatusCode int) {\n http.Error(w, http.StatusText(httpStatusCode), httpStatusCode)\n}", "title": "" }, { "docid": "bcb85ea3716e37d963961abfe4312c0f", "score": "0.46966943", "text": "func TestAsMethodNotAllowed(t *testing.T) {\n\theader[\"Allow\"] = []string{\"GET\"}\n\tdefer delete(header, \"Allow\")\n\trouter := iris.New()\n\tredfishRoutes := router.Party(\"/redfish\")\n\tredfishRoutes.Any(\"/v1/AccountService\", AsMethodNotAllowed)\n\te := httptest.New(t, router)\n\n\t//Check for status code 405 for http methods which are not allowed on Account service URL\n\te.POST(\"/redfish/v1/AccountService\").Expect().Status(http.StatusMethodNotAllowed).Headers().Equal(header)\n\te.PUT(\"/redfish/v1/AccountService\").Expect().Status(http.StatusMethodNotAllowed)\n\te.DELETE(\"/redfish/v1/AccountService\").Expect().Status(http.StatusMethodNotAllowed)\n}", "title": "" }, { "docid": "42c4d3e6bb2c6068ff8db7e6ef2d46ad", "score": "0.46939903", "text": "func TestNetworkingSendError(t *testing.T) {\n\tnetworking := newMockNetworking()\n\tdone := make(chan int)\n\tdht := NewDHT(\n\t\tSocket{Gateway: net.ParseIP(\"127.0.0.1\"), Port: 3000},\n\t\tOptionNodeIDChecksum(nodeChecksumFunc(alwaysValidChecksum)),\n\t)\n\tdht.networking = networking\n\n\tgo dht.Bind(grpc.NewServer())\n\n\tgo func() {\n\t\tnetworking.fail <- ErrMockNetworking\n\t\tclose(done)\n\t}()\n\n\tdht.Bootstrap(NetworkNode{\n\t\tID: getZerodIDWithNthByte(1, byte(255)),\n\t\tPort: 3001,\n\t\tIP: net.ParseIP(\"0.0.0.0\"),\n\t})\n\n\tdht.Disconnect()\n\t<-done\n}", "title": "" }, { "docid": "01aab2c7ad8b3196967cf92bb0489e05", "score": "0.46871543", "text": "func TestTCPProxyTLSPassthrough(t *testing.T) {\n\trh, c, done := setup(t)\n\tdefer done()\n\n\tsvc := fixture.NewService(\"correct-backend\").\n\t\tWithPorts(v1.ServicePort{Port: 80, TargetPort: intstr.FromInt(8080)})\n\n\trh.OnAdd(svc)\n\n\thp1 := &contour_api_v1.HTTPProxy{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"simple\",\n\t\t\tNamespace: svc.Namespace,\n\t\t},\n\t\tSpec: contour_api_v1.HTTPProxySpec{\n\t\t\tVirtualHost: &contour_api_v1.VirtualHost{\n\t\t\t\tFqdn: \"kuard-tcp.example.com\",\n\t\t\t\tTLS: &contour_api_v1.TLS{\n\t\t\t\t\tPassthrough: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\t// TODO(tsaarni)\n\t\t\t// According to HTTPProxy documentation, routes should not be processed if HTTPProxy is in tcpproxy mode.\n\t\t\t// Consider removing routes from this test case, and create separate tests for tcpproxies with routes.\n\t\t\t// See also https://github.com/projectcontour/contour/issues/3800\n\t\t\tRoutes: []contour_api_v1.Route{{\n\t\t\t\tConditions: matchconditions(prefixMatchCondition(\"/\")),\n\t\t\t\tServices: []contour_api_v1.Service{{\n\t\t\t\t\tName: \"wrong-backend\",\n\t\t\t\t\tPort: 80,\n\t\t\t\t}},\n\t\t\t}},\n\t\t\tTCPProxy: &contour_api_v1.TCPProxy{\n\t\t\t\tServices: []contour_api_v1.Service{{\n\t\t\t\t\tName: svc.Name,\n\t\t\t\t\tPort: 80,\n\t\t\t\t}},\n\t\t\t},\n\t\t},\n\t}\n\trh.OnAdd(hp1)\n\n\tc.Request(listenerType).Equals(&envoy_discovery_v3.DiscoveryResponse{\n\t\tResources: resources(t,\n\t\t\t// TODO(tsaarni)\n\t\t\t// Reference to non-existing backend (\"wrong-backend\" above) does not anymore prevent processing of routes, since\n\t\t\t// we would generally program 502/503 responses for missing services.\n\t\t\t// Currently in tcpproxy mode, this will trigger creation of HTTP listener for HTTPS upgrade redirect.\n\t\t\t// However, the reason for HTTP listener should have been HTTPS upgrade redirect for tcpproxy, not routes,\n\t\t\t// See also https://github.com/projectcontour/contour/issues/3800\n\t\t\tdefaultHTTPListener(),\n\t\t\t&envoy_listener_v3.Listener{\n\t\t\t\tName: \"ingress_https\",\n\t\t\t\tAddress: envoy_v3.SocketAddress(\"0.0.0.0\", 8443),\n\t\t\t\tFilterChains: []*envoy_listener_v3.FilterChain{{\n\t\t\t\t\tFilters: envoy_v3.Filters(\n\t\t\t\t\t\ttcpproxy(\"ingress_https\", \"default/correct-backend/80/da39a3ee5e\"),\n\t\t\t\t\t),\n\t\t\t\t\tFilterChainMatch: &envoy_listener_v3.FilterChainMatch{\n\t\t\t\t\t\tServerNames: []string{\"kuard-tcp.example.com\"},\n\t\t\t\t\t},\n\t\t\t\t}},\n\t\t\t\tListenerFilters: envoy_v3.ListenerFilters(\n\t\t\t\t\tenvoy_v3.TLSInspector(),\n\t\t\t\t),\n\t\t\t\tSocketOptions: envoy_v3.NewSocketOptions().TCPKeepalive().Build(),\n\t\t\t},\n\t\t\tstatsListener(),\n\t\t),\n\t\tTypeUrl: listenerType,\n\t})\n\n\tc.Request(routeType).Equals(&envoy_discovery_v3.DiscoveryResponse{\n\t\tResources: resources(t,\n\t\t\tenvoy_v3.RouteConfiguration(\"ingress_http\",\n\t\t\t\tenvoy_v3.VirtualHost(\"kuard-tcp.example.com\",\n\t\t\t\t\t&envoy_route_v3.Route{\n\t\t\t\t\t\tMatch: routePrefix(\"/\"),\n\t\t\t\t\t\tAction: &envoy_route_v3.Route_Redirect{\n\t\t\t\t\t\t\tRedirect: &envoy_route_v3.RedirectAction{\n\t\t\t\t\t\t\t\tSchemeRewriteSpecifier: &envoy_route_v3.RedirectAction_HttpsRedirect{\n\t\t\t\t\t\t\t\t\tHttpsRedirect: true,\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\tTypeUrl: routeType,\n\t})\n}", "title": "" }, { "docid": "4a176c178feb0ee2c279c8403eed33a9", "score": "0.46796587", "text": "func TestEgressHttp(t *testing.T) {\n\tctx := context.Background()\n\tout, err := TestHelper.LinkerdRun(\"inject\", \"testdata/proxy.yaml\")\n\tif err != nil {\n\t\ttestutil.AnnotatedFatal(t, \"unexpected error\", err)\n\t}\n\n\tTestHelper.WithDataPlaneNamespace(ctx, \"egress-test\", map[string]string{}, t, func(t *testing.T, ns string) {\n\n\t\tout, err = TestHelper.KubectlApply(out, ns)\n\t\tif err != nil {\n\t\t\ttestutil.AnnotatedFatalf(t, \"unexpected error\", \"unexpected error: %v output:\\n%s\", err, out)\n\t\t}\n\n\t\terr = TestHelper.CheckPods(ctx, ns, \"egress-test\", 1)\n\t\tif err != nil {\n\t\t\t//nolint:errorlint\n\t\t\tif rce, ok := err.(*testutil.RestartCountError); ok {\n\t\t\t\ttestutil.AnnotatedWarn(t, \"CheckPods timed-out\", rce)\n\t\t\t} else {\n\t\t\t\ttestutil.AnnotatedError(t, \"CheckPods timed-out\", err)\n\t\t\t}\n\t\t}\n\n\t\ttestCase := func(url, methodToUse string) {\n\t\t\ttestName := fmt.Sprintf(\"Can use egress to send %s request to (%s)\", methodToUse, url)\n\t\t\tt.Run(testName, func(t *testing.T) {\n\t\t\t\tcmd := []string{\n\t\t\t\t\t\"-n\", ns, \"exec\", \"deploy/egress-test\", \"-c\", \"http-egress\",\n\t\t\t\t\t\"--\", \"curl\", \"-sko\", \"/dev/null\", \"-w\", \"%{http_code}\", \"-X\", methodToUse, url,\n\t\t\t\t}\n\t\t\t\tout, err := TestHelper.Kubectl(\"\", cmd...)\n\t\t\t\tif err != nil {\n\t\t\t\t\ttestutil.AnnotatedFatalf(t, fmt.Sprintf(\"failed to exec %s\", cmd), \"failed to exec %s: %s (%s)\", cmd, err, out)\n\t\t\t\t}\n\n\t\t\t\tvar status int\n\t\t\t\t_, err = fmt.Sscanf(out, \"%d\", &status)\n\t\t\t\tif err != nil {\n\t\t\t\t\ttestutil.AnnotatedFatalf(t, \"failed to parse status code\", \"failed to parse status code (%s): %s\", out, err)\n\t\t\t\t}\n\n\t\t\t\tif status < 100 || status >= 500 {\n\t\t\t\t\ttestutil.Fatalf(t, \"got HTTP error code: %d\\n\", status)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tsupportedProtocols := []string{\"http\", \"https\"}\n\t\tmethods := []string{\"GET\", \"POST\"}\n\t\tfor _, protocolToUse := range supportedProtocols {\n\t\t\tfor _, methodToUse := range methods {\n\t\t\t\tserviceName := fmt.Sprintf(\"%s://www.linkerd.io\", protocolToUse)\n\t\t\t\ttestCase(serviceName, methodToUse)\n\t\t\t}\n\t\t}\n\n\t\t// Test egress for a domain with fewer than 3 segments.\n\t\ttestCase(\"http://linkerd.io\", \"GET\")\n\n\t})\n}", "title": "" }, { "docid": "7f26a97519850087ee64b86c7c732630", "score": "0.46791902", "text": "func TestHTTPRedirect(t *testing.T) {\n\tstartProxy(t, false)\n\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\t\treturn Dial(addr, &Config{\n\t\t\t\t\tDialProxy: func(addr string) (net.Conn, error) {\n\t\t\t\t\t\treturn net.Dial(\"tcp\", proxyAddr)\n\t\t\t\t\t},\n\t\t\t\t\tNewRequest: newRequest,\n\t\t\t\t})\n\t\t\t},\n\t\t\tDisableKeepAlives: true,\n\t\t},\n\t}\n\n\t_, counter, err := fdcount.Matching(\"TCP\")\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to get fdcount: %v\", err)\n\t}\n\n\tresp, err := client.Head(\"http://www.facebook.com\")\n\tif assert.NoError(t, err, \"Head request to facebook should have succeeded\") {\n\t\tif err := resp.Body.Close(); err != nil {\n\t\t\tlog.Debugf(\"Unable to close response body: %v\", err)\n\t\t}\n\t}\n\n\tassert.NoError(t, counter.AssertDelta(2), \"All file descriptors except the connection from proxy to destination site should have been closed\")\n}", "title": "" }, { "docid": "53206c8db1dd0d6f2342352dbc25877f", "score": "0.46743006", "text": "func checkRedirect(t *testing.T, initialPath string, expectedPath string) {\n\tinitialURL := server.URL + initialPath\n\texpectedDestination := server.URL + expectedPath\n\tresponse, err := http.Get(initialURL)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tactualDestination := response.Request.URL.String()\n\tif actualDestination != expectedDestination {\n\t\tt.Errorf(\"Unexpected redirect destination: \\\"%s\\\", expected: \\\"%s\\\", from \\\"%s\\\"\", actualDestination, expectedDestination, initialURL)\n\t}\n}", "title": "" }, { "docid": "4e2b10e3d442819779810a35a9b4b944", "score": "0.46732834", "text": "func TestFailoverOriginDownFirstMirrorDownUseSecondMirror(t *testing.T) {\n\tcheckForSkipFailover(t)\n\tResetBackends(backendsByPriority)\n\n\texpectedBody := \"lucky golden ticket\"\n\texpectedStatus := http.StatusOK\n\n\toriginServer.Stop()\n\tbackupServer1.Stop()\n\tbackupServer2.SwitchHandler(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(expectedBody))\n\t})\n\n\treq := NewUniqueEdgeGET(t)\n\tresp := RoundTripCheckError(t, req)\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != expectedStatus {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect status code. Expected %d, got %d\",\n\t\t\texpectedStatus,\n\t\t\tresp.StatusCode,\n\t\t)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif bodyStr := string(body); bodyStr != expectedBody {\n\t\tt.Errorf(\n\t\t\t\"Received incorrect response body. Expected %q, got %q\",\n\t\t\texpectedBody,\n\t\t\tbodyStr,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "c973633665ad0ca8c076ba637652e68c", "score": "0.4665343", "text": "func TestBadEndpoints(t *testing.T) {\n\t_, stderr, err := TestHelper.PipeToLinkerdRun(\"\", \"diagnostics\", \"endpoints\", \"foo\")\n\tif err == nil {\n\t\ttestutil.AnnotatedFatalf(t, \"was expecting an error\", \"was expecting an error: %v\", err)\n\t}\n\tstderrOut := strings.Split(stderr, \"\\n\")\n\tif len(stderrOut) == 0 {\n\t\ttestutil.AnnotatedFatalf(t, \"unexpected output\", \"unexpected output: %s\", stderr)\n\t}\n\tif stderrOut[0] != \"Destination API error: Invalid authority: foo\" {\n\t\ttestutil.AnnotatedErrorf(t, \"unexpected error string\", \"unexpected error string: %s\", stderrOut[0])\n\t}\n}", "title": "" }, { "docid": "7003cf4293f298d6b05cf3328a96057d", "score": "0.46643588", "text": "func TestHandler_PutService_ErrNotLeader(t *testing.T) {\n\th := NewHandler()\n\th.Store.LeaderFn = func() string { return \"host1:1111\" }\n\th.Store.AddServiceFn = func(service string, config *discoverd.ServiceConfig) error { return server.ErrNotLeader }\n\n\tw := httptest.NewRecorder()\n\th.ServeHTTP(w, MustNewHTTPRequest(\"PUT\", \"http://host0:1111/services/abc\", strings.NewReader(`{\"leader_type\":\"manual\"}`)))\n\tif w.Code != http.StatusTemporaryRedirect {\n\t\tt.Fatalf(\"unexpected status code: %d\", w.Code)\n\t} else if loc := w.Header().Get(\"Location\"); loc != `http://host1:1111/services/abc` {\n\t\tt.Fatalf(\"unexpected Location header: %s\", loc)\n\t}\n}", "title": "" }, { "docid": "c4036279d8d33879257f07cfa6d2d4a5", "score": "0.46599925", "text": "func ExpectPingFailure(ctx context.Context, addr, user string) (retErr error) {\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tdumpNetworkInfoAfterPingFailure(ctx)\n\t\t}\n\t}()\n\n\tif err := deletePingEntriesInConntrack(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to reset conntrack before pinging\")\n\t}\n\ttesting.ContextLog(ctx, \"Start to ping \", addr)\n\tpr := localping.NewLocalRunner()\n\t// Only ping once, continuous pings will be very likely to be affected by the\n\t// connection pinging so it does not make sense. In the routing tests, all the\n\t// ping targets are in the DUT, so use a small timeout value here.\n\tres, err := pr.Ping(ctx, addr, ping.Count(1), ping.User(user), ping.Timeout(2*time.Second))\n\tif err != nil {\n\t\t// An error definitely means a ping failure.\n\t\treturn nil\n\t}\n\tif res.Received != 0 {\n\t\treturn errors.New(\"received ping reply but not expected\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1fcc16aa1ef2d0d49b952282fbaadc56", "score": "0.46530828", "text": "func TestSendWrongMethod(t *testing.T) {\n var jsonStr = []byte(`{\"user_id\": \"9000\", \"currency\": \"EUR\", \"amount\": 100, \"time_placed\" : \"20-JAN-20 10:00:00\", \"type\": \"deposit\"}`)\n req, err := http.NewRequest(\"GET\", \"/send\", bytes.NewBuffer(jsonStr))\n if err != nil {\n t.Fatal(err)\n }\n rr := httptest.NewRecorder()\n handler := http.HandlerFunc(Send)\n handler.ServeHTTP(rr, req)\n if status := rr.Code; status != http.StatusBadGateway {\n t.Errorf(\"Send returned wrong status code: got %v want %v\",\n status, http.StatusBadGateway)\n }\n}", "title": "" }, { "docid": "01685cf93ec6fcc7eecd78c5224b999c", "score": "0.4649188", "text": "func TestTrialFileMissing(t *testing.T) {\n\tsrv := NewTestServer()\n\tdefer srv.Close()\n\n\t/* -- LIST -- */\n\n\t// Try to list files of a non-existent trial.\n\turl := srv.addr + \"/files/test_study/test_trial\"\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\tt.Errorf(\"error listing files: %v\", err)\n\t}\n\n\twant, got := http.StatusOK, res.StatusCode\n\tif want != got {\n\t\tt.Errorf(\"want %d, got %d\", want, got)\n\t}\n\n\tvar items []Item\n\tif err = json.NewDecoder(res.Body).Decode(&items); err != nil {\n\t\tt.Errorf(\"decoding error: %v\", err)\n\t}\n\tres.Body.Close()\n\n\t// Ensure that no items were returned.\n\twant, got = 0, len(items)\n\tif got != want {\n\t\tt.Errorf(\"want %d item, got %d\", want, got)\n\t}\n\n\t// -- GET -- //\n\n\t// Try to get a non-existent file.\n\turl = srv.addr + \"/files/test_study/test_trial/test_file\"\n\tres, err = http.Get(url)\n\tif err != nil {\n\t\tt.Errorf(\"error getting file: %v\", err)\n\t}\n\tres.Body.Close()\n\n\t// Ensure we get a StatusNoContent (204) response.\n\tif want, got := http.StatusNoContent, res.StatusCode; want != got {\n\t\tt.Errorf(\"want %d, got %d\", want, got)\n\t}\n\n\t// -- DELETE -- //\n\n\t// Try to delete a non-existent file.\n\tclient := new(http.Client)\n\turl = srv.addr + \"/files/test_study/test_trial/test_file\"\n\n\treq, err := http.NewRequest(\"DELETE\", url, nil)\n\tif err != nil {\n\t\tt.Errorf(\"error creating delete request: %v\", err)\n\t}\n\n\tres, err = client.Do(req)\n\tif err != nil {\n\t\tt.Errorf(\"error deleting file: %v\", err)\n\t}\n\tres.Body.Close()\n\n\t// No harm done.\n\tif want, got := http.StatusOK, res.StatusCode; want != got {\n\t\tt.Errorf(\"want %d, got %d\", want, got)\n\t}\n}", "title": "" }, { "docid": "ce1dede01821d6393b60e1a02ce2649d", "score": "0.4648824", "text": "func TestAuthHandlerServeHTTPBadMethod(t *testing.T) {\n\turl, done := testAuthHandler(t, \"http://foo.com/\", \"\", nil)\n\tdefer done()\n\n\tres, err := http.Post(url, \"\", nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif got, want := res.StatusCode, http.StatusMethodNotAllowed; got != want {\n\t\tlog.Fatalf(\"unexpected HTTP status code: %d != %d\", got, want)\n\t}\n}", "title": "" }, { "docid": "cd2228b47dab07f9dac419d94da422dc", "score": "0.46465993", "text": "func HTTPFail(w http.ResponseWriter, failure *relayhttp.Failure) {\n\tif failure.Code == http.StatusInternalServerError {\n\t\tglog.Error(failure.Message)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\n\t// Convert into JSON\n\toutput, err := json.Marshal(failure)\n\tif err != nil {\n\t\t// Should not occur, panic\n\t\tpanic(err)\n\t}\n\tw.WriteHeader(failure.Code)\n\t_, err = w.Write(output)\n\tif err != nil {\n\t\tglog.Error(err)\n\t}\n}", "title": "" }, { "docid": "59150a63b26bf410a5c343645817f5bd", "score": "0.46442556", "text": "func TestPullTractRetryFailure(t *testing.T) {\n\ts := getTestStoreDefault(t)\n\n\tid := core.TractID{Blob: 123456, Index: 0}\n\taddr := []string{\"down-server\", \"bad-disk\", \"invalid-argument\"}\n\n\ttt := s.tt.(*memTractserverTalker)\n\ttt.addCtlReadReply(addr[0], nil, core.ErrRPC)\n\ttt.addCtlReadReply(addr[1], nil, core.ErrIO)\n\ttt.addCtlReadReply(addr[2], nil, core.ErrInvalidArgument)\n\n\tif err := s.PullTract(BG, addr, id, 1); err == core.NoError {\n\t\tt.Fatalf(\"should have failed to PullTract\")\n\t}\n}", "title": "" }, { "docid": "c2012981568ec3add515c7145498cc65", "score": "0.46409672", "text": "func TestRemoteRotationEndpointError(t *testing.T) {\n\tts, _, _ := simpleTestServer(t)\n\tdefer ts.Close()\n\trepo, _ := initializeRepo(t, data.ECDSAKey, \"docker.com/notary\", ts.URL, true)\n\tdefer os.RemoveAll(repo.baseDir)\n\n\t// simpleTestServer has no rotate key endpoint, so this should fail\n\tfor _, role := range []data.RoleName{data.CanonicalSnapshotRole, data.CanonicalTimestampRole} {\n\t\terr := repo.RotateKey(role, true, nil)\n\t\trequire.Error(t, err)\n\t\trequire.IsType(t, store.ErrMetaNotFound{}, err)\n\t}\n}", "title": "" }, { "docid": "c31a331afbc87977f0b6cc2e85a68e96", "score": "0.4635466", "text": "func TestSyncClientRequestFailure(t *testing.T) {\n\trecorder := &internal.LogRecords{}\n\tsc := NewSyncClient(func(sc *SyncClient) { sc.Logger = zerolog.Nop() })\n\tgot := sc.Send(\"http://foo com\")\n\tif !internal.YubikeyEqual(nil, got) {\n\t\tt.Log(recorder)\n\t\tt.Errorf(\"SyncClient.Send(%q) => want: %s, got %s\",\n\t\t\t\"/?%gh&%ij\", internal.TestYubikey(nil), internal.TestYubikey(got))\n\t}\n}", "title": "" }, { "docid": "7184ac7db5d47b7990c2331740794834", "score": "0.46297812", "text": "func (m *MockClient) InstallLoadBalancerServiceFromOutsideFlows(arg0 net.IP, arg1 uint16, arg2 openflow.Protocol) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InstallLoadBalancerServiceFromOutsideFlows\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "66f6d03ee17dfb5bf20f796c9c776c3b", "score": "0.46222302", "text": "func TestTCPProxyInvalidLoadBalancerPolicy(t *testing.T) {\n\trh, c, done := setup(t)\n\tdefer done()\n\n\ts1 := &v1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"secret\",\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tType: \"kubernetes.io/tls\",\n\t\tData: featuretests.Secretdata(featuretests.CERTIFICATE, featuretests.RSA_PRIVATE_KEY),\n\t}\n\n\tsvc := fixture.NewService(\"backend\").\n\t\tWithPorts(v1.ServicePort{Port: 80, TargetPort: intstr.FromInt(8080)})\n\n\trh.OnAdd(s1)\n\trh.OnAdd(svc)\n\n\thp1 := &contour_api_v1.HTTPProxy{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"simple\",\n\t\t\tNamespace: s1.Namespace,\n\t\t},\n\t\tSpec: contour_api_v1.HTTPProxySpec{\n\t\t\tVirtualHost: &contour_api_v1.VirtualHost{\n\t\t\t\tFqdn: \"kuard-tcp.example.com\",\n\t\t\t\tTLS: &contour_api_v1.TLS{\n\t\t\t\t\tSecretName: s1.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTCPProxy: &contour_api_v1.TCPProxy{\n\t\t\t\tServices: []contour_api_v1.Service{{\n\t\t\t\t\tName: svc.Name,\n\t\t\t\t\tPort: 80,\n\t\t\t\t}},\n\t\t\t\tLoadBalancerPolicy: &contour_api_v1.LoadBalancerPolicy{\n\t\t\t\t\tStrategy: \"Cookie\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\trh.OnAdd(hp1)\n\n\t// Check that a basic cluster is produced with the default load balancer\n\t// policy.\n\tc.Request(clusterType).Equals(&envoy_discovery_v3.DiscoveryResponse{\n\t\tResources: resources(t,\n\t\t\tcluster(\n\t\t\t\tsvc.Namespace+\"/\"+svc.Name+\"/80/da39a3ee5e\",\n\t\t\t\tsvc.Namespace+\"/\"+svc.Name,\n\t\t\t\tsvc.Namespace+\"_\"+svc.Name+\"_80\",\n\t\t\t),\n\t\t),\n\t\tTypeUrl: clusterType,\n\t})\n\n\trh.OnUpdate(hp1, &contour_api_v1.HTTPProxy{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"simple\",\n\t\t\tNamespace: s1.Namespace,\n\t\t},\n\t\tSpec: contour_api_v1.HTTPProxySpec{\n\t\t\tVirtualHost: &contour_api_v1.VirtualHost{\n\t\t\t\tFqdn: \"kuard-tcp.example.com\",\n\t\t\t\tTLS: &contour_api_v1.TLS{\n\t\t\t\t\tSecretName: s1.Name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTCPProxy: &contour_api_v1.TCPProxy{\n\t\t\t\tServices: []contour_api_v1.Service{{\n\t\t\t\t\tName: svc.Name,\n\t\t\t\t\tPort: 80,\n\t\t\t\t}},\n\t\t\t\tLoadBalancerPolicy: &contour_api_v1.LoadBalancerPolicy{\n\t\t\t\t\tStrategy: \"RequestHash\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\n\t// Check that a basic cluster is produced with the default load balancer\n\t// policy.\n\tc.Request(clusterType).Equals(&envoy_discovery_v3.DiscoveryResponse{\n\t\tResources: resources(t,\n\t\t\tcluster(\n\t\t\t\tsvc.Namespace+\"/\"+svc.Name+\"/80/da39a3ee5e\",\n\t\t\t\tsvc.Namespace+\"/\"+svc.Name,\n\t\t\t\tsvc.Namespace+\"_\"+svc.Name+\"_80\",\n\t\t\t),\n\t\t),\n\t\tTypeUrl: clusterType,\n\t})\n}", "title": "" }, { "docid": "f13d3036b23b2381c738534164026b33", "score": "0.4616698", "text": "func TestGetBranchProtectionFailsOnOther404(t *testing.T) {\n\tts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != http.MethodGet {\n\t\t\tt.Errorf(\"Bad method: %s\", r.Method)\n\t\t}\n\t\tif r.URL.Path != \"/repos/org/repo/branches/master/protection\" {\n\t\t\tt.Errorf(\"Bad request path: %s\", r.URL.Path)\n\t\t}\n\t\tge := &githubError{\n\t\t\tMessage: \"Not Found\",\n\t\t}\n\t\tb, err := json.Marshal(&ge)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Didn't expect error: %v\", err)\n\t\t}\n\t\thttp.Error(w, string(b), http.StatusNotFound)\n\t}))\n\tdefer ts.Close()\n\tc := getClient(ts.URL)\n\t_, err := c.GetBranchProtection(\"org\", \"repo\", \"master\")\n\tif err == nil {\n\t\tt.Errorf(\"Expected error, got nil\")\n\t}\n}", "title": "" }, { "docid": "bf74b5440f96fbaa5e4979092890bd88", "score": "0.46073428", "text": "func FaultTolerance(attempts int, backoff time.Duration) Decorator {\n\treturn func(c Client) Client {\n\t\treturn ClientFunc(func(r *http.Request) (res *http.Response, err error) {\n\t\t\tfor i := 0; i < attempts; i++ {\n\t\t\t\tres, err = c.Do(r)\n\t\t\t\tif err == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\ttime.Sleep(backoff * time.Duration(i))\n\t\t\t}\n\t\t\treturn\n\t\t})\n\t}\n}", "title": "" }, { "docid": "fd4a4ed85fcecf50f65eab762db38826", "score": "0.46049708", "text": "func Test_getApi_MalformedURL(t *testing.T) {\n\n\tts := httptest.NewServer(http.HandlerFunc(getApi))\n\tdefer ts.Close()\n\n\ttestCases := []string {\n\t\tts.URL,\n\t\tts.URL + \"/something/\",\n\t\tts.URL + \"/something/123/\",\n\t}\n\n\n\tfor _, tstring := range testCases {\n\t\tresp, err := http.Get(ts.URL)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error making the GET request, %s\", err)\n\t\t}\n\n\t\tif resp.StatusCode != http.StatusBadRequest {\n\t\t\tt.Errorf(\"For route: %s, expected StatusCode %d, received %d. \", tstring, http.StatusBadRequest, resp.StatusCode)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a41259d37f2b8fa7e107e90e6a2a5c8", "score": "0.46023014", "text": "func RetryTests(retryCodes []int) map[int]bool {\n\ttests := map[int]bool{\n\t\t// 1xx\n\t\thttp.StatusContinue: false,\n\t\thttp.StatusSwitchingProtocols: false,\n\t\thttp.StatusProcessing: false,\n\n\t\t// 2xx\n\t\thttp.StatusOK: false,\n\t\thttp.StatusCreated: false,\n\t\thttp.StatusAccepted: false,\n\t\thttp.StatusNonAuthoritativeInfo: false,\n\t\thttp.StatusNoContent: false,\n\t\thttp.StatusResetContent: false,\n\t\thttp.StatusPartialContent: false,\n\t\thttp.StatusMultiStatus: false,\n\t\thttp.StatusAlreadyReported: false,\n\t\thttp.StatusIMUsed: false,\n\n\t\t// 3xx\n\t\thttp.StatusMultipleChoices: false,\n\t\thttp.StatusMovedPermanently: false,\n\t\thttp.StatusFound: false,\n\t\thttp.StatusSeeOther: false,\n\t\thttp.StatusNotModified: false,\n\t\thttp.StatusUseProxy: false,\n\t\thttp.StatusTemporaryRedirect: false,\n\t\thttp.StatusPermanentRedirect: false,\n\n\t\t// 4xx\n\t\thttp.StatusBadRequest: false,\n\t\thttp.StatusUnauthorized: false,\n\t\thttp.StatusPaymentRequired: false,\n\t\thttp.StatusForbidden: false,\n\t\thttp.StatusNotFound: false,\n\t\thttp.StatusMethodNotAllowed: false,\n\t\thttp.StatusNotAcceptable: false,\n\t\thttp.StatusProxyAuthRequired: false,\n\t\thttp.StatusRequestTimeout: false,\n\t\thttp.StatusConflict: false,\n\t\thttp.StatusGone: false,\n\t\thttp.StatusLengthRequired: false,\n\t\thttp.StatusPreconditionFailed: false,\n\t\thttp.StatusRequestEntityTooLarge: false,\n\t\thttp.StatusRequestURITooLong: false,\n\t\thttp.StatusUnsupportedMediaType: false,\n\t\thttp.StatusRequestedRangeNotSatisfiable: false,\n\t\thttp.StatusExpectationFailed: false,\n\t\thttp.StatusTeapot: false,\n\t\thttp.StatusUnprocessableEntity: false,\n\t\thttp.StatusLocked: false,\n\t\thttp.StatusFailedDependency: false,\n\t\thttp.StatusUpgradeRequired: false,\n\t\thttp.StatusPreconditionRequired: false,\n\t\thttp.StatusTooManyRequests: false,\n\t\thttp.StatusRequestHeaderFieldsTooLarge: false,\n\t\thttp.StatusUnavailableForLegalReasons: false,\n\n\t\t// 5xx\n\t\thttp.StatusInternalServerError: false,\n\t\thttp.StatusNotImplemented: false,\n\t\thttp.StatusBadGateway: false,\n\t\thttp.StatusServiceUnavailable: false,\n\t\thttp.StatusGatewayTimeout: false,\n\t\thttp.StatusHTTPVersionNotSupported: false,\n\t\thttp.StatusVariantAlsoNegotiates: false,\n\t\thttp.StatusInsufficientStorage: false,\n\t\thttp.StatusLoopDetected: false,\n\t\thttp.StatusNotExtended: false,\n\t\thttp.StatusNetworkAuthenticationRequired: false,\n\t}\n\n\tfor _, statusCode := range retryCodes {\n\t\ttests[statusCode] = true\n\t}\n\n\treturn tests\n}", "title": "" }, { "docid": "4ed727b4afbbfd508d6cbc0b18b76007", "score": "0.46020156", "text": "func TestWhitelistHTTP(t *testing.T) {\n\t// Create a service with authentication on by default, with one\n\t// exception configured as whitelist.\n\tservices := []*proxy.Service{{\n\t\tAddress: testTargetServiceAddress,\n\t\tHostRegexp: testHostRegexp,\n\t\tPathRegexp: testPathRegexpHTTP,\n\t\tProtocol: \"http\",\n\t\tAuth: \"on\",\n\t\tAuthWhitelistPaths: []string{\"^/http/white.*$\"},\n\t}}\n\n\tmockAuth := auth.NewMockAuthenticator()\n\tp, err := proxy.New(mockAuth, services, \"static\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create new proxy: %v\", err)\n\t}\n\n\t// Start server that gives requests to the proxy.\n\tserver := &http.Server{\n\t\tAddr: testProxyAddr,\n\t\tHandler: http.HandlerFunc(p.ServeHTTP),\n\t}\n\tgo func() { _ = server.ListenAndServe() }()\n\tdefer closeOrFail(t, server)\n\n\t// Start the target backend service.\n\tbackendService := &http.Server{Addr: testTargetServiceAddress}\n\tgo func() { _ = startBackendHTTP(backendService) }()\n\tdefer closeOrFail(t, backendService)\n\n\t// Wait for servers to start.\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// Test making a request to the backend service to an URL where\n\t// authentication is enabled.\n\tclient := &http.Client{}\n\turl := fmt.Sprintf(\"http://%s/http/black\", testProxyAddr)\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\tt.Fatalf(\"errored making http request: %v\", err)\n\t}\n\tif resp.Status != \"402 Payment Required\" {\n\t\tt.Fatalf(\"expected 402 status code, got: %v\", resp.Status)\n\t}\n\tauthHeader := resp.Header.Get(\"Www-Authenticate\")\n\tif !strings.Contains(authHeader, \"LSAT\") {\n\t\tt.Fatalf(\"expected partial LSAT in response header, got: %v\",\n\t\t\tauthHeader)\n\t}\n\t_ = resp.Body.Close()\n\n\t// Make sure that if we query an URL that is on the whitelist, we don't\n\t// get the 402 response.\n\turl = fmt.Sprintf(\"http://%s/http/white\", testProxyAddr)\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating request: %v\", err)\n\t}\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\tt.Fatalf(\"errored making http request: %v\", err)\n\t}\n\tif resp.Status != \"200 OK\" {\n\t\tt.Fatalf(\"expected 200 OK status code, got: %v\", resp.Status)\n\t}\n\n\t// Ensure that we got the response body we expect.\n\tdefer closeOrFail(t, resp.Body)\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to read response body: %v\", err)\n\t}\n\n\tif string(bodyBytes) != testHTTPResponseBody {\n\t\tt.Fatalf(\"expected response body %v, got %v\",\n\t\t\ttestHTTPResponseBody, string(bodyBytes))\n\t}\n}", "title": "" }, { "docid": "2a64eef4fc82501fd2b9a3e99ec419b9", "score": "0.4596326", "text": "func TestErrorIssuesRollback(t *testing.T) {\n\tcreateSandbox(KsTestUnsharded)\n\thcVTGateTest.Reset()\n\tsbc := hcVTGateTest.AddTestTablet(\"aa\", \"1.1.1.1\", 1001, KsTestUnsharded, \"0\", topodatapb.TabletType_MASTER, true, 1, nil)\n\n\t// Start a transaction, send one statement.\n\t// Simulate an error that should trigger a rollback:\n\t// vtrpcpb.Code_ABORTED case.\n\tsession, err := rpcVTGate.Begin(context.Background(), false)\n\tif err != nil {\n\t\tt.Fatalf(\"cannot start a transaction: %v\", err)\n\t}\n\tsession, _, err = rpcVTGate.Execute(\n\t\tcontext.Background(),\n\t\tsession,\n\t\t\"select id from t1\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\tt.Fatalf(\"want nil, got %v\", err)\n\t}\n\tif sbc.RollbackCount.Get() != 0 {\n\t\tt.Errorf(\"want 0, got %d\", sbc.RollbackCount.Get())\n\t}\n\tsbc.MustFailCodes[vtrpcpb.Code_ABORTED] = 20\n\tsession, _, err = rpcVTGate.Execute(\n\t\tcontext.Background(),\n\t\tsession,\n\t\t\"select id from t1\",\n\t\tnil,\n\t)\n\tif err == nil {\n\t\tt.Fatalf(\"want error but got nil\")\n\t}\n\tif sbc.RollbackCount.Get() != 1 {\n\t\tt.Errorf(\"want 1, got %d\", sbc.RollbackCount.Get())\n\t}\n\tsbc.RollbackCount.Set(0)\n\tsbc.MustFailCodes[vtrpcpb.Code_ABORTED] = 0\n\n\t// Start a transaction, send one statement.\n\t// Simulate an error that should trigger a rollback:\n\t// vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED case.\n\tsession, err = rpcVTGate.Begin(context.Background(), false)\n\tif err != nil {\n\t\tt.Fatalf(\"cannot start a transaction: %v\", err)\n\t}\n\tsession, _, err = rpcVTGate.Execute(\n\t\tcontext.Background(),\n\t\tsession,\n\t\t\"select id from t1\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\tt.Fatalf(\"want nil, got %v\", err)\n\t}\n\tif sbc.RollbackCount.Get() != 0 {\n\t\tt.Errorf(\"want 0, got %d\", sbc.RollbackCount.Get())\n\t}\n\tsbc.MustFailCodes[vtrpcpb.Code_RESOURCE_EXHAUSTED] = 20\n\tsession, _, err = rpcVTGate.Execute(\n\t\tcontext.Background(),\n\t\tsession,\n\t\t\"select id from t1\",\n\t\tnil,\n\t)\n\tif err == nil {\n\t\tt.Fatalf(\"want error but got nil\")\n\t}\n\tif sbc.RollbackCount.Get() != 1 {\n\t\tt.Errorf(\"want 1, got %d\", sbc.RollbackCount.Get())\n\t}\n\tsbc.RollbackCount.Set(0)\n\tsbc.MustFailCodes[vtrpcpb.Code_RESOURCE_EXHAUSTED] = 0\n\n\t// Start a transaction, send one statement.\n\t// Simulate an error that should *not* trigger a rollback:\n\t// vtrpcpb.Code_ALREADY_EXISTS case.\n\tsession, err = rpcVTGate.Begin(context.Background(), false)\n\tif err != nil {\n\t\tt.Fatalf(\"cannot start a transaction: %v\", err)\n\t}\n\tsession, _, err = rpcVTGate.Execute(\n\t\tcontext.Background(),\n\t\tsession,\n\t\t\"select id from t1\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\tt.Fatalf(\"want nil, got %v\", err)\n\t}\n\tif sbc.RollbackCount.Get() != 0 {\n\t\tt.Errorf(\"want 0, got %d\", sbc.RollbackCount.Get())\n\t}\n\tsbc.MustFailCodes[vtrpcpb.Code_ALREADY_EXISTS] = 20\n\tsession, _, err = rpcVTGate.Execute(\n\t\tcontext.Background(),\n\t\tsession,\n\t\t\"select id from t1\",\n\t\tnil,\n\t)\n\tif err == nil {\n\t\tt.Fatalf(\"want error but got nil\")\n\t}\n\tif sbc.RollbackCount.Get() != 0 {\n\t\tt.Errorf(\"want 0, got %d\", sbc.RollbackCount.Get())\n\t}\n\tsbc.MustFailCodes[vtrpcpb.Code_ALREADY_EXISTS] = 0\n}", "title": "" }, { "docid": "e70bad85f50aba359b4addb1af8ed6c9", "score": "0.4595242", "text": "func TestTsMethodNotAllowed(t *testing.T) {\n\trouter := iris.New()\n\tredfishRoutes := router.Party(\"/redfish/v1\")\n\tredfishRoutes.Any(\"/TaskService\", TsMethodNotAllowed)\n\tredfishRoutes.Any(\"/TaskService/Tasks\", TsMethodNotAllowed)\n\tredfishRoutes.Any(\"/TaskService/Tasks/{TaskID}\", TsMethodNotAllowed)\n\te := httptest.New(t, router)\n\n\t//Check for status code 405 for http methods which are not allowed on Task service URLs\n\te.POST(\"/redfish/v1/TaskService\").Expect().Status(http.StatusMethodNotAllowed)\n\te.PUT(\"/redfish/v1/TaskService\").Expect().Status(http.StatusMethodNotAllowed)\n\te.DELETE(\"/redfish/v1/TaskService\").Expect().Status(http.StatusMethodNotAllowed)\n\n\te.POST(\"/redfish/v1/TaskService/Tasks\").Expect().Status(http.StatusMethodNotAllowed)\n\te.PUT(\"/redfish/v1/TaskService/Tasks\").Expect().Status(http.StatusMethodNotAllowed)\n\te.DELETE(\"/redfish/v1/TaskService/Tasks\").Expect().Status(http.StatusMethodNotAllowed)\n\n\te.POST(\"/redfish/v1/TaskService/Tasks/{TaskID}\").Expect().Status(http.StatusMethodNotAllowed)\n\te.PUT(\"/redfish/v1/TaskService/Tasks/{TaskID}\").Expect().Status(http.StatusMethodNotAllowed)\n}", "title": "" }, { "docid": "647776f3aa17738a6784fc4b5268dc30", "score": "0.4593068", "text": "func testWriteFails(c *context.Context, flow context.TestFlow, payloadSize int, wantErr tcpip.Error) {\n\tc.T.Helper()\n\t// Take a snapshot of the stats to validate them at the end of the test.\n\tvar epstats tcpip.TransportEndpointStats\n\tc.EP.Stats().(*tcpip.TransportEndpointStats).Clone(&epstats)\n\n\tvar r bytes.Reader\n\tr.Reset(newRandomPayload(payloadSize))\n\t_, gotErr := c.EP.Write(&r, getWriteOptionsForFlow(flow))\n\tc.CheckEndpointWriteStats(1, &epstats, gotErr)\n\tif gotErr != wantErr {\n\t\tc.T.Fatalf(\"Write returned unexpected error: got %v, want %v\", gotErr, wantErr)\n\t}\n}", "title": "" }, { "docid": "20737e3be1f06259b73fb4cdd560529a", "score": "0.45835906", "text": "func Test_malformedURL(t *testing.T) {\n\tts := httptest.NewServer(http.HandlerFunc(handler))\n\tdefer ts.Close()\n\n\ttestCases := []string{\n\t\tts.URL,\n\t\tts.URL + \"/projectinfo/v1/github.com/golang/go/f\",\n\t\tts.URL + \"/projectinfo/v1/github.com/\",\n\t\tts.URL + \"/projectinfo/v1/\",\n\t}\n\n\tfor _, test := range testCases {\n\t\tresp, err := http.Get(test)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Get request error: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif resp.StatusCode != http.StatusBadRequest {\n\t\t\tt.Errorf(\"Expected StatusCode %d from %s, recieved %d\", http.StatusBadRequest, test, resp.StatusCode)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7f2b4f62a23ecf3638bea7fffdd4d117", "score": "0.45797044", "text": "func TestClient_ClientErrors(t *testing.T) {\n\t// 404 Not Found should return a ClientError.\n\tt.Run(\"404\", func(t *testing.T) {\n\t\t// 404 response with validation errors\n\t\tt.Run(\"OK\", func(t *testing.T) {\n\t\t\tclient, s := recurly.NewTestServer()\n\t\t\tdefer s.Close()\n\n\t\t\ts.HandleFunc(\"POST\", \"/v2/accounts\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t\tw.Write(MustOpenFile(\"error_not_found.xml\"))\n\t\t\t}, t)\n\n\t\t\t_, err := client.Accounts.Create(context.Background(), recurly.Account{})\n\t\t\tif !s.Invoked {\n\t\t\t\tt.Fatal(\"expected invocation\")\n\t\t\t} else if err == nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t} else if e, ok := err.(*recurly.ClientError); !ok {\n\t\t\t\tt.Fatalf(\"unexpected error: %T %#v\", err, err)\n\t\t\t} else if e.Response == nil {\n\t\t\t\tt.Fatal(\"expected *http.Response\")\n\t\t\t} else if e.Response.StatusCode != http.StatusNotFound {\n\t\t\t\tt.Fatalf(\"unexpected status code: %d\", e.Response.StatusCode)\n\t\t\t} else if diff := cmp.Diff(e.ValidationErrors, []recurly.ValidationError{{\n\t\t\t\tSymbol: \"not_found\",\n\t\t\t\tDescription: \"The record could not be located.\",\n\t\t\t}}); diff != \"\" {\n\t\t\t\tt.Fatal(diff)\n\t\t\t}\n\t\t})\n\n\t\t// 404 response with empty body\n\t\tt.Run(\"EmptyBody\", func(t *testing.T) {\n\t\t\tclient, s := recurly.NewTestServer()\n\t\t\tdefer s.Close()\n\n\t\t\ts.HandleFunc(\"POST\", \"/v2/accounts\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t}, t)\n\n\t\t\t_, err := client.Accounts.Create(context.Background(), recurly.Account{})\n\t\t\tif !s.Invoked {\n\t\t\t\tt.Fatal(\"expected invocation\")\n\t\t\t} else if err == nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t} else if e, ok := err.(*recurly.ClientError); !ok {\n\t\t\t\tt.Fatalf(\"unexpected error: %T %#v\", err, err)\n\t\t\t} else if e.Response == nil {\n\t\t\t\tt.Fatal(\"expected *http.Response\")\n\t\t\t} else if e.Response.StatusCode != http.StatusNotFound {\n\t\t\t\tt.Fatalf(\"unexpected status code: %d\", e.Response.StatusCode)\n\t\t\t} else if len(e.ValidationErrors) > 0 {\n\t\t\t\tt.Fatalf(\"unexpected validation errors: %#v\", e.ValidationErrors)\n\t\t\t}\n\t\t})\n\t})\n\n\tt.Run(\"422\", func(t *testing.T) {\n\t\t// Ensure a top-level <error> tag is properly handled.\n\t\tt.Run(\"SingleError\", func(t *testing.T) {\n\t\t\tclient, s := recurly.NewTestServer()\n\t\t\tdefer s.Close()\n\n\t\t\ts.HandleFunc(\"POST\", \"/v2/accounts\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tw.WriteHeader(http.StatusUnprocessableEntity)\n\t\t\t\tw.Write([]byte(`\n\t\t\t\t\t<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t\t\t\t\t<error>\n\t\t\t\t\t\t<symbol>simultaneous_request</symbol>\n\t\t\t\t\t\t<description>A change for subscription 3cf89f0c3fcda0b15c50134f63856d4e is already in progress.</description>\n\t\t\t\t\t</error>\n\t\t\t\t`))\n\t\t\t}, t)\n\n\t\t\t_, err := client.Accounts.Create(context.Background(), recurly.Account{})\n\t\t\tif !s.Invoked {\n\t\t\t\tt.Fatal(\"expected invocation\")\n\t\t\t} else if err == nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t} else if e, ok := err.(*recurly.ClientError); !ok {\n\t\t\t\tt.Fatalf(\"unexpected error: %T %#v\", err, err)\n\t\t\t} else if e.Response == nil {\n\t\t\t\tt.Fatal(\"expected *http.Response\")\n\t\t\t} else if e.Response.StatusCode != http.StatusUnprocessableEntity {\n\t\t\t\tt.Fatalf(\"unexpected status code: %d\", e.Response.StatusCode)\n\t\t\t} else if diff := cmp.Diff(e.ValidationErrors, []recurly.ValidationError{{\n\t\t\t\tSymbol: \"simultaneous_request\",\n\t\t\t\tDescription: \"A change for subscription 3cf89f0c3fcda0b15c50134f63856d4e is already in progress.\",\n\t\t\t}}); diff != \"\" {\n\t\t\t\tt.Fatal(diff)\n\t\t\t}\n\t\t})\n\n\t\t// Ensure a top-level <errors> tag is properly handled.\n\t\tt.Run(\"MultiErrors\", func(t *testing.T) {\n\t\t\tclient, s := recurly.NewTestServer()\n\t\t\tdefer s.Close()\n\n\t\t\ts.HandleFunc(\"POST\", \"/v2/accounts\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tw.WriteHeader(http.StatusUnprocessableEntity)\n\t\t\t\tw.Write([]byte(`\n\t\t\t\t\t<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t\t\t\t\t<errors>\n\t\t\t\t\t\t<error field=\"model_name.field_name\" symbol=\"not_a_number\" lang=\"en-US\">is not a number</error>\n\t\t\t\t\t\t<error field=\"subscription.base\" symbol=\"already_subscribed\">You already have a subscription to this plan.</error>\n\t\t\t\t\t</errors>\n\t\t\t\t`))\n\t\t\t}, t)\n\n\t\t\t_, err := client.Accounts.Create(context.Background(), recurly.Account{})\n\t\t\tif !s.Invoked {\n\t\t\t\tt.Fatal(\"expected invocation\")\n\t\t\t} else if err == nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t} else if e, ok := err.(*recurly.ClientError); !ok {\n\t\t\t\tt.Fatalf(\"unexpected error: %T %#v\", err, err)\n\t\t\t} else if e.Response == nil {\n\t\t\t\tt.Fatal(\"expected *http.Response\")\n\t\t\t} else if e.Response.StatusCode != http.StatusUnprocessableEntity {\n\t\t\t\tt.Fatalf(\"unexpected status code: %d\", e.Response.StatusCode)\n\t\t\t} else if diff := cmp.Diff(e.ValidationErrors, []recurly.ValidationError{\n\t\t\t\t{\n\t\t\t\t\tField: \"model_name.field_name\",\n\t\t\t\t\tSymbol: \"not_a_number\",\n\t\t\t\t\tDescription: \"is not a number\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tField: \"subscription.base\",\n\t\t\t\t\tSymbol: \"already_subscribed\",\n\t\t\t\t\tDescription: \"You already have a subscription to this plan.\",\n\t\t\t\t},\n\t\t\t}); diff != \"\" {\n\t\t\t\tt.Fatal(diff)\n\t\t\t}\n\t\t})\n\t})\n\n\tt.Run(\"Is\", func(t *testing.T) {\n\t\tt.Run(\"SingleError\", func(t *testing.T) {\n\t\t\tif err := (&recurly.ClientError{\n\t\t\t\tValidationErrors: []recurly.ValidationError{{\n\t\t\t\t\tSymbol: \"number_of_unique_codes\",\n\t\t\t\t\tDescription: \"You are limited to generating 200 at a time\",\n\t\t\t\t}},\n\t\t\t}); !err.Is(\"number_of_unique_codes\") {\n\t\t\t\tt.Fatal(\"expected true\")\n\t\t\t} else if err.Is(\"not_found\") {\n\t\t\t\tt.Fatal(\"expected false\")\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"MultiErrors\", func(t *testing.T) {\n\t\t\tif err := (&recurly.ClientError{\n\t\t\t\tValidationErrors: []recurly.ValidationError{\n\t\t\t\t\t{\n\t\t\t\t\t\tSymbol: \"number_of_unique_codes\",\n\t\t\t\t\t\tDescription: \"You are limited to generating 200 at a time\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tSymbol: \"will_not_invoice\",\n\t\t\t\t\t\tDescription: \"No adjustments to invoice\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}); !err.Is(\"number_of_unique_codes\") {\n\t\t\t\tt.Fatal(\"expected true\")\n\t\t\t} else if !err.Is(\"will_not_invoice\") {\n\t\t\t\tt.Fatal(\"expected true\")\n\t\t\t} else if err.Is(\"not_found\") {\n\t\t\t\tt.Fatal(\"expected false\")\n\t\t\t}\n\t\t})\n\t})\n}", "title": "" }, { "docid": "bb1d556879efc62d1137cd1a9a68df31", "score": "0.4577746", "text": "func test_status(expected_status int,\n\tmethod string,\n\turi string,\n\theaders map[string]string,\n\tbody []byte) int {\n\terr, status, _, r := rest_call(method, uri, headers, body)\n\tif nil != err {\n\t\tfmt.Printf(\"REST call failed: %s %q\\n\", method, uri)\n\t\treturn 0\n\t}\n\tresponse_body := json_prettyprint(r, \" \", \" \")\n\t// fmt.Printf(\"test_status: uri=%q\\nresp=%s\\n\", uri, response_body)\n\tif 0 == assert(expected_status == status,\n\t\t\t\"expected_status == status\",\n\t\t\tfmt.Sprintf(\" Expected %d, but got %d. %s, %s :\\n %s\", expected_status, status, method, uri, response_body)) {\n\t\treturn 0\n\t}\n\n\t// All checks passed\n\treturn 1\n}", "title": "" }, { "docid": "961501f0e12e4885a8d0be7986868a42", "score": "0.4558533", "text": "func testRouteConflictBehavior(t *testing.T, caCtx *test.Context) {\n\tsvcA := types.NamespacedName{Namespace: \"conflict-test\", Name: \"a\"}\n\tsvcB := types.NamespacedName{Namespace: \"test\", Name: \"a-conflict\"}\n\n\tfor _, ns := range []string{svcA.Namespace, svcB.Namespace} {\n\t\tif _, err := caCtx.Clients.Kube.CoreV1().Namespaces().Create(&corev1.Namespace{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: ns,\n\t\t\t},\n\t\t}); err != nil && !apierrs.IsAlreadyExists(err) {\n\t\t\tt.Fatalf(\"Failed to create namespace %s: %v\", ns, err)\n\t\t}\n\t\tdefer caCtx.Clients.Kube.CoreV1().Namespaces().Delete(ns, &metav1.DeleteOptions{})\n\t}\n\n\t// Each of the two services should be the \"oldest\" and it should work regardless.\n\tfor _, services := range [][]types.NamespacedName{{svcA, svcB}, {svcB, svcA}} {\n\t\tolder := services[0]\n\t\tnewer := services[1]\n\n\t\tt.Logf(\"older: %v, newer: %v\", older, newer)\n\n\t\tolderSvc, err := test.WithServiceReady(caCtx, older.Name, older.Namespace, image)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Knative Service not ready\", err)\n\t\t}\n\n\t\twaitForRouteServingText(t, caCtx, olderSvc.Status.URL.URL(), helloworldText)\n\n\t\t_, err = test.CreateService(caCtx, newer.Name, newer.Namespace, image)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Failed to create conflicting Knative Service\", err)\n\t\t}\n\n\t\tif _, err := test.WaitForServiceState(caCtx, newer.Name, newer.Namespace, func(s *servingv1.Service, err error) (bool, error) {\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\t// Wait until a revision is ready.\n\t\t\tif s.Status.LatestReadyRevisionName == \"\" {\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\tfor _, cond := range s.Status.Conditions {\n\t\t\t\t// Wait until we see \"DomainConflict\"\n\t\t\t\tif cond.Reason == \"DomainConflict\" {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false, nil\n\t\t}); err != nil {\n\t\t\tt.Fatal(\"Desired state never occurred\", err)\n\t\t}\n\n\t\t// Verify that the \"older\" service still works.\n\t\tresp, err := http.Get(olderSvc.Status.URL.String())\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Failed sending request to %s: %v\", olderSvc.Status.URL.String(), err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Failed to read body\", err)\n\t\t}\n\t\tbodyStr := strings.TrimSpace(string(body))\n\n\t\tif resp.StatusCode != http.StatusOK || bodyStr != helloworldText {\n\t\t\tt.Fatalf(\"Received wrong response, status %v, body %v\", resp.StatusCode, bodyStr)\n\t\t}\n\n\t\tfor _, svc := range services {\n\t\t\tif err := caCtx.Clients.Serving.ServingV1().Services(svc.Namespace).Delete(svc.Name, &metav1.DeleteOptions{}); err != nil {\n\t\t\t\tt.Fatalf(\"Failed to remove ksvc %v: %v\", svc, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "59c467f7ef2f8f9c6509c620ab54b1ec", "score": "0.45528573", "text": "func TestPullTractReadErrorOtherSide(t *testing.T) {\n\ts := getTestStoreDefault(t)\n\n\tid := core.TractID{Blob: 123456, Index: 0}\n\taddr := []string{\"somehost:someport\"}\n\n\t// There's nothing to return in the test tractserver talker so there's an RPC error.\n\tif err := s.PullTract(BG, addr, id, 1); err == core.NoError {\n\t\tt.Fatalf(\"should have failed to PullTract\")\n\t}\n}", "title": "" }, { "docid": "8f07ad68f579d0b471f445a86b741c02", "score": "0.45484975", "text": "func (c *C) ExpectFailure(reason string) {\n c.expectedFailure = &reason\n}", "title": "" }, { "docid": "334c061094edd1a7a7fa608ddfc25f65", "score": "0.45398635", "text": "func TestTransErrors(t *testing.T) {\n\tfor pi, sp := range Protocols() {\n\t\tn, _ = openConn(t)\n\t\tch := login_headers\n\t\tch = headersProtocol(ch, sp)\n\t\tconn, e = Connect(n, ch)\n\t\tif e != nil {\n\t\t\tt.Fatalf(\"TestTransErrors[%d/%s] CONNECT expected OK, got: %v\\n\", pi,\n\t\t\t\tsp, e)\n\t\t}\n\t\tfor ti, tv := range transBasicList {\n\t\t\tswitch tv.action {\n\t\t\tcase BEGIN:\n\t\t\t\te = conn.Begin(tv.th)\n\t\t\tcase COMMIT:\n\t\t\t\te = conn.Commit(tv.th)\n\t\t\tcase ABORT:\n\t\t\t\te = conn.Abort(tv.th)\n\t\t\tdefault:\n\t\t\t\tt.Fatalf(\"TestTransErrors[%d/%s] %s BAD DATA[%d]\\n\", pi,\n\t\t\t\t\tsp, tv.action, ti)\n\t\t\t}\n\t\t\tif e == nil {\n\t\t\t\tt.Fatalf(\"TestTransErrors[%d/%s] %s expected error[%d], got %v\\n\", pi,\n\t\t\t\t\tsp, tv.action, ti, e)\n\t\t\t}\n\t\t\tif e != tv.te {\n\t\t\t\tt.Fatalf(\"TestTransErrors[%d/%s] %s expected[%d]: %v, got %v\\n\", pi,\n\t\t\t\t\tsp, tv.action, ti, tv.te, e)\n\t\t\t}\n\t\t}\n\t\tcheckReceived(t, conn, false)\n\t\te = conn.Disconnect(empty_headers)\n\t\tcheckDisconnectError(t, e)\n\t\t_ = closeConn(t, n)\n\t}\n}", "title": "" }, { "docid": "85819fe01d352004088d40c130df2c9e", "score": "0.45358327", "text": "func TestServiceBindingFailure(t *testing.T) {\n\t// GIVEN\n\tct := newControllerTest(t)\n\tdefer ct.TearDown()\n\t// configure broker to respond with HTTP 409 for bind operation\n\tct.SetOSBBindReactionWithHTTPError(http.StatusConflict)\n\trequire.NoError(t, ct.CreateSimpleClusterServiceBroker())\n\trequire.NoError(t, ct.WaitForReadyBroker())\n\tct.AssertClusterServiceClassAndPlan(t)\n\trequire.NoError(t, ct.CreateServiceInstance())\n\trequire.NoError(t, ct.WaitForReadyInstance())\n\n\t// WHEN\n\tassert.NoError(t, ct.CreateBinding())\n\n\t// THEN\n\tassert.NoError(t, ct.WaitForBindingFailed())\n}", "title": "" }, { "docid": "eb9b95bdcf0c4fd43f7c5f159125f4ba", "score": "0.4534841", "text": "func (tr *failingTransport) RoundTrip(r *http.Request) (*http.Response, error) {\n\tif strings.HasPrefix(r.URL.Path, tr.path) && tr.fail != nil {\n\t\treturn tr.fail(r)\n\t}\n\tif tr.next != nil {\n\t\treturn tr.next.RoundTrip(r)\n\t}\n\treturn http.DefaultTransport.RoundTrip(r)\n}", "title": "" }, { "docid": "258968044fb453b205228417d6ccc941", "score": "0.45333573", "text": "func TestApiProviderDownloadFailure(t *testing.T) {\n\tt.Parallel()\n\n\tt.Run(\"Failed case of API Provider Download\", func(t *testing.T) {\n\t\tapiServiceKey := `{\n\t\t\t\"oauth\": {\n\t\t\t\t\"url\": \"https://demo\",\n\t\t\t\t\"clientid\": \"demouser\",\n\t\t\t\t\"clientsecret\": \"******\",\n\t\t\t\t\"tokenurl\": \"https://demo/oauth/token\"\n\t\t\t}\n\t\t}`\n\t\tconfig := apiProviderDownloadOptions{\n\t\t\tAPIServiceKey: apiServiceKey,\n\t\t\tAPIProviderName: \"provider1\",\n\t\t\tDownloadPath: \"APIProvider.json\",\n\t\t}\n\t\thttpClient := httpMockCpis{CPIFunction: \"APIProviderDownloadFailure\", ResponseBody: ``, TestType: \"Negative\"}\n\t\tutilsMock := apiProviderDownloadMockUtilsBundle()\n\t\terr := runApiProviderDownload(&config, nil, &httpClient, utilsMock)\n\n\t\tassert.False(t, utilsMock.HasWrittenFile(config.DownloadPath))\n\n\t\tassert.EqualError(t, err, \"HTTP GET request to https://demo/apiportal/api/1.0/Management.svc/APIProviders('provider1') failed with error: Service not Found\")\n\t})\n}", "title": "" }, { "docid": "a89e424f2d79ab437297dcfc5efc45ba", "score": "0.45317912", "text": "func TestGetRequestWrongCredentials(t *testing.T) {\n\tsetupIntegration()\n\tdefer tearDownIntegration()\n\n\tsession.TokenCreds.Secret = \"You shall not pass!\"\n\n\tresp, _ := session.Get(strings.Join([]string{defaultResourcesUrl, \"user\"}, \"/\"), nil, defaultHttpClient)\n\n\tif resp.StatusCode != 400 {\n\t\tt.Errorf(\"Response status error should be: %v\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "e37f7a8d8a0755e22e5ef274a704e64e", "score": "0.4526792", "text": "func TestPolicyValidation(t *testing.T) {\n\tgoodAppliedTo := []Endpoint{Endpoint{TenantID: uint64(33)}}\n\n\t// 1. Test validation of port ranges\n\tbadPorts := make([]uint, 2)\n\tbadPorts[0] = 65536\n\tbadPorts[1] = 100000\n\tbadPortRanges := make([]PortRange, 2)\n\tbadPortRanges[0] = PortRange{3, 65536}\n\tbadPortRanges[1] = PortRange{10, 4}\n\trules := Rules{\n\t\tRule{Ports: badPorts, Protocol: \"tcp\"},\n\t\tRule{PortRanges: badPortRanges, Protocol: \"udp\"},\n\t}\n\n\t// 2. Test no applied to\n\tpolicy := Policy{\n\t\tIngress: []RomanaIngress{\n\t\t\tRomanaIngress{Rules: rules},\n\t\t},\n\t\tDirection: PolicyDirectionEgress}\n\terr := policy.Validate()\n\tif err == nil {\n\t\tt.Error(\"Unexpected nil\")\n\t}\n\terr2 := err.(HttpError)\n\tlog.Printf(\"Bad ports/ranges: %v\", err2)\n\tdet := (err2.Details).([]string)\n\texpect(t, det[1], \"Rule #1: The following ports are invalid: 65536, 100000.\")\n\texpect(t, det[2], \"Rule #2: The following port ranges are invalid: 3-65536, 10-4.\")\n\texpect(t, det[0], \"Required 'applied_to' entry missing.\")\n\n\tpolicy = Policy{\n\t\tIngress: []RomanaIngress{\n\t\t\tRomanaIngress{Rules: rules},\n\t\t},\n\t\tDirection: PolicyDirectionEgress,\n\t\tAppliedTo: goodAppliedTo}\n\terr = policy.Validate()\n\tif err == nil {\n\t\tt.Error(\"Unexpected nil\")\n\t}\n\terr2 = err.(HttpError)\n\tlog.Printf(\"Bad ports/ranges: %v\", err2)\n\tdet = (err2.Details).([]string)\n\texpect(t, det[0], \"Rule #1: The following ports are invalid: 65536, 100000.\")\n\texpect(t, det[1], \"Rule #2: The following port ranges are invalid: 3-65536, 10-4.\")\n\n\t// 2. Test bad protocols and direction\n\trules = Rules{\n\t\tRule{},\n\t\tRule{Protocol: \"xxxx\"},\n\t}\n\tpolicy = Policy{\n\t\tIngress: []RomanaIngress{\n\t\t\tRomanaIngress{Rules: rules},\n\t\t},\n\t\tDirection: \"bla\",\n\t\tAppliedTo: goodAppliedTo}\n\terr = policy.Validate()\n\tif err == nil {\n\t\tt.Error(\"Unexpected nil\")\n\t}\n\terr2 = err.(HttpError)\n\tlog.Printf(\"Bad direction/protocol: %v\", err2)\n\tdet = (err2.Details).([]string)\n\texpect(t, det[0], \"Unknown direction 'bla', allowed 'egress' or 'ingress'.\")\n\texpect(t, det[1], \"Rule #1: No protocol specified.\")\n\texpect(t, det[2], \"Rule #2: Invalid protocol: xxxx.\")\n\n\t// 4. Test mismatch of proto and ports\n\trules = Rules{\n\t\tRule{Ports: []uint{10, 40}, Protocol: \"icmp\"},\n\t\tRule{IcmpType: 1, Protocol: \"udp\"},\n\t\tRule{IcmpType: 3, IcmpCode: 33, Protocol: \"icmp\"},\n\t}\n\tpolicy = Policy{\n\t\tIngress: []RomanaIngress{\n\t\t\tRomanaIngress{Rules: rules},\n\t\t},\n\t\tDirection: PolicyDirectionEgress,\n\t\tAppliedTo: goodAppliedTo}\n\terr = policy.Validate()\n\tif err == nil {\n\t\tt.Error(\"Unexpected nil\")\n\t}\n\terr2 = err.(HttpError)\n\tlog.Printf(\"Bad proto/ports: %v\", err2)\n\tdet = (err2.Details).([]string)\n\texpect(t, det[0], \"Rule #1: ICMP protocol is specified but ports are also specified.\")\n\texpect(t, det[1], \"Rule #2: ICMP protocol is not specified but ICMP Code and/or ICMP Type are also specified.\")\n\texpect(t, det[2], \"Rule #3: Invalid ICMP code for type 3: 33.\")\n\n\t// 5. Test tenant ID in applied.\n\trules = Rules{\n\t\tRule{Ports: []uint{10, 40}, Protocol: \"tcp\"},\n\t}\n\tbadAppliedTo := []Endpoint{\n\t\tEndpoint{TenantID: uint64(33)},\n\t\tEndpoint{},\n\t}\n\tpolicy = Policy{\n\t\tIngress: []RomanaIngress{\n\t\t\tRomanaIngress{Rules: rules},\n\t\t},\n\t\tDirection: PolicyDirectionEgress,\n\t\tAppliedTo: badAppliedTo}\n\terr = policy.Validate()\n\tif err == nil {\n\t\tt.Error(\"Unexpected nil\")\n\t}\n\terr2 = err.(HttpError)\n\tlog.Printf(\"Bad tenant: %v\", err2)\n\tdet = (err2.Details).([]string)\n\texpect(t, det[0], \"applied_to entry #2: at least one of: dest, tenant, tenant_id, tenant_external_id or tenant_network_id must be specified.\")\n}", "title": "" }, { "docid": "4dad73120310078e36c9ec048d11b9c7", "score": "0.45256513", "text": "func AssertProcessBoletoFailed(t *testing.T, response models.BoletoResponse) {\n\tassert.Greater(t, len(response.Errors), 0, \"Devem ocorrer erros \")\n\tassert.Empty(t, response.BarCodeNumber, \"Não deve haver um Barcode\")\n\tassert.Empty(t, response.DigitableLine, \"Não deve haver uma linha digitável\")\n}", "title": "" }, { "docid": "cc01fa07ebd6debe697f6ce722a7b217", "score": "0.4519234", "text": "func TestWalletRelativePathErrorBackup(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\tst, err := createServerTester(t.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer st.server.panicClose()\n\n\t// Announce the host.\n\tif err := st.announceHost(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Create tmp directory for uploads/downloads.\n\twalletTestDir := build.TempDir(\"wallet_relative_path_backup\")\n\terr = os.MkdirAll(walletTestDir, 0700)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Wallet backup should error if its destination is a relative path\n\tbackupAbsoluteError := \"error when calling /wallet/backup: destination must be an absolute path\"\n\t// This should error.\n\terr = st.stdGetAPI(\"/wallet/backup?destination=test_wallet.backup\")\n\tif err == nil || err.Error() != backupAbsoluteError {\n\t\tt.Fatal(err)\n\t}\n\t// This as well.\n\terr = st.stdGetAPI(\"/wallet/backup?destination=../test_wallet.backup\")\n\tif err == nil || err.Error() != backupAbsoluteError {\n\t\tt.Fatal(err)\n\t}\n\t// This should succeed.\n\terr = st.stdGetAPI(\"/wallet/backup?destination=\" + filepath.Join(walletTestDir, \"test_wallet.backup\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Make sure the backup was actually created.\n\t_, errStat := os.Stat(filepath.Join(walletTestDir, \"test_wallet.backup\"))\n\tif errStat != nil {\n\t\tt.Error(errStat)\n\t}\n}", "title": "" }, { "docid": "4dc0e50bbafd3c5380bb22206581d565", "score": "0.45177624", "text": "func FaultTolerance(attemps int, backoff time.Duration) Decorator {\n\treturn func(c Client) Client {\n\t\treturn ClientFunc(func(r *http.Request) (res *http.Response, err error) {\n\t\t\tfor i := 0; i <= attemps; i++ {\n\t\t\t\tif res, err = c.Do(r); err == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\ttime.Sleep(backoff * time.Duration(i))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn res, err\n\n\t\t})\n\t}\n}", "title": "" }, { "docid": "80f1a7d850d9d555e7fd947aa56d22b4", "score": "0.45134076", "text": "func TestConsentV2_GetBadFunction(t *testing.T) {\n\tscc := new(ConsentCC)\n\tstub := shim.NewMockStub(\"consentv2\", scc)\n\tres := stub.MockInvoke(\"1\", [][]byte{[]byte(\"badFunction\")})\n\tif res.Status != shim.ERROR{\n\t\tt.Log(\"bad status received, expected: 500 received:\"+strconv.FormatInt(int64(res.Status), 10))\n\t\tt.FailNow()\n\t}\n\tif !strings.Contains(res.Message, errorBadFunctionName){\n\t\tt.Log(\"Bad return message, expected:\"+errorBadFunctionName+\" reveived:\"+string(res.Message))\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "117b6ed17048faa69159fe9c1bffe457", "score": "0.45114484", "text": "func (m *MockPassiveFilter) Failed(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Failed\", arg0)\n}", "title": "" }, { "docid": "3b043dbbf51e96b42200495e953ed655", "score": "0.4509033", "text": "func SubtestWrongPeer(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {\n\ttsec.SubtestWrongPeer(t, at, bt, ap, bp)\n}", "title": "" }, { "docid": "b0230a2dedaf01fbc9ef8df5fedee594", "score": "0.45075616", "text": "func (_m *MockOptions) BackgroundHealthCheckFailThrottleFactor() float64 {\n\tret := _m.ctrl.Call(_m, \"BackgroundHealthCheckFailThrottleFactor\")\n\tret0, _ := ret[0].(float64)\n\treturn ret0\n}", "title": "" }, { "docid": "ac1cf2bda908ab46fac46a542fc9d2b1", "score": "0.45060247", "text": "func TestSsMethodNotAllowed(t *testing.T) {\n\theader[\"Allow\"] = []string{\"GET\"}\n\tdefer delete(header, \"Allow\")\n\trouter := iris.New()\n\tredfishRoutes := router.Party(\"/redfish\")\n\tredfishRoutes.Any(\"/v1/SessionService\", SsMethodNotAllowed)\n\te := httptest.New(t, router)\n\n\t//Check for status code 405 for http methods which are not allowed on Account service URL\n\te.POST(\"/redfish/v1/SessionService\").Expect().Status(http.StatusMethodNotAllowed).Headers().Equal(header)\n\te.PUT(\"/redfish/v1/SessionService\").Expect().Status(http.StatusMethodNotAllowed)\n\te.DELETE(\"/redfish/v1/SessionService\").Expect().Status(http.StatusMethodNotAllowed)\n}", "title": "" }, { "docid": "aa52b1a1cca48148e7bf075892942588", "score": "0.44946802", "text": "func TestShouldPropagateSuccessOrPermanentFailureResponses(t *testing.T) {\n\n\tvar testcases = []struct {\n\t\tid string\n\t\tresponseStatusCode int\n\t\tresponseLimits *Limits\n\t\tresponseBody string\n\t\texpectedResponseBodyStatus int\n\t}{\n\t\t{\"ShouldPropagateSuccess200\", 200, &Limits{limit: 1000, remaining: 500, reset: 123456789}, \"{\\\"status\\\": 1}\", 1},\n\t\t{\"ShouldPropagateError400\", 400, nil, \"{\\\"status\\\": 0}\", 0},\n\t\t{\"ShouldPropagateError401\", 401, nil, \"\", 0},\n\t\t{\"ShouldPropagateError402\", 402, nil, \"\", 0},\n\t\t{\"ShouldPropagateError403\", 403, nil, \"\", 0},\n\t\t{\"ShouldPropagateError404\", 404, nil, \"\", 0},\n\t\t{\"ShouldPropagateError405\", 405, nil, \"\", 0},\n\t\t{\"ShouldPropagateError426\", 426, nil, \"\", 0},\n\t}\n\t// **** GIVEN ****\n\n\t// The REST API server is initialized and connected to the message handler mock\n\tpcm := NewPushNotificationsSenderMock()\n\tprocessor := NewProcessor(pcm, NewLimitsCounterImpl())\n\n\ttestMessage := PushNotification{Token: \"<dummy token>\", User: \"<dummy user>\", Message: \"\"}\n\n\t// start the processor\n\tgo processor.Run()\n\n\tfor _, tc := range testcases {\n\n\t\tt.Run(tc.id, func(t *testing.T) {\n\n\t\t\t// **** WHEN ****\n\n\t\t\t// set the response in the mock\n\t\t\tpcm.ForceResponse(nil, tc.responseStatusCode, tc.responseLimits, tc.responseBody)\n\n\t\t\t// a push notification is obtained by the process (via IncommingPushNotificationMessageHandler interface method HandleMessage())\n\t\t\tvar response = PushNotificationHandlingResponse{}\n\t\t\terr := processor.HandleMessage(&response, testMessage)\n\n\t\t\t// **** THEN ****\n\n\t\t\t// the request should respond correctly\n\t\t\tif err == nil {\n\n\t\t\t\t// check the reseponse code\n\t\t\t\tif response.responseCode != tc.responseStatusCode {\n\t\t\t\t\tt.Errorf(\"The handling of the message returned response code %d, but expected was %d\", response.responseCode, tc.responseStatusCode)\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tt.Errorf(\"Handling of the message failed with error %s, response code %d.\", err, response.responseCode)\n\t\t\t}\n\n\t\t\t// if the limits match the expected limits\n\t\t\tif response.limits != tc.responseLimits {\n\n\t\t\t\tt.Errorf(\"Returned limits %s don't match the expected value %s.\", response.limits, tc.responseLimits)\n\t\t\t}\n\n\t\t\t// get the content of the body\n\t\t\ttype ResponseJSONBodyContent struct {\n\t\t\t\tStatus int `json:\"status\"`\n\t\t\t\tRequest string `json:\"request\"`\n\t\t\t}\n\t\t\tvar responseJSONBodyContent = ResponseJSONBodyContent{0, \"\"}\n\t\t\terr = json.NewDecoder(strings.NewReader(response.jsonResponseBody)).Decode(&responseJSONBodyContent)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"POST request returned JSON \\\"%s\\\", which failed to decode with error %s.\", response.jsonResponseBody, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// check the status value\n\t\t\tif responseJSONBodyContent.Status != tc.expectedResponseBodyStatus {\n\t\t\t\tt.Errorf(\"POST request returned JSON with status %d, expected status was %d.\", responseJSONBodyContent.Status, tc.expectedResponseBodyStatus)\n\t\t\t\treturn\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e6b811db7633c6537e897af6730dcc59", "score": "0.44838586", "text": "func TestProxyHTTP(t *testing.T) {\n\t// Create a list of services to proxy between.\n\tservices := []*proxy.Service{{\n\t\tAddress: testTargetServiceAddress,\n\t\tHostRegexp: testHostRegexp,\n\t\tPathRegexp: testPathRegexpHTTP,\n\t\tProtocol: \"http\",\n\t}}\n\n\tmockAuth := auth.NewMockAuthenticator()\n\tp, err := proxy.New(mockAuth, services, \"static\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create new proxy: %v\", err)\n\t}\n\n\t// Start server that gives requests to the proxy.\n\tserver := &http.Server{\n\t\tAddr: testProxyAddr,\n\t\tHandler: http.HandlerFunc(p.ServeHTTP),\n\t}\n\tgo func() { _ = server.ListenAndServe() }()\n\tdefer closeOrFail(t, server)\n\n\t// Start the target backend service.\n\tbackendService := &http.Server{Addr: testTargetServiceAddress}\n\tgo func() { _ = startBackendHTTP(backendService) }()\n\tdefer closeOrFail(t, backendService)\n\n\t// Wait for servers to start.\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// Test making a request to the backend service without the\n\t// Authorization header set.\n\tclient := &http.Client{}\n\turl := fmt.Sprintf(\"http://%s/http/test\", testProxyAddr)\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\tt.Fatalf(\"errored making http request: %v\", err)\n\t}\n\n\tif resp.Status != \"402 Payment Required\" {\n\t\tt.Fatalf(\"expected 402 status code, got: %v\", resp.Status)\n\t}\n\n\tauthHeader := resp.Header.Get(\"Www-Authenticate\")\n\tif !strings.Contains(authHeader, \"LSAT\") {\n\t\tt.Fatalf(\"expected partial LSAT in response header, got: %v\",\n\t\t\tauthHeader)\n\t}\n\t_ = resp.Body.Close()\n\n\t// Make sure that if the Auth header is set, the client's request is\n\t// proxied to the backend service.\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating request: %v\", err)\n\t}\n\treq.Header.Add(\"Authorization\", \"foobar\")\n\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\tt.Fatalf(\"errored making http request: %v\", err)\n\t}\n\n\tif resp.Status != \"200 OK\" {\n\t\tt.Fatalf(\"expected 200 OK status code, got: %v\", resp.Status)\n\t}\n\n\t// Ensure that we got the response body we expect.\n\tdefer closeOrFail(t, resp.Body)\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to read response body: %v\", err)\n\t}\n\n\tif string(bodyBytes) != testHTTPResponseBody {\n\t\tt.Fatalf(\"expected response body %v, got %v\",\n\t\t\ttestHTTPResponseBody, string(bodyBytes))\n\t}\n}", "title": "" }, { "docid": "f364bcf3aab7ab66197b2ea32bde4180", "score": "0.44788894", "text": "func TestHTTPSenderRetryResponseCodes(t *testing.T) {\n\tretryOptions := defaultRetryOptions\n\tretryOptions.Backoff = 1 * time.Millisecond\n\n\ttestCases := []struct {\n\t\tcode int\n\t\tretry bool\n\t}{\n\t\t{http.StatusServiceUnavailable, true},\n\t\t{http.StatusGatewayTimeout, true},\n\t\t{StatusTooManyRequests, true},\n\t\t{http.StatusRequestTimeout, false},\n\t\t{http.StatusBadRequest, false},\n\t\t{http.StatusNotFound, false},\n\t\t{http.StatusUnauthorized, false},\n\t\t{http.StatusForbidden, false},\n\t\t{http.StatusMethodNotAllowed, false},\n\t\t{http.StatusNotAcceptable, false},\n\t\t{http.StatusInternalServerError, false},\n\t\t{http.StatusNotImplemented, false},\n\t}\n\tfor i, test := range testCases {\n\t\tcount := 0\n\t\tserver, addr := startTestHTTPServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tcount++\n\t\t\tif count == 1 {\n\t\t\t\thttp.Error(w, \"manufactured error\", test.code)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !test.retry {\n\t\t\t\tt.Errorf(\"%d: didn't expect retry on code %d\", i, test.code)\n\t\t\t}\n\t\t\tbody, contentType, err := util.MarshalResponse(r, testPutResp, util.AllEncodings)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%d: failed to marshal response: %s\", i, err)\n\t\t\t}\n\t\t\tw.Header().Set(util.ContentTypeHeader, contentType)\n\t\t\tw.Write(body)\n\t\t}))\n\n\t\tsender, err := newHTTPSender(addr, testutils.NewTestBaseContext(), retryOptions)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\treply := &proto.PutResponse{}\n\t\tsender.Send(context.Background(), proto.Call{Args: testPutReq, Reply: reply})\n\t\tif test.retry {\n\t\t\tif count != 2 {\n\t\t\t\tt.Errorf(\"%d: expected retry\", i)\n\t\t\t}\n\t\t\tif reply.GoError() != nil {\n\t\t\t\tt.Errorf(\"%d: expected success after retry; got %s\", i, reply.GoError())\n\t\t\t}\n\t\t} else {\n\t\t\tif count != 1 {\n\t\t\t\tt.Errorf(\"%d; expected no retry; got %d\", i, count)\n\t\t\t}\n\t\t\tif reply.GoError() == nil {\n\t\t\t\tt.Errorf(\"%d: expected error\", i)\n\t\t\t}\n\t\t}\n\t\tserver.Close()\n\t}\n}", "title": "" }, { "docid": "026dbb0826876a76c22637ea121e526a", "score": "0.44760168", "text": "func (_ERC20FailingMock *ERC20FailingMockTransactor) Transfer(opts *bind.TransactOpts, arg0 common.Address, arg1 *big.Int) (*types.Transaction, error) {\n\treturn _ERC20FailingMock.contract.Transact(opts, \"transfer\", arg0, arg1)\n}", "title": "" }, { "docid": "9e46abb851dd8c94e6f0302623f94242", "score": "0.44707167", "text": "func TestFailureTemplate(t *testing.T) {\n\tt.Skip() // remove this line to see test failure\n\n\thandler := FruitsHandler()\n\n\tserver := httptest.NewServer(handler)\n\tdefer server.Close()\n\n\te := httpexpect.WithConfig(httpexpect.Config{\n\t\tTestName: \"Check Fruits List\",\n\t\tBaseURL: server.URL,\n\t\tReporter: httpexpect.NewAssertReporter(t),\n\t\tFormatter: &httpexpect.DefaultFormatter{\n\t\t\t// customize error message with `FailureTemplate`\n\t\t\tFailureTemplate: failureTemplate,\n\t\t\tTemplateFuncs: templateFuncs,\n\t\t},\n\t})\n\n\torange := map[string]interface{}{\n\t\t\"weight\": 100,\n\t}\n\n\te.PUT(\"/fruits/orange\").WithJSON(orange).\n\t\tExpect().\n\t\tStatus(http.StatusNoContent).NoContent()\n\n\tfruits := e.GET(\"/fruits\").WithName(\"Get Fruits\").\n\t\tExpect().\n\t\tStatus(http.StatusOK).JSON().Array()\n\n\tfruits.ContainsAny(\"melon\")\n}", "title": "" }, { "docid": "dae1f333e3ad1dbc8192921a88b78aea", "score": "0.4469146", "text": "func (s *MacaroonTestSuite) TestInvalidActivity(c *check.C) {\n\treq := &http3rd.MacaroonRequest{\n\t\tResource: s.fileURL,\n\t\tActivities: []string{http3rd.List},\n\t\tLifetime: time.Minute,\n\t}\n\tm, e := http3rd.GetMacaroon(s.x509client, req)\n\tif e != nil {\n\t\tc.Fatal(e)\n\t}\n\n\tdav := s.NewDavClient(m.Macaroon)\n\n\t// Stat (LIST) is fine\n\t_, e = dav.Stat(\"/\" + s.file)\n\tif e != nil {\n\t\tc.Fatal(e)\n\t}\n\n\t// Download is not fine\n\tcode, e := TryDownload(s.client, s.fileURL, m.Macaroon)\n\tif e != nil {\n\t\tc.Fatal(e)\n\t}\n\tif code != 403 {\n\t\tc.Error(\"Expecting a 403, got \", code)\n\t}\n}", "title": "" }, { "docid": "565b4703e9eaf1d8eeecfee3bb387f58", "score": "0.44686073", "text": "func TestCheckoutComAuthorizeFailed(t *testing.T) {\n\tclients := generateClients()\n\n\tfor _, clientNamePair := range clients {\n\t\tclient := clientNamePair.client\n\t\tname := clientNamePair.name\n\t\tfailedRequest := sleet_testing.BaseAuthorizationRequest()\n\t\tfailedRequest.CreditCard.Number = \"4544249167673670\"\n\t\tresponse, err := client.Authorize(failedRequest)\n\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: Authorize request should not have an error even if authorization failed- %s\", name, err.Error())\n\t\t}\n\n\t\tif response.Success {\n\t\t\tt.Errorf(\"%s: Auth response should indicate a failure\", name)\n\t\t}\n\n\t\tif response.Response != \"20051\" {\n\t\t\tt.Errorf(\"%s: Response should be 20051, code for insufficient funds- %s\", name, response.Response)\n\t\t}\n\t}\n}", "title": "" } ]
d5f7f2b83d46c4fccd582e1b4ec9c298
PageResponse returns the current OriginsListByEndpointResponse page.
[ { "docid": "2e280e2b80a8545d12bf86f2daebe7e8", "score": "0.7732076", "text": "func (p *OriginsListByEndpointPager) PageResponse() OriginsListByEndpointResponse {\n\treturn p.current\n}", "title": "" } ]
[ { "docid": "74a2e4729a14611b6628a8933627964e", "score": "0.6837681", "text": "func (p *OriginGroupsListByEndpointPager) PageResponse() OriginGroupsListByEndpointResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "d2d70bcc2c92343f7626138152e7c37b", "score": "0.6463451", "text": "func (p *CustomDomainsListByEndpointPager) PageResponse() CustomDomainsListByEndpointResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "ffdf83926d2588481ea7a1d0b0f71aa1", "score": "0.6376121", "text": "func (p *AFDOriginsListByOriginGroupPager) PageResponse() AFDOriginsListByOriginGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "0dc82adb589cdaf0c7db5aadffa40c6a", "score": "0.6304315", "text": "func (p *PrivateEndpointConnectionsListPager) PageResponse() PrivateEndpointConnectionsListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "0dc82adb589cdaf0c7db5aadffa40c6a", "score": "0.6304315", "text": "func (p *PrivateEndpointConnectionsListPager) PageResponse() PrivateEndpointConnectionsListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "2b56df2bc341933c3aa02f9f97e5c27d", "score": "0.6191954", "text": "func (p *RoutesListByEndpointPager) PageResponse() RoutesListByEndpointResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "5fcc45fc323b830533af77d81342d45d", "score": "0.59314287", "text": "func (p *ArtifactSourcesClientListPager) PageResponse() ArtifactSourcesClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "719a425609860540ac97d0a3b0bc3eba", "score": "0.59162086", "text": "func (p *ManagedClustersClientListOutboundNetworkDependenciesEndpointsPager) PageResponse() ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "a381c78c8c46a142e8435d798beacd68", "score": "0.5852782", "text": "func (p *OriginsListByEndpointPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.OriginListResult.NextLink == nil || len(*p.current.OriginListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = p.client.listByEndpointHandleError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listByEndpointHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "title": "" }, { "docid": "943bc50f43fdb2f3e0cbbe6ea7c471a1", "score": "0.5831502", "text": "func (p *DataCollectionEndpointsListByResourceGroupPager) PageResponse() DataCollectionEndpointsListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "7a8943c508024a51f616dc3848f7c327", "score": "0.580862", "text": "func (p *AgentPoolsClientListPager) PageResponse() AgentPoolsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "41b31db814709062a7aba9490028c6b5", "score": "0.58076155", "text": "func (p *DataCollectionEndpointsListBySubscriptionPager) PageResponse() DataCollectionEndpointsListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "4473de52f70b157821a34ef25a863ebb", "score": "0.5800998", "text": "func (p *MonitorsClientListHostsPager) PageResponse() MonitorsClientListHostsResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "2e9b83e72ab028facc21dac56718b1d8", "score": "0.57697374", "text": "func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {\n\treturn page.peclr\n}", "title": "" }, { "docid": "2e9b83e72ab028facc21dac56718b1d8", "score": "0.57697374", "text": "func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {\n\treturn page.peclr\n}", "title": "" }, { "docid": "6a355fb52f9e73dcb3f101e092ae7677", "score": "0.57696486", "text": "func (page ManagedInstancePrivateEndpointConnectionListResultPage) Response() ManagedInstancePrivateEndpointConnectionListResult {\n\treturn page.mipeclr\n}", "title": "" }, { "docid": "0b9a9aa780da70b68ee1f6a1824b0ba5", "score": "0.5768471", "text": "func (p *LocationsClientListPager) PageResponse() LocationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "0b9a9aa780da70b68ee1f6a1824b0ba5", "score": "0.5768471", "text": "func (p *LocationsClientListPager) PageResponse() LocationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "30c50caeea88a375978fd2c8dfc1424c", "score": "0.57630104", "text": "func (o EndpointOutput) Origins() EndpointOriginArrayOutput {\n\treturn o.ApplyT(func(v *Endpoint) EndpointOriginArrayOutput { return v.Origins }).(EndpointOriginArrayOutput)\n}", "title": "" }, { "docid": "e96f1456b8602f736651d13d9289022c", "score": "0.5756494", "text": "func (p *EndpointsListByProfilePager) PageResponse() EndpointsListByProfileResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "a4ae8f1aea6d95469f45e886d756b598", "score": "0.5720652", "text": "func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) Response() ManagedInstancePrivateEndpointConnectionListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "ea0f87be6d7ed8f795b604d3978051bb", "score": "0.5717109", "text": "func (p *ServiceLocationsClientListPager) PageResponse() ServiceLocationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "d4e0c9444c891ee12bd0000af438a21d", "score": "0.5669057", "text": "func (p *PeerAsnsClientListBySubscriptionPager) PageResponse() PeerAsnsClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "39e2c77f95c49b5c4e4cd9c947a813d3", "score": "0.5664982", "text": "func (p *PrefixesClientListByPeeringServicePager) PageResponse() PrefixesClientListByPeeringServiceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "a90b494aeca02923a2f3ac58a4cf9a45", "score": "0.5649429", "text": "func (p *MonitorsClientListPager) PageResponse() MonitorsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "3e51d398dc672e950366e28a50a67ad5", "score": "0.5640397", "text": "func (p *PrivateEndpointConnectionsListByPrivateLinkScopePager) PageResponse() PrivateEndpointConnectionsListByPrivateLinkScopeResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "75d83468573f6f30052235a41453d5aa", "score": "0.5637491", "text": "func (p *IotAlertsClientListPager) PageResponse() IotAlertsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "b727853352cbba1c7ef1955959442794", "score": "0.5631217", "text": "func (p *SpatialAnchorsAccountsClientListBySubscriptionPager) PageResponse() SpatialAnchorsAccountsClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "a0edcd8ce6538e84399138dc9ebf4e65", "score": "0.56170946", "text": "func (p *PoliciesClientListPager) PageResponse() PoliciesClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "71a24474ac19df1545ec203aa80d3f41", "score": "0.56083864", "text": "func (p *SnapshotsClientListPager) PageResponse() SnapshotsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "ecc2ce352d1eebf77518a225918ff9fc", "score": "0.5603338", "text": "func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "ecc2ce352d1eebf77518a225918ff9fc", "score": "0.5603338", "text": "func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "b127cfaab416965329934f7c85dde134", "score": "0.55977434", "text": "func (p *RemoteRenderingAccountsClientListBySubscriptionPager) PageResponse() RemoteRenderingAccountsClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "923cd76c7f00d8259bb4a9f2a88cac36", "score": "0.5587204", "text": "func (page PrivateZoneListResultPage) Response() PrivateZoneListResult {\n\treturn page.pzlr\n}", "title": "" }, { "docid": "e3a033a9f4521fd66f284a3f79d8e963", "score": "0.5581278", "text": "func (p *CustomImagesClientListPager) PageResponse() CustomImagesClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "679ea9590f2de3c028c23ee4701b4363", "score": "0.5574279", "text": "func (p *ProviderOperationsMetadataClientListPager) PageResponse() ProviderOperationsMetadataClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "702411b68c3101a8c73db5c3d7079e6e", "score": "0.55629784", "text": "func (page TimeZoneListResultPage) Response() TimeZoneListResult {\n\treturn page.tzlr\n}", "title": "" }, { "docid": "66df3f96838832c4439c6db9009307a5", "score": "0.55391663", "text": "func (page PublicIPAddressListResultPage) Response() network.PublicIPAddressListResult {\n\treturn page.pialr\n}", "title": "" }, { "docid": "7ea35b92f1b34c34c53e6a0c6ff316e1", "score": "0.55289346", "text": "func (p *ArtifactsClientListPager) PageResponse() ArtifactsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "f52f3b9f9639d3aace9864f34b427839", "score": "0.55285794", "text": "func (p *NotificationChannelsClientListPager) PageResponse() NotificationChannelsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "f19ecee9e825555987909ced4521af9a", "score": "0.55253524", "text": "func (p *SingleSignOnConfigurationsClientListPager) PageResponse() SingleSignOnConfigurationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "c5e81a78c6c880a776e208fcf019578e", "score": "0.55227655", "text": "func (p *ObjectAnchorsAccountsClientListBySubscriptionPager) PageResponse() ObjectAnchorsAccountsClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "b76bb818af2577a1e9f4846cebe4b79a", "score": "0.5516742", "text": "func (p *DisasterRecoveryConfigsListAuthorizationRulesPager) PageResponse() DisasterRecoveryConfigsListAuthorizationRulesResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "98c3f44f44998ddaa7758f6ff1c2e408", "score": "0.55061543", "text": "func (p *EndpointsListResourceUsagePager) PageResponse() EndpointsListResourceUsageResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "70c28566c8359e5750ef50c022dedbe4", "score": "0.5494773", "text": "func (p *NamespacesListAuthorizationRulesPager) PageResponse() NamespacesListAuthorizationRulesResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "9829282cdcaca1fc7bcf945127ca4e17", "score": "0.54884374", "text": "func (p *ServiceProvidersClientListPager) PageResponse() ServiceProvidersClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "51a4c856e23101d33ec11db6ab5f6d21", "score": "0.5487239", "text": "func (p *EnvironmentsClientListPager) PageResponse() EnvironmentsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "f61dbf63da5de5151a36e5774ef37134", "score": "0.547571", "text": "func (p *PeeringsClientListBySubscriptionPager) PageResponse() PeeringsClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "cc509e5c00391ba7611ca1476b8d07db", "score": "0.54733056", "text": "func (iter SyncIdentityProviderListIterator) Response() SyncIdentityProviderList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "5943a2af00c5f4a8a234dcc1da7c580d", "score": "0.5455044", "text": "func (p *QueuesListAuthorizationRulesPager) PageResponse() QueuesListAuthorizationRulesResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "dfac889e21a75a4519fdc0e0cb58fbdc", "score": "0.5454769", "text": "func (p *SpatialAnchorsAccountsClientListByResourceGroupPager) PageResponse() SpatialAnchorsAccountsClientListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "95356a7af94229702b3c57bfbc11728f", "score": "0.543465", "text": "func (p *MarketplaceAgreementsClientListPager) PageResponse() MarketplaceAgreementsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "4f027bbb0d88ccb50bd040512def5d06", "score": "0.54279244", "text": "func (p *RoleManagementPoliciesClientListForScopePager) PageResponse() RoleManagementPoliciesClientListForScopeResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "20d16c874438d482eff6c034fd98c5c1", "score": "0.5426297", "text": "func (p *RoleDefinitionsClientListPager) PageResponse() RoleDefinitionsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "0684c51948c949353fa8d126f04e6449", "score": "0.542494", "text": "func (p *PoliciesListPager) PageResponse() PoliciesListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "0fb9b9dcdbeb116fadf45bc7eb1328b8", "score": "0.5424439", "text": "func (p *ProviderOperationsClientListPager) PageResponse() ProviderOperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "04acec0ca7b66b32bbbc3d3207074ef9", "score": "0.542393", "text": "func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "4c3b7af4b5b58ab18d7a645a07fda56d", "score": "0.54191804", "text": "func (iter PrivateZoneListResultIterator) Response() PrivateZoneListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "15be7fdd409883f0f9a04764da123b39", "score": "0.541916", "text": "func (p *RoleAssignmentsClientListForSubscriptionPager) PageResponse() RoleAssignmentsClientListForSubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "0a7b9010ba2bdce57f28269fe8b1951c", "score": "0.5416404", "text": "func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult {\n\treturn page.esbaplr\n}", "title": "" }, { "docid": "7255d72a4e3cf0bc00d8499b404ea992", "score": "0.54120594", "text": "func (iter RestorePointListResultIterator) Response() RestorePointListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "98519777a4414183ecc8594e34bcfd31", "score": "0.5407948", "text": "func (p *SecretsClientListPager) PageResponse() SecretsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "c43aeb553df28d7195c4f30d85a87711", "score": "0.5402787", "text": "func (p *MonitorsClientListByResourceGroupPager) PageResponse() MonitorsClientListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "face6271e0138935cecfdc5c7d9fcb5b", "score": "0.54018575", "text": "func (p *GalleryImagesClientListPager) PageResponse() GalleryImagesClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "8a323ca66670f2bdf1cce55784338970", "score": "0.5393425", "text": "func (p *VirtualNetworksClientListPager) PageResponse() VirtualNetworksClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "d742eb6b01743d018f5053b41002459c", "score": "0.5390914", "text": "func (p *LabsClientListBySubscriptionPager) PageResponse() LabsClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "9466979848f7f3bb435a62b33579eab2", "score": "0.5378058", "text": "func (p *FormulasClientListPager) PageResponse() FormulasClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "bdade91839211379a453a07f7144e101", "score": "0.5373326", "text": "func (iter ServerBlobAuditingPolicyListResultIterator) Response() ServerBlobAuditingPolicyListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "c528538f4b27f53945287189edda36c5", "score": "0.536966", "text": "func (p *PeeringsClientListByResourceGroupPager) PageResponse() PeeringsClientListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "c2c627d3365cddefaf3af1b05b95f302", "score": "0.5357885", "text": "func (p *DataCollectionRuleAssociationsListByResourcePager) PageResponse() DataCollectionRuleAssociationsListByResourceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "5c7c88654b591e02da3bf08a2d56e5c5", "score": "0.5346917", "text": "func (iter MessagingRegionsListResultIterator) Response() MessagingRegionsListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "03ecf948aa28122b700a812ac19a3728", "score": "0.5342277", "text": "func (p *LegacyPeeringsClientListPager) PageResponse() LegacyPeeringsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "577c23cfc1d53aae042a7b0f9df7fcf2", "score": "0.5339031", "text": "func (p *RemoteRenderingAccountsClientListByResourceGroupPager) PageResponse() RemoteRenderingAccountsClientListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "da47484febde65d738fa47289941784d", "score": "0.53385156", "text": "func (p *ServiceFabricsClientListPager) PageResponse() ServiceFabricsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "c3755c8e52fe125a44b122205fad3986", "score": "0.53359497", "text": "func (p *SnapshotsClientListByResourceGroupPager) PageResponse() SnapshotsClientListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "e820998598cee46330c79b7076081a7d", "score": "0.5334427", "text": "func (client *CustomDomainsClient) listByEndpointHandleResponse(resp *http.Response) (CustomDomainsClientListByEndpointResponse, error) {\n\tresult := CustomDomainsClientListByEndpointResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CustomDomainListResult); err != nil {\n\t\treturn CustomDomainsClientListByEndpointResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "53c5b8897bae95b249bfca2b4b9d1440", "score": "0.532016", "text": "func (client *CustomDomainsClient) listByEndpointHandleResponse(resp *http.Response) (CustomDomainsListByEndpointResponse, error) {\n\tresult := CustomDomainsListByEndpointResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CustomDomainListResult); err != nil {\n\t\treturn CustomDomainsListByEndpointResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d9a386a63259d5290481bf8f994a7f8b", "score": "0.5318221", "text": "func (p *MonitorsClientListLinkedResourcesPager) PageResponse() MonitorsClientListLinkedResourcesResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "019f66f5d11467fdf2d111f28c1a4996", "score": "0.53160536", "text": "func (iter PremiumMessagingRegionsListResultIterator) Response() PremiumMessagingRegionsListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "c95b2ac8f8cdba91d417206c9e1a5503", "score": "0.53152204", "text": "func (iter TimeZoneListResultIterator) Response() TimeZoneListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "be16c9e43ef917397fe81a0060808065", "score": "0.53113073", "text": "func (p *SchedulesClientListPager) PageResponse() SchedulesClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "9a13d80c4de2896e89700c12604a2778", "score": "0.53078604", "text": "func (iter CustomLocationOperationsListIterator) Response() CustomLocationOperationsList {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "dd3daceab27b22924e070290678be0fe", "score": "0.53039485", "text": "func (iter EventHubListResultIterator) Response() EventHubListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "0a5149a5cde2b4ae19db96cfe62c4c73", "score": "0.52943", "text": "func (p *ServicesClientListBySubscriptionPager) PageResponse() ServicesClientListBySubscriptionResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "4b23ac56659325cbd852f5747963c18b", "score": "0.529202", "text": "func (p *ObjectAnchorsAccountsClientListByResourceGroupPager) PageResponse() ObjectAnchorsAccountsClientListByResourceGroupResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "ed05aea2cbdf4689215480a046df78d8", "score": "0.5288979", "text": "func (p *TagRulesClientListPager) PageResponse() TagRulesClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "459887a7076aa4766327a1bea378cee3", "score": "0.5286299", "text": "func (p *PermissionsClientListForResourcePager) PageResponse() PermissionsClientListForResourceResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1f49bce04b03b9e29586852ad1710dde", "score": "0.5275983", "text": "func (*ListOriginsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_cdn_v1_origin_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "8557f33bfa7dce60f410308defea04ff", "score": "0.5275933", "text": "func (page AdvisorsResultListPage) Response() AdvisorsResultList {\n\treturn page.arl\n}", "title": "" }, { "docid": "c1d7bc7f4bfdabc2df9606409911bfb7", "score": "0.5274791", "text": "func (page SyncIdentityProviderListPage) Response() SyncIdentityProviderList {\n\treturn page.sipl\n}", "title": "" }, { "docid": "65e4bf9d5f75c75899a52a246b0d2c60", "score": "0.52736413", "text": "func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Response() ExtendedDatabaseBlobAuditingPolicyListResult {\n\treturn iter.page.Response()\n}", "title": "" }, { "docid": "218ebce2009b842b9fa6d52830b86355", "score": "0.5271824", "text": "func (page EventHubListResultPage) Response() EventHubListResult {\n\treturn page.ehlr\n}", "title": "" }, { "docid": "795a2c70951ed233d88914c8862ac38d", "score": "0.52675277", "text": "func (p *IotDeviceVulnerabilityClientListPager) PageResponse() IotDeviceVulnerabilityClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.5263587", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.5263587", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.5263587", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.5263587", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.5263587", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "1b0f1099fd7be1602a6813ce8a3dea77", "score": "0.5263587", "text": "func (p *OperationsClientListPager) PageResponse() OperationsClientListResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "9e6314ebc8f5aa1ed984251dd43a4fcb", "score": "0.52628237", "text": "func (page RestorePointListResultPage) Response() RestorePointListResult {\n\treturn page.rplr\n}", "title": "" } ]
237a93d63a7ed60fd7702161d9870a36
BoolX is like Bool, but panics if an error occurs.
[ { "docid": "ca8930758ff97834e4212e735b48ea64", "score": "0.5953729", "text": "func (twgb *TwoWordGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := twgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" } ]
[ { "docid": "8e387712dbf8f3827b2671caf788572c", "score": "0.68958515", "text": "func Boolean(x bool) Const { return Const{x, nil} }", "title": "" }, { "docid": "6669119e994fb4298bede1fe7c7eb5f3", "score": "0.65981275", "text": "func (ns *NetworkSelect) BoolX(ctx context.Context) bool {\n\tv, err := ns.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0b86641e0ebebd70e431c082c935b618", "score": "0.6565964", "text": "func (ots *OtherTestSelect) BoolX(ctx context.Context) bool {\n\tv, err := ots.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ff337792e1b6ee8489eedba587248a19", "score": "0.65574956", "text": "func (fets *FlowExecutionTemplateSelect) BoolX(ctx context.Context) bool {\n\tv, err := fets.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a91a22b77b1230dc7b64f98bf1ac2959", "score": "0.65467775", "text": "func (os *OperationSelect) BoolX(ctx context.Context) bool {\n\tv, err := os.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "fa94e0ebb5c3d7bd2d621de4445685cf", "score": "0.6516607", "text": "func (sos *StatusOpinionSelect) BoolX(ctx context.Context) bool {\n\tv, err := sos.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "2497ca877ca72846f0bc21782d1e8731", "score": "0.6478074", "text": "func (hs *HistorySelect) BoolX(ctx context.Context) bool {\n\tv, err := hs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d699b6c570fe566975997a0de05eb21d", "score": "0.64700794", "text": "func (rs *RestaurantSelect) BoolX(ctx context.Context) bool {\n\tv, err := rs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b4f23d9124bd2cecbea0d7163aa604a3", "score": "0.64429814", "text": "func (tts *TreatmentTypeSelect) BoolX(ctx context.Context) bool {\n\tv, err := tts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "974a89dafd5f90560865f7d05edb4552", "score": "0.643702", "text": "func (nts *NetTopologySelect) BoolX(ctx context.Context) bool {\n\tv, err := nts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8526138c64732bb964eef25e079573bc", "score": "0.64218664", "text": "func (os *OptSelect) BoolX(ctx context.Context) bool {\n\tv, err := os.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3841a2e99ad3b8ac4f01e855825db4d2", "score": "0.64056146", "text": "func (ps *PreemptionSelect) BoolX(ctx context.Context) bool {\n\tv, err := ps.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3235a5d57774fee7cee2124b58be0f3b", "score": "0.6400259", "text": "func (ts *TransportSelect) BoolX(ctx context.Context) bool {\n\tv, err := ts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "daa35ef157b52b767974372643037bbb", "score": "0.63819385", "text": "func (is *InstanceSelect) BoolX(ctx context.Context) bool {\n\tv, err := is.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9351c393264960bf1c4c4e34dfd0a2a4", "score": "0.6369798", "text": "func (f FIXBoolean) Bool() bool { return bool(f) }", "title": "" }, { "docid": "53249f6258c1596e3ccea0d8cc7ea8f1", "score": "0.63624454", "text": "func (ts *TreatmentSelect) BoolX(ctx context.Context) bool {\n\tv, err := ts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9670a87f5f25ea81044247a8327c40d4", "score": "0.63610595", "text": "func (dvls *DeletedVlanLogSelect) BoolX(ctx context.Context) bool {\n\tv, err := dvls.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a508ebe0f17fb8e27faf14ac4215edf6", "score": "0.6360047", "text": "func (vs *VariantSelect) BoolX(ctx context.Context) bool {\n\tv, err := vs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a508ebe0f17fb8e27faf14ac4215edf6", "score": "0.6360047", "text": "func (vs *VariantSelect) BoolX(ctx context.Context) bool {\n\tv, err := vs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "63af2cf4a1181e0501c559b7ccaa88cc", "score": "0.63192743", "text": "func (bds *BankingDataSelect) BoolX(ctx context.Context) bool {\n\tv, err := bds.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "47935a3c063ed5791cfc7bb977d990c9", "score": "0.63169646", "text": "func (fetgb *FlowExecutionTemplateGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := fetgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3209b7dcce9de83f7a41f83a15896d3e", "score": "0.6295064", "text": "func (is *InsuranceSelect) BoolX(ctx context.Context) bool {\n\tv, err := is.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d3e6be141d8ff98366895e7bf9bf54bc", "score": "0.6287456", "text": "func (lms *LogMsgSelect) BoolX(ctx context.Context) bool {\n\tv, err := lms.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f7175e921e0b05ce251a7ef998cc629f", "score": "0.62798756", "text": "func (tws *TwoWordSelect) BoolX(ctx context.Context) bool {\n\tv, err := tws.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "c60bec119bc76128c2e3ace396c7f60e", "score": "0.6268532", "text": "func (utrs *UserTagRelationSelect) BoolX(ctx context.Context) bool {\n\tv, err := utrs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "64304c464b7ded616807d405d462320d", "score": "0.62635666", "text": "func (rs *RankingSelect) BoolX(ctx context.Context) bool {\n\tv, err := rs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "afb469e71db3f2a48a304496215b5c0a", "score": "0.62569165", "text": "func (wts *WidgetTypeSelect) BoolX(ctx context.Context) bool {\n\tv, err := wts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d044c02d554486b7471fb919d675ca0a", "score": "0.62547886", "text": "func (tr Row) ForceBool(nn int) (val bool) {\n\tval, _ = tr.BoolErr(nn)\n\treturn\n}", "title": "" }, { "docid": "7af48856f0be72a0945763d5194ec3fa", "score": "0.6239666", "text": "func (afs *AlarmFilterSelect) BoolX(ctx context.Context) bool {\n\tv, err := afs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "dc7a3a0a040b2120956cf4f1387db5f0", "score": "0.62333643", "text": "func (rgb *RestaurantGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := rgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "57614dad7dd968e9ae8ea765ba403e71", "score": "0.620885", "text": "func (tgb *TransportGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := tgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5da8ed154efc0e2613ce4cecbebba079", "score": "0.6202616", "text": "func (dvlgb *DeletedVlanLogGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := dvlgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b06f633dfca2ca400dd475b245644559", "score": "0.6200067", "text": "func (a *Asserter) Bool() bool {\n\tif *a.err != nil || a.x == nil {\n\t\treturn false\n\t}\n\tm, ok := a.x.(bool)\n\tif !ok {\n\t\t*a.err = errs.New(\"invalid type: bool != %T at %s\", a.x, a.path)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "05896fbe31089034fb953b8ffd48f798", "score": "0.61998725", "text": "func (otgb *OtherTestGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := otgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9a8bcb432b0430bbbc8a1e200bbd3de4", "score": "0.6193256", "text": "func (sogb *StatusOpinionGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := sogb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f25dd48cc806eaef9726aca2849506a1", "score": "0.61832386", "text": "func (kts *KqiTargetSelect) BoolX(ctx context.Context) bool {\n\tv, err := kts.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b857f9fe0e0d15fa97e9882c9efd140c", "score": "0.61767787", "text": "func (qis *QueueItemSelect) BoolX(ctx context.Context) bool {\n\tv, err := qis.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3057424abfcb69f7b3d51a3ae23b1486", "score": "0.61602306", "text": "func (nms *NodeMetadataSelect) BoolX(ctx context.Context) bool {\n\tv, err := nms.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "777f23227eb511d7cd286fc1e2fde551", "score": "0.6153021", "text": "func (w *Writer) Bool(x *bool) {\n\t_ = w.w.WriteByte(*(*byte)(unsafe.Pointer(x)))\n}", "title": "" }, { "docid": "7cec217adb6fdcb3711a1314027440fa", "score": "0.61520666", "text": "func (ttgb *TreatmentTypeGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := ttgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "7de4de60749ce52ec51c95b0332c1fdc", "score": "0.6146233", "text": "func (utrgb *UserTagRelationGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := utrgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "2a8979671b5a21de51685e9aa16cb634", "score": "0.6140217", "text": "func (sps *ServicePointSelect) BoolX(ctx context.Context) bool {\n\tv, err := sps.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b4b70c4cbcf56c2ecfb68221881a49d7", "score": "0.6137279", "text": "func (igb *InsuranceGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := igb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "22f194964a16057ce29c6dce8184d460", "score": "0.6131667", "text": "func (ds *DoctorinfoSelect) BoolX(ctx context.Context) bool {\n\tv, err := ds.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "98d974705ba61070cab016ff3c87350c", "score": "0.61037", "text": "func (ngb *NetworkGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := ngb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "506561c76bf8c6e835a721a3a015f8b4", "score": "0.61005473", "text": "func (hgb *HistoryGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := hgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "2295273baf433240d66e19755af1b4b2", "score": "0.6081222", "text": "func Bool(v bool) Value { return Value{typ: booleanType, b: v} }", "title": "" }, { "docid": "a752da18fea0ea64813f118466a3383f", "score": "0.6075451", "text": "func (ntgb *NetTopologyGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := ntgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "eaabb9e407de20d954b31f2943ca4dab", "score": "0.60708594", "text": "func (as *AuthorSelect) BoolX(ctx context.Context) bool {\n\tv, err := as.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b9937c89b009aef90b37b42023581ecc", "score": "0.6070768", "text": "func TestCheckBinaryNonConstExprXinterfaceXEqlBoolT(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := bool(true); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.XinterfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "1b547167c19de76c94a1c0ef679e2600", "score": "0.605237", "text": "func (tgb *TreatmentGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := tgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "63d2ad11347e6ba9ccd01bbbfd1dda23", "score": "0.6030543", "text": "func (afgb *AlarmFilterGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := afgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a17c8ed454b90d3985c72c9439f4febd", "score": "0.60292554", "text": "func (igb *InstanceGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := igb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "50854c6dbbfddd51c2564a5ee03430f3", "score": "0.6019468", "text": "func (pgb *PreemptionGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := pgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "377b0ef713704d37cf61633606036d7c", "score": "0.6018573", "text": "func MustBool(value bool, err error) bool {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "377b0ef713704d37cf61633606036d7c", "score": "0.6018573", "text": "func MustBool(value bool, err error) bool {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "d5485123040c1e73bcd3462106944a93", "score": "0.60179657", "text": "func TestCheckBinaryNonConstExprXinterfaceXGtrConstBool(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\t\n\texpectCheckError(t, `a > true`, env,\n\t\t`cannot convert true to type eval.XinterfaceX`,\n\t\t`invalid operation: a > true (mismatched types eval.XinterfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "bf008111d704219057fa52df8d05e58b", "score": "0.60158694", "text": "func (rgb *RankingGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := rgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ecb565945a198d5d9d94ebbdc2dc45bc", "score": "0.60071194", "text": "func TestCheckBinaryNonConstExprXinterfaceXEqlConstBool(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\t\n\texpectCheckError(t, `a == true`, env,\n\t\t`cannot convert true to type eval.XinterfaceX`,\n\t\t`invalid operation: a == true (mismatched types eval.XinterfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "f91e4b35cad215337dac596360292151", "score": "0.6003702", "text": "func (jps *JobPositionSelect) BoolX(ctx context.Context) bool {\n\tv, err := jps.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1d7fdd00b370e702c5b77ca3b27facf2", "score": "0.5998718", "text": "func (wtgb *WidgetTypeGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := wtgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "067f05d57b2e4795dd33b761a48440d0", "score": "0.5988044", "text": "func TestCheckBinaryNonConstExprBoolTEqlXinterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := bool(true); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := XinterfaceX(1); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types bool and eval.XinterfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "ebc5426908cd1488e84291364cd89f5e", "score": "0.59870815", "text": "func (gsos *GoodsSpecsOptionSelect) BoolX(ctx context.Context) bool {\n\tv, err := gsos.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "90e6878dcdfe970a135164756e069694", "score": "0.5986264", "text": "func (bdgb *BankingDataGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := bdgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d3c2438d50370d2efeefaf7130c1f0ee", "score": "0.597035", "text": "func TestCheckBinaryNonConstExprXinterfaceXGtrBoolT(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := bool(true); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types eval.XinterfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "e3158801a7814038576ef59d05d12416", "score": "0.5960957", "text": "func (vgb *VariantGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := vgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e3158801a7814038576ef59d05d12416", "score": "0.5960957", "text": "func (vgb *VariantGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := vgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1feae127cfe376be29aa0b4d83ad92ec", "score": "0.5956697", "text": "func (dgb *DoctorinfoGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := dgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "26553b407bf0bb11dcd782ac596cb8d6", "score": "0.5949029", "text": "func (spgb *ServicePointGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := spgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ea8fc8c1a10808ff5a3cf7e00607c92b", "score": "0.5946127", "text": "func (ogb *OptGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := ogb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e741096188ec30248f1038eba29e4ead", "score": "0.59442514", "text": "func MustBool(v interface{}) bool {\n\n\tx, err := Bool(v)\n\tif nil != err {\n\t\tpanic(err)\n\t}\n\n\treturn x\n}", "title": "" }, { "docid": "b1e4f7ce4a98a01bbbcfccd2e2b22199", "score": "0.5942422", "text": "func TestCheckBinaryNonConstExprBoolTShlConstBool(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := bool(true); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\t\n\texpectCheckError(t, `a << true`, env,\n\t\t`invalid operation: a << true (shift count type bool, must be unsigned integer)`,\n\t)\n\n}", "title": "" }, { "docid": "58a2872045b5d7a186ae4a9255d1ba4e", "score": "0.5938325", "text": "func (jpgb *JobPositionGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := jpgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5fff47c30b651d4572966affba0d8abb", "score": "0.5935915", "text": "func TestCheckBinaryNonConstExprBoolTGtrXinterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := bool(true); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := XinterfaceX(1); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types bool and eval.XinterfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "8e424df025b39d042cadd90cd8cd7c46", "score": "0.59236383", "text": "func Bool(b *bool) bool {\n\tif b == nil {\n\t\treturn false\n\t}\n\treturn *(*bool)(unsafe.Pointer(b))\n}", "title": "" }, { "docid": "c4177f7ae696a8215976b921c55f25a1", "score": "0.5918114", "text": "func Bool(v *bool) bool {\n\treturn BoolWithDefault(v, false)\n}", "title": "" }, { "docid": "727c1ae45300e86be55e0e9eff1b1c5b", "score": "0.59128493", "text": "func (ktgb *KqiTargetGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := ktgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "da15121d523ff6e0b602f00b4820d1bd", "score": "0.59017986", "text": "func (i Ei) Bool() (bool, error) {\n\tr, e := i.Uint64()\n\treturn r != 0, e\n}", "title": "" }, { "docid": "5ef07ad3127044e986b6a1e5312753e7", "score": "0.58941877", "text": "func TestCheckBinaryNonConstExprInterfaceXEqlBoolT(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceX(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := bool(true); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.interfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "f0aad1f90fd3c2ec12181a271b8d1c8e", "score": "0.5891911", "text": "func (kcs *KqiCategorySelect) BoolX(ctx context.Context) bool {\n\tv, err := kcs.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "68570b739d33c1b0ddd148a312f3b983", "score": "0.58697176", "text": "func (ogb *OperationGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := ogb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a03e31de8f5c6dbf1ed76b9ea31d0d51", "score": "0.5864552", "text": "func (r *RandomUnsafe) Bool() bool {\n\tif r.boolcount == 0 {\n\t\tr.boolcache, r.boolcount = r.src.Int63(), 63\n\t}\n\n\tresult := r.boolcache&0x01 == 1\n\tr.boolcache >>= 1\n\tr.boolcount--\n\n\treturn result\n}", "title": "" }, { "docid": "b9fb872d4e1b46da4fa16f8742237e11", "score": "0.5862266", "text": "func (x XT) True(cond bool) {\n\tx.Truef(cond, \"Expected true\")\n}", "title": "" }, { "docid": "8fc49c876b30b48ac09c1b7c4f1b5064", "score": "0.58558005", "text": "func (tr Row) Bool(nn int) (val bool) {\n\tval, err := tr.BoolErr(nn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d045276580c61c5efdbf909995564c00", "score": "0.5852405", "text": "func TestCheckBinaryNonConstExprInterfaceXGtrConstBool(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceX(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\t\n\texpectCheckError(t, `a > true`, env,\n\t\t`invalid operation: a > true (mismatched types eval.interfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "1d5df9a620564d4414d288dfda1aabee", "score": "0.5842172", "text": "func (v Value) Bool() (bool, error) {\n\tif v.err != nil {\n\t\treturn false, v.err\n\t}\n\tif len(v.b) > 0 && v.b[0] != 0 {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "3bee5a2b90659699170fcba315e1c2dc", "score": "0.58402795", "text": "func OkBool(v bool) okBool {\n\treturn okBool{v}\n}", "title": "" }, { "docid": "702340e386931c981b86fd5046287163", "score": "0.5835635", "text": "func TestCheckBinaryTypedExprBoolTGtrBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `bool(true) > true`, env,\n\t\t`invalid operation: true > true (operator > not defined on bool)`,\n\t)\n\n}", "title": "" }, { "docid": "a3893538d9e40773ebdcdf05f1347623", "score": "0.58276", "text": "func TestCheckBinaryNonConstExprXinterfaceXAddConstBool(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\t\n\texpectCheckError(t, `a + true`, env,\n\t\t`cannot convert true to type eval.XinterfaceX`,\n\t\t`invalid operation: a + true (mismatched types eval.XinterfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "9d4b8b3db44009419a9e73fe00cc2501", "score": "0.5825494", "text": "func (lmgb *LogMsgGroupBy) BoolX(ctx context.Context) bool {\n\tv, err := lmgb.Bool(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "4306d4081518f79bfaea7c4842858402", "score": "0.5823591", "text": "func (v Value) Bool() bool {}", "title": "" }, { "docid": "ce579652d6077325b6c4465bc8224a72", "score": "0.58225137", "text": "func (o Bool) Truthy() bool { return bool(o) }", "title": "" }, { "docid": "84944d2c8649765147874eecd290f094", "score": "0.5822075", "text": "func TestCheckBinaryNonConstExprBoolTAndXinterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := bool(true); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := XinterfaceX(1); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a & b`, env,\n\t\t`invalid operation: a & b (mismatched types bool and eval.XinterfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "a1d8efad75016647a9872b3813d50fa5", "score": "0.58213687", "text": "func TestCheckBinaryTypedExprBoolTAddBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `bool(true) + true`, env,\n\t\t`invalid operation: true + true (operator + not defined on bool)`,\n\t)\n\n}", "title": "" }, { "docid": "47859a7cdfa480a569582683e4fc6e77", "score": "0.5819416", "text": "func (v *Value) Bool() bool {\n\tif v.t.kind != Bool {\n\t\tv.t.panicErrKind(\"Bool\", Bool)\n\t}\n\treturn v.rep.(bool)\n}", "title": "" }, { "docid": "27883ed348fe663c3d7a2b04d846f6af", "score": "0.58188844", "text": "func TestCheckBinaryNonConstExprXinterfaceXShlBoolT(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := bool(true); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a << b`, env,\n\t\t`invalid operation: a << b (shift count type bool, must be unsigned integer)`,\n\t)\n\n}", "title": "" }, { "docid": "23f13305882b45ba720190b8e53ce2a4", "score": "0.5808971", "text": "func TestCheckBinaryNonConstExprInterfaceXEqlConstBool(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceX(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\t\n\texpectCheckError(t, `a == true`, env,\n\t\t`invalid operation: a == true (mismatched types eval.interfaceX and bool)`,\n\t)\n\n}", "title": "" }, { "docid": "97104a72edf8dc34c5bd65334bd71733", "score": "0.5805767", "text": "func TestCheckBinaryNonConstExprBoolTEqlInterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := bool(true); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := interfaceX(nil); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types bool and eval.interfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "1587838951f0908271ca90247ab2c705", "score": "0.58057004", "text": "func NewBool(x bool) Bool {\n\treturn Bool{inner: x}\n}", "title": "" }, { "docid": "08b41c8b54546557ef041351d92c3f3e", "score": "0.58031696", "text": "func TestCheckBinaryTypedExprBoolTShlBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `bool(true) << true`, env,\n\t\t`invalid operation: true << true (shift count type bool, must be unsigned integer)`,\n\t)\n\n}", "title": "" } ]
31d0d25d455effc374abf896a7bb3547
ExtractProjects extracts projects from http.Response
[ { "docid": "57c7acbd0cf9190d47511e9f160f3f1a", "score": "0.83249545", "text": "func ExtractProjects(resp *http.Response) ([]Project, error) {\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar getProjectsResult GetProjectsResult\n\tif err := json.Unmarshal(data, &getProjectsResult); err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to unmarshal in ExtractProjects. data = \" + string(data))\n\t}\n\treturn getProjectsResult.Projects, nil\n}", "title": "" } ]
[ { "docid": "28a0ba98d16cdcbd6ed8388267114ef6", "score": "0.688929", "text": "func ExtractProjects(r pagination.Page) ([]Project, error) {\n\tvar s []Project\n\terr := ExtractProjectsInto(r, &s)\n\treturn s, err\n}", "title": "" }, { "docid": "ca1d4556dea101dba148bfd78bc44cad", "score": "0.6437198", "text": "func (c *Client) DecodeProjects(resp *http.Response) (*Projects, error) {\n\tvar decoded Projects\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "title": "" }, { "docid": "a74f7a3fc0b637c11f7b85b1f983fb77", "score": "0.62077737", "text": "func (r commonResult) Extract() (*Project, error) {\n\tvar s Project\n\terr := r.ExtractInto(&s)\n\treturn &s, err\n}", "title": "" }, { "docid": "932ae8ad25882c586442a699c13ae6af", "score": "0.61323667", "text": "func extractAPIProject(payload []byte) (apiProject mgw.ProjectAPI, err error) {\n\tzipReader, err := zip.NewReader(bytes.NewReader(payload), int64(len(payload)))\n\tnewLineByteArray := []byte(\"\\n\")\n\tvar upstreamCerts []byte\n\tvar interceptorCerts []byte\n\n\tif err != nil {\n\t\tloggers.LoggerAPI.Errorf(\"Error occured while unzipping the apictl project. Error: %v\", err.Error())\n\t\treturn apiProject, err\n\t}\n\t// TODO: (VirajSalaka) this won't support for distributed openAPI definition\n\tfor _, file := range zipReader.File {\n\t\tloggers.LoggerAPI.Debugf(\"File reading now: %v\", file.Name)\n\t\tif strings.Contains(file.Name, deploymentsYAMLFile) {\n\t\t\tloggers.LoggerAPI.Debug(\"Setting deployments of API\")\n\t\t\tunzippedFileBytes, err := readZipFile(file)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occurred while reading the deployment environments: %v %v\",\n\t\t\t\t\tfile.Name, err.Error())\n\t\t\t\treturn apiProject, err\n\t\t\t}\n\t\t\tdeployments, err := parseDeployments(unzippedFileBytes)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occurred while parsing the deployment environments: %v %v\",\n\t\t\t\t\tfile.Name, err.Error())\n\t\t\t}\n\t\t\tapiProject.Deployments = deployments\n\t\t}\n\t\tif strings.Contains(file.Name, openAPIDir+string(os.PathSeparator)+openAPIFilename) {\n\t\t\tloggers.LoggerAPI.Debugf(\"openAPI file : %v\", file.Name)\n\t\t\tunzippedFileBytes, err := readZipFile(file)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occured while reading the openapi file. %v\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswaggerJsn, conversionErr := utills.ToJSON(unzippedFileBytes)\n\t\t\tif conversionErr != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error converting api file to json: %v\", conversionErr.Error())\n\t\t\t\treturn apiProject, conversionErr\n\t\t\t}\n\t\t\tapiProject.OpenAPIJsn = swaggerJsn\n\t\t\tapiProject.APIType = mgw.HTTP\n\t\t} else if strings.Contains(file.Name, interceptorCertDir+string(os.PathSeparator)) &&\n\t\t\t(strings.HasSuffix(file.Name, crtExtension) || strings.HasSuffix(file.Name, pemExtension)) {\n\t\t\tunzippedFileBytes, err := readZipFile(file)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occured while reading the intercept endpoint certificate : %v, %v\",\n\t\t\t\t\tfile.Name, err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !tlsutils.IsPublicCertificate(unzippedFileBytes) {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Provided interceptor certificate: %v is not in the PEM file format. \", file.Name)\n\t\t\t\treturn apiProject, errors.New(\"interceptor certificate Validation Error\")\n\t\t\t}\n\t\t\tinterceptorCerts = append(interceptorCerts, unzippedFileBytes...)\n\t\t\tinterceptorCerts = append(interceptorCerts, newLineByteArray...)\n\t\t} else if strings.Contains(file.Name, endpointCertDir+string(os.PathSeparator)) &&\n\t\t\t(strings.HasSuffix(file.Name, crtExtension) || strings.HasSuffix(file.Name, pemExtension)) {\n\t\t\tunzippedFileBytes, err := readZipFile(file)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occured while reading the endpoint certificate : %v, %v\", file.Name, err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !tlsutils.IsPublicCertificate(unzippedFileBytes) {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Provided certificate: %v is not in the PEM file format. \", file.Name)\n\t\t\t\t// TODO: (VirajSalaka) Create standard error handling mechanism\n\t\t\t\treturn apiProject, errors.New(\"certificate Validation Error\")\n\t\t\t}\n\t\t\tupstreamCerts = append(upstreamCerts, unzippedFileBytes...)\n\t\t\tupstreamCerts = append(upstreamCerts, newLineByteArray...)\n\t\t} else if (strings.Contains(file.Name, apiYAMLFile) || strings.Contains(file.Name, apiJSONFile)) &&\n\t\t\t!strings.Contains(file.Name, openAPIDir) {\n\t\t\tloggers.LoggerAPI.Debugf(\"fileName : %v\", file.Name)\n\t\t\tunzippedFileBytes, err := readZipFile(file)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occured while reading the api definition file : %v %v\", file.Name, err.Error())\n\t\t\t\treturn apiProject, err\n\t\t\t}\n\t\t\tapiJsn, conversionErr := utills.ToJSON(unzippedFileBytes)\n\t\t\tif conversionErr != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occured converting api file to json: %v\", conversionErr.Error())\n\t\t\t\treturn apiProject, conversionErr\n\t\t\t}\n\t\t\tvar apiYaml mgw.APIYaml\n\t\t\terr = json.Unmarshal(apiJsn, &apiYaml)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"Error occured while parsing api.yaml or api.json %v\", err.Error())\n\t\t\t\treturn apiProject, err\n\t\t\t}\n\t\t\tapiYaml = mgw.PopulateEndpointsInfo(apiYaml)\n\n\t\t\terr = mgw.VerifyMandatoryFields(apiYaml)\n\t\t\tif err != nil {\n\t\t\t\tloggers.LoggerAPI.Errorf(\"%v\", err)\n\t\t\t\treturn apiProject, err\n\t\t\t}\n\n\t\t\tif apiYaml.Data.EndpointImplementationType == inlineEndpointType {\n\t\t\t\terrmsg := \"inline endpointImplementationType is not currently supported with Choreo Connect\"\n\t\t\t\tloggers.LoggerAPI.Warnf(errmsg)\n\t\t\t\terr = errors.New(errmsg)\n\t\t\t\treturn apiProject, err\n\t\t\t}\n\t\t\tapiProject.APIYaml = apiYaml\n\t\t\tmgw.ExtractAPIInformation(&apiProject, apiYaml)\n\t\t}\n\t}\n\tif apiProject.APIYaml.Type == \"\" {\n\t\t// If no api.yaml file is included in the zip folder, return with error.\n\t\terr := errors.New(\"could not find api.yaml or api.json\")\n\t\tloggers.LoggerAPI.Errorf(\"Error occured while reading the api type : %v\", err.Error())\n\t\treturn apiProject, err\n\t} else if apiProject.APIType != mgw.HTTP && apiProject.APIType != mgw.WS && apiProject.APIType != mgw.WEBHOOK {\n\t\terrMsg := \"API type is not currently supported with Choreo Connect\"\n\t\tloggers.LoggerAPI.Warnf(errMsg)\n\t\terr = errors.New(errMsg)\n\t\treturn apiProject, err\n\t}\n\tapiProject.UpstreamCerts = upstreamCerts\n\tapiProject.InterceptorCerts = interceptorCerts\n\treturn apiProject, nil\n}", "title": "" }, { "docid": "7ae43a64fba2463c1648209668a23773", "score": "0.61098546", "text": "func (a *API) FetchProjects() ([]*sdk.WorkProject, error) {\n\n\tsdk.LogInfo(a.logger, \"fetching initial projects\")\n\tmu := sync.Mutex{}\n\tendpoint := \"_apis/projects\"\n\tparams := url.Values{}\n\tparams.Set(\"stateFilter\", \"all\")\n\tvar out struct {\n\t\tValue []projectResponse `json:\"value\"`\n\t}\n\tif _, err := a.get(endpoint, params, &out); err != nil {\n\t\treturn nil, err\n\t}\n\tasync := sdk.NewAsync(a.concurrency)\n\tvar projects []*sdk.WorkProject\n\tfor _, proj := range out.Value {\n\t\tprojects = append(projects, &sdk.WorkProject{\n\t\t\tActive: proj.State == \"wellFormed\",\n\t\t\tCustomerID: a.customerID,\n\t\t\tDescription: &proj.Description,\n\t\t\tIntegrationInstanceID: &a.integrationID,\n\t\t\tIdentifier: proj.Name,\n\t\t\tName: proj.Name,\n\t\t\tRefID: proj.ID,\n\t\t\tRefType: a.refType,\n\t\t\tURL: proj.URL,\n\t\t})\n\t\tprojid := proj.ID\n\t\tasync.Do(func() error {\n\t\t\tparams := url.Values{}\n\t\t\tparams.Set(\"api-version\", \"5.1-preview.1\")\n\t\t\tvar out projectDetailResponse\n\t\t\tif _, err := a.get(\"_apis/projects/\"+projid, params, &out); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmu.Lock()\n\t\t\tprojectProcessMap[projid] = out.Capabilities.ProcessTemplate.TemplateTypeID\n\t\t\tmu.Unlock()\n\t\t\treturn nil\n\t\t})\n\t}\n\tif err := async.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn projects, nil\n}", "title": "" }, { "docid": "b5acf678bdb8c6dccdc380ec14c08fa3", "score": "0.59093094", "text": "func getProjects(w http.ResponseWriter, r *http.Request) {\n\tq := r.URL.Query()\n\tvar gid = 0\n\tvar err error\n\tif q.Get(\"gid\") != \"\" {\n\t\tgid, err = strconv.Atoi(q.Get(\"gid\"))\n\t\tif err != nil {\n\t\t\tlogger.Warn(\"convert group id to int fails\")\n\t\t}\n\t}\n\tvar jsonData []byte\n\tif gid > 0 {\n\t\tjsonData, err = json.Marshal(gitlab.GitLabClient.ListGitlabGroupProjects(gid))\n\t} else {\n\t\tjsonData, err = json.Marshal(gitlab.GitLabClient.ListGitlabProjects())\n\t}\n\tw.Write(jsonData)\n}", "title": "" }, { "docid": "cc6fd395d382ce0dee4d2ce4981be961", "score": "0.5816139", "text": "func (client Client) GetListOfProjects(collection string) (ProjectResponse, error) {\n\n\t//\tOur return value:\n\tretval := ProjectResponse{}\n\n\t//\tFormat the url\n\tfullurl, err := client.GetFormattedURL(collection, \"\", \"\", \"projects\", \"\")\n\tif err != nil {\n\t\tapperr := fmt.Errorf(\"Unable to format url: %s\", err)\n\t\treturn retval, apperr\n\t}\n\n\t//\tMake a GET reqeust to TFS\n\tresp, err := getAPIResponse(fullurl)\n\tif err != nil {\n\t\tapperr := fmt.Errorf(\"There was a problem calling TFS: %s\", err)\n\t\treturn retval, apperr\n\t}\n\tdefer resp.Body.Close()\n\n\t//\tIf the HTTP status code indicates an error, report it and get out\n\tif resp.StatusCode >= 400 {\n\t\tapperr := fmt.Errorf(\"There was an error getting information from TFS: %s\", resp.Status)\n\t\treturn retval, apperr\n\t}\n\n\t//\tDecode the return object\n\terr = json.NewDecoder(resp.Body).Decode(&retval)\n\tif err != nil {\n\t\tapperr := fmt.Errorf(\"There was a problem decoding the response from TFS: %s\", err)\n\t\treturn retval, apperr\n\t}\n\n\treturn retval, nil\n}", "title": "" }, { "docid": "10ac89fc78ace236526f473620ffb8a3", "score": "0.5810901", "text": "func (c *Client) DecodeProject(resp *http.Response) (*Project, error) {\n\tvar decoded Project\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "title": "" }, { "docid": "eb305d9b799531dd32a23ca24f94e50f", "score": "0.57370496", "text": "func (c *Client) Project(name string) (Response, error) {\n\treturn c.Get(fmt.Sprintf(\"%s/%s/json\", root, name))\n}", "title": "" }, { "docid": "4902b6420b43f433af5a7005d338c162", "score": "0.5576142", "text": "func (c *Client) DecodeProjectCollection(resp *http.Response) (ProjectCollection, error) {\n\tvar decoded ProjectCollection\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn decoded, err\n}", "title": "" }, { "docid": "dbfe4d1af1463aecd30e41b78bc13a02", "score": "0.5556006", "text": "func (s *ConfigurationTemplatesService) GetProjects(getProjectsQueryParams *GetProjectsQueryParams) (*[]GetProjectsResponse, *resty.Response, error) {\n\n\tpath := \"/dna/intent/api/v1/template-programmer/project\"\n\n\tqueryString, _ := query.Values(getProjectsQueryParams)\n\n\tresponse, err := RestyClient.R().\n\t\tSetQueryString(queryString.Encode()).\n\t\tSetResult(&[]GetProjectsResponse{}).\n\t\tSetError(&Error{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif response.IsError() {\n\t\treturn nil, response, fmt.Errorf(\"Error with operation getProjects\")\n\t}\n\n\tresult := response.Result().(*[]GetProjectsResponse)\n\treturn result, response, err\n}", "title": "" }, { "docid": "ed76855ad8a10789b5077fa8d8d86e7a", "score": "0.5531602", "text": "func (c *Client) ListProjects(page, pageSize int, name, public string) (int, []*HarborProject, error) {\n\tpath := ProjectsPath(page, pageSize, name, public)\n\n\tlog.Infof(\"%s %s\", http.MethodGet, path)\n\tresp, err := c.do(http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn 0, nil, ErrorUnknownInternal.Error(err)\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn 0, nil, ErrorUnknownInternal.Error(err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode/100 == 2 {\n\t\tret := make([]*HarborProject, 0)\n\t\terr := json.Unmarshal(body, &ret)\n\t\tif err != nil {\n\t\t\treturn 0, nil, ErrorUnknownInternal.Error(err)\n\t\t}\n\t\ttotal, err := getTotalFromResp(resp)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"get total from resp error: %v\", err)\n\t\t\treturn 0, nil, ErrorUnknownInternal.Error(err)\n\t\t}\n\t\treturn total, ret, nil\n\t}\n\tlog.Errorf(\"list harbor projects error: %s\", body)\n\n\treturn 0, nil, ErrorUnknownInternal.Error(fmt.Sprintf(\"%s\", body))\n}", "title": "" }, { "docid": "f1e9b383157acc4f2079d2977a8af3f1", "score": "0.54415625", "text": "func (b Service) GetProjects() Projects {\n\tendpoint := b.BaseURL + apiURL + projectEndpoint\n\treq := b.requestHandler.CreateRequest(\"GET\", endpoint)\n\treq.SetBasicAuth(b.Username, b.Password)\n\tbody := b.requestHandler.ProcessRequest(req)\n\tvar jsonData Projects\n\tjson.Unmarshal([]byte(body), &jsonData)\n\treturn jsonData\n}", "title": "" }, { "docid": "7bed816ddb94318780ac2ee66c339716", "score": "0.54014987", "text": "func GetAllProjects(dbConn *sql.DB) ([]types.Project, error) {\n\t//logit.Info.Println(\"admindb:GetAllProjects: called\")\n\tvar rows *sql.Rows\n\tvar err error\n\trows, err = dbConn.Query(\"select id, name, description, to_char(updatedt, 'MM-DD-YYYY HH24:MI:SS') from project order by name\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tprojects := make([]types.Project, 0)\n\tvar containers []types.Container\n\tvar clusters []types.Cluster\n\tvar proxies []types.Proxy\n\n\tfor rows.Next() {\n\t\tproject := types.Project{}\n\t\tif err = rows.Scan(\n\t\t\t&project.ID,\n\t\t\t&project.Name,\n\t\t\t&project.Desc,\n\t\t\t&project.UpdateDate); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tproject.Proxies = make(map[string]string)\n\n\t\tproxies, err = GetAllProxiesForProject(dbConn, project.ID)\n\t\tif err != nil {\n\t\t\tlogit.Info.Println(\"admindb:GetAllProjects:\" + err.Error())\n\t\t\treturn projects, err\n\t\t}\n\n\t\tfor i := range proxies {\n\t\t\tproject.Proxies[proxies[i].ContainerID] = proxies[i].ContainerName\n\t\t}\n\n\t\tproject.Containers = make(map[string]string)\n\n\t\tcontainers, err = GetAllContainersForProject(dbConn, project.ID)\n\t\tif err != nil {\n\t\t\tlogit.Info.Println(\"admindb:GetAllProjects:\" + err.Error())\n\t\t\treturn projects, err\n\t\t}\n\n\t\tfor i := range containers {\n\t\t\tproject.Containers[containers[i].ID] = containers[i].Name\n\t\t}\n\n\t\tproject.Clusters = make(map[string]string)\n\n\t\tclusters, err = GetAllClustersForProject(dbConn, project.ID)\n\t\tif err != nil {\n\t\t\tlogit.Info.Println(\"admindb:GetAllProjects:\" + err.Error())\n\t\t\treturn projects, err\n\t\t}\n\n\t\tfor i := range clusters {\n\t\t\tproject.Clusters[clusters[i].ID] = clusters[i].Name\n\t\t}\n\t\tprojects = append(projects, project)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn projects, nil\n}", "title": "" }, { "docid": "28ffeca9543628b230f07672e805dea8", "score": "0.5385617", "text": "func (client *ClientImpl) GetProjects(ctx context.Context, args GetProjectsArgs) (*GetProjectsResponseValue, error) {\n\tqueryParams := url.Values{}\n\tif args.StateFilter != nil {\n\t\tqueryParams.Add(\"stateFilter\", string(*args.StateFilter))\n\t}\n\tif args.Top != nil {\n\t\tqueryParams.Add(\"$top\", strconv.Itoa(*args.Top))\n\t}\n\tif args.Skip != nil {\n\t\tqueryParams.Add(\"$skip\", strconv.Itoa(*args.Skip))\n\t}\n\tif args.ContinuationToken != nil {\n\t\tqueryParams.Add(\"continuationToken\", *args.ContinuationToken)\n\t}\n\tif args.GetDefaultTeamImageUrl != nil {\n\t\tqueryParams.Add(\"getDefaultTeamImageUrl\", strconv.FormatBool(*args.GetDefaultTeamImageUrl))\n\t}\n\tlocationId, _ := uuid.Parse(\"603fe2ac-9723-48b9-88ad-09305aa6c6e1\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"5.1\", nil, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue GetProjectsResponseValue\n\tresponseValue.ContinuationToken = resp.Header.Get(azuredevops.HeaderKeyContinuationToken)\n\terr = client.Client.UnmarshalCollectionBody(resp, &responseValue.Value)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "ac9629fee55b07356672b32e10fa8716", "score": "0.533687", "text": "func (c *CLI) projects() error {\n\tprojects, err := c.client.Projects()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintf(c.outStream, \"%-38s %-36s %s\\n\", \"ID\", \"Name\", \"Kind\")\n\tfor _, v := range *projects {\n\t\tfmt.Fprintf(c.outStream, \"%-38s %-36s %s\\n\", v.ID, v.Name, v.Kind)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf0add29896e7226c2ac26ce648ee2aa", "score": "0.5335734", "text": "func Extract() []APIBuilding {\n\tbuildingURL := getURL()\n\n\t//make the client to be used to call the API\n\tclient := http.Client{\n\t\tTimeout: time.Second * 20,\n\t}\n\n\t//make the request object to get the data from the URL\n\trequest, err := http.NewRequest(http.MethodGet, buildingURL, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trequest.Header.Set(\"User-Agent\", \"setup-test\")\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//get the body (data) from teh response\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//unpack the data into a slice of structs\n\tvar buildings []APIBuilding\n\tif err := json.Unmarshal(body, &buildings); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(\"Successfully extracted the data from the API\")\n\n\treturn buildings\n}", "title": "" }, { "docid": "93a8a40217190acd8ca9f8b73f21bfc6", "score": "0.5325055", "text": "func fetchProject(tx *db.ClusterTx, projectName string, skipIfNoLimits bool) (*projectInfo, error) {\n\tctx := context.Background()\n\tdbProject, err := cluster.GetProject(ctx, tx.Tx(), projectName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Fetch project database object: %w\", err)\n\t}\n\n\tproject, err := dbProject.ToAPI(ctx, tx.Tx())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif skipIfNoLimits && !projectHasLimitsOrRestrictions(*project) {\n\t\treturn nil, nil\n\t}\n\n\tprofilesFilter := cluster.ProfileFilter{}\n\n\t// If the project has the profiles feature enabled, we use its own\n\t// profiles to expand the instances configs, otherwise we use the\n\t// profiles from the default project.\n\tdefaultProject := Default\n\tif projectName == Default || shared.IsTrue(project.Config[\"features.profiles\"]) {\n\t\tprofilesFilter.Project = &projectName\n\t} else {\n\t\tprofilesFilter.Project = &defaultProject\n\t}\n\n\tdbProfiles, err := cluster.GetProfiles(ctx, tx.Tx(), profilesFilter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Fetch profiles from database: %w\", err)\n\t}\n\n\tprofiles := make([]api.Profile, 0, len(dbProfiles))\n\tfor _, profile := range dbProfiles {\n\t\tapiProfile, err := profile.ToAPI(ctx, tx.Tx())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tprofiles = append(profiles, *apiProfile)\n\t}\n\n\tdbInstances, err := cluster.GetInstances(ctx, tx.Tx(), cluster.InstanceFilter{Project: &projectName})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Fetch project instances from database: %w\", err)\n\t}\n\n\tinstances := make([]api.Instance, 0, len(dbInstances))\n\tfor _, instance := range dbInstances {\n\t\tapiInstance, err := instance.ToAPI(ctx, tx.Tx())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Failed to get API data for instance %q in project %q: %w\", instance.Name, instance.Project, err)\n\t\t}\n\n\t\tinstances = append(instances, *apiInstance)\n\t}\n\n\tvolumes, err := tx.GetCustomVolumesInProject(ctx, projectName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Fetch project custom volumes from database: %w\", err)\n\t}\n\n\tinfo := &projectInfo{\n\t\tProject: *project,\n\t\tProfiles: profiles,\n\t\tInstances: instances,\n\t\tVolumes: volumes,\n\t}\n\n\treturn info, nil\n}", "title": "" }, { "docid": "b4c1f34dbc40fe08f3fc928b1a8a5735", "score": "0.52730024", "text": "func (c *Client) DescribeProjects(request *DescribeProjectsRequest) (response *DescribeProjectsResponse, err error) {\n if request == nil {\n request = NewDescribeProjectsRequest()\n }\n response = NewDescribeProjectsResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "c7700ee1ffda885a9ba3481057cbd8a3", "score": "0.5271685", "text": "func (o *ScheduleUserSchedulesResponseIncluded) GetProjectsOk() (*map[string]ViewProject, bool) {\n\tif o == nil || o.Projects == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Projects, true\n}", "title": "" }, { "docid": "52b973a888d30ea8fb2604798f76becd", "score": "0.52591014", "text": "func GetProjects() []models.Project {\n\tprojects := make([]models.Project, 0)\n\texecute(resty.MethodGet, \"rest/api/2/project\", nil, &projects, \"\", nil)\n\treturn projects\n}", "title": "" }, { "docid": "60073b63802868af4afe6c77603e89f3", "score": "0.5252504", "text": "func GetProjects() []models.Project {\n\tprojects := make([]models.Project, 0)\n\texecute(resty.MethodGet, \"rest/api/2/project\", nil, &projects)\n\treturn projects\n}", "title": "" }, { "docid": "c0fb712899aa5d212a904ff661b2bfcd", "score": "0.5223112", "text": "func (r Routing) listProjects() http.Handler {\n\treturn httptransport.NewServer(\n\t\tendpoint.Chain(\n\t\t\tmiddleware.TokenVerifier(r.tokenVerifiers),\n\t\t\tmiddleware.UserSaver(r.userProvider),\n\t\t)(project.ListEndpoint(r.userInfoGetter, r.projectProvider, r.privilegedProjectProvider, r.userProjectMapper, r.projectMemberProvider, r.userProvider, r.clusterProviderGetter, r.seedsGetter)),\n\t\tproject.DecodeList,\n\t\tencodeJSON,\n\t\tr.defaultServerOptions()...,\n\t)\n}", "title": "" }, { "docid": "11e4bfc4b2f8a0929134b78ebc5b6c36", "score": "0.5208404", "text": "func (o ToolResultsStepResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ToolResultsStepResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e6664e0e52011db10c952a21ed62739c", "score": "0.5201247", "text": "func CreatePaginateProjectResponse() (response *PaginateProjectResponse) {\n\tresponse = &PaginateProjectResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "d09c2a69bb26da2d77364a7c1f0a1527", "score": "0.5187281", "text": "func ProjectListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := context.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\n\tres, err := projects.Find(\"\", \"\", refStr)\n\n\tif err != nil && err.Error() != \"not found\" {\n\n\t\trespondErr(w, 500, \"Internal error while querying datastore\", \"INTERNAL_SERVER_ERROR\")\n\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\trespondErr(w, 500, \"Error exporting data\", \"INTERNAL_SERVER_ERROR\")\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "title": "" }, { "docid": "567cbb86ad7891e0ddb34a0f7eeb1464", "score": "0.51832616", "text": "func (d *Data) Extract(username string) (*Profile, error) {\n\tp := &Profile{}\n\n\treq, err := d.get(\"https://github.com/\" + username)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn p, fmt.Errorf(\"error code %d\", resp.StatusCode)\n\t}\n\n\tif err := goq.NewDecoder(resp.Body).Decode(p); err != nil {\n\t\treturn p, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "edf2a3b117b01fbff01290f91cafc02c", "score": "0.51785624", "text": "func (o TestExecutionResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TestExecutionResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0971087a34152c590debebbfa5d86a0b", "score": "0.5174465", "text": "func (g *Gitlab) Projects() ([]*Project, error) {\n\n\turl := g.ResourceUrl(projects_url, nil)\n\n\tvar projects []*Project\n\n\tcontents, err := g.buildAndExecRequest(\"GET\", url, nil)\n\tif err == nil {\n\t\terr = json.Unmarshal(contents, &projects)\n\t}\n\n\treturn projects, err\n}", "title": "" }, { "docid": "93aee4b591f2ed8f2d5362653142ccdc", "score": "0.5172346", "text": "func GetAllProjects(qp QueryProject) (*ProjectResponse, error) {\n\tctx, cancel, p := getCollection(projectCollection)\n\tdefer cancel()\n\tcount := make(chan int64, 1)\n\tvar filter interface{}\n\tif qp.Name == \"\" {\n\t\tfilter = bson.D{{}}\n\t} else {\n\t\tfilter = bson.D{{\"name\", qp.Name}}\n\t}\n\tgo func() {\n\t\tif c, err := p.CountDocuments(ctx, filter); err == nil {\n\t\t\tcount <- c\n\t\t} else {\n\t\t\tcount <- -1\n\t\t}\n\t}()\n\tif c, err := p.Find(ctx, filter, qp.GetOptions()); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tvar projects []Project\n\t\tif err = c.All(ctx, &projects); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttotal := <-count\n\t\tif total == -1 {\n\t\t\treturn nil, ProjectTotalError\n\t\t}\n\t\treturn &ProjectResponse{Projects: projects, Total: total}, nil\n\t}\n}", "title": "" }, { "docid": "e6ac42765479ade122ce306aef094704", "score": "0.5161433", "text": "func (c *Client) Projects() (*[]Project, error) {\n\tres, err := c.HTTP(\"GET\", \"/v1/projects\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ps []Project\n\tif err := decodeJSON(res, &ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ps, nil\n}", "title": "" }, { "docid": "a8f734c14059bde11eefd834d3e4477f", "score": "0.5156997", "text": "func (*Server) GetAllProjects(ctx context.Context, r *project.GetAllProjectsRequest) (*project.GetAllProjectsResponse, error) {\n\tprojects, count, err := models.GetAllProjects(r.GetPageNumber(), r.GetResultPerPage())\n\tif err != nil {\n\t\tplugins.LogError(\"API Service\", \"Error at: GetAllProjects\", err)\n\t\treturn &project.GetAllProjectsResponse{}, err\n\t}\n\tvar arrayOfProjects []*project.GetProjectResponse\n\tcopier.Copy(&arrayOfProjects, projects)\n\tfor i := 0; i < len(arrayOfProjects); i++ {\n\t\tcreatedAt, err := ptypes.TimestampProto(projects[i].CreatedAt)\n\t\tif err != nil {\n\t\t\tplugins.LogError(\"API Service\", \"Error at: GetAllProjects - time.Time to Proto TimeStamp conversion err\", err)\n\t\t\treturn &project.GetAllProjectsResponse{}, err\n\t\t}\n\t\tarrayOfProjects[i].CreatedAt = createdAt\n\t}\n\treturn &project.GetAllProjectsResponse{\n\t\tPageNumber: r.GetPageNumber(),\n\t\tResultPerPage: r.GetResultPerPage(),\n\t\tTotalCount: count,\n\t\tProjects: arrayOfProjects,\n\t}, nil\n}", "title": "" }, { "docid": "555035e8b66f9001c3223775b09b2343", "score": "0.5156879", "text": "func fetchOpenstackProjects(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan interface{}) error {\n\tc := meta.(*client.Client)\n\t_ = c\n\t// Fetch using the third party client and put the result in res\n\t// res <- c.ThirdPartyClient.getDat()\n\treturn nil\n}", "title": "" }, { "docid": "5de73cdb059ca0d36aaeef8a6dba2462", "score": "0.5146683", "text": "func (pc *projectsCmd) projectsAction(ctx *cli.Context) error {\n\tvar (\n\t\turl = \"%s/box/api/projects?apps=false\"\n\t)\n\tuserData, err := pc.store.ReadUserData()\n\tif err != nil {\n\t\treturn cli.NewExitError(\"could not read userData \"+err.Error(), 1)\n\t}\n\tfullURL := fmt.Sprintf(url, userData.Host)\n\tnewrequest, err := http.NewRequest(\"GET\", fullURL, nil)\n\tif err != nil {\n\t\treturn cli.NewExitError(\"could not create new request object \"+err.Error(), 1)\n\t}\n\t// create a cookie\n\tcookie := http.Cookie{Name: \"feedhenry\", Value: userData.Auth}\n\tnewrequest.AddCookie(&cookie)\n\t//do request\n\tres, err := pc.getter(newrequest)\n\tif err != nil {\n\t\treturn cli.NewExitError(\"could not create new request object \"+err.Error(), 1)\n\t}\n\n\tvar dataStructure []*commands.Project\n\treturn ui.NewPrinter(ctx.GlobalString(\"o\"), res.Body, pc.out, projectsTemplate, &dataStructure).Print()\n}", "title": "" }, { "docid": "476d15912d8494f48c4ed773d9f2bdf2", "score": "0.5130998", "text": "func (o ToolResultsExecutionResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ToolResultsExecutionResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e6f5c0d55c60444a148e530b9d90efa3", "score": "0.51238984", "text": "func listAwesomeGoProjects(ctx context.Context, sect string) (map[string]projectDesc, error) {\n\t// force max timeout of 15 seconds for retrieving and processing the data\n\tvar cancel func()\n\tctx, cancel = context.WithTimeout(ctx, 15*time.Second)\n\tdefer cancel()\n\n\tsel := fmt.Sprintf(`//p[text()[contains(., '%s')]]`, sect)\n\n\t// navigate\n\tif err := chromedp.Run(ctx, chromedp.Navigate(`https://github.com/avelino/awesome-go`)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not navigate to github: %v\", err)\n\t}\n\n\t// wait visible\n\tif err := chromedp.Run(ctx, chromedp.WaitVisible(sel)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get section: %v\", err)\n\t}\n\n\tsib := sel + `/following-sibling::ul/li`\n\n\t// get project link text\n\tvar projects []*cdp.Node\n\tif err := chromedp.Run(ctx, chromedp.Nodes(sib+`/child::a/text()`, &projects)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get projects: %v\", err)\n\t}\n\n\t// get links and description text\n\tvar linksAndDescriptions []*cdp.Node\n\tif err := chromedp.Run(ctx, chromedp.Nodes(sib+`/child::node()`, &linksAndDescriptions)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get links and descriptions: %v\", err)\n\t}\n\n\t// check length\n\tif 2*len(projects) != len(linksAndDescriptions) {\n\t\treturn nil, fmt.Errorf(\"projects and links and descriptions lengths do not match (2*%d != %d)\", len(projects), len(linksAndDescriptions))\n\t}\n\n\t// process data\n\tres := make(map[string]projectDesc)\n\tfor i := 0; i < len(projects); i++ {\n\t\tres[projects[i].NodeValue] = projectDesc{\n\t\t\tURL: linksAndDescriptions[2*i].AttributeValue(\"href\"),\n\t\t\tDescription: strings.TrimPrefix(strings.TrimSpace(linksAndDescriptions[2*i+1].NodeValue), \"- \"),\n\t\t}\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "49d3a7c428736e4bcbdab608900b156c", "score": "0.510703", "text": "func (o ToolResultsHistoryResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ToolResultsHistoryResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4dd9077668ccf53d08a105d8a4bf905c", "score": "0.5101211", "text": "func listAwesomeGoProjects(ctx context.Context, sect string) (map[string]projectDesc, error) {\n\t// force max timeout of 15 seconds for retrieving and processing the data\n\tvar cancel func()\n\tctx, cancel = context.WithTimeout(ctx, 15*time.Second)\n\tdefer cancel()\n\n\tsel := fmt.Sprintf(`case \"p[text\": p[text()[contains(., '%s')]]`, sect)\n\n\t// navigate\n\tif err := chromedp.Run(ctx, chromedp.Navigate(`https://github.com/avelino/awesome-go`)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not navigate to github: %v\", err)\n\t}\n\n\t// wait visible\n\tif err := chromedp.Run(ctx, chromedp.WaitVisible(sel)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get section: %v\", err)\n\t}\n\n\tsib := sel + `/following-sibling::ul/li`\n\n\t// get project link text\n\tvar projects []*cdp.Node\n\tif err := chromedp.Run(ctx, chromedp.Nodes(sib+`/child::a/text()`, &projects)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get projects: %v\", err)\n\t}\n\n\t// get links and description text\n\tvar linksAndDescriptions []*cdp.Node\n\tif err := chromedp.Run(ctx, chromedp.Nodes(sib+`/child::node()`, &linksAndDescriptions)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get links and descriptions: %v\", err)\n\t}\n\n\t// check length\n\tif 2*len(projects) != len(linksAndDescriptions) {\n\t\treturn nil, fmt.Errorf(\"projects and links and descriptions lengths do not match (2*%d != %d)\", len(projects), len(linksAndDescriptions))\n\t}\n\n\t// process data\n\tres := make(map[string]projectDesc)\n\tfor i := 0; i < len(projects); i++ {\n\t\tres[projects[i].NodeValue] = projectDesc{\n\t\t\tURL: linksAndDescriptions[2*i].AttributeValue(\"href\"),\n\t\t\tDescription: strings.TrimPrefix(strings.TrimSpace(linksAndDescriptions[2*i+1].NodeValue), \"- \"),\n\t\t}\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "8b32a553e87f43a75bd4d7ea44bbe517", "score": "0.50947684", "text": "func FindAllProjects(w http.ResponseWriter, r *http.Request) {\n\tprojects := dao.QueryProjects()\n\n\ttype TaskStr struct {\n\t\tID int `json:\"id\"`\n\t\tName string `json:\"name\"`\n\n\t\tProgress int `json:\"progress\"`\n\t\tProgressByWorklog bool `json:\"progressByWorklog\"`\n\t\tRelevance int `json:\"relevance\"`\n\t\tType string `json:\"type\"`\n\t\tTypeID string `json:\"typeId\"`\n\t\tDescription string `json:\"description\"`\n\t\tCode string `json:\"code\"`\n\t\tLevel int `json:\"level\"`\n\t\tStatus string `json:\"status\"`\n\t\tDepends string `json:\"depends\"`\n\t\tCanWrite bool `json:\"canWrite\"`\n\t\tStart int `json:\"start\"`\n\t\tDuration int `json:\"duration\"`\n\t\tEnd int `json:\"end\"`\n\t\tStartIsMilestone bool `json:\"startIsMilestone\"`\n\t\tEndIsMilestone bool `json:\"endIsMilestone\"`\n\t\tCollapsed bool `json:\"collapsed\"`\n\t\tAssigs []string `json:\"assigs\"`\n\t\tHasChild bool `json:\"hasChild\"`\n\t}\n\ttype ResourceStr struct {\n\t\tID int `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t}\n\ttype RoleStr struct {\n\t\tID int `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t}\n\ttype GanttData struct {\n\t\tTask []TaskStr `json:\"tasks\"`\n\t\tResource []ResourceStr `json:\"resources\"`\n\t\tRole []RoleStr `json:\"roles\"`\n\t\tCanWrite bool `json:\"canWrite\"`\n\t\tCanDelete bool `json:\"canDelete\"`\n\t\tCanWriteOnParent bool `json:\"canWriteOnParent\"`\n\t\tCanAdd bool `json:\"canAdd\"`\n\t}\n\n\tvar ganttData GanttData\n\treg, _ := regexp.Compile(\"PT_\")\n\n\tfor _, element := range projects {\n\t\tisPT := len(reg.FindStringIndex(element.ProjectName)) > 0\n\t\tif isPT {\n\t\t\tvar task TaskStr\n\t\t\ttask.ID = element.ProjectID\n\t\t\ttask.Name = element.ProjectName\n\t\t\ttask.Status = \"STATUS_ACTIVE\"\n\t\t\ttask.Start = 1396994400000\n\t\t\ttask.Duration = 20\n\t\t\ttask.End = 1399586399999\n\t\t\ttask.Assigs = append(task.Assigs, \"a\")\n\t\t\tganttData.Task = append(ganttData.Task, task)\n\t\t}\n\n\t}\n\tfor i := 0; i < 5; i++ {\n\t\tvar res ResourceStr\n\t\tres.ID = i\n\t\tres.Name = \"Papiyong\"\n\t\tganttData.Resource = append(ganttData.Resource, res)\n\t}\n\tfor i := 0; i < 5; i++ {\n\t\tvar role RoleStr\n\t\trole.ID = i\n\t\trole.Name = \"Dev\"\n\t\tganttData.Role = append(ganttData.Role, role)\n\t}\n\trespondWithJSON(w, http.StatusOK, ganttData)\n}", "title": "" }, { "docid": "1048f74f5ef763dffd046688416b123d", "score": "0.50924337", "text": "func (o *ProjectCustomFieldProjectsResponseIncluded) GetProjectsOk() (*map[string]ViewProject, bool) {\n\tif o == nil || o.Projects == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Projects, true\n}", "title": "" }, { "docid": "ce73fa51c7171bf496f9a3f502a58090", "score": "0.50918365", "text": "func (o *ScheduleUserSchedulesResponseIncluded) GetProjects() map[string]ViewProject {\n\tif o == nil || o.Projects == nil {\n\t\tvar ret map[string]ViewProject\n\t\treturn ret\n\t}\n\treturn *o.Projects\n}", "title": "" }, { "docid": "a8872b4acf541bb64f826d8aaca0fb11", "score": "0.5079703", "text": "func projHandler(w http.ResponseWriter, r *http.Request)\t{\n\trenderProjectPage(w);\n}", "title": "" }, { "docid": "d82b680f855b888dc435da5d058c5578", "score": "0.50737876", "text": "func (wa *WolframAlphaClient) ExtractResponse(xmlBody []byte) string {\n\ttype SubPod struct {\n\t\tTextInfo string `xml:\"plaintext\"`\n\t\tTitle string `xml:\"title,attr\"`\n\t}\n\ttype Pod struct {\n\t\tSubPods []SubPod `xml:\"subpod\"`\n\t\tTitle string `xml:\"title,attr\"`\n\t}\n\ttype QueryResult struct {\n\t\tPods []Pod `xml:\"pod\"`\n\t}\n\tvar result QueryResult\n\tif err := xml.Unmarshal(xmlBody, &result); err != nil {\n\t\treturn err.Error()\n\t}\n\tvar outBuf bytes.Buffer\n\tfor _, pod := range result.Pods {\n\t\tfor _, subPod := range pod.SubPods {\n\t\t\t// Further compact output by eliminating \" |\" from pods\n\t\t\toutBuf.WriteString(strings.TrimSpace(strings.Replace(subPod.TextInfo, \" |\", \"\", -1)))\n\t\t\toutBuf.WriteRune('.')\n\t\t}\n\t}\n\treturn outBuf.String()\n}", "title": "" }, { "docid": "c060189a6fa49068ecc92779e87f0da9", "score": "0.50720906", "text": "func (ScrapeProjects) Scrape(client *HarborClient, ch chan<- prometheus.Metric) error {\n\tvar (\n\t\tid int\n\t\terr error\n\t)\n\n\tid, err = projects(client, ch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = projectsLogs(id, client, ch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = projectsMetadata(id, client, ch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = projectsMembers(id, client, ch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = reposQuery(id, client, ch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = reposTop(client, ch)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "98491b258e9135358e48ddc691deb9cd", "score": "0.50707203", "text": "func getServiceProjects(hostProject string, service *compute.Service) (*compute.ProjectsGetXpnResources, error) {\n\tlog.Printf(\"Looking for service projects in %s\", hostProject)\n\n\tres, err := service.Projects.GetXpnResources(hostProject).Do()\n\tif err != nil {\n\t\tlog.Printf(\"Error getting service projects for %s: %v\", hostProject, err)\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "5f63e77d5ec8ec6a6bae8c38884e9b2f", "score": "0.50701547", "text": "func removeUnauthorizedProjects(cp []goship.Project, r *http.Request, u User) (fp []goship.Project) {\n\tif authentication.authorization != true {\n\t\treturn cp\n\t}\n\n\tfor _, p := range cp {\n\t\ta := isCollaborator(p.RepoOwner, p.RepoName, u.UserName)\n\t\tif a == true {\n\t\t\tfp = append(fp, p)\n\t\t}\n\t}\n\treturn fp\n}", "title": "" }, { "docid": "917a94c1898b9b13f32b1a5846e6ce58", "score": "0.506197", "text": "func ConvertProjects(projects []*github.Project) []Project {\n\titems := []Project{}\n\tfor _, project := range projects {\n\t\titems = append(items, Project{\n\t\t\tName: project.GetName(),\n\t\t\tURL: project.GetURL(),\n\t\t})\n\t}\n\treturn items\n}", "title": "" }, { "docid": "ef4be89ce31fca35fc6e788c24a6c472", "score": "0.5051514", "text": "func GetGitlabProjects(ctx context.Context, profile string, namespace string) ([]*GetGitlabProjectsItem, error) {\n\tgitlabClient := client.GetGitlabClient()\n\n\tif gitlabClient == nil {\n\t\treturn nil, errNoGitlabClient\n\t}\n\n\tprojects, _, err := gitlabClient.Projects.ListProjects(\n\t\t&gitlab.ListProjectsOptions{\n\t\t\tTopic: config.Get().ExternalServicesTopic,\n\t\t},\n\t\tgitlab.WithContext(ctx),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"can not list projects\")\n\t}\n\n\tvar (\n\t\texludeProjects []string\n\t\tincludeProjects []string\n\t\tprojectProfile *config.ProjectProfile\n\t)\n\n\tif len(profile) > 0 { //nolint:gocritic\n\t\tprojectProfile = config.GetProjectProfileByName(profile)\n\t} else if len(namespace) > 0 {\n\t\tprojectProfile = config.GetProjectProfileByNamespace(namespace)\n\t} else {\n\t\treturn nil, errors.Wrap(err, \"need profile or namespace\")\n\t}\n\n\tif projectProfile == nil {\n\t\treturn nil, errors.Errorf(\"unknown project profile for %s %s\", profile, namespace)\n\t}\n\n\tif projectProfile != nil {\n\t\tif projectProfile.Exclude == \"*\" {\n\t\t\tfor _, project := range projects {\n\t\t\t\tif !projectProfile.IsProjectRequired(project.ID) {\n\t\t\t\t\texludeProjects = append(exludeProjects, strconv.Itoa(project.ID))\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\texludeProjects = projectProfile.GetExclude()\n\t\t}\n\t}\n\n\tincludeProjects = projectProfile.GetInclude()\n\n\tresult := make([]*GetGitlabProjectsItem, 0)\n\n\tfor _, project := range projects {\n\t\titem := GetGitlabProjectsItem{\n\t\t\tProjectID: project.ID,\n\t\t\tName: project.NameWithNamespace,\n\t\t\tDescription: project.Description,\n\t\t\tDefaultBranch: project.DefaultBranch,\n\t\t\tWebURL: project.WebURL,\n\t\t\tTagsList: formatProjectTags(project.TagList),\n\t\t\tRequired: projectProfile.IsProjectRequired(project.ID),\n\t\t\tSelectedBranch: projectProfile.GetProjectSelectedBranch(project.ID),\n\t\t}\n\n\t\texclude := utils.StringInSlice(strconv.Itoa(item.ProjectID), exludeProjects)\n\n\t\t// if project in includes it must be always shown\n\t\tif utils.StringInSlice(strconv.Itoa(item.ProjectID), includeProjects) {\n\t\t\texclude = false\n\t\t}\n\n\t\tif !exclude {\n\t\t\tresult = append(result, &item)\n\t\t}\n\t}\n\n\tsort.SliceStable(result, func(i, j int) bool {\n\t\treturn result[i].Name < result[j].Name\n\t})\n\n\treturn result, nil\n}", "title": "" }, { "docid": "cdba509a81d240382b3a3578962fc08b", "score": "0.5033189", "text": "func (o ModelReferenceResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ModelReferenceResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9cce7b869839473773208ac9ca94f7ce", "score": "0.50119764", "text": "func (a *ProductsApiService) ProjectsHead(ctx context.Context, projectName string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Head\")\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 + \"/projects\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"project_name\", parameterToString(projectName, \"\"))\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\", \"text/plain\"}\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\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "84a126dc976bb71c2c07910a8b735bf6", "score": "0.500718", "text": "func retrieveCommits(r *http.Request, project goship.Project, deployUser string) (goship.Project, error) {\n\t// define a wait group to wait for all goroutines to finish\n\tvar wg sync.WaitGroup\n\tgithubToken := os.Getenv(gitHubAPITokenEnvVar)\n\tts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: githubToken})\n\tclient := github.NewClient(oauth2.NewClient(oauth2.NoContext, ts))\n\tfor i, environment := range project.Environments {\n\t\tfor j, host := range environment.Hosts {\n\t\t\t// start a goroutine for SSHing on to the machine\n\t\t\twg.Add(1)\n\t\t\tgo getCommit(&wg, project, environment, host, deployUser, i, j)\n\t\t}\n\t\twg.Add(1)\n\t\tgo getLatestGitHubCommit(&wg, project, environment, client, project.RepoOwner, project.RepoName, i)\n\t}\n\t// wait for goroutines to finish\n\twg.Wait()\n\tfor i, e := range project.Environments {\n\n\t\tproject.Environments[i] = e\n\t\tfor j, host := range e.Hosts {\n\t\t\thost.GitHubCommitURL = host.LatestGitHubCommitURL(project)\n\t\t\thost.GitHubDiffURL = host.LatestGitHubDiffURL(project, e)\n\t\t\thost.ShortCommitHash = host.LatestShortCommitHash()\n\t\t\tproject.Environments[i].Hosts[j] = host\n\t\t}\n\t}\n\tu, err := getUser(r)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to get user %s\", err)\n\t}\n\treturn filterProject(project, r, u), err\n}", "title": "" }, { "docid": "77ae29f57b97c833cc91968fad17e667", "score": "0.5004728", "text": "func (p *ProjectsService) List(opt *ProjectsOptParams) (*ResponseProjects, *string, error) {\n\n\tparams := url.Values{}\n\n\tif opt != nil {\n\t\tif opt.Page != 0 {\n\t\t\tparams.Add(\"p\", strconv.Itoa(opt.Page))\n\t\t}\n\t\tif opt.Size != 0 {\n\t\t\tparams.Add(\"ps\", strconv.Itoa(opt.Size))\n\t\t}\n\t\tif opt.Projects != nil && len(opt.Projects) > 0 {\n\t\t\tparams.Add(\"projects\", strings.Join(opt.Projects[:], \",\"))\n\t\t}\n\t}\n\n\treq, err := p.client.NewRequest(\"GET\", \"projects/search\", params.Encode())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresponse := &ResponseProjects{}\n\tresp, err := p.client.Do(req, &response)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn response, resp.BodyStrPtr, err\n}", "title": "" }, { "docid": "55704aa0947e9c0ea7327d14d77e2f03", "score": "0.4993794", "text": "func ChooseProj(writer http.ResponseWriter, req *http.Request) {\n\t// recover in case of bad read\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tjsonResponse, _ := json.Marshal(\"{}\")\n\t\t\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\twriter.Write(jsonResponse)\n\t\t}\n\t}()\n\n\tprojName, ok := req.URL.Query()[\"projName\"]\n\tif !ok {\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\twriter.Write([]byte(\"400 Bad Request\"))\n\t\tlog.Println(\"Request Body must be incorrect\")\n\t}\n\t// Grab the project details from the database\n\tresponseData := GetAllErrorInstances(projName[0], Database)\n\tjsonResponse, _ := json.Marshal(responseData)\n\tfmt.Println(string(jsonResponse))\n\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\twriter.Write(jsonResponse)\n}", "title": "" }, { "docid": "254ec5e2f934e0bd00fac2253cd94e19", "score": "0.49932742", "text": "func renderProjectPage(w http.ResponseWriter)\t{\n\trenderTemplate(w, \"head\", nil);\n\trenderTemplate(w, \"navbar\", nil);\n\trenderTemplate(w, \"proj_title\", nil);\n\trenderTemplate(w, \"proj_sidebar\", nil);\n\trenderTemplate(w, \"proj_content\", nil);\n}", "title": "" }, { "docid": "1a3b913fcd2ead038d398af656a9c93f", "score": "0.49889693", "text": "func (d TestDevfileData) GetProjects() []v1.Project {\n\tprojectName := [...]string{\"test-project\", \"anotherproject\"}\n\tclonePath := [...]string{\"test-project/\", \"anotherproject/\"}\n\tsourceLocation := [...]string{\"https://github.com/someproject/test-project.git\", \"https://github.com/another/project.git\"}\n\n\tproject1 := v1.Project{\n\t\tClonePath: clonePath[0],\n\t\tName: projectName[0],\n\t\tProjectSource: v1.ProjectSource{\n\t\t\tGit: &v1.GitProjectSource{\n\t\t\t\tGitLikeProjectSource: v1.GitLikeProjectSource{\n\t\t\t\t\tRemotes: map[string]string{\n\t\t\t\t\t\t\"origin\": sourceLocation[0],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tproject2 := v1.Project{\n\t\tClonePath: clonePath[1],\n\t\tName: projectName[1],\n\t\tProjectSource: v1.ProjectSource{\n\t\t\tGit: &v1.GitProjectSource{\n\t\t\t\tGitLikeProjectSource: v1.GitLikeProjectSource{\n\t\t\t\t\tRemotes: map[string]string{\n\t\t\t\t\t\t\"origin\": sourceLocation[1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn []v1.Project{project1, project2}\n\n}", "title": "" }, { "docid": "6a349ee2c8a14bde63a7cf4ba702711e", "score": "0.4987941", "text": "func (o DatasetReferenceResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatasetReferenceResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8a1d72d61a71dceeb727e27c19e87b62", "score": "0.49819943", "text": "func (o RowAccessPolicyReferenceResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RowAccessPolicyReferenceResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8fefb67e1a053adc78503e5dfbf72fe3", "score": "0.497436", "text": "func (p *ProjectsService) List() ([]Project, *http.Response, error) {\n\treq, err := p.client.NewRequest(\"GET\", \"projects\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tprojs := new([]Project)\n\n\tresp, err := p.client.Do(req, projs)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn *projs, resp, nil\n}", "title": "" }, { "docid": "5280c4d546ee593539d13b6c13b73e29", "score": "0.49700463", "text": "func (o JobReferenceResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v JobReferenceResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4727d6f20975a617074af784206a1437", "score": "0.49601394", "text": "func (svc *extractorSVC) Extract() (*domain.Pageinfo, error) {\n\t// call validate tovalidate the request\n\te := svc.Validate()\n\tif e != nil {\n\t\tlog.Println(\"request validation failed\")\n\t\treturn nil, e\n\n\t}\n\t// scrape the URL passed in the request object\n\tresp, e := svc.Scrape()\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tdefer resp.Body.Close()\n\tbody := resp.Body\n\tif e != nil {\n\t\treturn nil, nil\n\t}\n\t// create a new goquery document for easy parsing\n\tdoc, err := goquery.NewDocumentFromReader(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// create anew parserobject to call the different parse methods\n\t// ParsePage will internally call other required methods\n\tparser := NewParserSvc(doc)\n\tresult, err := parser.ParsePage(svc.request.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "69c93449080517c79675b61f11ff7535", "score": "0.4959621", "text": "func (o InstanceReferenceResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v InstanceReferenceResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f279ee5c69076d2cec5fa6016820ea50", "score": "0.49592474", "text": "func (bs *Basecamp) FetchProjects(reset bool) ([]Project, error) {\n\tif len(bs.Projects) > 0 && !reset {\n\t\tbs.logger.Info(\"returning cached projects...\")\n\t\treturn bs.Projects, nil\n\t}\n\tbs.logger.Info(\"Fetching Projects...\")\n\tbasecamppp, err := bs.client.FetchProjects()\n\tif err != nil {\n\t\tbs.logger.Error(err.Error())\n\t\treturn nil, err\n\t}\n\tbs.logger.Info(\"Fetching todos...\")\n\tfor i, p := range basecamppp {\n\t\tfmt.Printf(\"project #%d: %s\\n\", i, p.Name)\n\t\terr = bs.client.FetchTodos(&p)\n\t\tif err != nil {\n\t\t\tbs.logger.Error(err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\tnp := newProject(&p)\n\t\tbs.Projects = append(bs.Projects, *np)\n\t}\n\tbs.logger.Info(\"Fetching successfull\")\n\treturn bs.Projects, nil\n}", "title": "" }, { "docid": "4ce7b67bcc120fd06222c3746f365eea", "score": "0.49576083", "text": "func GetProjects(db *gorp.DbMap, developer int64, account int64) (p []*Project, err error) {\n\tif account == 0 {\n\t\t_, err = db.Select(&p, `SELECT * FROM \"project\" WHERE \"developer_id\" = ?`, developer)\n\t} else {\n\t\t_, err = db.Select(&p, `SELECT * FROM \"project\" WHERE \"developer_id\" = ? AND \"account_id\" = ?`,\n\t\t\tdeveloper, account)\n\t}\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"get projects failed\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "3e30ce8282781e9c87d47323f2894751", "score": "0.49558908", "text": "func ProjectListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlProject := urlVars[\"project\"]\n\n\t// Grab context references\n\trefStr := context.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\tresults, err := projects.Find(\"\", urlProject, refStr)\n\n\tif err != nil {\n\n\t\tif err.Error() == \"not found\" {\n\t\t\trespondErr(w, 404, \"Project does not exist\", \"NOT_FOUND\")\n\t\t\treturn\n\t\t}\n\t\trespondErr(w, 500, \"Internal error while querying datastore\", \"INTERNAL_SERVER_ERROR\")\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tres := results.One()\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\trespondErr(w, 500, \"Error exporting data\", \"INTERNAL\")\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "title": "" }, { "docid": "689dfe7b0b6e7ca9bb331230896c619d", "score": "0.4951541", "text": "func PushAPIProjects(payload []byte, environments []string) error {\n\t// Reading the root zip\n\tzipReader, err := zip.NewReader(bytes.NewReader(payload), int64(len(payload)))\n\tif err != nil {\n\t\tlogger.LoggerSync.Errorf(\"Error occured while unzipping the apictl project. Error: %v\", err.Error())\n\t\treturn err\n\t}\n\t// TODO: Currently the apis.zip file contains another zip files containing API projects.\n\t// But there would be a meta data file in future. Once that comes, this code segement should\n\t// handle that meta data file as well.\n\n\t// Read the .zip files within the root apis.zip\n\tfor _, file := range zipReader.File {\n\t\t// open the zip files\n\t\tif strings.HasSuffix(file.Name, zipExt) {\n\t\t\tlogger.LoggerSync.Debugf(\"Starting zip reading: %v\", file.Name)\n\t\t\t// Open thezip\n\t\t\tf, err := file.Open()\n\t\t\tif err != nil {\n\t\t\t\tlogger.LoggerSync.Errorf(\"Error zip reading: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Close the stream once the processing of f is done\n\t\t\tdefer f.Close()\n\t\t\t//Read the files inside each xxxx-api.zip\n\t\t\tr, err := ioutil.ReadAll(f)\n\t\t\t// Pass the byte slice for the XDS APIs to push it to the enforcer and router\n\t\t\terr = apiServer.ApplyAPIProject(r, environments)\n\t\t\tif err != nil {\n\t\t\t\tlogger.LoggerSync.Errorf(\"Error occurred while applying project %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\t// Error nil for successful execution\n\treturn nil\n}", "title": "" }, { "docid": "417a1f46ad8b0f50f17ee845b593fb80", "score": "0.4949895", "text": "func (o *LoginOptions) gatherProjectInfo() error {\n\tif err := o.assertGatheredAuthInfo(); err != nil {\n\t\treturn err\n\t}\n\n\toClient, err := client.New(o.Config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojects, err := oClient.Projects().List(labels.Everything(), fields.Everything())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojectsItems := projects.Items\n\n\tswitch len(projectsItems) {\n\tcase 0:\n\t\t// TODO most users will not be allowed to run the suggested commands below, so we should check it and/or\n\t\t// have a server endpoint that allows an admin to describe to users how to request projects\n\t\tfmt.Printf(`You don't have any projects. If you have access to create a new project, run\n\n $ openshift ex new-project <projectname> --admin=%q\n\nTo be added as an admin to an existing project, run\n\n $ openshift ex policy add-role-to-user admin %q -n <projectname>\n\n`, o.Username, o.Username)\n\n\tcase 1:\n\t\to.Project = projectsItems[0].Name\n\t\tfmt.Printf(\"Using project %q.\\n\", o.Project)\n\n\tdefault:\n\t\tprojects := kutil.StringSet{}\n\t\tfor _, project := range projectsItems {\n\t\t\tprojects.Insert(project.Name)\n\t\t}\n\n\t\tnamespace, err := o.ClientConfig.Namespace()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !projects.Has(namespace) {\n\t\t\tif def := \"default\"; namespace != def && projects.Has(def) {\n\t\t\t\tnamespace = def\n\t\t\t} else {\n\t\t\t\tnamespace = projects.List()[0]\n\t\t\t}\n\t\t}\n\n\t\tif current, err := oClient.Projects().Get(namespace); err == nil {\n\t\t\to.Project = current.Name\n\t\t\tfmt.Printf(\"Using project %q.\\n\", o.Project)\n\t\t} else if !kerrors.IsNotFound(err) && !clientcmd.IsForbidden(err) {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"\\nYou have access to the following projects and can switch between them with 'osc project <projectname>':\\n\\n\")\n\t\tfor _, p := range projects.List() {\n\t\t\tif o.Project == p {\n\t\t\t\tfmt.Printf(\" * %s (current)\\n\", p)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\" * %s\\n\", p)\n\t\t\t}\n\t\t}\n\t\tfmt.Println()\n\t}\n\n\to.gatheredProjectInfo = true\n\treturn nil\n}", "title": "" }, { "docid": "243acdae3e8d2e78f2b6edf48b820b3d", "score": "0.494881", "text": "func getKitProjects(s *goquery.Selection, k *Kit) {\n\tconst (\n\t\tCSS string = \".main-toycon:nth-child(1) > .toycon-tag\"\n\t)\n\tvar (\n\t\tok bool\n\t)\n\ts = s.Find(CSS)\n\tok = (s.Length() > 0)\n\tif !ok {\n\t\ts = s.Find(\".project-list:nth-child(1) > .project\")\n\t\tok = (s.Length() > 0)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t}\n\tk.Projects = newProjects(s)\n}", "title": "" }, { "docid": "30cec56f70fc3d5f7f278a26ab86b968", "score": "0.49405602", "text": "func retrieveCommits(gcl githublib.Client, ac acl.AccessControl, r *http.Request, project goship.Project, deployUser string) (goship.Project, error) {\n\t// define a wait group to wait for all goroutines to finish\n\tvar wg sync.WaitGroup\n\tfor i, environment := range project.Environments {\n\t\tfor j, host := range environment.Hosts {\n\t\t\t// start a goroutine for SSHing on to the machine\n\t\t\twg.Add(1)\n\t\t\tgo getCommit(&wg, project, environment, host, deployUser, i, j)\n\t\t}\n\t\twg.Add(1)\n\t\tgo getLatestGitHubCommit(&wg, project, environment, gcl, project.RepoOwner, project.RepoName, i)\n\t}\n\t// wait for goroutines to finish\n\twg.Wait()\n\tfor i, e := range project.Environments {\n\n\t\tproject.Environments[i] = e\n\t\tfor j, host := range e.Hosts {\n\t\t\thost.GitHubCommitURL = host.LatestGitHubCommitURL(project)\n\t\t\thost.GitHubDiffURL = host.LatestGitHubDiffURL(project, e)\n\t\t\thost.ShortCommitHash = host.LatestShortCommitHash()\n\t\t\tproject.Environments[i].Hosts[j] = host\n\t\t}\n\t}\n\tu, err := auth.CurrentUser(r)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to get user %s\", err)\n\t}\n\treturn filterProject(ac, project, r, u), err\n}", "title": "" }, { "docid": "23f5eb4c8e3864bf8338086e8324b358", "score": "0.49370793", "text": "func CreateSearchProjectsByRegionResponse() (response *SearchProjectsByRegionResponse) {\n\tresponse = &SearchProjectsByRegionResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "bbfae7e251dc144c418c406f629d2c63", "score": "0.4932562", "text": "func (a *ProductsApiService) ProjectsProjectIdGet(ctx context.Context, projectId int64) (Project, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Project\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/projects/{project_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"project_id\"+\"}\", fmt.Sprintf(\"%v\", projectId), -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\", \"text/plain\"}\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\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v Project\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "932cd51f0ddfd81ae22be3d65a579a3b", "score": "0.49240154", "text": "func (o *ListProjectsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\t// return empty array\n\t\tpayload = make([]*models.Project, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "397539102d6aa051c591edd67808e371", "score": "0.49042967", "text": "func (c *Client) GetProjects(isCompleted ...bool) ([]Project, error) {\n\turi := \"get_projects\"\n\tif len(isCompleted) > 0 {\n\t\turi = uri + \"&is_completed=\" + btoitos(isCompleted[0])\n\t}\n\n\treturnProjects := []Project{}\n\tvar err error\n\tif c.useBetaApi {\n\t\terr = c.sendRequestBeta(\"GET\", uri, nil, &returnProjects, \"projects\")\n\t} else {\n\t\terr = c.sendRequest(\"GET\", uri, nil, &returnProjects)\n\t}\n\treturn returnProjects, err\n}", "title": "" }, { "docid": "4aa1d6b2b60e0c1b907e1705ed82acae", "score": "0.48970526", "text": "func ProjectCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlProject := urlVars[\"project\"]\n\n\t// Grab context references\n\trefStr := context.Get(r, \"str\").(stores.Store)\n\trefUserUUID := context.Get(r, \"auth_user_uuid\").(string)\n\n\t// Read POST JSON body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\trespondErr(w, 400, \"Invalid Request body\", \"INVALID_ARGUMENT\")\n\t\treturn\n\t}\n\n\t// Parse pull options\n\tpostBody, err := projects.GetFromJSON(body)\n\tif err != nil {\n\t\trespondErr(w, 400, \"Invalid Project Arguments\", \"INVALID_ARGUMENT\")\n\t\tlog.Error(string(body[:]))\n\t\treturn\n\t}\n\n\tuuid := uuid.NewV4().String() // generate a new uuid to attach to the new project\n\tcreated := time.Now().UTC()\n\t// Get Result Object\n\tres, err := projects.CreateProject(uuid, urlProject, created, refUserUUID, postBody.Description, refStr)\n\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\trespondErr(w, 409, \"Project already exists\", \"ALREADY_EXISTS\")\n\t\t\treturn\n\t\t}\n\n\t\trespondErr(w, 500, err.Error(), \"INTERNAL_SERVER_ERROR\")\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\n\t\trespondErr(w, 500, \"Error exporting data to JSON\", \"INTERNAL_SERVER_ERROR\")\n\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "title": "" }, { "docid": "7ac0d7321bc2e22d9267ecce35ac44f6", "score": "0.4895017", "text": "func NewListProjectHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decoder,\n\tencoder func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\terrhandler func(context.Context, http.ResponseWriter, error),\n\tformatter func(err error) goahttp.Statuser,\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeListProjectRequest(mux, decoder)\n\t\tencodeResponse = EncodeListProjectResponse(encoder)\n\t\tencodeError = EncodeListProjectError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"list project\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b211e8e8b9a4c6e3dfcc8d8a636b4588", "score": "0.48919088", "text": "func (t tracing) GetProjects(user *userpb.User) []*proto.Project {\n\t_, span := trace.StartSpan(context.Background(), \"EosProjects.GetProjects\")\n\tdefer span.End()\n\n\tspan.Annotate([]trace.Attribute{}, \"Execute EosProjects.GetProjects handler\")\n\n\treturn t.next.GetProjects(user)\n}", "title": "" }, { "docid": "417a90bbef13cd85fd14fcde059df70c", "score": "0.4890106", "text": "func (scraper *CommentsScraper) extract(resp *http.Response) ([]*rpb.RedditComment, error) {\n\tdefer resp.Body.Close()\n\n\t// Read respose body\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"scraper.ReadResponseBody: %v\", err)\n\t}\n\n\t// Unmarshal response\n\tparsedResponse := pushshiftCommentResponse{}\n\terr = json.Unmarshal(body, &parsedResponse)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"scraper.Unmarshal: %v\", err)\n\t}\n\n\t// Convert response to protobuf\n\tcomments := scraper.convert(parsedResponse.Comments)\n\n\treturn comments, nil\n}", "title": "" }, { "docid": "b641b9da33f6954cf9b25e732da0177e", "score": "0.48851833", "text": "func (o *GetGerritProjectsByNameUsingGETReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetGerritProjectsByNameUsingGETOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewGetGerritProjectsByNameUsingGETUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewGetGerritProjectsByNameUsingGETForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetGerritProjectsByNameUsingGETNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetGerritProjectsByNameUsingGETInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "d7d684798747a8dc3373d5c15e01d621", "score": "0.48841587", "text": "func (c *Client) GetProjects() ([]Project, error) {\n\tresp, err := c.do(\"[\\\"projects\\\"]\", \"\", \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tprojects, err := ExtractProjects(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn projects, err\n}", "title": "" }, { "docid": "bb0738bb48718c6575a15bbc2a8435f3", "score": "0.48839542", "text": "func performListProjects(entry IncomingSocketCommand, user *User) {\n\tuser.WriteJSON(\"project_list\", Config.Projects)\n\tdumpExistingData(user)\n}", "title": "" }, { "docid": "39249531b1dc5257c8af1cd062a9c761", "score": "0.4875395", "text": "func NewProjectSampleProjectsResponseIncluded() *ProjectSampleProjectsResponseIncluded {\n\tthis := ProjectSampleProjectsResponseIncluded{}\n\treturn &this\n}", "title": "" }, { "docid": "232f600ee4889c5dbd84934acde71a9e", "score": "0.4871221", "text": "func GetProjects(c *fiber.Ctx) error {\n\tdb := database.DBConn\n\tvar projects []Projects\n\terr := db.Find(&projects).Error\n\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\treturn c.SendStatus(404)\n\t}\n\treturn c.JSON(projects)\n}", "title": "" }, { "docid": "4b9cae3854160c37d880a11929108a4f", "score": "0.48659614", "text": "func (o *InlineResponse20053) HasProjects() bool {\n\tif o != nil && o.Projects != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "144137950f7ad1401d828cc1194e097c", "score": "0.48646376", "text": "func (a *WorkspacesApiService) WorkspacesWorkspaceProjectsGetExecute(r ApiWorkspacesWorkspaceProjectsGetRequest) (PaginatedProjects, *_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 PaginatedProjects\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"WorkspacesApiService.WorkspacesWorkspaceProjectsGet\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/workspaces/{workspace}/projects\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"workspace\"+\"}\", _neturl.PathEscape(parameterToString(r.workspace, \"\")), -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 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[\"api_key\"]; 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[\"Authorization\"] = 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\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\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": "2f129eaeef521a09b9ee40e41e2b84f7", "score": "0.4858141", "text": "func ConvertBitbucketToProjectsJSON(repos []bitbucket.Repository, metadataFactory BitbucketMetadataFactory) Projects {\n\tresults := make(Projects)\n\tbbUser := os.Getenv(\"TABIA_BITBUCKET_USER\")\n\tbbToken := os.Getenv(\"TABIA_BITBUCKET_TOKEN\")\n\tbasicAuth := fmt.Sprintf(\"%s:%s\", bbUser, bbToken)\n\tfor _, repo := range repos {\n\t\tproject, found := results[repo.Project.Name]\n\t\tif !found {\n\t\t\tresults[repo.Project.Name] = &Project{}\n\t\t\tproject = results[repo.Project.Name]\n\t\t\tproject.Git = make([]string, 0)\n\t\t}\n\t\tupdateFromBitbucketProject(project, repo, basicAuth, metadataFactory)\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "3cddc47103e6d6add72d018e48777e66", "score": "0.48518452", "text": "func newProjectRequests(c *Client) *projectRequests {\n\treturn &projectRequests{\n\t\tr: c,\n\t}\n}", "title": "" }, { "docid": "c977d3f64d96501fff4304b19b6af001", "score": "0.4841619", "text": "func (o *InlineResponse20053) GetProjects() []InlineResponse20053Projects {\n\tif o == nil || o.Projects == nil {\n\t\tvar ret []InlineResponse20053Projects\n\t\treturn ret\n\t}\n\treturn *o.Projects\n}", "title": "" }, { "docid": "c06e3ba5fac9be0a6b51a280d3c30212", "score": "0.4834702", "text": "func (o RoutineReferenceResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RoutineReferenceResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ce06afa7f4ee88c65dbeb5e8c798e34f", "score": "0.483126", "text": "func (o GetProjectsResultOutput) Projects() GetProjectsProjectArrayOutput {\n\treturn o.ApplyT(func(v GetProjectsResult) []GetProjectsProject { return v.Projects }).(GetProjectsProjectArrayOutput)\n}", "title": "" }, { "docid": "ce06afa7f4ee88c65dbeb5e8c798e34f", "score": "0.483126", "text": "func (o GetProjectsResultOutput) Projects() GetProjectsProjectArrayOutput {\n\treturn o.ApplyT(func(v GetProjectsResult) []GetProjectsProject { return v.Projects }).(GetProjectsProjectArrayOutput)\n}", "title": "" }, { "docid": "85e259353365f5231425f3b6e0efacce", "score": "0.48126772", "text": "func (c *Client) Project(name string) (*Project, error) {\n\tres, err := c.HTTP(\"GET\", `/v1/projects/`+name, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar p Project\n\tif err := decodeJSON(res, &p); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &p, nil\n}", "title": "" }, { "docid": "0a41c8c19f9e84cc04b80a617bedd32c", "score": "0.48119792", "text": "func (o *InlineResponse20053) GetProjectsOk() (*[]InlineResponse20053Projects, bool) {\n\tif o == nil || o.Projects == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Projects, true\n}", "title": "" }, { "docid": "2542ce26bb45cecf9c78824d014be62b", "score": "0.48118615", "text": "func Extractor(link string, projectPath string) {\n\t// create and write files to our project directory\n\t// write as it downloads and not load the whole file into memory.\n\t// out, err := f.Create(document)\n\t// if err != nil {\n\t// \tfmt.Println(err)\n\t// }\n\t// defer out.Close()\n\t// Write the body to file\n\t// _, err = io.Copy(out, resp.Body)\n\t// fmt.Println(err)\n\tfmt.Println(\"Extracting --> \", link)\n\t// get the html body\n\tresp, err := http.Get(link)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Closure\n\tdefer resp.Body.Close()\n\t// file base\n\tbase := path.Base(link)\n\t// file extension\n\textension := filepath.Ext(base)\n\t// css extension\n\tif strings.Contains(extension, \".css\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".css\"\n\t\t// get the project name and path we use the path to\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"css/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\n\t}\n\t// js extension\n\tif strings.Contains(extension, \".js\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".js\"\n\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"js/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\t}\n\t// jpg extension\n\tif strings.Contains(extension, \".jpg\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".jpg\"\n\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"imgs/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\t}\n\t// png entension\n\tif strings.Contains(extension, \".png\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".png\"\n\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"imgs/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\t}\n\t// gif extension\n\tif strings.Contains(extension, \".gif\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".gif\"\n\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"imgs/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\t}\n\t// jpeg extension\n\tif strings.Contains(extension, \".jpeg\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".jpeg\"\n\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"imgs/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\t}\n\t// svg extension\n\tif strings.Contains(extension, \".svg\") {\n\t\tvar name = base[0 : len(base)-len(extension)]\n\t\tdocument := name + \".svg\"\n\n\t\tf, err := os.OpenFile(projectPath+\"/\"+\"imgs/\"+document, os.O_RDWR|os.O_CREATE, 0777)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer f.Close()\n\t\thtmlData, err := ioutil.ReadAll(resp.Body)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf.Write(htmlData)\n\t}\n}", "title": "" }, { "docid": "45d563856f3b69dbc36b5b4a2c96be53", "score": "0.48112732", "text": "func (c *ProjectsListCall) Do() (*ListProjectsResponse, error) {\n\tc.urlParams[\"page\"] = []string{strconv.Itoa(c.pageToken)}\n\turls := c.s.baseURL + \"/projects\" + \"?\" + url.Values(c.urlParams).Encode()\n\treq, err := http.NewRequest(http.MethodGet, urls, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := c.s.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := checkResponse(res); err != nil {\n\t\treturn nil, err\n\t}\n\tret := &ListProjectsResponse{\n\t\tServerResponse: ServerResponse{\n\t\t\tHeader: res.Header,\n\t\t\tStatusCode: res.StatusCode,\n\t\t\tBody: res.Body,\n\t\t},\n\t}\n\tret.Projects = nil\n\ttarget := &ret\n\tif err := json.NewDecoder(res.Body).Decode(&(*target).Projects); err != nil {\n\t\treturn nil, err\n\t}\n\tret.NextPage = c.pageToken + 1\n\treturn ret, nil\n}", "title": "" }, { "docid": "ff7381f0c1cb376508c64f2c4de6d364", "score": "0.48032704", "text": "func (c *Client) DecodeProjectAdministrators(resp *http.Response) (*ProjectAdministrators, error) {\n\tvar decoded ProjectAdministrators\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "title": "" }, { "docid": "1314e12f1c6f14889aa35948600668d0", "score": "0.480094", "text": "func PushAPIProjects(payload []byte, environments []string) error {\n\tvar deploymentList []*notifier.DeployedAPIRevision\n\t// Reading the root zip\n\tzipReader, err := zip.NewReader(bytes.NewReader(payload), int64(len(payload)))\n\tif err != nil {\n\t\tlogger.LoggerSync.Errorf(\"Error occurred while unzipping the apictl project. Error: %v\", err.Error())\n\t\treturn err\n\t}\n\n\t// Read deployments from deployment.json file\n\tdeploymentDescriptor, envProps, err := sync.ReadRootFiles(zipReader)\n\tif err != nil {\n\t\tlogger.LoggerSync.Error(\"Error occurred while reading root files \", err)\n\t\treturn err\n\t}\n\n\tnumberOfAPIDeployments := len(deploymentDescriptor.Data.Deployments)\n\n\t// apiFiles represents zipped API files fetched from API Manager\n\tapiFiles := make(map[string]*zip.File, numberOfAPIDeployments)\n\t// Read the .zip files within the root apis.zip and add apis to apiFiles array.\n\tfor _, file := range zipReader.File {\n\t\tif strings.HasSuffix(file.Name, zipExt) {\n\t\t\tapiFiles[file.Name] = file\n\t\t}\n\t}\n\n\tlogger.LoggerSync.Infof(\"Start Deploying %d API/s...\", numberOfAPIDeployments)\n\n\t// loop deployments in deployment descriptor file instead of files in the root zip\n\tfor _, deployment := range deploymentDescriptor.Data.Deployments {\n\t\tfile := apiFiles[deployment.APIFile]\n\t\tif file == nil {\n\t\t\terr := fmt.Errorf(\"API file \\\"%v\\\" defined in deployment descriptor not found\",\n\t\t\t\tdeployment.APIFile)\n\t\t\tlogger.LoggerSync.Errorf(\"API file not found: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tvhostToEnvsMap := make(map[string][]string)\n\t\tfor _, environment := range deployment.Environments {\n\t\t\tvhostToEnvsMap[environment.Vhost] = append(vhostToEnvsMap[environment.Vhost], environment.Name)\n\t\t}\n\n\t\tlogger.LoggerSync.Infof(\"Start deploying api from file (API_ID:REVISION_ID).zip : %v\", file.Name)\n\t\tf, err := file.Open()\n\t\tif err != nil {\n\t\t\tlogger.LoggerSync.Errorf(\"Error reading zip file (API_ID:REVISION_ID).zip : %v, Error : %v\", file.Name, err)\n\t\t\treturn err\n\t\t}\n\t\t//Read the files inside each xxxx-api.zip\n\t\tapiFileData, err := ioutil.ReadAll(f)\n\t\t_ = f.Close() // Close the file here (without defer)\n\t\t// Pass the byte slice for the XDS APIs to push it to the enforcer and router\n\t\t// Updating cache one API by one API, if one API failed to update cache continue with others.\n\t\tvar deployedRevisionList []*notifier.DeployedAPIRevision\n\t\tdeployedRevisionList, err = apiServer.ApplyAPIProjectFromAPIM(apiFileData, vhostToEnvsMap, envProps)\n\t\tif err != nil {\n\t\t\tlogger.LoggerSync.Errorf(\"Error occurred while applying project (API_ID:REVISION_ID).zip : %v, Error : %v\", file.Name, err)\n\t\t} else if deployedRevisionList != nil {\n\t\t\tdeploymentList = append(deploymentList, deployedRevisionList...)\n\t\t}\n\t}\n\tnotifier.SendRevisionUpdateAck(deploymentList)\n\tlogger.LoggerSync.Infof(\"Successfully deployed %d API/s\", len(deploymentList))\n\t// Error nil for successful execution\n\treturn nil\n}", "title": "" }, { "docid": "505fec34c8d855fb9db96c4b201b67c2", "score": "0.47997817", "text": "func listProjects(svc *devicefarm.DeviceFarm) {\n\n\tresp, err := svc.ListProjects(nil)\n\tfailOnErr(err, \"error listing projects\")\n\n\t//fmt.Println(awsutil.Prettify(resp))\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Created\", \"ARN\"})\n\ttable.SetAlignment(tablewriter.ALIGN_LEFT)\n\ttable.SetColWidth(50)\n\n\tfor _, m := range resp.Projects {\n\t\tline := []string{*m.Name, time.Time.String(*m.Created), *m.ARN}\n\t\ttable.Append(line)\n\t}\n\ttable.Render() // Send output\n}", "title": "" }, { "docid": "a0ef2e63407279a36df3c4c37d19cc8c", "score": "0.47917235", "text": "func Projects() ([]models.Project, error) {\n\tvar projects []models.Project\n\treturn projects, load(\"projects.json\", &projects)\n}", "title": "" }, { "docid": "589d596a56cbeaa8b25318c2e1ef4d5a", "score": "0.47840303", "text": "func Projects(s *Service) *ProjectsService {\n\treturn &ProjectsService{s: s}\n}", "title": "" }, { "docid": "0bd27fd879cc0c084923eb996526566a", "score": "0.4779414", "text": "func Projects(ctx context.Context) {\n\tclient := sentry.NewClient(\"\", 0, \"\")\n\tprojects, err := client.ProjectList(\"\")\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\treturn\n\t}\n\tresult, err := json.MarshalIndent(projects, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Println(string(result))\n}", "title": "" }, { "docid": "75eda52fb8117f5900442d23884d0fce", "score": "0.4772172", "text": "func (adh *AdminHandler) AllProjects(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == http.MethodPost {\n\n\t} else {\n\t\tadh.Temp.ExecuteTemplate(w, \"all_projects.layout\", nil)\n\t}\n}", "title": "" } ]
77fbe3383294cb275a71051eb6e1e97a
FromJsonString It is highly NOT recommended to use this function because it has no param check, nor strict type check
[ { "docid": "fdc79e5b9a638f0eef771e65a02c6539", "score": "0.0", "text": "func (r *DescribeTcssSummaryRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\t\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeTcssSummaryRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" } ]
[ { "docid": "0533115efd6200dc84bc2640ded3aa71", "score": "0.6440321", "text": "func StringToJson(s string) (json Json, ok bool, errtok string) {\n\tvar j Json;\n\tb := new(_JsonBuilder);\n\tb.ptr = &j;\n\tok, _, errtok = Parse(s, b);\n\tif !ok {\n\t\treturn nil, false, errtok\n\t}\n\treturn j, true, \"\";\n}", "title": "" }, { "docid": "10a9af3f6492f6f47fceeccd9e356c9e", "score": "0.63366306", "text": "func stringToJson(str *string) map[string]interface{} {\n\tvar ret map[string]interface{}\n\n\t// replace \"\\\" by \"/\" to avoid escaping issues\n\t//\tescapedStr := strings.Replace(*str, \"\\\\\", \"/\", -1)\n\n\tif err := json.Unmarshal([]byte(*str), &ret); err == nil {\n\t\treturn ret\n\t} else {\n\t\tlogp.Err(\"Invalid json format: %s\", *str)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "4960662b7c6236541bb8c90c0a027a75", "score": "0.6237233", "text": "func jsonStringToObject(s string, v interface{}) error {\n\tdata := []byte(s)\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "4960662b7c6236541bb8c90c0a027a75", "score": "0.6237233", "text": "func jsonStringToObject(s string, v interface{}) error {\n\tdata := []byte(s)\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "172ed96e1b9d342ef85aee121f6dae28", "score": "0.60918283", "text": "func (j *JSON) FromString(input string) error {\n\tr := strings.NewReader(input)\n\tdec := json.NewDecoder(r)\n\treturn dec.Decode(&j.Data)\n}", "title": "" }, { "docid": "6eb19d1d848558bbe35d36cecc9c7bb7", "score": "0.60558474", "text": "func (r *AddIgnoreVulResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "fb403a68113be21f19c5e18c48c6cf02", "score": "0.6042197", "text": "func (r *AddIgnoreVulRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"List\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"AddIgnoreVulRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "7c45c4b91b0768fbaa01966b5b96af89", "score": "0.602392", "text": "func (deserializerJSONImpl) ReadString(tObject interface{}, data string) error {\n\tif data == \"\" {\n\t\treturn exc.New(ErrJSONBlankString, nil)\n\t}\n\treturn Deserialize(tObject, strings.NewReader(data))\n}", "title": "" }, { "docid": "4b06c5a3dc599219ae684394a8781636", "score": "0.60064954", "text": "func (r *ImportKeyPairResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2fe18504a142a06d992fa91e74cf61a6", "score": "0.5977133", "text": "func (r *CreateNetDetectResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "0e8c7439d45f9253a62b6ff90da625da", "score": "0.59682906", "text": "func (r *CreateLoadBalancingResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a5ce1fc5ecf27497ba4eb5a6de0748ea", "score": "0.59581095", "text": "func (r *ModifyLoadBalancingRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ZoneId\")\n\tdelete(f, \"LoadBalancingId\")\n\tdelete(f, \"Type\")\n\tdelete(f, \"OriginId\")\n\tdelete(f, \"TTL\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyLoadBalancingRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "85e095712c9315710e2292e789999238", "score": "0.59365934", "text": "func (r *CreateLoadBalancingRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ZoneId\")\n\tdelete(f, \"Host\")\n\tdelete(f, \"Type\")\n\tdelete(f, \"OriginId\")\n\tdelete(f, \"TTL\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateLoadBalancingRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "37a06e8c8bf05fa144f066751408e623", "score": "0.5933193", "text": "func (r *CheckNetDetectStateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c686ae26aeed7b771eea38891c4e18f9", "score": "0.589794", "text": "func (r *ModifyLoadBalancingResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "af9b804e6965f6066a2e081653bffa3e", "score": "0.5885032", "text": "func (r *CreateKeyPairResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "85df2a121998898c014b0c18d8a32288", "score": "0.5876098", "text": "func (r *ModifyNetDetectResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "583ba166ea8c36d109f7ffb3871b709d", "score": "0.58614844", "text": "func (r *DeleteIgnoreVulResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "db6b963599fe2e3165f1aef875292072", "score": "0.58588743", "text": "func (r *CreateLocalGatewayResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5597cb5cf56bf4656deb291f67cc65df", "score": "0.58533", "text": "func StringJson(v interface{}, unq bool) (ret string) {\n\tret = simplejson.MustDumpString(v)\n\tif unq {\n\t\tret, _ = unquote(strings.TrimSpace(ret), '\"')\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "421c29a22c734db564d81fc053212919", "score": "0.5852385", "text": "func NewFrom(s string) JSON {\n\treturn New([]byte(s))\n}", "title": "" }, { "docid": "7243bb1ec40e26182a3eba8fb283870e", "score": "0.5848371", "text": "func (r *ModifyLocalGatewayResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "51ffcbd3dfcc824c7867c6e21542eb1a", "score": "0.5841601", "text": "func (r *DescribeLoadBalancingRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ZoneId\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Limit\")\n\tdelete(f, \"Host\")\n\tdelete(f, \"Fuzzy\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeLoadBalancingRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c192755e261df2ebe78b003e73eb260b", "score": "0.57845527", "text": "func (r *ModifyNetDetectRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"NetDetectId\")\n\tdelete(f, \"NetDetectName\")\n\tdelete(f, \"DetectDestinationIp\")\n\tdelete(f, \"NextHopType\")\n\tdelete(f, \"NextHopDestination\")\n\tdelete(f, \"NetDetectDescription\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyNetDetectRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "824d9971c41ea18cf6a8231038c22dd9", "score": "0.57836485", "text": "func (r *CreateVirusScanAgainResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "39c97c86e3cee72c2e07c5d29dd2894b", "score": "0.57805514", "text": "func (r *ModifyLoadBalancingStatusRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ZoneId\")\n\tdelete(f, \"LoadBalancingId\")\n\tdelete(f, \"Status\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyLoadBalancingStatusRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "0f637b463e9f0f95c9d8bd97f2bc1ce5", "score": "0.5778896", "text": "func (r *ExportVirusListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d4952c95869ccbb688f4481c45ea1af7", "score": "0.5775945", "text": "func (r *SendMsgResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "fc5000454ab0efd31b1ccb7b4ec6168c", "score": "0.5772374", "text": "func (r *DeleteIgnoreVulRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"List\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DeleteIgnoreVulRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "20198baae52666f4baa8216444aedf6e", "score": "0.57631415", "text": "func (r *GetFaceIdTokenIntlResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "fe347f536ed29f4282aaed6d64e23653", "score": "0.57575023", "text": "func (r *DeleteLoadBalancingResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5f5d163864b365fe06df2924818d3264", "score": "0.57501704", "text": "func (r *DescribeVulTopRankingRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"CategoryType\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeVulTopRankingRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "38cb97375f0fbe4c8b8d5f289339b50f", "score": "0.5740913", "text": "func (chain *BlockChain) DecodeFromJson(jsonString string) {\n\n\tvar block[] Block;\n\tblock = DecodeFromJsonArray(jsonString);\n\n\n\tfor i:= 0; i < len(block); i++{\n\t\tchain.Insert(block[i]);\n\t}\n}", "title": "" }, { "docid": "5916cc7e08493f87fe280ff342bd45cd", "score": "0.57281625", "text": "func (r *GenerateReflectSequenceResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5493f36d08a4225968e64858f8c4bd80", "score": "0.5727477", "text": "func (r *ModifyLoadBalancingStatusResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f85413878c808d747d0081fd413afb3d", "score": "0.57267463", "text": "func (r *CreateInstanceSnapshotResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a57cb292dd19a542d62bcb877327d079", "score": "0.5723281", "text": "func (r *CreateFlowLogResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "ed96cc81e5337a1f49304c44cfd60de6", "score": "0.5722386", "text": "func (r *DescribeLoadBalancingDetailRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ZoneId\")\n\tdelete(f, \"LoadBalancingId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeLoadBalancingDetailRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "74c31ae4e0f3695943cfa1e2679d576d", "score": "0.57200414", "text": "func (r *ModifyAssetResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c446ffd52491025b790a16b3c1190512", "score": "0.5713798", "text": "func (r *DeleteLocalGatewayResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "8476a9f7a79d06716bd7414a47ffc710", "score": "0.5699771", "text": "func (r *ModifyAssetRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"All\")\n\tdelete(f, \"Hosts\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyAssetRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "63a780c136945a27baa569c61a591a2b", "score": "0.56944895", "text": "func (r *DeleteLoadBalancingRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ZoneId\")\n\tdelete(f, \"LoadBalancingId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DeleteLoadBalancingRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c02bbac84e79c60b1827ab63789b7b84", "score": "0.5694429", "text": "func (r *ImportKeyPairRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"KeyName\")\n\tdelete(f, \"PublicKey\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ImportKeyPairRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "93eeb90662bd40590dee7832eda3651a", "score": "0.56938094", "text": "func (r *DescribeNetDetectStatesRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"NetDetectIds\")\n\tdelete(f, \"Filters\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Limit\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeNetDetectStatesRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "8e87ddfaf40141e4f93fd23fac72a53e", "score": "0.5693385", "text": "func (r *DescribeVulTendencyRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"StartTime\")\n\tdelete(f, \"EndTime\")\n\tdelete(f, \"SphereOfInfluence\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeVulTendencyRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "0e37d792502d9ef221fb6d73f1e7c908", "score": "0.56902707", "text": "func NewJSONStr(s string) RawJSON {\n\tif len(s) == 0 {\n\t\treturn NullJSON()\n\t}\n\treturn RawJSON{\n\t\tJSON: types.NewJSONStr(s),\n\t\tValid: true,\n\t}\n}", "title": "" }, { "docid": "ae3c2ba3a1cf8be56a2b46d1bfda217f", "score": "0.56901944", "text": "func (r *CreateHaVipResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "41cda3b0e53109595554e1981868931e", "score": "0.5689239", "text": "func (r *DeleteNetDetectResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "ad4698bb20928802e4211bc49c1ef3e5", "score": "0.5686052", "text": "func (r *DeleteNetDetectRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"NetDetectId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DeleteNetDetectRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "55a5f5b2878aade5eeeede751d134e9a", "score": "0.56788343", "text": "func (r *AddEscapeWhiteListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f7407083dbcd26e6158a32e95fa116b5", "score": "0.5669538", "text": "func (r *DescribeNetDetectsRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"NetDetectIds\")\n\tdelete(f, \"Filters\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Limit\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeNetDetectsRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c40cf7e5e17e3f6e78e81dfb4f679dce", "score": "0.56625664", "text": "func (r *CreatePurgeTaskResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "cbf186753460e1284d6c0f4a18839138", "score": "0.5657628", "text": "func (r *DescribeLoadBalancingResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f198596bcfb7ee78c34e5a626d402a7d", "score": "0.5657243", "text": "func (r *DescribeVulDetailRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"PocID\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeVulDetailRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "fc4d9ddabf46df69e4209543fb941af5", "score": "0.56561327", "text": "func (r *CreateStreamLiveInputResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "1a5b43a745f2f0348c977a64641e9682", "score": "0.565358", "text": "func (r *DescribeTimingL4DataResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d55c1409d7051ce714e92138751e24c4", "score": "0.5651636", "text": "func (r *GetFaceIdTokenIntlRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"CheckMode\")\n\tdelete(f, \"SecureLevel\")\n\tdelete(f, \"Image\")\n\tdelete(f, \"Extra\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GetFaceIdTokenIntlRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "1920b2bee2f9cd539b10fd0984de6919", "score": "0.5649976", "text": "func (r *AddCompliancePolicyItemToWhitelistResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f22f75331bf6edc9536ed50fd704e513", "score": "0.56471926", "text": "func (r *DescribeAssetDBServiceListRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Limit\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Filters\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeAssetDBServiceListRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b227b71d2840d9254e65e0b1a4cc6128", "score": "0.56390446", "text": "func (r *ApplyLivenessTokenResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "7d413a22a30a4307b39a6fddba1608c0", "score": "0.56331205", "text": "func (r *ExportVirusListRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Filters\")\n\tdelete(f, \"Order\")\n\tdelete(f, \"By\")\n\tdelete(f, \"ExportField\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ExportVirusListRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b6c57e649185374991103ee49bafd2e2", "score": "0.5631742", "text": "func (r *CreateVirusScanAgainRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"TaskId\")\n\tdelete(f, \"ContainerIds\")\n\tdelete(f, \"TimeoutAll\")\n\tdelete(f, \"Timeout\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateVirusScanAgainRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "cf3937b3cedec116bcb9b1c001096de0", "score": "0.56310844", "text": "func (r *CheckNetDetectStateRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"DetectDestinationIp\")\n\tdelete(f, \"NextHopType\")\n\tdelete(f, \"NextHopDestination\")\n\tdelete(f, \"NetDetectId\")\n\tdelete(f, \"VpcId\")\n\tdelete(f, \"SubnetId\")\n\tdelete(f, \"NetDetectName\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CheckNetDetectStateRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "0bad98ce48c98f6431aca0c61706f351", "score": "0.5630865", "text": "func (r *DeleteKeyPairsResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2d30955918582e465842d89dc10309cf", "score": "0.56262904", "text": "func (r *CreateVulScanTaskResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "eec76e0123aea27b8b9b776ec1e3afc6", "score": "0.5624214", "text": "func DecodeFromJson(jsonString string) Block{\n\tvar block Block;\n\t_ = json.Unmarshal([]byte(jsonString), &block);\n\treturn block;\n}", "title": "" }, { "docid": "a688503174bd6ce023159bce861c017a", "score": "0.5623095", "text": "func (r *TextModerationRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Content\")\n\tdelete(f, \"BizType\")\n\tdelete(f, \"DataId\")\n\tdelete(f, \"User\")\n\tdelete(f, \"Device\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"TextModerationRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2f8c32d3ac4a6319aa5a061b3e239e95", "score": "0.56223994", "text": "func (r *GetLivenessResultRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"SdkToken\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GetLivenessResultRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e6e3012b2897bef0dd9add6890bea6cc", "score": "0.5621547", "text": "func (r *DescribeVulTopRankingResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "34188cfed2bb39af5dcb25eb8afd4265", "score": "0.56185395", "text": "func (r *DescribeAssetDBServiceListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "bf20f462296822b8531968ee3c5906a6", "score": "0.56176376", "text": "func (r *OpenTcssTrialResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "de3816520018a594c2ce38241e22c1a2", "score": "0.5616661", "text": "func (r *DescribeLocalGatewayResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "6864ec406cd4de1c74daa82d117b7d12", "score": "0.56157947", "text": "func ConvertToJsonStr(in interface{}) (string, error) {\n\tjsonByte, err := jsoniter.Marshal(in)\n\tif err != nil {\n\t\tlog.Warn(fmt.Sprintf(\"Marshal with error: %+v\\n\", err))\n\t\treturn \"\", nil\n\t}\n\treturn string(jsonByte), nil\n}", "title": "" }, { "docid": "97f1769d6fbf59ffad49ebaa6324ecd9", "score": "0.5614098", "text": "func (r *AdjustPublicAddressResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a49177a699c4378ca22979b33d96b715", "score": "0.5613009", "text": "func (r *CreateEnvironmentResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "9d130745209d0d2aca17e12031140ca0", "score": "0.56101215", "text": "func (r *DescribeValueAddedSrvInfoRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\t\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeValueAddedSrvInfoRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "6d910feed326e2a0c1f856b1c5eced82", "score": "0.5607284", "text": "func (r *DescribeComplianceWhitelistItemListRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Limit\")\n\tdelete(f, \"AssetTypeSet\")\n\tdelete(f, \"Filters\")\n\tdelete(f, \"By\")\n\tdelete(f, \"Order\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeComplianceWhitelistItemListRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "816a952edd3a2600b71740c1ca97e14d", "score": "0.56066144", "text": "func (r *DescribeEscapeSafeStateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f4f060294bc409b3cf1972141f4e3945", "score": "0.5604768", "text": "func (r *SendRocketMQMessageResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "66a51b7d3c012046f03391779d029718", "score": "0.5603733", "text": "func (r *CreateNetDetectRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"VpcId\")\n\tdelete(f, \"SubnetId\")\n\tdelete(f, \"NetDetectName\")\n\tdelete(f, \"DetectDestinationIp\")\n\tdelete(f, \"NextHopType\")\n\tdelete(f, \"NextHopDestination\")\n\tdelete(f, \"NetDetectDescription\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateNetDetectRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "212922dbb49c1e199c17e6b5446c7290", "score": "0.56026906", "text": "func (r *ModifyStreamLiveWatermarkResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b50497bb21bc442a5ac7f818813e8de2", "score": "0.56006134", "text": "func (r *DescribeNetDetectStatesResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "508d0eb9b7dbf6c8c980b3e2668c184b", "score": "0.5599288", "text": "func (r *CreateBlueprintResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "69c831bd6acfae40c19722d41df5064e", "score": "0.5598652", "text": "func (r *DescribeVirusTaskListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "62533e1728f3a158064a67b7d39c986e", "score": "0.5597936", "text": "func (r *CreateRefreshTaskResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d53a203b24b07bf578ce13607757372f", "score": "0.55954945", "text": "func (r *DescribeVulTendencyResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "efa572708d734689e7cfa1863d5ff630", "score": "0.5588097", "text": "func (r *CreateCheckComponentResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "61a7f4c5c1dcfe50f285be9cee09c946", "score": "0.558764", "text": "func (r *ModifyAddressInternetChargeTypeResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "3da1051dcda57f106a640a9ea0cfcba8", "score": "0.5583096", "text": "func (r *CreateStreamLiveWatermarkResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d37f30262fd8dd2a23acf49f750fc066", "score": "0.5583052", "text": "func (r *DescribeUsedIpAddressResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e3bfc8cb5f1cbb535a4e7fc2eae38739", "score": "0.55826735", "text": "func (r *ModifyEscapeWhiteListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "bc71a165a4b29ccc256a6804ef121a38", "score": "0.55779356", "text": "func (r *ModifyDnssecResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f51da27474069c51528bfa59bc8b7be1", "score": "0.5577901", "text": "func (r *DescribeKeyPairsResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2dbafac76cba42085f29dd6521c22734", "score": "0.55765873", "text": "func (r *ReceiveMessageResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "206a3e4a12f6763c596c09e5479ebe83", "score": "0.55763686", "text": "func (r *DescribeVirusListRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Limit\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Filters\")\n\tdelete(f, \"Order\")\n\tdelete(f, \"By\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeVirusListRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e764dd9072a3c5c44b3a021d10cc7880", "score": "0.557089", "text": "func (r *DescribeAssetWebServiceListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "83d8b1e1bb618a6a65903ae4015c28ae", "score": "0.55703944", "text": "func (r *ModifyLocalGatewayRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"LocalGatewayName\")\n\tdelete(f, \"CdcId\")\n\tdelete(f, \"LocalGatewayId\")\n\tdelete(f, \"VpcId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyLocalGatewayRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a930e521df90f34a9e6e57ffcfebb0bf", "score": "0.55684763", "text": "func (r *DescribeRiskListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "77e2d005af3b018c4b3549a2ae9d8c4e", "score": "0.5564344", "text": "func (r *DescribeVirusListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e722c502314a55ffa95d04e280d8f5b3", "score": "0.5563008", "text": "func (r *DescribeLocalGatewayRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Filters\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Limit\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeLocalGatewayRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "70b05daef5791811283161cbd70823ff", "score": "0.5560562", "text": "func (r *ModifyStreamLiveInputResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" } ]
4edafdd262fca07831b470937c04e1e5
UserSearch returns search results.
[ { "docid": "2b6518dd92175c86e5f1fa12dc093367", "score": "0.73060787", "text": "func (c *Config) UserSearch(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tquery := r.URL.Query().Get(\"query\")\n\tif query == \"\" {\n\t\tbjson.WriteJSON(w, map[string]string{\"message\": \"query cannot be empty\"}, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcontacts, err := c.UserStore.Search(ctx, query)\n\tif err != nil {\n\t\tbjson.HandleError(w, err)\n\t\treturn\n\t}\n\n\tbjson.WriteJSON(w, map[string]interface{}{\"users\": contacts}, http.StatusOK)\n}", "title": "" } ]
[ { "docid": "40d9b78e1d1d6f6d522f0abf64197ebb", "score": "0.76240504", "text": "func userSearch(h *HLTBClient, q *HLTBQuery) (*UserResultsPage, error) {\n\thandleUserDefaults(q)\n\tdoc, err := searchQuery(h, q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !hasResults(doc) {\n\t\treturn &UserResultsPage{}, nil\n\t}\n\tres, err := parseUserResponse(doc, q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres.hltbClient = h\n\treturn res, nil\n}", "title": "" }, { "docid": "951b4bd78b1c7d166c94293f0675a52b", "score": "0.74246264", "text": "func (a *App) SearchUser(w http.ResponseWriter, r *http.Request) {\n\thandler.SarchUser(a.DB, w, r)\n}", "title": "" }, { "docid": "58413ac71609ad0a0601ebbec0e364dd", "score": "0.7247633", "text": "func (repository Users) Search(userQuery string) ([]models.User, error) {\n\tuserQuery = fmt.Sprintf(\"%%%s%%\", userQuery) // %% serve para o escape de caracteres\n\n\tlines, error := repository.db.Query(\"SELECT id, name, nick, email, createdAt FROM users WHERE name LIKE ? OR nick LIKE ?\",\n\t\tuserQuery, userQuery)\n\n\tif error != nil {\n\t\treturn nil, error\n\t}\n\n\tdefer lines.Close()\n\n\tvar users []models.User\n\n\tfor lines.Next() {\n\t\tvar user models.User\n\n\t\tif error = lines.Scan(\n\t\t\t&user.ID,\n\t\t\t&user.Name,\n\t\t\t&user.Email,\n\t\t\t&user.Nick,\n\t\t\t&user.CreatedAt,\n\t\t); error != nil {\n\t\t\treturn nil, error\n\t\t}\n\n\t\tusers = append(users, user)\n\t}\n\n\treturn users, nil\n}", "title": "" }, { "docid": "659c7f5a791f02a0c08d8a3ba9b0acd8", "score": "0.7188109", "text": "func Search(c *gin.Context) {\n\tstatus := c.Query(\"status\")\n\n\tusers, err := services.UserServ.SearchUser(status)\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\n\tisPublic := c.GetHeader(\"X-Public\") == \"true\"\n\tc.JSON(http.StatusOK, users.Marshall(isPublic))\n}", "title": "" }, { "docid": "59ceb163e027cf6646a0f90acd18e62f", "score": "0.7180908", "text": "func (r *UserRead) search(q *msg.Request, mr *msg.Result) {\n\tvar (\n\t\tuserID, userName string\n\t\trows *sql.Rows\n\t\terr error\n\t)\n\n\tif rows, err = r.stmtSearch.Query(\n\t\tq.Search.User.UserName,\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(\n\t\t\t&userID,\n\t\t\t&userName,\n\t\t); 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.User = append(mr.User, proto.User{\n\t\t\tID: userID,\n\t\t\tUserName: userName,\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": "1970a4a36012a5e407a1a7485669dc44", "score": "0.710033", "text": "func SearchUser(c *gin.Context) {\n\tstatus := c.Query(\"status\")\n\n\tusersList, err := services.UsersService.SearchUser(status)\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, usersList.Marshall(c.GetHeader(\"X-Public\") == \"true\"))\n}", "title": "" }, { "docid": "22e6e2c5f373966dbe09d125d6b8c6ed", "score": "0.70128816", "text": "func Search(c *gin.Context) {\n\tstatus := c.Query(\"status\")\n\n\tusers, err := services.UserService.Search(status)\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, users.Marshall(c.GetHeader(\"X-Public\") == \"true\"))\n\n}", "title": "" }, { "docid": "4549645763e0f9441b01e2fa4ab470b5", "score": "0.69698787", "text": "func Search(c *gin.Context) {\n\tstatus := c.Query(\"status\")\n\tusers, err := service.UsersService.Search(status)\n\tif err != nil {\n\t\tc.JSON(err.Status(), err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, users.Marshal(c.GetHeader(\"X-Public\") == \"true\"))\n\n}", "title": "" }, { "docid": "928e11c20b8142f6df9e7758d412f8c4", "score": "0.6968223", "text": "func (us *UsersService) Search(searchQuery string, queryParams client.QueryParams) (*client.UserSearchResult, error) {\n\tctx := context.Background()\n\tif queryParams == nil || queryParams[\"query\"] == \"\" {\n\t\tqueryParams = make(client.QueryParams)\n\t\tqueryParams[\"query\"] = searchQuery\n\t\treturn us.client.SearchUsers(ctx, queryParams)\n\t}\n\tqueryParams[\"query\"] = searchQuery\n\treturn us.client.SearchUsers(ctx, queryParams)\n}", "title": "" }, { "docid": "bb593d830534de0365f96c69c2c93c9c", "score": "0.6966091", "text": "func (ig *Instagram) SearchUsers(query string) (*SearchUsers, error) {\n\n\tendpoint := fmt.Sprintf(\n\t\t\"/users/search/?ig_sig_key_version=%v&is_typeahead=true&query=%v&rank_token=%v\",\n\t\tSigKeyVersion, query, ig.RankToken,\n\t)\n\n\tvar object SearchUsers\n\terr := ig.Request(\"GET\", endpoint, &object)\n\n\treturn &object, err\n}", "title": "" }, { "docid": "efc3a7bb78aa2d58caf4261c51390acf", "score": "0.6949892", "text": "func (serv *AppServer) UserSearch(username string) int {\n\tret, _ := strconv.Atoi(serv.ServerRequest([]string{\"UserSearch\", username}))\n\treturn ret\n}", "title": "" }, { "docid": "b306927433aff989f0ad53ef7636584b", "score": "0.6944125", "text": "func (s *HttpServer) Search(w http.ResponseWriter, r *http.Request) {\n\tvar limit int64 = 201\n\tctx := r.Context()\n\tid := r.URL.Query().Get(\"id\")\n\n\tif id == \"\" {\n\t\tid = \"0\"\n\t}\n\tid64, err := strconv.ParseInt(id, 10, 64)\n\tif err != nil {\n\t\thttp.Error(w, exceptions.IntegerRequired.Error(), 500)\n\t\treturn\n\t}\n\n\tdirection := r.URL.Query().Get(\"direction\")\n\n\tquery := r.FormValue(\"query\")\n\tusers, err := s.UserService.FindByNameUC(ctx, query, id64, limit, direction)\n\tvar firstID, lastID int64\n\n\tdata := map[string]interface{}{\n\t\t\"Users\": users,\n\t\t\"Errors\": \"\",\n\t\t\"Query\": query,\n\t\t\"Next\" : false,\n\t}\n\tif err != nil {\n\t\tdata[\"Errors\"] = err.Error()\n\t\ts.RenderTemplate(ctx, w, \"index\", data)\n\t\treturn\n\t}\n\tcount := int64(len(users))\n\tif count > 0 {\n\t\tlastID = users[count-1].ID\n\t\tfirstID = users[0].ID\n\t\tdata[\"Users\"]=users[:count-1]\n\t}\n\tdata[\"FirstID\"] = firstID\n\tdata[\"LastID\"] = lastID\n\tif count > limit-1 {\n\t\tdata[\"Next\"] = true\n\t}\n\ts.RenderTemplate(ctx, w, \"index\", data)\n}", "title": "" }, { "docid": "00c205d9fb38cffb87b74c42709f4dc7", "score": "0.68961453", "text": "func SearchUserT(resp http.ResponseWriter, req *http.Request) {\n\tfirstName, ok := req.URL.Query()[\"firstname\"]\n\tif !ok {\n\t\tfmt.Println(\"Url Param 'firstname' is missing\")\n\t}\n\n\tsecondName, ok := req.URL.Query()[\"secondname\"]\n\tif !ok {\n\t\tfmt.Println(\"Url Param 'secondname' is missing\")\n\t}\n\t//fmt.Println(firstName, secondName)\n\n\tusers := model.TarantoolUserSearch(svc.Tarantool, firstName[0], secondName[0])\n\n\tjs, err := json.Marshal(users)\n\tif err != nil {\n\t\tfmt.Println(\"Users marshalling error\")\n\t}\n\n\tresp.Write(js)\n}", "title": "" }, { "docid": "dc17814fc61e9fbe9f1bb3d2194850fb", "score": "0.68657094", "text": "func (h *HLTBClient) SearchUsers(query string) (*UserResultsPage, error) {\n\treturn userSearch(h, &HLTBQuery{Query: query})\n}", "title": "" }, { "docid": "a3af088ba9e40e993eb85bb72958484e", "score": "0.68456125", "text": "func Search(status string) (users.Users, *errors.RestErr) {\n\tdao := &users.User{}\n\treturn dao.FindByStatus(status)\n}", "title": "" }, { "docid": "8addcbc54238c4f597a4c334167ec7b0", "score": "0.6822442", "text": "func (us *Users) Search(f string) (*User, error) {\n\texp := fmt.Sprintf(\"username='%v' OR email='%v'\", f, f)\n\n\treturn getUserWhere(exp)\n}", "title": "" }, { "docid": "9414ff5335081019bea6545a3dd7d032", "score": "0.6797176", "text": "func (m *MalService) SearchUser(query string, page ...int) (search.UserParser, error) {\n\treturn search.InitUserParser(m.Config, query, page...)\n}", "title": "" }, { "docid": "45c44b04f2a84c33ed734ce05d0983f7", "score": "0.67901665", "text": "func Search(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tl := logger.New(\"default\")\n\n\tquery := r.URL.Query().Get(\"q\")\n\tresults, err := catalog.SearchMulti(url.QueryEscape(query))\n\tif err != nil {\n\t\tl.Errorf(err.Error())\n\t\thttp.Error(w, \"HTTP 500 : Internal Server Error\", 500)\n\t\treturn\n\t}\n\tcontext := struct {\n\t\tTitle string\n\t\tQuery string\n\t\tResults tmdb.SearchMultiResult\n\t}{\n\t\t\"tvt.io\",\n\t\tquery,\n\t\tresults,\n\t}\n\tt := template.Must(template.ParseFiles(\n\t\t\"templates/search.html\",\n\t\t\"templates/partials/facebook.html\",\n\t\t\"templates/partials/footer.html\",\n\t\t\"templates/partials/javascript.html\",\n\t\t\"templates/partials/css.html\",\n\t))\n\tt.Execute(w, context)\n}", "title": "" }, { "docid": "2049ec356cd38bb371713399d72fdcf4", "score": "0.67711097", "text": "func (u User) Search(ctx context.Context, from, to int, search string) ([]model.User, error) {\n\tspan, _ := jtrace.Tracer.SpanFromContext(ctx, \"search user model\")\n\tdefer span.Finish()\n\tspan.SetTag(\"model\", \"search users\")\n\n\ttx := mysql.Storage.GetDatabase().Begin()\n\n\tvar users []model.User\n\terr := tx.\n\t\tPreload(\"Role\").\n\t\tPreload(\"Provider\").\n\t\tPreload(\"Role.Permissions\").\n\t\tTable(\"users\").\n\t\tWhere(\"username LIKE ?\", \"%\"+search+\"%\").\n\t\tOr(\"name LIKE ?\", \"%\"+search+\"%\").\n\t\tOr(\"last_name LIKE ?\", \"%\"+search+\"%\").\n\t\tOr(\"phone LIKE ?\", \"%\"+search+\"%\").\n\t\tOr(\"email LIKE ?\", \"%\"+search+\"%\").\n\t\tOr(\"gender LIKE ?\", \"%\"+search+\"%\").\n\t\tOr(\"role_id LIKE ?\", \"%\"+search+\"%\").\n\t\tLimit(to - from).\n\t\tOffset(from).\n\t\tSelect(\"*\").\n\t\tFind(&users).Error\n\tif err != nil {\n\t\tlog := logger.GetZapLogger(false)\n\t\tlogger.Prepare(log).\n\t\t\tAppend(zap.Any(\"error\", fmt.Sprintf(\"update user error: %s\", err))).\n\t\t\tLevel(zap.ErrorLevel).\n\t\t\tDevelopment().\n\t\t\tCommit(\"env\")\n\t\ttx.Rollback()\n\t\treturn nil, err\n\t}\n\ttx.Commit()\n\n\treturn users, nil\n}", "title": "" }, { "docid": "75d78ff7ad8dcbe82b6a643d1e226942", "score": "0.67381275", "text": "func (c *Crowd) SearchUsers(restriction string) ([]string, error) {\n\tvar names []string\n\n\tv := url.Values{}\n\tv.Set(\"entity-type\", \"user\")\n\tv.Set(\"restriction\", restriction)\n\turl := c.url + \"rest/usermanagement/1/search?\" + v.Encode()\n\tc.Client.Jar = c.cookies\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn names, nil\n\t}\n\treq.SetBasicAuth(c.user, c.passwd)\n\treq.Header.Set(\"Accept\", \"application/xml\")\n\treq.Header.Set(\"Content-Type\", \"application/xml\")\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn names, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch resp.StatusCode {\n\tcase 200:\n\t\t// fall through switch without returning\n\tdefault:\n\t\treturn names, fmt.Errorf(\"request failed: %s\", resp.Status)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn names, err\n\t}\n\n\tr := struct{\n\t\tUsers []struct{\n\t\t\tName string `xml:\"name,attr\"`\n\t\t} `xml:\"user\"`\n\t}{}\n\n\terr = xml.Unmarshal(body, &r)\n\tif err != nil {\n\t\treturn names, err\n\t}\n\n\tfor _, u := range r.Users {\n\t\tnames = append(names, u.Name)\n\t}\n\n\treturn names, nil\n}", "title": "" }, { "docid": "a600a3e77cb30e683cda35252f5f78b6", "score": "0.6623765", "text": "func Search(w http.ResponseWriter, r *http.Request) {\n\tviewData := BaseViewData(w, r)\n\n\ttermMap := utils.GetSearchTermsForString(r.FormValue(\"q\"), true)\n\tterms := make([]string, len(termMap))\n\ti := 0\n\tfor term := range termMap {\n\t\tterms[i] = term\n\t\ti++\n\t}\n\n\tpageNumStr := \"1\"\n\tif len(r.FormValue(\"page\")) > 0 {\n\t\tpageNumStr = r.FormValue(\"page\")\n\t}\n\n\tpage, err := strconv.Atoi(pageNumStr)\n\tif err != nil {\n\t\tviewData.NotFound(w)\n\t\treturn\n\t}\n\t// Correct for the human readable format for page numbers used\n\t// by the client here\n\tpage = page - 1\n\n\tplaceID := -1\n\tif viewData.Session != nil {\n\t\tplaceID = viewData.Session.User.PlaceID\n\t}\n\n\tlistings := []models.Listing{}\n\tif len(terms) > 0 {\n\t\tlistings, err = models.DoSearchForTerms(Base.Db, terms, page, placeID)\n\t\tif err != nil {\n\t\t\tviewData.InternalError(w)\n\t\t\treturn\n\t\t}\n\t}\n\n\tnumPages := models.GetPageCountForTerms(Base.Db, terms, placeID)\n\n\tviewData.Data = searchViewData{\n\t\tListings: listings,\n\t\tQuery: r.FormValue(\"q\"),\n\t\tPage: page + 1,\n\t\tStartOffset: page*50 + 1,\n\t\tEndOffset: page*50 + len(listings),\n\t\tMaxTotal: numPages * 50,\n\t\tOutOf: numPages,\n\t}\n\tRenderView(w, \"search#search\", viewData)\n}", "title": "" }, { "docid": "5a3a2acccd9deafb0c89010501a0b9fc", "score": "0.6593409", "text": "func SearchHandler(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tc = appengine.NewContext(r)\n\t\tp = page.New(\"search.html\")\n\t\tdb = data.NewRequest(c)\n\t\tpageData = map[string]interface{}{\n\t\t\t\"query\": r.FormValue(\"q\"),\n\t\t\t\"count\": 0,\n\t\t\t\"title\": \"Search for \\\"\" + r.FormValue(\"q\") + \"\\\"\",\n\t\t}\n\t)\n\tif len(r.FormValue(\"q\")) > 0 {\n\t\tresults, err := db.SearchUsers(r.FormValue(\"q\"))\n\t\tif err != nil {\n\t\t\tlog.Errorf(c, \"got err on search: %v\", err)\n\t\t}\n\n\t\tswitch r.FormValue(\"s\") {\n\t\tcase \"overall\":\n\t\t\tsort.Sort(data.ByOverall(results))\n\t\t\tbreak\n\t\tcase \"followers\":\n\t\t\tsort.Sort(data.ByFollowers(results))\n\t\t\tbreak\n\t\tcase \"loops\":\n\t\t\tsort.Sort(data.ByLoops(results))\n\t\t\tbreak\n\t\tcase \"posts\":\n\t\t\tsort.Sort(data.ByPosts(results))\n\t\t\tbreak\n\t\tcase \"revines\":\n\t\t\tsort.Sort(data.ByRevines(results))\n\t\t\tbreak\n\t\t}\n\n\t\tif r.Method == \"GET\" {\n\t\t\tpageData[\"count\"] = len(results)\n\t\t\tpageData[\"results\"] = results\n\t\t} else if r.Method == \"POST\" {\n\t\t\tjsonData, _ := json.Marshal(results)\n\t\t\tfmt.Fprint(w, string(jsonData))\n\t\t\treturn\n\t\t}\n\t}\n\n\tp.LoadData(pageData)\n\tp.Write(w)\n}", "title": "" }, { "docid": "df8b2c5c25d3f2e7dd14bd81d2187ee3", "score": "0.6586539", "text": "func (a SearchApi) GetUsersSearch(q64 string, expand []string, integrationPresenceSource string) (*Userssearchresponse, *APIResponse, error) {\n\tvar httpMethod = \"GET\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/users/search\"\n\tdefaultReturn := new(Userssearchresponse)\n\tif true == false {\n\t\treturn defaultReturn, nil, errors.New(\"This message brought to you by the laws of physics being broken\")\n\t}\n\n\t// verify the required parameter 'q64' is set\n\tif &q64 == nil {\n\t\t// false\n\t\treturn defaultReturn, nil, errors.New(\"Missing required parameter 'q64' when calling SearchApi->GetUsersSearch\")\n\t}\n\n\theaderParams := make(map[string]string)\n\tqueryParams := make(map[string]string)\n\tformParams := url.Values{}\n\tvar postBody interface{}\n\tvar postFileName string\n\tvar fileBytes []byte\n\t// authentication (PureCloud OAuth) required\n\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\t\n\tqueryParams[\"q64\"] = a.Configuration.APIClient.ParameterToString(q64, \"\")\n\t\n\tqueryParams[\"expand\"] = a.Configuration.APIClient.ParameterToString(expand, \"multi\")\n\t\n\tqueryParams[\"integrationPresenceSource\"] = a.Configuration.APIClient.ParameterToString(integrationPresenceSource, \"\")\n\t\n\n\t// Find an replace keys that were altered to avoid clashes with go keywords \n\tcorrectedQueryParams := make(map[string]string)\n\tfor k, v := range queryParams {\n\t\tif k == \"varType\" {\n\t\t\tcorrectedQueryParams[\"type\"] = v\n\t\t\tcontinue\n\t\t}\n\t\tcorrectedQueryParams[k] = v\n\t}\n\tqueryParams = correctedQueryParams\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\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\tvar successPayload *Userssearchresponse\n\tresponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, postFileName, fileBytes)\n\tif err != nil {\n\t\t// Nothing special to do here, but do avoid processing the response\n\t} else if err == nil && response.Error != nil {\n\t\terr = errors.New(response.ErrorMessage)\n\t} else if response.HasBody {\n\t\tif \"Userssearchresponse\" == \"string\" {\n\t\t\tcopy(response.RawBody, &successPayload)\n\t\t} else {\n\t\t\terr = json.Unmarshal(response.RawBody, &successPayload)\n\t\t}\n\t}\n\treturn successPayload, response, err\n}", "title": "" }, { "docid": "b81a86dfad5261a4dd5b90be0431d527", "score": "0.657024", "text": "func searchResult(w http.ResponseWriter, r *http.Request) {\n clearCache(w)\n exists, cookie := getCookie(r, LOGIN_COOKIE)\n if !exists {\n http.Redirect(w, r, \"/welcome\", http.StatusSeeOther)\n return\n }\n r.ParseForm()\n LOG[INFO].Println(\"Form Values: Username\", r.FormValue(\"username\"))\n if cookie.Value == r.FormValue(\"username\") {\n LOG[INFO].Println(\"User Self Search\")\n http.Redirect(w, r, \"/home\", http.StatusSeeOther)\n return\n }\n response := sendCommand(CommandRequest{CommandSearch, struct{\n Searcher string\n Target string\n }{\n cookie.Value,\n r.FormValue(\"username\"),\n }})\n if response == nil {\n http.SetCookie(w, genCookie(ERROR_COOKIE, \"Send Command Error\"))\n http.Redirect(w, r, \"/error\", http.StatusSeeOther)\n return\n }\n if !response.Success {\n if response.Status == StatusUserNotFound {\n LOG[WARNING].Println(StatusText(response.Status))\n http.Redirect(w, r, \"/home\", http.StatusSeeOther)\n } else {\n LOG[ERROR].Println(StatusText(response.Status))\n http.SetCookie(w, genCookie(ERROR_COOKIE, StatusText(response.Status)))\n http.Redirect(w, r, \"/error\", http.StatusSeeOther)\n }\n return\n }\n\n if r.Method == http.MethodGet {\n LOG[INFO].Println(\"Search Results Page\")\n t, err := template.ParseFiles(\"../../web/search-result.html\")\n if err != nil {\n LOG[ERROR].Println(\"HTML Template Error\", err)\n http.SetCookie(w, genCookie(ERROR_COOKIE, \"HTML Template Error\"))\n http.Redirect(w, r, \"/error\", http.StatusSeeOther)\n return\n }\n err = t.Execute(w, struct{Username, Follow string}{r.FormValue(\"username\"), response.Data.(string)})\n if err != nil {\n LOG[ERROR].Println(\"HTML Template Execution Error\", err)\n http.SetCookie(w, genCookie(ERROR_COOKIE, \"HTML Template Execution Error\"))\n http.Redirect(w, r, \"/error\", http.StatusSeeOther)\n }\n } else if r.Method == http.MethodPost {\n LOG[INFO].Println(\"Executing Follow/Unfollow\")\n LOG[INFO].Println(\"Form Values: Username\", r.PostFormValue(\"username\"))\n r.ParseForm()\n if response.Data == \"Follow\" {\n response = sendCommand(CommandRequest{CommandFollow, struct {\n Username1 string\n Username2 string\n }{\n cookie.Value,\n r.PostFormValue(\"username\"),\n }})\n } else if response.Data == \"Unfollow\" {\n response = sendCommand(CommandRequest{CommandUnfollow, struct {\n Username1 string\n Username2 string\n }{\n cookie.Value,\n r.PostFormValue(\"username\"),\n }})\n }\n if response == nil {\n http.SetCookie(w, genCookie(ERROR_COOKIE, \"Send Command Error\"))\n http.Redirect(w, r, \"/error\", http.StatusSeeOther)\n return\n }\n\n if !response.Success {\n http.SetCookie(w, genCookie(ERROR_COOKIE, StatusText(response.Status)))\n http.Redirect(w, r, \"/error\", http.StatusSeeOther)\n return\n }\n LOG[INFO].Println(\"Follow Successful\")\n http.Redirect(w, r, \"/home\", http.StatusSeeOther)\n }\n}", "title": "" }, { "docid": "2bec78219ad66bdbb3afa5ad59df504c", "score": "0.64892256", "text": "func UserActionSearch(props ...*userActionProps) *userAction {\n\ta := &userAction{\n\t\ttimestamp: time.Now(),\n\t\tresource: \"system:user\",\n\t\taction: \"search\",\n\t\tlog: \"searched for matching users\",\n\t\tseverity: actionlog.Info,\n\t}\n\n\tif len(props) > 0 {\n\t\ta.props = props[0]\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "3d49834b7b623a64a67e1c0a34cb8bf3", "score": "0.6481773", "text": "func (s UserSet) Search(condition q.UserCondition) m.UserSet {\n\tres := s.Collection().Call(\"Search\", condition)\n\tresTyped := res.(models.RecordSet).Collection().Wrap(\"User\").(m.UserSet)\n\treturn resTyped\n}", "title": "" }, { "docid": "9c3e8910520a0c7d8da256d6ef3c5514", "score": "0.64765424", "text": "func Search(w http.ResponseWriter, r *http.Request) {\n\n\tuser := utils.GetAuthenticatedUser(r)\n\n\tkeys, ok := r.URL.Query()[\"q\"]\n\n\tif !ok || len(keys[0]) < 1 {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\t// Query()[\"key\"] will return an array of items,\n\t// we only want the single item.\n\tkey := keys[0]\n\n\t// redirect to glsa if isNumeric\n\tif _, err := strconv.Atoi(key); err == nil {\n\t\thttp.Redirect(w, r, \"/glsa/\"+key, 301)\n\t}\n\n\tif key == \"#home\" {\n\t\thttp.Redirect(w, r, \"/\", 301)\n\t\treturn\n\t} else if key == \"#dashboard\" {\n\t\thttp.Redirect(w, r, \"/dashboard\", 301)\n\t\treturn\n\t} else if key == \"#new\" {\n\t\thttp.Redirect(w, r, \"/new\", 301)\n\t\treturn\n\t} else if key == \"#cvetool\" {\n\t\thttp.Redirect(w, r, \"/cve/tool\", 301)\n\t\treturn\n\t} else if key == \"#requests\" {\n\t\thttp.Redirect(w, r, \"/requests\", 301)\n\t\treturn\n\t} else if key == \"#drafts\" {\n\t\thttp.Redirect(w, r, \"/drafts\", 301)\n\t\treturn\n\t} else if key == \"#all\" {\n\t\thttp.Redirect(w, r, \"/all\", 301)\n\t\treturn\n\t} else if key == \"#archive\" {\n\t\thttp.Redirect(w, r, \"/archive\", 301)\n\t\treturn\n\t} else if key == \"#about\" {\n\t\thttp.Redirect(w, r, \"/about\", 301)\n\t\treturn\n\t} else if key == \"#bugzilla\" {\n\t\thttp.Redirect(w, r, \"https://bugs.gentoo.org/\", 301)\n\t\treturn\n\t} else if key == \"#admin\" {\n\t\thttp.Redirect(w, r, \"/admin\", 301)\n\t\treturn\n\t} else if key == \"#password\" {\n\t\thttp.Redirect(w, r, \"/account/password\", 301)\n\t\treturn\n\t} else if key == \"#2fa\" {\n\t\thttp.Redirect(w, r, \"/account/2fa\", 301)\n\t\treturn\n\t} else if key == \"#statistics\" {\n\t\thttp.Redirect(w, r, \"/statistics\", 301)\n\t\treturn\n\t}\n\n\tif key == \"#logout\" {\n\t\thttp.Redirect(w, r, \"/logout\", 301)\n\t\treturn\n\t}\n\n\tif !user.Permissions.Glsa.View {\n\t\tauthentication.AccessDenied(w, r)\n\t\treturn\n\t}\n\n\tvar glsas []*models.Glsa\n\terr := user.CanAccess(connection.DB.Model(&glsas).\n\t\tRelation(\"Bugs\").\n\t\tRelation(\"Comments\").\n\t\tRelation(\"Creator\").\n\t\tWhereGroup(func(q *orm.Query) (*orm.Query, error) {\n\t\t\tq = q.WhereOr(\"title LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"type LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"synopsis LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"description LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"workaround LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"resolution LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"keyword LIKE \" + \"'%\" + key + \"%'\").\n\t\t\t\tWhereOr(\"background LIKE \" + \"'%\" + key + \"%'\")\n\t\t\t\t//WhereOr(\"creator LIKE \" + \"'%\" + key + \"%'\")\n\t\t\treturn q, nil\n\t\t})).\n\t\tSelect()\n\n\t// TODO search in comments\n\t// TODO search in bugs\n\n\tif err != nil {\n\t\tlogger.Info.Println(\"Error during searching\")\n\t\tlogger.Info.Println(err)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tfor _, glsa := range glsas {\n\t\tglsa.ComputeStatus(user)\n\t}\n\n\trenderSearchTemplate(w, user, key, glsas)\n\n}", "title": "" }, { "docid": "7448aa3ef345a6e13f8cff074c4dadff", "score": "0.645821", "text": "func (a UsersApi) GetUsersSearch(q64 string, expand []string, integrationPresenceSource string) (*Userssearchresponse, *APIResponse, error) {\n\tvar httpMethod = \"GET\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/users/search\"\n\tdefaultReturn := new(Userssearchresponse)\n\tif true == false {\n\t\treturn defaultReturn, nil, errors.New(\"This message brought to you by the laws of physics being broken\")\n\t}\n\n\t// verify the required parameter 'q64' is set\n\tif &q64 == nil {\n\t\t// false\n\t\treturn defaultReturn, nil, errors.New(\"Missing required parameter 'q64' when calling UsersApi->GetUsersSearch\")\n\t}\n\n\theaderParams := make(map[string]string)\n\tqueryParams := make(map[string]string)\n\tformParams := url.Values{}\n\tvar postBody interface{}\n\tvar postFileName string\n\tvar fileBytes []byte\n\t// authentication (PureCloud OAuth) required\n\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\t\n\tqueryParams[\"q64\"] = a.Configuration.APIClient.ParameterToString(q64, \"\")\n\t\n\tqueryParams[\"expand\"] = a.Configuration.APIClient.ParameterToString(expand, \"multi\")\n\t\n\tqueryParams[\"integrationPresenceSource\"] = a.Configuration.APIClient.ParameterToString(integrationPresenceSource, \"\")\n\t\n\n\t// Find an replace keys that were altered to avoid clashes with go keywords \n\tcorrectedQueryParams := make(map[string]string)\n\tfor k, v := range queryParams {\n\t\tif k == \"varType\" {\n\t\t\tcorrectedQueryParams[\"type\"] = v\n\t\t\tcontinue\n\t\t}\n\t\tcorrectedQueryParams[k] = v\n\t}\n\tqueryParams = correctedQueryParams\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\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\tvar successPayload *Userssearchresponse\n\tresponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, postFileName, fileBytes)\n\tif err != nil {\n\t\t// Nothing special to do here, but do avoid processing the response\n\t} else if err == nil && response.Error != nil {\n\t\terr = errors.New(response.ErrorMessage)\n\t} else if response.HasBody {\n\t\tif \"Userssearchresponse\" == \"string\" {\n\t\t\tcopy(response.RawBody, &successPayload)\n\t\t} else {\n\t\t\terr = json.Unmarshal(response.RawBody, &successPayload)\n\t\t}\n\t}\n\treturn successPayload, response, err\n}", "title": "" }, { "docid": "9dbd366f79f553b6f922452f44d88fe9", "score": "0.64556015", "text": "func Handle(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\tvar txtsearch string\n\tvar ctx = context.Background()\n\tvar query *SearchQuery\n\tvar results []*models.User\n\tapi.OPENFAASGetBody(r, &query)\n\tif goscrappy.Debug {\n\t\tfmt.Printf(\"Query : %+v\\n\", query)\n\t}\n\tvar DB = dbservice.Db\n\tvar qtemplate = `\n\tFOR usr IN users \n\tLET a = (\n\t\t\tFOR comp IN companies FILTER comp == usr.company \n\t\t\tRETURN comp\n\t)\n\tLET b = (\n\t\t\tFOR email IN emails FILTER email == usr.email \n\t\t\tRETURN email\n\t)\n\tLET c = (\n\t\t\tFOR phone IN phones FILTER phone == usr.phone \n\t\t\tRETURN phone\n\t)\n\t%s\n\tLIMIT @offset, @limit\n\tRETURN merge(usr, { \n\t \tcompany: FIRST(a),\n\t \temail: FIRST(b),\n\t \tphone: FIRST(c)\n\t\t}\n\t)\n\t`\n\tif query != nil && query.Intext != nil {\n\t\ttxtsearch = fmt.Sprintf(\n\t\t\t`\n\t\t\tLET srch = LOWER(\"%s\")\n\t\t\tLET inlastname = LOWER(usr.last_name)\n\t\t\tFILTER CONTAINS(inlastname, srch)\n\t\t\t`,\n\t\t\t*query.Intext,\n\t\t)\n\t}\n\tlimitVal := func() int64 {\n\t\tif query != nil && query.Count != nil &&\n\t\t\t*query.Count > 0 {\n\t\t\treturn *query.Count\n\t\t}\n\t\treturn 10\n\t}()\n\toffsetVal := func() int64 {\n\t\tif query != nil && query.Offset != nil &&\n\t\t\t*query.Offset > 0 {\n\t\t\treturn *query.Offset\n\t\t}\n\t\treturn 0\n\t}()\n\tq := fmt.Sprintf(qtemplate, txtsearch)\n\tcursor, err := DB.Query(ctx, q, map[string]interface{}{\n\t\t\"offset\": offsetVal,\n\t\t\"limit\": limitVal,\n\t})\n\tif err != nil {\n\t\tapi.OPENFAASErrorResponse(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer cursor.Close()\n\tfor {\n\t\tvar doc models.User\n\t\t_, err := cursor.ReadDocument(ctx, &doc)\n\t\tif driver.IsNoMoreDocuments(err) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\tapi.OPENFAASErrorResponse(w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t\tresults = append(results, &doc)\n\t}\n\tapi.OPENFAASJsonResponse(w, http.StatusOK, results)\n}", "title": "" }, { "docid": "14d4655b3a220bc4db4bed4f9521e7d9", "score": "0.64545697", "text": "func SearchUserByName(searchTerm string, userID string) ([]*model.User, error) {\n\n\tuserList := []*model.User{}\n\n\t// get user information\n\trows, err := db.SQL.Query(`SELECT id, email, firstName, lastName FROM \"User\" WHERE \"firstName\" || ' ' || \"lastName\" LIKE ? OR \"email\" LIKE lower(?) AND \"id\" != ? LIMIT 20;`, \"%\"+searchTerm+\"%\", \"%\"+searchTerm+\"%\", userID)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []*model.User{}, errors.New(\"Internal error.\")\n\t}\n\n\tdefer rows.Close()\n\n\t// map query to user object list\n\tfor rows.Next() {\n\t\tnewUser := &model.User{}\n\t\terr := rows.Scan(&newUser.ID, &newUser.Email, &newUser.FirstName, &newUser.LastName)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn []*model.User{}, errors.New(\"Internal error.\")\n\t\t}\n\t\tuserList = append(userList, newUser)\n\t}\n\n\terr = rows.Err()\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []*model.User{}, errors.New(\"Internal error.\")\n\t}\n\n\treturn userList, nil\n}", "title": "" }, { "docid": "8e82bd924c1dee305493dc71f0589197", "score": "0.6451188", "text": "func SearchUsers(name string) ([]User, error) {\n\tname = strings.ToLower(name)\n\tusers, err := ListAllUsers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfiltered := []User{}\n\tfor _, user := range users {\n\t\tif strings.Contains(user.LoginName, name) || strings.Contains(user.FullName, name) {\n\t\t\tfiltered = append(filtered, user)\n\t\t}\n\t}\n\treturn filtered, nil\n}", "title": "" }, { "docid": "961e70984c99b40715a3ad92f9b4df8e", "score": "0.6448082", "text": "func GetUsersSearch(baseURL string) {\n\ttargetURL := baseURL + \"?username=\" + usrSearch.Username +\n\t\t\"&email=\" + usrSearch.Email +\n\t\t\"&page=\" + strconv.Itoa(usrSearch.Page) +\n\t\t\"&page_size=\" + strconv.Itoa(usrSearch.PageSize)\n\n\tfmt.Println(\"==> GET\", targetURL)\n\n\t// Read beegosessionID from .cookie.yaml\n\tc, err := utils.CookieLoad()\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\treturn\n\t}\n\n\tutils.Request.Get(targetURL).\n\t\tSet(\"Cookie\", \"harbor-lang=zh-cn; beegosessionID=\"+c.BeegosessionID).\n\t\tEnd(utils.PrintStatus)\n}", "title": "" }, { "docid": "2ca6e718d608f63c96df991a59708c43", "score": "0.6431209", "text": "func (d *DefaultAuthenticateHelper) SearchUser(ctx context.Context, username string) (*models.User, error) {\n\tlog.Errorf(\"Not support searching user, username: %s\", username)\n\treturn nil, libErrors.NotFoundError(ErrNotSupported).WithMessage(\"%s not found\", username)\n}", "title": "" }, { "docid": "87f52ebdff3969c9076868d96ac75bc6", "score": "0.64296967", "text": "func (s UserSet) SearchAll() m.UserSet {\n\tres := s.Collection().Call(\"SearchAll\")\n\tresTyped := res.(models.RecordSet).Collection().Wrap(\"User\").(m.UserSet)\n\treturn resTyped\n}", "title": "" }, { "docid": "7b715a8a0d5de90bd977ed44105ea175", "score": "0.64289254", "text": "func GetUsersSearch(query url.Values) (*UsersSearch, error) {\n\tres := &UsersSearch{}\n\terr := urlToStruct(fmt.Sprintf(\"/users?%s\", query.Encode()), res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "090d8f82f386f182dda20f0f037b1f9f", "score": "0.6295887", "text": "func (s *searcher) User(resp http.ResponseWriter, req *http.Request) {\n\tsearchTerms := mux.Vars(req)\n\n\tuserIDHex := searchTerms[\"user_publickey_hexencoded\"]\n\n\tuserIDbytes, err := hex.DecodeString(userIDHex)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\tresp.Write([]byte(\"user ID Public PEM string should be hexadecimal encoded for the url\"))\n\t\treturn\n\t}\n\n\tuserID := string(userIDbytes)\n\n\tif len(userID) == 0 {\n\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\tresp.Write([]byte(\"user ID is empty\"))\n\t\treturn\n\t}\n\n\tif !strings.HasPrefix(userID, \"-----BEGIN RSA PUBLIC KEY-----\") {\n\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\tresp.Write([]byte(\"user ID should be a Public RSA PEM string\"))\n\t\treturn\n\t}\n\n\tsearchPaths, err := s.searchIndex.GetTransactionPathsByUserID(userID)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tresp.Write([]byte(fmt.Sprintf(\"error finding transactions: %s\", err.Error())))\n\t\treturn\n\t}\n\n\ttransactions, err := s.searchIndex.GetTransactionsFromFiles(searchPaths)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tresp.Write([]byte(fmt.Sprintf(\"error finding transactions: %s\", err.Error())))\n\t\treturn\n\t}\n\n\tresultBytes, err := json.Marshal(transactions)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tresp.Write([]byte(fmt.Sprintf(\"error marshallig transactions to json: %s\", err.Error())))\n\t\treturn\n\t}\n\n\tresp.WriteHeader(http.StatusOK)\n\tresp.Write(resultBytes)\n}", "title": "" }, { "docid": "c11a72c86da4f1e7652ddde7348886b7", "score": "0.6272108", "text": "func (pr *SearchRepository) Search(userID uint64, query string) (SearchVM, error) {\n\tvm := SearchVM{}\n\n\tif len(strings.TrimSpace(query)) == 0 {\n\t\treturn SearchVM{}, fmt.Errorf(\"Query string is empty\")\n\t}\n\terr := db.Where(\"user_id = ?\", userID).\n\t\tWhere(\"to_tsvector(name) @@ to_tsquery(?)\", fmt.Sprintf(\"%s:*\", query)).\n\t\tOrder(\"id asc\").Find(&vm.Categories).Error\n\tif err != nil {\n\t\treturn SearchVM{}, err\n\t}\n\n\terr = db.Preload(\"Tasks\").Preload(\"Category\").Where(\"user_id = ?\", userID).\n\t\tWhere(\"to_tsvector(name || ' ' || description) @@ to_tsquery(?)\", fmt.Sprintf(\"%s:*\", query)).\n\t\tOrder(\"archived asc, created_at asc\").Find(&vm.Projects).Error\n\tif err != nil {\n\t\treturn SearchVM{}, err\n\t}\n\n\tq := db.Where(\"user_id = ?\", userID).\n\t\tWhere(\"to_tsvector(name || ' ' || description) @@ to_tsquery(?)\", fmt.Sprintf(\"%s:*\", query)).\n\t\tPreload(\"Project\").Preload(\"Comments\").Preload(\"Category\")\n\tq = q.Preload(\"TaskLogs\", func(db *gorm.DB) *gorm.DB {\n\t\treturn db.Where(\"session_id = 0 and minutes > 0\")\n\t})\n\terr = q.Order(\"tasks.completed asc, tasks.created_at asc\").Find(&vm.Tasks).Error\n\tif err != nil {\n\t\treturn SearchVM{}, err\n\t}\n\n\terr = db.Where(\"user_id = ?\", userID).\n\t\tWhere(\"to_tsvector(contents) @@ to_tsquery(?)\", fmt.Sprintf(\"%s:*\", query)).\n\t\tOrder(\"id\").Find(&vm.Comments).Error\n\n\treturn vm, err\n}", "title": "" }, { "docid": "84361261bc66e7a45b212ecd030a41dd", "score": "0.62555605", "text": "func (DBConnection *MariaDBPlugin) SearchUsers(searchString string, PageStart uint64, PageStride uint64) ([]interfaces.UserInformation, uint64, error) {\n\tvar ToReturn []interfaces.UserInformation\n\tsearchString = strings.TrimSpace(searchString)\n\tsearchString = strings.Replace(searchString, \"%\", \"\", -1)\n\tsearchString = \"%\" + searchString + \"%\"\n\tqueryArray := []interface{}{}\n\tsqlQuery := \"SELECT ID, Name, CreationTime, Disabled, Permissions FROM Users WHERE Name Like ? ORDER BY Name\"\n\tsqlCountQuery := \"SELECT COUNT(*) FROM Users WHERE Name Like ?\"\n\tif searchString == \"\" {\n\t\tsqlQuery = \"SELECT ID, Name, CreationTime, Disabled, Permissions FROM Users ORDER BY Name\"\n\t\tsqlCountQuery = \"SELECT COUNT(*) FROM Users\"\n\t} else {\n\t\tqueryArray = append(queryArray, searchString)\n\t}\n\n\t//Query Count\n\t//Run the count query (Count query does not use start/stride, so run this before we add those)\n\tvar MaxResults uint64\n\terr := DBConnection.DBHandle.QueryRow(sqlCountQuery, queryArray...).Scan(&MaxResults)\n\tif err != nil {\n\t\tlogging.WriteLog(logging.LogLevelError, \"MariaDBPlugin/SearchUsers\", \"0\", logging.ResultFailure, []string{\"Error running search query\", sqlCountQuery, err.Error()})\n\t\treturn nil, 0, err\n\t}\n\t//\n\tif PageStride > 0 {\n\t\tsqlQuery += \" LIMIT ? OFFSET ?;\"\n\t\tqueryArray = append(queryArray, PageStride)\n\t\tqueryArray = append(queryArray, PageStart)\n\t}\n\n\t//First Query the main information\n\trows, err := DBConnection.DBHandle.Query(sqlQuery, queryArray...)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tdefer rows.Close()\n\t//Placeholders for data returned by each row\n\tvar ID uint64\n\tvar Name string\n\tvar NCreationTime mysql.NullTime\n\tvar CreationTime time.Time\n\tvar Disabled bool\n\tvar Permissions uint64\n\t//For each row\n\tfor rows.Next() {\n\t\t//Parse out the data\n\t\terr := rows.Scan(&ID, &Name, &NCreationTime, &Disabled, &Permissions)\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\tif NCreationTime.Valid {\n\t\t\tCreationTime = NCreationTime.Time\n\t\t}\n\t\t//Add this result to ToReturn\n\t\tToReturn = append(ToReturn, interfaces.UserInformation{ID: ID, Name: Name, CreationTime: CreationTime, Disabled: Disabled, Permissions: interfaces.UserPermission(Permissions)})\n\t}\n\n\treturn ToReturn, MaxResults, nil\n}", "title": "" }, { "docid": "7aa10b0b41b6c174a28213610d7d9af2", "score": "0.6244871", "text": "func (s *Service) Search(r *http.Request, args *SearchEntryArgs, result *SearchResponse) error {\n\t// TODO: add metadata searching\n\t// TODO: add fuzzy tags searching\n\tif args.UserID == \"\" {\n\t\tresult.Error = uidMissing\n\t\tresult.Entries = []Entry{}\n\t\tresult.Count = 0\n\t\treturn nil\n\t}\n\tvar searchClauses []bson.M\n\tvar searchQuery bson.M\n\tvar entries []Entry\n\tentryTypes := []string{EntryTypePim, EntryTypeBookmark, EntryTypeOrg}\n\tif len(args.Types) > 0 {\n\t\tentryTypes = args.Types\n\t}\n\tvar entryTypesClauses []bson.M\n\tfor _, entryType := range entryTypes {\n\t\tentryTypesClauses = append(entryTypesClauses, bson.M{\"type\": entryType})\n\t}\n\tsearchClauses = append(searchClauses, bson.M{\"$or\": entryTypesClauses})\n\tif args.Content != \"\" {\n\t\tvar entryContentClauses []bson.M\n\t\tentryContentClauses = append(entryContentClauses, bson.M{\"content\": bson.M{\"$regex\": args.Content, \"$options\": \"i\"}})\n\t\tentryContentClauses = append(entryContentClauses, bson.M{\"metadata.description\": bson.M{\"$regex\": args.Content, \"$options\": \"i\"}})\n\t\tsearchClauses = append(searchClauses, bson.M{\"$or\": entryContentClauses})\n\t}\n\tif len(args.Tags) > 0 {\n\t\tvar regexTags []bson.RegEx\n\t\tfor _, tag := range args.Tags {\n\t\t\tregexTags = append(regexTags, bson.RegEx{tag, \"i\"})\n\t\t}\n\t\tsearchClauses = append(searchClauses, bson.M{\"tags\": bson.M{\"$in\": regexTags}})\n\t}\n\tif len(args.Priority) > 0 {\n\t\tsearchClauses = append(searchClauses, bson.M{\"priority\": bson.M{\"$in\": args.Priority}})\n\t}\n\tcoll := s.Session.DB(MentatDatabase).C(args.UserID)\n\tif len(searchClauses) > 0 {\n\t\tsearchQuery = bson.M{\"$and\": searchClauses}\n\t}\n\tmgoErr := coll.Find(searchQuery).All(&entries)\n\tif mgoErr != nil {\n\t\tif mgoErr.Error() == MongoNotFound {\n\t\t\tresult.Entries = []Entry{}\n\t\t\tresult.Count = 0\n\t\t\treturn nil\n\t\t}\n\t\ts.Log.Infof(\"mgo error: %s\", mgoErr)\n\t\tresult.Error = fmt.Sprintf(\"mgo error: %s\", mgoErr)\n\t\tresult.Entries = []Entry{}\n\t\tresult.Count = 0\n\t\treturn nil\n\t}\n\tresult.Entries = entries\n\tresult.Count = len(entries)\n\treturn nil\n}", "title": "" }, { "docid": "6f6d5f516da3b931d104bcb977cff221", "score": "0.623259", "text": "func (search *Search) User(user string, countParam ...int) (*SearchResult, error) {\n\tcount := 50\n\tif len(countParam) > 0 {\n\t\tcount = countParam[0]\n\t}\n\tinsta := search.inst\n\tbody, err := insta.sendRequest(\n\t\t&reqOptions{\n\t\t\tEndpoint: urlSearchUser,\n\t\t\tQuery: map[string]string{\n\t\t\t\t\"ig_sig_key_version\": goInstaSigKeyVersion,\n\t\t\t\t\"is_typeahead\": \"true\",\n\t\t\t\t\"q\": user,\n\t\t\t\t\"count\": fmt.Sprintf(\"%d\", count),\n\t\t\t\t\"rank_token\": insta.rankToken,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := &SearchResult{}\n\terr = json.Unmarshal(body, res)\n\tfor id := range res.Users {\n\t\tres.Users[id].inst = insta\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "e842759e3b540c600034a6981c69947b", "score": "0.62023705", "text": "func ExampleApi_GetUserSearch_Params() {\n\t// *** need ***\n\tapi := New(\"\", \"client_secret\", \"access_token\", true)\n\n\tparams := url.Values{}\n\tparams.Set(\"count\", \"5\") // Get 5 users\n\tparams.Set(\"q\", \"jack\") // Search for user \"jack\"\n\n\tusersResponse, err := api.GetUserSearch(params)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, user := range usersResponse.Users {\n\t\tprocessUser(&user)\n\t}\n}", "title": "" }, { "docid": "1a1e128e4db071f7380d3a42e4a4da2c", "score": "0.6201859", "text": "func (a *Auth) SearchUser(ctx context.Context, from, to int, search string) ([]model.User, error) {\n\tspan := jtrace.Tracer.StartSpan(\"search-user\")\n\tdefer span.Finish()\n\tspan.SetTag(\"service\", \"start to search\")\n\n\t// search users\n\tusers, err := user.Model.Search(jtrace.Tracer.ContextWithSpan(context.Background(), span), from, to, search)\n\tif err != nil {\n\t\treturn []model.User{}, status.Errorf(codes.Internal, \"internal error for search users\")\n\t}\n\n\treturn users, nil\n}", "title": "" }, { "docid": "6299ca60dac0baa713cc9cff3876c173", "score": "0.61872464", "text": "func (c *Client) SearchUsers(ctx context.Context, queryParams QueryParams) (*UserSearchResult, error) {\n\tlink, err := buildURL(SearchUsersEndpoint, queryParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// throw an error if search query parameter not in URL\n\tif _, ok := queryParams[\"query\"]; !ok {\n\t\treturn nil, ErrQueryNotInURL(link)\n\t}\n\tdata, err := c.getBodyBytes(ctx, link)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar res UserSearchResult\n\terr = parseJSON(data, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &res, nil\n}", "title": "" }, { "docid": "d2307bb676972c83728bba65cbf13f1f", "score": "0.6182682", "text": "func (s *Service) User(c context.Context, mid int64, buvid, mobiApp, device, platform, keyword, filtered, order, fromSource string, highlight, build, userType, orderSort, pn, ps int, now time.Time) (res *search.UserResult) {\n\tres = &search.UserResult{}\n\tuser, err := s.srchDao.User(c, mid, keyword, mobiApp, device, platform, buvid, filtered, order, fromSource, highlight, build, userType, orderSort, pn, ps, now)\n\tif err != nil {\n\t\tlog.Error(\"%+v\", err)\n\t\treturn\n\t}\n\tif len(user) == 0 {\n\t\treturn\n\t}\n\tres.Items = make([]*search.Item, 0, len(user))\n\tfor _, u := range user {\n\t\tres.Items = append(res.Items, &search.Item{Mid: u.Mid, Name: u.Name, Face: u.Pic})\n\t}\n\treturn\n}", "title": "" }, { "docid": "ee450be19ba8d981e345250fd3767ca8", "score": "0.6120366", "text": "func search(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {\n\t// Upgrades the connection to a websocket and checks for fb.Errors.\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer conn.Close()\n\n\tvar (\n\t\tvalue string\n\t\tsearch *searchOptions\n\t\tmessage []byte\n\t)\n\n\t// Starts an infinite loop until a valid command is captured.\n\tfor {\n\t\t_, message, err = conn.ReadMessage()\n\t\tif err != nil {\n\t\t\treturn http.StatusInternalServerError, err\n\t\t}\n\n\t\tif len(message) != 0 {\n\t\t\tvalue = string(message)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tsearch = parseSearch(value)\n\tscope := strings.TrimPrefix(r.URL.Path, \"/\")\n\tscope = \"/\" + scope\n\tscope = c.User.Scope + scope\n\tscope = strings.Replace(scope, \"\\\\\", \"/\", -1)\n\tscope = filepath.Clean(scope)\n\n\terr = filepath.Walk(scope, func(path string, f os.FileInfo, err error) error {\n\t\tif search.CaseInsensitive {\n\t\t\tpath = strings.ToLower(path)\n\t\t}\n\n\t\tpath = strings.TrimPrefix(path, scope)\n\t\tpath = strings.TrimPrefix(path, \"/\")\n\t\tpath = strings.Replace(path, \"\\\\\", \"/\", -1)\n\n\t\t// Only execute if there are conditions to meet.\n\t\tif len(search.Conditions) > 0 {\n\t\t\tmatch := false\n\n\t\t\tfor _, t := range search.Conditions {\n\t\t\t\tif t(path) {\n\t\t\t\t\tmatch = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If doesn't meet the condition, go to the next.\n\t\t\tif !match {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tif len(search.Terms) > 0 {\n\t\t\tis := false\n\n\t\t\t// Checks if matches the terms and if it is allowed.\n\t\t\tfor _, term := range search.Terms {\n\t\t\t\tif is {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif strings.Contains(path, term) {\n\t\t\t\t\tif !c.User.Allowed(path) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\n\t\t\t\t\tis = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !is {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tresponse, _ := json.Marshal(map[string]interface{}{\n\t\t\t\"dir\": f.IsDir(),\n\t\t\t\"path\": path,\n\t\t})\n\n\t\treturn conn.WriteMessage(websocket.TextMessage, response)\n\t})\n\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "729ecec76f45cfeba1d83a568f0f45ad", "score": "0.6088404", "text": "func Search(w http.ResponseWriter, r *http.Request) {\n\tid := identity.CurrentSession(r)\n\tq := r.URL.Query()\n\n\tquery := q.Get(\"query\")\n\tlog.Debug(\"Looking for nodes with query \", query)\n\tif strings.Contains(query, \"/\") {\n\t\tresponse := []SearchResult{}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(&response)\n\t\treturn\n\t}\n\n\tnodes, err := db.SearchNodesByName(query, id.Username, id.Organizations)\n\tif err != nil {\n\t\tlog.Error(\"Failed to search for nodes: \", err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tresponse := make([]SearchResult, len(nodes))\n\tfor i, node := range nodes {\n\t\tisShared := node.Path[:strings.Index(node.Path, \"/\")] == id.Username\n\t\tnodeInfo, err := os.Stat(db.GetSetting(db.DAV_ROOT) + node.Path)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Could not get node info: \", err)\n\t\t\tcontinue\n\t\t}\n\t\tvar shareNode *db.Share\n\t\tif isShared {\n\t\t\tfor _, target := range append(id.Organizations, id.Username) {\n\t\t\t\tshareNode, err = db.GetNodeShareToTarget(node.ID, target)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Failed to get share on node %v to target %v\", node.ID, target)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif shareNode != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpermissionString := \"27\"\n\t\tif node.Isdir {\n\t\t\tpermissionString = \"31\"\n\t\t}\n\t\tif shareNode != nil {\n\t\t\tpermissionString = strconv.Itoa(shareNode.Permissions)\n\t\t}\n\t\ttypeString := \"file\"\n\t\tif node.Isdir {\n\t\t\ttypeString = \"folder\"\n\t\t}\n\t\tnodePath := node.Path[strings.Index(node.Path, \"/\")+1:]\n\t\tnodePath = nodePath[strings.Index(nodePath, \"/\")+1:]\n\n\t\tvar linkDir string\n\t\tif strings.Contains(nodePath, \"/\") {\n\t\t\tlinkDir = nodePath[:strings.LastIndex(nodePath, \"/\")]\n\t\t}\n\t\tlink := fmt.Sprintf(\"/index.php/apps/files/?dir=/%v&scrollto=%v\", linkDir, node.Path[strings.LastIndex(node.Path, \"/\")+1:])\n\n\t\tsr := SearchResult{\n\t\t\tId: strconv.FormatFloat(node.ID, 'e', -1, 64),\n\t\t\tLink: link,\n\t\t\tMime: node.MimeType,\n\t\t\tModified: strconv.Itoa(int(nodeInfo.ModTime().Unix())),\n\t\t\tName: nodeInfo.Name(),\n\t\t\tPath: nodePath,\n\t\t\tPermissions: permissionString,\n\t\t\tSize: strconv.Itoa(int(nodeInfo.Size())),\n\t\t\tType: typeString,\n\t\t}\n\t\tresponse[i] = sr\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(&response)\n}", "title": "" }, { "docid": "2909909b06ef922474ac3b1bbff174f6", "score": "0.60639465", "text": "func (m *Client) SearchUsers(arg0 context.Context, arg1 *zendesk.SearchUsersOptions) ([]zendesk.User, zendesk.Page, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SearchUsers\", arg0, arg1)\n\tret0, _ := ret[0].([]zendesk.User)\n\tret1, _ := ret[1].(zendesk.Page)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "69f3cab826333931bbce6263111e409e", "score": "0.6035321", "text": "func (h *HLTBClient) SearchUsersByQuery(q *HLTBQuery) (*UserResultsPage, error) {\n\treturn userSearch(h, q)\n}", "title": "" }, { "docid": "5c4e6a9a9bd59555867fdbefbc514a42", "score": "0.6034517", "text": "func (i *InstaClient) SearchUser(queryString string, options map[string]string) (*SearchResult, error) {\n\tif len(queryString) == 0 {\n\t\treturn nil, errors.New(\"query string cannot be empty\")\n\t}\n\n\toptions[\"q\"] = queryString // add query string to options map\n\tsearchResult := new(SearchResult)\n\terr := i.getRequest(base+\"/users/search\", options, searchResult)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn searchResult, nil\n}", "title": "" }, { "docid": "b4b6cde6eff549821086192065b922f4", "score": "0.6029863", "text": "func (c *Admin) Search(params cmap.CMap) (datas []*Admin, pager result.Pager, err error) {\n\t//var datas []*Admin\n\tcrud.Params(gt.Data(&datas))\n\tcd := crud.GetBySearch(params)\n\tif cd.Error() != nil {\n\t\treturn nil, pager, cd.Error()\n\t}\n\tpager.Pager = cd.Pager()\n\treturn datas, pager, nil\n}", "title": "" }, { "docid": "9a5eeb4c6ce60e647a419deb1909226f", "score": "0.6017452", "text": "func (kph *keePassHTTP) Search(filter *Filter) (credentials []*Credential, err error) {\n\tresult, err := kph.request(&body{\n\t\tRequestType: \"get-logins\",\n\t\tUrl: filter.Url,\n\t\tSubmitUrl: filter.SubmitUrl,\n\t\tRealm: filter.Realm,\n\t})\n\tif err == nil {\n\t\tkph.getCredentials(result, &credentials)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7877633aaf2dcded81a213086b2162c9", "score": "0.59742343", "text": "func (self *LdapSearchApp) Search() (*openldap.LdapSearchResult, error){\n\n\t//FIXME: should be an external option\n\tscope := openldap.LDAP_SCOPE_SUBTREE\n\n\treturn self.ldap.SearchAll(\n\t\tself.opts.base, \n\t\tscope, \n\t\tself.opts.filter, \n\t\tself.opts.attributes)\n}", "title": "" }, { "docid": "02ec70c1a7285011e370f311af8f708c", "score": "0.597127", "text": "func (p *Parser) SearchUser(query model.UserQuery) ([]model.UserSearch, int, error) {\n\tq := map[string]interface{}{\n\t\t\"q\": query.Username,\n\t\t\"show\": 24 * (query.Page - 1),\n\t\t\"loc\": query.Location,\n\t\t\"agelow\": query.MinAge,\n\t\t\"agehigh\": query.MaxAge,\n\t\t\"g\": query.Gender,\n\t}\n\tdoc, code, err := p.getDoc(utils.BuildURLWithQuery(q, malURL, \"users.php\"), \"#content\")\n\tif err != nil {\n\t\treturn nil, code, err\n\t}\n\treturn p.search.GetUser(doc), http.StatusOK, nil\n}", "title": "" }, { "docid": "016edbd2f56dec5efa80e079b5ebaf0b", "score": "0.59681654", "text": "func (m *FeedDAO) Search(keyword string, limit int) ([]searchResult, error)", "title": "" }, { "docid": "aa1a343c5e57161e7e0d3243d7ab05f2", "score": "0.59395427", "text": "func search(client pb.TwitterClient, query string) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\treq := &pb.Search{Token: getToken(), Text: query}\n\tstream, err := client.Filter(ctx, req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor {\n\t\tres, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\tfmt.Println(\"Search ended :O\")\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Printf(\"%v : %s \\n\", res.User.ScreenName, res.Text)\n\t}\n}", "title": "" }, { "docid": "bf9c5c220120ca5a627df0e11a7551ff", "score": "0.5936601", "text": "func (h *Handlers) Search(w http.ResponseWriter, r *http.Request) {\n\tinput, err := buildSearchInput(r.URL.Query())\n\tif err != nil {\n\t\th.logger.Error().Err(err).Str(\"query\", r.URL.RawQuery).Str(\"method\", \"Search\").Msg(\"invalid query\")\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tdataJSON, err := h.pkgManager.SearchJSON(r.Context(), input)\n\tif err != nil {\n\t\th.logger.Error().Err(err).Str(\"query\", r.URL.RawQuery).Str(\"method\", \"Search\").Send()\n\t\tif errors.Is(err, pkg.ErrInvalidInput) {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t} else {\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\thelpers.RenderJSON(w, dataJSON, helpers.DefaultAPICacheMaxAge)\n}", "title": "" }, { "docid": "0da8cf3f365ceb4a524bb930d373a37b", "score": "0.5936396", "text": "func (as *API) Search(ctx context.Context, req *pbreq.Search) (*pbresp.Results, error) {\n\tobjects, err := as.lens.KeywordSearch(req.Keywords)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar objs = make([]*pbresp.Object, len(objects))\n\tfor _, v := range objects {\n\t\tobjs = append(objs, &pbresp.Object{\n\t\t\tName: v.Name,\n\t\t\tMimeType: v.MetaData.MimeType,\n\t\t\tCategory: v.MetaData.Category,\n\t\t})\n\t}\n\n\treturn &pbresp.Results{\n\t\tObjects: objs,\n\t}, nil\n}", "title": "" }, { "docid": "1fe4cd7deb9a720e5e207199b88e621e", "score": "0.5922869", "text": "func (m defaultMatcher) Search(feed *Feed, searchTerm string) ([]*Result, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "261c131402051e242b881f4384a9dde8", "score": "0.59166205", "text": "func Search(w http.ResponseWriter, r *http.Request) {\n\tq := r.URL.Query()\n\n\tif keywords, ok := q[\"keyword\"]; ok {\n\t\tsearch := keywords[0]\n\n\t\tproducts, err := lib.Search(search)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tbytes, err := helpers.JSONMarshal(products, true)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tfmt.Fprintf(w, \"%s\", bytes)\n\t}\n}", "title": "" }, { "docid": "534bd519f62387d88aaa334ccd1f7114", "score": "0.59083724", "text": "func Search(query string) (name, infohash string) {\n\tfor providerKey, _ := range providers {\n\t\tname, infohash = SearchProvider(query, providerKey)\n\t}\n\treturn name, infohash\n}", "title": "" }, { "docid": "0722da514586de496945dbb4178899e5", "score": "0.5908095", "text": "func Search(query string) ([]Result, error) {\n\tlog.Println(\"serial search\")\n\tresults := []Result{\n\t\tWeb(query),\n\t\tImage(query),\n\t\tVideo(query),\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "39052b167516f37d7dae4b5b233ebb80", "score": "0.5894472", "text": "func SearchServer(w http.ResponseWriter, r *http.Request) {\n\treq := r.URL.Query()\n\tvar (\n\t\tquery = req.Get(\"query\")\n\t\torderBy = req.Get(\"order_by\")\n\t\torderField = req.Get(\"order_field\")\n\t\tlimit = req.Get(\"limit\")\n\t\toffset = req.Get(\"offset\")\n\t)\n\n\t// Check client credentials.\n\tif r.Header.Get(\"AccessToken\") != allowedAccessToken {\n\t\tlog.Printf(\"inconsist access attempt: %v\\n\", r.RemoteAddr)\n\t\tpushError(w, errAuth, http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\t// Read data xml-file and close it.\n\tfile, err := os.Open(\"dataset.xml\")\n\tif err != nil {\n\t\tlog.Printf(\"opening file was failed: %v\\n\", err)\n\t\tpushError(w, errSource, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\t// Read opened file in byte slice\n\t// TO-DO : Buffered parse and search \"query\" inplace!\n\tbyteSlice, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tlog.Printf(\"reading file was failed: %v\\n\", err)\n\t\tpushError(w, errSource, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Unmarshaling in user struct.\n\tusers := UserSet{}\n\terr = xml.Unmarshal(byteSlice, &users)\n\tif err != nil {\n\t\tlog.Printf(\"decoding file was failed: %v\\n\", err)\n\t\tpushError(w, errSource, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trequired, ok := users.Require(query)\n\tif !ok {\n\t\tlog.Println(\"quary not matched, empty result\")\n\t}\n\n\t// Sort required users.\n\tsorted, err := Sort(required, orderBy, orderField)\n\tif err != nil {\n\t\tlog.Printf(\"can't sorting reqired set: %v\\n\", err)\n\t\tpushError(w, errSorting, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Paginate resopnse.\n\tlimited, err := Limit(sorted, limit, offset)\n\tif err != nil {\n\t\tlog.Printf(\"can't paginate reqired set: %v\\n\", err)\n\t\tpushError(w, errPaginate, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = pushResponse(w, limited)\n\tif err != nil {\n\t\tpushError(w, err, http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "2f9938e3b87fd94dc73c7e8e12df0115", "score": "0.58891827", "text": "func (i ItunesUpstream) Search(search string) ([]*data.Item, error) {\n\tvar err error\n\tvar response *itunes.Response\n\n\treportDuration(\n\t\tfunc() {\n\t\t\tresponse, err = i.itunes.Search(search)\n\t\t},\n\t\ti.o,\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar items []*data.Item\n\n\tfor _, item := range response.Results {\n\t\titems = append(items, &data.Item{\n\t\t\tTitle: item.TrackName,\n\t\t\tType: \"music\",\n\t\t\tCreators: []string{item.ArtistName},\n\t\t})\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "b7404eb9037a16cc947f1ec9630ab249", "score": "0.58880657", "text": "func (w *ServerInterfaceWrapper) SearchUsers1(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.SearchUsers1(ctx)\n\treturn err\n}", "title": "" }, { "docid": "c8624bc48b49916b228972afa81472f9", "score": "0.5884985", "text": "func (service *RssService) Search(searchString string, isBookmark bool, feedID int64, userID int64) *models.ArticlesJSON {\n\tvar articles []models.Articles\n\tquery := service.db.\n\t\tJoins(\"join feeds on articles.FeedId = feeds.Id\").\n\t\tSelect(\"articles.Id, articles.Title, articles.IsBookmark, articles.IsRead, articles.Link\").\n\t\tWhere(\"(articles.Title LIKE ? OR articles.Body LIKE ?) and feeds.UserId = ?\", \"%\"+searchString+\"%\", \"%\"+searchString+\"%\", userID)\n\n\tif feedID != 0 {\n\t\tquery = query.Where(&models.Articles{Id: feedID})\n\t}\n\tif isBookmark {\n\t\tquery = query.Where(\"articles.IsBookmark = 1\")\n\t}\n\n\tquery.Find(&articles)\n\n\treturn &models.ArticlesJSON{Articles: articles}\n}", "title": "" }, { "docid": "0694e7f315ed2661faa65a00ed38bcb1", "score": "0.5864453", "text": "func Search(cmd *cobra.Command, args []string) {\n\t//*TODO* Update with the new serializer option\n\tlog.Debug(\"Search subcommand run with log level: \", Verbose, \"\\n\")\n\n\tif len(args) > 0 {\n\t\tif args[0] != \"\" {\n\t\t\tsearchTerm = args[0]\n\t\t}\n\t}\n\tif len(args) > 1 {\n\t\tif args[1] != \"\" {\n\t\t\tgobFile = args[1]\n\t\t}\n\t}\n\n\tnp := persister.NewPersistor(persister.GOB)\n\terr := np.Load(gobFile, &data)\n\tif err != nil {\n\t\tlog.Errorf(\"error loading gob file: %v\", err)\n\t}\n\n\tfilters, urls, names := data.F, data.U, data.N\n\n\tvar found []interface{}\n\t// iterate through the filters and return indices of matches\n\tfor i, v := range filters {\n\t\tfilter, _ := cuckoo.Decode(v)\n\t\tif filter.Lookup([]byte(searchTerm)) {\n\t\t\tif len(found) >= rslts {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfound = append(found, Result{\n\t\t\t\tName: names[i],\n\t\t\t\tURL: urls[i],\n\t\t\t})\n\t\t}\n\t}\n\n\tif !nostd {\n\t\t// ** PRETTY OUTPUT FOR USE AT COMMAND LINE **\n\t\tfoundJSON, err := json.MarshalIndent(found, \"\", \" \")\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error in marshalling the found results: %v\", err)\n\t\t}\n\t\tfmt.Printf(\"Search Results:\\n %s\\n\", string(foundJSON))\n\t}\n\n}", "title": "" }, { "docid": "8e74c6e3ac3e5a545e27bf2241d6566a", "score": "0.5839591", "text": "func (w *Watch) search() (*ldap.SearchResult, error) {\n\treturn w.watcher.conn.Search(w.searchRequest)\n}", "title": "" }, { "docid": "7285350fae853cc329246e8fb48a804e", "score": "0.5828891", "text": "func (l *lib) Search(params *Params) (*Result, *Response, error) {\n\tp := twitter.SearchTweetParams(*params)\n\n\tif search, response, err := l.client.Search.Tweets(&p); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"failed to search twitter\")\n\t} else {\n\t\treturn search, new(Response).FromHttpResponse(response), nil\n\t}\n}", "title": "" }, { "docid": "59430bea64c66acdd4f1696ee1335de8", "score": "0.58226323", "text": "func Search(param string) {\n\tfmt.Printf(\"Searching: %v...\\n\", param)\n\tpayload := domain.HttpRequestParam{\n\t\tMethod: \"GET\",\n\t\tURL: domain.BaseRoute + fmt.Sprintf(\"/REST/rxcui.json?name=%s&search=1\", url.QueryEscape(param)),\n\t\tHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Bearer \",\n\t\t},\n\t}\n\n\tresp, err := MakeHttpRequest(payload)\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err.Error())\n\t}\n\tdata := make(map[string]interface{})\n\n\terr = json.Unmarshal(resp, &data)\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err.Error())\n\t}\n\n\t//pretty print data\n\tm, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Printf(\"error: %v\\n\", err.Error())\n\t}\n\tfmt.Printf(\"%v\\n\", string(m))\n}", "title": "" }, { "docid": "e58098264bdc61ee7f3e0f20f1a2c545", "score": "0.58101404", "text": "func Search(query string) ([]Place, error) {\n\treturn DefaultClient.Search(query)\n}", "title": "" }, { "docid": "eb6c2be3187f3792d46791373ff6aa5f", "score": "0.57994175", "text": "func (s UserSet) SearchRead(params webtypes.SearchParams) []models.RecordData {\n\tres := s.Collection().Call(\"SearchRead\", params)\n\tresTyped, _ := res.([]models.RecordData)\n\treturn resTyped\n}", "title": "" }, { "docid": "1a226a375aec28afb6ae8ab533b297ef", "score": "0.57989377", "text": "func (m Model) Search(query string) []Result {\n\tvar results []Result\n\n\twords := Tokenize(query)\n\tif len(words) == 0 {\n\t\treturn results\n\t}\n\n\t// main search query\n\tif err := m.PG.Model(&Occurence{}).\n\t\tColumnExpr(\"(SELECT name FROM files WHERE id = occurence.file_id) as file_name\").\n\t\tColumnExpr(\"SUM(occurence.count) as sum\").\n\t\tColumnExpr(\"array_agg(occurence.word_id) as words\").\n\t\tJoin(\"JOIN words on occurence.word_id = words.id\").\n\t\tWhere(\"words.word in (?)\", pg.In(words)).\n\t\tGroup(\"occurence.file_id\").\n\t\tOrder(\"sum DESC\").\n\t\tSelect(&results); err != nil {\n\t\tlog.Println(err.Error())\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "e4f57fd3776b1ea6ace55dc0716eb0d0", "score": "0.57987", "text": "func (self *SearchService) Search(params *SearchRequest) (*Search, *http.Response, error) {\n\tsearch := new(Search)\n\tapiError := new(APIError)\n\n\tresp, err := self.api.New().QueryStruct(params).Receive(search, apiError)\n\treturn search, resp, relevantError(err, *apiError)\n}", "title": "" }, { "docid": "b180886f69d218c8022fec07869a1958", "score": "0.5797452", "text": "func (a SearchApi) PostUsersSearch(body Usersearchrequest) (*Userssearchresponse, *APIResponse, error) {\n\tvar httpMethod = \"POST\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/users/search\"\n\tdefaultReturn := new(Userssearchresponse)\n\tif true == false {\n\t\treturn defaultReturn, nil, errors.New(\"This message brought to you by the laws of physics being broken\")\n\t}\n\n\t// verify the required parameter 'body' is set\n\tif &body == nil {\n\t\t// false\n\t\treturn defaultReturn, nil, errors.New(\"Missing required parameter 'body' when calling SearchApi->PostUsersSearch\")\n\t}\n\n\theaderParams := make(map[string]string)\n\tqueryParams := make(map[string]string)\n\tformParams := url.Values{}\n\tvar postBody interface{}\n\tvar postFileName string\n\tvar fileBytes []byte\n\t// authentication (PureCloud OAuth) required\n\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\t\n\n\t// Find an replace keys that were altered to avoid clashes with go keywords \n\tcorrectedQueryParams := make(map[string]string)\n\tfor k, v := range queryParams {\n\t\tif k == \"varType\" {\n\t\t\tcorrectedQueryParams[\"type\"] = v\n\t\t\tcontinue\n\t\t}\n\t\tcorrectedQueryParams[k] = v\n\t}\n\tqueryParams = correctedQueryParams\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\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\t// body params\n\tpostBody = &body\n\n\tvar successPayload *Userssearchresponse\n\tresponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, postFileName, fileBytes)\n\tif err != nil {\n\t\t// Nothing special to do here, but do avoid processing the response\n\t} else if err == nil && response.Error != nil {\n\t\terr = errors.New(response.ErrorMessage)\n\t} else if response.HasBody {\n\t\tif \"Userssearchresponse\" == \"string\" {\n\t\t\tcopy(response.RawBody, &successPayload)\n\t\t} else {\n\t\t\terr = json.Unmarshal(response.RawBody, &successPayload)\n\t\t}\n\t}\n\treturn successPayload, response, err\n}", "title": "" }, { "docid": "cfa90421e5a6b41a735dcb7badb907ec", "score": "0.5777027", "text": "func SearchMember(w http.ResponseWriter, r *http.Request) {\n\tvar data []SearchRequest\n var payload ResponseValues\n\n enc := json.NewEncoder(w)\n enc.SetIndent(\"\", \" \")\n\n // Decodes the request body\n\terr := json.NewDecoder(r.Body).Decode(&data)\n\tif err != nil {\n writeError(w, &enc, &payload, http.StatusBadRequest, \"Invalid request data format\")\n return\n\t}\n\n // Validates the incoming request data\n validated := validateRequestData(data)\n if !validated {\n writeError(w, &enc, &payload, http.StatusBadRequest, \"Invalid request data format\")\n return\n }\n\n // Uses request body data to build the elastic query body\n\telasticQueryBody, err := buildElasticQuery(data)\n\tif err != nil {\n writeError(w, &enc, &payload, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n // Queries the elastic service\n payload, err = elasticService.QueryElasticService(elasticQueryBody)\n if err != nil {\n writeError(w, &enc, &payload, http.StatusBadRequest, payload.Error)\n return\n }\n\n w.Header().Set(\"Content-Type\", \"application/json\")\n w.WriteHeader(http.StatusOK)\n enc.Encode(payload)\n\n\treturn\n}", "title": "" }, { "docid": "6248ae4b35ac57d64308f191b7eb4898", "score": "0.5755892", "text": "func GetUsers(w http.ResponseWriter, r *http.Request) {\n\tloginOrName := strings.ToLower(r.URL.Query().Get(\"user\"))\n\n\tdb, err := database.Connect()\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\trepository := repository.NewRepositoryUser(db)\n\n\tusers, err := repository.SearchByLoginOrName(loginOrName)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusOK, users)\n\n}", "title": "" }, { "docid": "dff856c381a247742fd9bd0d44d2c3aa", "score": "0.575024", "text": "func (dao *sqlimpl) Search(metaIds []string, nodeUuids []string, namespace string, ownerSubject string, resourceQuery *service.ResourcePolicyQuery) (result []*idm.UserMeta, e error) {\n\n\tvar wheres []goqu.Expression\n\n\tpolicyQ, e := dao.BuildPolicyConditionForAction(resourceQuery, service.ResourcePolicyAction_READ)\n\tif e != nil {\n\t\treturn\n\t}\n\tif policyQ != nil {\n\t\twheres = append(wheres, policyQ)\n\t}\n\n\tif len(metaIds) > 0 {\n\t\tvar ors []goqu.Expression\n\t\tfor _, metaId := range metaIds {\n\t\t\tors = append(ors, goqu.I(\"uuid\").Eq(metaId))\n\t\t}\n\t\twheres = append(wheres, goqu.Or(ors...))\n\t}\n\tif len(nodeUuids) > 0 {\n\t\tvar ors []goqu.Expression\n\t\tfor _, nodeId := range nodeUuids {\n\t\t\tors = append(ors, goqu.I(\"node_uuid\").Eq(nodeId))\n\t\t}\n\t\twheres = append(wheres, goqu.Or(ors...))\n\t}\n\tif namespace != \"\" {\n\t\twheres = append(wheres, goqu.I(\"namespace\").Eq(namespace))\n\t}\n\tif ownerSubject != \"\" {\n\t\twheres = append(wheres, goqu.I(\"owner\").Eq(ownerSubject))\n\t}\n\tif len(wheres) == 0 {\n\t\treturn\n\t}\n\n\tq, _, err := goqu.New(dao.Driver(), nil).From(\"idm_usr_meta\").Where(goqu.And(wheres...)).ToSql()\n\tif err != nil {\n\t\te = err\n\t\treturn\n\t}\n\n\tres, err := dao.DB().Query(q)\n\tif err != nil {\n\t\te = err\n\t\treturn\n\t}\n\tdefer res.Close()\n\tfor res.Next() {\n\t\tuserMeta := new(idm.UserMeta)\n\t\tvar owner string\n\t\tvar format string\n\t\tvar lastUpdated int32\n\t\tif err := res.Scan(\n\t\t\t&userMeta.Uuid,\n\t\t\t&userMeta.NodeUuid,\n\t\t\t&userMeta.Namespace,\n\t\t\t&owner,\n\t\t\t&lastUpdated,\n\t\t\t&format,\n\t\t\t&userMeta.JsonValue,\n\t\t); err != nil {\n\t\t\treturn result, err\n\t\t}\n\n\t\tif policies, e := dao.GetPoliciesForResource(userMeta.Uuid); e == nil {\n\t\t\tuserMeta.Policies = policies\n\t\t} else {\n\t\t\tlog.Logger(context.Background()).Error(\"cannot load resource policies for uuid: \"+userMeta.Uuid, zap.Error(e))\n\t\t}\n\t\tresult = append(result, userMeta)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7e8fdf1da7b8ff6aab2b21cb40d97fa6", "score": "0.5727338", "text": "func (s UserSet) NameSearch(params webtypes.NameSearchParams) []webtypes.RecordIDWithName {\n\tres := s.Collection().Call(\"NameSearch\", params)\n\tresTyped, _ := res.([]webtypes.RecordIDWithName)\n\treturn resTyped\n}", "title": "" }, { "docid": "82e515e6d62a4689242c589a8c184c12", "score": "0.5723468", "text": "func (c *Client) Search(keyword string) ([]Movie, error) {\n\treturn []Movie{}, fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "83fe9baac949e4d78759f19567d67c31", "score": "0.571892", "text": "func (repository Posts) SearchByUser(userID uint64) ([]models.Post, error) {\n\trows, err := repository.db.Query(\n\t\t`SELECT p.*, u.username FROM posts p\n\t\tJOIN users u on u.id = p.author_id\n\t\tWHERE p.author_id = ?`,\n\t\tuserID,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar posts []models.Post\n\tfor rows.Next() {\n\t\tvar post models.Post\n\n\t\tif err = 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.AuthorID,\n\t\t\t&post.Likes,\n\t\t\t&post.CreatedOn,\n\t\t\t&post.AuthorUsername,\n\t\t); 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": "f2c31e42bba40bca4edec746b676db24", "score": "0.5717255", "text": "func (a *Api) Search(q string, limit int) (*SearchResult, error) {\n\tif limit == 0 {\n\t\tlimit = 20\n\t}\n\tparams := *a.defaultParams()\n\tdelete(params, \"UserId\")\n\tdelete(params, \"DeviceId\")\n\tparams[\"SearchTerm\"] = q\n\tparams[\"Limit\"] = fmt.Sprint(limit)\n\tparams.setIncludeTypes(mediaTypeSong)\n\n\tbody, err := a.get(\"/Search/Hints\", &params)\n\tif err != nil {\n\t\tmsg := getBodyMsg(body)\n\t\treturn nil, fmt.Errorf(\"query failed: %v: %s\", err, msg)\n\t}\n\tresult := &SearchResult{}\n\terr = json.NewDecoder(body).Decode(result)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"json parsing failed: %v\", err)\n\t}\n\n\tif len(result.Items) > 0 {\n\t\tfor i, _ := range result.Items {\n\t\t\tresult.Items[i].Duration /= 10000000\n\t\t}\n\t}\n\n\treturn result, err\n}", "title": "" }, { "docid": "391a7dc8c750de3c1c8a59447e349c2d", "score": "0.570268", "text": "func (c Client) Search() search.Client {\n\treturn search.NewClient(c...)\n}", "title": "" }, { "docid": "942ac6727536de63badc887a15acfab7", "score": "0.56937176", "text": "func (c *Client) Search(ctx context.Context, password string, opts ...grpc.CallOption) (count int, err error) {\n\tdigest := sha1.Sum([]byte(password))\n\tprefix, suffix := pwned.SplitDigest(digest)\n\n\tresp, err := c.pc.Range(ctx, &pb.RangeRequest{\n\t\tPrefix: prefix,\n\t}, opts...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif len(resp.Results)%(pwned.SuffixSize+1) != 0 {\n\t\treturn 0, errors.New(\"pwned: invalid result set returned\")\n\t}\n\n\treturn pwned.SearchSet(resp.Results, suffix), nil\n}", "title": "" }, { "docid": "54d3d31cd1965cfd42dda19c3003da47", "score": "0.56882995", "text": "func (c *Client) Search(term string) ([]RantModel, error) {\n\turl := fmt.Sprintf(SEARCH_PATH, API, term, APP_VERSION)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar data SearchResponse\n\tjson.NewDecoder(res.Body).Decode(&data)\n\tif !data.Success && data.Error != \"\" {\n\t\treturn nil, errors.New(data.Error)\n\t}\n\treturn data.Rants, nil\n}", "title": "" }, { "docid": "59436cb73638b551d43b08252d7c9036", "score": "0.568827", "text": "func (r SearchUsersRequest) Send() (*SearchUsersOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*SearchUsersOutput), nil\n}", "title": "" }, { "docid": "a62d878e4587f50c446a435f7f5028be", "score": "0.5685238", "text": "func (ag Aggregator) Search(query string) (Results, error) {\n\tvar (\n\t\tret Results\n\t\txts = make(map[string]bool)\n\t)\n\tfor _, s := range ag.searchers {\n\t\tlist, err := s.Search(query)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, r := range list {\n\t\t\tvar dup bool\n\t\t\tfor _, xt := range parseExactTopics(r.MagnetURL) {\n\t\t\t\tif xts[xt] {\n\t\t\t\t\tdup = true\n\t\t\t\t}\n\t\t\t\txts[xt] = true\n\t\t\t}\n\t\t\tif !dup {\n\t\t\t\tret = append(ret, r)\n\t\t\t}\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "0fbbe2a0204930fc5cdef7dadbfe8657", "score": "0.56790614", "text": "func (p *Plex) Search(title string) (SearchResults, error) {\n\tif title == \"\" {\n\t\treturn SearchResults{}, errors.New(\"ERROR: A title is required\")\n\t}\n\n\trequestInfo.headers.Token = p.token\n\n\ttitle = url.QueryEscape(title)\n\tquery := p.URL + \"/search?query=\" + title\n\n\tvar results SearchResults\n\n\tresp, respErr := requestInfo.get(query)\n\n\tif respErr != nil {\n\t\treturn SearchResults{}, respErr\n\t}\n\n\t// Unauthorized\n\tif resp.StatusCode == 401 {\n\t\treturn SearchResults{}, errors.New(\"You are not authorized to access that server\")\n\t}\n\n\tdefer resp.Body.Close()\n\n\terr := json.NewDecoder(resp.Body).Decode(&results)\n\n\tif err != nil {\n\t\treturn SearchResults{}, err\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "8c3b19f026f8329bf8c60c08dbbdf52e", "score": "0.5675978", "text": "func (s *Service) Search(term string, authConfig *AuthConfig, headers map[string][]string) (*SearchResults, error) {\n\trepoInfo, err := s.ResolveRepository(term)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// *TODO: Search multiple indexes.\n\tendpoint, err := repoInfo.GetEndpoint()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr, err := NewSession(authConfig, HTTPRequestFactory(headers), endpoint, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.SearchRepositories(repoInfo.GetSearchTerm())\n}", "title": "" }, { "docid": "c31c40e4ed0cf617b3afae54c42c851a", "score": "0.5668062", "text": "func searchSongs(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n criteria := pat.Param(ctx, \"searchCriteria\")\n result := searchSongsDA(criteria)\n fmt.Fprintf(w, result)\n}", "title": "" }, { "docid": "e294df0b644fc63766093231b6e4ea5b", "score": "0.56502926", "text": "func (a UsersApi) PostUsersSearch(body Usersearchrequest) (*Userssearchresponse, *APIResponse, error) {\n\tvar httpMethod = \"POST\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/users/search\"\n\tdefaultReturn := new(Userssearchresponse)\n\tif true == false {\n\t\treturn defaultReturn, nil, errors.New(\"This message brought to you by the laws of physics being broken\")\n\t}\n\n\t// verify the required parameter 'body' is set\n\tif &body == nil {\n\t\t// false\n\t\treturn defaultReturn, nil, errors.New(\"Missing required parameter 'body' when calling UsersApi->PostUsersSearch\")\n\t}\n\n\theaderParams := make(map[string]string)\n\tqueryParams := make(map[string]string)\n\tformParams := url.Values{}\n\tvar postBody interface{}\n\tvar postFileName string\n\tvar fileBytes []byte\n\t// authentication (PureCloud OAuth) required\n\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\t\n\n\t// Find an replace keys that were altered to avoid clashes with go keywords \n\tcorrectedQueryParams := make(map[string]string)\n\tfor k, v := range queryParams {\n\t\tif k == \"varType\" {\n\t\t\tcorrectedQueryParams[\"type\"] = v\n\t\t\tcontinue\n\t\t}\n\t\tcorrectedQueryParams[k] = v\n\t}\n\tqueryParams = correctedQueryParams\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\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\t// body params\n\tpostBody = &body\n\n\tvar successPayload *Userssearchresponse\n\tresponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, postFileName, fileBytes)\n\tif err != nil {\n\t\t// Nothing special to do here, but do avoid processing the response\n\t} else if err == nil && response.Error != nil {\n\t\terr = errors.New(response.ErrorMessage)\n\t} else if response.HasBody {\n\t\tif \"Userssearchresponse\" == \"string\" {\n\t\t\tcopy(response.RawBody, &successPayload)\n\t\t} else {\n\t\t\terr = json.Unmarshal(response.RawBody, &successPayload)\n\t\t}\n\t}\n\treturn successPayload, response, err\n}", "title": "" }, { "docid": "e6277296914cc20fb94b3e97ef35e518", "score": "0.5640367", "text": "func Search() {\n\t// Add nodes\n\tclient := Client()\n\taddNodes(client)\n\t// Give the nodes time to end up in all of the data bases. An immediate search will show no nodes\n\ttime.Sleep(10 * time.Second)\n\n\t// List Indexes\n\tindexes, err := client.Search.Indexes()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue listing indexes \", err)\n\t}\n\tfmt.Printf(\"List indexes %+v EndIndex\\n\", indexes)\n\n\t// build an invalid seach query\n\tquery, err := client.Search.NewQuery(\"node\", \"name\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue building invalid query\", err)\n\t}\n\n\t// build a seach query\n\tquery, err = client.Search.NewQuery(\"node\", \"name:node*\")\n\tquery.Rows = 2\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue building query \", err)\n\t}\n\tfmt.Printf(\"List new query %+v\\n\", query)\n\n\t// Run the query\n\tres, err := query.Do(client)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running query \", err)\n\t}\n\tfmt.Printf(\"List nodes from query %+v\\n\", res)\n\n\t// Run the query, JSON output\n\tjres, err := query.DoJSON(client)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running query \", err)\n\t}\n\tfmt.Printf(\"List nodes from query JSON format %+v\\n\", jres)\n\n\t// Get the next page of results\n\tfmt.Printf(\"Query after the call %+v\\n\", query)\n\tquery.Start = query.Start + query.Rows\n\tres, err = query.Do(client)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running 2nd query \", err)\n\t}\n\tfmt.Printf(\"List 2nd set of nodes from query %+v\\n\", res)\n\n\t// Get the next page of results again, in JSON format\n\tquery.Start = query.Start - query.Rows\n\tjres, err = query.DoJSON(client)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running 2nd query \", err)\n\t}\n\tfmt.Printf(\"List 2nd set of nodes from query JSON format %+v\\n\", jres)\n\n\t// You can also use the service to run a query\n\tres, err = client.Search.Exec(\"node\", \"name:node1\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running Search.Exec() \", err)\n\t}\n\tfmt.Printf(\"List nodes from Exec query %+v\\n\", res)\n\t// dump out results back in json as an example\n\tfmt.Println(\"JSON output example\")\n\tjsonData, err := json.MarshalIndent(res, \"\", \"\\t\")\n\tos.Stdout.Write(jsonData)\n\tos.Stdout.WriteString(\"\\n\")\n\n\tres, err = client.Search.Exec(\"node\", \"name:*\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running Search.Exec() \", err)\n\t}\n\tfmt.Printf(\"List nodes from all nodes Exec query %+v\\n\", res)\n\n\t// You can also use the service to run a query JSON Format\n\tjres, err = client.Search.ExecJSON(\"node\", \"name:node1\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running Search.Exec() \", err)\n\t}\n\tfmt.Printf(\"List nodes from Exec query JSON format %+v\\n\", jres)\n\t// dump out results back in json as an example\n\tfmt.Println(\"JSON output example\")\n\tos.Stdout.WriteString(\"\\n\")\n\n\tjres, err = client.Search.ExecJSON(\"node\", \"name:*\")\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running Search.Exec() \", err)\n\t}\n\tfmt.Printf(\"List nodes from all nodes Exec query JSON format %+v\\n\", jres)\n\n\t// Partial search\n\tpart := make(map[string]interface{})\n\tpart[\"name\"] = []string{\"name\"}\n\tjpres, err := client.Search.PartialExecJSON(\"node\", \"*:*\", part)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running Search.PartialExec()\", err)\n\t}\n\tfmt.Printf(\"List nodes from partial search %+v\\n\", jpres)\n\n\t// Partial search JSON format\n\tpart = make(map[string]interface{})\n\tpart[\"name\"] = []string{\"name\"}\n\tjpres, err = client.Search.PartialExecJSON(\"node\", \"*:*\", part)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue running Search.PartialExec()\", err)\n\t}\n\tfmt.Printf(\"List nodes from partial search JSON format %+v\\n\", jpres)\n\tfor i, row := range jpres.Rows {\n\t\tfmt.Fprintf(os.Stdout, \"Partial search JSON format row: %v rawjson: %v\\n\", i, string(row.Data))\n\t}\n\n\t// Clean up nodes\n\tdeleteNodes(client)\n}", "title": "" }, { "docid": "b1d8c6d09075ee6a995d18506dc0f158", "score": "0.5637486", "text": "func Query(ctx context.Context, search *Search) ([]Result, error) {\n\t// Get fake user agent\n\tfakeUserAgent := browser.Chrome()\n\n\tif search.Num == 0 {\n\t\tsearch.Num = 10\n\t}\n\n\t// Build request\n\turlString := fmt.Sprintf(baseURL, url.QueryEscape(search.Q), search.Num, search.Start)\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", urlString, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"User-Agent\", fakeUserAgent)\n\tvar resp *http.Response\n\n\t// Do request\n\tif search.TryHard {\n\t\t// Use a proxy if default method fails\n\t\tif p == nil {\n\t\t\tp = proxier.New()\n\t\t\tp.TryNoProxyFirst = true\n\t\t}\n\t\tresp, err = p.DoRequest(ctx, req)\n\t} else {\n\t\tresp, err = http.DefaultClient.Do(req)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"invalid response code: %d\", resp.StatusCode)\n\t}\n\n\treturn parse(resp.Body)\n}", "title": "" }, { "docid": "6cf2fca16d9bf500829da51c96ec4996", "score": "0.5627072", "text": "func ByQueryWithUser(c *gin.Context, pagenum int) (search TorrentParam, tor []models.Torrent, count int, err error) {\n\tsearch, tor, count, err = ByQuery(c, pagenum, true, false, false)\n\treturn\n}", "title": "" }, { "docid": "ec6c3b70aeb249cb93d45e10768740ae", "score": "0.5625568", "text": "func (m *manager) List(ctx context.Context, query *q.Query) (models.Users, error) {\n\tquery = q.MustClone(query)\n\tif query.Sorting == \"\" {\n\t\tquery.Sorting = \"username\"\n\t}\n\n\texcludeAdmin := true\n\tfor key := range query.Keywords {\n\t\tstr := strings.ToLower(key)\n\t\tif str == \"user_id__in\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t} else if str == \"user_id\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif excludeAdmin {\n\t\t// Exclude admin account when not filter by UserIDs, see https://github.com/goharbor/harbor/issues/2527\n\t\tquery.Keywords[\"user_id__gt\"] = 1\n\t}\n\n\treturn m.dao.List(ctx, query)\n}", "title": "" }, { "docid": "e9245fd2c08ba93e575c779ffbbd78ad", "score": "0.56234115", "text": "func Search(w http.ResponseWriter, r *http.Request) {\r\n\tsearch := r.FormValue(\"search\")\r\n\tvar data = make(map[string]interface{})\r\n\r\n\t//search function with name\r\n\tf := map[string]string{\"name\": search}\r\n\tfs, err := models.GetFunc(&f)\r\n\ttrace(\"home.Search->\", err)\r\n\tif len(fs) != 0 {\r\n\t\tdata[\"func\"] = fs\r\n\t}\r\n\r\n}", "title": "" }, { "docid": "0c406ba9642cca7ea276af79977bed8d", "score": "0.5615645", "text": "func (s UserSet) SearchByName(name string, op operator.Operator, additionalCond q.UserCondition, limit int) m.UserSet {\n\tres := s.Collection().Call(\"SearchByName\", name, op, additionalCond, limit)\n\tresTyped := res.(models.RecordSet).Collection().Wrap(\"User\").(m.UserSet)\n\treturn resTyped\n}", "title": "" }, { "docid": "db222e88e177ac69a2939920b2737a82", "score": "0.56121206", "text": "func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, headers map[string][]string) ([]registry.SearchResult, error) {\n\tif err := searchFilters.Validate(acceptedSearchFilterTags); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO(thaJeztah): the \"is-automated\" field is deprecated; reset the field for the next release (v26.0.0). Return early when using \"is-automated=true\", and ignore \"is-automated=false\".\n\tisAutomated, err := searchFilters.GetBoolOrDefault(\"is-automated\", false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tisOfficial, err := searchFilters.GetBoolOrDefault(\"is-official\", false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thasStarFilter := 0\n\tif searchFilters.Contains(\"stars\") {\n\t\thasStars := searchFilters.Get(\"stars\")\n\t\tfor _, hasStar := range hasStars {\n\t\t\tiHasStar, err := strconv.Atoi(hasStar)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errdefs.InvalidParameter(errors.Wrapf(err, \"invalid filter 'stars=%s'\", hasStar))\n\t\t\t}\n\t\t\tif iHasStar > hasStarFilter {\n\t\t\t\thasStarFilter = iHasStar\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO(thaJeztah): the \"is-automated\" field is deprecated. Reset the field for the next release (v26.0.0) if any \"true\" values are present.\n\tunfilteredResult, err := s.searchUnfiltered(ctx, term, limit, authConfig, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfilteredResults := []registry.SearchResult{}\n\tfor _, result := range unfilteredResult.Results {\n\t\tif searchFilters.Contains(\"is-automated\") {\n\t\t\tif isAutomated != result.IsAutomated { //nolint:staticcheck // ignore SA1019 for old API versions.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif searchFilters.Contains(\"is-official\") {\n\t\t\tif isOfficial != result.IsOfficial {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif searchFilters.Contains(\"stars\") {\n\t\t\tif result.StarCount < hasStarFilter {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tfilteredResults = append(filteredResults, result)\n\t}\n\n\treturn filteredResults, nil\n}", "title": "" }, { "docid": "837c84a49213f12ecd314c043d145a3c", "score": "0.5610898", "text": "func (ai *AppInteractor) Search(id string) ([]domain.App, error) {\n\treturn ai.AppRepository.Search(id)\n}", "title": "" }, { "docid": "bfe6f24ada5f20df1811115d24bb027f", "score": "0.5610704", "text": "func (s *Server) Search(ctx context.Context, req *querypb.SearchRequest) (*internalpb.SearchResults, error) {\n\treturn s.querynode.Search(ctx, req)\n}", "title": "" }, { "docid": "e0733c030f8f4ebec5d52910bd89664b", "score": "0.56092364", "text": "func (req fedSearchRequest) search(logger log.Logger, searcher *searcher, searchType string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch searchType {\n\t\tcase ACH:\n\t\t\tachP, err := searcher.ACHFind(extractSearchLimit(r), req)\n\t\t\tif err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t}\n\t\t\tw = setResponseHeader(w)\n\t\t\tif err := json.NewEncoder(w).Encode(&searchResponse{ACHParticipants: achP}); err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase WIRE:\n\t\t\twireP, err := searcher.WIREFind(extractSearchLimit(r), req)\n\t\t\tif err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t}\n\t\t\tw = setResponseHeader(w)\n\t\t\tif err := json.NewEncoder(w).Encode(&searchResponse{WIREParticipants: wireP}); err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\n\t}\n}", "title": "" } ]
302e82f3a010bd957fa1595a440f78df
convert degrees to radians
[ { "docid": "e6a04953e2d12a0dd9e43230e8376d2b", "score": "0.72632647", "text": "func rad(deg float64) float64 {\n\treturn deg * math.Pi / 180\n}", "title": "" } ]
[ { "docid": "9b53b32ab780c04dacf4d7a01bbdb736", "score": "0.78556335", "text": "func rad(deg float64) float64 { return deg * math.Pi / 180 }", "title": "" }, { "docid": "41a1de62f63d04f038e514e6844bab7e", "score": "0.78160095", "text": "func degreeToRadians(degrees float64) float64 {\n\treturn (degrees * math.Pi) / 180\n}", "title": "" }, { "docid": "a991131547d50e0855fbd41a61dc4026", "score": "0.77297133", "text": "func deg(rad float64) float64 { return rad * 180 / math.Pi }", "title": "" }, { "docid": "40bd26d7202777204c9e9d83e7365bdf", "score": "0.7617496", "text": "func toRadians(input float64) float64 {\n\treturn input * math.Pi / 180\n}", "title": "" }, { "docid": "8880ad1b72a069c8341ec898f26753f2", "score": "0.755156", "text": "func rad2deg(radians float64) float64 {\n\treturn radians * (180.0 / math.Pi)\n}", "title": "" }, { "docid": "08a28b1d1e0052f78bdce23e302272e7", "score": "0.74874926", "text": "func deg2rad(degrees float64) float64 {\n\treturn degrees * (math.Pi / 180.0)\n}", "title": "" }, { "docid": "636e3cf4d9ca2248df826f7f389fa921", "score": "0.7427162", "text": "func DegToRad(deg float64) float64 {\n\treturn deg / 180 * math.Pi\n}", "title": "" }, { "docid": "0aa18fac847cae50ed46175a5f1c1f9d", "score": "0.74053705", "text": "func ToRad(deg float64) float64 {\n\treturn (math.Pi / 180) * deg\n}", "title": "" }, { "docid": "67f4a89caa4e661bd7760ac77ac00f25", "score": "0.7389454", "text": "func deg2rad(deg float64) float64 {\n\treturn deg * (math.Pi / 180)\n}", "title": "" }, { "docid": "bec2370d7ec936425d8eba6ef38284f1", "score": "0.72577", "text": "func (a Angle) ToRad() float64 {\n\treturn 2 * math.Pi * float64(a) / 256\n}", "title": "" }, { "docid": "31f0002368cb71d8c7f31b169dce1978", "score": "0.72530544", "text": "func radianToDegrees(radians float64) float64 {\n\treturn (radians * 180) / math.Pi\n}", "title": "" }, { "docid": "05db04aca2840d2415c1049319aa2640", "score": "0.72427374", "text": "func toDegrees(input float64) float64 {\n\treturn input * 180 / math.Pi\n}", "title": "" }, { "docid": "e319794c9f0084a97c8110c43f55d00f", "score": "0.72200525", "text": "func ToRadians(degree float64) float64 {\n\treturn (degree * math.Pi) / 180\n}", "title": "" }, { "docid": "1ac27426ac1886363ebebc4728e767e8", "score": "0.71650976", "text": "func Deg2Rad(arg float64) float64 {\n\tvar mix float64 = arg / Degree180\n\treturn mix * math.Pi\n}", "title": "" }, { "docid": "1272b39b1ca14a20646bb8a6b6a9486a", "score": "0.71169895", "text": "func DegreesToRadians(d float64) float64 {\n\treturn d * math.Pi / 180\n}", "title": "" }, { "docid": "0ed6779edd49f7bee95dd6b4588fd117", "score": "0.70380306", "text": "func RadiansToDegrees(r float64) float64 {\n\treturn r * 180 / math.Pi\n}", "title": "" }, { "docid": "59b48a643bfbed8a29accde3dcf6a832", "score": "0.69996184", "text": "func ToRadians(dblDegrees float64) float64 {\n\treturn dblDegrees * math.Pi / 180\n}", "title": "" }, { "docid": "849303cb54455d47ed72bea375f7ef1f", "score": "0.6994391", "text": "func DegreesToRadians(d float64) float64 {\n\treturn d * degreesToRadian\n}", "title": "" }, { "docid": "af7d045899296abe7c1da7c96ae4deff", "score": "0.6989461", "text": "func DegreesToRadians(degrees float64) float64 {\n\treturn (degrees * math.Pi) / 180.0\n}", "title": "" }, { "docid": "2c780a27438aef0a544d3e53b72ebd53", "score": "0.6963049", "text": "func degsToRads(degrees float64) float64 { return degrees * M_PI_180 }", "title": "" }, { "docid": "529d5714f1c7eaaa61d3627e3223fd5d", "score": "0.69402343", "text": "func Rad2Deg(arg float64) float64 {\n\tvar mix float64 = arg * Degree180\n\treturn mix / math.Pi\n}", "title": "" }, { "docid": "3b7981ccae532e992b31de266b464034", "score": "0.6910357", "text": "func (m mathUtil) DegreesToRadians(degrees float64) float64 {\n\treturn degrees * _d2r\n}", "title": "" }, { "docid": "e3f376823267157b9fca41586795aefb", "score": "0.68886334", "text": "func (c Coord) RadToDeg() Coord {\n\treturn Coord{180 * c[0] / math.Pi, 180 * c[1] / math.Pi, c[2], c[3]}\n}", "title": "" }, { "docid": "f55eb55fe1aa8ed316e50606ccdd06c8", "score": "0.68509686", "text": "func RadToDeg(rad float64) float64 {\n\treturn rad / math.Pi * 180\n}", "title": "" }, { "docid": "4b9417b3fbb04a949412d7675b21b5ae", "score": "0.681671", "text": "func (m mathUtil) RadiansToDegrees(value float64) float64 {\n\treturn math.Mod(value, _2pi) * _r2d\n}", "title": "" }, { "docid": "05ba4ecb61f9389be6f01c45ae8ff75d", "score": "0.67820317", "text": "func (a Angle) ToDeg() float64 {\n\treturn 360 * float64(a) / 256\n}", "title": "" }, { "docid": "1f1f366d4a5b9015f46aa83f75260ed0", "score": "0.6768126", "text": "func mathDeg2rad(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar x phpv.ZFloat\n\t_, err := core.Expand(ctx, args, &x)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn (x / 180 * math.Pi).ZVal(), nil\n}", "title": "" }, { "docid": "dc589b735185a9a613f4f4b16aab84ba", "score": "0.67439544", "text": "func (d Degrees) Angle() Angle { return Angle(float64(d) * float64(s1.Degree)) }", "title": "" }, { "docid": "11391971efb76c66ae5ec30e62d342a4", "score": "0.67345273", "text": "func RadiansToDegrees(r float64) float64 {\n\treturn r * radiansToDegrees\n}", "title": "" }, { "docid": "39d60d0c9a80a3bd86acfe5c6adb3f4e", "score": "0.6703681", "text": "func ToDegrees(dblRadians float64) float64 {\n\treturn dblRadians * 180 / math.Pi\n}", "title": "" }, { "docid": "771b20e818b968371caf7929bf71452e", "score": "0.66504616", "text": "func DegToRad(fAngDeg gl.Float) gl.Float {\n\treturn fAngDeg * degToRad\n}", "title": "" }, { "docid": "7ab0146baaafe83559e0e57d53731e53", "score": "0.662327", "text": "func (c *Clac) RadToDeg() error {\n\treturn c.applyFloat(1, func(vals []value.Value) (value.Value, error) {\n\t\te := &eval{}\n\t\tdegPerRad := e.binary(value.Int(180), \"/\", Pi)\n\t\tdeg := e.binary(vals[0], \"*\", degPerRad)\n\t\treturn deg, e.err\n\t})\n}", "title": "" }, { "docid": "24e9f71f2a6c4d5c42e0c0a3840b14f5", "score": "0.6614271", "text": "func Rad(d float64) float64 {\n\treturn d * (math.Pi / 180)\n}", "title": "" }, { "docid": "28bd7fb46f466ad0c4caa6f881282fe3", "score": "0.66116834", "text": "func radsToDegs(radians float64) float64 { return radians * M_180_PI }", "title": "" }, { "docid": "54246f071514205f02f95578ad714d31", "score": "0.660635", "text": "func Radian(d float32) float32 {\n\treturn d * Pi / 180\n}", "title": "" }, { "docid": "f5f3f6171ffe184ec39f16650e2fcbae", "score": "0.6572175", "text": "func (c Coord) DegToRad() Coord {\n\treturn Coord{math.Pi * c[0] / 180, math.Pi * c[1] / 180, c[2], c[3]}\n}", "title": "" }, { "docid": "4db07d2d027e9cd40334ddb9a0dd25fb", "score": "0.6548383", "text": "func DtoR(degrees float64) float64 {\n\treturn (Pi / 180) * degrees\n}", "title": "" }, { "docid": "65ba0af92537a06cc750102dc0412f72", "score": "0.6500612", "text": "func (d Degrees) Radians() float64 {\n\treturn float64(d) * degToRad\n}", "title": "" }, { "docid": "983001ddeff20d13e73680771dcb73f1", "score": "0.64768714", "text": "func (m mathUtil) PercentToRadians(pct float64) float64 {\n\treturn m.DegreesToRadians(360.0 * pct)\n}", "title": "" }, { "docid": "c139af9d29508c06c4678a2c0f5f142c", "score": "0.64380604", "text": "func (d Degree) Radians() Radian {\n\treturn Radian(d * DegToRad)\n}", "title": "" }, { "docid": "6ca16d476771e82aa4c9c28b11196338", "score": "0.643489", "text": "func (l *Line) AngleRadians() float64 {\n\treturn l.angle * DegToRad\n}", "title": "" }, { "docid": "00e7473eedfd385c5e7f536b2238bb20", "score": "0.64155173", "text": "func (c *Clac) DegToRad() error {\n\treturn c.applyFloat(1, func(vals []value.Value) (value.Value, error) {\n\t\te := &eval{}\n\t\tradPerDeg := e.binary(Pi, \"/\", value.Int(180))\n\t\trad := e.binary(vals[0], \"*\", radPerDeg)\n\t\treturn rad, e.err\n\t})\n}", "title": "" }, { "docid": "bcbe38cf242cb99e0905f845a1d80913", "score": "0.6406041", "text": "func (m mathUtil) DegreesToCompass(deg float64) float64 {\n\treturn m.DegreesAdd(deg, -90.0)\n}", "title": "" }, { "docid": "b2b9363b7ca45f32980a22f3b3ab876d", "score": "0.63521194", "text": "func Radians(deg float64) float64 {\n\treturn (deg * math.Pi) / 180.0\n}", "title": "" }, { "docid": "9e29a6876abdea2824a1b64a5673ef6c", "score": "0.63438773", "text": "func (p Point2) ToRadians() float64 {\n\treturn math.Atan2(p[1], p[0])\n}", "title": "" }, { "docid": "696847554f1117bf4fd398214f4c4cdf", "score": "0.6292364", "text": "func Degrees(r float64) float64 {\n\treturn r * DegreesPerRadian\n}", "title": "" }, { "docid": "a6a127e856e566a1ea0fc1fe2f85db48", "score": "0.62492573", "text": "func (r Radian) Degrees() Degree {\n\treturn Degree(r * RadToDeg)\n}", "title": "" }, { "docid": "99a959c052064e134471e088ac86afd5", "score": "0.6213837", "text": "func RtoD(radians float64) float64 {\n\treturn (180 / Pi) * radians\n}", "title": "" }, { "docid": "c4ba3268bda6eb3affa497d9dbbfedc1", "score": "0.6132171", "text": "func Degree(r float32) float32 {\n\treturn r * 180 / Pi\n}", "title": "" }, { "docid": "f3f3c2dd47305e9a11c24f59df17fa90", "score": "0.6057405", "text": "func AngleRadians(lhs Vector, rhs Vector) float64 {\n\treturn math.Acos(DotProduct(lhs, rhs) / (Magnitude(lhs) * Magnitude(rhs)))\n}", "title": "" }, { "docid": "e765d6dc1c1f16524a30e7413bef0818", "score": "0.60456795", "text": "func (entity Entity) CalculateRadAngleTo(target Entity) float64 {\n\tdx := target.X - entity.X\n\tdy := target.Y - entity.Y\n\n\treturn math.Atan2(dy, dx)\n}", "title": "" }, { "docid": "04c0a0099f5939b2b6c9bc4e3deb9448", "score": "0.60184205", "text": "func ReadAngle(r Reader, bits uint) float32 {\n\treturn float32(r.ReadBits(bits)) * 360.0 / float32(uint(1)<<bits-1)\n}", "title": "" }, { "docid": "084b929d2767b5f9331c697edf36132b", "score": "0.601546", "text": "func ToAngle(v Vect) f.Float { return f.Atan2(v.Y, v.X) }", "title": "" }, { "docid": "127d76278eba40bb4c36b0753b09e49d", "score": "0.59724575", "text": "func Radians(d float64) float64 {\n\treturn d * RadiansPerDegree\n}", "title": "" }, { "docid": "6277747166e35247e18be87d6a8e37f7", "score": "0.5958476", "text": "func (p *Vect) ToAngle() f.Float { return f.Atan2(p.Y, p.X) }", "title": "" }, { "docid": "c3435ff89eaae2d01feadf218d8a50cb", "score": "0.59511393", "text": "func DistanceToRadians(dblDistance float64) float64 {\n\treturn dblDistance * math.Pi * 2 / EarthRadius\n}", "title": "" }, { "docid": "2bbdd818737cb8196fd4784f5b1732ce", "score": "0.5905422", "text": "func (l *Line) RotateRadians(angle float64) float64 {\n\treturn l.Rotate(angle*RadToDeg) * DegToRad\n}", "title": "" }, { "docid": "3589e5bd43556c107e952937b8e5b476", "score": "0.5820006", "text": "func AngleDegrees(lhs Vector, rhs Vector) float64 {\n\treturn AngleRadians(lhs, rhs) * (180 / math.Pi)\n}", "title": "" }, { "docid": "7d87416bb91279217216bac17c98df6a", "score": "0.58092016", "text": "func DirectionRadians(v Vector) Direction {\n\tmagnitude := Magnitude(v)\n\treturn Direction{\n\t\tX: math.Acos(v.I / magnitude),\n\t\tY: math.Acos(v.J / magnitude),\n\t\tZ: math.Acos(v.K / magnitude),\n\t}\n}", "title": "" }, { "docid": "4004102c2983461cb709653514b2ea19", "score": "0.5649394", "text": "func (a Vec2) Radians() Vec2 {\n\treturn Vec2{\n\t\tRadians(a.X),\n\t\tRadians(a.Y),\n\t}\n}", "title": "" }, { "docid": "aa9e38f35a406ef215730c07caede9ed", "score": "0.5582903", "text": "func (l *Line) SetAngleRadians(angle float64) float64 {\n\treturn l.RotateRadians(angle - l.angle)\n}", "title": "" }, { "docid": "2e0147462deddf14b6f447fa19b38757", "score": "0.5551965", "text": "func gpsToDegrees(gps []string) string {\n\tdegree, _ := strconv.ParseFloat(gps[0], 64)\n\tmins, _ := strconv.ParseFloat(gps[1], 64)\n\tsecs, _ := strconv.ParseFloat(gps[2], 64)\n\treturn fmt.Sprintf(\"%v\", degree+(mins/60)+(secs/3600))\n}", "title": "" }, { "docid": "c8950ca4abdad823d61900688bae9a64", "score": "0.55408704", "text": "func (p Point2) ToAngle() float64 {\n\treturn p.ToRadians() * 180 / math.Pi\n}", "title": "" }, { "docid": "8174fe4cb4e39d7da16e0d921d112b74", "score": "0.553524", "text": "func (a Vec2) Degrees() Vec2 {\n\treturn Vec2{\n\t\tDegrees(a.X),\n\t\tDegrees(a.Y),\n\t}\n}", "title": "" }, { "docid": "21afc1ff1e21e460a4f39b51bf6801f2", "score": "0.5531744", "text": "func funcRad(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) Vector {\n\treturn simpleFunc(vals, enh, func(v float64) float64 {\n\t\treturn v * math.Pi / 180\n\t})\n}", "title": "" }, { "docid": "4b34d51f87a6d42d1639f777ab35ede8", "score": "0.5496794", "text": "func (p Point2) RadiansTo(p2 Point2) float64 {\n\treturn p.Sub(p2).ToRadians()\n}", "title": "" }, { "docid": "0a7d2dbe58757c760ca3cbf7caf87f8f", "score": "0.54578024", "text": "func (g GeoPoint) RadiansTo(point GeoPoint) float64 {\n\td2r := math.Pi / 180.0\n\tlat1Rad := g.Latitude * d2r\n\tlong1Rad := g.Longitude * d2r\n\tlat2Rad := point.Latitude * d2r\n\tlong2Rad := point.Longitude * d2r\n\n\tsinDeltaLatDiv2 := math.Sin((lat1Rad - lat2Rad) / 2)\n\tsinDeltaLongDiv2 := math.Sin((long1Rad - long2Rad) / 2)\n\n\t// Square of half the straight line chord distance between both points.\n\tvar a = sinDeltaLatDiv2*sinDeltaLatDiv2 + math.Cos(lat1Rad)*math.Cos(lat2Rad)*sinDeltaLongDiv2*sinDeltaLongDiv2\n\ta = math.Min(1.0, a)\n\treturn 2 * math.Asin(math.Sqrt(a))\n}", "title": "" }, { "docid": "7e30893360e68b2c2222d15b164b7be3", "score": "0.5455693", "text": "func ForAngle(a f.Float) Vect { return Vect{f.Cos(a), f.Sin(a)} }", "title": "" }, { "docid": "36fb9260f80526a48d3afa160e07c122", "score": "0.5455129", "text": "func funcDeg(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) Vector {\n\treturn simpleFunc(vals, enh, func(v float64) float64 {\n\t\treturn v * 180 / math.Pi\n\t})\n}", "title": "" }, { "docid": "6731196518d582db1836b81395874281", "score": "0.54179287", "text": "func angleToXY(angle float64) (float64, float64) {\n\tvar x float64\n\tvar y float64\n\n\tangle = angle * 0.0174533 // Convert to radian\n\n\tx = math.Cos(angle)\n\ty = math.Sin(angle)\n\treturn x, y\n}", "title": "" }, { "docid": "ee6eb13c4cd0af3a91373c4f3a0c0290", "score": "0.53917205", "text": "func (u Vec) Angle() float64 {\n\treturn math.Atan2(u.Y, u.X)\n}", "title": "" }, { "docid": "6876e4dc3aef7161aed09bc977c443a3", "score": "0.535757", "text": "func (l *Line) RotateAroundRadians(angle float64, base Vector) Vector {\n\tcenter := l.Center()\n\tcp := l.p.Subtract(center)\n\tcq := l.q.Subtract(center)\n\n\tcenter = center.RotateAroundRadians(angle, base)\n\tl.p = center.Add(cp)\n\tl.q = center.Add(cq)\n\n\treturn center\n}", "title": "" }, { "docid": "ee9e99abcfb0a86cb3f7e6c21a43c88d", "score": "0.53406113", "text": "func _posAngleRads(rads float64) float64 {\n\tvar tmp float64\n\tif rads < 0.0 {\n\t\ttmp = rads + M_2PI\n\t} else {\n\t\ttmp = rads\n\t}\n\tif rads >= M_2PI {\n\t\ttmp -= M_2PI\n\t}\n\treturn tmp\n}", "title": "" }, { "docid": "109e7fd5f10f60f23e9d97bd4e7f3287", "score": "0.53196913", "text": "func DirectionDegrees(v Vector) Direction {\n\tdirectionDegrees := DirectionRadians(v)\n\treturn Direction{\n\t\tX: directionDegrees.X * (180 / math.Pi),\n\t\tY: directionDegrees.Y * (180 / math.Pi),\n\t\tZ: directionDegrees.Z * (180 / math.Pi),\n\t}\n}", "title": "" }, { "docid": "6380977857aafed30b4cd0bfbf112034", "score": "0.5316988", "text": "func (p *Int64) Degrees() Degrees {\n\tn := p.Len()\n\tdeg := make(Degrees, n)\n\ti := 0\n\tfor k := range p.c {\n\t\tdeg[i] = k\n\t\ti++\n\t}\n\tdeg.ReverseSort()\n\treturn deg\n}", "title": "" }, { "docid": "0b9b3d8d8820f179b1057cc616a000c1", "score": "0.52691907", "text": "func (i I) Angle() float64 {\n\treturn math.Atan2(float64(i.Y), float64(i.X))\n}", "title": "" }, { "docid": "27dd80b0ca11cdbac12ae4ef222fea1e", "score": "0.5268309", "text": "func Angle(a, o, b *Point) float64 {\n\toa := Distance(o, a)\n\tob := Distance(o, b)\n\tab := Distance(a, b)\n\tif oa == 0 || ob == 0 {\n\t\treturn 0\n\t}\n\tcos := (ob*ob + oa*oa - ab*ab) / (2 * ob * oa)\n\treturn math.Acos(cos) * 180 / math.Pi\n}", "title": "" }, { "docid": "9b298c7bb3b4af48b426f445e500c934", "score": "0.5230849", "text": "func Radians(zone int, south bool, easting, northing float64) (float64, float64) {\n\n\t// False northing\n\tfn := 0.\n\tif south {\n\t\tfn = utmSouthernHemisphereFalseNorthing\n\t}\n\n\tξPrime := (northing - fn) / (b * kO)\n\tηPrime := (easting - fe) / (b * kO)\n\n\tξ1Prime := h1Prime * math.Sin(2*ξPrime) * math.Cosh(2*ηPrime)\n\tξ2Prime := h2Prime * math.Sin(4*ξPrime) * math.Cosh(4*ηPrime)\n\tξ3Prime := h3Prime * math.Sin(6*ξPrime) * math.Cosh(6*ηPrime)\n\tξ4Prime := h4Prime * math.Sin(8*ξPrime) * math.Cosh(8*ηPrime)\n\tξ0Prime := ξPrime - (ξ1Prime + ξ2Prime + ξ3Prime + ξ4Prime)\n\n\tη1Prime := h1Prime * math.Cos(2*ξPrime) * math.Sinh(2*ηPrime)\n\tη2Prime := h2Prime * math.Cos(4*ξPrime) * math.Sinh(4*ηPrime)\n\tη3Prime := h3Prime * math.Cos(6*ξPrime) * math.Sinh(6*ηPrime)\n\tη4Prime := h4Prime * math.Cos(8*ξPrime) * math.Sinh(8*ηPrime)\n\tη0Prime := ηPrime - (η1Prime + η2Prime + η3Prime + η4Prime)\n\n\tβPrime := math.Asin(math.Sin(ξ0Prime) / math.Cosh(η0Prime))\n\tqPrime := math.Asinh(math.Tan(βPrime))\n\n\tqDoublePrime := qPrime + e*math.Atanh(e*math.Tanh(qPrime))\n\n\t// Iterate until the difference is insignificant.\n\tfor {\n\t\tnextqDoublePrime := qPrime + e*math.Atanh(e*math.Tanh(qDoublePrime))\n\t\tif nextqDoublePrime == qDoublePrime {\n\t\t\tbreak\n\t\t}\n\n\t\tqDoublePrime = nextqDoublePrime\n\t}\n\n\tϕ := math.Atan(math.Sinh(qDoublePrime))\n\tλ := λO(zone) + math.Asin(math.Tanh(η0Prime)/math.Cos(βPrime))\n\treturn ϕ, λ\n}", "title": "" }, { "docid": "744a741e06a4d30f70dc0b8e8d44fd53", "score": "0.5181419", "text": "func (m mathUtil) RadianAdd(base, delta float64) float64 {\n\tvalue := base + delta\n\tif value > _2pi {\n\t\treturn math.Mod(value, _2pi)\n\t} else if value < 0 {\n\t\treturn math.Mod(_2pi+value, _2pi)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "b1b3fb80dcf3f62fa73966f6a9bd4943", "score": "0.51601857", "text": "func (m mathUtil) DegreesAdd(baseDegrees, deltaDegrees float64) float64 {\n\tvalue := baseDegrees + deltaDegrees\n\tif value > _2pi {\n\t\treturn math.Mod(value, 360.0)\n\t} else if value < 0 {\n\t\treturn math.Mod(360.0+value, 360.0)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "74c2e5d81b427ea66cdb7a1b3b5c0956", "score": "0.51060635", "text": "func Vtoangle(v Vect) float64 {\n\treturn float64(C.cpvtoangle(v.c()))\n}", "title": "" }, { "docid": "f5b99120a4d15e727f871bdf8fe95650", "score": "0.5071649", "text": "func (q Quat) Angle() float32 {\n\tq = q.Normalize()\n\treturn math32.Acos(q.W) * 2\n}", "title": "" }, { "docid": "b51a7a5d7471ee1b00185071ca9bcb39", "score": "0.50444025", "text": "func (entity Entity) CalculateAngleTo(target Entity) float64 {\n\treturn RadToDeg(entity.CalculateRadAngleTo(target))\n}", "title": "" }, { "docid": "232093873611b8147284a96220d5d28c", "score": "0.50327885", "text": "func normalizeLon(lonDeg float64) float64 {\n\tif lonDeg >= -180 && lonDeg <= 180 {\n\t\treturn lonDeg\n\t}\n\n\toff := math.Mod(lonDeg+180, 360)\n\tif off < 0 {\n\t\treturn 180 + off\n\t} else if off == 0 && lonDeg > 0 {\n\t\treturn 180\n\t}\n\treturn -180 + off\n}", "title": "" }, { "docid": "fb419f6b84a18b0778ea425809e91911", "score": "0.5029802", "text": "func normEasting(deg float64) float64 {\n\t// go's Mod fcn preserves sign on first param\n\tif deg < -180 {\n\t\treturn math.Mod(deg+180, 360) + 180\n\t}\n\tif deg > 180 {\n\t\treturn math.Mod(deg-180, 360) - 180\n\t}\n\treturn deg\n}", "title": "" }, { "docid": "b0c6a729e80223f7273af6d061947a06", "score": "0.5000523", "text": "func randDegree() float64 {\n return rand.Float64() * 360.0\n }", "title": "" }, { "docid": "28c8f50b3cbc7666ddfe9b82dd59b58c", "score": "0.49768373", "text": "func deg(v uint32) int {\n\tf := [...]uint32{0, 10241, 491582, 712794, 831695, 948446, 1032189, 1048576}\n\td := [...]int{0, 1, 2, 3, 4, 10, 11, 40}\n\n\tfor j := 1; j < len(f)-1; j++ {\n\t\tif v < f[j] {\n\t\t\treturn d[j]\n\t\t}\n\t}\n\n\treturn d[len(d)-1]\n}", "title": "" }, { "docid": "57696d6f249de822e91a5f6afc28b08f", "score": "0.49045712", "text": "func XInRadians(hand int, scale float64) float64 {\n\treturn (math.Pi / (scale / (float64(hand))))\n}", "title": "" }, { "docid": "4f97b94d0233b3b646c104de9e6e8867", "score": "0.4902673", "text": "func (c Coord) Rot(r mat) Coord {\n\trc := Coord{\n\t\tX: (c.X * r[0].X) + (c.Y * r[0].Y),\n\t\tY: (c.X * r[1].X) + (c.Y * r[1].Y),\n\t}\n\n\tif ax := abs(rc.X); ax > 1 {\n\t\trc.X = rc.X / ax\n\t}\n\tif ay := abs(rc.Y); ay > 1 {\n\t\trc.Y = rc.Y / ay\n\t}\n\treturn rc\n}", "title": "" }, { "docid": "f14b1c39292e79a6ffc4a93925043dce", "score": "0.4899018", "text": "func PolarRadians(x, y, r, angle float64) (float64, float64) {\n\tpx := (r * math.Cos(angle)) + x\n\tpy := (r * math.Sin(angle)) + y\n\treturn px, py\n}", "title": "" }, { "docid": "ffa3dc40ce0ff446901a558de0e8d479", "score": "0.48849925", "text": "func (a Vec2) Angle(b Vec2) float64 {\n\treturn math.Atan2(b.Y-a.Y, b.X-a.X)\n}", "title": "" }, { "docid": "50ea94f41e75d693e725c2e063c255bc", "score": "0.48657557", "text": "func HoursInRadians(t time.Time) float64 {\n\treturn XInRadians(t.Hour(), hoursInHalfClock) + MinutesInRadians(t)/minutesInClock + SecondsInRadians(t)/(minutesInClock*secondsInClock)\n}", "title": "" }, { "docid": "b70a24bb9cf0339612619e85a0dde032", "score": "0.48493594", "text": "func NormAngle(angle float64) float64 {\n\tangle = math.Mod(angle, 2.0*math.Pi)\n\tif angle > math.Pi {\n\t\tangle -= 2*math.Pi\n\t} else if angle < -math.Pi {\n\t\tangle += 2*math.Pi\n\t}\n\treturn angle\n}", "title": "" }, { "docid": "4cbb215a5d36ebd80fc8aa741cea7ce3", "score": "0.48314944", "text": "func Angle(x string) (geometry.Angle, error) {\n\ta, err := Number(x)\n\tif err != nil {\n\t\treturn 0, ErrBadAngle\n\t}\n\treturn geometry.Angle(a), nil\n}", "title": "" }, { "docid": "200fa68aa24d972b2b27531c528359ca", "score": "0.48288408", "text": "func (device *Device) GetTiltAngle() float64 {\n\n\ttiltState := C.freenect_get_tilt_state(device.device)\n\n\treturn float64(C.freenect_get_tilt_degs(tiltState))\n}", "title": "" }, { "docid": "7c50d3a90ab9711040aebefd010de522", "score": "0.48191696", "text": "func MinutesInRadians(t time.Time) float64 {\n\treturn SecondsInRadians(t)/secondsInClock + XInRadians(t.Minute(), minutesInHalfClock)\n}", "title": "" }, { "docid": "c988dec30a2ac16d82b552f3e7b6261f", "score": "0.48118094", "text": "func (g DenseGraph) Degrees() []int {\n\ttmpDegreeSequence := make([]int, len(g.DegreeSequence))\n\tcopy(tmpDegreeSequence, g.DegreeSequence)\n\treturn tmpDegreeSequence\n}", "title": "" }, { "docid": "66b1b0115a96452218c731e329555ef3", "score": "0.48111117", "text": "func Rotate(v Vector, compassAngle float64) Vector {\n\trad := toRadians(compassAngle)\n\treturn Vector{\n\t\tX: v.X*math.Cos(rad) + v.Y*math.Sin(rad),\n\t\tY: v.Y*math.Cos(rad) - v.X*math.Sin(rad),\n\t\tZ: v.Z,\n\t}\n}", "title": "" }, { "docid": "8c34eb11a183edfcec1f1e0faa42be54", "score": "0.48062637", "text": "func CanonicalAngle(theta float64) float64 {\n\tif theta < 0 {\n\t\treturn CanonicalAngle(2*math.Pi - theta)\n\t}\n\treturn math.Mod(theta, 2*math.Pi)\n}", "title": "" }, { "docid": "fd1d8c611f5f194bb7498c84ed651b53", "score": "0.479727", "text": "func (fn *formulaFuncs) RADIANS(argsList *list.List) formulaArg {\n\tif argsList.Len() != 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"RADIANS requires 1 numeric argument\")\n\t}\n\tangle := argsList.Front().Value.(formulaArg).ToNumber()\n\tif angle.Type == ArgError {\n\t\treturn angle\n\t}\n\treturn newNumberFormulaArg(math.Pi / 180.0 * angle.Number)\n}", "title": "" } ]
23eca402d98680fbbf1b85af80153640
GetByID returns the branch with the given ID
[ { "docid": "d304991e22a0fb99cdbfcd98b9bc9956", "score": "0.7806393", "text": "func (r *mockBranchRepository) GetByID(ctx context.Context, branchID uint) (*entities.Branch, error) {\n\tvar b entities.Branch\n\tb.ID = branchID\n\treturn &b, nil\n}", "title": "" } ]
[ { "docid": "ddcb4e6fcf90a373b03fdc4e59e5f5bb", "score": "0.7969542", "text": "func (r *BranchRepository) GetByID(ctx context.Context, branchID uint) (*entities.Branch, error) {\n\tvar b entities.Branch\n\tdbt := r.DB.Where(\"id = ?\", branchID).Find(&b)\n\tif dbt.Error != nil {\n\t\tif dbt.RecordNotFound() {\n\t\t\tctx.Done()\n\t\t\treturn nil, nil\n\t\t}\n\t\tctx.Done()\n\t\tlog.Error(dbt.Error)\n\t\treturn nil, errors.Wrap(dbt.Error, \"error getting branch with the given id\")\n\t}\n\tcity, err := r.GetCityByID(ctx, b.CityID)\n\tif err != nil {\n\t\tctx.Done()\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\tb.City = *city\n\treturn &b, nil\n}", "title": "" }, { "docid": "2f9621633c75966ee0e8abd15b9b6b2f", "score": "0.66868985", "text": "func GetByID(id []byte) (bp Blueprint, err error) {\n\terr = store.Load([]byte(DBBucket), id, &bp)\n\treturn\n}", "title": "" }, { "docid": "6a05dea7269636ee92f2e452004124b6", "score": "0.62213224", "text": "func (sl *NeighborList) GetByID(id []byte) *node.RemoteNode {\n\tvalue, ok := sl.nodes.Load(string(id))\n\tif ok {\n\t\trn, ok := value.(*node.RemoteNode)\n\t\tif ok {\n\t\t\treturn rn\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce330f5cab9d192828f1686c4f6505be", "score": "0.6170557", "text": "func (r *repository) GetByID(ID int) (Transaction, error){\n\tvar transaction Transaction\n\terr := r.db.Where(\"id = ?\", ID).Find(&transaction).Error\n\n\tif err != nil{\n\t\treturn transaction, err\n\t}\n\treturn transaction, nil\n}", "title": "" }, { "docid": "8fcf2c615ac041022af2901c8b364e79", "score": "0.6101001", "text": "func (r *repo) Get(ctx context.Context, id string) (repository.Bid, error) {\n\tvar bid repository.Bid\n\tquery := `\nSELECT\n\tid,\n\tstatus,\n\treceived_coin_type,\n\treceived_value,\n\treceived_address,\n\tgiven_coin_type,\n\tgiven_value,\n\tgiven_address,\n\tcreated_at,\n\tupdated_at\nFROM\n\tbids\nWHERE\n\tid = $1`\n\terr := r.db.QueryRowContext(ctx, query, id).\n\t\tScan(\n\t\t\t&bid.ID,\n\t\t\t&bid.Status,\n\t\t\t&bid.ReceivedCoinType,\n\t\t\t&bid.ReceivedValue,\n\t\t\t&bid.ReceivedAddress,\n\t\t\t&bid.GivenCoinType,\n\t\t\t&bid.GivenValue,\n\t\t\t&bid.GivenAddress,\n\t\t\t&bid.CreatedAt,\n\t\t\t&bid.UpdatedAt,\n\t\t)\n\tif errors.Is(err, sql.ErrNoRows) {\n\t\treturn bid, errors.Wrap(repository.ErrNotFound, \"get fail\")\n\t} else if err != nil {\n\t\treturn bid, errors.Wrap(err, \"get fail\")\n\t}\n\n\treturn bid, nil\n}", "title": "" }, { "docid": "d60389ebf2f73b575bef49683fb9fac4", "score": "0.6085863", "text": "func GetBranch(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *BranchState, opts ...pulumi.ResourceOption) (*Branch, error) {\n\tvar resource Branch\n\terr := ctx.ReadResource(\"aws:amplify/branch:Branch\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "44b7402e4b5cc098678234c80a187f5a", "score": "0.6022757", "text": "func (r *Repository) GetByID(tx *storage.Transaction, id uint, filter DatabaseFilter, t interface{}) (entry interface{}, err error) {\n\terr = filter(tx.Gorm().Model(t)).Where(\"id = ?\", id).First(t).Error\n\treturn t, err\n}", "title": "" }, { "docid": "be050d45c2f8f949fa3f787dac60c35b", "score": "0.60222566", "text": "func (lv *LocalVCS) GetBranch() (string, error) {\n\treturn lv.BranchCmd.Exec(PackageSource(lv.SrcPath, lv.Root))\n}", "title": "" }, { "docid": "6ebefe0229cdebc969e457580c9b6a2d", "score": "0.60119593", "text": "func (s *BucketsService) GetByID(id uint) (*api.Bucket, error) {\n\tbucket, err := s.repository.FindOneByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bucket.ConvertModelToEntity(), nil\n}", "title": "" }, { "docid": "a8d424a2df3ecb74b61fc4c616e68312", "score": "0.6008678", "text": "func (r *PostgresRepo) Get(accountID string, ID string) (*models.Bin, error) {\n\tbin := &models.Bin{}\n\n\ttable := r.DB.Table(tableName)\n\tres := table.Where(\"id = ? AND account_id = ?\", ID, accountID).Find(&bin).RecordNotFound()\n\n\tif res {\n\t\tbin = nil\n\t}\n\n\treturn bin, nil\n}", "title": "" }, { "docid": "8b5527a1b8dbe6c5b11bdef0f9b942d4", "score": "0.5993494", "text": "func (r *BranchRepository) GetCategoryByID(ctx context.Context, categoryID uint) (*entities.Category, error) {\n\tctx, cancelFunc := context.WithCancel(ctx)\n\tvar category entities.Category\n\tdbt := r.DB.Where(\"id = ?\", categoryID).Find(&category)\n\tif dbt.Error != nil {\n\t\tif dbt.RecordNotFound() {\n\t\t\tcancelFunc()\n\t\t\treturn nil, nil\n\t\t}\n\t\tlog.Error(dbt.Error)\n\t\tcancelFunc()\n\t\treturn nil, dbt.Error\n\t}\n\tcancelFunc()\n\treturn &category, nil\n}", "title": "" }, { "docid": "92b0d48e13f5660292ee5e30faac06bb", "score": "0.596778", "text": "func (s *BuildStorage) GetByID(ctx context.Context, imageID, id string) (*types.Build, error) {\n\tbuild := &types.Build{}\n\treturn build, nil\n}", "title": "" }, { "docid": "51b85b4e7f43cd59c19394b14ccf5803", "score": "0.5949103", "text": "func (db *ShipperOrderrepo) GetByID(id uint) (*models.ShipperOder, error) {\n\n\t//database access\n\treturn nil, nil\n}", "title": "" }, { "docid": "a3ba4820e55e360fa9a39c61c3608450", "score": "0.58729845", "text": "func (gi *Chunk) GetByID(db *pg.DB) (Chunk, error) {\r\n\tlog.Printf(\">===>chunkItem.GetByID(ChunkID=%d)\", gi.ID)\r\n\r\n\t//getErr := db.Select(gi)\r\n\tgetErr := db.Model(gi).Where(\"id = ?0\", gi.ID).Select()\r\n\tif getErr != nil {\r\n\t\tlog.Printf(\"Error while selecting item, Reason %v\\n\", getErr)\r\n\t\treturn *gi, getErr\r\n\t}\r\n\tlog.Printf(\"Select by ID successful in chunkItem.GetById() chunk=%v\\n\", *gi)\r\n\treturn *gi, nil\r\n}", "title": "" }, { "docid": "ff0a02f80a2a78b50526d57385dcd486", "score": "0.58695436", "text": "func (c *CommentsRepo) GetByID(id string) (*models.Comment, error) {\n comment := models.Comment{}\n err := c.DB.Model(&comment).Where(\"id = ?\", id).Select()\n if err != nil {\n return nil, err\n }\n return &comment, nil\n}", "title": "" }, { "docid": "a94877b923d0dce33a892b3f0d3dba17", "score": "0.58638114", "text": "func (r *mockBranchRepository) GetCategoryByID(ctx context.Context, categoryID uint) (*entities.Category, error) {\n\tctx, cancelFunc := context.WithCancel(ctx)\n\tvar category entities.Category\n\tcancelFunc()\n\treturn &category, nil\n}", "title": "" }, { "docid": "6a77d7d85937f8de8b48f2eee3e4eeea", "score": "0.5846475", "text": "func (r *mockBranchRepository) GetByOwner(ctx context.Context, ownerID uint) ([]entities.Branch, error) {\n\tvar b []entities.Branch\n\tb[0] = entities.Branch{}\n\towner := entities.User{}\n\towner.ID = ownerID\n\tb[0].Owner = &owner\n\treturn b, nil\n}", "title": "" }, { "docid": "021702cb8a3ecc304dc2387aaba0d550", "score": "0.5815348", "text": "func (br *Branch) ParentById(id string) (*Branch, error) {\n\tfor br.ID != id {\n\t\tvar err error\n\t\tbr, err = br.Parent(1)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn br, nil\n}", "title": "" }, { "docid": "4bb7ad6a5aa512b402cb482685718e5d", "score": "0.5810821", "text": "func findByIDBFS(root *Node, id string) *Node {\n\tqueue := make([]*Node, 0)\n\tqueue = append(queue, root)\n\n\tfor len(queue) > 0 {\n\t\t// get zero idx item in queue list.\n\t\tcurrent := queue[0]\n\t\t// remove idx = 0 from list by setting list to contain\n\t\t// all items in the list starting (inclusive) index 1.\n\t\tqueue = queue[1:]\n\t\tif current.id == id {\n\t\t\treturn current\n\t\t}\n\t\tidx := 0\n\t\tif len(current.children) > 0 {\n\t\t\tfor _, child := range current.children {\n\t\t\t\tidx++\n\t\t\t\tqueue = append(queue, child)\n\t\t\t}\n\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c55f3d412fa2c9223ab301ca4c68a36b", "score": "0.5809404", "text": "func (m *BusinessDAO) GetByID(id string) (Business, error) {\n\tvar business Business\n\terr := db.C(COLLECTION).FindId(bson.ObjectIdHex(id)).One(&business)\n\treturn business, err\n}", "title": "" }, { "docid": "a4ce5d118e2640b372603cc481c175b7", "score": "0.58047295", "text": "func (BookRepositoryImpl) FetchBookByID(ctx context.Context, id string) (*models.Book, error) {\n\tdefer fetchBookSegment(ctx).End()\n\tbook, ok := storage[id]\n\tif !ok {\n\t\treturn nil, ErrBookNotFound\n\t}\n\n\treturn book, nil\n}", "title": "" }, { "docid": "2d6949662ffbf99f3a2c822d5eda38f4", "score": "0.57860726", "text": "func (sw *Switch) GetByID(id string) Peer {\n\tif sw.peers != nil {\n\t\treturn sw.peers.GetByID(id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ea8b84948612917e526991a3e10f3293", "score": "0.5772849", "text": "func (r *mockBranchRepository) GetByLocation(ctx context.Context, country string, cityID uint) ([]entities.Branch, error) {\n\tvar b []entities.Branch\n\tb[0] = entities.Branch{\n\t\tCountry: country,\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "c6d38199247b323b75c925b36119efa1", "score": "0.57515883", "text": "func (account *Account) GetById(id string) *Account {\n\tfmt.Println(\"getting account by Id\")\n\treturn account\n}", "title": "" }, { "docid": "4510bd17e67f4a3ee2e1719f0cdbaa91", "score": "0.5737761", "text": "func (d DB) GetByID(ctx context.Context, id string) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "70212f37d9b188428d3e20906e630766", "score": "0.5734809", "text": "func ByID(ctx context.Context, id int) (BHAP, *datastore.Key, error) {\n\tvar results []BHAP\n\tquery := datastore.NewQuery(BHAPEntityName).\n\t\tFilter(\"ID =\", id).\n\t\tLimit(1)\n\tkeys, err := query.GetAll(ctx, &results)\n\tif err != nil {\n\t\treturn BHAP{}, nil, fmt.Errorf(\"by ID %v: %v\", id, err)\n\t}\n\n\tif len(results) == 0 {\n\t\treturn BHAP{}, nil, nil\n\t}\n\n\treturn results[0], keys[0], nil\n}", "title": "" }, { "docid": "7a63d4817a257cd333f3ff3df0b4c0a8", "score": "0.57329017", "text": "func (r *backend) Branch() (string, error) {\n\tbranchRefs, err := r.repository.Branches()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\theadRef, err := r.repository.Head()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar currentBranchName string\n\terr = branchRefs.ForEach(func(branchRef *plumbing.Reference) error {\n\t\tif branchRef.Hash().String() == headRef.Hash().String() {\n\t\t\tcurrentBranchName = branchRef.Name().Short()\n\t\t\treturn nil\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn currentBranchName, nil\n}", "title": "" }, { "docid": "6550101ad4176f80e320a52df107f0ae", "score": "0.57277", "text": "func (r *InMemoryRepo) GetByID(id string) (*pb.User, error) {\n\n\tuser := r.data[id]\n\tif user == nil {\n\t\treturn nil, errors.New(\"Not found\")\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "2c2bff50aa2a523be979761d735d8b60", "score": "0.57165396", "text": "func (b *BranchSupporters) BranchID() (branchID ledgerstate.BranchID) {\n\treturn b.branchID\n}", "title": "" }, { "docid": "d28b78aff0c642073a82c29271e94f15", "score": "0.57108134", "text": "func DownloadByID(ctx *context.Context) {\n\tblob, err := ctx.Repo.GitRepo.GetBlob(ctx.Params(\"sha\"))\n\tif err != nil {\n\t\tif git.IsErrNotExist(err) {\n\t\t\tctx.NotFound(\"GetBlob\", nil)\n\t\t} else {\n\t\t\tctx.ServerError(\"GetBlob\", err)\n\t\t}\n\t\treturn\n\t}\n\tif err = common.ServeBlob(ctx.Base, ctx.Repo.TreePath, blob, nil); err != nil {\n\t\tctx.ServerError(\"ServeBlob\", err)\n\t}\n}", "title": "" }, { "docid": "2d363a2cfcdefd4b376c359296117c59", "score": "0.5699486", "text": "func (p *Post) GetByID(w http.ResponseWriter, r *http.Request) {\n\tid, _ := strconv.Atoi(chi.URLParam(r, \"id\"))\n\tpayload, err := p.repo.GetByID(r.Context(), int64(id))\n\n\tif err != nil {\n\t\tfmt.Println(\"Error: ID does not exist\")\n\t}\n\n\trespondwithJSON(w, http.StatusOK, payload)\n}", "title": "" }, { "docid": "d83948d745f94b609c72212d39e15930", "score": "0.5692668", "text": "func (r *pgRepository) GetByIDGlobal(ctx context.Context, id string) (*model.Tombstone, error) {\n\tlog.C(ctx).Debugf(\"Getting Tombstone entity with id %q\", id)\n\tvar tombstoneEnt Entity\n\tif err := r.singleGetterGlobal.GetGlobal(ctx, repo.Conditions{repo.NewEqualCondition(\"id\", id)}, repo.NoOrderBy, &tombstoneEnt); err != nil {\n\t\treturn nil, err\n\t}\n\n\ttombstoneModel, err := r.conv.FromEntity(&tombstoneEnt)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while converting Tombstone from Entity\")\n\t}\n\n\treturn tombstoneModel, nil\n}", "title": "" }, { "docid": "4e45825af7a2cbf6490f5b19887734ae", "score": "0.56878805", "text": "func (m *MasterManager) GetStateById(id uuid.UUID) (bu.StateBO, error) {\n\tmaster := masFac.New(bs.CState).(*bs.State)\n\tres, err := master.GetStateById(id)\n\treturn res, err\n}", "title": "" }, { "docid": "b2e9cbce52052ee1059bb4bf3960c3a7", "score": "0.56713235", "text": "func get_state_by_id(stateId int) State {\n\n\ttheState := States[stateId]\n\n\tif theState.Id == stateId {\n\t\treturn theState\n\t}\n\n\tfmt.Println(\"Cannot find state by id \", stateId)\n\tos.Exit(1)\n\treturn theState\n\t// var state State\n\t// for _, state := range States {\n\t// \tif state.Id == stateId {\n\t// \t\treturn state\n\t// \t}\n\t// }\n\n\t// return state\n}", "title": "" }, { "docid": "8354f271586eb3ec6f19f06dc561c568", "score": "0.5665228", "text": "func (r *BranchRepository) GetByLocation(ctx context.Context, country string, cityID uint) ([]entities.Branch, error) {\n\tvar b []entities.Branch\n\tdbt := r.DB.Where(\"country = ? AND city_id = ?\", country, cityID).Find(&b)\n\tif dbt.Error != nil {\n\t\tif dbt.RecordNotFound() {\n\t\t\tctx.Done()\n\t\t\treturn nil, nil\n\t\t}\n\t\tctx.Done()\n\t\tlog.Error(dbt.Error)\n\t\treturn nil, errors.Wrap(dbt.Error, \"error getting branches in the given location\")\n\t}\n\tfor id, branch := range b {\n\t\tcity, err := r.GetCityByID(ctx, branch.CityID)\n\t\tif err != nil {\n\t\t\tctx.Done()\n\t\t\tlog.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\t\tb[id].City = *city\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "0941866c7218075e3f07307ca679bcb7", "score": "0.56584024", "text": "func GetBoardByID(c *gin.Context, boardID string) (models.Board, error) {\n\tboard, err := database.GetManager().GetBoardByID(c, boardID)\n\tif err != nil {\n\t\treturn models.Board{}, err\n\t}\n\n\treturn board, nil\n}", "title": "" }, { "docid": "8a830cc14c6d5f25c0e2f38fe7f25653", "score": "0.5656971", "text": "func GetByID(id string) (backendDescriptor *BackendDescriptor) {\n\tbackendsLock.Lock()\n\tdefer backendsLock.Unlock()\n\n\tbackendDescriptor = unsyncedGetByID(id)\n\treturn\n}", "title": "" }, { "docid": "3d6d23aa2102439c8baf7761956d211c", "score": "0.564115", "text": "func (k *KBucket) Get(id []byte) ContactIdentifier {\n\n\tbitIndex := 0\n\tnode := k.root\n\tfor node.contacts == nil {\n\t\tif n := k.determineNode(node, id, bitIndex); n != nil {\n\t\t\tnode = n\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\tbitIndex++\n\t}\n\n\tif node == nil {\n\t\treturn nil\n\t}\n\n\tindex := node.indexOf(id) // index of uses contact id for matching\n\tif index > -1 {\n\t\treturn node.atIndex(index)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4bf8c6d93a29af2a68af38c11b7fa4e", "score": "0.5639904", "text": "func GetCurrencyByID(w http.ResponseWriter, r *http.Request) {\n\tcrDetail := model.Currency{}\n\trVars := mux.Vars(r)\n\tcr := rVars[\"currency\"]\n\t\n\tsymbol := mp[cr]\n\tif symbol.BaseCurrency == \"\" {\n\t\tlog.Printf(\"Not a valid symbol type\")\n\t\t\n\t}\n\tu, err := url.Parse(\"https://api.hitbtc.com\")\n\tu.Path = path.Join(\"/api/2/public/currency/\", symbol.BaseCurrency)\n\tresp, err := http.Get(u.String())\n\tif err != nil {\n\t\tfmt.Printf(\"getting error from api %s\", err)\n\t}\n\t\n\tb, _ := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\n\terr = json.Unmarshal(b, &crDetail)\n\tcrDetail.FeeCurrency = symbol.FeeCurrency\n\tif err != nil {\n\t\tfmt.Printf(\"getting error from api read %s\", err)\n\t}\n\n\ttick := getTicker(symbol.ID)// Get latest currency details from bit api\n\tcrDetail.Ticker = tick\n\tjson.NewEncoder(w).Encode(crDetail)\n}", "title": "" }, { "docid": "7012b4059a203a4914d50c213e8a7f72", "score": "0.56394196", "text": "func (c *Cloud) GetLoadBalancerByID(id string) (*brightbox.LoadBalancer, error) {\n\tklog.V(4).Infof(\"GetLoadBalancerById (%q)\", id)\n\tclient, err := c.CloudClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.LoadBalancer(id)\n}", "title": "" }, { "docid": "d90bdbd952e34012acfb1972adcea32c", "score": "0.5635272", "text": "func (r *SQLRepo) GetByID(id string) (*pb.Product, error) {\n\n\tdb, err := r.GetDB()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(`select id, title, description, price_in_cents from public.products where id = $1`)\n\tdefer stmt.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(id)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tpbProduct, err := transform(rows)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn pbProduct, nil\n\t}\n\n\treturn nil, errors.New(\"Not found\")\n}", "title": "" }, { "docid": "03652f9945e38762024ca09e70d6dedf", "score": "0.56346256", "text": "func (b Branch) Get(path Path) interface{} {\n\tvar node interface{} = b\n\tfor _, p := range path {\n\t\tbr, _ := node.(Branch)\n\t\tif br == nil {\n\t\t\treturn nil\n\t\t}\n\t\tnode = br[p]\n\t}\n\treturn node\n}", "title": "" }, { "docid": "6063fce177845ff40e71f31a9ca39ca0", "score": "0.56345004", "text": "func (c *Client) GetBranch(ctx context.Context, project, branch string) (BranchInfo, error) {\n\tvar res BranchInfo\n\terr := c.do(ctx, &res, \"GET\", fmt.Sprintf(\"/projects/%s/branches/%s\", project, branch))\n\treturn res, err\n}", "title": "" }, { "docid": "20b3b1415769788a768935662e8a0659", "score": "0.56246483", "text": "func (connection *Connection) GetByID(db *gorm.DB, id uuid.UUID) error {\n\tif err := db.Where(\"id = ?\", id).First(&connection).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ea94607d94b1d8b98c5a9a35bf1dc3b", "score": "0.5622743", "text": "func findById(session *mgo.Session, id string) (Building, error) {\n\tvar bld Building\n\terr := getBuildingCollection(session).FindId(bson.ObjectIdHex(id)).One(&bld)\n\treturn bld, err\n}", "title": "" }, { "docid": "d57ef1af934f108091822a57c7f7271b", "score": "0.5616613", "text": "func (r *BranchRepository) GetCityByID(ctx context.Context, cityID uint) (*entities.City, error) {\n\tctx, cancelFunc := context.WithCancel(ctx)\n\tvar city entities.City\n\tdbt := r.DB.Where(\"id = ?\", cityID).Find(&city)\n\tif dbt.Error != nil {\n\t\tcancelFunc()\n\t\treturn nil, dbt.Error\n\t}\n\tcancelFunc()\n\treturn &city, nil\n}", "title": "" }, { "docid": "4a365b3cdca2d20540214624c7843874", "score": "0.56154513", "text": "func (store *BadgerStackStorage) Get(id string) (*thrapb.Stack, error) {\n\tvar (\n\t\tkey = store.getOpaqueKey(id)\n\t\tstack *thrapb.Stack\n\t)\n\n\terr := store.db.View(func(txn *badger.Txn) error {\n\t\tvar err error\n\t\tstack, err = store.getStack(txn, key)\n\t\treturn err\n\t})\n\n\treturn stack, err\n}", "title": "" }, { "docid": "6ad335bcc2124f279ef545408d0fb492", "score": "0.55985534", "text": "func getBlogByID(id int) (*Blog, error) {\r\n\tvar (\r\n\t\ttitle, description string\r\n\t\tcategories, tags string\r\n\t\t// category = BlogCategory{}\r\n\t)\r\n\trows, err := db.Query(\"select id, title, description, categories, tags from blogs where id = ?\", id)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tdefer rows.Close()\r\n\tfor rows.Next() {\r\n\t\terr := rows.Scan(&id, &title, &description, &categories, &tags)\r\n\t\tif err != nil {\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\r\n\t\tcategories := strings.Split(categories, \",\")\r\n\r\n\t\treturn &Blog{ID: id, Title: title, Description: description, BlogCategories: categories}, nil\r\n\t}\r\n\terr = rows.Err()\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\treturn nil, errors.New(\"Openings not found\")\r\n}", "title": "" }, { "docid": "04ddc663d6e4748373d07b0c724f25ed", "score": "0.55972743", "text": "func (p *Post) GetByID(w http.ResponseWriter, r *http.Request) {\n\tid, _ := strconv.Atoi(chi.URLParam(r, \"id\"))\n\tpayload, err := p.repo.GetByID(r.Context(), int64(id))\n\tif err != nil {\n\t\thelper.RespondWithError(w, http.StatusNotFound, \"Content not found\")\n\t}\n\n\thelper.RespondwithJSON(w, http.StatusOK, payload)\n}", "title": "" }, { "docid": "a20e0e3d7ff62f247e96cddd54525530", "score": "0.5573026", "text": "func Branch() string { return branch }", "title": "" }, { "docid": "e9cdfbdddb61568986075a08f11836d1", "score": "0.5572664", "text": "func (svc Service) GetBank(id int) (*Bank, error) {\n\treturn svc.s.get(id)\n}", "title": "" }, { "docid": "534580a5bfc23ad5ddebbc18247e81aa", "score": "0.55659795", "text": "func (b *BranchWeight) BranchID() (branchID ledgerstate.BranchID) {\n\treturn b.branchID\n}", "title": "" }, { "docid": "287c2f67f3ec86d41c8ec50fa51ab710", "score": "0.5563776", "text": "func (s *BanksService) BankByID(id int64, headers map[string]string, log logger.Logger) (response models.OperationResponseOfBankObject, err error) {\n\ti := strconv.FormatInt(id, 10)\n\terr = s.client.apiReq(http.MethodPost, \"/banks/\"+url.QueryEscape(i), nil, nil, &response, &headers, log)\n\treturn\n}", "title": "" }, { "docid": "194089fff3cc3ac639c1e0402217e556", "score": "0.5559727", "text": "func GetCabinetById(id int) (v *Cabinet, err error) {\n\to := orm.NewOrm()\n\tv = &Cabinet{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "177680c6618a925a58fd8f44c51238d2", "score": "0.55576324", "text": "func (bpdb *BitpartmentDB) GetHouseByID(id int) (*House, error) {\n\thouse := &House{HouseID: id}\n\terr := bpdb.db.Model(house).Where(\"house_id = ?house_id\").Select()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"Got house:\", house)\n\treturn house, nil\n}", "title": "" }, { "docid": "a242abd397dd8dae9015132a5f3636a7", "score": "0.55526876", "text": "func GetBookByID(c *gin.Context){\n\tid := c.Param(\"id\")\n\terr := bs.BookByID(id)\n\tif err!=nil{\n\t\tc.IndentedJSON(http.StatusNotFound,gin.H{\"message\":\"No such book exists!\"})\n\t\treturn \n\t}\n\tc.IndentedJSON(http.StatusOK,bs.GetBook())\n}", "title": "" }, { "docid": "83f5f12dc496f183f0f40f1e14007b03", "score": "0.5539792", "text": "func (rs *MasterService) FindMasterByID(id int64) (*models.Master, error) {\n\n\tvar err error\n\n\turl := fmt.Sprintf(\"%s%s%v\", rs.url, rs.uri, id)\n\n\t// Add token to request headers\n\theaders := map[string]string{\n\t\t\"User-Agent\": rs.useragent,\n\t\t\"Authorization\": \"Discogs token=\" + rs.token,\n\t}\n\n\tq := new(requests.HTTPClient)\n\n\tbody, err := q.Send(url, nil, headers)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\n\terr = json.Unmarshal(body, &rs.master)\n\treturn rs.master, err\n\n}", "title": "" }, { "docid": "a43de56a990cb7b4a99518f88ec27bd0", "score": "0.5539781", "text": "func getByID(root *xmlpath.Node, id string) (*xmlpath.Node, error) {\n\treturn getByXPath(root, fmt.Sprintf(`.//*[@id=\"%s\"]`, id))\n}", "title": "" }, { "docid": "8cb631ba40f6750036b98d92efbc8267", "score": "0.55394053", "text": "func getBranch(folder string) string {\n\tout, _ := cmd.ExecCmd(\"git\", []string{\"-C\", file.Rel(folder), \"rev-parse\", \"--abbrev-ref\", \"HEAD\"})\n\treturn strings.Trim(out, \"\\n \")\n}", "title": "" }, { "docid": "0c0ad845d823d14f4196d0d1bbc07dcf", "score": "0.55368805", "text": "func (instance *XCountryDAO) GetByID(countryID int32) (model.XCountry, error) {\n\treturn instance.getOneWhere(\n\t\t`WHERE id = $1 AND deleted_at IS NULL`,\n\t\tcountryID)\n}", "title": "" }, { "docid": "db24292a08720b0703532078645b2a97", "score": "0.5532046", "text": "func (r *repositoryBlogsCRUD) FindByID(bid uint32) (models.Blog, error) {\n\tvar err error\n\tblogs := models.Blog{}\n\tdone := make(chan bool)\n\tgo func(ch chan<- bool) {\n\t\tdefer close(ch)\n\t\terr = r.db.Debug().Model(&models.Blog{}).Where(\"id = ?\", bid).Take(&blogs).Error\n\t\tif err != nil {\n\t\t\tch <- false\n\t\t\treturn\n\t\t}\n\t\tif blogs.ID != 0 {\n\t\t\terr = r.db.Debug().Model(&models.Blog{}).Where(\"id = ?\", blogs.AuthorID).Error\n\t\t\tif err != nil {\n\t\t\t\tch <- false\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tch <- true\n\t}(done)\n\tif channels.OK(done) {\n\t\treturn blogs, nil\n\t}\n\treturn models.Blog{}, err\n}", "title": "" }, { "docid": "fffadc8c87fa7c09084efd0235d3f570", "score": "0.5531738", "text": "func (s *CoinsService) GetByID(coinID string) (coin *Coin, err error) {\n\turl := fmt.Sprintf(\"%s/coins/%s\", baseURL, coinID)\n\n\tbody, err := sendGET(s.httpClient, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(body, &coin)\n\treturn coin, err\n}", "title": "" }, { "docid": "84f91b6ace904c4646f7b8b473567587", "score": "0.5531533", "text": "func (s *server) GetById(ctx context.Context, in *pb.PlaceIdRequest) (*pb.PlaceResponse, error) {\n\n\t// TODO request storage\n\tdummyPlace := &pb.Place{\n\t\tId: in.GetId(),\n\t\tName: \"Dummy name\",\n\t\tLocation: \"Dummy location\",\n\t}\n\n\t// test output\n\tfmt.Println(\"Received: get place by id:\", in.GetId())\n\n\treturn &pb.PlaceResponse{Place: dummyPlace}, nil\n}", "title": "" }, { "docid": "7089dbced3c0ff989707bc416be35d33", "score": "0.5515718", "text": "func (db *DB) GetBottle(account, id int) *BottleModel {\n\tdb.Lock()\n\tdefer db.Unlock()\n\tbottles, ok := db.bottles[account]\n\tif !ok {\n\t\treturn nil\n\t}\n\tfor _, b := range bottles {\n\t\tif b.ID == id {\n\t\t\treturn b\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67886fa884dd3bcfce05db551c64c7da", "score": "0.55145824", "text": "func (dispenser *Dispenser) GetByID(db *gorm.DB, id uuid.UUID) error {\n\tif err := db.Where(\"id = ?\", id).First(&dispenser).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "284e16882a3aa1f3ad98dc9c30276c54", "score": "0.5509411", "text": "func (repo *TestClientsRepo) GetByID(id uint) (models.Client, error) {\n\n\tfor _, item := range repo.clients {\n\t\tif item.ID == id {\n\t\t\treturn item, nil\n\t\t}\n\t}\n\n\tvar ret models.Client\n\treturn ret, errors.New(\"coulnd not find item\")\n}", "title": "" }, { "docid": "c5e54407a927d116b5ae2cbc696b3745", "score": "0.55085015", "text": "func (r *mockBranchRepository) GetCityByID(ctx context.Context, cityID uint) (*entities.City, error) {\n\tctx, cancelFunc := context.WithCancel(ctx)\n\tvar city entities.City\n\tcity.ID = cityID\n\tcancelFunc()\n\treturn &city, nil\n}", "title": "" }, { "docid": "98dd0013d8d901cabf708adf673eabd3", "score": "0.549854", "text": "func (m projectUsecase) GetByID(ctx context.Context, id models.UUID) (*models.Project, []models.Member, error) {\n\treturn m.projectRepos.GetByID(ctx, id)\n}", "title": "" }, { "docid": "7e5ac27df3eb6e4d67e933cc735a48e2", "score": "0.54935133", "text": "func LoadByID(s *state.State, id int) (Instance, error) {\n\t// Get the DB record\n\tproject, name, err := s.DB.Cluster.GetInstanceProjectAndName(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn LoadByProjectAndName(s, project, name)\n}", "title": "" }, { "docid": "e4afad208a3647df738c557d432f2ebf", "score": "0.54907644", "text": "func (h *Handler) GetBookByID(w http.ResponseWriter, r *http.Request, param httprouter.Params) {\n\t// TODO: Implement this. Query = SELECT id, title, author, isbn, stock FROM books WHERE id = <bookID>\n}", "title": "" }, { "docid": "7bd46431dcd02955217a4d6940415366", "score": "0.5489861", "text": "func GetBlockById(db *sql.DB, Id int) (MODELS.BLOCKS, bool) {\n\tvar Block MODELS.BLOCKS\n\t//db, err := connectdatabase()\n\t//// Query all users\n\tif db == nil {\n\n\t\tlog.Print(\"can not connect to database!\")\n\t\treturn Block, false\n\t}\n\t//defer db.Close()\n\n\trows, err := db.Query(\"select * from BLOCKS where id = ?\", Id)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor rows.Next() {\n\t\tvar block MODELS.BLOCKS\n\t\terr := rows.Scan(&block.Id, &block.NameBlock, &block.Address, &block.Description, &block.IdOwner)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tBlock = block\n\t}\n\tdefer rows.Close()\n\treturn Block, true\n}", "title": "" }, { "docid": "3135ad0c6f426868565295a9bfdfc2e2", "score": "0.5478519", "text": "func (c Client) GetByID(id string, params *stripe.FinancialConnectionsAccountParams) (*stripe.FinancialConnectionsAccount, error) {\n\tpath := stripe.FormatURLPath(\"/v1/financial_connections/accounts/%s\", id)\n\taccount := &stripe.FinancialConnectionsAccount{}\n\terr := c.B.Call(http.MethodGet, path, c.Key, params, account)\n\treturn account, err\n}", "title": "" }, { "docid": "3135ad0c6f426868565295a9bfdfc2e2", "score": "0.5478519", "text": "func (c Client) GetByID(id string, params *stripe.FinancialConnectionsAccountParams) (*stripe.FinancialConnectionsAccount, error) {\n\tpath := stripe.FormatURLPath(\"/v1/financial_connections/accounts/%s\", id)\n\taccount := &stripe.FinancialConnectionsAccount{}\n\terr := c.B.Call(http.MethodGet, path, c.Key, params, account)\n\treturn account, err\n}", "title": "" }, { "docid": "49d206b56d6d1acf1badc8be1d7a9dae", "score": "0.54758906", "text": "func GetBarangById(Id int) (*DataBarang, error) {\n\tbarang := GetDataBarang()\n\tfor _, a := range *barang {\n\t\tif a.ID == Id {\n\t\t\treturn &a, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"Barang Tidak ada\")\n}", "title": "" }, { "docid": "a5ba97871e73abfdb7b81d4c7270e6c0", "score": "0.546947", "text": "func (msr *mysqlShippingRepository) GetById(id int64) (shipping *models.Shipping, err error) {\n\tquery := `SELECT ` + shippingSqlFields + `,` + customerSqlFields + ` FROM shipping\n\tINNER JOIN customer ON shipping.customer_id = customer.customer_id WHERE shipping_id = ?`\n\tshippings, err := msr.fetch(query, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(shippings) > 0 {\n\t\tshipping = shippings[0]\n\t} else {\n\t\terr = models.ErrNotFound\n\t}\n\treturn\n}", "title": "" }, { "docid": "c27f8fd6dbba9f305f15057facdeafd1", "score": "0.5468292", "text": "func (db *Postgres) GetByID(table string, ID interface{}) (*sql.Row, error) {\n\treturn db.driver.QueryRow(\"SELECT * FROM \"+table+\" WHERE id = $1\", ID), nil\n}", "title": "" }, { "docid": "aa0663c902f6ff3e9749470b3438e287", "score": "0.54610926", "text": "func (r *repository) Get(id int) *Transaction {\n\tfor _, t := range transactions {\n\t\tif t.Id == id {\n\t\t\treturn t\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5beaa1ffe8612e7cdaea759ccb7a3032", "score": "0.54554975", "text": "func BizCashLogByID(ctx context.Context, id int, key ...interface{}) (*BizCashLog, error) {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\ttableName, err := GetBizCashLogTableName(key...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// sql query\n\tsqlstr := `SELECT ` +\n\t\t`id, sid, fid, fsid, related_type, related_id, action, action_cash, cash_before, cash_left, created_at ` +\n\t\t`FROM ` + tableName +\n\t\t` WHERE id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, id)))\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetSlaveConn()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tbcl := BizCashLog{\n\t\t_exists: true,\n\t}\n\n\tif tx != nil {\n\t\terr = tx.QueryRow(sqlstr, id).Scan(&bcl.ID, &bcl.Sid, &bcl.Fid, &bcl.Fsid, &bcl.RelatedType, &bcl.RelatedID, &bcl.Action, &bcl.ActionCash, &bcl.CashBefore, &bcl.CashLeft, &bcl.CreatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\terr = dbConn.QueryRow(sqlstr, id).Scan(&bcl.ID, &bcl.Sid, &bcl.Fid, &bcl.Fsid, &bcl.RelatedType, &bcl.RelatedID, &bcl.Action, &bcl.ActionCash, &bcl.CashBefore, &bcl.CashLeft, &bcl.CreatedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &bcl, nil\n}", "title": "" }, { "docid": "3b99478e34938e28a042e0f2972abe7d", "score": "0.5453205", "text": "func (Simple) GetByID(txn *ndgo.Txn, uid string, result interface{}) (err error) {\n\tif err = validateInput(result); err != nil {\n\t\treturn err\n\t}\n\tdgType := getDgType(result)\n\treturn Stateless{}.GetByID(txn, uid, dgType, result)\n}", "title": "" }, { "docid": "9c219bc2dfb2a5ad76037787453ae810", "score": "0.5449574", "text": "func (m *mmu) GetBank(id bankID, typ bankType) *bank {\n\treturn &m.banks[typ][id]\n}", "title": "" }, { "docid": "bc51dfaee1e39c35fe3679fef1dc7eb5", "score": "0.54469043", "text": "func (p *Group) Get(id string) Balancer {\n\tp.l.Lock()\n\tdefer p.l.Unlock()\n\tif p.m == nil {\n\t\tpanic(errGroupClosed)\n\t}\n\tif actual, ok := p.m[id]; ok {\n\t\treturn actual\n\t}\n\tnewborn := p.g()\n\tp.m[id] = newborn\n\treturn newborn\n}", "title": "" }, { "docid": "79844c516d0daf31003f31889618bf2b", "score": "0.54437214", "text": "func (building *Building) FindBuildingFootPrintById(session *mgo.Session, id string) (Building, error) {\n\tvar bld Building\n\tif bson.IsObjectIdHex(id) {\n\t\tbld, err := findById(session, id)\n\t\treturn bld, err\n\t} else {\n\t\treturn bld, errors.New(\"please provide a valid Object ID\")\n\t}\n}", "title": "" }, { "docid": "6cbc80720a65c456ef7511b74633699f", "score": "0.54431987", "text": "func (h *Handler) GetBookByID(c *fiber.Ctx) error {\n\n\tid := c.Params(\"id\")\n\tbook := Book{}\n\n\terr := h.db.Where(\"id = ?\", id).First(&book).Error\n\tif err != nil {\n\t\treturn c.Status(http.StatusNotFound).JSON(err.Error())\n\t}\n\n\treturn c.Status(http.StatusOK).JSON(book)\n}", "title": "" }, { "docid": "ae0b0accb8cee7629523fc1f3394d257", "score": "0.54404646", "text": "func (accessor *JobAccessor) GetByID(id uint) (*Job, error) {\n\tjob := Job{}\n\terr := accessor.DB.First(&job, id).Error\n\treturn &job, err\n}", "title": "" }, { "docid": "cbbde8decf64e472b0ac715cf12b1c8e", "score": "0.5435433", "text": "func (s *MongoStore) GetByBlockID(id bson.ObjectId) (*Block, error) {\n\tblock := &Block{}\n\terr := s.col.FindId(id).One(block)\n\tif err != nil {\n\t\treturn nil, ErrBlockNotFound\n\t}\n\treturn block, nil\n}", "title": "" }, { "docid": "5bfb23bb0d69294a060d41abe76f57d7", "score": "0.54339033", "text": "func (db *Local) GetBookByID(id int) (*model.Book, error) {\n\tdb.Lock()\n\tdefer db.Unlock()\n\treturn db.getBookByID(id)\n}", "title": "" }, { "docid": "9d19c8a435048efb4f3a3e2f2e4229fd", "score": "0.5432498", "text": "func GetByID(id string) (*repositoryML.Config, error) {\n\tf := []stgType.Filter{\n\t\t{Key: model.KeyID, Value: id},\n\t}\n\tout := &repositoryML.Config{}\n\terr := stg.SVC.FindOne(model.EntityDataRepository, out, f)\n\tif err == nil {\n\t\tupdatedResult, err := updateResult(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout = updatedResult\n\t}\n\treturn out, err\n}", "title": "" }, { "docid": "103cdd8ca898c49fb970e58cd84754d2", "score": "0.5430194", "text": "func (r *Graph) Get(ref string) *Commit {\n\tr.graphMtx.RLock()\n\tdefer r.graphMtx.RUnlock()\n\tif c, ok := r.commits[ref]; ok {\n\t\treturn c\n\t}\n\tfor _, b := range r.branches {\n\t\tif ref == b.Name {\n\t\t\tif c, ok := r.commits[b.Head]; ok {\n\t\t\t\treturn c\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f84d58ef8ca9e1109e5dd0d49ab7b4a6", "score": "0.54247975", "text": "func (s *Statement) BranchID() (branchID ledgerstate.BranchID) {\n\treturn s.branchID\n}", "title": "" }, { "docid": "b644a760500727e61502f00980fadf5f", "score": "0.5422857", "text": "func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch string, options ...RequestOptionFunc) (*ProtectedBranch, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"projects/%s/protected_branches/%s\", PathEscape(project), url.PathEscape(branch))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tp := new(ProtectedBranch)\n\tresp, err := s.client.Do(req, p)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn p, resp, nil\n}", "title": "" }, { "docid": "9b9c6715a9e6c482a23bb63d4595abf3", "score": "0.5420955", "text": "func (s *Service) GetBlockByID(id int) (model.Block, error) {\n\tblock, err := s.Node1.GetBlockByID(id)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn model.Block{}, err\n\t}\n\n\treturn block, err\n}", "title": "" }, { "docid": "496e35dcb447e89bb76ff38ad893e493", "score": "0.5416681", "text": "func (f *FakeProvider) GetBranch(owner string, repo string, branch string) (*GitBranch, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "1bc481cb77c7ce171c91e6834e4b18d2", "score": "0.54139054", "text": "func (r *BranchRepository) GetByOwner(ctx context.Context, ownerID uint) ([]entities.Branch, error) {\n\tvar b []entities.Branch\n\tdbt := r.DB.Where(\"owner_id = ?\", ownerID).Find(&b)\n\tif dbt.Error != nil {\n\t\tif dbt.RecordNotFound() {\n\t\t\tctx.Done()\n\t\t\treturn nil, nil\n\t\t}\n\t\tctx.Done()\n\t\tlog.Error(dbt.Error)\n\t\treturn nil, errors.Wrap(dbt.Error, \"error getting branches associated with the given owner\")\n\t}\n\tfor id, branch := range b {\n\t\tcity, err := r.GetCityByID(ctx, branch.CityID)\n\t\tif err != nil {\n\t\t\tctx.Done()\n\t\t\tlog.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\t\tb[id].City = *city\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "564310161f9fabbce0ce850de3a84d79", "score": "0.5413215", "text": "func (r repository) Get(ctx context.Context, id string) (entity.Comment, error) {\n\tvar com entity.Comment\n\tkey := strings.ToLower(id)\n\terr := r.db.Get(ctx, key, &com)\n\treturn com, err\n}", "title": "" }, { "docid": "894f7de4779b40f21fed7ba435098456", "score": "0.5412541", "text": "func (r Repository) Get(ctx context.Context, id uuid.UUID) (domain.Bet, error) {\n\tbet, err := r.StorageProvider.Get(ctx, id)\n\tif err != nil {\n\t\treturn domain.Bet{}, err\n\t}\n\n\treturn storage.AdaptBetToDomain(bet), nil\n}", "title": "" }, { "docid": "5ee3f53978a2031d535f2b0df35dddfb", "score": "0.5411091", "text": "func GetBranch(branchName string, path string) (*Branch, error) {\n\tif repo == nil {\n\t\trepository, err := git.PlainOpen(path)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to open repository: %s\", err)\n\t\t}\n\t\trepo = repository\n\t}\n\n\ttree, err := repo.Worktree()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = tree.Checkout(&git.CheckoutOptions{\n\t\tBranch: plumbing.NewBranchReferenceName(branchName),\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn GetCurrentBranch(path)\n}", "title": "" }, { "docid": "59358de5169e95c78201e2057fa43489", "score": "0.5409035", "text": "func (d *Dealer) Get(id string) (*sql.DB, error) {\n\tif db, ok := d.pool.Get(id); ok {\n\t\treturn db, nil\n\t}\n\n\tname, err := d.masterController.Get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb, err := d.tenantController.Get(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td.pool.Put(id, db)\n\treturn db, nil\n}", "title": "" }, { "docid": "32490f24dc8de4d0cb67b9ac0e901fe6", "score": "0.54050654", "text": "func (c *BuildCache) Get(id int) (*buildbot.Build, error) {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\tb, ok := c.byId[id]\n\tif ok {\n\t\treturn b, nil\n\t}\n\tglog.Warningf(\"Missing build with id %d; loading now.\", id)\n\tbuilds, err := buildbot.GetBuildsFromDB([]int{id})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif b, ok := builds[id]; ok {\n\t\treturn b, nil\n\t}\n\treturn nil, fmt.Errorf(\"No such build: %d\", id)\n}", "title": "" }, { "docid": "1296009a0e7e3343f68c136712d6a307", "score": "0.54021156", "text": "func GetStockByID(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar stock Models.Stock\n\terr := Models.GetStockByID(&stock, id)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, stock)\n\t}\n}", "title": "" }, { "docid": "9a5e2f3ecbf9a47355190d06f7cbcffb", "score": "0.54017496", "text": "func (q *Store) GetByID(id string) (*Reader, error) {\n\tvar reader Reader\n\tlogger := q.logger.With(\"operation\", \"GetReader\")\n\tlogger.Debug(\"Start Query\")\n\tb, err := q.db.NamedQuery(\"SELECT * FROM reader Where id=:id\",\n\t\tmap[string]interface{}{\n\t\t\t\"id\": id,\n\t\t})\n\tif err != nil {\n\t\tlogger.Error(\"Failed to Get Reader\")\n\t\treturn nil, err\n\t}\n\tdefer b.Close()\n\n\tif !b.Next() {\n\t\treturn &reader, nil\n\t}\n\tlogger.Debug(\"Struct Scanner Started\")\n\terr = b.StructScan(&reader)\n\tif err != nil {\n\t\tlogger.Error(\"Failed to Scan Struct\", \"error\", err)\n\t\treturn &reader, err\n\t}\n\treturn &reader, nil\n}", "title": "" } ]
aa93b4a6d167b266c3b679424580bcec
resourceProvisionTokenCreate creates Teleport token from resource definition
[ { "docid": "d7628624633192d18fc8569ad0ac964b", "score": "0.81067127", "text": "func resourceProvisionTokenCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {\n\tc, err := getClient(m)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\tname, err := getResourceName(d, \"provision_token\")\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\t// Check if token already exists\n\t_, err = c.GetToken(ctx, name)\n\tif err == nil {\n\t\texistErr := \"token \" + name + \" exists in Teleport. Either remove it (tctl tokens rm \" + name + \")\" +\n\t\t\t\" or import it to the existing state (terraform import teleport_provision_token.\" + name + \" \" + name + \")\"\n\n\t\treturn diagFromErr(trace.Errorf(existErr))\n\t}\n\tif err != nil && !trace.IsNotFound(err) {\n\t\treturn diagFromErr(describeErr(err, \"token\"))\n\t}\n\n\tt := types.ProvisionTokenV2{}\n\terr = tfschema.FromTerraformProvisionTokenV2(d, &t)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\terr = t.CheckAndSetDefaults()\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\terr = c.UpsertToken(ctx, &t)\n\tif err != nil {\n\t\treturn diagFromErr(describeErr(err, \"token\"))\n\t}\n\n\td.SetId(t.GetName())\n\n\treturn resourceProvisionTokenRead(ctx, d, m)\n}", "title": "" } ]
[ { "docid": "265daa047370645d02d51502db1dbb72", "score": "0.7049592", "text": "func resourceTeleportProvisionToken() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreateContext: resourceProvisionTokenCreate,\n\t\tReadContext: resourceProvisionTokenRead,\n\t\tUpdateContext: resourceProvisionTokenUpdate,\n\t\tDeleteContext: resourceProvisionTokenDelete,\n\n\t\tSchema: tfschema.SchemaProvisionTokenV2,\n\t\tSchemaVersion: 2,\n\n\t\tImporter: &schema.ResourceImporter{\n\t\t\tStateContext: schema.ImportStatePassthroughContext,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2215b9b028e0b62aae45494cb66798b6", "score": "0.6645785", "text": "func (a *Agent) CreateToken(account *accounts.Account, permissions string, expiry time.Duration) (token string) {\n b := make([]byte, 32)\n crand.Read(b)\n token = fmt.Sprintf(\"%x\", b)\n //store token in the agent\n a.tokens[token] = Token{(time.Now()).Add(expiry), account, token, permissions}\n return token\n}", "title": "" }, { "docid": "69269df0fc7e31d7dd6e0a2f9af18a40", "score": "0.6351354", "text": "func (vcdClient *VCDClient) CreateToken(org, tokenName string) (*Token, error) {\n\tapiTokenParams := &types.ApiTokenParams{\n\t\tClientName: tokenName,\n\t}\n\n\tnewTokenParams, err := vcdClient.RegisterToken(org, apiTokenParams)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to register API token: %s\", err)\n\t}\n\n\ttokenUrn, err := BuildUrnWithUuid(\"urn:vcloud:token:\", newTokenParams.ClientID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build URN: %s\", err)\n\t}\n\n\ttoken, err := vcdClient.GetTokenById(tokenUrn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get token: %s\", err)\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "674fd3d30fa446f40570053b0a556307", "score": "0.62805855", "text": "func (t *token) CreateToken(w http.ResponseWriter, r *http.Request) {\n\tmod := &engine.CreateTokenReq{}\n\tjson.NewDecoder(r.Body).Decode(&mod)\n\n\tresult := t.CreateTokenUsecase(mod)\n\n\tresp, _ := json.Marshal(result)\n\n\tDefaultRespon(w, resp)\n}", "title": "" }, { "docid": "42644a604c01f38edd3985bb99466765", "score": "0.62593114", "text": "func resourcePlatformCreate(d *schema.ResourceData, m interface{}) error {\n\tclient := m.(*pkg.KrokClient)\n\texpandedVCSToken, err := expandVCSTokenResource(d)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := client.VcsClient.Create(expandedVCSToken); err != nil {\n\t\tlog.Println(\"Failed to create vcstoken.\")\n\t\treturn fmt.Errorf(\"failed to create vcstoken: %w\", err)\n\t}\n\td.SetId(uniqueResourceID())\n\treturn resourceCommandRead(d, m)\n}", "title": "" }, { "docid": "96fe0b3ad0d788b5d3f307065498bf83", "score": "0.6161243", "text": "func resourceProvisionTokenRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {\n\tc, err := getClient(m)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\tid := d.Id()\n\n\tt, err := c.GetToken(ctx, id)\n\tif trace.IsNotFound(err) {\n\t\td.SetId(\"\")\n\t\treturn diag.Diagnostics{}\n\t}\n\n\tif err != nil {\n\t\treturn diagFromErr(describeErr(err, \"token\"))\n\t}\n\n\ttV2, ok := t.(*types.ProvisionTokenV2)\n\tif !ok {\n\t\treturn diagFromErr(fmt.Errorf(\"failed to convert created user to types.ProvisionTokenV2 from %T\", t))\n\t}\n\n\terr = tfschema.ToTerraformProvisionTokenV2(tV2, d)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\treturn diag.Diagnostics{}\n}", "title": "" }, { "docid": "6fcbb11600d4841ed49e4b5b78609aee", "score": "0.61406827", "text": "func (c *ApiService) CreateToken(params *CreateTokenParams) (*ApiV2010Token, error) {\n\tpath := \"/2010-04-01/Accounts/{AccountSid}/Tokens.json\"\n\tif params != nil && params.PathAccountSid != nil {\n\t\tpath = strings.Replace(path, \"{\"+\"AccountSid\"+\"}\", *params.PathAccountSid, -1)\n\t} else {\n\t\tpath = strings.Replace(path, \"{\"+\"AccountSid\"+\"}\", c.requestHandler.Client.AccountSid(), -1)\n\t}\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.Ttl != nil {\n\t\tdata.Set(\"Ttl\", fmt.Sprint(*params.Ttl))\n\t}\n\n\tresp, err := c.requestHandler.Post(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &ApiV2010Token{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "title": "" }, { "docid": "4fe3c0c4879f9259684dc065597b8001", "score": "0.6107887", "text": "func planCreateToken(c *gin.Context) {\n\tvar req dto.PlanCreateTokenReq\n\tif bindOrAbort(c, &req) != nil {\n\t\treturn\n\t}\n\n\tvar userID int64\n\tif getUserIDOrAbort(c, &userID) != nil {\n\t\treturn\n\t}\n\n\t// existence and ownership\n\tif planOwnershipOrAbort(c, req.ID, userID) != nil {\n\t\treturn\n\t}\n\n\t// cannot create token of plan more than 30\n\tvar tokenCount int64\n\trow := db.DB.QueryRow(\"select count(*) from t_plan_token where c_plan_id = ?;\", req.ID)\n\terr := row.Scan(&tokenCount)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tc.AbortWithStatusJSON(http.StatusBadGateway, dto.NewResponseBad(err.Error()))\n\t}\n\tif tokenCount >= 30 {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, dto.NewResponseBad(\n\t\t\t\"number of tokens of the same plan cannot be more than 30, revoke some tokens before create more.\"))\n\t\treturn\n\t}\n\n\ttoken := utils.GenerateToken()\n\t_, err = db.DB.Exec(\"insert into t_plan_token (c_plan_id, c_token) values (?, ?)\", req.ID, token)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tc.AbortWithStatusJSON(http.StatusBadGateway, dto.NewResponseBad(err.Error()))\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, dto.NewResponseFine(dto.PlanCreateTokenRes{Token: token}))\n}", "title": "" }, { "docid": "9c43eb701097bc22156294cab28f47f0", "score": "0.61038685", "text": "func CreateToken(clientset clientset.Interface, duration time.Duration, hostname string) (string, error) {\n\ttokenStr, err := bootstraputil.GenerateBootstrapToken()\n\tif err != nil {\n\t\tlog.Printf(\"Error generating token to upload certs: %s\", err)\n\t\treturn \"\", err\n\t}\n\ttoken, err := kubeadmapi.NewBootstrapTokenString(tokenStr)\n\tif err != nil {\n\t\tlog.Printf(\"Error creating upload certs token: %s\", err)\n\t\treturn \"\", err\n\t}\n\ttokens := []kubeadmapi.BootstrapToken{{\n\t\tToken: token,\n\t\tDescription: fmt.Sprintf(\"EdgeNet token for adding node called %s\", hostname),\n\t\tTTL: &metav1.Duration{\n\t\t\tDuration: duration,\n\t\t},\n\t\tUsages: []string{\"authentication\", \"signing\"},\n\t\tGroups: []string{\"system:bootstrappers:kubeadm:default-node-token\"},\n\t}}\n\n\tif err := nodebootstraptokenphase.CreateNewTokens(clientset, tokens); err != nil {\n\t\tlog.Printf(\"Error creating token: %s\", err)\n\t\treturn \"\", err\n\t}\n\t// This reads server info of the current context from the config file\n\tserver, err := custconfig.GetServerOfCurrentContext()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\tserver = s.Trim(server, \"https://\")\n\tserver = s.Trim(server, \"http://\")\n\t// This reads CA cert to be hashed\n\tcerts, err := cert.CertsFromFile(\"/etc/kubernetes/pki/ca.crt\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\tvar CA string\n\tfor i, cert := range certs {\n\t\tif i == 0 {\n\t\t\thashedCA := sha256.Sum256([]byte(cert.RawSubjectPublicKeyInfo))\n\t\t\tCA = fmt.Sprintf(\"sha256:%x\", hashedCA)\n\t\t}\n\t}\n\n\tjoinCommand := fmt.Sprintf(\"kubeadm join %s --token %s --discovery-token-ca-cert-hash %s\", server, tokens[0].Token.String(), CA)\n\treturn joinCommand, nil\n}", "title": "" }, { "docid": "308177c1cda288bdca942ba26c3ce893", "score": "0.6075409", "text": "func (p *PasetoToken) CreateToken(username string, scope []string, duration time.Duration) (string, error) {\n\tpayload, err := NewPayload(username, scope, duration)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn p.paseto.Encrypt(p.symmetricKey, payload, nil)\n}", "title": "" }, { "docid": "1aac8359f4c55d359942c3982fb1bbd4", "score": "0.60681397", "text": "func CreateToken(account string, minutes uint16, starttime uint64) string {\n\tcode := make([]byte, 22)\n\tif starttime == 0 {\n\t\tstarttime = uint64(time.Now().UTC().Unix())\n\t}\n\tbinary.LittleEndian.PutUint64(code, uint64(starttime))\n\tbinary.LittleEndian.PutUint16(code[8:], uint16(minutes))\n\trand.Read(code[10:14])\n\tmagickey := \"abc@123\"\n\tdata := fmt.Sprintf(\"%s%d%d%s\", account, starttime, minutes, magickey)\n\tdec := md5.New()\n\tdec.Write([]byte(data))\n\tverify := dec.Sum(nil)\n\tcopy(code[14:], verify[4:12])\n\treturn string(hex.EncodeToString(code))\n}", "title": "" }, { "docid": "3557a59531425a94c352e040bf869354", "score": "0.6007351", "text": "func (e Endpoints) CreateToken(ctx context.Context, groupid string, chainid string, symbol string, identify string, decimal string, chainName string) (asset *repository.SimpleAsset, err error) {\n\trequest := CreateTokenRequest{\n\t\tChainName: chainName,\n\t\tChainid: chainid,\n\t\tDecimal: decimal,\n\t\tGroupid: groupid,\n\t\tIdentify: identify,\n\t\tSymbol: symbol,\n\t}\n\tresponse, err := e.CreateTokenEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response.(CreateTokenResponse).Asset, nil\n}", "title": "" }, { "docid": "ddb51ff451a2727cc85377d909e95a14", "score": "0.5894993", "text": "func (c *Client) CreateToken(ctx context.Context, token types.ProvisionToken) error {\n\ttokenV2, ok := token.(*types.ProvisionTokenV2)\n\tif !ok {\n\t\treturn trace.BadParameter(\"invalid type %T\", token)\n\t}\n\t_, err := c.grpc.CreateToken(ctx, tokenV2, c.callOpts...)\n\treturn trail.FromGRPC(err)\n}", "title": "" }, { "docid": "6968de3f7c673b15bdddd30eb52a8f27", "score": "0.5883599", "text": "func resourceProvisionTokenUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {\n\tc, err := getClient(m)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\tid := d.Id()\n\n\t// Check that token exists. This situation is hardly possible because Terraform tries to read a resource before updating it.\n\tt, err := c.GetToken(ctx, id)\n\tif err != nil {\n\t\treturn diagFromErr(describeErr(err, \"token\"))\n\t}\n\n\ttV2, ok := t.(*types.ProvisionTokenV2)\n\tif !ok {\n\t\treturn diagFromErr(fmt.Errorf(\"failed to convert created token to types.GithubConnectorV3 from %T\", t))\n\t}\n\n\terr = tfschema.FromTerraformProvisionTokenV2(d, tV2)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\terr = c.UpsertToken(ctx, tV2)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\treturn resourceProvisionTokenRead(ctx, d, m)\n}", "title": "" }, { "docid": "15bbd2bea1440c3665498d4971e74201", "score": "0.58835936", "text": "func CreateToken(id uint, role string) (*TokenDetails, error) {\n\ttoken := &TokenDetails{}\n\tvar err error\n\ttoken.AExp = time.Now().Add(time.Minute * 1).Unix()\n\ttoken.AUuid = uuid.New().String()\n\ttoken.RExp = time.Now().Add(time.Hour * 24).Unix()\n\ttoken.RUuid = uuid.New().String()\n\n\n\tAClaims := jwt.MapClaims{}\n\n\tAClaims[\"authorized\"] = true\n\tAClaims[\"role\"] = role\n\tAClaims[\"a_id\"] = token.AUuid\n\tAClaims[\"id\"] = id\n\tAClaims[\"exp\"] = token.AExp\n\tatoken := jwt.NewWithClaims(jwt.SigningMethodHS256, AClaims)\n\n\ttoken.AToken, err = atoken.SignedString([]byte(os.Getenv(\"TokenPass\")))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tRClaims := jwt.MapClaims{}\n\tRClaims[\"authorized\"] = true\n\tRClaims[\"role\"] = role\n\tRClaims[\"r_id\"] = token.RUuid\n\tRClaims[\"id\"] = id\n\tRClaims[\"exp\"] = token.RExp\n\trtoken := jwt.NewWithClaims(jwt.SigningMethodHS256, RClaims)\n\t\n\ttoken.RToken, err = rtoken.SignedString([]byte(os.Getenv(\"TokenPass\")))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "cfc70c87e015fca5f39a9a3961fc08cd", "score": "0.58743006", "text": "func (mgr *Manager) CreateToken(id string) (string, error) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, &jwt.StandardClaims{\n\t\tSubject: id,\n\t})\n\treturn token.SignedString(mgr.secret)\n}", "title": "" }, { "docid": "fbb429486c6c714e9c6806aa0e72b3f1", "score": "0.586234", "text": "func CreateToken() map[string]string {\n\tlog := logs.NewLogger(10000)\n\tlog.SetLogger(\"console\", \"\")\n\n\ttoken := goJwt.New(goJwt.GetSigningMethod(\"RS256\")) // Create a Token that will be signed with RSA 256.\n\ttoken.Claims[\"ID\"] = \"This is my super fake ID\"\n\ttoken.Claims[\"exp\"] = time.Now().Unix() + 36000\n\t// The claims object allows you to store information in the actual token.\n\ttokenString, _ := token.SignedString(RSAKeys.PrivateKey)\n\t// tokenString Contains the actual token you should share with your client.\n\treturn map[string]string{\"token\": tokenString}\n}", "title": "" }, { "docid": "9f4751f6ec9fb59cf526f818dca88e59", "score": "0.5842872", "text": "func CreateGetWorkbenchTokenRequest() (request *GetWorkbenchTokenRequest) {\n\trequest = &GetWorkbenchTokenRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"EHPC\", \"2018-04-12\", \"GetWorkbenchToken\", \"ehs\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "bf4d6feed27415f1d9020af6d46441a3", "score": "0.58330387", "text": "func CreateNewToken(user modal.User, key modal.APIKey, deviceID string, macAddress string) modal.Token {\n\tnow := time.Now().Unix()\n\tdb := GetDBInstance()\n\tdefer db.Close()\n\tk, _ := base64.StdEncoding.DecodeString(secretkey)\n\tc, _ := aes.NewCipher(k)\n\tgcm, _ := cipher.NewGCM(c)\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tid, _ := shortid.Generate()\n\n\taccTokenString := \"Awaaz-App.AccessToken.\" + id + \".\" + user.ID + \".\" + key.APIKey + \".\" + key.Platform + \".\" + deviceID + \".\" + macAddress + \".\" + strconv.Itoa(accessTokenTime) + \".\" + strconv.Itoa(int(now))\n\trefTokenString := \"Awaaz-App.RefreshToken.\" + id + \".\" + user.ID + \".\" + key.APIKey + \".\" + key.Platform + \".\" + deviceID + \".\" + macAddress + \".\" + strconv.Itoa(refreshTokenTime) + \".\" + strconv.Itoa(int(now))\n\n\ttoken := modal.Token{\n\t\tID: id,\n\t\tAccessToken: hex.EncodeToString(gcm.Seal(nonce, nonce, []byte(accTokenString), nil)),\n\t\tAccessTokenExpiry: accessTokenTime,\n\t\tAccessTokenTime: strconv.Itoa(int(now)),\n\t\tRefreshToken: hex.EncodeToString(gcm.Seal(nonce, nonce, []byte(refTokenString), nil)),\n\t\tRefreshTokenTime: strconv.Itoa(int(now)),\n\t\tRefreshTokenExpiry: refreshTokenTime,\n\t\tUserID: user.ID,\n\t\tStatus: 1,\n\t\tAPIKey: key.APIKey,\n\t\tDeviceID: deviceID,\n\t\tMacAddress: macAddress,\n\t}\n\n\ttoken.Save(db);\n\treturn token\n}", "title": "" }, { "docid": "4abe122552af08441517ef66253be764", "score": "0.5826267", "text": "func (o *CommandTokenOptions) runCreateToken(out io.Writer, client kubeclient.Interface) error {\n\tklog.V(1).Infoln(\"[token] creating token\")\n\tbootstrapToken, err := tokenutil.GenerateRandomBootstrapToken(o.TTL, o.Description, o.Groups, o.Usages)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := tokenutil.CreateNewToken(client, bootstrapToken); err != nil {\n\t\treturn err\n\t}\n\n\ttokenStr := bootstrapToken.Token.ID + \".\" + bootstrapToken.Token.Secret\n\n\t// if --print-register-command was specified, print a machine-readable full `karmadactl register` command\n\t// otherwise, just print the token\n\tif o.PrintRegisterCommand {\n\t\tjoinCommand, err := tokenutil.GenerateRegisterCommand(*options.DefaultConfigFlags.KubeConfig, o.parentCommand, tokenStr, *options.DefaultConfigFlags.Context)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get register command, err: %w\", err)\n\t\t}\n\t\tfmt.Fprintln(out, joinCommand)\n\t} else {\n\t\tfmt.Fprintln(out, tokenStr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e37c8164038725325faeb7a2b68d6fa1", "score": "0.5801541", "text": "func CreateToken(privateKey *rsa.PrivateKey) (string, error) {\n\tatClaims := jwt.MapClaims{}\n\tatClaims[\"a_id\"] = \"4f9b99eb-490a-484e-bade-15e3841dfda9\"\n\tatClaims[\"c\"] = utils.TimeUnixMilli(time.Now())\n\tatClaims[\"exp\"] = utils.TimeUnixMilli(time.Now().Add(time.Hour * 24 * 30))\n\n\tat := jwt.NewWithClaims(jwt.SigningMethodRS256, atClaims)\n\ttoken, err := at.SignedString(privateKey)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "2e32f6f95b31e8cde5e1d31460e4d36f", "score": "0.5789508", "text": "func createToken(claims jwt.Claims) (string, error) {\n\t// Forge the token\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tss, err := token.SignedString(secretKey)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to issue token\")\n\t}\n\treturn ss, nil\n}", "title": "" }, { "docid": "dd549730422ff2a9f32a6df4fe2d2d5c", "score": "0.5770836", "text": "func CreateCapabilityToken(params CapabilityTokenParams) CapabilityToken {\n\treturn CapabilityToken{\n\t\tbaseJwt: &baseJwt.Jwt{\n\t\t\tSecretKey: params.AuthToken,\n\t\t\tIssuer: params.AccountSid,\n\t\t\tSubject: \"\",\n\t\t\tAlgorithm: HS256,\n\t\t\tNbf: params.Nbf,\n\t\t\tTtl: Max(params.Ttl, 3600),\n\t\t\tValidUntil: params.ValidUntil,\n\t\t},\n\t\tAccountSid: params.AccountSid,\n\t\tAuthToken: params.AuthToken,\n\t\tWorkspaceSid: params.WorkspaceSid,\n\t\tChannelID: params.ChannelID,\n\t\tPolicies: make([]Policy, 0),\n\t}\n}", "title": "" }, { "docid": "56e78424423c9581a75b22c90ca22114", "score": "0.5749098", "text": "func (c *ApiService) CreateToken(params *CreateTokenParams) (*OauthV1Token, error) {\n\tpath := \"/v1/token\"\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.GrantType != nil {\n\t\tdata.Set(\"GrantType\", *params.GrantType)\n\t}\n\tif params != nil && params.ClientSid != nil {\n\t\tdata.Set(\"ClientSid\", *params.ClientSid)\n\t}\n\tif params != nil && params.ClientSecret != nil {\n\t\tdata.Set(\"ClientSecret\", *params.ClientSecret)\n\t}\n\tif params != nil && params.Code != nil {\n\t\tdata.Set(\"Code\", *params.Code)\n\t}\n\tif params != nil && params.CodeVerifier != nil {\n\t\tdata.Set(\"CodeVerifier\", *params.CodeVerifier)\n\t}\n\tif params != nil && params.DeviceCode != nil {\n\t\tdata.Set(\"DeviceCode\", *params.DeviceCode)\n\t}\n\tif params != nil && params.RefreshToken != nil {\n\t\tdata.Set(\"RefreshToken\", *params.RefreshToken)\n\t}\n\tif params != nil && params.DeviceId != nil {\n\t\tdata.Set(\"DeviceId\", *params.DeviceId)\n\t}\n\n\tresp, err := c.requestHandler.Post(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &OauthV1Token{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "title": "" }, { "docid": "78e62a5bf707d893b08845f23b14d1eb", "score": "0.57192016", "text": "func (iam *Iamclient) CreatUserToken(passwd string, user_name string, domain_name string, project_name string, project_id string) (string, error) {\n\tvar str []byte\n\tmethods := []string{\"password\"}\n\trouter := fmt.Sprintf(\"%s/v3/auth/tokens\", iam.endpoint)\n\tif project_name != \"\" || project_id != \"\" {\n\t\trequstbody := AuthReqProject{\n\t\t\tAuth: AuthProject{\n\t\t\t\tIdentity: Identity{\n\t\t\t\t\tMethods: methods,\n\t\t\t\t\tPassword: Password{\n\t\t\t\t\t\tUser: User{\n\t\t\t\t\t\t\tPassword: passwd,\n\t\t\t\t\t\t\tName: user_name,\n\t\t\t\t\t\t\tDomain: Domain{\n\t\t\t\t\t\t\t\tName: domain_name,\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\tScope: ScopeProject{\n\t\t\t\t\tProject: Project{\n\t\t\t\t\t\tName: project_name,\n\t\t\t\t\t\tID: project_id,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tstr, _ = json.Marshal(requstbody)\n\t}else {\n\t\trequstbody := AuthReqDomain{\n\t\t\tAuth: AuthDomain{\n\t\t\t\tIdentity: Identity{\n\t\t\t\t\tMethods: methods,\n\t\t\t\t\tPassword: Password{\n\t\t\t\t\t\tUser: User{\n\t\t\t\t\t\t\tPassword: passwd,\n\t\t\t\t\t\t\tName: user_name,\n\t\t\t\t\t\t\tDomain: Domain{\n\t\t\t\t\t\t\t\tName: domain_name,\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\tScope: ScopeDomain{\n\t\t\t\t\tDomain: Domain{\n\t\t\t\t\t\tName: domain_name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tstr, _ = json.Marshal(requstbody)\n\t}\n\tbody := bytes.NewBuffer([]byte(str))\n\trsp, status_code, hearder, err := common.DoHttpRequest(\"POST\", router, \"application/json\", body, \"\", \"\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif status_code != 201 {\n\t\treturn \"\", errors.New(\"return code is not 200 :\" + strconv.Itoa(status_code) + string(rsp))\n\t}\n\ttoken := hearder.Get(\"X-Subject-Token\")\n\n\treturn token, nil\n}", "title": "" }, { "docid": "6b72695f867687af0d0833325a5a9053", "score": "0.57136714", "text": "func CreateToken(applicationId string, filename string, operations common.PermissionType) (string, error) {\n\tsignedKey := getSigningKey()\n\n\tclaims := &RequestClaim{\n\t\tapplicationId,\n\t\tfilename,\n\t\toperations,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: int64(tokenLifetime.Seconds()),\n\t\t\tIssuer: \"DFS Master\",\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tsignedString, err := token.SignedString(signedKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn signedString, nil\n}", "title": "" }, { "docid": "ff61add214aa2974c99c14ea2f97b37e", "score": "0.57123905", "text": "func (keystone *Keystone) CreateTokenAPI(c echo.Context) error { // nolint: gocyclo\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tkeystoneEndpoint, err := getKeystoneEndpoint(clusterID, keystone.Endpoints)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn echo.NewHTTPError(http.StatusUnauthorized, err)\n\t}\n\tif keystoneEndpoint != \"\" {\n\t\tkeystone.Client.SetAuthURL(keystoneEndpoint)\n\t\treturn keystone.Client.CreateToken(c)\n\t}\n\tvar authRequest kscommon.AuthRequest\n\tif err = c.Bind(&authRequest); err != nil {\n\t\tlogrus.WithField(\"error\", err).Debug(\"Validation failed\")\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"Invalid JSON format\")\n\t}\n\tvar user *kscommon.User\n\tvar token *kscommon.Token\n\ttokenID := \"\"\n\tif authRequest.Auth.Identity.Token != nil {\n\t\ttokenID = authRequest.Auth.Identity.Token.ID\n\t}\n\tif tokenID != \"\" { // user trying to get a token from token\n\t\ttoken, err = keystone.Store.RetrieveToken(tokenID)\n\t\tif err != nil {\n\t\t\treturn echo.NewHTTPError(http.StatusUnauthorized, err)\n\t\t}\n\t\tuser = token.User\n\t} else {\n\t\t_, err = keystone.setAssignment()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tuser, err = keystone.Assignment.FetchUser(\n\t\t\tauthRequest.Auth.Identity.Password.User.Name,\n\t\t\tauthRequest.Auth.Identity.Password.User.Password,\n\t\t)\n\t\tif err != nil {\n\t\t\tlogrus.WithField(\"err\", err).Debug(\"User not found\")\n\t\t\treturn echo.NewHTTPError(http.StatusUnauthorized, \"Failed to authenticate\")\n\t\t}\n\t\tif user == nil {\n\t\t\tlogrus.Debug(\"User not found\")\n\t\t\treturn echo.NewHTTPError(http.StatusUnauthorized, \"Failed to authenticate\")\n\t\t}\n\t}\n\tvar project *kscommon.Project\n\tproject, err = filterProject(user, authRequest.Auth.Scope)\n\tif err != nil {\n\t\tlogrus.WithField(\"err\", err).Debug(\"filter project error\")\n\t\treturn echo.NewHTTPError(http.StatusUnauthorized, \"Failed to authenticate\")\n\t}\n\ttokenID, token = keystone.Store.CreateToken(user, project)\n\tc.Response().Header().Set(\"X-Subject-Token\", tokenID)\n\tauthResponse := &kscommon.AuthResponse{\n\t\tToken: token,\n\t}\n\treturn c.JSON(http.StatusOK, authResponse)\n}", "title": "" }, { "docid": "2ccf3527e11de9c8f42495adabda4a82", "score": "0.5700823", "text": "func CreateToken(user_id int64) (token string, err error) {\n\tviper.SetConfigFile(\"./.env\")\n\terr = viper.ReadInConfig()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\tclaims := UserClaims{\n\t\tuser_id,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: time.Now().Add(time.Minute * 15).Unix(),\n\t\t\tIssuer: \"ussd\",\n\t\t},\n\t}\n\ttok := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\ttoken, err = tok.SignedString([]byte(viper.GetString(\"SECRET\")))\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "5682f6a49599cb9f1ee58b970f180626", "score": "0.56930155", "text": "func resourceProvisionTokenDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {\n\tc, err := getClient(m)\n\tif err != nil {\n\t\treturn diagFromErr(err)\n\t}\n\n\tid := d.Id()\n\terr = c.DeleteToken(ctx, id)\n\tif err != nil {\n\t\treturn diagFromErr(describeErr(err, \"token\"))\n\t}\n\n\treturn diag.Diagnostics{}\n}", "title": "" }, { "docid": "d502a1529d8102a811a77395ae8e8c75", "score": "0.5685899", "text": "func (c ScalewayClient) CreateToken(email string, password string, expires bool) (TokenResponse, error) {\n\tvar data TokenResponse\n\tjson := fmt.Sprintf(`{\"email\": \"%s\", \"password\": \"%s\", \"expires\": %t}`,\n\t\temail, password, expires)\n\terr := postAPIResource(\n\t\tc.Client,\n\t\tc.Token,\n\t\tfmt.Sprintf(\"%s/tokens\", c.AccountURL),\n\t\t[]byte(json),\n\t\t&data)\n\treturn data, err\n}", "title": "" }, { "docid": "fcb34409fe9c66dbf1a9fa12b2d5d285", "score": "0.5682154", "text": "func (m *TokenMan) CreateToken(identity string, hoursTTL int) (string, error) {\n\tif len(m.ClaimAudience) == 0 {\n\t\treturn \"\", ErrorClaimAudienceEmpty\n\t}\n\tif len(m.ClaimIssuer) == 0 {\n\t\treturn \"\", ErrorClaimIssuerEmpty\n\t}\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\ttoken.Claims = jwt.StandardClaims{\n\t\tAudience: m.ClaimAudience,\n\t\tExpiresAt: time.Now().Add(time.Hour * time.Duration(hoursTTL)).Unix(),\n\t\tIssuer: m.ClaimIssuer,\n\t\tId: identity,\n\t\tIssuedAt: time.Now().Unix(),\n\t}\n\t// Sign and get the complete encoded token as a string\n\ttokenString, err := token.SignedString(m.sharedSigningKey)\n\tif err != nil {\n\t\treturn \"\", ErrTokenCreationFailed\n\t}\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "1a1a4337901dc924ff66df7b76919e55", "score": "0.5657849", "text": "func (vcdClient *VCDClient) RegisterToken(org string, tokenParams *types.ApiTokenParams) (*types.ApiTokenParams, error) {\n\tclient := vcdClient.Client\n\n\tif client.APIVCDMaxVersionIs(\"< 36.1\") {\n\t\tversion, err := client.GetVcdFullVersion()\n\t\tif err == nil {\n\t\t\treturn nil, fmt.Errorf(\"minimum version for Token registration is 10.3.1 - Version detected: %s\", version.Version)\n\t\t}\n\t\t// If we can't get the VCD version, we return API version info\n\t\treturn nil, fmt.Errorf(\"minimum API version for Token registration is 36.1 - Version detected: %s\", client.APIVersion)\n\t}\n\n\t// If the client is a user of an org, the endpoint is oauth/tenant/orgName/register\n\t// if the client is a user of sysorg, the endpoint is oauth/provider/register\n\tuserDef := \"tenant/\" + org\n\tif strings.EqualFold(org, \"system\") {\n\t\tuserDef = \"provider\"\n\t}\n\n\t// Create the URL for the register endpoint\n\turlRef, err := url.ParseRequestURI(fmt.Sprintf(\"%s://%s/oauth/%s/%s\", client.VCDHREF.Scheme, client.VCDHREF.Host, userDef, \"register\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting request URL from %s : %s\", urlRef.String(), err)\n\t}\n\n\tnewTokenParams := &types.ApiTokenParams{}\n\n\t// oauth/{tenantcontext}/register isn't an OpenAPI endpoint, so it doesn't have a defined\n\t// API version\n\terr = client.OpenApiPostItemSync(\"\", urlRef, nil, tokenParams, newTokenParams)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error registering token: %s\", err)\n\t}\n\n\treturn newTokenParams, nil\n}", "title": "" }, { "docid": "61a85d9c1b4e81b2687a1b580c20705d", "score": "0.5639414", "text": "func (domain *Domain) CreateToken(ctx context.Context, userId string) (string, error) {\n\ts := &_struct.Struct{}\n\ttokenId := uuid.New().String()\n\tjso, _ := json.Marshal(verificationToken{\n\t\tID: tokenId,\n\t\tUserID: userId,\n\t})\n\terr := s.UnmarshalJSON(jso)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t_, err = domain.db.Create(ctx, &db.CreateRequest{\n\t\tTable: \"tokens\",\n\t\tRecord: s,\n\t})\n\treturn tokenId, err\n}", "title": "" }, { "docid": "1f6bb2098ef58388b76b17b68e3fe8a3", "score": "0.56394124", "text": "func (*CreateTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_tokens_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0861fd06a2f38e1f81bf472659d16135", "score": "0.56159914", "text": "func (j *JWTMaker) CreateToken(username string, duration time.Duration) (string, error) {\n\tpayload, err := NewPayload(username, duration)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tjwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, payload)\n\treturn jwtToken.SignedString([]byte(j.secretKey))\n}", "title": "" }, { "docid": "b23552b752fa1106cb68ff2d37ff1118", "score": "0.55854493", "text": "func (fup *FakeUsersProxy) CreateToken(user entities.User) (string, error) {\n\targs := fup.Called(user)\n\treturn args.String(0), args.Error(1)\n}", "title": "" }, { "docid": "b5901c7317e68cf2d2afb64923a1f22f", "score": "0.5574744", "text": "func createToken(id uuid.UUID, issuer string, secret string) (string, error) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"id\": id.String(),\n\t\t\"iss\": issuer,\n\t\t\"exp\": time.Now().Add(24 * time.Hour).Unix(),\n\t})\n\n\treturn token.SignedString([]byte(secret))\n}", "title": "" }, { "docid": "22af8b91fffcc51928700e6357bc6e0e", "score": "0.55420476", "text": "func CreateToken(expiration time.Duration, userID *userpb.UserId, description string) *invitepb.InviteToken {\n\ttokenID := uuid.New().String()\n\tnow := time.Now()\n\texpirationTime := now.Add(expiration)\n\n\treturn &invitepb.InviteToken{\n\t\tToken: tokenID,\n\t\tUserId: userID,\n\t\tExpiration: &typesv1beta1.Timestamp{\n\t\t\tSeconds: uint64(expirationTime.Unix()),\n\t\t\tNanos: 0,\n\t\t},\n\t\tDescription: description,\n\t}\n}", "title": "" }, { "docid": "239f68b62cd46e68e7306f235c0ae68a", "score": "0.5529195", "text": "func CreateToken(c *gnomock.Container, rootToken string, policies ...string) (string, error) {\n\tcli, err := Client(c, rootToken)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttcr := api.TokenCreateRequest{\n\t\tPolicies: policies,\n\t}\n\n\ts, err := cli.Auth().Token().Create(&tcr)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create token: %w\", err)\n\t}\n\n\treturn s.Auth.ClientToken, nil\n}", "title": "" }, { "docid": "51d15b59faa0fa2eec6ba2f9e6c5a105", "score": "0.55226886", "text": "func CreateIDToken(_ string) (string, error) {\n\targs := []string{\n\t\t\"--quiet\",\n\t\t\"auth\",\n\t\t\"print-identity-token\",\n\t}\n\n\tcmd := exec.Command(gcloudBin, args...)\n\n\tout, err := gcloud(\"operation [id-token]\", cmd)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(out), nil\n}", "title": "" }, { "docid": "51d15b59faa0fa2eec6ba2f9e6c5a105", "score": "0.55226886", "text": "func CreateIDToken(_ string) (string, error) {\n\targs := []string{\n\t\t\"--quiet\",\n\t\t\"auth\",\n\t\t\"print-identity-token\",\n\t}\n\n\tcmd := exec.Command(gcloudBin, args...)\n\n\tout, err := gcloud(\"operation [id-token]\", cmd)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(out), nil\n}", "title": "" }, { "docid": "146d671ca069ed49e20b97176d555a49", "score": "0.5519193", "text": "func generateRtcToken(int_uid uint32, channelName string, role rtctokenbuilder.Role) {\n\n\tappID := os.Getenv(\"appID\")\n\tif appID == \"\" {\n\t\tlog.Fatal(\"Invalid appID, please setup > appID < in config vars\")\n\t}\n\tappCertificate := os.Getenv(\"appCertificate\")\n\tif appCertificate == \"\" {\n\t\tlog.Fatal(\"Invalid appCertificate, please setup > appCertificate < in config vars\")\n\t}\n\t// Number of seconds after which the token expires.\n\t// For demonstration purposes the expiry time is set to 900 seconds (15 min). This shows you the automatic token renew actions of the client.\n\texpireTimeInSeconds := uint32(900)\n\t// Get current timestamp.\n\tcurrentTimestamp := uint32(time.Now().UTC().Unix())\n\t// Timestamp when the token expires.\n\texpireTimestamp := currentTimestamp + expireTimeInSeconds\n\n\tresult, err := rtctokenbuilder.BuildTokenWithUID(appID, appCertificate, channelName, int_uid, role, expireTimestamp)\n\tif err != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tlog.Printf(\"Token with uid: %s\\n\", result)\n\t\tlog.Printf(\"uid is %d\\n\", int_uid)\n\t\tlog.Printf(\"ChannelName is %s\\n\", channelName)\n\t\tlog.Printf(\"Role is %d\\n\", role)\n\t}\n\trtc_token = result\n}", "title": "" }, { "docid": "d5d1488d78df55898e7ee28510d1b729", "score": "0.5515991", "text": "func GenToken() {\n\tprivatePEM, err := ioutil.ReadFile(\"private.pem\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tprivateKey, err := jwt.ParseRSAPrivateKeyFromPEM(privatePEM)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// The call to retrieve a user requires an Admin role by the caller.\n\tclaims := struct {\n\t\tjwt.StandardClaims\n\t\tRoles []string `json:\"roles\"`\n\t}{\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tIssuer: \"service project\",\n\t\t\tSubject: \"123456789\",\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{auth.RoleAdmin},\n\t}\n\n\tmethod := jwt.GetSigningMethod(\"RS256\")\n\ttkn := jwt.NewWithClaims(method, claims)\n\ttkn.Header[\"kid\"] = \"54bb2165-71e1-41a6-af3e7da4a0e1e2c1\"\n\tstr, err := tkn.SignedString(privateKey)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tfmt.Printf(\"-----BEGIN TOKEN-----\\n%s\\n-----END TOKEN-----\\n\", str)\n}", "title": "" }, { "docid": "8c8cefede1c6aaa5b6bcf93aa06444cf", "score": "0.5512107", "text": "func (a *jwtAuthImpl) CreateToken(uid, aud string, nExpiredMinute int, signedKey string, now time.Time) (string, error) {\n\tcs := Claims{\n\t\tjwt.StandardClaims{\n\t\t\tSubject: uid,\n\t\t\tAudience: aud,\n\t\t\tIssuedAt: now.Unix(),\n\t\t\tNotBefore: now.Unix(),\n\t\t\tExpiresAt: now.Unix() + int64(nExpiredMinute*60),\n\t\t},\n\t}\n\n\t// Create the token\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, cs)\n\n\t// Sign and get the complete encoded token as a string\n\treturn token.SignedString([]byte(signedKey))\n}", "title": "" }, { "docid": "5e60ef019ad6064f90954d44e5d8b6f5", "score": "0.5511843", "text": "func (jt *JwtToken) CreateToken(id, role string) (map[string]string, error) {\n\n\ttoken := jwt.NewWithClaims(jwt.GetSigningMethod(\"HS256\"), &Token{\n\t\tID: id,\n\t\tRole: role,\n\t})\n\t// token -> string. Only server knows this secret (foobar).\n\ttokenString, err := token.SignedString([]byte(jt.C.JwtSecret))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm := make(map[string]string)\n\tm[\"token\"] = tokenString // set response data\n\treturn m, nil\n}", "title": "" }, { "docid": "df4521990b68c52bfbedabb09f226149", "score": "0.5506152", "text": "func CreateTokenEndpoint(w http.ResponseWriter, req *http.Request) {\n\tdata, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tresponseError(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tua := req.Header.Get(\"Content-Type\")\n\tlog.Print(ua)\n\tif !strings.Contains(ua, \"application/json\") {\n\t\tresponseCode(w, http.StatusUnsupportedMediaType)\n\t\treturn\n\t}\n\n\tuser := &User{}\n\terr = json.Unmarshal(data, user)\n\tif err != nil {\n\t\tresponseError(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tresult := User{}\n\terr = users.Find(bson.M{\"email\": user.Email}).One(&result)\n\tif err != nil {\n\t\tresponseError(w, \"User not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\trez := CheckPasswordHash(user.Password, result.Password)\n\tif !rez {\n\t\t// responseError(w, \"Wrong password!\", http.StatusUnauthorized)\n\t\tresponseError(w, \"Wrong password!\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"email\": user.Email,\n\t\t\"password\": user.Password,\n\t})\n\ttokenString, error := token.SignedString([]byte(\"secret\"))\n\tif error != nil {\n\t\tfmt.Println(error)\n\t}\n\tjson.NewEncoder(w).Encode(JwtToken{Token: tokenString})\n}", "title": "" }, { "docid": "0b45f252f587c82c4f0e1df67b1b5627", "score": "0.55029416", "text": "func createTokenPolicyScenario(cluster *base.ClusterContext, prefix, testPath, name string, works bool) (createToken cli.TestScenario) {\n\n\tcreateToken = cli.TestScenario{\n\t\tName: prefixName(prefix, \"create-token\"),\n\t\tTasks: []cli.SkupperTask{\n\t\t\t{Ctx: cluster, Commands: []cli.SkupperCommandTester{\n\t\t\t\t// skupper token create - verify token has been created\n\t\t\t\t&token.CreateTester{\n\t\t\t\t\tName: name,\n\t\t\t\t\tFileName: filepath.Join(testPath, name+\".token.yaml\"),\n\t\t\t\t\tPolicyProhibits: !works,\n\t\t\t\t\t// Here, we deviate from Hello World, as we're not testing expiry or uses.\n\t\t\t\t\t// This allows the token to be used repeatedly on some tests, saving\n\t\t\t\t\t// some time.\n\t\t\t\t\tExpiry: \"600m\",\n\t\t\t\t\tUses: \"1000\",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t}\n\treturn\n}", "title": "" }, { "docid": "0fdc8d29cd705628cefa4936a20c92ee", "score": "0.54990566", "text": "func CreateToken(userID string) (*models.TokenDetails, error) {\n\texpTime := time.Now().Add(time.Minute * 15).Unix()\n\n\tclaims := jwt.MapClaims{}\n\tclaims[\"authorized\"] = true\n\tclaims[\"user_id\"] = userID\n\tclaims[\"exp\"] = expTime\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\ttokenString, err := token.SignedString([]byte(os.Getenv(\"ACCESS_TOKEN_SECRET\")))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &models.TokenDetails{\n\t\tAccessToken: tokenString,\n\t}, nil\n}", "title": "" }, { "docid": "a60a2752f9de2197164201ef33c3897f", "score": "0.5495239", "text": "func CreateToken(pubkey *[ed25519.PublicKeySize]byte, privkey *[ed25519.PrivateKeySize]byte, counter uint64) AuthToken {\n\tnow := uint64(times.Now()) / SkewWindow\n\ttoken := make([]byte, TokenSize)\n\tcopy(token[:32], pubkey[:])\n\tio.ReadFull(Rand, token[32:64])\n\tbinary.BigEndian.PutUint64(token[64:72], now)\n\tbinary.BigEndian.PutUint64(token[72:80], counter)\n\tsig := ed25519.Sign(privkey[:], token[:80])\n\tcopy(token[80:], sig[:])\n\treturn token\n}", "title": "" }, { "docid": "3d3145544e343a374eff973859f7e0c1", "score": "0.5482653", "text": "func getOrCreateTokenSecret(client kubecli.KubevirtClient, vmexport *exportv1.VirtualMachineExport) (*k8sv1.Secret, error) {\n\t// Securely randomize a 20 char string to be used as a token\n\ttoken, err := util.GenerateSecureRandomString(secretTokenLenght)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsecret := &k8sv1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: getExportSecretName(vmexport.Name),\n\t\t\tNamespace: vmexport.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(vmexport, schema.GroupVersionKind{\n\t\t\t\t\tGroup: exportv1.SchemeGroupVersion.Group,\n\t\t\t\t\tVersion: exportv1.SchemeGroupVersion.Version,\n\t\t\t\t\tKind: \"VirtualMachineExport\",\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\tType: k8sv1.SecretTypeOpaque,\n\t\tData: map[string][]byte{\n\t\t\tsecretTokenKey: []byte(token),\n\t\t},\n\t}\n\n\tsecret, err = client.CoreV1().Secrets(vmexport.Namespace).Create(context.Background(), secret, metav1.CreateOptions{})\n\tif err != nil && !k8serrors.IsAlreadyExists(err) {\n\t\treturn nil, err\n\t}\n\n\treturn secret, nil\n}", "title": "" }, { "docid": "8e4059da63c46f3beb1bf1233611131b", "score": "0.5482633", "text": "func CreateToken(id string) (string, error) {\n\tclaims := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.StandardClaims{\n\t\tIssuer: id,\n\t\tExpiresAt: time.Now().Add(time.Hour * 24).Unix()})\n\tif secret := os.Getenv(\"ACCESS_SECRET\"); secret == \"\" {\n\t\tlog.Error(\"No ACCESS_SECRET\")\n\t\treturn \"\", errors.New(\"NO ACCESS_SECRET\")\n\t} else {\n\t\ttoken, err := claims.SignedString([]byte(secret))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn token, nil\n\t}\n\n}", "title": "" }, { "docid": "2a1faab6a5989bfa5a29e7b034139df9", "score": "0.5450407", "text": "func (c *Client) createNewToken(ctx context.Context) (token string, err error) {\n\n\t// Build Login URL\n\turlstr := c.marketplace.String() + c.option.LoginEndpoint\n\tlogDebug(ctx, c, fmt.Sprintf(\"Login on %v with user %v\", urlstr, c.username))\n\n\t// Create Login Body\n\tdata := loginStruct{c.username, c.password}\n\n\t// Encode Login Body to JSON\n\tbody := new(bytes.Buffer)\n\tencoder := json.NewEncoder(body)\n\tif err := encoder.Encode(data); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Build Login Request\n\treq, err := http.NewRequest(\"POST\", urlstr, body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Set Login Header\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn \"\", errorFormatterPx(ctx, c, resp.StatusCode, resp.Body)\n\t}\n\n\t// If Response gives errors print also Body\n\tif resp.StatusCode == http.StatusBadRequest ||\n\t\tresp.StatusCode == http.StatusNotFound ||\n\t\tresp.StatusCode == http.StatusMethodNotAllowed ||\n\t\tresp.StatusCode == http.StatusInternalServerError {\n\n\t\treturn \"\", errorFormatterPx(ctx, c, resp.StatusCode, resp.Body)\n\t}\n\n\trespbody := resp.Body\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(respbody)\n\ttk := buf.String()\n\tdefer respbody.Close()\n\n\t//Trim Token\n\ttk = strings.Replace(tk, \"\\\"\", \"\", -1)\n\t//If everything OK return nil\n\treturn tk, nil\n\n}", "title": "" }, { "docid": "bf26836a0a8261e41eae9cd01f3a829f", "score": "0.5449908", "text": "func CreateToken() (string, error) {\n\tglog.V(4).Infof(\"Creating shared token\")\n\targs := []string{\"token\", \"generate\"}\n\ttoken, err := DoExecCommand(\"kubeadm\", args)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to create shared token: %v\", err)\n\t}\n\treturn ExtractToken(token)\n}", "title": "" }, { "docid": "0ca20d75a2bdd56f935d689707ace1f4", "score": "0.54486376", "text": "func (*CreateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_token_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0828ba5b336407f91efa1696d70b98da", "score": "0.54443586", "text": "func CreateGetIntegrationTokenRequest() (request *GetIntegrationTokenRequest) {\n\trequest = &GetIntegrationTokenRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"GetIntegrationToken\", \"arms\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "0efd8d4dadae47ac1210bc5e3a9ace3c", "score": "0.5439968", "text": "func (t *UserCreation) Create() (Token, error) {\n\tclient := resty.New()\n\turl := fmt.Sprintf(\"%sv3/localauthconfig/\", connection.Get().HostName)\n\tresponse := Token{}\n\tkErr := KuberaError{}\n\tbody, err := json.Marshal(t)\n\tif err != nil {\n\t\treturn Token{}, &APIError{\n\t\t\tErr: err,\n\t\t}\n\t}\n\tresp, err := client.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(body).\n\t\t//SetError invoke if response status code >= 399 and content type JSON\n\t\tSetError(&kErr).\n\t\t//SetResult invoke if response status code is between 200 and 299\n\t\tSetResult(&response).\n\t\tPost(url)\n\n\tif err != nil || kErr.Message != \"\" || !resp.IsSuccess() {\n\t\treturn Token{}, &APIError{\n\t\t\tErr: err,\n\t\t\tMessage: kErr.Message,\n\t\t\tStatusCode: resp.StatusCode(),\n\t\t\tStatus: resp.Status(),\n\t\t}\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "7524d28967a58ab4034d468c927ae71a", "score": "0.54335195", "text": "func testTokenResource(comment string) string {\n\treturn fmt.Sprintf(`\n\t\tresource \"databricks_token\" \"my-token\" {\n\t\t\tlifetime_seconds = 6000\n\t\t\tcomment = \"%v\"\n\t\t}\n\t\t`, comment)\n}", "title": "" }, { "docid": "4c6424e5cf2947bf4cad1d99221c7c7c", "score": "0.54065776", "text": "func (s *Service) Create(ctx context.Context, req *model.AuthRequest, res *model.Token) error {\n\tif err := s.createAccount(req); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.createAdminUser(req); err != nil {\n\t\treturn err\n\t}\n\n\tjwt, err := s.createToken(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres.AccessToken = jwt.Access\n\tres.RefreshToken = jwt.Refresh\n\tres.ExpiresAt = jwt.ExpiresAt\n\tres.Scopes = jwt.Scopes\n\treturn nil\n}", "title": "" }, { "docid": "c169c9897ce600794fd1fe44338b2669", "score": "0.54058564", "text": "func (g *TokenGenerator) CreateToken(userId uint64, userName string, permissions uint64) (*TokenDetails, error) {\n\ttd := &TokenDetails{}\n\ttd.Expires = time.Now().Add(g.expirationTime).Unix()\n\ttd.Uuid = uuid.NewV4().String()\n\n\tclaims := jwt.MapClaims{}\n\tclaims[\"authorized\"] = true\n\tclaims[\"uuid\"] = td.Uuid\n\tclaims[\"user_id\"] = userId\n\tclaims[\"user_name\"] = userName\n\tclaims[\"user_permissions\"] = permissions\n\tclaims[\"exp\"] = td.Expires\n\n\tvar err error\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tif td.Token, err = token.SignedString([]byte(g.secret)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn td, nil\n}", "title": "" }, { "docid": "19374cd243fe70a1d39f29d439127c5f", "score": "0.54014343", "text": "func LinkTokenCreate(\n\tpaymentInitiation *plaid.PaymentInitiation, userId string,\n) (string, *errors.Error) {\n\tcountryCodes := strings.Split(plaidService.PlaidCountryCodes, \",\")\n\tproducts := strings.Split(plaidService.PlaidProducts, \",\")\n\tredirectURI := plaidService.PlaidRedirectURI\n\tconfigs := plaid.LinkTokenConfigs{\n\t\tUser: &plaid.LinkTokenUser{\n\t\t\t// This should correspond to a unique id for the current user.\n\t\t\tClientUserID: userId,\n\t\t},\n\t\tClientName: \"Plaid Quickstart\",\n\t\tProducts: products,\n\t\tCountryCodes: countryCodes,\n\t\tLanguage: \"en\",\n\t\tRedirectUri: redirectURI,\n\t\tPaymentInitiation: paymentInitiation,\n\t}\n\n\tresp, err := plaidService.PlaidClient().CreateLinkToken(configs)\n\n\tif err != nil {\n\t\treturn \"\", &errors.Error{\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t\tMessage: err.Error(),\n\t\t}\n\t}\n\n\treturn resp.LinkToken, nil\n}", "title": "" }, { "docid": "22818d9c4bb10eaa012be6facc701e9b", "score": "0.5395152", "text": "func (r *VCSTokenHandler) Create() echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tvcsToken := &models.VCSToken{}\n\t\tif err := c.Bind(vcsToken); err != nil {\n\t\t\tr.Logger.Debug().Err(err).Msg(\"Failed to bind vcs token.\")\n\t\t\treturn c.JSON(http.StatusBadRequest, kerr.APIError(\"failed to bind vcs token\", http.StatusBadRequest, err))\n\t\t}\n\n\t\tif err := r.TokenProvider.SaveTokenForPlatform(vcsToken.Token, vcsToken.VCS); err != nil {\n\t\t\tr.Logger.Debug().Err(err).Msg(\"VCS token creation failed.\")\n\t\t\treturn c.JSON(http.StatusInternalServerError, kerr.APIError(\"VCS token creation failed\", http.StatusInternalServerError, err))\n\t\t}\n\n\t\treturn c.NoContent(http.StatusCreated)\n\t}\n}", "title": "" }, { "docid": "41cda4e312a9acb0b7e919e6fdbe2f23", "score": "0.5372349", "text": "func generateToken(opts TokenOptions) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := token.Claims.(jwt.MapClaims)\n\tclaims[\"display_name\"] = opts.DisplayName\n\tclaims[\"email\"] = opts.Email\n\tclaims[\"exp\"] = time.Now().Add(time.Hour * 12).Unix()\n\n\treturn token.SignedString([]byte(viper.GetString(\"app.secret\")))\n}", "title": "" }, { "docid": "23e3783f85fcb275350872ae2ec109b2", "score": "0.5365133", "text": "func createToken(username string) (string, AuthenticationError) {\n\tif tokenSigningKey == \"\" {\n\t\treturn \"\", invalidSigningKeyError{}\n\t}\n\n\tuser, err := getUserFromUsername(username)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar dur = time.Hour * time.Duration(GetTokenExpiration())\n\tvar expirationDate = time.Now().Add(dur).UnixNano() / 1e6\n\tvar userId = user.Id\n\tvar isAdmin = user.Administrator\n\n\tjwToken := jwt.New(jwt.SigningMethodHS256)\n\tclaims := jwToken.Claims.(jwt.MapClaims)\n\tclaims[\"exp\"] = expirationDate\n\tclaims[\"uid\"] = userId\n\tclaims[\"adm\"] = isAdmin\n\ttokenString, serr := jwToken.SignedString([]byte(tokenSigningKey))\n\tif serr != nil {\n\t\treturn \"\", tokenSigningError{}\n\t}\n\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "361331ebab2e03d244856b4fe86988e5", "score": "0.5363397", "text": "func CreateToken(id uint, userName string) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodHS512)\n\ttoken.Claims[\"id\"] = id\n\ttoken.Claims[\"userName\"] = userName\n\texpTime := time.Minute * time.Duration(configuration.Conf.JwtExpTime)\n\ttoken.Claims[\"exp\"] = time.Now().Add(expTime)\n\t// tokenString gets []byte because of the HS512 alg\n\ttokenString, err := token.SignedString([]byte(configuration.Conf.JwtSecret))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "74d9b5f9d0cb557adfef77d380929812", "score": "0.534973", "text": "func createToken() jwt.JWT {\n\tclaims := jwt.NewClaims()\n\tclaims.SetSubject(\"1234567890\")\n\tclaims.Set(\"name\", \"John Doe\")\n\tclaims.Set(\"admin\", true)\n\ttoken, err := jwt.Encode(claims, []byte(\"secret\"), jwt.HS512)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn token\n}", "title": "" }, { "docid": "8a3150b44395f840f6c79367a531f866", "score": "0.53406477", "text": "func (s *MockAuthStore) CreateOrUpdateToken(t *jwt.Token) error {\n\ts.CreateOrUpdateTokenInvoked = true\n\treturn s.CreateOrUpdateTokenFn(t)\n}", "title": "" }, { "docid": "c5d30b51ae85caba3e97007585fd8d2a", "score": "0.5340354", "text": "func createCustomer(client pb.CustomerClient, customer *pb.CustomerRequest) {\n\tvalidToken, err := auth.GenerateJWT()\n\tif err != nil {\n\t\tlog.Fatal(\"Something went wrong generating jwt\", err.Error())\n\t}\n\n\t//After appending k/v's assing it to variable\n\tctx := metadata.AppendToOutgoingContext(context.Background(), \"token\", validToken)\n\n\t//pass the variable that you have assigned your context to your rpc function\n\tresp, err := client.CreateCustomer(ctx, customer)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not create Customer: %v\", err)\n\t}\n\tif resp.Success {\n\t\tmd, ok := metadata.FromIncomingContext(ctx)\n\t\tif ok {\n\t\t\tfmt.Println(md[\"\"])\n\t\t}\n\t\tlog.Printf(\"A new Customer has been added with id: %d\", resp.Id)\n\t}\n}", "title": "" }, { "docid": "9b7a507807cdc37f3721a5dd6c50805a", "score": "0.53288573", "text": "func CreateToken(storage localfs.Storage, id string, username string, password string) *model.Token {\n\ttoken := model.NewToken(id)\n\ttoken.Username = username\n\ttoken.Password = password\n\treturn PersistToken(storage, &token)\n}", "title": "" }, { "docid": "864fbb398406ac37e3413b230a4cc014", "score": "0.5327891", "text": "func createToken(sid string, key []byte) (string, error) {\n\tmac := hmac.New(sha256.New, key)\n\t_, err := mac.Write([]byte(sid))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error writing sid to hash: %w\", err)\n\t}\n\n\tsignedMAC := fmt.Sprintf(\"%x\", mac.Sum(nil))\n\n\treturn signedMAC + \"|\" + sid, nil\n}", "title": "" }, { "docid": "aca6aa4eddbb1ea8fc3071f4fe521f81", "score": "0.53264356", "text": "func CreateToken(signer jose.Signer, cl interface{}, privateClaims ...interface{}) (string, error) {\n\tbuilder := jwt.Signed(signer).Claims(cl)\n\tfor i := range privateClaims {\n\t\tbuilder = builder.Claims(privateClaims[i])\n\t}\n\traw, err := builder.CompactSerialize()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn raw, nil\n}", "title": "" }, { "docid": "20703907ad00f78a01f12999ab0c5586", "score": "0.5322635", "text": "func NewToken() Token {\n\tvar out Token\n\tout.Created = time.Now()\n\tout.Revision = out.Created\n\tout.Autheticated = false\n\tvar key rsa.PublicKey\n\t//err := scrypto.NewKeypair(&out.ServerPrivate)\n\tpriv, err := rsa.GenerateKey(rand.Reader, 2048)\n\tout.ServerPrivate = priv\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tkey = out.ServerPrivate.PublicKey\n\tout.ServerPublic = key\n\tout.ServerPublicPem = pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PUBLIC KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PublicKey(&priv.PublicKey),\n\t\t},\n\t)\n\tout.ServerPem = string(pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PUBLIC KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PublicKey(&out.ServerPrivate.PublicKey),\n\t\t},\n\t))\n\tfmt.Println(out.ServerPem)\n\treturn out\n}", "title": "" }, { "docid": "15d61d20c54910c2f3e22583ef160460", "score": "0.53188056", "text": "func GenerateToken(identityID string, identityUsername string, privateKey *rsa.PrivateKey) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodRS256)\n\ttoken.Claims.(jwt.MapClaims)[\"uuid\"] = identityID\n\ttoken.Claims.(jwt.MapClaims)[\"preferred_username\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"sub\"] = identityID\n\n\ttoken.Claims.(jwt.MapClaims)[\"jti\"] = uuid.NewV4().String()\n\ttoken.Claims.(jwt.MapClaims)[\"session_state\"] = uuid.NewV4().String()\n\ttoken.Claims.(jwt.MapClaims)[\"iat\"] = time.Now().Unix()\n\ttoken.Claims.(jwt.MapClaims)[\"exp\"] = time.Now().Unix() + 60*60*24*30\n\ttoken.Claims.(jwt.MapClaims)[\"nbf\"] = 0\n\ttoken.Claims.(jwt.MapClaims)[\"iss\"] = \"wit\"\n\ttoken.Claims.(jwt.MapClaims)[\"typ\"] = \"Bearer\"\n\n\ttoken.Claims.(jwt.MapClaims)[\"approved\"] = true\n\ttoken.Claims.(jwt.MapClaims)[\"name\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"company\"] = \"Company Inc.\"\n\ttoken.Claims.(jwt.MapClaims)[\"given_name\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"family_name\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"email\"] = fmt.Sprintf(\"%s@email.com\", identityUsername)\n\n\ttoken.Header[\"kid\"] = \"test-key\"\n\ttokenStr, err := token.SignedString(privateKey)\n\tif err != nil {\n\t\treturn \"\", errors.WithStack(err)\n\t}\n\treturn tokenStr, nil\n}", "title": "" }, { "docid": "8e47f9e6c0b8ff2eab0e2350545ca240", "score": "0.53095174", "text": "func (_ReputationTokenFactory *ReputationTokenFactoryTransactor) CreateReputationToken(opts *bind.TransactOpts, _controller common.Address, _universe common.Address) (*types.Transaction, error) {\n\treturn _ReputationTokenFactory.contract.Transact(opts, \"createReputationToken\", _controller, _universe)\n}", "title": "" }, { "docid": "07e4f87870f779e549f7522797a5ab40", "score": "0.530409", "text": "func CreateTokenRoute() *routev3.Route {\n\tvar (\n\t\trouter routev3.Route\n\t\taction *routev3.Route_Route\n\t\tmatch *routev3.RouteMatch\n\t\tdecorator *routev3.Decorator\n\t)\n\n\tmatch = &routev3.RouteMatch{\n\t\tPathSpecifier: &routev3.RouteMatch_Path{\n\t\t\tPath: testKeyPath,\n\t\t},\n\t}\n\n\thostRewriteSpecifier := &routev3.RouteAction_AutoHostRewrite{\n\t\tAutoHostRewrite: &wrapperspb.BoolValue{\n\t\t\tValue: true,\n\t\t},\n\t}\n\n\tdecorator = &routev3.Decorator{\n\t\tOperation: testKeyPath,\n\t}\n\n\tperFilterConfig := extAuthService.ExtAuthzPerRoute{\n\t\tOverride: &extAuthService.ExtAuthzPerRoute_Disabled{\n\t\t\tDisabled: true,\n\t\t},\n\t}\n\n\tb := proto.NewBuffer(nil)\n\tb.SetDeterministic(true)\n\t_ = b.Marshal(&perFilterConfig)\n\tfilter := &any.Any{\n\t\tTypeUrl: extAuthzPerRouteName,\n\t\tValue: b.Bytes(),\n\t}\n\n\taction = &routev3.Route_Route{\n\t\tRoute: &routev3.RouteAction{\n\t\t\tHostRewriteSpecifier: hostRewriteSpecifier,\n\t\t\tRegexRewrite: &envoy_type_matcherv3.RegexMatchAndSubstitute{\n\t\t\t\tPattern: &envoy_type_matcherv3.RegexMatcher{\n\t\t\t\t\tEngineType: &envoy_type_matcherv3.RegexMatcher_GoogleRe2{\n\t\t\t\t\t\tGoogleRe2: &envoy_type_matcherv3.RegexMatcher_GoogleRE2{\n\t\t\t\t\t\t\tMaxProgramSize: nil,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tRegex: testKeyPath,\n\t\t\t\t},\n\t\t\t\tSubstitution: \"/\",\n\t\t\t},\n\t\t},\n\t}\n\n\tdirectClusterSpecifier := &routev3.RouteAction_Cluster{\n\t\tCluster: \"token_cluster\",\n\t}\n\taction.Route.ClusterSpecifier = directClusterSpecifier\n\n\trouter = routev3.Route{\n\t\tName: testKeyPath, //Categorize routes with same base path\n\t\tMatch: match,\n\t\tAction: action,\n\t\tMetadata: nil,\n\t\tDecorator: decorator,\n\t\tTypedPerFilterConfig: map[string]*any.Any{\n\t\t\twellknown.HTTPExternalAuthorization: filter,\n\t\t},\n\t}\n\treturn &router\n}", "title": "" }, { "docid": "1fd5c1e99fbfa1ab63a2435ccfe98d7a", "score": "0.5289737", "text": "func CreateToken(user goth.User) (string, error) {\n\tuuid, err := nanoid.Nanoid()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tnow := time.Now()\n\tpayload := JWTPayload{\n\t\tPayload: jwt.Payload{\n\t\t\tIssuer: \"receiptsarchive\",\n\t\t\tSubject: user.UserID,\n\t\t\tExpirationTime: jwt.NumericDate(now.Add(time.Hour)),\n\t\t\tIssuedAt: jwt.NumericDate(now),\n\t\t\tJWTID: uuid,\n\t\t},\n\t\tUserID: user.UserID,\n\t}\n\n\ttoken, err := jwt.Sign(payload, hs)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(token), nil\n}", "title": "" }, { "docid": "8381b7f083571d30668231b0d67da8ea", "score": "0.5287725", "text": "func (c Customer) CreateByToken(token, email, description string) (*simplejson.Json, error) {\n\tparams := url.Values{}\n\tparams.Add(\"card\", token)\n\tparams.Add(\"email\", email)\n\tparams.Add(\"description\", description)\n\n\treturn c.webpayclient.Post(c.path, params)\n}", "title": "" }, { "docid": "7715e31ef385f8c0c24a8ae3942d9457", "score": "0.52876437", "text": "func (o *CreateFileTokenParams) WithResource(resource *models.FileToken) *CreateFileTokenParams {\n\to.SetResource(resource)\n\treturn o\n}", "title": "" }, { "docid": "1d7428535b50b0d2ad7110240d27b056", "score": "0.52848005", "text": "func GenerateTokenObject(identityID string, identityUsername string, privateKey *rsa.PrivateKey) (*jwt.Token, error) {\n\ttoken := jwt.New(jwt.SigningMethodRS256)\n\ttoken.Claims.(jwt.MapClaims)[\"uuid\"] = identityID\n\ttoken.Claims.(jwt.MapClaims)[\"preferred_username\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"sub\"] = identityID\n\n\ttoken.Claims.(jwt.MapClaims)[\"jti\"] = uuid.NewV4().String()\n\ttoken.Claims.(jwt.MapClaims)[\"session_state\"] = uuid.NewV4().String()\n\ttoken.Claims.(jwt.MapClaims)[\"iat\"] = time.Now().Unix()\n\ttoken.Claims.(jwt.MapClaims)[\"exp\"] = time.Now().Unix() + 60*60*24*30\n\ttoken.Claims.(jwt.MapClaims)[\"nbf\"] = 0\n\ttoken.Claims.(jwt.MapClaims)[\"iss\"] = \"wit\"\n\ttoken.Claims.(jwt.MapClaims)[\"typ\"] = \"Bearer\"\n\n\ttoken.Claims.(jwt.MapClaims)[\"approved\"] = true\n\ttoken.Claims.(jwt.MapClaims)[\"name\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"company\"] = \"Company Inc.\"\n\ttoken.Claims.(jwt.MapClaims)[\"given_name\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"family_name\"] = identityUsername\n\ttoken.Claims.(jwt.MapClaims)[\"email\"] = fmt.Sprintf(\"%s@email.com\", identityUsername)\n\n\ttoken.Header[\"kid\"] = \"test-key\"\n\tvar err error\n\ttoken.Raw, err = token.SignedString(privateKey)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "bdc91be5ae32f9c72a6a1d60571455d4", "score": "0.52828056", "text": "func CreateGetWorkbenchTokenResponse() (response *GetWorkbenchTokenResponse) {\n\tresponse = &GetWorkbenchTokenResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "3e7adea03ce2b4a2bbdc3ffd4b87ce89", "score": "0.5276135", "text": "func (s *BuntDBStorage) CreateToken(ctx context.Context, req *authProto.CreateTokenRequest) (*authProto.CreateTokenResponse, error) {\n\tlogger := s.logger.WithField(\"request\", req)\n\n\tlogger.Info(\"Creating token\")\n\tvar accessToken, refreshToken *token.IssuedToken\n\terr := s.db.Update(func(tx *buntdb.Tx) error {\n\t\t// remove already exist tokens\n\t\tlogger.Debug(\"Remove already exist tokens\")\n\t\tif err := s.deleteTokenByIdentity(tx, &tokenOwnerIdentity{\n\t\t\tUserAgent: req.GetUserAgent(),\n\t\t\tUserIP: req.GetUserIp(),\n\t\t\tFingerprint: req.GetFingerprint(),\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// issue tokens\n\t\tvar err error\n\t\tuserIDHash := sha256.Sum256([]byte(req.GetUserId()))\n\t\tlogger.WithField(\"userIDHash\", userIDHash).Debug(\"Issue tokens\")\n\t\taccessToken, refreshToken, err = s.TokenFactory.IssueTokens(token.ExtensionFields{\n\t\t\tUserIDHash: hex.EncodeToString(userIDHash[:]),\n\t\t\tRole: req.GetUserRole(),\n\t\t\tPartTokenID: req.GetPartTokenId(),\n\t\t})\n\t\tif err != nil {\n\t\t\ts.logger.WithError(err).Error(\"token issue failed\")\n\t\t\treturn autherr.ErrInternal().AddDetailsErr(err).Log(err, s.logger)\n\t\t}\n\n\t\t// store tokens\n\t\tlogger.WithField(\"accessToken\", accessToken).\n\t\t\tWithField(\"refreshToken\", refreshToken).\n\t\t\tDebugf(\"Store tokens\")\n\t\t_, _, err = tx.Set(refreshToken.ID,\n\t\t\ts.marshalRecord(token.RequestToRecord(req, refreshToken)),\n\t\t\t&buntdb.SetOptions{\n\t\t\t\tExpires: true,\n\t\t\t\tTTL: refreshToken.LifeTime,\n\t\t\t})\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, s.wrapTXError(err)\n\t}\n\n\treturn &authProto.CreateTokenResponse{\n\t\tAccessToken: accessToken.Value,\n\t\tRefreshToken: refreshToken.Value,\n\t}, nil\n}", "title": "" }, { "docid": "7c8d9c6d8f83f670765bdf3bbde437a8", "score": "0.52761227", "text": "func createToken(userID string) (UserToken, error) {\n\tvar err error\n\ttd := UserToken{}\n\tempty := UserToken{}\n\ttd.AtExpires = time.Now().Add(time.Minute * 30).Unix()\n\ttd.AccessUUID = uuid.NewV4().String()\n\ttd.RtExpires = time.Now().Add(time.Hour * 24 * 14).Unix()\n\ttd.RefreshUUID = uuid.NewV4().String()\n\t// fmt.Println(\"AtExpires: \" + fmt.Sprint(td.AtExpires))\n\t// fmt.Println(\"RefreshUUID: \" + td.AccessUUID)\n\tatClaim := jwt.MapClaims{}\n\tatClaim[\"authorized\"] = true\n\tatClaim[\"access_uuid\"] = td.AccessUUID\n\tatClaim[\"userID\"] = userID\n\tatClaim[\"exp\"] = td.AtExpires\n\tat := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaim)\n\ttd.AccessToken, err = at.SignedString(accessSecret)\n\tif err != nil {\n\t\treturn empty, err\n\t}\n\n\trtClaim := jwt.MapClaims{}\n\trtClaim[\"refresh_uuid\"] = td.RefreshUUID\n\trtClaim[\"userID\"] = userID\n\trtClaim[\"exp\"] = td.RtExpires\n\trt := jwt.NewWithClaims(jwt.SigningMethodHS256, rtClaim)\n\ttd.RefreshToken, err = rt.SignedString([]byte(refreshSecret))\n\tif err != nil {\n\t\treturn empty, err\n\t}\n\treturn td, nil\n}", "title": "" }, { "docid": "1151c75fd3059dc0334b3efee4d9897c", "score": "0.52718335", "text": "func CreateToken(jwtKey string, secretKey []byte, encoding string, session bool, duration time.Duration, claims jwt.MapClaims) (string, error) {\n\tif jwtKey == \"\" {\n\t\treturn \"\", errors.New(\"No jwtKey is defined\")\n\t}\n\n\tclaims[\"session\"] = session\n\tclaims[\"exp\"] = time.Now().Add(duration).Unix()\n\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\n\ttokenStr, err := token.SignedString([]byte(jwtKey))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(secretKey) > 0 {\n\t\tvar err error\n\t\ttokenStr, err = encryptString(secretKey, tokenStr, encoding)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn tokenStr, nil\n}", "title": "" }, { "docid": "a76e71a951cbbc4e0b4210e17d6c580d", "score": "0.52688056", "text": "func (login *Login) CreateToken(userName string) (string, error) {\n\tsignKey := []byte(\"mysupersecretkey\")\n\tclaims := &jwt.MapClaims{\n\t\t\"username\": userName,\n\t\t\"exp\": time.Now().Add(1 * time.Hour).UTC().Unix(),\n\t}\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)\n\tss, err := token.SignedString(signKey)\n\treturn ss, err\n}", "title": "" }, { "docid": "8b9fa2ccc247e765f90c885f758511c3", "score": "0.5261092", "text": "func expandVCSTokenResource(d *schema.ResourceData) (*models.VCSToken, error) {\n\tvar (\n\t\ttoken string\n\t\tvcs int\n\t)\n\tif v, ok := d.GetOk(platformTokenFieldName); ok {\n\t\ttoken = v.(string)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find parse field %s\", platformTokenFieldName)\n\t}\n\tif v, ok := d.GetOk(platformVCSFieldName); ok {\n\t\tvcs = v.(int)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"unable to find parse field %s\", platformVCSFieldName)\n\t}\n\tplatform := &models.VCSToken{\n\t\tToken: token,\n\t\tVCS: vcs,\n\t}\n\treturn platform, nil\n}", "title": "" }, { "docid": "f40f16a663feb61e07929e0f56e2c7d1", "score": "0.52593344", "text": "func ServeTokenResource(rg *routing.RouteGroup, tokenService *services.TokenService) {\n\tr := &tokenEndpoint{tokenService}\n\trg.Get(\"/tokens/<id>\", r.get)\n\trg.Get(\"/tokens\", r.query)\n\trg.Post(\"/tokens\", r.create)\n}", "title": "" }, { "docid": "61ec805392158920e9f674ac50138a5d", "score": "0.5255777", "text": "func newToken(user store.User) (string, error) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\tfirstNameKey: user.FirstName,\n\t\tlastNameKey: user.LastName,\n\t\tloginKey: user.Login,\n\t\t\"exp\": time.Now().Add(expiredTTL).Unix(),\n\t})\n\ttokenString, err := token.SignedString(signingKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn tokenString, nil\n}", "title": "" }, { "docid": "2bb27368834a458e9548587b5567adba", "score": "0.5252391", "text": "func (*CreateTokenResponse) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_token_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4ed494823ada7dd0bdbd472a83ddda72", "score": "0.524826", "text": "func genToken(\n\tctx context.Context, user *User,\n) (string, error) {\n\ttoken := jwt.NewWithClaims(signingMethod, JWTClaims{\n\t\tuser,\n\t\tjwt.StandardClaims{\n\t\t\t// ExpiresAt: 1500,\n\t\t\tIssuer: \"OpenBanking\",\n\t\t},\n\t})\n\n\t// Generate the token ...\n\treturn token.SignedString(signingKey)\n}", "title": "" }, { "docid": "e6094c231d0b9de8edd0225658de2bfd", "score": "0.5247055", "text": "func CreateWithToken(serverURL, clusterName, userName string, caCert []byte, token string) *clientcmdapi.Config {\n\tconfig := CreateBasic(serverURL, clusterName, userName, caCert)\n\tconfig.AuthInfos[userName] = &clientcmdapi.AuthInfo{\n\t\tToken: token,\n\t}\n\treturn config\n}", "title": "" }, { "docid": "22d012c264afd0f3d6e2e23968343bf3", "score": "0.52411795", "text": "func (b *backend) pathTokenWrite(\n\tctx context.Context,\n\treq *logical.Request,\n\td *framework.FieldData,\n) (res *logical.Response, err error) {\n\tclient, done, err := b.Client(ctx, req.Storage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer done()\n\n\t// Safely parse the request and any options from interface types.\n\ttokReq := &tokenRequest{\n\t\tInstallationID: d.Get(keyInstallationID).(int),\n\t\tOrgName: d.Get(keyOrgName).(string),\n\t}\n\n\tif tokReq.InstallationID == 0 && tokReq.OrgName == \"\" {\n\t\treturn logical.ErrorResponse(\n\t\t\t\"%s or %s is a required parameter\",\n\t\t\tkeyInstallationID,\n\t\t\tkeyOrgName,\n\t\t), nil\n\t}\n\n\tif perms, ok := d.GetOk(keyPerms); ok {\n\t\ttokReq.Permissions = perms.(map[string]string)\n\t}\n\n\tif repoIDs, ok := d.GetOk(keyRepoIDs); ok {\n\t\ttokReq.RepositoryIDs = repoIDs.([]int)\n\t}\n\n\tif repos, ok := d.GetOk(keyRepos); ok {\n\t\ttokReq.Repositories = repos.([]string)\n\t}\n\n\t// Instrument and log the token API call, recording status, duration and\n\t// whether any constraints (permissions, repository IDs) were requested.\n\tdefer func(begin time.Time) {\n\t\tduration := time.Since(begin)\n\t\tb.Logger().Debug(\"attempted to create a new installation token\",\n\t\t\t\"took\", duration.String(),\n\t\t\t\"err\", err,\n\t\t\t\"permissions\", tokReq.Permissions,\n\t\t\t\"org_name\", tokReq.OrgName,\n\t\t\t\"installation_id\", fmt.Sprint(tokReq.InstallationID),\n\t\t\t\"repository_ids\", fmt.Sprint(tokReq.RepositoryIDs),\n\t\t\t\"repositories\", fmt.Sprint(tokReq.Repositories),\n\t\t)\n\t\trequestDuration.With(prometheus.Labels{\n\t\t\t\"success\": strconv.FormatBool(err == nil),\n\t\t\tkeyOrgName: tokReq.OrgName,\n\t\t\tkeyInstallationID: fmt.Sprint(tokReq.InstallationID),\n\t\t\tkeyPerms: strconv.FormatBool(len(tokReq.Permissions) > 0),\n\t\t\tkeyRepoIDs: strconv.FormatBool(len(tokReq.RepositoryIDs) > 0),\n\t\t\tkeyRepos: strconv.FormatBool(len(tokReq.Repositories) > 0),\n\t\t}).Observe(duration.Seconds())\n\t}(time.Now())\n\n\t// Perform the token request.\n\treturn client.Token(ctx, tokReq)\n}", "title": "" }, { "docid": "b3792d83acf7c4cb606d96724a78d354", "score": "0.52401", "text": "func (t *Token) CreateToken(userID uint64) (*TokenDetails, error) {\n\ttd := &TokenDetails{}\n\ttd.AtExpires = time.Now().Add(time.Minute * 15).Unix()\n\ttd.AccessUUID = uuid.NewV4().String()\n\ttd.RtExpires = time.Now().Add(time.Hour * 24 * 7).Unix()\n\ttd.RefreshUUID = uuid.NewV4().String()\n\n\tvar err error\n\tatClaims := jwt.MapClaims{}\n\tatClaims[\"authorized\"] = true\n\tatClaims[\"access_uuid\"] = td.AccessUUID\n\tatClaims[\"user_id\"] = userID\n\tatClaims[\"exp\"] = td.AtExpires\n\tat := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaims)\n\tsat, err := at.SignedString([]byte(os.Getenv(\"ACCESS_SECRET\")))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttd.AccessToken = sat\n\n\trtClaims := jwt.MapClaims{}\n\trtClaims[\"exp\"] = td.RtExpires\n\trtClaims[\"refresh_uuid\"] = td.RefreshUUID\n\trtClaims[\"user_id\"] = userID\n\trt := jwt.NewWithClaims(jwt.SigningMethodHS256, rtClaims)\n\tsrt, err := rt.SignedString([]byte(os.Getenv(\"REFRESH_SECRET\")))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttd.RefreshToken = srt\n\treturn td, nil\n}", "title": "" }, { "docid": "792a61f31b532222c529588d9918c330", "score": "0.5239648", "text": "func (c *Client) deriveToken(alloc *structs.Allocation, taskNames []string, vclient *vaultapi.Client) (map[string]string, error) {\n\tif alloc == nil {\n\t\treturn nil, fmt.Errorf(\"nil allocation\")\n\t}\n\n\tif taskNames == nil || len(taskNames) == 0 {\n\t\treturn nil, fmt.Errorf(\"missing task names\")\n\t}\n\n\tgroup := alloc.Job.LookupTaskGroup(alloc.TaskGroup)\n\tif group == nil {\n\t\treturn nil, fmt.Errorf(\"group name in allocation is not present in job\")\n\t}\n\n\tverifiedTasks := []string{}\n\t// Check if the given task names actually exist in the allocation\n\tfor _, taskName := range taskNames {\n\t\tfound := false\n\t\tfor _, task := range group.Tasks {\n\t\t\tif task.Name == taskName {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tc.logger.Printf(\"[ERR] task %q not found in the allocation\", taskName)\n\t\t\treturn nil, fmt.Errorf(\"task %q not found in the allocation\", taskName)\n\t\t}\n\t\tverifiedTasks = append(verifiedTasks, taskName)\n\t}\n\n\t// DeriveVaultToken of nomad server can take in a set of tasks and\n\t// creates tokens for all the tasks.\n\treq := &structs.DeriveVaultTokenRequest{\n\t\tNodeID: c.NodeID(),\n\t\tSecretID: c.secretNodeID(),\n\t\tAllocID: alloc.ID,\n\t\tTasks: verifiedTasks,\n\t\tQueryOptions: structs.QueryOptions{\n\t\t\tRegion: c.Region(),\n\t\t\tAllowStale: false,\n\t\t},\n\t}\n\n\t// Derive the tokens\n\tvar resp structs.DeriveVaultTokenResponse\n\tif err := c.RPC(\"Node.DeriveVaultToken\", &req, &resp); err != nil {\n\t\tc.logger.Printf(\"[ERR] client.vault: DeriveVaultToken RPC failed: %v\", err)\n\t\treturn nil, fmt.Errorf(\"DeriveVaultToken RPC failed: %v\", err)\n\t}\n\tif resp.Error != nil {\n\t\tc.logger.Printf(\"[ERR] client.vault: failed to derive vault tokens: %v\", resp.Error)\n\t\treturn nil, structs.NewWrappedServerError(resp.Error)\n\t}\n\tif resp.Tasks == nil {\n\t\tc.logger.Printf(\"[ERR] client.vault: failed to derive vault token: invalid response\")\n\t\treturn nil, fmt.Errorf(\"failed to derive vault tokens: invalid response\")\n\t}\n\n\tunwrappedTokens := make(map[string]string)\n\n\t// Retrieve the wrapped tokens from the response and unwrap it\n\tfor _, taskName := range verifiedTasks {\n\t\t// Get the wrapped token\n\t\twrappedToken, ok := resp.Tasks[taskName]\n\t\tif !ok {\n\t\t\tc.logger.Printf(\"[ERR] client.vault: wrapped token missing for task %q\", taskName)\n\t\t\treturn nil, fmt.Errorf(\"wrapped token missing for task %q\", taskName)\n\t\t}\n\n\t\t// Unwrap the vault token\n\t\tunwrapResp, err := vclient.Logical().Unwrap(wrappedToken)\n\t\tif err != nil {\n\t\t\tif structs.VaultUnrecoverableError.MatchString(err.Error()) {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// The error is recoverable\n\t\t\treturn nil, structs.NewRecoverableError(\n\t\t\t\tfmt.Errorf(\"failed to unwrap the token for task %q: %v\", taskName, err), true)\n\t\t}\n\n\t\t// Validate the response\n\t\tvar validationErr error\n\t\tif unwrapResp == nil {\n\t\t\tvalidationErr = fmt.Errorf(\"Vault returned nil secret when unwrapping\")\n\t\t} else if unwrapResp.Auth == nil {\n\t\t\tvalidationErr = fmt.Errorf(\"Vault returned unwrap secret with nil Auth. Secret warnings: %v\", unwrapResp.Warnings)\n\t\t} else if unwrapResp.Auth.ClientToken == \"\" {\n\t\t\tvalidationErr = fmt.Errorf(\"Vault returned unwrap secret with empty Auth.ClientToken. Secret warnings: %v\", unwrapResp.Warnings)\n\t\t}\n\t\tif validationErr != nil {\n\t\t\tc.logger.Printf(\"[WARN] client.vault: failed to unwrap token: %v\", err)\n\t\t\treturn nil, structs.NewRecoverableError(validationErr, true)\n\t\t}\n\n\t\t// Append the unwrapped token to the return value\n\t\tunwrappedTokens[taskName] = unwrapResp.Auth.ClientToken\n\t}\n\n\treturn unwrappedTokens, nil\n}", "title": "" }, { "docid": "9938edf01e9861ccd6ff894e03807f3e", "score": "0.52381074", "text": "func tokenFromFile(oauthCfg azure.OAuthConfig, tokenPath, clientID, resource string,\n\tcallback azure.TokenRefreshCallback) (*azure.ServicePrincipalToken, error) {\n\tlog.Debug(\"Loading auth token from file\", logutil.Fields{\"path\": tokenPath})\n\tif _, err := os.Stat(tokenPath); err != nil {\n\t\tif os.IsNotExist(err) { // file not found\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\ttoken, err := azure.LoadToken(tokenPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to load token from file: %v\", err)\n\t}\n\n\tspt, err := azure.NewServicePrincipalTokenFromManualToken(oauthCfg, clientID, resource, *token, callback)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error constructing service principal token: %v\", err)\n\t}\n\treturn spt, nil\n}", "title": "" }, { "docid": "8a906ce8f6e0a5294efbb069a09587f9", "score": "0.52376103", "text": "func (s *kfctlServer) CreateDeployment(ctx context.Context, req kfdefsv1beta1.KfDef) (*kfdefsv1beta1.KfDef, error) {\n\tlog.Infof(\"New CreateDeployment for %v\", req.Name)\n\ttoken, err := req.GetSecret(gcp.GcpAccessTokenName)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get secret %v; error %v\", gcp.GcpAccessTokenName, err)\n\t\treturn nil, &httpError{\n\t\t\tMessage: fmt.Sprintf(\"Could not obtain an access token from secret %v\", gcp.GcpAccessTokenName),\n\t\t\tCode: http.StatusBadRequest,\n\t\t}\n\t}\n\tpluginSpec := &gcpplugin.GcpPluginSpec{}\n\n\terr = req.GetPluginSpec(gcp.GcpPluginName, pluginSpec)\n\tif err != nil {\n\t\tdeployReqCounter.WithLabelValues(\"INTERNAL\").Inc()\n\t\tlog.Errorf(\"Failed to load GcpPluginSpec: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tinitFunc := func() error {\n\t\ts.kfDefMux.Lock()\n\t\tdefer s.kfDefMux.Unlock()\n\n\t\tif s.ts == nil {\n\t\t\tlog.Infof(\"Initializing token source\")\n\t\t\tts, err := NewRefreshableTokenSource(pluginSpec.Project)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Could not create token source; error %v\", err)\n\n\t\t\t\treturn &httpError{\n\t\t\t\t\tMessage: \"Internal service error please try again later.\",\n\t\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ts.ts = ts\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := initFunc(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Refresh the credential. This will fail if it doesn't provide access to the project\n\terr = s.ts.Refresh(oauth2.Token{\n\t\tAccessToken: token,\n\t})\n\n\tif err != nil {\n\t\tlog.Errorf(\"Refreshing the token failed; %v\", err)\n\t\treturn nil, &httpError{\n\t\t\tMessage: fmt.Sprintf(\"Could not verify you have admin priveleges on project %v; please check that the project is correct and you have admin priveleges\", pluginSpec.Project),\n\t\t\tCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\tcheckIsMatch := func() bool {\n\t\ts.kfDefMux.Lock()\n\t\tdefer s.kfDefMux.Unlock()\n\t\treturn isMatch(&s.latestKfdef, &req)\n\t}\n\n\tif !checkIsMatch() {\n\t\treturn nil, &httpError{\n\t\t\tMessage: fmt.Sprintf(\"This server is already handling a deployment for project %v name %v and the new request doesn't match\", pluginSpec.Project, req.Name),\n\t\t\tCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\t// Check that it is a valid request.\n\tif isValid, msg := (&req).IsValid(); !isValid {\n\t\treq.Status.Conditions = append(req.Status.Conditions, kfdefsv1beta1.KfDefCondition{\n\t\t\tType: kfdefsv1beta1.KfDegraded,\n\t\t\tStatus: v1.ConditionTrue,\n\t\t\tMessage: fmt.Sprintf(\"Kfdef.Spec is invalid; \" + msg),\n\t\t\tLastUpdateTime: metav1.Now(),\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t})\n\t\treturn &req, nil\n\t}\n\n\t// TODO integrate once https://github.com/kubeflow/kubeflow/pull/4436 merged.\n\t// TODo(jlewi): Uncoment when gcp.IsValid is checked in.\n\t//if isValid, msg := gcp.IsValid(req); !isValid {\n\t//\treq.Status.Conditions = append(req.Status.Conditions, kfdefsv3.KfDefCondition{\n\t//\t\tType: kfdefsv3.KfFailed,\n\t//\t\tStatus: v1.ConditionTrue,\n\t//\t\tReason: kfdefsv3.InvalidKfDefSpecReason,\n\t//\t\tMessage: fmt.Sprintf(\"KfDef.Spec is invalid; \" + msg),\n\t//\t\tLastUpdateTime: metav1.Now(),\n\t//\t\tLastTransitionTime: metav1.Now(),\n\t//\t})\n\t//\n\t//\treturn &req, nil\n\t//}\n\n\tstrippedReq := req.DeepCopy()\n\n\t// Enqueue the request\n\tprepareSecrets(strippedReq)\n\n\ts.c <- *strippedReq\n\tlog.Infof(\"Channel: insert %v, channel len: %v\", strippedReq.Name, len(s.c))\n\n\tlatestKfdef, err := s.GetLatestKfDef(req)\n\n\t// We haven't persisted yet so just echo back what we have\n\tif latestKfdef.Name == \"\" {\n\t\treturn &req, nil\n\t}\n\treturn latestKfdef, nil\n}", "title": "" }, { "docid": "6246f9aac1b80bd25ad8bf13400f29a2", "score": "0.52342945", "text": "func CreateToken(user models.User) string {\n\tvar err error\n\t//Creating Access Token\n\n\tatClaims := jwt.MapClaims{}\n\tatClaims[\"authorized\"] = true\n\tatClaims[\"user_id\"] = user.ID\n\tatClaims[\"username\"] = user.Username\n\tatClaims[\"exp\"] = time.Now().Add(time.Minute * 15).Unix()\n\tat := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaims)\n\ttoken, err := at.SignedString([]byte(config.GETEnvVariable(\"KEY\")))\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn token\n}", "title": "" }, { "docid": "2c7f366811a6f65e39d05535da2418be", "score": "0.5225277", "text": "func CreateToken() error {\n\tidentifier := uuid.New()\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\t_, err := collection.InsertOne(ctx, bson.M{\"tokenid\": identifier})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2db08b9070aac33ccb224d4a3fe573e6", "score": "0.5221438", "text": "func (c *CreateCommand) validateToken(token, endpoint string, spinner text.Spinner) (string, error) {\n\terr := spinner.Start()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tmsg := \"Validating token\"\n\tspinner.Message(msg + \"...\")\n\n\tclient, err := c.clientFactory(token, endpoint)\n\tif err != nil {\n\t\tc.Globals.ErrLog.AddWithContext(err, map[string]any{\n\t\t\t\"Endpoint\": endpoint,\n\t\t})\n\n\t\tspinner.StopFailMessage(msg)\n\t\tspinErr := spinner.StopFail()\n\t\tif spinErr != nil {\n\t\t\treturn \"\", spinErr\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"error regenerating Fastly API client: %w\", err)\n\t}\n\n\tt, err := client.GetTokenSelf()\n\tif err != nil {\n\t\tc.Globals.ErrLog.Add(err)\n\n\t\tspinner.StopFailMessage(msg)\n\t\tspinErr := spinner.StopFail()\n\t\tif spinErr != nil {\n\t\t\treturn \"\", spinErr\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"error validating token: %w\", err)\n\t}\n\n\tif c.automationToken {\n\t\tspinner.StopMessage(msg)\n\t\terr = spinner.Stop()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn fmt.Sprintf(\"Automation Token (%s)\", t.ID), nil\n\t}\n\n\tuser, err := client.GetUser(&fastly.GetUserInput{\n\t\tID: t.UserID,\n\t})\n\tif err != nil {\n\t\tc.Globals.ErrLog.AddWithContext(err, map[string]any{\n\t\t\t\"User ID\": t.UserID,\n\t\t})\n\n\t\tspinner.StopFailMessage(msg)\n\t\tspinErr := spinner.StopFail()\n\t\tif spinErr != nil {\n\t\t\treturn \"\", spinErr\n\t\t}\n\n\t\treturn \"\", fsterr.RemediationError{\n\t\t\tInner: fmt.Errorf(\"error fetching token user: %w\", err),\n\t\t\tRemediation: \"If providing an 'automation token', retry the command with the `--automation-token` flag set.\",\n\t\t}\n\t}\n\n\tspinner.StopMessage(msg)\n\terr = spinner.Stop()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn user.Login, nil\n}", "title": "" }, { "docid": "06f44135aaa25a61ece6257b048bbcd6", "score": "0.5216567", "text": "func (s *UserService) CreateToken(userId uint32) (string, error) {\n\ts.CreateTokenInvoked = true\n\treturn s.CreateTokenFn(userId)\n}", "title": "" }, { "docid": "461426142dbd92b65020ef4ac778b23d", "score": "0.5209477", "text": "func createToken(identifier, issuer string, expireAt int64) *jwt.Token {\n\ttClaims := Claims{\n\t\tidentifier,\n\t\tjwt.StandardClaims{\n\t\t\tExpiresAt: expireAt,\n\t\t\tIssuer: issuer,\n\t\t\tIssuedAt: time.Now().Unix(),\n\t\t},\n\t}\n\n\treturn jwt.NewWithClaims(jwt.SigningMethodHS256, tClaims)\n}", "title": "" }, { "docid": "b60ebffd403f628643031f0f6de236d2", "score": "0.5207167", "text": "func (c *tokenRequests) Create(ctx context.Context, tokenRequest *v1alpha1.TokenRequest, opts v1.CreateOptions) (result *v1alpha1.TokenRequest, err error) {\n\tresult = &v1alpha1.TokenRequest{}\n\terr = c.client.Post().\n\t\tNamespace(c.ns).\n\t\tResource(\"tokenrequests\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(tokenRequest).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" } ]
75646f575142895e318e2ad6aa2e6423
SetResultEntries gets a reference to the given []HyperflexConfigResultEntryRelationship and assigns it to the ResultEntries field.
[ { "docid": "54e0f8d3141989e1f5984e885ee72cd1", "score": "0.75244063", "text": "func (o *HyperflexConfigResult) SetResultEntries(v []HyperflexConfigResultEntryRelationship) {\n\to.ResultEntries = v\n}", "title": "" } ]
[ { "docid": "5e6948ff5b161291052d11113835d3cd", "score": "0.6609662", "text": "func (o *HyperflexConfigResult) GetResultEntries() []HyperflexConfigResultEntryRelationship {\n\tif o == nil {\n\t\tvar ret []HyperflexConfigResultEntryRelationship\n\t\treturn ret\n\t}\n\treturn o.ResultEntries\n}", "title": "" }, { "docid": "abaada77856130d4fb8a6b0f7a4faf95", "score": "0.61316115", "text": "func (m *HuntingQueryResults) SetResults(value []HuntingRowResultable)() {\n err := m.GetBackingStore().Set(\"results\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cf2ffc8defaf009fbf4372203d118138", "score": "0.55946344", "text": "func (o *HyperflexConfigResult) HasResultEntries() bool {\n\tif o != nil && o.ResultEntries != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "845c578fe0babfa2f787af5e04ad7016", "score": "0.5500188", "text": "func (m *SearchLogQuery) SetEntries(val []ProposedEntry) {\n\tm.entriesField = val\n}", "title": "" }, { "docid": "a883b52cfbf33c13547ef8aa59395b9a", "score": "0.5467837", "text": "func (fr *FragmentResource) SetEntries(rm *ResourceMap) error {\n\tfr.Entries = []*ResourceEntry{}\n\tfor predicate, entries := range fr.predicates {\n\t\tfor _, entry := range entries {\n\t\t\tre, err := entry.NewResourceEntry(predicate, fr.GetLevel(), rm)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfr.Entries = append(fr.Entries, re)\n\t\t}\n\t}\n\t// sort entries by order\n\tsort.Slice(fr.Entries[:], func(i, j int) bool {\n\t\treturn fr.Entries[i].Order < fr.Entries[j].Order\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "00a33c243cad82be25c504761397ab75", "score": "0.53989285", "text": "func (ctx *Context) SetCheckResults(host string, results []*operator.CheckResult) {\n\tctx.exec.Lock()\n\tif currResult, ok := ctx.exec.checkResults[host]; ok {\n\t\tctx.exec.checkResults[host] = append(currResult, results...)\n\t} else {\n\t\tctx.exec.checkResults[host] = results\n\t}\n\tctx.exec.Unlock()\n}", "title": "" }, { "docid": "8aeda81356cc3c3eae94c857f8def7d5", "score": "0.5197058", "text": "func (o *HyperflexConfigResult) GetResultEntriesOk() ([]HyperflexConfigResultEntryRelationship, bool) {\n\tif o == nil || o.ResultEntries == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResultEntries, true\n}", "title": "" }, { "docid": "839ccdf67cce54de02b9aab434d237ed", "score": "0.51919836", "text": "func (s *NetworkAcl) SetEntries(v []*NetworkAclEntry) *NetworkAcl {\n\ts.Entries = v\n\treturn s\n}", "title": "" }, { "docid": "b7a51d049837a0f5dd9dd30be633dc40", "score": "0.5142912", "text": "func (o *HclHwCatalogInfoList) SetResults(v []HclHwCatalogInfo) {\n\to.Results = v\n}", "title": "" }, { "docid": "91b50468d17ada819dce7505546d820c", "score": "0.5123146", "text": "func (p *Pagination) SetResultKeys(item interface{}) {\n\tp.ResultKey = make([]string, 0)\n\trkaArray, ok := item.([]string)\n\tif ok {\n\t\tfor _, k := range rkaArray {\n\t\t\tp.ResultKey = append(p.ResultKey, strcase.ToCamel(k))\n\t\t}\n\t\treturn\n\t}\n\trkStr, ok := item.(string)\n\tif ok {\n\t\tp.ResultKey = append(p.ResultKey, strcase.ToCamel(rkStr))\n\t}\n}", "title": "" }, { "docid": "e2bd26a0f274d5d837e0a406ca3ab880", "score": "0.5050398", "text": "func (s *GetManagedPrefixListEntriesOutput) SetEntries(v []*PrefixListEntry) *GetManagedPrefixListEntriesOutput {\n\ts.Entries = v\n\treturn s\n}", "title": "" }, { "docid": "7948a46b24cecffa11266cbfc85c411f", "score": "0.503488", "text": "func (m *ConfigManager) WithQueryResults(criteria *config.Criteria, results []*config.KeyValue) *ConfigManager {\n\tm.queryResults[*criteria] = results\n\treturn m\n}", "title": "" }, { "docid": "8ac3f24358cdf8042e8b2771e8685161", "score": "0.49993953", "text": "func (s *CreateManagedPrefixListInput) SetEntries(v []*AddPrefixListEntry) *CreateManagedPrefixListInput {\n\ts.Entries = v\n\treturn s\n}", "title": "" }, { "docid": "1a09202e8449e5aade0da51b8e50927f", "score": "0.4695912", "text": "func (o *StorageDiskResponseList) SetResults(v []StorageDiskResponse) {\n\to.Results = &v\n}", "title": "" }, { "docid": "6d0bb6601abbef6db0da2fb04d9e15aa", "score": "0.46629038", "text": "func (o *SyntheticsBatchDetailsData) SetResults(v []SyntheticsBatchResult) {\n\to.Results = v\n}", "title": "" }, { "docid": "912506a507a07fcabe3d6e195a21c96f", "score": "0.46469602", "text": "func (b *resultBatch) AddResults(rs []*entity.Result) {\n\tfor _, r := range rs {\n\t\tb.AddResult(r)\n\t}\n}", "title": "" }, { "docid": "708eac8ebee3931d604116c1be92e7c5", "score": "0.458698", "text": "func (s *GetScreenDataOutput) SetResults(v map[string]*ResultSet) *GetScreenDataOutput {\n\ts.Results = v\n\treturn s\n}", "title": "" }, { "docid": "344d05bc1728800618ac2f2e39a469fc", "score": "0.45790687", "text": "func (o *AutocompleteProductSearch200Response) SetResults(v []AutocompleteProductSearch200ResponseResultsInner) {\n\to.Results = v\n}", "title": "" }, { "docid": "ce6c96dfa01faa47f83f3472a738b21c", "score": "0.45600966", "text": "func addAttemptResults(metadata *middleware.Metadata, v AttemptResults) {\n\tmetadata.Set(attemptResultsKey{}, v)\n}", "title": "" }, { "docid": "bd85af2eba0bfd1d9cb460c67d9a9d02", "score": "0.45147294", "text": "func SetClusterConsulResultMap(key string, value []Upstream) {\n\tmutexForResultMap.Lock()\n\tdefer mutexForResultMap.Unlock()\n\tClusterConsulResultMap[key] = value\n}", "title": "" }, { "docid": "6ec3e2f762e30cfc1eefcb7c5d656e69", "score": "0.45128396", "text": "func (r *Raft) setupAppendEntries(s *followerReplication, req *AppendEntriesRequest, nextIndex, lastIndex uint64) error {\n\treq.Term = s.currentTerm\n\treq.Leader = r.trans.EncodePeer(r.localAddr)\n\treq.LeaderCommitIndex = r.getCommitIndex()\n\tif err := r.setPreviousLog(req, nextIndex); err != nil {\n\t\treturn err\n\t}\n\tif err := r.setNewLogs(req, nextIndex, lastIndex); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cd96b01cfc109bf3a20b614018a519c", "score": "0.45074484", "text": "func (_options *QueryOptions) SetTableResults(tableResults *QueryLargeTableResults) *QueryOptions {\n\t_options.TableResults = tableResults\n\treturn _options\n}", "title": "" }, { "docid": "203f46b23715dbad827c604cd89d1a03", "score": "0.4492324", "text": "func (q *SearchQuery) setResultContinue(corpus *index.Corpus, res *SearchResult) {\n\tif !q.Constraint.onlyMatchesPermanode() {\n\t\treturn\n\t}\n\tvar pnTimeFunc func(blob.Ref) (t time.Time, ok bool)\n\tswitch q.Sort {\n\tcase LastModifiedDesc:\n\t\tpnTimeFunc = corpus.PermanodeModtimeLocked\n\tcase CreatedDesc:\n\t\tpnTimeFunc = corpus.PermanodeAnyTimeLocked\n\tdefault:\n\t\treturn\n\t}\n\n\tif q.Limit <= 0 || len(res.Blobs) != q.Limit {\n\t\treturn\n\t}\n\tlastpn := res.Blobs[len(res.Blobs)-1].Blob\n\tt, ok := pnTimeFunc(lastpn)\n\tif !ok {\n\t\treturn\n\t}\n\tres.Continue = fmt.Sprintf(\"pn:%d:%v\", t.UnixNano(), lastpn)\n}", "title": "" }, { "docid": "248f58e8909e805f2595a7ed48f119ca", "score": "0.4472826", "text": "func (o *EnvironmentDatabasesCurrentMetricResponseList) SetResults(v []EnvironmentDatabasesCurrentMetricResponse) {\n\to.Results = &v\n}", "title": "" }, { "docid": "a192f7022770021c822b1ff558171b1f", "score": "0.44583395", "text": "func (rs *pendingResult) SetResult(res *sqltypes.Result) {\n\trs.result = res\n}", "title": "" }, { "docid": "356f6d7b15fe5b2c94ddac731a2f0b76", "score": "0.44580254", "text": "func (o *SearchResultsDTO) SetConnectionResults(v []ComponentSearchResultDTO) {\n\to.ConnectionResults = &v\n}", "title": "" }, { "docid": "1905aa14a0d0efd36abe02f9a003ead6", "score": "0.44298762", "text": "func (s *RescoreOutput) SetResultItems(v []*RescoreResultItem) *RescoreOutput {\n\ts.ResultItems = v\n\treturn s\n}", "title": "" }, { "docid": "de9da10f06c39c8718b4886a6f5beb24", "score": "0.4410286", "text": "func (tdrc *TCPDetectorResultCreate) SetResults(sdsr schema.TCPDetectorSubResults) *TCPDetectorResultCreate {\n\ttdrc.mutation.SetResults(sdsr)\n\treturn tdrc\n}", "title": "" }, { "docid": "4c90419296de0c57700f9cef65eeb661", "score": "0.4404096", "text": "func (subscriptionSetImpl) Entries(p schema.SubscriptionSetEntriesFieldResolverParams) (interface{}, error) {\n\tset := p.Source.(subscriptionSet)\n\tentries := set.entries()\n\n\tl, h := clampSlice(p.Args.Offset, p.Args.Offset+p.Args.Limit, len(entries))\n\treturn entries[l:h], nil\n}", "title": "" }, { "docid": "9b7f790c12245a409ffa0a14f9c37429", "score": "0.4390741", "text": "func (s *hostEntryLister) HostEntries(namespace string) HostEntryNamespaceLister {\n\treturn hostEntryNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "338bddd36d34f21b93732e7d343225f0", "score": "0.43905577", "text": "func (o *NiatelemetryDcnmTransceiverDetailsList) SetResults(v []NiatelemetryDcnmTransceiverDetails) {\n\to.Results = v\n}", "title": "" }, { "docid": "fc7aca978ee64aa852d6433318d84b7d", "score": "0.43589962", "text": "func InitResult(c Context, e catalog.Engine) Result {\n\tid := e.Meta.ID\n\tif len(id) == 0 {\n\t\tid = e.Meta.Name\n\t}\n\treturn Result{\n\t\tEnvironment: c.Environment,\n\t\tID: id,\n\t\tSuccess: true,\n\t\tRequirements: make([]Requirement, 0),\n\t}\n}", "title": "" }, { "docid": "ba284d2e5d73c12784e5c66482aa6672", "score": "0.4340415", "text": "func (entry DomainEntry) GetEntries(rrClass uint16) []RecordsEntry {\n\tvar entries []RecordsEntry\n\tentries = make([]RecordsEntry, 0)\n\n\tif rrClass == dns.ClassANY {\n\t\tfor _, entry := range entry {\n\t\t\tentries = append(entries, entry)\n\t\t}\n\t} else if entry, ok := entry[rrClass]; ok {\n\t\tentries = append(entries, entry)\n\t}\n\n\treturn entries\n}", "title": "" }, { "docid": "9a66a0142d0b352ac4fd3b9662431ee5", "score": "0.43354416", "text": "func (o *BucketsPage) SetResults(v []Bucket) {\n\to.Results = v\n}", "title": "" }, { "docid": "0ddeeb913fb13149adf463e6afb65af9", "score": "0.43236005", "text": "func (mh *mkhiHdr) SetResult(v uint8) {\n\tmh[3] = v\n}", "title": "" }, { "docid": "8aa4ae4ee0b22c22c680eb258e799c49", "score": "0.43165687", "text": "func (cf *CacheFile) SetResult(entry *Entry, resultErr *errors.ErrorStack) error {\n\tvar jsonRepr []byte\n\tvar err error\n\tvar fd *os.File\n\n\tif jsonRepr, err = json.Marshal(&result{entry, resultErr}); err != nil {\n\t\treturn err\n\t}\n\n\tif fd, err = os.OpenFile(cf.fileName, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0600); err != nil {\n\t\treturn err\n\t}\n\tfd.WriteString(string(jsonRepr))\n\tfd.Close()\n\treturn nil\n}", "title": "" }, { "docid": "2a50c306824743f20cf811674bea4eeb", "score": "0.42943907", "text": "func (a *API) RestoreDatasourceEntries(ctx context.Context, params RestoreDatasourceEntriesParams) (*RestoreDatasourceEntriesResult, error) {\n\tres := &RestoreDatasourceEntriesResult{}\n\t_, err := a.post(ctx, api.BuildPath(metadataFields, params.FieldExternalID, dataSourceRestore), params, res)\n\n\treturn res, err\n}", "title": "" }, { "docid": "05a2bef66952881171fa5db97e2ebf07", "score": "0.4271317", "text": "func (m *ContentLinkApplyEntry) AnswerChainEntriesInOther(first *lite.EntryHolder, rest []*lite.EntryHolder) {\n\tif bytes.Compare(first.Entry.ExtIDs[1], []byte(\"Content Chain\")) != 0 {\n\t\tm.ErrorAndStop = true\n\t}\n\n\tex := first.Entry.ExtIDs\n\tm.Version = ex[0][0]\n\tm.ContentType = ex[2][0]\n\tu, err := primitives.BytesToUint32(ex[3])\n\tif err != nil {\n\t\tlog.Debug(\"[ContentLink] (1): Cannot unmarshal into uint32\", err.Error())\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\tm.TotalEntries = u\n\n\tr, err := primitives.BytesToHash(ex[4])\n\tif err != nil {\n\t\tlog.Debug(\"[ContentLink] (2): Cannot unmarshal into hash\", err.Error())\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\t// Root chain in Link does not match.\n\tif !m.RootChainID.IsSameAs(r) {\n\t\tlog.Debug(\"[ContentLink] (3): Root Chain ID does not match:\")\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\n\ti, err := primitives.BytesToInfoHash(ex[5])\n\tif err != nil {\n\t\tlog.Debug(\"[ContentLink] (4): Cannot unmarshal into infohash:\", err.Error())\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\tm.Infohash = *i\n\n\tvar t time.Time\n\terr = t.UnmarshalBinary(ex[6])\n\tif err != nil {\n\t\tlog.Debug(\"[ContentLink] (5): Cannot unmarshal into time:\", err.Error())\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\tm.Timestamp = t\n\t// Check Time window\n\tif !InsideTimeWindow(m.LinkTimestamp, m.Timestamp, constants.ENTRY_TIMESTAMP_WINDOW) {\n\t\tlog.Debug(\"[ContentLink] (6): Time outside valid window\")\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\n\tm.ShiftCipher = ex[7][0]\n\n\terr = m.ContentSigKey.UnmarshalBinary(ex[8])\n\tif err != nil {\n\t\tlog.Debug(\"[ContentLink] (7): Cannot unmarshal into content signing key\")\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tfor i := 0; i < 8; i++ {\n\t\tbuf.Write(ex[i])\n\t}\n\tm.Message = buf.Next(buf.Len())\n\tm.Signature = ex[9]\n\n\tif !m.ContentSigKey.IsSameAs(&m.Channel.Channel.ContentSingingKey) {\n\t\tlog.Debugf(\"[ContentLink] (8): Content signing key does not match. \\n Found %s, expect %s\", m.ContentSigKey.String(), m.Channel.Channel.ContentSingingKey.String())\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\n\tif valid := m.ContentSigKey.Verify(m.Message, m.Signature); !valid {\n\t\tlog.Debug(\"[ContentLink] (9): Content verify failed\")\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\n\t// Stitch Content\n\t// Stich Entries :: 142bytes\n\t//\t\t[4]byte\t\tSequence\n\t//\t\t[32]byte\tSha256Hash of PreXOR\n\t//\t\t[32]byte\tContentSignKey\n\t//\t\t[64]byte\tSignature\n\t// ContentStitch\n\t// data is the bytes to be stitched\n\tcontent := make([]byte, 0)\n\tplain := primitives.XORCipher(m.ShiftCipher, first.Entry.Content)\n\tcontent = append(content, plain...)\n\n\tvar c uint32\n\tfor c = 1; c < m.TotalEntries+1; c++ {\n\t\t// Looking for sequence c\n\t\tfound := false\n\t\tfor in, e := range rest {\n\t\t\tif len(e.Entry.ExtIDs) != 4 { // Crap\n\t\t\t\t//rest = append(rest[:in], rest[in+1:]...)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tseq, err := primitives.BytesToUint32(e.Entry.ExtIDs[0])\n\t\t\tif err != nil {\n\t\t\t\t//rest = append(rest[:in], rest[in+1:]...) // Remove crap\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif seq == uint32(c) {\n\t\t\t\tv, data := m.ValidateStitch(e)\n\t\t\t\tif v { // Stich applied, look for the next\n\t\t\t\t\t//rest = append(rest[:in], rest[in+1:]...)\n\t\t\t\t\tcontent = append(content, data...)\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar _ = in\n\t\t}\n\t\tif !found {\n\t\t\tlog.Debug(\"[ContentLink] (10): Missing data in content link\")\n\t\t\tm.ErrorAndStop = true\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Woo! Stiched up!\n\terr = m.ContentData.UnmarshalBinary(content)\n\tif err != nil {\n\t\tlog.Debug(\"[ContentLink] (11): Cannot unmarshal into ContentData\")\n\t\tm.ErrorAndStop = true\n\t\treturn\n\t}\n\n\tm.Content = *m.ContentData.ContentChainContentToCommonContent()\n\tm.Content.Type = m.ContentType\n\tm.Content.CreationTime = m.LinkTimestamp\n\tm.Content.ContentID = m.ContentChainID\n\tm.RootChainID = m.RootChainID\n}", "title": "" }, { "docid": "740c31bdc5fb1bc338f493cda4b24050", "score": "0.4261946", "text": "func (s *API) SetDHCPEntries(req *SetDHCPEntriesRequest, opts ...scw.RequestOption) (*SetDHCPEntriesResponse, error) {\n\tvar err error\n\n\tif req.Zone == \"\" {\n\t\tdefaultZone, _ := s.client.GetDefaultZone()\n\t\treq.Zone = defaultZone\n\t}\n\n\tif fmt.Sprint(req.Zone) == \"\" {\n\t\treturn nil, errors.New(\"field Zone cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"PUT\",\n\t\tPath: \"/vpc-gw/v1/zones/\" + fmt.Sprint(req.Zone) + \"/dhcp-entries\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp SetDHCPEntriesResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "d6d95f43072793c584980dfc2cc3b2cc", "score": "0.425609", "text": "func (ts *TableSource) SetResultFields(rfs []*ResultField) {\n\tts.Source.SetResultFields(rfs)\n}", "title": "" }, { "docid": "7b39c651d0c0b31e926152522d6eef7f", "score": "0.4247704", "text": "func (o *LicensedWorkloadsPage) SetResults(v []LicensedWorkload) {\n\to.Results = v\n}", "title": "" }, { "docid": "3944d9bc4b9119413dad004cdbde2bd1", "score": "0.4244356", "text": "func (o *GetPreferencesMetaEntryitemsParams) SetRows(rows string) {\n\to.Rows = rows\n}", "title": "" }, { "docid": "d2dcb7a89f6b5f5af5b79aa1bbf1385c", "score": "0.42262155", "text": "func (m *SearchLogQuery) Entries() []ProposedEntry {\n\treturn m.entriesField\n}", "title": "" }, { "docid": "cfc325622ab36a2ba78f2f9ecb0e20a3", "score": "0.42258227", "text": "func (w *Workbench) ExecutionResult(errs []error) {\n\tassigned := make([]IssueAssignment, 0)\n\tfor i, err := range errs {\n\t\tif err != nil {\n\t\t\tassigned = append(assigned, w.assigned[i])\n\t\t} else {\n\t\t\tassignment := w.assigned[i]\n\t\t\tw.completed = append(w.completed, IssueAction{assignment.issue, w.actionBases[assignment.actionId]})\n\t\t}\n\t}\n\tw.assigned = assigned\n\n}", "title": "" }, { "docid": "6f75b89a057e8bcb6f22930bf313e17e", "score": "0.4216407", "text": "func AddResult(uid string, arg string, title string, sub string, icon string, valid string, auto string, rtype string, priority int) {\n\t//\n\t// Add in the new result array if not full.\n\t//\n\tif currentResult < maxResults {\n\t\tresults[currentResult].Uid = uid\n\t\tresults[currentResult].Arg = arg\n\t\tresults[currentResult].Title = title\n\t\tresults[currentResult].Sub = sub\n\t\tresults[currentResult].Icon = icon\n\t\tresults[currentResult].Valid = valid\n\t\tresults[currentResult].Auto = auto\n\t\tresults[currentResult].Rtype = rtype\n\t\tresults[currentResult].Priority = priority\n\t\tcurrentResult++\n\t}\n}", "title": "" }, { "docid": "d7cb9965346aec3c28ffd3529ac9b934", "score": "0.42153656", "text": "func (p *EpLno) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error) {\n\tentries, err := p.EpAll.ActionEntries(entries...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te, err := p.lnoEntries(entries)\n\treturn []upstream.Entry{e}, err\n}", "title": "" }, { "docid": "85b731c5334d3ad20c6a9a50035b9b5e", "score": "0.4214884", "text": "func (r ShardResults) AddResults(other ShardResults) {\n\tfor shard, result := range other {\n\t\tif result == nil || result.NumSeries() == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif existing, ok := r[shard]; ok {\n\t\t\texisting.AddResult(result)\n\t\t} else {\n\t\t\tr[shard] = result\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d30e437e565f6f83470da8584055c385", "score": "0.4213804", "text": "func (o LookupHostSecurityReportResultOutput) ResultRows() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupHostSecurityReportResult) string { return v.ResultRows }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cedf1752609d85c3091512c053c0be94", "score": "0.4205975", "text": "func (s *Domain) SetDomainEntries(v []*DomainEntry) *Domain {\n\ts.DomainEntries = v\n\treturn s\n}", "title": "" }, { "docid": "a0d2570719bcbb591ccee9ef08347887", "score": "0.417918", "text": "func (mvcc *MVCC) ScanEntries() api.EntryIterator {\n\tcurrkey := []byte(nil)\n\tsb := makescanbuf()\n\n\tre := &indexentry{id: mvcc.ID()}\n\tleseqno := mvcc.startscan(nil, sb, 0)\n\n\treturn func(fin bool) api.IndexEntry {\n\t\tif re.err != nil {\n\t\t\treturn re\n\t\t} else if fin {\n\t\t\tsb = nil\n\t\t\treturn re.set(nil, nil, 0, false, io.EOF)\n\t\t}\n\n\t\tkey, value, seqno, deleted := sb.pop()\n\t\tif key == nil { // prefetch is nil\n\t\t\tmvcc.startscan(currkey, sb, leseqno)\n\t\t\tkey, value, seqno, deleted = sb.pop()\n\t\t}\n\n\t\tif key == nil { // iteration has finished\n\t\t\tsb = nil\n\t\t\treturn re.set(nil, nil, 0, false, io.EOF)\n\t\t}\n\t\tcurrkey = lib.Fixbuffer(currkey, int64(len(key)))\n\t\tcopy(currkey, key)\n\t\treturn re.set(key, value, seqno, deleted, nil)\n\t}\n}", "title": "" }, { "docid": "db12b31e2a8db572616c9fc2ecd4224f", "score": "0.41729578", "text": "func (r *Run) WithResult(ruleId string, message string, uri string, line int, column int) *Run {\n\tif r.Results == nil {\n\t\tr.Results = []*Result{}\n\t}\n\n\tmsg := NewMessage()\n\tmsg.Text = message\n\tresult := NewResult(msg)\n\tlocation := NewLocation().WithURI(uri).WithLineColumn(line, column)\n\n\tresult.Locations = append(result.Locations, location)\n\tresult.RuleId = ruleId\n\tr.Results = append(r.Results, result)\n\treturn r\n}", "title": "" }, { "docid": "9f9ad63a266a9d163958a0624e553749", "score": "0.41646442", "text": "func NewHyperflexConfigResult(classId string, objectType string) *HyperflexConfigResult {\n\tthis := HyperflexConfigResult{}\n\tthis.ClassId = classId\n\tthis.ObjectType = objectType\n\treturn &this\n}", "title": "" }, { "docid": "5e70cdfd893bd27f4675c688b85fcc2b", "score": "0.41502687", "text": "func (o *GetPreferencesMetaEntryitemsParams) WithRows(rows string) *GetPreferencesMetaEntryitemsParams {\n\to.SetRows(rows)\n\treturn o\n}", "title": "" }, { "docid": "6cec388a78e0748d734dc7c7fbc48d8a", "score": "0.41387466", "text": "func (cb *MgoBackend) SetResult(taskID string, result *ResultMessage) error {\n\tresult.ID = taskID\n\tif err := cb.md.Conn().Collection(cb.table).Save(result); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b815ad5082407e9bc09b24872584f5dd", "score": "0.41375136", "text": "func FlattenResults(multi ...db.Results) (flat db.Results) {\n\tfor _, m := range multi {\n\t\tfor _, r := range m {\n\t\t\tflat = append(flat, r)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "77a6dc866637309f48aadd8f7ff1e83d", "score": "0.41268495", "text": "func (e Etcds) SetEntries(s *Setup) {\n\n\t_, s.Etcd.Version = e.GetFormItemByLabel(\"Version\").(*tview.DropDown).GetCurrentOption()\n\ts.Etcd.DataDir = e.GetFormItemByLabel(\"DataDir\").(*tview.InputField).GetText()\n}", "title": "" }, { "docid": "37295b6708ba0e1cd8ec0224c40160c1", "score": "0.4104771", "text": "func (s *ResultSet) SetRows(v []*ResultRow) *ResultSet {\n\ts.Rows = v\n\treturn s\n}", "title": "" }, { "docid": "7828a3403c877731f164a1dd11a520a1", "score": "0.41031742", "text": "func (o *TagsOutAllOf) SetResults(v map[string][]StructuredTag) {\n\to.Results = &v\n}", "title": "" }, { "docid": "15fc25c4821321d90b1bf77566946e17", "score": "0.4101157", "text": "func (o *SearchResultsDTO) SetProcessorResults(v []ComponentSearchResultDTO) {\n\to.ProcessorResults = &v\n}", "title": "" }, { "docid": "795e081ad40bab36c0eb9f6945c45279", "score": "0.40895954", "text": "func JoinResults(keys, values *ResultSet) ([]weave.Model, error) {\n\tkref, vref := keys.Results, values.Results\n\tif len(kref) != len(vref) {\n\t\treturn nil, errors.New(\"Mismatches result set size\")\n\t}\n\tmods := make([]weave.Model, len(kref))\n\tfor i := range mods {\n\t\tmods[i] = weave.Model{\n\t\t\tKey: kref[i],\n\t\t\tValue: vref[i],\n\t\t}\n\t}\n\treturn mods, nil\n}", "title": "" }, { "docid": "daed6adbd2c3c46ad583898c7092cb85", "score": "0.40760905", "text": "func (o *CreditSession) SetResults(v CreditSessionResults) {\n\to.Results = &v\n}", "title": "" }, { "docid": "958f0c3efe287ff0e5e300ced18cce8a", "score": "0.40706515", "text": "func (a *AuthenticationResponseParameter) SetRES(rES [16]uint8) {\n\tcopy(a.Octet[0:16], rES[:])\n}", "title": "" }, { "docid": "84130906ff306154653ce85d118c32ad", "score": "0.40671104", "text": "func (ctq *ClinicalTrialQuery) WithResultsDefinition(opts ...func(*ResultsDefinitionQuery)) *ClinicalTrialQuery {\n\tquery := &ResultsDefinitionQuery{config: ctq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tctq.withResultsDefinition = query\n\treturn ctq\n}", "title": "" }, { "docid": "1a1fde933ed7d388f2114282720f5774", "score": "0.4064187", "text": "func (o QueryAnalysisValidationResultResponseOutput) QueryResults() QueryExecutionResultResponseOutput {\n\treturn o.ApplyT(func(v QueryAnalysisValidationResultResponse) QueryExecutionResultResponse { return v.QueryResults }).(QueryExecutionResultResponseOutput)\n}", "title": "" }, { "docid": "0d2f5e0354102f564c67eca0aa61961f", "score": "0.40613598", "text": "func UnmarshalClusterSearchResult(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ClusterSearchResult)\n\terr = core.UnmarshalPrimitive(m, \"offset\", &obj.Offset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"limit\", &obj.Limit)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"total_count\", &obj.TotalCount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_count\", &obj.ResourceCount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"first\", &obj.First)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"last\", &obj.Last)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"prev\", &obj.Prev)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"next\", &obj.Next)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"resources\", &obj.Resources, UnmarshalClusterInfo)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "bcc5ae6b4d838c4225e2744a301a7d91", "score": "0.40574434", "text": "func (o *SearchResultsDTO) SetFunnelResults(v []ComponentSearchResultDTO) {\n\to.FunnelResults = &v\n}", "title": "" }, { "docid": "ef54d1faf2dc718c003901b9d51c5eb4", "score": "0.4049275", "text": "func (ctu *ClinicalTrialUpdate) SetResultsDefinition(r *ResultsDefinition) *ClinicalTrialUpdate {\n\treturn ctu.SetResultsDefinitionID(r.ID)\n}", "title": "" }, { "docid": "8f510cf8d14cc96abce5ae2449a6ff9c", "score": "0.40476978", "text": "func (c Connection) Results(id int) (Result, error) {\n\tvar ret Result\n\tyamlStr, err := c.ResultsAsYAML(id)\n\n\terr = yaml.Unmarshal([]byte(yamlStr), &ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "eec8b8083c2ada9fc2ee5c9842d83a84", "score": "0.40443453", "text": "func (o *MicrosoftGraphDriveItem) SetSearchResult(v AnyOfmicrosoftGraphSearchResult) {\n\to.SearchResult = &v\n}", "title": "" }, { "docid": "c6d3a9d08500f83061e83e9c3d36d836", "score": "0.403093", "text": "func (c *Client) ConfigEntries() *ConfigEntries {\n\treturn &ConfigEntries{c}\n}", "title": "" }, { "docid": "fecb97e2a2e005420a7ce4c430e0dbbb", "score": "0.40262935", "text": "func (m *HuntingQueryResults) GetResults()([]HuntingRowResultable) {\n val, err := m.GetBackingStore().Get(\"results\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]HuntingRowResultable)\n }\n return nil\n}", "title": "" }, { "docid": "cdb5add8a6df3d37a2a64de527fd96e9", "score": "0.40240532", "text": "func ExpectAllResults(\n\ttesting *testing.T,\n\tentries []ParserTestEntry,\n\tparsingFunction testParsingFunction) {\n\n\tfor _, entry := range entries {\n\t\tExpectResult(testing, entry.Input, entry.ExpectedOutput, parsingFunction)\n\t}\n}", "title": "" }, { "docid": "7246649844114584d14df368c255fd7d", "score": "0.4022114", "text": "func (m *Company) SetGeneralLedgerEntries(value []GeneralLedgerEntryable)() {\n err := m.GetBackingStore().Set(\"generalLedgerEntries\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3a35c1176252338b8cc41b74454a7838", "score": "0.40193176", "text": "func (rf *Raft) AppendEntries (args AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tDPrintf(\"peer %d with role %d append entry from leader %d\\n\", rf.me, rf.Role, args.LeaderId)\n\tdefer rf.mu.Unlock()\n\tif args.Term < rf.CurrentTerm {\n\t\treply.Term = rf.CurrentTerm\n\t\treply.Success = false\n\t\tDPrintf(\"peer %d with term %d reject peer %d with term %d because of args.Term < rf.CurrentTerm\\n\", rf.me, rf.CurrentTerm, args.LeaderId, args.Term)\n\t\treturn\n\t} else if args.Term > rf.CurrentTerm {\n\t\trf.Role = 0\n\t\trf.CurrentTerm = args.Term\n\t\trf.persist()\n\t}\n\tif rf.Role == 1 {\n\t\trf.Role = 0\n\t\trf.CurrentTerm = args.Term\n\t\trf.persist()\n\t}\n\tif rf.Role == 0 {\n\t\t// reset heart beat\n\t\tDPrintf(\"follower peer %d with term %d receive heartbeat from leader %d with term %d\\n\", rf.me, rf.CurrentTerm, args.LeaderId, args.Term)\n\t\tDPrintf(\"peer %d with role %d reset heart beat timer\", rf.me, rf.Role)\n\t\trf.HeartBeat.Reset(time.Duration(rand.Int63n(Interval)+Heartbeat) * time.Millisecond)\n\t}\n\tif args.PrevLogIndex != 0 && args.PrevLogIndex <= len(rf.Logs) && rf.Logs[args.PrevLogIndex-1].Term != args.PrevLogTerm {\n\t\treply.Term = rf.Logs[args.PrevLogIndex-1].Term\n\t\tk := args.PrevLogIndex\n\t\tfor ; k > 0; k-- {\n\t\t\tif rf.Logs[k-1].Term != reply.Term {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tDPrintf(\"peer %d k = %d\", rf.me, k)\n\t\treply.FirstIndex = k+1\n\t\treply.Success = false\n\t\tDPrintf(\"peer %d with term %d reject peer %d with term %d because of log mismatch in index %d, reply.term=%d, reply.FirstIndex=%d\\n\", rf.me, rf.CurrentTerm, args.LeaderId, args.Term, args.PrevLogIndex, reply.Term, reply.FirstIndex)\n\t\treturn\n\t}\n\tif args.PrevLogIndex > len(rf.Logs) {\n\t\tif len(rf.Logs) == 0 {\n\t\t\tDPrintf(\"peer %d reject leader %d because of log mismatch, len(rf.Logs)==0\", rf.me, args.LeaderId)\n\t\t\treply.Term = 0\n\t\t\treply.FirstIndex = 0\n\t\t\treply.Success = false\n\t\t\treturn\n\t\t} else {\n\t\t\treply.Term = rf.Logs[len(rf.Logs)-1].Term\n\t\t\treply.FirstIndex = len(rf.Logs)\n\t\t\treply.Success = false\n\t\t\tDPrintf(\"peer %d with term %d reject peer %d with term %d because of log mismatch, len(log)=%d, args.PrevLogIndex=%d, reply.term=%d, reply.FirstIndex=%d\", rf.me, rf.CurrentTerm, args.LeaderId, args.Term, len(rf.Logs), args.PrevLogIndex, reply.Term, reply.FirstIndex)\n\t\t\treturn\n\t\t}\n\t}\n\tif rf.Role == 0 {\n\t\t// append entries\n\t\tif len(rf.Logs) != 0 {\n\t\t\tif args.PrevLogIndex != 0 {\n\t\t\t\trf.Logs = rf.Logs[:args.PrevLogIndex]\n\t\t\t\trf.persist()\n\t\t\t} else {\n\t\t\t\trf.Logs = []*LogEntry{}\n\t\t\t\trf.persist()\n\t\t\t}\n\t\t}\n\t\tfor _, entry := range args.Entries {\n\t\t\t\tDPrintf(\"peer %d append new logs from leader %d with index %d\", rf.me, args.LeaderId, entry.Index)\n\t\t\t\trf.Logs = append(rf.Logs, entry)\n\t\t}\n\t\trf.persist()\n\t}\n\tif args.LeaderCommit > rf.CommitIndex {\n\t\tDPrintf(\"ready to update %d 's commitIndex, args.LeaderCommit=%d , len(rf.Logs)=%d\", rf.me, args.LeaderCommit, len(rf.Logs))\n\t\tif args.LeaderCommit < len(rf.Logs) {\n\t\t\trf.CommitIndex = args.LeaderCommit\n\t\t\tDPrintf(\"update %d 's commitIndex to LeaderCommit with value %d\", rf.me, rf.CommitIndex)\n\t\t} else {\n\t\t\trf.CommitIndex = len(rf.Logs)\n\t\t\tDPrintf(\"update %d 's commitIndex to len(rf.Logs) with value %d\", rf.me, len(rf.Logs))\n\t\t}\n\t}\n\tDPrintf(\"peer %d with committed index %d logs: \", rf.me, rf.CommitIndex)\n\tfor j := 0; j < len(rf.Logs); j++ {\n\t\tDPrintf(\"peer %d: index: %d term: %d cmd: %d\",rf.me ,rf.Logs[j].Index, rf.Logs[j].Term, rf.Logs[j].Command.(int))\n\t}\n\treply.Term = args.Term\n\treply.Success = true\n}", "title": "" }, { "docid": "e12a26e762cc07fcc8ab6d58116dae42", "score": "0.40192205", "text": "func UnmarshalCatalogSearchResult(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(CatalogSearchResult)\n\terr = core.UnmarshalPrimitive(m, \"offset\", &obj.Offset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"limit\", &obj.Limit)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"total_count\", &obj.TotalCount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_count\", &obj.ResourceCount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"first\", &obj.First)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"last\", &obj.Last)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"prev\", &obj.Prev)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"next\", &obj.Next)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"resources\", &obj.Resources, UnmarshalCatalog)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "e68980fd37d50e1012c8bf23f658b1d8", "score": "0.40135798", "text": "func (o *V1GetNetworkPoliciesResponse) SetResults(v []V1NetworkPolicy) {\n\to.Results = &v\n}", "title": "" }, { "docid": "0e523ec196388516c3d49606724e6e03", "score": "0.40045455", "text": "func (c IndexEnqueuerInferIndexConfigurationFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1, c.Result2}\n}", "title": "" }, { "docid": "5ed9740ae7a7406f0bcc70e86b83f63c", "score": "0.3988043", "text": "func (m *SslCertificate) SetRelatedHosts(value []Hostable)() {\n err := m.GetBackingStore().Set(\"relatedHosts\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3ca6a394cabc4ae8f21ce515d36ac58f", "score": "0.3987324", "text": "func (ctuo *ClinicalTrialUpdateOne) SetResultsDefinition(r *ResultsDefinition) *ClinicalTrialUpdateOne {\n\treturn ctuo.SetResultsDefinitionID(r.ID)\n}", "title": "" }, { "docid": "953fb3a5239eccb68bac65947d45ddea", "score": "0.3976828", "text": "func (_KVTableTest *KVTableTestFilterer) FilterSetResult(opts *bind.FilterOpts) (*KVTableTestSetResultIterator, error) {\n\n\tlogs, sub, err := _KVTableTest.contract.FilterLogs(opts, \"SetResult\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &KVTableTestSetResultIterator{contract: _KVTableTest.contract, event: \"SetResult\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "2b16bb7c22778042c86657ecd98c1e75", "score": "0.39633623", "text": "func resultIter(ctx context.Context, results []int32) <-chan statuspb.TestStatus {\n\treturn result.Iter(ctx, results)\n}", "title": "" }, { "docid": "e2c995b7cacd46f42dcef31fab577031", "score": "0.39425662", "text": "func (o *SearchResultsDTO) SetInputPortResults(v []ComponentSearchResultDTO) {\n\to.InputPortResults = &v\n}", "title": "" }, { "docid": "667b2c92f72a10323ae0a5d78413c302", "score": "0.39413214", "text": "func (b *resultBatch) AddResult(r *entity.Result) {\n\tif b.check(r.UUID()) {\n\t\treturn\n\t}\n\tb.AddFile(r.File)\n\tb.AddBenchmark(r.Benchmark)\n\tb.AddCommit(r.Commit)\n\tb.AddProperties(r.Environment)\n\tb.AddProperties(r.Metadata)\n\tb.Results = append(b.Results, r)\n}", "title": "" }, { "docid": "776545f06fb884a7193b9c8f484a65f3", "score": "0.39382577", "text": "func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\t//check if the senders term is stale or not\n\tif rf.currentTerm > args.Term {\n\t\treply.Success = false\n\t\treply.Term = rf.currentTerm\n\t} else {\n\t\trf.currentTerm = args.Term\n\t\trf.makeFollower()\n\t\tselect {\n\t\tcase <-rf.activityCh:\n\t\tdefault:\n\t\t\tclose(rf.activityCh)\n\t\t}\n\t\tlastIdx := len(rf.logs) - 1\n\t\tl := len(args.Entries)\n\t\tif lastIdx < args.PrevLogIndex || l == 0 {\n\t\t\treply.Success = false\n\t\t} else if args.PrevLogIndex == -1 || rf.logs[args.PrevLogIndex].Term == args.PrevLogTerm {\n\t\t\treply.Success = true\n\t\t\trf.logs = rf.logs[:args.PrevLogIndex+1]\n\t\t\tfor j := 0; j < len(args.Entries); j += 1 {\n\t\t\t\trf.logs = append(rf.logs, args.Entries[j])\n\t\t\t}\n\t\t} else {\n\t\t\treply.Success = false\n\t\t}\n\t}\n\t//Check whether the servers commitIndex can be increased based on leader commit and current term\n\tfor j := rf.commitIndex + 1; j < min(args.LeaderCommit+1, len(rf.logs)); j += 1 {\n\t\tif rf.logs[j].Term == rf.currentTerm {\n\t\t\tfor k := rf.commitIndex + 1; k <= j; k += 1 {\n\t\t\t\trf.commitIndex += 1\n\t\t\t\trf.applyCh <- ApplyMsg{rf.commitIndex + 1, rf.logs[rf.commitIndex].Command}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "268676e7e32e724e94013be736eea663", "score": "0.39190936", "text": "func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tmyPrevLogIndex := logicalToPhysical(args.PrevLogIndex, rf.offset)\n\tvar myPrevTerm int\n\tif rf.offset > 0 {\n\t\tif args.PrevLogIndex < rf.offset {\n\t\t\tmyPrevTerm = -1000\n\t\t} else if args.PrevLogIndex == rf.offset {\n\t\t\tmyPrevTerm = rf.lastterm\n\t\t} else if args.PrevLogIndex > rf.offset && myPrevLogIndex <= len(rf.log)-1 {\n\t\t\tmyPrevTerm = rf.log[myPrevLogIndex].Term\n\t\t} else {\n\t\t\tmyPrevTerm = -3000\n\t\t}\n\t} else {\n\t\tif args.PrevLogIndex <= len(rf.log)-1 {\n\t\t\tmyPrevTerm = rf.log[args.PrevLogIndex].Term\n\t\t} else {\n\t\t\tmyPrevTerm = -3000\n\t\t}\n\t}\n\n\t//fmt.Println(\"Called AppendEntries:\", args.LeaderID)\n\treply.Term = rf.currentTerm\n\tif args.Term < rf.currentTerm { //heartbeat scenario\n\t\treply.Success = false\n\t\tfmt.Println(\"Received Invalid AppendEntry for Server: term: Status:\", rf.me, rf.currentTerm, rf.peerStatus, args.LeaderID, args.Term)\n\t\treturn\n\n\t} else if myPrevTerm == -1000 { //Case to handle when leader is too far behind. force new election\n\t\treply.Success = false\n\t\trf.currentTerm = args.Term\n\t\tfmt.Println(\"AppendEntries: Leader log is too short...\", rf.me, args.LeaderID)\n\t\trf.persist()\n\t\treturn\n\t} else if myPrevTerm == -3000 { //Leader far ahead\n\t\treply.Success = false\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\tfmt.Println(\"Leader: ahead of Follower: indexes:\", args.LeaderID, rf.me, args.PrevLogIndex, rf.length()-1)\n\t\trf.persist()\n\t\treturn\n\t\t//else if args.Entries == nil && len(rf.log)-1 < args.PrevLogIndex\n\t} else if args.Entries == nil && rf.length()-1 < args.PrevLogIndex { //Check that logs are long enough.\n\t\treply.Success = false\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\t//fmt.Println(\"Heart beat received: Case 1:\", rf.me)\n\t\trf.persist()\n\t\treturn\n\t\t// last logical index in client log >= previous log index\n\t\t//else if args.Entries == nil && rf.log[args.PrevLogIndex].Term != args.PrevLogTerm {\n\t} else if args.Entries == nil && myPrevTerm != args.PrevLogTerm {\n\t\treply.Success = false\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\t//fmt.Println(\"Heart beat received: Case 2:\", rf.me)\n\t\trf.persist()\n\t\treturn\n\t\t//else if args.Entries == nil && rf.log[args.PrevLogIndex].Term == args.PrevLogTerm {\n\t} else if args.Entries == nil && myPrevTerm == args.PrevLogTerm {\n\t\treply.Success = true\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\tif args.LeaderCommit > rf.commitIndex {\n\t\t\t//fmt.Println(\"Heartbeat: Leadercommit: CommitIndex, lastApplied: Length:\", args.LeaderCommit, rf.commitIndex, rf.lastApplied, len(rf.log)-1)\n\t\t\t//rf.commitIndex = min(args.LeaderCommit, len(rf.log)-1)\n\t\t\trf.commitIndex = min(args.LeaderCommit, rf.length()-1)\n\t\t\tgo rf.commitApplier()\n\t\t\t//go rf.commitFinder()\n\t\t}\n\t\t//fmt.Println(\"Heart beat received: Case 3:\", rf.me)\n\t\trf.persist()\n\t\treturn\n\n\t} else if args.Entries == nil && args.Term >= rf.currentTerm { //This should not happen\n\t\treply.Success = true\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\tfmt.Println(\"Heart beat received: Case 4: This should not happen\", rf.me)\n\t\trf.persist()\n\t\treturn\n\t\t//else if args.Entries != nil && len(rf.log)-1 < args.PrevLogIndex {\n\t} else if args.Entries != nil && rf.length()-1 < args.PrevLogIndex {\n\t\treply.Success = false\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\tfmt.Println(\"Get agreement Case 1:\", rf.me)\n\t\trf.persist()\n\t\treturn\n\t\t// last logical index in client log >= previous log index\n\t\t//else if args.Entries != nil && rf.log[args.PrevLogIndex].Term != args.PrevLogTerm {\n\t} else if args.Entries != nil && myPrevTerm != args.PrevLogTerm {\n\t\treply.Success = false\n\t\trf.log = rf.log[0 : myPrevLogIndex+1] //truncate the log\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\tfmt.Println(\"Get agreement Case 2:\", rf.me)\n\t\t//fmt.Println(\"Truncate logs for server:\", rf.me)\n\t\trf.persist()\n\t\treturn\n\t\t//else if args.Entries != nil && rf.log[args.PrevLogIndex].Term == args.PrevLogTerm {\n\t} else if args.Entries != nil && myPrevTerm == args.PrevLogTerm {\n\t\t// reason to check length is not replace larger chuck with a smaller one\n\t\tlen1 := len(rf.log[myPrevLogIndex+1:])\n\t\tlen2 := len(args.Entries[:])\n\t\tif len2 >= len1 {\n\t\t\trf.log = append(rf.log[0:myPrevLogIndex+1], args.Entries[:]...)\n\t\t\t//fmt.Println(\"AppendEntries from: Leader: to Server: LeaderEntries: PrevLogIndex:\", args.LeaderID, rf.me, args.Entries, args.PrevLogIndex)\n\t\t\t//fmt.Println(\"ServerLog after append:\", rf.log)\n\t\t}\n\t\treply.Success = true\n\t\trf.currentTerm = args.Term\n\t\trf.validBeat = true\n\t\tfmt.Println(\"Get agreement Case 3:\", rf.me)\n\n\t\tif args.LeaderCommit > rf.commitIndex {\n\t\t\t//fmt.Println(\"Leadercommit: CommitIndex, lastApplied: Length:\", args.LeaderCommit, rf.commitIndex, rf.lastApplied, len(rf.log)-1)\n\t\t\t//rf.commitIndex = min(args.LeaderCommit, len(rf.log)-1)\n\t\t\trf.commitIndex = min(args.LeaderCommit, rf.length()-1)\n\t\t\tgo rf.commitApplier()\n\t\t\t//go rf.commitFinder()\n\t\t}\n\t\trf.persist()\n\t\treturn\n\t}\n\tfmt.Println(\"OOPS.....No scenario matched for AppendRPC:\", rf.me)\n}", "title": "" }, { "docid": "f5d7ddef8a5ac2042b11605ad669956e", "score": "0.3918155", "text": "func (client BaseClient) AcrListManifestMetadataResponder(resp *http.Response) (result SetObject, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "49ae8a7e74a6772c7c789da351768e59", "score": "0.39177653", "text": "func (_result result) SetResponse() map[string]interface{} {\n\tjsonObject, _ := json.Marshal(_result)\n\n\tvals := make(map[string]interface{})\n\terr := json.Unmarshal(jsonObject, &vals)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn vals\n}", "title": "" }, { "docid": "93dfbb6dbcf2af5c80b671c96c2966d9", "score": "0.3915066", "text": "func (c *compactJob) installCompactionResults() {\n\tif c.rollup == nil {\n\t\t// if it does compact job, need mark compaction input files for deletion\n\t\tc.state.compaction.MarkInputDeletes()\n\t}\n\t// adds compaction outputs\n\tlevel := c.state.compaction.GetLevel()\n\tif c.rollup == nil {\n\t\tlevel++ // compact job need add level\n\t}\n\tfor _, output := range c.state.outputs {\n\t\tc.state.compaction.AddFile(level, output)\n\t}\n\tc.family.commitEditLog(c.state.compaction.GetEditLog())\n}", "title": "" }, { "docid": "2e3c22c3b4634a6e9221a935a1d28122", "score": "0.39099005", "text": "func NewTransactionHistoryResultEntryExt(v int32, value interface{}) (result TransactionHistoryResultEntryExt, err error) {\n\tresult.V = v\n\tswitch int32(v) {\n\tcase 0:\n\t\t// void\n\t}\n\treturn\n}", "title": "" }, { "docid": "8aa11de0b69f7fa8a0813bf9e59d687f", "score": "0.39056244", "text": "func (r *RIB) SetResolvedEntryHook(fn ResolvedEntryFn) {\n\tr.resolvedEntryHook = fn\n}", "title": "" }, { "docid": "6431be6eeebc3e9695d6531b7072b32d", "score": "0.39040357", "text": "func (d *domainClient) RequestEntries(ctx context.Context, args *RequestEntriesArgs) (reply *RequestEntriesReply, err error) {\n\treply = new(RequestEntriesReply)\n\tif args != nil {\n\t\terr = rpcc.Invoke(ctx, \"CacheStorage.requestEntries\", args, reply, d.conn)\n\t} else {\n\t\terr = rpcc.Invoke(ctx, \"CacheStorage.requestEntries\", nil, reply, d.conn)\n\t}\n\tif err != nil {\n\t\terr = &internal.OpError{Domain: \"CacheStorage\", Op: \"RequestEntries\", Err: err}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4a44ba37febf6006f083c4fb1021b5bf", "score": "0.38988516", "text": "func InitialQueryResult(ctx *Context) QueryResult {\n\tqr := QueryResult{make([]Bindings, 0, 1), 0, 0}\n\tqr.Bss = append(qr.Bss, make(map[string]interface{}))\n\treturn qr\n\n}", "title": "" }, { "docid": "7c5b35490a941d46e4337b3650726541", "score": "0.38984796", "text": "func settlementEntriesForAdvancedSettlement(s schema.Schema, trn schema.Transaction, exp schema.Expense) []Entry {\n\tcmt := NewComment(\"settlement of employee advancement\", trn.String())\n\tcmt.add(compareAmounts(trn.Amount, exp.Amount))\n\n\temp, err := s.Parties.EmployeeByRef(exp.AdvancedThirdParty)\n\tcmt.add(err)\n\n\tdesc := \"no employee found\"\n\tif err == nil {\n\t\tdata := map[string]string{\n\t\t\t\"Identifier\": exp.Identifier,\n\t\t\t\"Party\": fmt.Sprintf(\"%s (%s)\", emp.Name, emp.Identifier),\n\t\t}\n\t\tdesc = util.ApplyTemplate(\n\t\t\t\"employee advanced expense settlement\",\n\t\t\ts.JournalConfig.AdvancedExpenseSettlementDescription,\n\t\t\tdata)\n\t}\n\n\treturn []Entry{\n\t\t{\n\t\t\tDate: trn.DateTime(),\n\t\t\tStatus: UnmarkedStatus,\n\t\t\tCode: trn.Identifier,\n\t\t\tDescription: desc,\n\t\t\tComment: cmt,\n\t\t\tAccount1: fmt.Sprintf(\"%s:%s\", s.JournalConfig.EmployeeLiabilitiesAccount, emp.Name),\n\t\t\tAccount2: s.JournalConfig.BankAccount,\n\t\t\tAmount: trn.Amount,\n\t\t}}\n}", "title": "" }, { "docid": "4b9408e832ce105625e2a2ec1ac6337b", "score": "0.38899696", "text": "func (f *TestFunc) SetResults(status, time string) {\n\tf.Status = status\n\tf.Time = time\n}", "title": "" }, { "docid": "9b7f7c2f34f40b5c7eae8b484004b7bb", "score": "0.38798648", "text": "func (client *Client) PublishRouteEntriesWithOptions(request *PublishRouteEntriesRequest, runtime *util.RuntimeOptions) (_result *PublishRouteEntriesResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CenId)) {\n\t\tquery[\"CenId\"] = request.CenId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ChildInstanceId)) {\n\t\tquery[\"ChildInstanceId\"] = request.ChildInstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ChildInstanceRegionId)) {\n\t\tquery[\"ChildInstanceRegionId\"] = request.ChildInstanceRegionId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ChildInstanceRouteTableId)) {\n\t\tquery[\"ChildInstanceRouteTableId\"] = request.ChildInstanceRouteTableId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ChildInstanceType)) {\n\t\tquery[\"ChildInstanceType\"] = request.ChildInstanceType\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DestinationCidrBlock)) {\n\t\tquery[\"DestinationCidrBlock\"] = request.DestinationCidrBlock\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"PublishRouteEntries\"),\n\t\tVersion: tea.String(\"2017-09-12\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &PublishRouteEntriesResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "66f3747f99abbacb36d6fbf017dcb6c0", "score": "0.3876336", "text": "func (m *DeviceManagement) SetRemoteAssistancePartners(value []RemoteAssistancePartnerable)() {\n m.remoteAssistancePartners = value\n}", "title": "" }, { "docid": "bbf548cd05624d81f288ec495e949b64", "score": "0.38728115", "text": "func (f *registrationEntryFetcher) mappedEntries(ctx context.Context, clientID string) ([]*common.RegistrationEntry, error) {\n\tselectorsResp, err := f.dataStore.GetNodeSelectors(ctx,\n\t\t&datastore.GetNodeSelectorsRequest{\n\t\t\tSpiffeId: clientID,\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif selectorsResp.Selectors == nil {\n\t\treturn nil, errors.New(\"response missing selectors\")\n\t}\n\n\t// No need to look for more entries if we didn't get any selectors\n\tselectors := selectorsResp.Selectors.Selectors\n\tif len(selectors) < 1 {\n\t\treturn nil, nil\n\t}\n\n\t// list all registration entries with a combination of the selectors\n\tlistResp, err := f.dataStore.ListRegistrationEntries(ctx,\n\t\t&datastore.ListRegistrationEntriesRequest{\n\t\t\tBySelectors: &datastore.BySelectors{\n\t\t\t\tSelectors: selectors,\n\t\t\t\tMatch: datastore.BySelectors_MATCH_SUBSET,\n\t\t\t},\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn listResp.Entries, nil\n}", "title": "" }, { "docid": "87a1b635dbe52960a935fa5915660afd", "score": "0.38703075", "text": "func NewTransactionHistoryResultEntryExt(v LedgerVersion, value interface{}) (result TransactionHistoryResultEntryExt, err error) {\n\tresult.V = v\n\tswitch LedgerVersion(v) {\n\tcase LedgerVersionEmptyVersion:\n\t\t// void\n\t}\n\treturn\n}", "title": "" }, { "docid": "c5bc5a1ae2a487000a8483beb5b7cfff", "score": "0.38686916", "text": "func (br *buildResult) AddToClientResult(cr *client.Result) {\n\tif br.MultiPlatform {\n\t\tcr.AddMeta(\n\t\t\tfmt.Sprintf(\"%s/%s\", exptypes.ExporterImageConfigKey, br.ExportPlatform.ID),\n\t\t\tbr.ImageConfig,\n\t\t)\n\t\tcr.AddMeta(\n\t\t\tfmt.Sprintf(\"%s/%s\", exptypes.ExporterBuildInfo, br.ExportPlatform.ID),\n\t\t\tbr.BuildInfo,\n\t\t)\n\t\tcr.AddRef(br.ExportPlatform.ID, br.Reference)\n\t} else {\n\t\tcr.AddMeta(exptypes.ExporterImageConfigKey, br.ImageConfig)\n\t\tcr.AddMeta(exptypes.ExporterBuildInfo, br.BuildInfo)\n\t\tcr.SetRef(br.Reference)\n\t}\n}", "title": "" }, { "docid": "06fca2dd5c2f329cd296fc2e06308f26", "score": "0.38655326", "text": "func (f *registrationEntryFetcher) directEntries(ctx context.Context, id string) ([]*common.RegistrationEntry, error) {\n\tchildEntries, err := f.childEntries(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmappedEntries, err := f.mappedEntries(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn append(childEntries, mappedEntries...), nil\n}", "title": "" } ]
91ab996de4b6e8c4be1f94bb08be6b49
Insert: Creates a new web app for the enterprise. enterpriseId: The ID of the enterprise.
[ { "docid": "11b986258dc831917d7997b815feaa40", "score": "0.73407716", "text": "func (r *WebappsService) Insert(enterpriseId string, webapp *WebApp) *WebappsInsertCall {\n\tc := &WebappsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.webapp = webapp\n\treturn c\n}", "title": "" } ]
[ { "docid": "20416a56b9798ba52919b0534df39d13", "score": "0.58646864", "text": "func (r *StorelayoutpagesService) Insert(enterpriseId string, storepage *StorePage) *StorelayoutpagesInsertCall {\n\tc := &StorelayoutpagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.storepage = storepage\n\treturn c\n}", "title": "" }, { "docid": "a655bcb132120f36dc0efa29d8f2804d", "score": "0.5693679", "text": "func EnterpriseRegister(p *EnterpriseUserProp, a *AppIdProp, d *DaoWrapper) error {\n\t// TODO(mike) change to begain / end transaction and define rollback\n\t/*\n\t\tif enterprise name in enterprise list\n\t\t\tgoto next stage\n\t\telse\n\t\t\tcreate appid\n\t\t\tcreate enterprise id / user id\n\n\t*/\n\t// TODO(mike) each parameter checking\n\tif p == nil || d == nil {\n\t\treturn errors.New(\"invalid property or dao wrapper\")\n\t}\n\tLogInfo.Printf(\"enterprise prop: %s\", p)\n\n\tent_prop, err := d.GetEnterpriseByName(p.EnterpriseName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tLogInfo.Printf(\"enterprise prop: %s\", ent_prop)\n\n\tif len(ent_prop.EnterpriseId) == 0 {\n\t\ttime_now := time.Now()\n\t\ta.AppId = GenAppId()\n\t\ta.CreatedTime = time_now\n\t\tif err := d.AddAppEntry(a); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp.EnterpriseId = GenEnterpriseId()\n\t\tp.AppId = a.AppId\n\t\tp.CreatedTime = time_now\n\t\tif err := d.AddEnterpriseEntry(p); err != nil {\n\t\t\t// TODO(mike) roll back appid\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tp.AppId = ent_prop.AppId\n\t\tp.EnterpriseId = ent_prop.EnterpriseId\n\t}\n\tLogInfo.Printf(\"enterprise_id: %s, appid: %s\", p.EnterpriseId, p.AppId)\n\tp.UserId = GenUserId()\n\tif err := d.AddUserEntry(p); err != nil {\n\t\t// TODO(mike): rollback appid, and enterpriseid entries if need\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eba7e863aff215124d27e5027103b7ef", "score": "0.5641281", "text": "func (ea *EntApp) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif ea._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key must be provided\n\tconst sqlstr = `INSERT INTO custmchat.ent_app (` +\n\t\t`id, ent_id, app_name, create_at, update_at` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, ea.ID, ea.EntID, ea.AppName, ea.CreateAt, ea.UpdateAt)\n\t_, err = db.Exec(sqlstr, ea.ID, ea.EntID, ea.AppName, ea.CreateAt, ea.UpdateAt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tea._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "cf29680715a3992aea3d7a523dc16764", "score": "0.51998574", "text": "func (r *UsersService) Insert(enterpriseId string, user *User) *UsersInsertCall {\n\tc := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.user = user\n\treturn c\n}", "title": "" }, { "docid": "8d3bf79d4e6ac428a85b909aa3148d6f", "score": "0.5144631", "text": "func CreateExtApp(ctx context.Context, attr *ExtApp, 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\t_, err = tx.ExecContext(ctx, `\n\t\tINSERT INTO\n\t\t\text_apps (uid, name, kind, val, icon, extra)\n\t\t\tVALUES (?, ?, ?, ?, ?, ?);`, attr.UserID, attr.Name, attr.Kind, attr.Val, attr.Icon, attr.Extra)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "82bf358937e30a84c7eed58909fe6f4b", "score": "0.50770074", "text": "func Insert(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tif r.Body == nil {\n\t\thttp.Error(w, http.StatusText(400), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// ADD HANDLING FOR ARRAY of JSON\n\t//-----------------\n\t// WORK IN PROGRESS\n\t//-----------------\n\n\tprod, err := putProduct(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tpjson, err := json.Marshal(prod)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated) // 201\n\tfmt.Fprintf(w, \"%s\\n\", pjson)\n}", "title": "" }, { "docid": "baa032d3fd9dda70533cc2bd7fdb9eaa", "score": "0.50701964", "text": "func (c *Client) CreateApp(m *AppManifest) (*http.Response, error) {\n\tu, err := c.baseURL.Parse(\"/settings/apps/new\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := json.Marshal(map[string]*AppManifest{\"manifest\": m})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.Client.Post(u.String(), \"json\", bytes.NewReader(body))\n}", "title": "" }, { "docid": "d688d91d2c9d429905af2d3ef6e9e6d3", "score": "0.50447285", "text": "func Insert(db gorpmapper.SqlExecutorWithTx, proj sdk.Project, app *sdk.Application) error {\n\tif err := app.IsValid(); err != nil {\n\t\treturn sdk.WrapError(err, \"application is not valid\")\n\t}\n\n\tapp.ProjectID = proj.ID\n\tapp.ProjectKey = proj.Key\n\tapp.LastModified = time.Now()\n\tcopyVCSStrategy := app.RepositoryStrategy\n\n\tdbApp := dbApplication{Application: *app}\n\tif err := gorpmapping.InsertAndSign(context.Background(), db, &dbApp); err != nil {\n\t\treturn sdk.WrapError(err, \"application.Insert %s(%d)\", app.Name, app.ID)\n\t}\n\t*app = dbApp.Application\n\t// Reset the vcs_stragegy except the passowrd because it as been erased by the encryption layed\n\tapp.RepositoryStrategy = copyVCSStrategy\n\tapp.RepositoryStrategy.Password = sdk.PasswordPlaceholder\n\tapp.RepositoryStrategy.SSHKeyContent = \"\"\n\n\treturn nil\n}", "title": "" }, { "docid": "f6ab9cdca7f8cb7db6f65a3415307538", "score": "0.5003455", "text": "func (r *SimpleAppRepository) Create(app App) int {\n\treturn r.store.Apps.create(app)\n}", "title": "" }, { "docid": "0ab8b6c2afccca143921787c055023d7", "score": "0.50011426", "text": "func InsertInstallmentProduction(c *gin.Context) {\n\trequestBody, _ := ioutil.ReadAll(c.Request.Body)\n\tvar requestObj Installment\n\tjson.Unmarshal(requestBody, &requestObj)\n\n\trequestPoint := &requestObj\n\n\tappEngine := appengine.NewContext(c.Request)\n\tkey := datastore.NewIncompleteKey(appEngine, InstallmentKey, ProductionPromotionsKey(appEngine, InstallmentKey))\n\tif _, err := datastore.Put(appEngine, key, requestPoint); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"status_code\": http.StatusBadRequest,\n\t\t\t\"status_message\": err.Error(),\n\t\t})\n\t} else {\n\t\tc.JSON(http.StatusCreated, gin.H{\n\t\t\t\"status_code\": http.StatusCreated,\n\t\t\t\"status_message\": \"Installment created.\",\n\t\t})\n\t}\n}", "title": "" }, { "docid": "0b70a9ad76c48a5d8e8d3534cda4be8c", "score": "0.499707", "text": "func (asi AllowedWebMailsStoreImpl) Save(allowedWebMails *models.AllowedWebMails, db *gorm.DB) *u.AppError {\n\ttransaction := db.Begin()\n\tif appError := allowedWebMails.IsValid(); appError != nil {\n\t\ttransaction.Rollback()\n\t\treturn u.NewAPIError(422, appError.ID, \"Wrong data provided : \\n ---- \"+appError.Message+\" ----\")\n\t}\n\tif !transaction.NewRecord(&allowedWebMails) {\n\t\ttransaction.Rollback()\n\t\treturn u.NewAPIError(409, \"duplicate entry\", \"You already authorized \"+allowedWebMails.Domain+\" mails to sign up.\")\n\t}\n\tif err := transaction.Create(&allowedWebMails).Error; err != nil {\n\t\ttransaction.Rollback()\n\t\treturn u.NewAPIError(500, \"unxepected error\", \"Unexpected error while adding entry. \\n ---- \"+err.Error()+\"----\")\n\t}\n\ttransaction.Commit()\n\treturn nil\n}", "title": "" }, { "docid": "24e3072c407ec5b03d2cf530bf6e725f", "score": "0.49958292", "text": "func (d *DaoWrapper) AddAppEntry(a *AppIdProp) error {\n\t_, err := d.mysql.Exec(\"insert into appid_list values(?, ?, ?, ?, ?, ?)\", a.AppId, a.CreatedTime, a.ApiCnt, a.ExpirationTime, a.AnalysisDuration, a.Activation)\n\tLogInfo.Printf(\"add appid: %s, (%s)\", a, err)\n\treturn err\n}", "title": "" }, { "docid": "579dfcd46b41f7c263bc65c2ea4dd687", "score": "0.4971261", "text": "func InsertApp(app *model.App) error {\n\tif app == nil {\n\t\treturn nil\n\t}\n\t_, err := DB.Insert(app)\n\tif err != nil {\n\t\terr = errutil.YXErrDBOperation\n\t}\n\treturn err\n}", "title": "" }, { "docid": "54acaac17e6164abe79956fbe30d9b9e", "score": "0.4953058", "text": "func CreateApp(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\t/*\n\t * First we will get the app context\n\t * Then we will parse the request\n\t * Then we will create the app\n\t * Then will inform the authentication across the platform\n\t * Return the response\n\t */\n\t//getting the app context\n\tappCtx := ctx.Value(routes.AppContextKey).(*config.AppContext)\n\tappCtx.Log.Info(\"a request has come to create the app from \", appCtx.Session.User.ID)\n\n\t//parse the request param\n\ta := &config.App{}\n\terr := json.NewDecoder(r.Body).Decode(a)\n\tif err != nil {\n\t\t//bad request\n\t\tappCtx.Log.Error(\"error while parsing the app param\", err.Error())\n\t\tresponse.WriteError(appCtx, w, response.Error{Err: \"Invalid Params \" + err.Error()}, http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\t//creating the app\n\ta.UID = uuid.New()\n\ta.AccessToken = uuid.New().String()\n\ta.UserID = appCtx.Session.User.ID\n\taI := a.ToAppInfo()\n\terr = (&aI).Insert(*appCtx)\n\tif err != nil {\n\t\t//error while inserting the app to the platform\n\t\tappCtx.Log.Error(\"error while inserting the app into db for\", aI.UserID)\n\t\tappCtx.Log.Error(err.Error())\n\t\tresponse.WriteError(appCtx, w, response.Error{Err: \"Couldn't create the app\"}, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t//informing the authentication across the platform\n\tappCtx.Log.Info(\"created the app for user - \", a.UserID, \"with id\", a.ID, \"going to update the same across the platform\")\n\tuser := aI.ToApp().ToUser()\n\tgo user.InformAuth(*appCtx, true)\n\n\t//we will write the response\n\tresponse.Write(appCtx, w, response.Message{Message: \"created the app\", Data: aI.ToApp()})\n}", "title": "" }, { "docid": "d7133a28d9f463112f1438ba78627121", "score": "0.48950574", "text": "func Insert(w http.ResponseWriter, r *http.Request) {\n\tdb := dbConn()\n\tif r.Method == \"POST\" {\n\t\tstmt, err := db.Prepare(\"INSERT INTO employee.employee(name, lastname, age, city) VALUES(?,?,?,?)\")\n\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tkeyVal := make(map[string]string)\n\t\tjson.Unmarshal(body, &keyVal)\n\t\tFirstName := keyVal[\"FirstName\"]\n\t\tLastName := keyVal[\"LastName\"]\n\t\tCity := keyVal[\"City\"]\n\t\tAge := keyVal[\"Age\"]\n\n\t\t_, err = stmt.Exec(FirstName, LastName, City, Age)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\tfmt.Fprintf(w, \"New post was created\")\n\tdefer db.Close()\n\thttp.Redirect(w, r, \"/\", 301)\n}", "title": "" }, { "docid": "6bdd97ad7290652f5a6e7ef7106ace52", "score": "0.48724943", "text": "func (m Mongodb) InsertAppEntity(data interface{}) error {\n\treturn nil\n}", "title": "" }, { "docid": "068997f68a7f5facf954f164da592788", "score": "0.48614517", "text": "func AppCreate(fn controller.AppCreateFunc) Handler {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\tcurrentOrg = orgFromContext(ctx)\n\t\t\tp = payloadApp{}\n\t\t)\n\n\t\terr := json.NewDecoder(r.Body).Decode(&p)\n\t\tif err != nil {\n\t\t\trespondError(w, 0, wrapError(ErrBadRequest, err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tapp, err := fn(currentOrg, p.name, p.description)\n\t\tif err != nil {\n\t\t\trespondError(w, 0, err)\n\t\t\treturn\n\t\t}\n\n\t\trespondJSON(w, http.StatusCreated, &payloadApp{app: app})\n\t}\n}", "title": "" }, { "docid": "d49f45834a3afa14364d5326e051ae98", "score": "0.48506123", "text": "func AppCreate(db *gorm.DB, data *App) (err error) {\n\tdata.Ctime = time.Now().Unix()\n\tdata.Utime = time.Now().Unix()\n\n\tif err = db.Create(data).Error; err != nil {\n\t\tmus.Logger.Error(\"create app error\", zap.Error(err))\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "88fd90c70f39556d4dbc26789878a49b", "score": "0.48434013", "text": "func insertWebhook(w *webhookStruct, db *DBInfo) {\n\tsession, err := mgo.Dial(db.ConnectionString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer session.Close()\n\n\terr = session.DB(db.DBString).C(db.WebhookCollectionString).Insert(w)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n}", "title": "" }, { "docid": "d9d8e3d3ee7124cb25917c73c23dde8a", "score": "0.48426458", "text": "func (a *Application) PostAppHandler(c echo.Context) error {\n\tl := a.Logger.With(\n\t\tzap.String(\"source\", \"appHandler\"),\n\t\tzap.String(\"operation\", \"postApp\"),\n\t)\n\tapp := &model.App{\n\t\tID: uuid.NewV4(),\n\t\tCreatedAt: time.Now().UnixNano(),\n\t\tUpdatedAt: time.Now().UnixNano(),\n\t}\n\temail := c.Get(\"user-email\").(string)\n\tapp.CreatedBy = email\n\terr := WithSegment(\"decodeAndValidate\", c, func() error {\n\t\treturn decodeAndValidate(c, app)\n\t})\n\tif err != nil {\n\t\treturn c.JSON(http.StatusUnprocessableEntity, &Error{Reason: err.Error(), Value: app})\n\t}\n\terr = WithSegment(\"db-insert\", c, func() error {\n\t\treturn a.DB.Insert(&app)\n\t})\n\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"duplicate key\") {\n\t\t\treturn c.JSON(http.StatusConflict, &Error{Reason: err.Error(), Value: app})\n\t\t}\n\t\tlog.E(l, \"Failed to create app.\", func(cm log.CM) {\n\t\t\tcm.Write(zap.Error(err))\n\t\t})\n\t\treturn c.JSON(http.StatusInternalServerError, &Error{Reason: err.Error(), Value: app})\n\t}\n\tlog.D(l, \"Created app successfully.\", func(cm log.CM) {\n\t\tcm.Write(zap.Object(\"app\", app))\n\t})\n\treturn c.JSON(http.StatusCreated, app)\n}", "title": "" }, { "docid": "5d799583014ae1df69e8705c1231d87d", "score": "0.48255917", "text": "func CreateApplication(db *sqlx.DB, item *Application) error {\n\tif err := item.Validate(); err != nil {\n\t\treturn fmt.Errorf(\"validate application error: %s\", err)\n\t}\n\n\terr := db.Get(&item.ID, `\n\t\tinsert into application (\n\t\t\tname,\n\t\t\tdescription\n\t\t) values ($1, $2) returning id`,\n\t\titem.Name,\n\t\titem.Description,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create application error: %s\", err)\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"id\": item.ID,\n\t\t\"name\": item.Name,\n\t}).Info(\"application created\")\n\treturn nil\n}", "title": "" }, { "docid": "55a0a64367c65f7881d9b58e062d12e4", "score": "0.482528", "text": "func (env *Env) Create_applicant(w http.ResponseWriter, r *http.Request) {\n\tapp := new(models.Applicant)\n\n\terr := json.NewDecoder(r.Body).Decode(app)\n\tif err != nil {\n\t\trespond(w, \"Your format sucked\", &models.My_error{err.Error(), http.StatusBadRequest})\n\t\treturn\n\t}\n\n\tapp, err = models.Store_applicant(env.Db, app)\n\tif err != nil {\n\t\trespond(w,\n\t\t\t\"Unable to store applicant\",\n\t\t\t&models.My_error{err.Error(), http.StatusInternalServerError})\n\t} else {\n\t\trespond(w, app, nil)\n\t}\n}", "title": "" }, { "docid": "3675fedee57046ed027c43e9e875a1b1", "score": "0.47878063", "text": "func (as *AppStorage) CreateApp(app model.AppData) (model.AppData, error) {\n\t// generate new ID if it's not set\n\tif len(app.ID) == 0 {\n\t\tapp.ID = xid.New().String()\n\t}\n\n\tav, err := dynamodbattribute.MarshalMap(app)\n\tif err != nil {\n\t\tlog.Println(\"error marshalling app: \", err)\n\t\treturn model.AppData{}, ErrorInternalError\n\t}\n\n\tinput := &dynamodb.PutItemInput{\n\t\tItem: av,\n\t\tTableName: aws.String(appsTableName),\n\t}\n\n\tif _, err = as.db.C.PutItem(input); err != nil {\n\t\tlog.Println(\"error putting app to storage: \", err)\n\t\treturn model.AppData{}, ErrorInternalError\n\t}\n\treturn app, nil\n}", "title": "" }, { "docid": "744f5eca1c5e3f3216372f59bc62b49a", "score": "0.47822285", "text": "func (em *Employed) Insert(db dbaccess.DBExecer) error {\n\treturn dbaccess.Insert(db, em)\n}", "title": "" }, { "docid": "17e1d5dfaaf2e72320ce2e300754fd4e", "score": "0.47570327", "text": "func (a Application) Insert() (int, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "2853bff6c9c7710e6884c5d95ece0d07", "score": "0.4754704", "text": "func (r *StorelayoutclustersService) Insert(enterpriseId string, pageId string, storecluster *StoreCluster) *StorelayoutclustersInsertCall {\n\tc := &StorelayoutclustersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.pageId = pageId\n\tc.storecluster = storecluster\n\treturn c\n}", "title": "" }, { "docid": "ce989db8e0c9d9814929ff6c948bfb50", "score": "0.47448128", "text": "func (h *Handler) createDeveloperApp(c *gin.Context) handlerResponse {\n\n\tvar newDeveloperApp types.DeveloperApp\n\tif err := c.ShouldBindJSON(&newDeveloperApp); err != nil {\n\t\treturn handleBadRequest(err)\n\t}\n\tdeveloper, err := h.service.Developer.Get(c.Param(developerParameter))\n\tif err != nil {\n\t\treturn handleError(err)\n\t}\n\tif _, err := h.service.DeveloperApp.GetByName(newDeveloperApp.Name); err == nil {\n\t\treturn handleError(types.NewBadRequestError(\n\t\t\tfmt.Errorf(\"Developer app '%s' already exists\", newDeveloperApp.Name)))\n\t}\n\tstoredDeveloperApp, err := h.service.DeveloperApp.Create(developer.Email, newDeveloperApp, h.who(c))\n\tif err != nil {\n\t\treturn handleError(err)\n\t}\n\treturn handleCreated(storedDeveloperApp)\n}", "title": "" }, { "docid": "656a266666d834cb1963de74276f413b", "score": "0.47444135", "text": "func (v *AppClient) CreateApp(a App, ac AppContent, p string, cN string, cV string) (App, error) {\n\n\t//Construct the composite key to select the entry\n\tkey := AppKey{\n\t\tApp: a.Metadata.Name,\n\t\tProject: p,\n\t\tCompositeApp: cN,\n\t\tCompositeAppVersion: cV,\n\t}\n\n\t//Check if this App already exists\n\t_, err := v.GetApp(a.Metadata.Name, p, cN, cV)\n\tif err == nil {\n\t\treturn App{}, pkgerrors.New(\"App already exists\")\n\t}\n\n\t//Check if Project exists\n\t_, err = NewProjectClient().GetProject(p)\n\tif err != nil {\n\t\treturn App{}, pkgerrors.New(\"Unable to find the project\")\n\t}\n\n\t//check if CompositeApp with version exists\n\t_, err = NewCompositeAppClient().GetCompositeApp(cN, cV, p)\n\tif err != nil {\n\t\treturn App{}, pkgerrors.New(\"Unable to find the composite app with version\")\n\t}\n\n\terr = db.DBconn.Insert(v.storeName, key, nil, v.tagMeta, a)\n\tif err != nil {\n\t\treturn App{}, pkgerrors.Wrap(err, \"Creating DB Entry\")\n\t}\n\n\terr = db.DBconn.Insert(v.storeName, key, nil, v.tagContent, ac)\n\tif err != nil {\n\t\treturn App{}, pkgerrors.Wrap(err, \"Creating DB Entry\")\n\t}\n\n\treturn a, nil\n}", "title": "" }, { "docid": "c21e6f92521fb0e7e951ef5b47f0b570", "score": "0.47284794", "text": "func (ea *EntApp) Save(db XODB) error {\n\tif ea.Exists() {\n\t\treturn ea.Update(db)\n\t}\n\n\treturn ea.Insert(db)\n}", "title": "" }, { "docid": "1f898efd777fd6d44ec66e8d9e6b7e37", "score": "0.47255936", "text": "func (r *ProjectsWebAppsService) Create(parent string, webapp *WebApp) *ProjectsWebAppsCreateCall {\n\tc := &ProjectsWebAppsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.webapp = webapp\n\treturn c\n}", "title": "" }, { "docid": "3de69ca780bdabea42e5cf31d3675735", "score": "0.4711777", "text": "func (h *handler) CreateApplication(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"http://localhost:3000\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"PUT\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\n\tif r.Method == http.MethodOptions {\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(r.Body)\n\tvar application models.Application\n\terr := decoder.Decode(&application)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(fmt.Sprint(\"Error unmarshalling JSON: \", err)))\n\t\treturn\n\t}\n\n\tdate := time.Now().String()\n\tapplication.Date = string(date[0:10])\n\tapplication.State = \"pending approval\"\n\n\t// Use Volunteer struct to create a new volunteer\n\tinsertedApplication, err := h.Service.CreateApplication(application)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(fmt.Sprint(\"Error saving record to database: \", err)))\n\t\treturn\n\t}\n\n\t// Return a 201 if successful\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tjson.NewEncoder(w).Encode(insertedApplication)\n}", "title": "" }, { "docid": "169d31c7ad18c3c987f256558eb629c0", "score": "0.47025242", "text": "func CreateDev(w http.ResponseWriter, r *http.Request) {\n\tdev := models.Dev{}\n\terr := json.NewDecoder(r.Body).Decode(&dev)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tpanic(error(err))\n\t}\n\n\terr = models.InsertDev(dev)\n\tif err != nil {\n\t\tpanic(error(err))\n\t}\n\tw.WriteHeader(200)\n\terr = json.NewEncoder(w).Encode(dev)\n\tif err != nil {\n\t\tpanic(error(err))\n\t}\n}", "title": "" }, { "docid": "b6dc1908041ff514b2ca02493c41c776", "score": "0.46613368", "text": "func (s *ApplicationsService) Create(a *pulsar.Application) (*http.Response, error) {\n\treq, err := s.client.NewRequest(\"PUT\", \"pulsar/apps\", a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := s.client.Do(req, a)\n\treturn resp, err\n}", "title": "" }, { "docid": "e792796eb89460eb30913b0f2d32ed70", "score": "0.4650951", "text": "func NewWeaveDevicesInsert(ctx *middleware.Context, handler WeaveDevicesInsertHandler) *WeaveDevicesInsert {\n\treturn &WeaveDevicesInsert{Context: ctx, Handler: handler}\n}", "title": "" }, { "docid": "45015d60cd1db67ca4bbcb4b0aa02e11", "score": "0.46400812", "text": "func createApp(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {\n\tctx := r.Context()\n\tvar ia inputApp\n\terr = ParseInput(r, &ia)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta := app.App{\n\t\tTeamOwner: ia.TeamOwner,\n\t\tPlatform: ia.Platform,\n\t\tPlan: appTypes.Plan{Name: ia.Plan},\n\t\tName: ia.Name,\n\t\tDescription: ia.Description,\n\t\tPool: ia.Pool,\n\t\tRouterOpts: ia.RouterOpts,\n\t\tRouter: ia.Router,\n\t\tTags: ia.Tags,\n\t\tMetadata: ia.Metadata,\n\t\tQuota: quota.UnlimitedQuota,\n\t}\n\ttags, _ := InputValues(r, \"tag\")\n\ta.Tags = append(a.Tags, tags...) // for compatibility\n\tif a.TeamOwner == \"\" {\n\t\ta.TeamOwner, err = autoTeamOwner(ctx, t, permission.PermAppCreate)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tcanCreate := permission.Check(t, permission.PermAppCreate,\n\t\tpermission.Context(permTypes.CtxTeam, a.TeamOwner),\n\t)\n\tif !canCreate {\n\t\treturn permission.ErrUnauthorized\n\t}\n\tu, err := auth.ConvertNewUser(t.User())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif a.Platform != \"\" {\n\t\trepo, _ := image.SplitImageName(a.Platform)\n\t\tplatform, errPlat := servicemanager.Platform.FindByName(ctx, repo)\n\t\tif errPlat != nil {\n\t\t\treturn errPlat\n\t\t}\n\t\tif platform.Disabled {\n\t\t\tcanUsePlat := permission.Check(t, permission.PermPlatformUpdate) ||\n\t\t\t\tpermission.Check(t, permission.PermPlatformCreate)\n\t\t\tif !canUsePlat {\n\t\t\t\treturn &errors.HTTP{Code: http.StatusBadRequest, Message: appTypes.ErrInvalidPlatform.Error()}\n\t\t\t}\n\t\t}\n\t}\n\tevt, err := event.New(&event.Opts{\n\t\tTarget: appTarget(a.Name),\n\t\tKind: permission.PermAppCreate,\n\t\tOwner: t,\n\t\tRemoteAddr: r.RemoteAddr,\n\t\tCustomData: event.FormToCustomData(InputFields(r)),\n\t\tAllowed: event.Allowed(permission.PermAppReadEvents, contextsForApp(&a)...),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() { evt.Done(err) }()\n\terr = app.CreateApp(ctx, &a, u)\n\tif err != nil {\n\t\tlog.Errorf(\"Got error while creating app: %s\", err)\n\t\tif _, ok := err.(appTypes.NoTeamsError); ok {\n\t\t\treturn &errors.HTTP{\n\t\t\t\tCode: http.StatusBadRequest,\n\t\t\t\tMessage: \"In order to create an app, you should be member of at least one team\",\n\t\t\t}\n\t\t}\n\t\tif e, ok := err.(*appTypes.AppCreationError); ok {\n\t\t\tif e.Err == app.ErrAppAlreadyExists {\n\t\t\t\treturn &errors.HTTP{Code: http.StatusConflict, Message: e.Error()}\n\t\t\t}\n\t\t\tif _, ok := pkgErrors.Cause(e.Err).(*quota.QuotaExceededError); ok {\n\t\t\t\treturn &errors.HTTP{\n\t\t\t\t\tCode: http.StatusForbidden,\n\t\t\t\t\tMessage: \"Quota exceeded\",\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif err == appTypes.ErrInvalidPlatform {\n\t\t\treturn &errors.HTTP{Code: http.StatusBadRequest, Message: err.Error()}\n\t\t}\n\t\treturn err\n\t}\n\tmsg := map[string]interface{}{\n\t\t\"status\": \"success\",\n\t}\n\taddrs, err := a.GetAddresses()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(addrs) > 0 {\n\t\tmsg[\"ip\"] = addrs[0]\n\t}\n\tjsonMsg, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tw.Write(jsonMsg)\n\treturn nil\n}", "title": "" }, { "docid": "c79814723cfc36b72ad2fce749d5b5c6", "score": "0.4635947", "text": "func (api *API) AddApp(app *Application) (*Application, error) {\n\terr := api.dbR.\n\t\tInsertInto(\"application\").\n\t\tWhitelist(\"name\", \"description\", \"team_id\").\n\t\tRecord(app).\n\t\tReturning(\"*\").\n\t\tQueryStruct(app)\n\n\treturn app, err\n}", "title": "" }, { "docid": "1cd27935ae790bf43ecaca98a33443ef", "score": "0.46214986", "text": "func AddApplication(\n\trowID string,\n\tid string,\n\tmemberID string,\n\tfirstName string,\n\tlastName string,\n\tdob string,\n\tappData map[string]json.RawMessage,\n\temploymentData map[string]json.RawMessage,\n) error {\n\tappDataJSON, err := json.Marshal(appData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\temploymentDataJSON, err := json.Marshal(employmentData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tqueryStr := `insert into applications (row_id, id, member_id, first_name, last_name, dob, app_data, employment_data)` +\n\t\t` values (?, ?, ?, ?, ?, ?, ?, ?)` +\n\t\t` on duplicate key update id = ?, member_id = ?, first_name = ?, last_name = ?, dob = ?, app_data = ?, employment_data = ?`\n\t_, err = zestDB.Exec(queryStr, rowID, id, memberID, firstName, lastName, dob, appDataJSON, employmentDataJSON,\n\t\tid, memberID, firstName, lastName, dob, appDataJSON, employmentDataJSON)\n\n\treturn err\n}", "title": "" }, { "docid": "605725ae18e5222bc4868d9ae7dceacd", "score": "0.46104234", "text": "func Insert(ctx context.Context, beans ...any) error {\n\t_, err := GetEngine(ctx).Insert(beans...)\n\treturn err\n}", "title": "" }, { "docid": "3f2445820247d47dc2ef4e605fc7f8d3", "score": "0.46005538", "text": "func (app *App) createNewArticle(w http.ResponseWriter, r *http.Request) {\r\n\r\n\tvar (\r\n\t\tquery string\r\n\t\tarticle Article\r\n\t)\r\n\r\n\tapp.logger.Println(\"Endpoint hit : createNewArticle\")\r\n\t// get the payload from request\r\n\terr := json.NewDecoder(r.Body).Decode(&article)\r\n\tif err != nil {\r\n\t\tapp.logger.Println(err)\r\n\t}\r\n\r\n\tif app.DBType == \"mysql\" {\r\n\t\tquery = \"INSERT INTO articles (title, descr, content) VALUES (?,?,?)\"\r\n\t} else if app.DBType == \"postgres\" {\r\n\t\tquery = \"INSERT INTO articles (title, descr, content) VALUES ($1,$2,$3)\"\r\n\t}\r\n\r\n\t// insert data into DB\r\n\tresponse, err := app.Database.Exec(query, article.Title, article.Desc, article.Content)\r\n\t// if there is an error inserting, handle it\r\n\tif err != nil {\r\n\t\tapp.logger.Println(err.Error())\r\n\t\treturn\r\n\t}\r\n\tapp.logger.Print(response.RowsAffected())\r\n\tapp.logger.Println(\"inserted new record to DB\")\r\n\r\n\t// return the added article\r\n\tjson.NewEncoder(w).Encode(article)\r\n}", "title": "" }, { "docid": "75d462afd601fce4abc39ec15dac56c1", "score": "0.4599948", "text": "func CreatePage(c *gin.Context) {\n\tpayload := dtos.PageCreation{}\n\n\t// Binding\n\tif err := c.ShouldBindJSON(&payload); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, constants.HTTPErrorResponse(err, \"Validation/structure error\", \"\"))\n\t\treturn\n\t}\n\n\t// Validation\n\tif err := validate.Struct(payload); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, constants.HTTPErrorResponse(err, \"Validation/structure error\", \"\"))\n\t\treturn\n\t}\n\n\turlID := c.Param(\"app-url-id\")\n\tfmt.Println(\"App URL id:\", urlID)\n\n\tresult, svcErr := services.CreatePage(payload)\n\n\tif svcErr != nil {\n\t\tc.AbortWithStatusJSON(svcErr.HTTPStatus, svcErr.HTTPErrorResponse)\n\t\treturn\n\t}\n\n\tc.JSON(result.HTTPStatus, result.HTTPResponse)\n}", "title": "" }, { "docid": "5b8e0881bd2e7e5362d9cae90cb815a9", "score": "0.45992723", "text": "func (m *FrameworksDAO) Insert(framework models.Framework) error {\n\t_, err := collection.InsertOne(nil, &framework)\n\treturn err\n}", "title": "" }, { "docid": "a06d8599a15738fce024804f6439d9e9", "score": "0.45949787", "text": "func (c *ApplicationService) Create(ctx context.Context, data url.Values) (*Application, error) {\n\tapplication := new(Application)\n\terr := c.client.CreateResource(ctx, applicationPathPart, data, application)\n\treturn application, err\n}", "title": "" }, { "docid": "5b930d70b0625b1316970060c8aad9f1", "score": "0.45773834", "text": "func (c *FakeFirebaseWebApps) Create(ctx context.Context, firebaseWebApp *v1alpha1.FirebaseWebApp, opts v1.CreateOptions) (result *v1alpha1.FirebaseWebApp, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(firebasewebappsResource, c.ns, firebaseWebApp), &v1alpha1.FirebaseWebApp{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.FirebaseWebApp), err\n}", "title": "" }, { "docid": "0efbd36bfa87788a571acd7b0bf44d8c", "score": "0.45773628", "text": "func (s service) CreateApp(ctx context.Context, req *auth.CreateAppRequest) (*auth.App, error) {\n\tif err := ValidateAppCreateRequest(req); err != nil {\n\t\treturn nil, err\n\t}\n\tid, err := s.repo.CreateApp(ctx, entity.App{\n\t\tName: req.Name,\n\t\tEnable: req.Enable,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.GetApp(ctx, id)\n}", "title": "" }, { "docid": "971360fa1b72ce25bf43147ef5514bd0", "score": "0.4564391", "text": "func (Executor) AddApp(appId string, description []byte) error {\n\tlogger.Logging(logger.DEBUG, \"IN\")\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\tif len(appId) == 0 {\n\t\terr := errors.InvalidParam{\"Invalid param error : app_id is empty.\"}\n\t\treturn err\n\t}\n\n\tsession, err := connect(DB_URL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer close(session)\n\n\t// Get application information specified by appId parameter.\n\tapp := App{}\n\tquery := bson.M{\"_id\": appId}\n\terr = getCollection(session, DB_NAME, APP_COLLECTION).Find(query).One(&app)\n\tif err != nil {\n\t\terr = ConvertMongoError(err)\n\t\tswitch err.(type) {\n\t\tdefault:\n\t\t\treturn err\n\t\tcase errors.NotFound:\n\t\t\timages, services, err := getImageAndServiceNames(description)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Add a newly deployed application information.\n\t\t\tapp := App{\n\t\t\t\tID: appId,\n\t\t\t\tImages: images,\n\t\t\t\tServices: services,\n\t\t\t\tRefCnt: 1,\n\t\t\t}\n\n\t\t\terr = getCollection(session, DB_NAME, APP_COLLECTION).Insert(app)\n\t\t\tif err != nil {\n\t\t\t\treturn ConvertMongoError(err, \"\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Increase the reference count.\n\tquery = bson.M{\"_id\": appId}\n\tupdate := bson.M{\"$set\": bson.M{\"refcnt\": app.RefCnt + 1}}\n\terr = getCollection(session, DB_NAME, APP_COLLECTION).Update(query, update)\n\tif err != nil {\n\t\treturn ConvertMongoError(err, \"Failed to increase reference count\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e1a0deb963eb50b0e19fb44ba181c3df", "score": "0.4563553", "text": "func (as *ApplicationStateChangeStore) Create(a *model.ApplicationStateChange) (err error) {\n\treturn as.db.Save(a).Error\n}", "title": "" }, { "docid": "132a00f3736d9e26bc2b690651ac8860", "score": "0.4559886", "text": "func CreateExerciseCategory(data model.ExerciseCategory) error {\n\n\toutput := storage.DB.Create(&data)\n\n\treturn output.Error\n}", "title": "" }, { "docid": "fcecd0d968110dc4452c3b58a80ab839", "score": "0.45595318", "text": "func Insert(w http.ResponseWriter, r *http.Request) {\n\n\t// Open database connection\n\tdb := dbConn()\n\n\t// Check the request form METHOD\n\tif r.Method == \"POST\" {\n\n\t\t// Get the values from Form\n\t\tname := r.FormValue(\"name\")\n\t\temail := r.FormValue(\"email\")\n\n\t\t// Prepare a SQL INSERT and check for errors\n\t\tinsForm, err := db.Prepare(\"INSERT INTO names(name, email) VALUES(?,?)\")\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\n\t\t// Execute the prepared SQL, getting the form fields\n\t\tinsForm.Exec(name, email)\n\n\t\t// Show on console the action\n\t\tlog.Println(\"INSERT: Name: \" + name + \" | E-mail: \" + email)\n\t}\n\n\t// Close database connection\n\tdefer db.Close()\n\n\t// Redirect to HOME\n\thttp.Redirect(w, r, \"/\", 301)\n}", "title": "" }, { "docid": "917433efd28e83dca1605441cb5154f8", "score": "0.45570603", "text": "func (h *Handler) InsertProduct(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"/insert handler called\")\n\n\tp := &product{}\n\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\terr = json.Unmarshal(data, p)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\ttxn := h.db.Txn(true)\n\tdefer txn.Abort()\n\n\tif err := txn.Insert(\"product\", p); err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\ttxn.Commit()\n\n\tw.WriteHeader(http.StatusNoContent)\n\th.natsClient.Publish(\"product.inserted\", data)\n}", "title": "" }, { "docid": "dee5785f47893e9a07e9f62ade015354", "score": "0.45535487", "text": "func InsertDB(c appengine.Context, key *datastore.Key, a Account) (success string, err error) {\n\tsuccess = \"DB: Processed Sucessfully\"\n\n\t// Validateion before insert\n\t// more comprehensive setup is needed after finalizing this functionality\n\terr = checkStatus(a.AccStatus)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = datastore.Put(c, key, &a)\n\treturn\n}", "title": "" }, { "docid": "82eaf83d821b2d609d7c911603f12eec", "score": "0.45528883", "text": "func (p *Entry) Create(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\tctx, span := trace.StartSpan(ctx, \"handlers.Entry.Create\")\n\tdefer span.End()\n\n\t// claims, ok := ctx.Value(auth.Key).(auth.Claims)\n\t// if !ok {\n\t// \treturn web.NewShutdownError(\"claims missing from context\")\n\t// }\n\n\tv, ok := ctx.Value(web.KeyValues).(*web.Values)\n\tif !ok {\n\t\treturn web.NewShutdownError(\"web value missing from context\")\n\t}\n\n\tvar n entry.NewEntry\n\tif err := web.Decode(r, &n); err != nil {\n\t\treturn errors.Wrap(err, \"decoding new entry\")\n\t}\n\n\to, err := entry.Create(ctx, p.db, n, v.Now)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"creating new entry: %+v\", n)\n\t}\n\n\treturn web.Respond(ctx, w, o, http.StatusCreated)\n}", "title": "" }, { "docid": "d5a8ad775338deae3ac47a7a9f9db74f", "score": "0.45484766", "text": "func (s *AppsService) Create(input *AppCreateInput) (*App, *Response, error) {\n\tu := \"apps\"\n\treq, err := s.client.NewRequest(\"POST\", u, input)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar app = &App{}\n\tresp, err := s.client.Do(req, app)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn app, resp, err\n}", "title": "" }, { "docid": "bc965729ea8fd2c9c17eb0603e128e48", "score": "0.45478654", "text": "func (a *Admin) Insert() (code int, err error) {\n\to := orm.NewOrm()\n\to.Using(\"admin\")\n\tid, err := o.Insert(a)\n\tfmt.Printf(\"ID: %d, ERR: %v\\n\", id, err)\n\n\tif err != nil {\n\t\tif mgo.IsDup(err) {\n\t\t\tcode = ErrDupRows\n\t\t} else {\n\t\t\tcode = ErrDatabase\n\t\t}\n\t} else {\n\t\tcode = 0\n\t}\n\treturn\n}", "title": "" }, { "docid": "3bed16dcf2387a72540f9134c7861dfe", "score": "0.45463517", "text": "func (a *App) CreateVenue(w http.ResponseWriter, r *http.Request) {\n\tvar resp = map[string]interface{}{\"status\": \"success\", \"message\": \"Venue successfully created\"}\n\n\tuser := r.Context().Value(\"userID\").(float64)\n\tvenue := &models.Venue{}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(body, &venue)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tvenue.Prepare()\n\n\tif err = venue.Validate(); err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif vne, _ := venue.GetVenue(a.DB); vne != nil {\n\t\tresp[\"status\"] = \"failed\"\n\t\tresp[\"message\"] = \"Venue already registered, please choose another name\"\n\t\tresponses.JSON(w, http.StatusBadRequest, resp)\n\t\treturn\n\t}\n\n\tvenue.UserID = uint(user)\n\n\tvenueCreated, err := venue.Save(a.DB)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tresp[\"venue\"] = venueCreated\n\tresponses.JSON(w, http.StatusCreated, resp)\n\treturn\n}", "title": "" }, { "docid": "cbc401102b47dd04ddc178801872dff7", "score": "0.45362535", "text": "func (oc *OfferController) InsertOffer(offer models.Offer, telephone bool, email bool) (string, error) {\n\tu, err := oc.userDAL.GetUserInfo(offer.Userid)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\tif telephone {\n\t\toffer.Telephone = u.Telephone\n\t} else {\n\t\toffer.Telephone = \"\"\n\t}\n\tif email {\n\t\toffer.Email = u.Email\n\t} else {\n\t\toffer.Email = \"\"\n\t}\n\n\tid, err := oc.offerDAL.InsertOfferInDB(&offer)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\terr = oc.offerDAL.InsertOfferInES(offer)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "3acee4eacc3a9c027ccf9256cc48e5e7", "score": "0.4535069", "text": "func (a *ApplicationAPI) Create(ctx context.Context, req *pb.CreateApplicationRequest) (*pb.CreateApplicationResponse, error) {\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateApplicationsAccess(auth.Create, req.OrganizationID),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tapp := storage.Application{\n\t\tName: req.Name,\n\t\tDescription: req.Description,\n\t\tOrganizationID: req.OrganizationID,\n\t\tServiceProfileID: req.ServiceProfileID,\n\t\tPayloadCodec: codec.Type(req.PayloadCodec),\n\t\tPayloadEncoderScript: req.PayloadEncoderScript,\n\t\tPayloadDecoderScript: req.PayloadDecoderScript,\n\t}\n\n\tif err := storage.CreateApplication(config.C.PostgreSQL.DB, &app); err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\treturn &pb.CreateApplicationResponse{\n\t\tId: app.ID,\n\t}, nil\n}", "title": "" }, { "docid": "35316fbfb32bbef07d73c7bde39241bd", "score": "0.45317122", "text": "func insertEntityEventAPI(ctx *web.Context)(output interface{}, code int) {\n apiKey := ctx.Params[\"key\"]\n ent, err := entity.GetEntityByKey(apiKey, data.DB)\n if err != nil || ent.ID == 0{\n logging.Error(\"entity\", err.Error())\n return err, 400\n }\n\n id := atoiOrDefault(ctx.Params[\"id\"], 0)\n typ := ctx.Params[\"type\"]\n d := ctx.Params[\"data\"]\n iData := atoiOrDefault(ctx.Params[\"int\"], 0)\n\n _, err = entity.NewEntityEvent(id, typ, d, iData, data.DB)\n if err == nil {\n entity.PublishEventQueueUpdate(uint(id), true)\n }\n return err, 200\n}", "title": "" }, { "docid": "971918749cd1dcd032c9b91c1754d131", "score": "0.4531137", "text": "func (c *CloudflowApplicationClient) Create(app CloudflowApplication) (*CloudflowApplication, error) {\n\tresult := CloudflowApplication{}\n\terr := c.restClient.\n\t\tPost().\n\t\tNamespace(c.ns).\n\t\tResource(\"cloudflowapplications\").\n\t\tBody(&app).\n\t\tDo().\n\t\tInto(&result)\n\n\treturn &result, err\n}", "title": "" }, { "docid": "481a5c6605131fb5694cbe62219dae4b", "score": "0.45176354", "text": "func (p *Products) Create(rw http.ResponseWriter, req *http.Request) {\n\n\tproduct := req.Context().Value(KeyProduct{}).(data.Product)\n\n\tp.l.Debug(\"Inserting product: %#v\\n\", product)\n\n\tp.productDB.AddProduct(&product)\n}", "title": "" }, { "docid": "3f38acee052092d5e608fce416ace26d", "score": "0.45143056", "text": "func (s *Service) AddApp(c context.Context, appname string) (err error) {\n\t// Generate the secret and key\n\ttimestamp := strconv.Itoa((int)(time.Now().Unix()) + rand.Intn(1))\n\thashsec := md5.New()\n\thashsec.Write([]byte(timestamp))\n\tappsecret := hex.EncodeToString(hashsec.Sum(nil))\n\thashkey := md5.New()\n\ttimestamp += \"biliappkey\"\n\thashkey.Write([]byte(timestamp))\n\tappkey := hex.EncodeToString(hashkey.Sum(nil))\n\tg := &model.App{\n\t\tAppName: appname,\n\t\tAppKey: appkey,\n\t\tAppSecret: appsecret,\n\t\tEnabled: 1,\n\t}\n\tif err = s.dao.AddApp(c, g); err != nil {\n\t\tlog.Error(\"s.dao.AddApp(%+v) error(%v)\", g, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6431a6261df908cb3ca292cab2812425", "score": "0.4505149", "text": "func InsertDiscountProduction(c *gin.Context) {\n\trequestBody, _ := ioutil.ReadAll(c.Request.Body)\n\tvar requestObj Discount\n\tjson.Unmarshal(requestBody, &requestObj)\n\n\trequestPoint := &requestObj\n\n\tappEngine := appengine.NewContext(c.Request)\n\tkey := datastore.NewIncompleteKey(appEngine, DiscountKey, ProductionPromotionsKey(appEngine, DiscountKey))\n\n\tif _, err := datastore.Put(appEngine, key, requestPoint); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"status_code\": http.StatusBadRequest,\n\t\t\t\"status_message\": err.Error(),\n\t\t})\n\t} else {\n\t\tc.JSON(http.StatusCreated, gin.H{\n\t\t\t\"status_code\": http.StatusCreated,\n\t\t\t\"status_message\": \"Discount created.\",\n\t\t})\n\t}\n\n}", "title": "" }, { "docid": "17763af2f11730be292269b3e70a9719", "score": "0.4504854", "text": "func (h *handler) CreateApplicant(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"http://localhost:3000\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\n\tif r.Method == http.MethodOptions {\n\t\treturn\n\t}\n\tdecoder := json.NewDecoder(r.Body)\n\tvar applicant models.Applicant\n\terr := decoder.Decode(&applicant)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(fmt.Sprint(\"Error unmarshalling JSON: \", err)))\n\t\treturn\n\t}\n\n\t// Use Volunteer struct to create a new volunteer\n\tinsertedApplicant, err := h.Service.CreateApplicant(applicant)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(fmt.Sprint(\"Error saving record to database: \", err)))\n\t\treturn\n\t}\n\n\t// Return a 201 if successful\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tjson.NewEncoder(w).Encode(insertedApplicant)\n}", "title": "" }, { "docid": "378061eda1f202ce2eacbb88a6c6cee4", "score": "0.44998285", "text": "func (h Handlers) Create(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\tv, err := web.GetValues(ctx)\n\tif err != nil {\n\t\treturn web.NewShutdownError(\"web value missing from context\")\n\t}\n\n\tclaims, err := auth.GetClaims(ctx)\n\tif err != nil {\n\t\treturn errors.New(\"claims missing from context\")\n\t}\n\n\tvar np product.NewProduct\n\tif err := web.Decode(r, &np); err != nil {\n\t\treturn fmt.Errorf(\"unable to decode payload: %w\", err)\n\t}\n\n\tprod, err := h.Product.Create(ctx, claims, np, v.Now)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating new product, np[%+v]: %w\", np, err)\n\t}\n\n\treturn web.Respond(ctx, w, prod, http.StatusCreated)\n}", "title": "" }, { "docid": "6b580a9b930d010b25b33d342e2545ea", "score": "0.44911665", "text": "func (appManager * AppManager) addApp(response http.ResponseWriter, request *http.Request) {\n\tvar newAppReq NewAppRequest\n\n\tif validateRequestHeaderCookieParam(request) == false {\n\t\trespondWithError(response, http.StatusUnauthorized, ERROR_MESSAGE_UNAUTHORIZED_PERMISSION_REQUIRE)\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(request.Body)\n\tif err := decoder.Decode(&newAppReq); err != nil {\n\t\trespondWithError(response, http.StatusBadRequest, ERROR_MESSAGE_INVALID_REQUEST_PARAMS)\n\t\treturn\n\t}\n\tdefer request.Body.Close()\n\n\tif len(newAppReq.AppName) <= EMPTY_LENGTH && len(newAppReq.AppKey) <= EMPTY_LENGTH {\n\t\trespondWithError(response, http.StatusBadRequest, ERROR_MESSAGE_APP_KEY_AND_NAME_REQUIRED)\n\t\treturn\n\t}\n\n\tif len(newAppReq.AppKey) <= EMPTY_LENGTH {\n\t\trespondWithError(response, http.StatusBadRequest, ERROR_MESSAGE_APP_KEY_REQUIRED)\n\t\treturn\n\t}\n\n\tif len(newAppReq.AppName) <= EMPTY_LENGTH {\n\t\trespondWithError(response, http.StatusBadRequest, ERROR_MESSAGE_APP_NAME_REQUIRED)\n\t\treturn\n\t}\n\n\tif len(newAppReq.AppName) > APPLICATION_TABLE_DB_PROPERTY_NAME_LIMIT {\n\t\trespondWithError(response, http.StatusBadRequest, fmt.Sprintf(ERROR_MESSAGE_APP_NAME_VALIDATION, APPLICATION_TABLE_DB_PROPERTY_NAME_LIMIT))\n\t\treturn\n\t}\n\n\tapp_key_splited := strings.Split(newAppReq.AppKey, SEPARATOR_CHAR);\n\tif (len(newAppReq.AppKey) != VALID_UUID_CHAR_LIMIT || len(app_key_splited) != VALID_UUID_SEPARATOR_CHAR) {\n\t\trespondWithError(response, http.StatusBadRequest, ERROR_MESSAGE_APP_KEY_VALIDATION)\n\t\treturn\n\t}\n\n\t// Encrypt with sha1 the app_key parameter before insert it into db\n\tencrypt := sha1.New()\n\tencrypt.Write([]byte(newAppReq.AppKey))\n\tencrypted := encrypt.Sum(nil)\n\n\t// Generate uuid for id + uuid\n\tuuid_str_app_id := uuid.New()\n\tuuid_str_app_uuid := uuid.New()\n\tappManager.connectToDb();\n\n\tnewApp := NewAppParams{\n\t\tAppUuid: uuid_str_app_uuid.String(),\n\t\tAppKey: fmt.Sprintf(\"%x\", encrypted),\n\t\tAppName: newAppReq.AppName,\n\t\tAppId: uuid_str_app_id.String()}\n\n\tappManager.addApplication(newApp);\n\n\trespondGeneral(response, http.StatusOK, SUCCESS_MESSAGE_ADD_NEW_APP);\n}", "title": "" }, { "docid": "d389ae7cffd7ae9565e3906e03010142", "score": "0.44857433", "text": "func (d *Model) CreateDBEntry(c *gin.Context) (err error){\n\terr = c.BindJSON(&d)\n\tif err != nil {\n\t\tthrow.ErrorBadRequest(c)\n\t}\n\terr = db.DBConnection.Create(d).Error\n\treturn\n}", "title": "" }, { "docid": "49951c73fec8196cbdfe9b64a8718fcd", "score": "0.44744295", "text": "func CaseInsert(w http.ResponseWriter, r *http.Request) {\n\tcases := &Case{}\n\tprettyPrint := getPrettyPrintValue(r)\n\tcollection := db.C(cases.Collection())\n\n\tjson.NewDecoder(r.Body).Decode(&cases)\n\n\terr := collection.Insert(&cases)\n\tif err == mgo.ErrNotFound {\n\t\thandleError(w, 405)\n\t\treturn\n\t}\n\n\tJSON(w, cases, prettyPrint, 200)\n\n}", "title": "" }, { "docid": "148e2abcce65f80a96cc17511f7cbde2", "score": "0.44682014", "text": "func (p *PerformanceProfileDAO) Insert(performanceProfile types.PerformanceProfile) error {\n\terr := p.db.C(p.Collection).Insert(&performanceProfile)\n\treturn err\n}", "title": "" }, { "docid": "2554c844a910769c3ea770018c42e3af", "score": "0.44627458", "text": "func (r *EnterprisesService) CreateWebToken(enterpriseId string, administratorwebtokenspec *AdministratorWebTokenSpec) *EnterprisesCreateWebTokenCall {\n\tc := &EnterprisesCreateWebTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.administratorwebtokenspec = administratorwebtokenspec\n\treturn c\n}", "title": "" }, { "docid": "818906257e92d0f526c05176a962e8ae", "score": "0.44439006", "text": "func (e *Employee) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif e._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key must be provided\n\tconst sqlstr = `INSERT INTO public.employee (` +\n\t\t`emp_id, emp_number` +\n\t\t`) VALUES (` +\n\t\t`$1, $2` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, e.EmpID, e.EmpNumber)\n\terr = db.QueryRow(sqlstr, e.EmpID, e.EmpNumber).Scan(&e.EmpID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\te._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "e9123c7ca47a14cdf9a3d215dd8a108e", "score": "0.44216362", "text": "func (d TinkDB) InsertIntoDB(ctx context.Context, data string) error {\n\ttx, err := d.instance.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"BEGIN transaction\")\n\t}\n\n\t_, err = tx.Exec(`\n\tINSERT INTO\n\t\thardware (inserted_at, id, data)\n\tVALUES\n\t\t($1, ($2::jsonb ->> 'id')::uuid, $2)\n\tON CONFLICT (id)\n\tDO\n\tUPDATE SET\n\t\t(inserted_at, deleted_at, data) = ($1, NULL, $2);\n\t`, time.Now(), data)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"INSERT\")\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"COMMIT\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43c9121135a51af6985811372dc3ed54", "score": "0.44061518", "text": "func (s Service) InsertProduct(ctx context.Context, product Product) (Product, error) {\n product, err := s.Store.InsertProduct(product)\n if err != nil {\n return Product{}, err\n }\n return product, nil\n}", "title": "" }, { "docid": "23c8871494194223c56f8adabb89f981", "score": "0.4405614", "text": "func InsertIssuer(a StableIssuer) error {\n\tdb, err := OpenDB()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\t// check whether another issuer already exists. if so, quit\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(StableBucket)\n\t\tencoded, err := json.Marshal(a)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Failed to encode this data into json\")\n\t\t\treturn err\n\t\t}\n\t\treturn b.Put([]byte(utils.ItoB(a.Index)), encoded)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "35ea619ce297031ae4c56547fefd2cb6", "score": "0.43889758", "text": "func (c *SecurityPoliciesClient) Insert(ctx context.Context, req *computepb.InsertSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) {\n\treturn c.internalClient.Insert(ctx, req, opts...)\n}", "title": "" }, { "docid": "ecf6793cd929e04f53c1b70b6987ea4c", "score": "0.4388629", "text": "func (r *WebappsService) Delete(enterpriseId string, webAppId string) *WebappsDeleteCall {\n\tc := &WebappsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.webAppId = webAppId\n\treturn c\n}", "title": "" }, { "docid": "42be7d86e0c94281b66e5b842db4940d", "score": "0.4385556", "text": "func (cl *Client) CreateProduction(name, title, summary string) (*a.Production, error) {\n\tif err := cl.HasToken(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif name == \"\" {\n\t\treturn nil, fmt.Errorf(\"name must not be empty\")\n\t}\n\n\treq := a.Production{\n\t\tName: name,\n\t\tTitle: title,\n\t\tSummary: summary,\n\t}\n\n\tresp := a.Production{}\n\t_, err := cl.post(cl.Namespace+productionRoute, &req, &resp)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp, nil\n}", "title": "" }, { "docid": "2f7afe7702533db96567da7b9034d5fe", "score": "0.43850067", "text": "func (p *Products) Create(w http.ResponseWriter, r *http.Request) error {\n\tvar np product.NewProduct\n\n\tif err := web.Decode(r, &np); err != nil {\n\t\treturn web.NewRequestError(err, http.StatusBadRequest)\n\t}\n\n\tprod, err := product.Create(p.db, np, time.Now())\n\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Create Handler :\")\n\t}\n\treturn web.Respond(w, prod, http.StatusOK)\n}", "title": "" }, { "docid": "fe43ad282e089e597d0206ba41a7160a", "score": "0.43846062", "text": "func (p *Products) Create(rw http.ResponseWriter, r *http.Request) {\n\tprod := r.Context().Value(KeyProduct{}).(data.Product)\n\tdata.AddProduct(prod)\n\n\tp.l.Printf(\"[DEBUG] Inserted product: %#v\\n\", prod)\n}", "title": "" }, { "docid": "6a0fe58b1ad1792b80b98c0da0c80eaf", "score": "0.43814883", "text": "func (r *ServiceaccountkeysService) Insert(enterpriseId string, serviceaccountkey *ServiceAccountKey) *ServiceaccountkeysInsertCall {\n\tc := &ServiceaccountkeysInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.enterpriseId = enterpriseId\n\tc.serviceaccountkey = serviceaccountkey\n\treturn c\n}", "title": "" }, { "docid": "4ff03865fc957ace154d076f370d4186", "score": "0.4380399", "text": "func (c *Context) InsertUser(rw web.ResponseWriter, req *web.Request) {\n\tuser := models.ApplicationUser{}\n\tdecoder := json.NewDecoder(req.Body)\n\terr := decoder.Decode(&user)\n\tif err != nil {\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t} else {\n\t\tuser.ID = uuid.NewV4().String()\n\t\tdatabase.DB.Create(&user)\n\t\trw.Header().Set(\"Location\", fmt.Sprintf(\"http://%s:%d%s%s\", serverIP, serverPort, req.RequestURI, user.ID))\n\t\trw.WriteHeader(http.StatusCreated)\n\t}\n}", "title": "" }, { "docid": "d402e337f2a3433c64e19ce06958afbb", "score": "0.43799484", "text": "func insertDeployment(d *model.Deployment, session *mgo.Session, db string) error {\n\terr := session.DB(db).\n\t\tC(CollectionDeployments).\n\t\tEnsureIndexKey(StorageIndexes...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn session.DB(db).C(CollectionDeployments).Insert(d)\n}", "title": "" }, { "docid": "2b01af1f6b5df879dcb82253401804b3", "score": "0.43751067", "text": "func (codeEngine *CodeEngineV2) CreateApp(createAppOptions *CreateAppOptions) (result *App, response *core.DetailedResponse, err error) {\n\treturn codeEngine.CreateAppWithContext(context.Background(), createAppOptions)\n}", "title": "" }, { "docid": "3396fd4bd63019fc1eeb3761d23fa839", "score": "0.43676397", "text": "func CreateAppHandler(service Service, authBackend AuthorizationBackend) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer errors.HandleRequest(\"CreateAppHandler\", w, r)\n\t\t// Authentication Handling\n\t\t// OAuth2 Authentication\n\t\tctx, ok := authBackend.AuthorizeOAuth2(r, w, \"poi:apps:create\")\n\t\tif !ok {\n\t\t\t// No Error Handling needed, this is already done\n\t\t\treturn\n\t\t}\n\t\tr = r.WithContext(ctx)\n\n\t\t// Trace the service function handler execution\n\t\thandlerSpan, ctx := opentracing.StartSpanFromContext(r.Context(), \"CreateAppHandler\")\n\t\tdefer handlerSpan.Finish()\n\n\t\t// Setup context, response writer and request type\n\t\twriter := createAppResponseWriter{\n\t\t\tResponseWriter: metrics.NewMetric(\"poi\", \"/beta/apps\", w, r),\n\t\t}\n\t\trequest := CreateAppRequest{\n\t\t\tRequest: r.WithContext(ctx),\n\t\t}\n\n\t\t// Scan and validate incoming request parameters\n\t\tif !runtime.ValidateParameters(w, r, &request) {\n\t\t\treturn // invalid request stop further processing\n\t\t}\n\n\t\t// Unmarshal the service request body\n\t\tif runtime.Unmarshal(w, r, &request.Content) {\n\t\t\t// Invoke service that implements the business logic\n\t\t\terr := service.CreateApp(ctx, &writer, &request)\n\t\t\tif err != nil {\n\t\t\t\terrors.HandleError(err, \"CreateAppHandler\", w, r)\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "086174583a8ad02012431ef2ca5342ce", "score": "0.4367059", "text": "func (oww *OtxWeblinkWeblink) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif oww._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key provided by sequence\n\tconst sqlstr = `INSERT INTO public.otx_weblink_weblink (` +\n\t\t`url, content` +\n\t\t`) VALUES (` +\n\t\t`$1, $2` +\n\t\t`) RETURNING id`\n\n\t// run query\n\tXOLog(sqlstr, oww.URL, oww.Content)\n\terr = db.QueryRow(sqlstr, oww.URL, oww.Content).Scan(&oww.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\toww._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "fe188c0c0cce88340b38e2135ab4e234", "score": "0.43627182", "text": "func CreateAlert(c *gin.Context) {\n\tvar input models.CreateAlertInput\n\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\t// Create alert\n\talert := models.Alert{Email: input.Email, Coin: input.Coin, Currency: input.Currency, PriceMin: input.PriceMin, PriceMax: input.PriceMax}\n\tif err := models.CreateAlert(&alert); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": alert})\n}", "title": "" }, { "docid": "c09321ebc1944d31a1d7939e6cf2c993", "score": "0.43487257", "text": "func (wpm *WsubPostinstallMessage) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif wpm._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key provided by autoincrement\n\tconst sqlstr = `INSERT INTO jlabo.wsub_postinstall_messages (` +\n\t\t`extension_id, title_key, description_key, action_key, language_extension, language_client_id, type, action_file, action, condition_file, condition_method, version_introduced, enabled` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, wpm.ExtensionID, wpm.TitleKey, wpm.DescriptionKey, wpm.ActionKey, wpm.LanguageExtension, wpm.LanguageClientID, wpm.Type, wpm.ActionFile, wpm.Action, wpm.ConditionFile, wpm.ConditionMethod, wpm.VersionIntroduced, wpm.Enabled)\n\tres, err := db.Exec(sqlstr, wpm.ExtensionID, wpm.TitleKey, wpm.DescriptionKey, wpm.ActionKey, wpm.LanguageExtension, wpm.LanguageClientID, wpm.Type, wpm.ActionFile, wpm.Action, wpm.ConditionFile, wpm.ConditionMethod, wpm.VersionIntroduced, wpm.Enabled)\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\twpm.PostinstallMessageID = uint64(id)\n\twpm._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "62e41da20088a5819df015530b6fd9ff", "score": "0.43479505", "text": "func (a *Agency) Insert() (code int, err error) {\n mConn := mymongo.Conn()\n defer mConn.Close()\n\n c := mConn.DB(\"\").C(DBTableAgency)\n\n if count, err := c.FindId(a.ID).Count(); count == 0 || err != nil {\n err = c.Insert(a)\n if err != nil {\n if mgo.IsDup(err) {\n code = ErrDupRows\n } else {\n code = ErrDatabase\n }\n } else {\n code = 0\n }\n } else {\n return -1, nil\n }\n\n return\n}", "title": "" }, { "docid": "970cdacecf59a2b7a06d773b9337d868", "score": "0.43372294", "text": "func (h *handler) CreateExpense(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"http://localhost:3000\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\n\tif r.Method == http.MethodOptions {\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(r.Body)\n\tvar expense models.Expense\n\terr := decoder.Decode(&expense)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(fmt.Sprint(\"Error unmarshalling JSON: \", err)))\n\t\treturn\n\t}\n\n\t// Use Volunteer struct to create a new volunteer\n\tinsertedExpense, err := h.Service.CreateExpense(expense)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(fmt.Sprint(\"Error saving record to database: \", err)))\n\t\treturn\n\t}\n\n\t// Return a 201 if successful\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tjson.NewEncoder(w).Encode(insertedExpense)\n}", "title": "" }, { "docid": "fa6f9833230b10f3a084e03eb8b6e10b", "score": "0.43362826", "text": "func InsertDatabaseRowSite(sitename string, description string, url string) (bool, error) {\n\n\t// mutex lock\n\tvar mutex = &sync.Mutex{}\n\n\tvar cwd, _ = os.Getwd()\n\n\t// init database driver\n\tdatabase, err := sql.Open(\"sqlite3\", cwd+\"/database/\"+DB_NAME)\n\tif err != nil {\n\t\tLOGS.ErrorLogger.Fatalln(err)\n\t}\n\tdefer database.Close()\n\n\tif err != nil {\n\t\tLOGS.ErrorLogger.Fatalln(err)\n\t\treturn false, err\n\t}\n\n\t// add new site\n\tstatementInsertSite, _ := database.Prepare(\"INSERT INTO sites (id, name, description, url) VALUES (?, ?, ?, ?);\")\n\tmutex.Lock()\n\tstatementInsertSite.Exec(nil, sitename, description, url)\n\tmutex.Unlock()\n\n\tif err != nil {\n\t\treturn false, err\n\t} else {\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "729e577770adf295c17ba7c099943f8c", "score": "0.43240613", "text": "func (r *Repository) Insert(data *Courier) (err error) {\n\n\terr = r.db.Create(data).Error\n\n\treturn\n}", "title": "" }, { "docid": "7c7551360becc47ed08786c74feee03d", "score": "0.43218255", "text": "func Insert(db gorp.SqlExecutor, model *sdk.Model) error {\n\tdbmodel := WorkerModel(*model)\n\tdbmodel.NeedRegistration = true\n\tmodel.UserLastModified = time.Now()\n\tif model.ModelDocker.Password == sdk.PasswordPlaceholder {\n\t\treturn sdk.WithStack(sdk.ErrInvalidPassword)\n\t}\n\tif err := db.Insert(&dbmodel); err != nil {\n\t\treturn sdk.WithStack(err)\n\t}\n\t*model = sdk.Model(dbmodel)\n\tif model.ModelDocker.Password != \"\" {\n\t\tmodel.ModelDocker.Password = sdk.PasswordPlaceholder\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63e5b836a7643350975f5eda956525bc", "score": "0.43216595", "text": "func (r *PagesService) Insert(blogId string, page *Page) *PagesInsertCall {\n\tc := &PagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.blogId = blogId\n\tc.page = page\n\treturn c\n}", "title": "" }, { "docid": "cc460954e4804ee4ecd3812b4386b7b6", "score": "0.43150795", "text": "func (v WalletEntriesResource) Create(c buffalo.Context) error {\n\t// Allocate an empty WalletEntry\n\twalletEntry := &models.WalletEntry{}\n\n\t// Bind walletEntry to the html form elements\n\tif err := c.Bind(walletEntry); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(walletEntry)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Make the errors available inside the html template\n\t\tc.Set(\"errors\", verrs)\n\n\t\t// Render again the new.html template that the user can\n\t\t// correct the input.\n\t\treturn c.Render(422, r.Auto(c, walletEntry))\n\t}\n\n\t// If there are no errors set a success message\n\tc.Flash().Add(\"success\", \"WalletEntry was created successfully\")\n\n\t// and redirect to the wallet_entries index page\n\treturn c.Render(201, r.Auto(c, walletEntry))\n}", "title": "" }, { "docid": "4282eeecd645b92e8afac6f9864d77ee", "score": "0.43021056", "text": "func (s *ApplicationsServiceOp) Create(dir *ApplicationRequestCreate) (*Application, error) {\n\tendpoint := fmt.Sprintf(\"tenants/%s/applications\", s.client.tenantId)\n\n\tenc, err := json.Marshal(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := bytes.NewBuffer(enc)\n\n\tresp, err := s.client.request(\"POST\", endpoint, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusCreated {\n\t\treturn nil, ApiError{StatusCode: resp.StatusCode, Message: \"non-ok status returned\"}\n\t}\n\tobj := &ApplicationResponse{}\n\tdec := json.NewDecoder(resp.Body)\n\tdec.Decode(obj)\n\treturn s.get(obj)\n}", "title": "" }, { "docid": "32115ca1ae2f22916902ebfc7209fd7f", "score": "0.42922068", "text": "func insertCPEIntoDB(cpe *pb.CPEDataMsg, macMgmtTable gocassa.Table) error {\n\tdbcpe, err := json.Marshal(cpe)\n\tif dbcpe == nil {\n\t\treturn fmt.Errorf(logtagdb+\"INSERT CPE error: %v\", err)\n\t}\n\n\tentry := cpe\n\n\tquery, params := macMgmtTable.Set(entry).GenerateStatement()\n\tlogFields := log.Fields{\n\t\t\"CPE_MAC\" : cpe.MacAddr,\n\t\t\"CABLE_MODEM\" : cpe.CableModem,\n\t\t\"IPv4_ADDR\" : cpe.Ipv4Addr,\n\t\t\"DEVICE_CLASS\": cpe.DeviceClass,\n\t\t\"LEASE_TIME\" : cpe.LeaseTime}\n\n\n\tlog.WithFields(logFields).Info(logtagdb, \"Query -> \", query, \"Params = \", params)\n\n\tif err := macMgmtTable.Set(entry).Run(); err != nil {\n\t\tlog.WithFields(logFields).Error(logtagdb, err)\n\t\treturn fmt.Errorf(logtagdb+\"INSERT CPE error: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b69283e1d47e7493c2a036e428005214", "score": "0.42863575", "text": "func (a *Appointment) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif a._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key must be provided\n\tconst sqlstr = `INSERT INTO public.appointment (` +\n\t\t`id, state, patient, specialist_fee, scheduled_time, duration` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5, $6` +\n\t\t`) RETURNING id`\n\n\t// run query\n\tXOLog(sqlstr, a.ID, a.State, a.Patient, a.SpecialistFee, a.ScheduledTime, a.Duration)\n\terr = db.QueryRow(sqlstr, a.ID, a.State, a.Patient, a.SpecialistFee, a.ScheduledTime, a.Duration).Scan(&a.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\ta._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "7e41a82cef025a7d4d8dd25f12f65967", "score": "0.42754924", "text": "func (h *ProductHandler) Create(ctx iris.Context) {\n\tvar product entity.Product\n\tif err := ctx.ReadJSON(&product); err != nil {\n\t\treturn\n\t}\n\n\tid, err := h.service.Insert(ctx.Request().Context(), product)\n\tif err != nil {\n\t\tif err == sql.ErrUnprocessable {\n\t\t\tctx.StopWithJSON(iris.StatusUnprocessableEntity, newError(iris.StatusUnprocessableEntity, ctx.Request().Method, ctx.Path(), \"required fields are missing\"))\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"ProductHandler.Create(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\t// Send 201 with body of {\"id\":$last_inserted_id\"}.\n\tctx.StatusCode(iris.StatusCreated)\n\tctx.JSON(iris.Map{product.PrimaryKey(): id})\n}", "title": "" }, { "docid": "912c84dd6ff38ab76060fb4887f51f0b", "score": "0.42689234", "text": "func (db *Connection) InsertEvent(deviceID string, event Event, tombstoneMapKey string) error {\n\tif valid, err := isEventValid(deviceID, event); !valid {\n\t\treturn emperror.WrapWith(err, \"Insert event not attempted\", \"device id\", deviceID,\n\t\t\t\"event\", event)\n\t}\n\t// get event id using the device id\n\tcounterKey := strings.Join([]string{counterDoc, deviceID}, \":\")\n\teventID, err := db.idGenerator.getNextID(counterKey, 1, 0, 0)\n\tif err != nil {\n\t\treturn emperror.WrapWith(err, \"Failed to get event id\", \"device id\", deviceID)\n\t}\n\tevent.ID = strconv.FormatUint(eventID, 10)\n\n\t//if tombstonekey isn't empty string, then set the tombstone map at that key\n\tif tombstoneMapKey != \"\" {\n\t\terr = db.upsertToTombstone(deviceID, tombstoneMapKey, event)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// append to the history, create if it doesn't exist\n\terr = db.upsertToHistory(deviceID, event)\n\treturn err\n}", "title": "" }, { "docid": "1ad66463cbefbeae0ab19204813e73fb", "score": "0.42688963", "text": "func (p *Product) Create(w http.ResponseWriter, r *http.Request) error {\n\n\tvar np product.NewProduct\n\n\tif err := web.Decode(r, &np); err != nil {\n\t\treturn err\n\t}\n\n\tprod, err := product.Create(p.DB, np, time.Now())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn web.Respond(w, prod, http.StatusCreated)\n}", "title": "" }, { "docid": "292eb7e8f6e931060b331e15ebd6bf81", "score": "0.4268616", "text": "func (s EmailStore) InsertEmail(e models.Email) (int, error) {\n\ttx, err := s.db.Begin()\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tdefer tx.Commit()\n\n\tstmt, err := tx.Prepare(\"INSERT INTO emails(msgID, thdID, timeRecieved) values(?,?,?)\")\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tres, err := stmt.Exec(e.MsgID, e.ThdID, e.TimeReceived)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tlog.WithFields(log.Fields{\"Database ID\": id}).Info(\"Inserted to DB.\")\n\treturn int(id), nil\n}", "title": "" }, { "docid": "d9ffc974b61f46de0f3a2a0012da56bb", "score": "0.4264002", "text": "func (m *UsersDAO) insert(post Post) error {\r\n\terr := admin.C(collection).Insert(&post)\r\n\treturn err\r\n}", "title": "" } ]
c59d5eaedb9575f661747cecdd486610
NewReaderByteCodeLoader creates a new object
[ { "docid": "7ae3880a712ff442ef889b889ce064ec", "score": "0.6473692", "text": "func NewReaderByteCodeLoader(p parser.Parser, c compiler.Compiler) *ReaderByteCodeLoader {\n\treturn &ReaderByteCodeLoader{NewFlags(), p, c}\n}", "title": "" } ]
[ { "docid": "aef2c7f933cbd58ecaefe51c95bec10a", "score": "0.64644", "text": "func NewReader(b []byte) *Reader {}", "title": "" }, { "docid": "5e254345040cd3ec6715e4eb7c301f5f", "score": "0.6319144", "text": "func NewReader(data []byte) *Reader { return &Reader{data: data} }", "title": "" }, { "docid": "277c006d480c48e4e3a48cc460f869a3", "score": "0.6228754", "text": "func NewDecoder(r io.Reader) io.Reader {}", "title": "" }, { "docid": "5af66b5e61ffde7b4df47b4545758336", "score": "0.6210132", "text": "func NewDecoder(r io.Reader) *Decoder {}", "title": "" }, { "docid": "5af66b5e61ffde7b4df47b4545758336", "score": "0.6210132", "text": "func NewDecoder(r io.Reader) *Decoder {}", "title": "" }, { "docid": "91c6a822714edaf45fdb541382f18ab7", "score": "0.6116875", "text": "func (l *ReaderByteCodeLoader) LoadReader(name string, rdr io.Reader) (*vm.ByteCode, error) {\n\tast, err := l.Parser.ParseReader(name, rdr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif l.ShouldDumpAST() {\n\t\tfmt.Fprintf(os.Stderr, \"AST:\\n%s\\n\", ast)\n\t}\n\n\tbc, err := l.Compiler.Compile(ast)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bc, nil\n}", "title": "" }, { "docid": "e501a29142aa260b289bf83f1a3ffb7a", "score": "0.597387", "text": "func NewDecoder(enc *base32.Encoding, r io.Reader) io.Reader", "title": "" }, { "docid": "94c42edcac47c0c4002731c191f62056", "score": "0.5857739", "text": "func New(r reader.StreamReader) (*Decoder, error) {\n\td := &Decoder{\n\t\tr: r,\n\t\tContextSize: []int{16, 13, 10, 10},\n\t\tReferedToContextSize: []int{13, 10},\n\t}\n\n\t// initialize the decoder from the reader\n\tif err := d.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "c8518a96f66957b634d8e64175578331", "score": "0.58479834", "text": "func newReader(a archive) (*Reader, error) {\n\tr := &Reader{p: newPackage(), r: a}\n\tif err := r.loadPackage(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "2204271a6ba346912ed7686599af4756", "score": "0.5823708", "text": "func newBlockFromReader(r io.Reader) (*Block, error) {\n\t// Deserialize the bytes into a MsgBlock.\n\tvar msgBlock protos.MsgBlock\n\terr := msgBlock.Deserialize(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb := Block{\n\t\tmsgBlock: &msgBlock,\n\t}\n\treturn &b, nil\n}", "title": "" }, { "docid": "c4ec8dfdff25c584a0f8d98a82f2ab76", "score": "0.5698999", "text": "func (l *Loader) Preload(localSymVersion int, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64) goobj.FingerprintType {\n\troObject, readonly, err := f.Slice(uint64(length)) // TODO: no need to map blocks that are for tools only (e.g. RefName)\n\tif err != nil {\n\t\tlog.Fatal(\"cannot read object file:\", err)\n\t}\n\tr := goobj.NewReaderFromBytes(roObject, readonly)\n\tif r == nil {\n\t\tif len(roObject) >= 8 && bytes.Equal(roObject[:8], []byte(\"\\x00go114ld\")) {\n\t\t\tlog.Fatalf(\"found object file %s in old format\", f.File().Name())\n\t\t}\n\t\tpanic(\"cannot read object file\")\n\t}\n\tpkgprefix := objabi.PathToPrefix(lib.Pkg) + \".\"\n\tndef := r.NSym()\n\tnhashed64def := r.NHashed64def()\n\tnhasheddef := r.NHasheddef()\n\tor := &oReader{\n\t\tReader: r,\n\t\tunit: unit,\n\t\tversion: localSymVersion,\n\t\tflags: r.Flags(),\n\t\tpkgprefix: pkgprefix,\n\t\tsyms: make([]Sym, ndef+nhashed64def+nhasheddef+r.NNonpkgdef()+r.NNonpkgref()),\n\t\tndef: ndef,\n\t\tnhasheddef: nhasheddef,\n\t\tnhashed64def: nhashed64def,\n\t\tobjidx: uint32(len(l.objs)),\n\t}\n\n\t// Autolib\n\tlib.Autolib = append(lib.Autolib, r.Autolib()...)\n\n\t// DWARF file table\n\tnfile := r.NFile()\n\tunit.FileTable = make([]string, nfile)\n\tfor i := range unit.FileTable {\n\t\tunit.FileTable[i] = r.File(i)\n\t}\n\n\tl.addObj(lib.Pkg, or)\n\n\t// The caller expects us consuming all the data\n\tf.MustSeek(length, os.SEEK_CUR)\n\n\treturn r.Fingerprint()\n}", "title": "" }, { "docid": "0a0418404eb5a50122814aee93af4a2f", "score": "0.56965244", "text": "func newLoader(reqs chan map[aid]string, done chan map[aid]asset,\n\tbind chan msg, stop chan bool) *loader {\n\tl := &loader{bind: bind, assets: map[aid]string{}}\n\tl.loc = load.NewLocator()\n\tl.cache = newCache()\n\tl.stop = stop\n\tl.load = reqs\n\tl.loaded = done\n\treturn l\n}", "title": "" }, { "docid": "c4541bd1386ea2097d89487d79067e3a", "score": "0.5685535", "text": "func (r *Reader) init() error {\n\tif r.d != nil {\n\t\treturn nil\n\t}\n\n\tif r.Header.DictCap > r.h.DictCap {\n\t\tr.h.DictCap = r.Header.DictCap\n\t}\n\tr.Header = r.h\n\n\tbr := ByteReader(r.lzma)\n\tstate := newState(r.h.Properties)\n\n\tdict, err := newDecoderDict(r.h.DictCap)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.d, err = newDecoder(br, state, dict, r.h.Size)\n\treturn err\n}", "title": "" }, { "docid": "f6ba62854f0e4115e43446ace614275e", "score": "0.56538564", "text": "func NewReader(r io.Reader) io.Reader {\n\tbz2 := new(reader)\n\tbz2.br = newBitReader(r)\n\treturn bz2\n}", "title": "" }, { "docid": "87a3470ea8095154d75b033cc50e57b8", "score": "0.5616307", "text": "func New(src io.Reader, start StateFunc) *L {\n\treturn &L{\n\t\tsource: src,\n\t\tstartState: start,\n\t\tbuf: make([]rune, 0),\n\t\tp: make([]byte, 1),\n\t\tstart: 0,\n\t\tposition: 0,\n\t\treadbytes: 0,\n\t\trewind: newRuneStack(),\n\t}\n}", "title": "" }, { "docid": "9cca8b2112eb972fc3e71360a63a1626", "score": "0.55563545", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\td: wkbcommon.NewDecoder(r),\n\t}\n}", "title": "" }, { "docid": "4535fcf60022b07790d1b6ad1cb688cd", "score": "0.5545942", "text": "func Loader(config map[string]interface{}) (go2chef.Step, error) {\n\tsource, err := go2chef.GetSourceFromStepConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb := &Bundle{\n\t\tsource: source,\n\t\tlogger: go2chef.GetGlobalLogger(),\n\t\tConfigName: \"bundle.json\",\n\t\tTimeoutSeconds: 300,\n\t}\n\tif err := mapstructure.Decode(config, b); err != nil {\n\t\treturn nil, err\n\t}\n\tb.source.SetName(b.Name() + \"-source\")\n\n\treturn b, nil\n}", "title": "" }, { "docid": "b87fa00cd248830f499d886f8fe0f58d", "score": "0.5513193", "text": "func (st *State) LoadByteCode(key string) (*ByteCode, error) {\n\treturn st.Loader.Load(key)\n}", "title": "" }, { "docid": "7ef20446476f765a8510c28864efd94c", "score": "0.55066437", "text": "func newReader(source string, read func() ([]byte, error)) Reader {\n\treturn reader{\n\t\tsource: source,\n\t\treadFunc: read,\n\t}\n}", "title": "" }, { "docid": "62605f7558dd853f68d1d632c324bb46", "score": "0.55058324", "text": "func NewLoader(\n\tconfig TemplateConfig,\n\tclient ESClient,\n\tbeatInfo beat.Info,\n\tfields []byte,\n\tmigration bool,\n) (*Loader, error) {\n\treturn &Loader{\n\t\tconfig: config,\n\t\tclient: client,\n\t\tbeatInfo: beatInfo,\n\t\tfields: fields,\n\t\tmigration: migration,\n\t}, nil\n}", "title": "" }, { "docid": "22556b17530fa71393d64addf0426c5f", "score": "0.5502936", "text": "func newReader(r io.Reader) *reader {\n return &reader{\n r: r,\n buflen: defaultBufLen,\n }\n}", "title": "" }, { "docid": "ef9ff498ba118e88d15ae9b345b8f0cd", "score": "0.5502277", "text": "func NewReader(r ByteReadCloser) *Reader {\n\treturn &Reader{reader: bzip2.NewReader(r), underlying: r}\n}", "title": "" }, { "docid": "958bac911dd736d3af4c4ed99134f61c", "score": "0.55008006", "text": "func NewReader(r io.Reader) *Reader {\n\treturn &Reader{Reader: *tar.NewReader(r)}\n}", "title": "" }, { "docid": "021fe87b72cc7a2226a12f4c0e437224", "score": "0.54944444", "text": "func fromBytes(moddir string, data []byte) (m *Module, err error) {\n\tif !enabled {\n\t\tpanic(\"use of index\")\n\t}\n\n\tdefer unprotect(protect(), &err)\n\n\tif !bytes.HasPrefix(data, []byte(indexVersion+\"\\n\")) {\n\t\treturn nil, errCorrupt\n\t}\n\n\tconst hdr = len(indexVersion + \"\\n\")\n\td := &decoder{data: data}\n\tstr := d.intAt(hdr)\n\tif str < hdr+8 || len(d.data) < str {\n\t\treturn nil, errCorrupt\n\t}\n\td.data, d.str = data[:str], d.data[str:]\n\t// Check that string table looks valid.\n\t// First string is empty string (length 0),\n\t// and we leave a marker byte 0xFF at the end\n\t// just to make sure that the file is not truncated.\n\tif len(d.str) == 0 || d.str[0] != 0 || d.str[len(d.str)-1] != 0xFF {\n\t\treturn nil, errCorrupt\n\t}\n\n\tn := d.intAt(hdr + 4)\n\tif n < 0 || n > (len(d.data)-8)/8 {\n\t\treturn nil, errCorrupt\n\t}\n\n\tm = &Module{\n\t\tmoddir,\n\t\td,\n\t\tn,\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "fed2013ba6b3ec8029d2c0c5c41a1cc9", "score": "0.54836226", "text": "func NewReader(buf []byte, cmp comparer.BasicComparer) (r *Reader, err error) {\n\tif len(buf) < 8 {\n\t\terr = errors.ErrCorrupt(\"block to short\")\n\t\treturn\n\t}\n\n\t// Decode restart len\n\trestartLen := binary.LittleEndian.Uint32(buf[len(buf)-4:])\n\n\t// Calculate restart start offset\n\trestartStart := len(buf) - int(restartLen)*4 - 4\n\tif restartStart >= len(buf)-4 {\n\t\terr = errors.ErrCorrupt(\"bad restart offset in block\")\n\t\treturn\n\t}\n\n\tr = &Reader{\n\t\tcmp: cmp,\n\t\tbuf: buf,\n\t\trbuf: buf[restartStart : len(buf)-4],\n\t\trestartLen: int(restartLen),\n\t\trestartStart: restartStart,\n\t}\n\treturn\n}", "title": "" }, { "docid": "ccefef6d21ddf7eec39f3be570bbb8fa", "score": "0.5477964", "text": "func (c *Codec) NewReader(r io.Reader) io.ReadCloser {\n\tp := new(reader)\n\tif p.dec, _ = decoderPool.Get().(*zstd.Decoder); p.dec != nil {\n\t\tp.dec.Reset(r)\n\t} else {\n\t\tz, err := zstd.NewReader(r,\n\t\t\tzstd.WithDecoderConcurrency(1),\n\t\t)\n\t\tif err != nil {\n\t\t\tp.err = err\n\t\t} else {\n\t\t\tp.dec = z\n\t\t}\n\t}\n\treturn p\n}", "title": "" }, { "docid": "40f60b159be950e7c70fdbe1f5fad953", "score": "0.54753345", "text": "func NewReader(rd io.Reader) (r *Reader, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"dbf.NewReader: %w\", err)\n\t\t}\n\t}()\n\tif rd == nil {\n\t\treturn nil, fmt.Errorf(\"parameter is nil\")\n\t}\n\tr = &Reader{\n\t\theader: &header{},\n\t\tfields: NewFields(),\n\t\treader: bufio.NewReader(rd),\n\t}\n\tif err = r.header.read(r.reader); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = r.fields.read(r.reader, r.header.fieldCount()); err != nil {\n\t\treturn nil, err\n\t}\n\t// Skip byte header end\n\tif _, err = r.reader.Discard(1); err != nil {\n\t\treturn nil, err\n\t}\n\t// Create buffer\n\tr.buf = make([]byte, int(r.header.RecSize))\n\t// Code page\n\tif cp := r.header.codePage(); cp != 0 {\n\t\tcm := charmapByPage(cp)\n\t\tr.decoder = cm.NewDecoder()\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "3110e28cae6d34295bdc95aac8e6482d", "score": "0.54683644", "text": "func newUncompressedReader(r io.Reader, dict *decoderDict, size int64) *uncompressedReader {\n\tur := &uncompressedReader{\n\t\tlr: io.LimitedReader{R: r, N: size},\n\t\tDict: dict,\n\t}\n\treturn ur\n}", "title": "" }, { "docid": "a0e1d2b9e66f1c14e1ae9ee48a0d3fc5", "score": "0.54410756", "text": "func (l *Loader) Preload(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64, pn string, flags int) {\n\troObject, readonly, err := f.Slice(uint64(length))\n\tif err != nil {\n\t\tlog.Fatal(\"cannot read object file:\", err)\n\t}\n\tr := goobj2.NewReaderFromBytes(roObject, readonly)\n\tif r == nil {\n\t\tpanic(\"cannot read object file\")\n\t}\n\tlocalSymVersion := syms.IncVersion()\n\tpkgprefix := objabi.PathToPrefix(lib.Pkg) + \".\"\n\tor := &oReader{r, unit, localSymVersion, r.Flags(), pkgprefix, nil}\n\n\t// Autolib\n\tlib.ImportStrings = append(lib.ImportStrings, r.Autolib()...)\n\n\t// DWARF file table\n\tnfile := r.NDwarfFile()\n\tunit.DWARFFileTable = make([]string, nfile)\n\tfor i := range unit.DWARFFileTable {\n\t\tunit.DWARFFileTable[i] = r.DwarfFile(i)\n\t}\n\n\tistart := l.addObj(lib.Pkg, or)\n\n\tndef := r.NSym()\n\tnnonpkgdef := r.NNonpkgdef()\n\tfor i, n := 0, ndef+nnonpkgdef; i < n; i++ {\n\t\tosym := goobj2.Sym{}\n\t\tosym.Read(r, r.SymOff(i))\n\t\tname := strings.Replace(osym.Name, \"\\\"\\\".\", pkgprefix, -1)\n\t\tif name == \"\" {\n\t\t\tcontinue // don't add unnamed aux symbol\n\t\t}\n\t\tv := abiToVer(osym.ABI, localSymVersion)\n\t\tdupok := osym.Dupok()\n\t\tadded := l.AddSym(name, v, istart+Sym(i), or, dupok, sym.AbiSymKindToSymKind[objabi.SymKind(osym.Type)])\n\t\tif added && strings.HasPrefix(name, \"go.itablink.\") {\n\t\t\tl.itablink[istart+Sym(i)] = struct{}{}\n\t\t}\n\t\tif added && strings.HasPrefix(name, \"runtime.\") {\n\t\t\tif bi := goobj2.BuiltinIdx(name, v); bi != -1 {\n\t\t\t\t// This is a definition of a builtin symbol. Record where it is.\n\t\t\t\tl.builtinSyms[bi] = istart + Sym(i)\n\t\t\t}\n\t\t}\n\t}\n\n\t// The caller expects us consuming all the data\n\tf.MustSeek(length, os.SEEK_CUR)\n}", "title": "" }, { "docid": "ed449d8846f6c0a208e950a39ad48a81", "score": "0.5433036", "text": "func (c *Codec) NewReader(r io.Reader) io.ReadCloser {\r\n\tx, _ := readerPool.Get().(*xerialReader)\r\n\tif x != nil {\r\n\t\tx.Reset(r)\r\n\t} else {\r\n\t\tx = &xerialReader{\r\n\t\t\treader: r,\r\n\t\t\tdecode: snappy.Decode,\r\n\t\t}\r\n\t}\r\n\treturn &reader{xerialReader: x}\r\n}", "title": "" }, { "docid": "bc777249fd4b2c735088efa64764fb75", "score": "0.5428501", "text": "func (IndexWrapper *IndexWrapper) LoadFromBytes(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn fmt.Errorf(\"no data received to load the LSH Forest from\")\n\t}\n\n\t// get the import holder ready\n\timportedForest := &LSHforest{}\n\n\t// unmarshall into the holder\n\tif err := proto.Unmarshal(data, importedForest); err != nil {\n\t\treturn err\n\t}\n\n\t// some quick sanity checks\n\tif (importedForest.K * importedForest.L) != int32(IndexWrapper.sketchSize) {\n\t\treturn fmt.Errorf(\"groot graphs and lsh forest were not created in same run\")\n\t}\n\tif len(importedForest.Buckets) < 1 {\n\t\treturn fmt.Errorf(\"LSH Forest is corrupted\")\n\t}\n\n\t// attach the forest to the wrapper\n\tIndexWrapper.forest = importedForest\n\n\t// re-stringify all the sketch partitions in the LSH Forest buckets\n\tIndexWrapper.convertSketchPartitionsToString()\n\treturn nil\n}", "title": "" }, { "docid": "ad211dd97ee64a457c5faeaa07d2ebeb", "score": "0.5425381", "text": "func newBlockImporter(r io.ReadSeeker, rpc *rpcclient.Client, c *redis.Client, f *os.File, f2 *os.File) (*blockImporter, error) {\n\treturn &blockImporter{\n\t\tr: r,\n\t\tc: c,\n\t\trpc: rpc,\n\t\tf: f,\n\t\tf2: f2,\n\t\tprocessQueue: make(chan []byte, 2),\n\t\tdoneChan: make(chan bool),\n\t\terrChan: make(chan error),\n\t\tquit: make(chan struct{}),\n\t}, nil\n}", "title": "" }, { "docid": "e92eceeb82ddd76e74b15fc1241c6021", "score": "0.5407502", "text": "func NewReader(r io.Reader) (*Reader, error) {\n\tzlib, err := zlib.NewReader(r)\n\tif err != nil {\n\t\treturn nil, packfile.ErrZLib.AddDetails(err.Error())\n\t}\n\n\treturn &Reader{\n\t\tzlib: zlib,\n\t}, nil\n}", "title": "" }, { "docid": "efa0d635df718c57356d4338a3e15d45", "score": "0.54057574", "text": "func NewDecoder(line []byte) *Decoder {\n\tdec := &Decoder{line: line}\n\treturn dec\n}", "title": "" }, { "docid": "645f5ad4cc524ee825dbd946f1e6d901", "score": "0.54048324", "text": "func NewStringByteCodeLoader (p parser.Parser, c compiler.Compiler) *StringByteCodeLoader {\n return &StringByteCodeLoader { NewFlags(), p, c }\n}", "title": "" }, { "docid": "874468b6eb7f045904cc12a13229d7af", "score": "0.5395787", "text": "func (c *CompressionCodec) NewReader(r io.Reader) io.ReadCloser {\n\tp := new(reader)\n\tif cached := decPool.Get(); cached == nil {\n\t\tp.dec, p.err = zstdlib.NewReader(r)\n\t\truntime.SetFinalizer(p, finalizeReader)\n\t} else {\n\t\tp = cached.(*reader)\n\t\tp.err = p.dec.Reset(r)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "a32fa6366eaffba15a5e4cadbef63336", "score": "0.53885746", "text": "func NewLexerFromBytes(input []byte) *Lexer {\n\tl := &Lexer{\n\t\tinput: input, row: 1, col: 0, // inc'd first time by NextChar\n\t\tstartCol: 1, startRow: 1, endRow: 1, endCol: 1,\n\t}\n\tl.NextChar()\n\treturn l\n}", "title": "" }, { "docid": "6008fe577048414e8af9c7132ba9d804", "score": "0.5385332", "text": "func NewReader(r io.Reader) io.Reader {\n\treturn byteReader{r}\n}", "title": "" }, { "docid": "8ebe21f9575e9c55b94c2993a9c1f78f", "score": "0.5381794", "text": "func NewObjectFromReader(r io.Reader) (*Object, error) {\n\tfile, err := ioutil.TempFile(\"\", \"pdf-\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := io.Copy(file, r); err != nil {\n\t\treturn nil, err\n\t}\n\n\ttempLocation := file.Name()\n\tif err := file.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocation := fmt.Sprintf(\"%s.html\", tempLocation)\n\tif err := os.Rename(tempLocation, location); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newObject(location, true, nil)\n}", "title": "" }, { "docid": "ea8d5c12f3822cbe937443a02af318b9", "score": "0.5373137", "text": "func NewDecodeReader(inStream io.Reader, enc string) io.Reader {\n\tvar reader io.Reader\n\n\tencoding := getEncoding(enc)\n\tif encoding != nil {\n\t\treader = transform.NewReader(inStream, encoding.NewDecoder())\n\t} else {\n\t\treader = inStream\n\t}\n\n\treturn reader\n}", "title": "" }, { "docid": "7091e02feec15128e8330789295cd536", "score": "0.5365658", "text": "func FromReader(name string, r io.Reader, modules ...Module) (*Script, error) {\n\treturn New(name, r, 0, modules...)\n}", "title": "" }, { "docid": "9795f591d039886d85efc3e73bdb3d89", "score": "0.5364331", "text": "func Load(r io.Reader) (*MetaInfo, error) {\n\tvar mi MetaInfo\n\td := bencode.NewDecoder(r)\n\terr := d.Decode(&mi)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mi, nil\n}", "title": "" }, { "docid": "b8845ab9ee0ee049efc4bb6d12c997e1", "score": "0.53535855", "text": "func Open(r io.Reader) (*bencodeTorrent, error) {\n\tbto := bencodeTorrent{}\n\terr := bencode.Unmarshal(r, &bto)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &bto, nil\n}", "title": "" }, { "docid": "27c77b1c84ff8b60bbece5eca0ba314a", "score": "0.5344839", "text": "func NewReader(src io.Reader, unmarshal Unmarshal) File {\n\treturn &walker{\n\t\tsrc: src,\n\t\tunmarshal: unmarshal,\n\t}\n\n}", "title": "" }, { "docid": "fb118a00fb3adcd1c6ad5018e67cf99b", "score": "0.5337205", "text": "func (b *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error {\n\treturn backend.DefaultLoad(ctx, h, length, offset, b.openReader, fn)\n}", "title": "" }, { "docid": "870f17ed0e4633ba26233da1f3937a7c", "score": "0.5332985", "text": "func NewReader(lzma io.Reader) (r *Reader, err error) {\n\tdata := make([]byte, HeaderLen)\n\tif _, err = io.ReadFull(lzma, data); err != nil {\n\t\tif err == io.EOF {\n\t\t\treturn nil, errors.New(\"lzma: unexpected EOF\")\n\t\t}\n\t\treturn nil, err\n\t}\n\tr = new(Reader)\n\tif err = r.h.unmarshalBinary(data); err != nil {\n\t\treturn nil, err\n\t}\n\tif r.h.DictCap < MinDictCap {\n\t\treturn nil, errors.New(\"lzma: dictionary capacity too small\")\n\t}\n\tr.Header = r.h\n\tr.lzma = lzma\n\n\treturn r, nil\n}", "title": "" }, { "docid": "07d353bb1eb1c70d7285d1c8417ad815", "score": "0.5332973", "text": "func newLoaderPackage(id keybase1.TeamID, e keybase1.KID, g keybase1.PerTeamKeyGeneration, role keybase1.TeamRole) *LoaderPackage {\n\treturn &LoaderPackage{id: id, encKID: e, encKIDGen: g, role: role}\n}", "title": "" }, { "docid": "b461e7e063d5ad4a9649e87fa310a11b", "score": "0.5324587", "text": "func NewReader(r io.Reader) io.Reader {\n\treturn &decompressor{r: r}\n}", "title": "" }, { "docid": "80f10bfdba891c708d792215418fb90e", "score": "0.53192973", "text": "func FromBytes(buffer []byte) (*Reader, error) {\n\tmetadataStart := bytes.LastIndex(buffer, metadataStartMarker)\n\n\tif metadataStart == -1 {\n\t\treturn nil, newInvalidDatabaseError(\"error opening database: invalid MaxMind DB file\")\n\t}\n\n\tmetadataStart += len(metadataStartMarker)\n\tmetadataDecoder := decoder{buffer[metadataStart:]}\n\n\tvar metadata Metadata\n\n\trvMetdata := reflect.ValueOf(&metadata)\n\t_, err := metadataDecoder.decode(0, rvMetdata, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsearchTreeSize := metadata.NodeCount * metadata.RecordSize / 4\n\tdataSectionStart := searchTreeSize + dataSectionSeparatorSize\n\tdataSectionEnd := uint(metadataStart - len(metadataStartMarker))\n\tif dataSectionStart > dataSectionEnd {\n\t\treturn nil, newInvalidDatabaseError(\"the MaxMind DB contains invalid metadata\")\n\t}\n\td := decoder{\n\t\tbuffer[searchTreeSize+dataSectionSeparatorSize : metadataStart-len(metadataStartMarker)],\n\t}\n\n\tnodeBuffer := buffer[:searchTreeSize]\n\tvar nodeReader nodeReader\n\tswitch metadata.RecordSize {\n\tcase 24:\n\t\tnodeReader = nodeReader24{buffer: nodeBuffer}\n\tcase 28:\n\t\tnodeReader = nodeReader28{buffer: nodeBuffer}\n\tcase 32:\n\t\tnodeReader = nodeReader32{buffer: nodeBuffer}\n\tdefault:\n\t\treturn nil, newInvalidDatabaseError(\"unknown record size: %d\", metadata.RecordSize)\n\t}\n\n\treader := &Reader{\n\t\tbuffer: buffer,\n\t\tnodeReader: nodeReader,\n\t\tdecoder: d,\n\t\tMetadata: metadata,\n\t\tipv4Start: 0,\n\t\tnodeOffsetMult: metadata.RecordSize / 4,\n\t}\n\n\treader.setIPv4Start()\n\n\treturn reader, err\n}", "title": "" }, { "docid": "db20292b0a71ccb1e27d4f2c97c07a75", "score": "0.5308363", "text": "func NewDecoderFrom(r io.Reader, hdr Header) *Decoder {\n\treturn &Decoder{\n\t\tr: r,\n\t\thdr: hdr.dtype(),\n\t}\n}", "title": "" }, { "docid": "88c34ff68067cc3e08d4c535ef5b4f62", "score": "0.53065455", "text": "func newDecoderFromBytes(byts []byte, val interface{}) (*decoder, error) {\n\tr := newReader(bytes.NewReader(byts), newPosition(1, 0))\n\tlx := NewLexer(r)\n\tif err := lx.FetchTokens(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trefVal, err := valToReflect(val)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &decoder{\n\t\tlx: lx,\n\t\trefVal: refVal,\n\t}, nil\n}", "title": "" }, { "docid": "9b5d0822ce7d7f411795f8a33fceb0d2", "score": "0.52994215", "text": "func Load(r io.Reader, conf *Config) (*Tree, error) {\n\tvar t *Tree\n\tif err := msgpack.NewDecoder(r).Decode(&t); err != nil {\n\t\treturn nil, err\n\t}\n\tt.SetConfig(conf)\n\treturn t, nil\n}", "title": "" }, { "docid": "832bb7057217cb368fe91304c055f78a", "score": "0.52861655", "text": "func NewFromReader(r io.Reader, t int) (ExtractCloser, error) {\n\tif r == nil {\n\t\treturn nil, fmt.Errorf(\"nil reader\")\n\t}\n\tfn := \"-\"\n\tswitch t {\n\tcase ArchivePlain:\n\t\treturn &Plain{Name: fn, r: r}, nil\n\tcase ArchiveGzip:\n\t\treturn &Gzip{fn: fn, unc: fn, gfh: r}, nil\n\tcase ArchiveZstd:\n\t\treturn &Zstd{fn: fn, unc: fn, gfh: r}, nil\n\tcase ArchiveZip:\n\t\treturn nil, fmt.Errorf(\"not supported\")\n\tcase ArchiveGpg:\n\t\treturn NewGpgfile(fn)\n\tcase ArchiveTar:\n\t\treturn NewTarfile(fn)\n\t}\n\treturn &Plain{Name: fn, r: r}, fmt.Errorf(\"unknown type\")\n}", "title": "" }, { "docid": "0cec39d858392d8982028b0540dfa761", "score": "0.52826375", "text": "func NewReader(r io.Reader) io.Reader {\n\treturn &jsoncTranslator{\n\t\tr: r,\n\n\t\tdata: make([]byte, bytes.MinRead),\n\t\tcursor: bytes.MinRead,\n\n\t\tlastToken: tokenOther,\n\t}\n}", "title": "" }, { "docid": "4dea8304d2df5bf4d7b8df290e299ac1", "score": "0.528057", "text": "func newBinParser(r io.Reader) *binParser {\n\treturn &binParser{bufio.NewReader(r), 0, 0}\n}", "title": "" }, { "docid": "623b4d73716ea56d526fd2cfd56f0ef1", "score": "0.5273811", "text": "func NewFromReader(v4 io.Reader, v6 io.Reader) Shortcut {\n\treturn New(readLines(v4), readLines(v6))\n}", "title": "" }, { "docid": "da46c866e348d84bd43bbda1eb786a2d", "score": "0.52737325", "text": "func NewReader(r io.Reader, t transform.Transformer) *Reader {\n\tt.Reset()\n\treturn &Reader{\n\t\tr: r,\n\t\tt: t,\n\t\tdst: make([]byte, defaultBufSize),\n\t\tsrc: make([]byte, defaultBufSize),\n\t}\n}", "title": "" }, { "docid": "b2258eaed01cc292bed0f232a52986c0", "score": "0.52682066", "text": "func newBytesReader(b []byte) *bytesReader {\n\treturn &bytesReader{Reader: bytes.NewReader(b), buf: b}\n}", "title": "" }, { "docid": "131f98e79b5cebb6bc773de83306fcd3", "score": "0.5266995", "text": "func NewReader(zctx *resolver.Context, path string) (*Reader, error) {\n\treturn newReader(zctx, path, 0)\n}", "title": "" }, { "docid": "5b1605e24113b2e484a7064666e558d6", "score": "0.52537155", "text": "func newResourceFromBytes(s []byte) (*Resource, error) {\n\tr := &Resource{\n\t\tRaw: s,\n\t}\n\tresponse := &infoResponse{}\n\terr := json.Unmarshal(s, response)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing error: %s, server response: %s\", err, string(s[:]))\n\t}\n\n\tr.OData = &ODataAnnotation{\n\t\tContext: response.Context,\n\t\tID: response.ID,\n\t\tType: response.Type,\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "54543218f5eb0416c4fed4854a9ec0c8", "score": "0.52469075", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treader := bufio.NewReader(r)\n\treturn &Decoder{r: reader, stack: make([]interface{}, 0), memo: make(map[string]interface{})}\n}", "title": "" }, { "docid": "e3be56da8d313904c5b18090f0013baf", "score": "0.52460337", "text": "func NewReader(r io.Reader) io.ReadCloser {\n\tfixedHuffmanDecoderInit()\n\n\tvar f decompressor\n\tf.r = makeReader(r)\n\tf.bits = new([maxNumLit + maxNumDist]int)\n\tf.codebits = new([numCodes]int)\n\tf.step = (*decompressor).nextBlock\n\tf.dict.init(maxMatchOffset, nil)\n\treturn &f\n}", "title": "" }, { "docid": "7338ece95ee7f0a8033cb2d24d8077b0", "score": "0.5243772", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "7338ece95ee7f0a8033cb2d24d8077b0", "score": "0.5243772", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "7338ece95ee7f0a8033cb2d24d8077b0", "score": "0.5243772", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "bf9283a73cf6929c479ae568bd8514fd", "score": "0.5240289", "text": "func (*embeddedBPFObjectLoader) load() ([]byte, error) {\n\t// Guard against some build-time mishap\n\tif bpfObj == nil || len(bpfObj) == 0 {\n\t\treturn nil, errNoBPFObject\n\t}\n\n\treturn bpfObj, nil\n}", "title": "" }, { "docid": "d49f0fb9bb2cb0f2093a37bb14052a96", "score": "0.5238793", "text": "func execNewDecoder(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := base32.NewDecoder(args[0].(*base32.Encoding), args[1].(io.Reader))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "0934cd45c6a3d869d5557c6acfa4fe78", "score": "0.5234067", "text": "func FromBytes(buffer []byte) (*Reader, error) {\n\tmetadataStart := bytes.LastIndex(buffer, metadataStartMarker)\n\n\tif metadataStart == -1 {\n\t\treturn nil, newInvalidDatabaseError(\"error opening database: invalid MaxMind DB file\")\n\t}\n\n\tmetadataStart += len(metadataStartMarker)\n\tmetadataDecoder := decoder{buffer[metadataStart:]}\n\n\tvar metadata Metadata\n\n\trvMetdata := reflect.ValueOf(&metadata)\n\t_, err := metadataDecoder.decode(0, rvMetdata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsearchTreeSize := metadata.NodeCount * metadata.RecordSize / 4\n\tdataSectionStart := searchTreeSize + dataSectionSeparatorSize\n\tdataSectionEnd := uint(metadataStart - len(metadataStartMarker))\n\tif dataSectionStart > dataSectionEnd {\n\t\treturn nil, newInvalidDatabaseError(\"the MaxMind DB contains invalid metadata\")\n\t}\n\td := decoder{\n\t\tbuffer[searchTreeSize+dataSectionSeparatorSize : metadataStart-len(metadataStartMarker)],\n\t}\n\n\treader := &Reader{\n\t\tbuffer: buffer,\n\t\tdecoder: d,\n\t\tMetadata: metadata,\n\t\tipv4Start: 0,\n\t}\n\n\treader.ipv4Start, err = reader.startNode()\n\n\treturn reader, err\n}", "title": "" }, { "docid": "75b56f35d31198fa2eb484e7d7f988fc", "score": "0.523272", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r}\n}", "title": "" }, { "docid": "3e4d138ef79c3b46ee38ba59fca440b2", "score": "0.52325267", "text": "func newLoader(pd policyData) *Loader {\n\treturn &Loader{\n\t\tpd: pd,\n\t\tclient: http.DefaultClient,\n\t\tminDelay: DefaultMinDelay,\n\t\tmaxDelay: DefaultMaxDelay,\n\t\tlogError: func(error) {},\n\t\tprepareRequest: func(*http.Request) error { return nil },\n\t}\n}", "title": "" }, { "docid": "5b2d55807fdf0551a4a276e27170ae80", "score": "0.5232251", "text": "func (m *Manager) LoadBytes(b []byte) error {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\treturn json.Unmarshal(b, &m.TokenCache)\n}", "title": "" }, { "docid": "d47acea030c288cc677f857c7be7d26e", "score": "0.52272195", "text": "func NewReader(r io.Reader) (formType FourCC, data *Reader, err error) {\n\tvar buf [chunkHeaderSize]byte\n\tif _, err := io.ReadFull(r, buf[:]); err != nil {\n\t\tif err == io.EOF || err == io.ErrUnexpectedEOF {\n\t\t\terr = errMissingRIFFChunkHeader\n\t\t}\n\t\treturn FourCC{}, nil, err\n\t}\n\tif buf[0] != 'R' || buf[1] != 'I' || buf[2] != 'F' || buf[3] != 'F' {\n\t\treturn FourCC{}, nil, errMissingRIFFChunkHeader\n\t}\n\treturn NewListReader(u32(buf[4:]), r)\n}", "title": "" }, { "docid": "f00a788ad26709200ea44ec50b8931d4", "score": "0.5222854", "text": "func NewReader(r io.Reader) Reader {\n\treturn &mhReader{r}\n}", "title": "" }, { "docid": "fabf41442830f988b22d522c0d7596a5", "score": "0.5222255", "text": "func NewFrom(filename string) (*Read, error) {\n\n\t// First we map in the entire file\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileLength, err := f.Seek(0, io.SeekEnd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := mapMemory(f.Fd(), uintptr(fileLength))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newFromData(data, uintptr(fileLength))\n}", "title": "" }, { "docid": "8e69f8e99a5580e418284e986c860232", "score": "0.522128", "text": "func newFileReader(driver storagedriver.StorageDriver, path string) (*fileReader, error) {\n\trd := &fileReader{\n\t\tdriver: driver,\n\t\tpath: path,\n\t}\n\n\t// Grab the size of the layer file, ensuring existence.\n\tif fi, err := driver.Stat(path); err != nil {\n\t\tswitch err := err.(type) {\n\t\tcase storagedriver.PathNotFoundError:\n\t\t\t// NOTE(stevvooe): We really don't care if the file is not\n\t\t\t// actually present for the reader. If the caller needs to know\n\t\t\t// whether or not the file exists, they should issue a stat call\n\t\t\t// on the path. There is still no guarantee, since the file may be\n\t\t\t// gone by the time the reader is created. The only correct\n\t\t\t// behavior is to return a reader that immediately returns EOF.\n\t\tdefault:\n\t\t\t// Any other error we want propagated up the stack.\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif fi.IsDir() {\n\t\t\treturn nil, fmt.Errorf(\"cannot read a directory\")\n\t\t}\n\n\t\t// Fill in file information\n\t\trd.size = fi.Size()\n\t\trd.modtime = fi.ModTime()\n\t}\n\n\treturn rd, nil\n}", "title": "" }, { "docid": "2c28edf0572bbd8bdb2931c21f703bf5", "score": "0.522017", "text": "func NewReader(r io.Reader) *Reader {\n\treturn &Reader{\n\t\trd: bufio.NewReader(r),\n\t\thasher: xxhash.New(),\n\t}\n}", "title": "" }, { "docid": "ee925c58628716adaa83f9555c219af5", "score": "0.5219766", "text": "func NewDecoder(r io.ReadSeeker, header Header) Decoder {\n\treturn &slDecoder{r: r, header: &header}\n}", "title": "" }, { "docid": "dbfa241b77dc92999ad32d02d14db461", "score": "0.5215839", "text": "func New(o *opa.OPA) *Loader {\n\treturn newLoader(o)\n}", "title": "" }, { "docid": "f2918d8c9f9d4932c1463b6ad9c418c5", "score": "0.52101624", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: r,\n\t\tbo: binary.LittleEndian,\n\t}\n}", "title": "" }, { "docid": "95a4c66d430ae0b70ad5cce971486652", "score": "0.5209771", "text": "func NewReader(rdr io.Reader) (*Reader, error) {\n\tdrdr := &Reader{Reader: rdr, HasDebianVersion: false}\n\tarr, err := ar.NewReader(rdr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdrdr.ArReader = arr\n\treturn drdr, err\n}", "title": "" }, { "docid": "3eb47988981dfdd4193bc5b3def6ae98", "score": "0.52080417", "text": "func FromBytes(raw []byte) Reader {\n\treturn readerFunc(func() ([]byte, error) {\n\t\treturn raw, nil\n\t})\n}", "title": "" }, { "docid": "3fa032e5c1ab776331e66c78fb03525f", "score": "0.5206504", "text": "func (c *Conf) load(bts []byte, decodeFunc func([]byte, interface{}) error) error {\n\terr := decodeFunc(bts, c)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9fe4f270f6f992b1e91475d7c4ef494d", "score": "0.5204911", "text": "func NewObjFromReader(objName string, rd io.Reader, options *ObjParserOptions) (*Obj, error) {\n\treturn readObj(objName, bufio.NewReader(rd), options)\n}", "title": "" }, { "docid": "320d8bac7abd16d25010d85493c36034", "score": "0.5190151", "text": "func NewDecoder(r io.Reader) *Decoder {\n\tc := msgpack.NewDecoder(r)\n\tc.DecodeMapFunc = decodeMapFunc\n\n\treturn &Decoder{c}\n}", "title": "" }, { "docid": "0905e11fc1a3d9671ffae2f9381f53a7", "score": "0.51797074", "text": "func newFrameReader(rc io.ReadCloser, contentType ContentType) *frameReader {\n\treturn &frameReader{\n\t\trc: rc,\n\t\tbufSize: defaultBufSize,\n\t\tmaxFrameSize: defaultMaxFrameSize,\n\t\tcontentType: contentType,\n\t}\n}", "title": "" }, { "docid": "dbe3f5eb76a65d9dc5e92771540a880f", "score": "0.5167365", "text": "func ResourceFromBytes(b []byte) Resource {\n resource := Resource{}\n json.Unmarshal(b, &resource)\n\n return resource\n}", "title": "" }, { "docid": "61a4b3b6fb3c362f956a960f3f01bfce", "score": "0.5164855", "text": "func newLoader(configFlag string) *viper.Viper {\n\t// Create Config - NB: 'ConfigName' does not require filetype extension.\n\tloader := viper.New()\n\tif config == \"\" {\n\t\tloader.SetConfigName(\"memoria\")\n\t\tloader.AddConfigPath(\".\")\n\t\tloader.AddConfigPath(\"./config\")\n\t\tloader.AddConfigPath(\"$MEMORIA_HOME/config\")\n\t\tloader.AddConfigPath(\"$HOME/.memoria\")\n\t} else {\n\t\tconfigPath, configName := handleConfigFlag(configFlag)\n\t\tloader.SetConfigName(configName)\n\t\tloader.AddConfigPath(configPath)\n\t}\n\n\t// Load Config\n\tif err := loader.ReadInConfig(); err != nil {\n\t\tfmt.Println(\"unable to read config:\", err)\n\t\tos.Exit(1)\n\t}\n\t// Display Loaded config as YAML\n\tif verbose {\n\t\tfmt.Printf(\"loaded config >>>\\n%s\\n\", toYAML(loader))\n\t}\n\n\treturn loader\n}", "title": "" }, { "docid": "b9a44f13b5bb22bbbda85c2945c5f3e1", "score": "0.5163077", "text": "func NewReader(r io.Reader, priv, pub *[32]byte) *Reader {\n\tsr := &Reader{\n\t\treader: r,\n\t}\n\n\tbox.Precompute(&sr.sharedKey, pub, priv)\n\n\treturn sr\n}", "title": "" }, { "docid": "be12a25f1e82cfb1b58cf0efff688785", "score": "0.51630527", "text": "func NewReader(buf []byte) Reader {\n\treturn Reader{buf: buf}\n}", "title": "" }, { "docid": "d38645ace4fa4ce7be10ff671e5f9dfa", "score": "0.515937", "text": "func NewReader(r io.Reader) (*Reader, error) {\n\tgz, err := gzip.NewReader(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Reader{tar.NewReader(gz), gz}, nil\n}", "title": "" }, { "docid": "7fb6660e1136f344d1a3f10bb71dddd8", "score": "0.5155793", "text": "func NewReader(r BytesReader) *Reader {\n\treturn &Reader{r: r, hdr: new(Header)}\n}", "title": "" }, { "docid": "c4c84a4df2f9675e1c5def90d57c6028", "score": "0.51471174", "text": "func (t *Torrent) NewReader(ctx context.Context, offset int64, length int64) *Reader {\n\tr := &Reader{\n\t\ttorrent: t,\n\t\toffset: offset,\n\t\tlength: length,\n\t\tcontext: ctx,\n\t\trequestedIndex: -1,\n\t}\n\truntime.SetFinalizer(r, (*Reader).Close)\n\treturn r\n}", "title": "" }, { "docid": "5d3994b982668e177dd44e5fa2162968", "score": "0.5145311", "text": "func New(configFile string) Decoder {\n\tconfig, err := ini.ShadowLoad(configFile)\n\tif err != nil {\n\t\tglog.Fatal(\"Error reading ini file \", err)\n\t}\n\n\td := Decoder{config}\n\treturn d\n}", "title": "" }, { "docid": "af345a63d3e46020b155cc0a5c26432f", "score": "0.51452005", "text": "func NewDecoder(r io.Reader) *Decoder {\n\tb := bufio.NewReader(r)\n\treturn &Decoder{\n\t\tr: b,\n\t\tfr: fullReader{b},\n\t}\n}", "title": "" }, { "docid": "d1b51dde35aa75e91be0951307347448", "score": "0.51448894", "text": "func (i InputEncryptedFileLocation) construct() InputFileLocationClass { return &i }", "title": "" }, { "docid": "c82ebc52f1ea17a733c07dbec2574c26", "score": "0.51444286", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tdec: codec.NewDecoder(r, new(codec.CborHandle)),\n\t}\n}", "title": "" }, { "docid": "0854250a1cf25794418cecb078f42912", "score": "0.51421535", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r, bytes.Buffer{}}\n}", "title": "" }, { "docid": "1d3b019494d8a0738b74f563fe182ad3", "score": "0.51327765", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r, buf: make([]byte, 8)}\n}", "title": "" }, { "docid": "37191ff48ef0b7ab47598a150e6fe42d", "score": "0.5131049", "text": "func newReader(r io.Reader, contentType string) (io.Reader, error) {\n\tpreview := make([]byte, 10240)\n\tn, err := io.ReadFull(r, preview)\n\tswitch {\n\tcase err == io.ErrUnexpectedEOF:\n\t\tpreview = preview[:n]\n\tcase err != nil:\n\t\treturn nil, err\n\t}\n\tr = io.MultiReader(bytes.NewReader(preview), r)\n\n\tif e, _, _ := determineEncoding(preview, contentType); e != encoding.Nop {\n\t\tr = transform.NewReader(r, e.NewDecoder())\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "8b150f8290cff847e405d5c7af9ffdc6", "score": "0.5128952", "text": "func NewLoader(asset *support.Asset) *Loader {\n\treturn &Loader{\n\t\tasset: asset,\n\t}\n}", "title": "" } ]
b7977a8f608320fb0e119cd1792e605c
IsYANGGoEnum ensures that OpenconfigTerminalDevice_Channel_LinkState implements the yang.GoEnum interface. This ensures that OpenconfigTerminalDevice_Channel_LinkState can be identified as a mapped type for a YANG enumeration.
[ { "docid": "de7d0764cf18c93ed2f39d1f3bc9bb89", "score": "0.79729414", "text": "func (E_OpenconfigTerminalDevice_Channel_LinkState) IsYANGGoEnum() {}", "title": "" } ]
[ { "docid": "2148753101829d2c9dfe6d7bb0a2cbca", "score": "0.70188755", "text": "func (E_OpenconfigOspfv2_SubTlv_LinkType) IsYANGGoEnum() {}", "title": "" }, { "docid": "20639c99553fef057fdffd3dabccfc3c", "score": "0.65066874", "text": "func (E_OpenconfigIsis_LinkProtectionType_Type) IsYANGGoEnum() {}", "title": "" }, { "docid": "20639c99553fef057fdffd3dabccfc3c", "score": "0.65066874", "text": "func (E_OpenconfigIsis_LinkProtectionType_Type) IsYANGGoEnum() {}", "title": "" }, { "docid": "238aa764997eb9a7891afcc7f321d78b", "score": "0.6450478", "text": "func (E_OpenconfigOspfTypes_OSPF_TE_LINK_TLV_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "7121010c03fa5c343ef6ae97573d9b2b", "score": "0.64366937", "text": "func (E_OpenconfigIsis_IsisInterfaceAdjState) IsYANGGoEnum() {}", "title": "" }, { "docid": "4b50bbd58d58e3e0e815f9ba9d572fe2", "score": "0.64189553", "text": "func (E_OpenconfigOspfTypes_OSPFV2_ROUTER_LINK_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "fc04d0ffb78a4edc6fe171d2ec48c7fa", "score": "0.6366944", "text": "func (E_OpenconfigSpanningTree_StpLinkType) IsYANGGoEnum() {}", "title": "" }, { "docid": "d9afdf048d38f3d2eec76792ab50f960", "score": "0.63622105", "text": "func (E_SrlNokiaInterfacesLag_MemberLinkOperDownReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "cc4e38acb9e26072d76d4964a68534e4", "score": "0.6287431", "text": "func (E_OpenconfigLacp_LacpActivityType) IsYANGGoEnum() {}", "title": "" }, { "docid": "ae1490ee1c5d268bede26868e0e8d27a", "score": "0.6165514", "text": "func (E_OpenconfigIsis_CircuitType) IsYANGGoEnum() {}", "title": "" }, { "docid": "1224323b0b34f801a6fec6c5077e7ba4", "score": "0.61488086", "text": "func (E_SrlNokiaLacp_LacpActivityType) IsYANGGoEnum() {}", "title": "" }, { "docid": "f71c88d635731dffd4033c6e05066baf", "score": "0.61251897", "text": "func (E_OpenconfigIsis_LanAdjacencySid_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "f71c88d635731dffd4033c6e05066baf", "score": "0.61251897", "text": "func (E_OpenconfigIsis_LanAdjacencySid_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "500f725e3ed228d7aec3a1486224aa4f", "score": "0.6113625", "text": "func (E_SrlNokiaIsis_IsisInterfaceAdjState) IsYANGGoEnum() {}", "title": "" }, { "docid": "b24c721da49a72783839a02013f5ecc4", "score": "0.61103815", "text": "func (E_OpenconfigIsis_Flags_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "b24c721da49a72783839a02013f5ecc4", "score": "0.61103815", "text": "func (E_OpenconfigIsis_Flags_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "d8a844132b27184a14648d374c0d78e1", "score": "0.60976404", "text": "func (E_OpenconfigIsis_Capability_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "d8a844132b27184a14648d374c0d78e1", "score": "0.60976404", "text": "func (E_OpenconfigIsis_Capability_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "b85acd01f5999e656efb068799f5aca7", "score": "0.6051829", "text": "func (E_OpenconfigVlan_Vlan_Status) IsYANGGoEnum() {}", "title": "" }, { "docid": "b85acd01f5999e656efb068799f5aca7", "score": "0.6051829", "text": "func (E_OpenconfigVlan_Vlan_Status) IsYANGGoEnum() {}", "title": "" }, { "docid": "c4b19e757acf112890ba49a297bfe667", "score": "0.6036387", "text": "func (E_SrlNokiaPlatform_LocatorLedState) IsYANGGoEnum() {}", "title": "" }, { "docid": "14bfc288bf8e3f6363554938dfa12b8f", "score": "0.60157", "text": "func (E_SrlNokiaInterfaces_Interface_Transceiver_ConnectorType) IsYANGGoEnum() {}", "title": "" }, { "docid": "19b6c4b3a06998efc306737ee576ef49", "score": "0.60053015", "text": "func (E_OpenconfigAcl_ACL_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "64c5ec37d79a4ec7af0b0b67b843231e", "score": "0.60040057", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_Lsdb_LsaTypes_LsaType_Lsas_Lsa_OpaqueLsa_RouterInformation_Tlvs_Tlv_Type) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6001264", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6001264", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6001264", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7f00a22a5c309b6a8471338e1913cf5e", "score": "0.6001264", "text": "func (E_IETFInterfaces_InterfaceType) IsYANGGoEnum() {}", "title": "" }, { "docid": "ccfc56b9ec80a317b421e1c640f5a077", "score": "0.5986319", "text": "func (E_SrlNokiaInterfaces_Interface_BreakoutMode_ChannelSpeed) IsYANGGoEnum() {}", "title": "" }, { "docid": "fdf4259cda21806efaae4fa22c9b315e", "score": "0.5970653", "text": "func (E_OpenconfigIsisTypes_AFI_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "6408ea1ce64f4936e9ca80b78c2460a5", "score": "0.59647286", "text": "func (E_OpenconfigOspfTypes_OSPFV2_EXTENDED_LINK_SUBTLV_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "7ce4c738e9fe9f0784b1b1787d239775", "score": "0.5956127", "text": "func (E_SrlNokiaQos_ForwardingClass) IsYANGGoEnum() {}", "title": "" }, { "docid": "337820d518827d138eca0f3db6279dd5", "score": "0.5954869", "text": "func (E_OpenconfigIsis_LevelType) IsYANGGoEnum() {}", "title": "" }, { "docid": "dd45e6efa20c11af3f0ba1ad58adbf0c", "score": "0.5947767", "text": "func (E_SrlNokiaInterfaces_Interface_Subinterface_BridgeTable_MacLearning_LearntEntries_Mac_Aging) IsYANGGoEnum() {}", "title": "" }, { "docid": "bc1af01f68c41e4b67aaef2f78ca2765", "score": "0.5944376", "text": "func (E_OpenconfigTransportTypes_FIBER_CONNECTOR_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "97269d1223a6a4aecff241618776b6ef", "score": "0.5933235", "text": "func (E_SrlNokiaInterfaces_Interface_Subinterface_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "37d980206162a09aae7958f9c1a31d7c", "score": "0.5926236", "text": "func (E_SrlNokiaInterfaces_Interface_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "cb97f72512fe20376032bc5396bc2d5a", "score": "0.5910689", "text": "func (E_SrlNokiaIsis_IsisCircuitType) IsYANGGoEnum() {}", "title": "" }, { "docid": "42bb7765d4046f1c3dc6701e7ee62697", "score": "0.5910432", "text": "func (E_OpenconfigMpls_MplsHopType) IsYANGGoEnum() {}", "title": "" }, { "docid": "9908e4dbb74b7cda9d4992a116a49ff3", "score": "0.59101427", "text": "func (E_OpenconfigLldp_PortIdType) IsYANGGoEnum() {}", "title": "" }, { "docid": "d76d8691722ef51690e29f1e8c5aeb82", "score": "0.5910135", "text": "func (E_OpenconfigTransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "f39564e74ee74ea39317d8f12b9d8abc", "score": "0.59087086", "text": "func (E_OpenconfigInterfaces_Interfaces_Interface_State_AdminStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "f39564e74ee74ea39317d8f12b9d8abc", "score": "0.59087086", "text": "func (E_OpenconfigInterfaces_Interfaces_Interface_State_AdminStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "8916669a87982e59aa040dbf29b47301", "score": "0.5899387", "text": "func (E_FaucetConfiguration_Acls_Acle_Match_DlTypeName) IsYANGGoEnum() {}", "title": "" }, { "docid": "941f630e3ec26513314519167aa22cfa", "score": "0.58945274", "text": "func (E_OpenconfigPlatformTypes_COMPONENT_OPER_STATUS) IsYANGGoEnum() {}", "title": "" }, { "docid": "941f630e3ec26513314519167aa22cfa", "score": "0.58945274", "text": "func (E_OpenconfigPlatformTypes_COMPONENT_OPER_STATUS) IsYANGGoEnum() {}", "title": "" }, { "docid": "e10467b828a3838abb021bbe383270b4", "score": "0.58806944", "text": "func (E_OpenconfigAaaTypes_AAA_AUTHORIZATION_EVENT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "e10467b828a3838abb021bbe383270b4", "score": "0.58806944", "text": "func (E_OpenconfigAaaTypes_AAA_AUTHORIZATION_EVENT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "e10467b828a3838abb021bbe383270b4", "score": "0.58806944", "text": "func (E_OpenconfigAaaTypes_AAA_AUTHORIZATION_EVENT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "5aea4df8cf6a67cc25ccbea73480b5ac", "score": "0.587845", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_Protocols_BgpEvpn_BgpInstance_Routes_BridgeTable_NextHop) IsYANGGoEnum() {}", "title": "" }, { "docid": "6f396a15a555c59db77e71a4af658275", "score": "0.58740646", "text": "func (E_OpenconfigTerminalDevice_AdminStateType) IsYANGGoEnum() {}", "title": "" }, { "docid": "47533376286f5771c0c1459c45679130", "score": "0.5873979", "text": "func (E_SrlNokiaInterfacesLag_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "bbea6af77f2cafc3a895684627ccd512", "score": "0.58715564", "text": "func (E_SrlNokiaIsis_IsisAdjacencyDownReason) IsYANGGoEnum() {}", "title": "" }, { "docid": "d0c51c8e2af5f4550cf1fce32d6b04fd", "score": "0.58570784", "text": "func (E_OpenconfigSystem_System_Aaa_Accounting_Events_Event_Config_Record) IsYANGGoEnum() {}", "title": "" }, { "docid": "d0c51c8e2af5f4550cf1fce32d6b04fd", "score": "0.58570784", "text": "func (E_OpenconfigSystem_System_Aaa_Accounting_Events_Event_Config_Record) IsYANGGoEnum() {}", "title": "" }, { "docid": "1209e419906a253c6b06e61e3f1557fa", "score": "0.58477944", "text": "func (E_OpenconfigInterfaces_Interface_AdminStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "1209e419906a253c6b06e61e3f1557fa", "score": "0.58477944", "text": "func (E_OpenconfigInterfaces_Interface_AdminStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "c11539c9f90f0d72f6ea290aaf66878f", "score": "0.5844444", "text": "func (E_OpenconfigAaaTypes_AAA_ACCOUNTING_EVENT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "c11539c9f90f0d72f6ea290aaf66878f", "score": "0.5844444", "text": "func (E_OpenconfigAaaTypes_AAA_ACCOUNTING_EVENT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "c11539c9f90f0d72f6ea290aaf66878f", "score": "0.5844444", "text": "func (E_OpenconfigAaaTypes_AAA_ACCOUNTING_EVENT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "ad61df855a4329cd5d3116593f60327c", "score": "0.5835433", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_TYPE_ID) IsYANGGoEnum() {}", "title": "" }, { "docid": "ad61df855a4329cd5d3116593f60327c", "score": "0.5835433", "text": "func (E_OpenconfigAlarmTypes_OPENCONFIG_ALARM_TYPE_ID) IsYANGGoEnum() {}", "title": "" }, { "docid": "aa0868380dafd8879ac220b9ff90cc8b", "score": "0.5834534", "text": "func (E_SrlNokiaInterfaces_AdminState) IsYANGGoEnum() {}", "title": "" }, { "docid": "196bcd53b506d3f2be223994e9d11691", "score": "0.58235025", "text": "func (E_SrlNokiaInterfacesBridgeTable_AdminState) IsYANGGoEnum() {}", "title": "" }, { "docid": "52d4bc810a7a31d1ea546c2c4063cff5", "score": "0.5819885", "text": "func (E_OpenconfigIsis_AdjacencySid_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "52d4bc810a7a31d1ea546c2c4063cff5", "score": "0.5819885", "text": "func (E_OpenconfigIsis_AdjacencySid_Flags) IsYANGGoEnum() {}", "title": "" }, { "docid": "7133a5993578236ca6223bdf8c4c65c9", "score": "0.5816614", "text": "func (E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "7133a5993578236ca6223bdf8c4c65c9", "score": "0.5816614", "text": "func (E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "86e5db9efd3477349e3dfe6046010aeb", "score": "0.58150035", "text": "func (E_SrlNokiaLldp_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "3129168d5e3efd242a8c1526e43d0869", "score": "0.5805648", "text": "func (E_SrlNokiaPlatform_Platform_ResourceManagement_UnifiedForwardingResources_Alpm) IsYANGGoEnum() {}", "title": "" }, { "docid": "2700a43e0fcf1f421c1a7a0334b8e616", "score": "0.58049893", "text": "func (E_SrlNokiaInterfacesLag_LagType) IsYANGGoEnum() {}", "title": "" }, { "docid": "6c55fd72ae85714c78c9c881600f3ddf", "score": "0.58038634", "text": "func (E_OpenconfigIsisTypes_OVERLOAD_RESET_TRIGGER_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "ec5aa68cd0d4f100a0fa04ce271f7593", "score": "0.58026236", "text": "func (E_SrlNokiaOspfTypes_Ospfv2RouterLinkType) IsYANGGoEnum() {}", "title": "" }, { "docid": "4c3787b7ddaf9832489ca301b7b90dd6", "score": "0.5802058", "text": "func (E_OpenconfigPlatformTypes_OPENCONFIG_SOFTWARE_COMPONENT) IsYANGGoEnum() {}", "title": "" }, { "docid": "4c3787b7ddaf9832489ca301b7b90dd6", "score": "0.5802058", "text": "func (E_OpenconfigPlatformTypes_OPENCONFIG_SOFTWARE_COMPONENT) IsYANGGoEnum() {}", "title": "" }, { "docid": "4c3787b7ddaf9832489ca301b7b90dd6", "score": "0.5802058", "text": "func (E_OpenconfigPlatformTypes_OPENCONFIG_SOFTWARE_COMPONENT) IsYANGGoEnum() {}", "title": "" }, { "docid": "3b13bf7c8224aeed7030c32106b28025", "score": "0.5801669", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_BridgeTable_MacLearning_LearntEntries_Mac_Aging) IsYANGGoEnum() {}", "title": "" }, { "docid": "b4ce8cfdbc9847bc4b742457f9b518b2", "score": "0.5800418", "text": "func (E_OpenconfigIsisLsdbTypes_ISIS_TLV_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "b4ce8cfdbc9847bc4b742457f9b518b2", "score": "0.5800418", "text": "func (E_OpenconfigIsisLsdbTypes_ISIS_TLV_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "aad5787cf8db54bb7b54816489d71333", "score": "0.57864124", "text": "func (E_SrlNokiaBridgeTableMacLearning_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "639d8fe2e3c144b266949b2293f12153", "score": "0.5782929", "text": "func (E_OpenconfigLldpTypes_LLDP_TLV) IsYANGGoEnum() {}", "title": "" }, { "docid": "67f64f34de9613380b142a6e8738b96f", "score": "0.57805496", "text": "func (E_OpenconfigAaa_Event_Record) IsYANGGoEnum() {}", "title": "" }, { "docid": "66b644ee70592c3feea179ff28960519", "score": "0.5770964", "text": "func (E_OpenconfigAcl_FORWARDING_ACTION) IsYANGGoEnum() {}", "title": "" }, { "docid": "ea5c8ea7e0122c1dbae6410b49c9b440", "score": "0.5763759", "text": "func (E_OpenconfigBgp_PeerType) IsYANGGoEnum() {}", "title": "" }, { "docid": "2e89dfe2281022cf6a59faa935a4607e", "score": "0.5763716", "text": "func (E_OpenconfigInterfaces_Interface_OperStatus) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.5759336", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.5759336", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2c18b232ca85d104461da2ba67d92885", "score": "0.5759336", "text": "func (E_OpenconfigAaaTypes_AAA_METHOD_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "f03b61717a9c800b08199cbbdfb0ded2", "score": "0.5755524", "text": "func (E_OpenconfigIfIp_Neighbor_NeighborState) IsYANGGoEnum() {}", "title": "" }, { "docid": "f03b61717a9c800b08199cbbdfb0ded2", "score": "0.5755524", "text": "func (E_OpenconfigIfIp_Neighbor_NeighborState) IsYANGGoEnum() {}", "title": "" }, { "docid": "b7e4008b5b26b0a7d1ae0400a0a4ef17", "score": "0.57524014", "text": "func (E_OpenconfigIsis_SrgbDescriptor_Label) IsYANGGoEnum() {}", "title": "" }, { "docid": "b7e4008b5b26b0a7d1ae0400a0a4ef17", "score": "0.57524014", "text": "func (E_OpenconfigIsis_SrgbDescriptor_Label) IsYANGGoEnum() {}", "title": "" }, { "docid": "d11459746a108790eff3240b21a73a46", "score": "0.57519865", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_Lsdb_LsaTypes_LsaType_Lsas_Lsa_OpaqueLsa_ExtendedPrefix_RouteType) IsYANGGoEnum() {}", "title": "" }, { "docid": "7e486b894386082945754e90c55eed64", "score": "0.57511395", "text": "func (E_SrlNokiaNetworkInstance_NetworkInstance_Protocols_Ospf_Instance_Area_Interface_OperState) IsYANGGoEnum() {}", "title": "" }, { "docid": "bbdcb337ff3dbb67dbe08f3a8149efb0", "score": "0.5747266", "text": "func (E_OpenconfigLldp_ChassisIdType) IsYANGGoEnum() {}", "title": "" }, { "docid": "f58067a8ac17df61b5ab098cddb2d029", "score": "0.57349265", "text": "func (E_OpenconfigTransportLineCommon_OPTICAL_LINE_PORT_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "2a5267c7e54690d17b90bc3a0b32f9f5", "score": "0.57315856", "text": "func (E_OpenconfigSpanningTreeTypes_STP_EDGE_PORT) IsYANGGoEnum() {}", "title": "" }, { "docid": "a62556b660967c955bd0c8309e7ff0ba", "score": "0.5730825", "text": "func (E_OpenconfigAaaTypes_AAA_SERVER_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "a62556b660967c955bd0c8309e7ff0ba", "score": "0.5730825", "text": "func (E_OpenconfigAaaTypes_AAA_SERVER_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "a62556b660967c955bd0c8309e7ff0ba", "score": "0.5730825", "text": "func (E_OpenconfigAaaTypes_AAA_SERVER_TYPE) IsYANGGoEnum() {}", "title": "" } ]
b5be0433029da4df13dddfde441445d6
NewCreateAccountRequest create the request corresponding to the create action endpoint of the account resource.
[ { "docid": "eb03b28fb7600b3feded3b948e03b3d4", "score": "0.78367776", "text": "func (c *Client) NewCreateAccountRequest(ctx context.Context, path string, payload *CreateAccountPayload, contentType string) (*http.Request, error) {\n\tvar body bytes.Buffer\n\tif contentType == \"\" {\n\t\tcontentType = \"*/*\" // Use default encoder\n\t}\n\terr := c.Encoder.Encode(payload, &body, contentType)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"POST\", u.String(), &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif contentType != \"*/*\" {\n\t\theader.Set(\"Content-Type\", contentType)\n\t}\n\treturn req, nil\n}", "title": "" } ]
[ { "docid": "a58ac27c9d624094b6762060f007c4ce", "score": "0.74689645", "text": "func (a *UserManagementApiService) CreateAccount(ctx context.Context) ApiCreateAccountRequest {\n\treturn ApiCreateAccountRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "2dc700add06ef498695242b61c66621f", "score": "0.6828843", "text": "func (a *AccountService) CreateNewAccount(c *fiber.Ctx) error {\n\tvar account models.Account\n\tif err := c.BodyParser(&account); err != nil {\n\t\treturn c.Status(fiber.StatusBadRequest).JSON(models.Error{Code: fiber.StatusBadRequest, Message: \"Invalid JSON\"})\n\t}\n\t_, err := a.AccountModel.Create(&account)\n\tif err != nil {\n\t\treturn c.Status(fiber.StatusInternalServerError).JSON(models.Error{Code: fiber.StatusInternalServerError, Message: err.Error()})\n\t}\n\treturn c.Status(fiber.StatusCreated).JSON(account)\n}", "title": "" }, { "docid": "276cb78d325604d23a400036317bbbb1", "score": "0.6666534", "text": "func (h Handler) CreateAccount(r *http.Request) responses.Response {\n\toperation := \"accounts.Handler.CreateAccount\"\n\n\tctx := r.Context()\n\tvar body CreateAccountRequest\n\terr := json.NewDecoder(r.Body).Decode(&body)\n\tif err != nil {\n\t\treturn responses.BadRequest(domain.Error(operation, err), responses.ErrInvalidBody)\n\t}\n\n\t_, err = h.Usecase.CreateAccount(ctx, body.Email, body.Password)\n\tif err != nil {\n\t\treturn responses.ErrorResponse(domain.Error(operation, err))\n\t}\n\n\treturn responses.Created(nil)\n}", "title": "" }, { "docid": "e9729ecba138ffce2e7ec4e1d6e5eef3", "score": "0.6596235", "text": "func CreateAccount(w http.ResponseWriter, r *http.Request) {\n\taccount := model.Account{}\n\n\tif err := render.Bind(r.Body, &account); err != nil {\n\t\trender.Status(r, http.StatusBadRequest)\n\t\trender.JSON(w, r, http.StatusText(http.StatusBadRequest))\n\n\t\treturn\n\t}\n\n\tif !account.IsVaild() {\n\t\trender.Status(r, http.StatusBadRequest)\n\t\trender.JSON(w, r, http.StatusText(http.StatusBadRequest))\n\n\t\treturn\n\t}\n\tif err := database.CreateAccount(account); err != nil {\n\t\trender.Status(r, http.StatusConflict)\n\t\trender.JSON(w, r, http.StatusText(http.StatusConflict))\n\n\t\treturn\n\t}\n\trender.Status(r, http.StatusCreated)\n\trender.JSON(w, r, account)\n}", "title": "" }, { "docid": "1882ef5eb9d41d5de88ee2783602b72b", "score": "0.6586881", "text": "func (c *Client) CreateAccount(request CreateAccountRequest) (*CreateAccountResponse, *Errors, error) {\n\tvar resp CreateAccountResponse\n\tvar errors Errors\n\n\trestClient := c.Start(&resp, &errors)\n\terr := restClient.WithURI(\"/organisation/accounts\").\n\t\tSetJSONBody(request).\n\t\tSetMethod(http.MethodPost).\n\t\tCall()\n\tif restClient.ErrorRef == nil {\n\t\treturn &resp, nil, err\n\t}\n\treturn &resp, &errors, err\n}", "title": "" }, { "docid": "c5104a9a04c27f67b17fa70e7bd630dd", "score": "0.6451302", "text": "func (c *Client) CreateAccount(instanceId string, args *CreateAccountArgs) error {\n\tif args == nil {\n\t\treturn fmt.Errorf(\"unset args\")\n\t}\n\n\tif args.AccountName == \"\" {\n\t\treturn fmt.Errorf(\"unset AccountName\")\n\t}\n\n\tif args.Password == \"\" {\n\t\treturn fmt.Errorf(\"unset Password\")\n\t}\n\n\tif args.AccountType == \"\" {\n\t\targs.AccountType = \"common\"\n\t}\n\tif args.AccountType == \"Super\" {\n\t\targs.AccountType = \"rdssuper\"\n\t}\n\tif args.AccountType == \"Common\" {\n\t\targs.AccountType = \"common\"\n\t}\n\tif args.DatabasePrivileges != nil {\n\t\tfor idx, _ := range args.DatabasePrivileges {\n\t\t\tif args.DatabasePrivileges[idx].AuthType == \"ReadOnly\" {\n\t\t\t\targs.DatabasePrivileges[idx].AuthType = \"readOnly\"\n\t\t\t} else if args.DatabasePrivileges[idx].AuthType == \"ReadWrite\" {\n\t\t\t\targs.DatabasePrivileges[idx].AuthType = \"readWrite\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bce.NewRequestBuilder(c).\n\t\tWithMethod(http.POST).\n\t\tWithURL(getAccountUriWithInstanceId(instanceId)).\n\t\tWithQueryParamFilter(\"clientToken\", args.ClientToken).\n\t\tWithHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE).\n\t\tWithBody(args).\n\t\tDo()\n}", "title": "" }, { "docid": "c6a6ca99385569a37ffe76bc1d49147e", "score": "0.6449878", "text": "func (a *API) CreateAccount(ctx context.Context, req *rpc.CreateAccountRequest) (*rpc.CreateAccountResponse, error) {\n\tvar (\n\t\tacc *account.Account\n\t\terr error\n\t)\n\n\tif req.Key != \"\" {\n\t\tacc, err = account.NewAccountWithKey(req.Key, req.Owner)\n\t} else {\n\t\tacc, err = account.NewAccount(req.Owner)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif req.Environment == rpc.AccountEnvironment_PRODUCTION {\n\t\tacc.DirectoryURL = a.configuration.ACME.DefaultProductionDirectory\n\t}\n\n\tif err := a.bucket.SaveAccount(acc); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &rpc.CreateAccountResponse{\n\t\tId: acc.ID.String(),\n\t\tToken: acc.Token.String(),\n\t}, nil\n}", "title": "" }, { "docid": "edfdda8748f1a773364757bcf1bbc13e", "score": "0.64408374", "text": "func (c *client) CreateAccount() (Account, error) {\n\turlStr := fmt.Sprintf(\"%s/accounts/\", c.url)\n\treq, err := http.NewRequest(\"POST\", urlStr, nil)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\treq.SetBasicAuth(c.user, c.pass)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\t_, payload, err := c.do(req)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\treturn accountFromPayload(payload)\n}", "title": "" }, { "docid": "5e47cebd18ae9a27ebc1ab517cbbdda3", "score": "0.6409281", "text": "func CreateListAccountRequest() (request *ListAccountRequest) {\n\trequest = &ListAccountRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"retailadvqa-public\", \"2020-05-15\", \"ListAccount\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "9037dd9a10a88fd4d058d3cfea146af9", "score": "0.6361878", "text": "func CreateNewAccount(w http.ResponseWriter, r *http.Request) {\n\tAccounts, err := ReadAccounts()\n\tif err != nil {\n\t\thttp.Error(w, \"データベースの参照に失敗しました。\\n\", http.StatusInternalServerError)\n\t\tlog.Printf(\"データベースの参照に失敗しました。\\n%v\\n\", err)\n\t\treturn\n\t}\n\n\tCookieData, err := GetCookieValue(r)\n\tif err != nil {\n\t\thttp.Error(w, \"Cookieの取得に失敗しました。\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = r.ParseForm()\n\tif err != nil {\n\t\tfmt.Printf(\"Parse form error\\n%v\\n\", err)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tnickname := r.Form.Get(\"nickname\")\n\tif nickname == \"\" {\n\t\tnickname = Accounts[CookieData[\"id\"]].Name\n\t}\n\n\tAccounts[CookieData[\"id\"]] = AccountList{Name: nickname}\n\n\tif err = ExportAccounts(Accounts); err != nil {\n\t\thttp.Error(w, \"データの書き出しに失敗しました。\\n\", http.StatusInternalServerError)\n\t\tlog.Printf(\"データの書き出しに失敗しました。\\n%v\\n\", err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Location\", \"/\")\n\tw.WriteHeader(http.StatusTemporaryRedirect)\n}", "title": "" }, { "docid": "12bc3c76caf322d75b570f3f1b766d66", "score": "0.6294945", "text": "func (api *API) AccountCreate(account, fee, owner, active, posting, memo string) error {\n\tvar ops []types.Operation\n\n\t// construct operation\n\top := &types.AccountCreateOperation{\n\t\tFee: fee,\n\t\tCreator: api.account,\n\t\tNewAccountName: account,\n\t\tOwner: authorityFromKey(owner),\n\t\tActive: authorityFromKey(active),\n\t\tPosting: authorityFromKey(posting),\n\t\tMemoKey: memo,\n\t\tJsonMetadata: \"{}\",\n\t}\n\n\tops = append(ops, op)\n\n\tresp, err := api.client.SendTrx(api.account, ops)\n\n\tlog.Printf(\"Response: %s\", resp)\n\n\treturn err\n}", "title": "" }, { "docid": "c67f3fef1748f9c22ede5b937136ea16", "score": "0.6284827", "text": "func (h *handler) CreateAccount(ctx context.Context, req *accountpb.Account, res *accountpb.Response) error {\n\t// Save our customer\n\taccount, err := h.repository.Create(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres.Account = account\n\treturn nil\n}", "title": "" }, { "docid": "be4d60d6ff613fe3af1c9d71ec24768a", "score": "0.62456566", "text": "func CreateAccount(c *gin.Context) {\n\tvar account models.Account\n\tc.BindJSON(&account)\n\terr := models.CreateAccount(&account)\n\tif err != nil {\n\t log.Warn(err.Error())\n\t c.AbortWithStatus(http.StatusInternalServerError)\n\t} else {\n\t c.JSON(http.StatusOK, account)\n\t}\n }", "title": "" }, { "docid": "4f43005cfb4c80b29d594d1d01824766", "score": "0.6236", "text": "func CreateAccount(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\trepo := config.CreateRepository()\n\treturn handler.CreateAccount(request, repo)\n}", "title": "" }, { "docid": "15f34fa35f8c819570628f8a8d4213c6", "score": "0.6208148", "text": "func (c *Client) CreateAccount(body *AccountCreate, opts ...Option) (*Account, error) {\n\tctx := context.Background()\n\treturn c.createAccount(ctx, body, opts...)\n}", "title": "" }, { "docid": "f1bf3e48153a13a2967559260f4294c8", "score": "0.61872697", "text": "func (c *Client) CreateAccount(instanceId string, args *CreateAccountArgs) error {\n\tif args == nil {\n\t\treturn fmt.Errorf(\"unset args\")\n\t}\n\n\tif args.AccountName == \"\" {\n\t\treturn fmt.Errorf(\"unset AccountName\")\n\t}\n\n\tif args.Password == \"\" {\n\t\treturn fmt.Errorf(\"unset Password\")\n\t}\n\n\tcryptedPass, err := Aes128EncryptUseSecreteKey(c.Config.Credentials.SecretAccessKey, args.Password)\n\tif err != nil {\n\t\treturn err\n\t}\n\targs.Password = cryptedPass\n\n\treturn bce.NewRequestBuilder(c).\n\t\tWithMethod(http.POST).\n\t\tWithURL(getRdsUriWithInstanceId(instanceId)+\"/account\").\n\t\tWithQueryParamFilter(\"clientToken\", args.ClientToken).\n\t\tWithBody(args).\n\t\tDo()\n}", "title": "" }, { "docid": "0ef2435c50815c624affe132634a4280", "score": "0.61680514", "text": "func NewControllersCreateAccountRequest() *ControllersCreateAccountRequest {\n\tthis := ControllersCreateAccountRequest{}\n\treturn &this\n}", "title": "" }, { "docid": "cef4df08867ff9b4893ae75e0620c6f9", "score": "0.61647934", "text": "func (c *Client) NewAddAccountsRequest(ctx context.Context, path string, payload *AddAccountRequest, contentType string) (*http.Request, error) {\n\tvar body bytes.Buffer\n\tif contentType == \"\" {\n\t\tcontentType = \"*/*\" // Use default encoder\n\t}\n\terr := c.Encoder.Encode(payload, &body, contentType)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"POST\", u.String(), &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif contentType == \"*/*\" {\n\t\theader.Set(\"Content-Type\", \"application/json\")\n\t} else {\n\t\theader.Set(\"Content-Type\", contentType)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "7916c8c478b7617666822137eae7b874", "score": "0.615868", "text": "func (s *AccountService) NewCreateAccountParams(email string, firstname string, lastname string, password string, username string) *CreateAccountParams {\n\tp := &CreateAccountParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"email\"] = email\n\tp.p[\"firstname\"] = firstname\n\tp.p[\"lastname\"] = lastname\n\tp.p[\"password\"] = password\n\tp.p[\"username\"] = username\n\treturn p\n}", "title": "" }, { "docid": "d36cf776f923ee0a1ad7e8b1f47eb352", "score": "0.6126505", "text": "func (c *Client) CreateAccount(walletId, name, pwd string) (*adajson.Account, error) {\n\treturn c.CreateAccountAsync(walletId, name, pwd).Receive()\n}", "title": "" }, { "docid": "abc1bfdd4b780eb8c8a9b1996698a324", "score": "0.61102766", "text": "func NewAccount(ctx *pulumi.Context,\n\tname string, args *AccountArgs, opts ...pulumi.ResourceOption) (*Account, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Account\n\terr := ctx.RegisterResource(\"azure:netapp/account:Account\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "46c05aa2ba272aad9d9b249639e2668b", "score": "0.61008596", "text": "func (s *Server) CreateAccount(ctx context.Context, req *proto.CreateAccountRequest) (*proto.CreateAccountResponse, error) {\n\toperationType := constants.CREATE_ACCOUNT\n\tctx, rootSpan := s.ConfigureAndStartRootSpan(ctx, operationType)\n\tdefer rootSpan.Finish()\n\n\tif req == nil {\n\t\treturn nil, service_errors.ErrInvalidInputArguments\n\t}\n\n\temail, password := req.Email, req.Password\n\terr, pwdOrEmailIsInvalid := s.IsPasswordOrEmailInValid(email, password, operationType)\n\tif pwdOrEmailIsInvalid {\n\t\treturn nil, err\n\t}\n\n\tvar callAuthenticationService = req.CallAuthenticationService(s.authnClient)\n\n\tresult, err := s.PerformRetryableRPCOperation(ctx, rootSpan, callAuthenticationService, operationType)()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tid, err := s.GetIdFromResponseObject(ctx, result, operationType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.logger.For(ctx).Info(\"Successfully created user account\", zap.Int(\"Id\", int(id)))\n\tresponse := &proto.CreateAccountResponse{Id: uint32(id), Error: \"\"}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "d9e19c7b386c5b7a1564cac64f964463", "score": "0.60946316", "text": "func NewAccount(ctx *pulumi.Context,\n\tname string, args *AccountArgs, opts ...pulumi.ResourceOpt) (*Account, error) {\n\tinputs := make(map[string]interface{})\n\tif args == nil {\n\t\tinputs[\"cloudwatchRoleArn\"] = nil\n\t} else {\n\t\tinputs[\"cloudwatchRoleArn\"] = args.CloudwatchRoleArn\n\t}\n\tinputs[\"throttleSettings\"] = nil\n\ts, err := ctx.RegisterResource(\"aws:apigateway/account:Account\", name, true, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Account{s: s}, nil\n}", "title": "" }, { "docid": "220e88a0cc5b0091a411d32e3e5d2bb5", "score": "0.6070324", "text": "func NewAccount(id int64, name string, createdAt, updatedAt time.Time) *Account {\n\tcreatedAt = createdAt.UTC().Truncate(time.Second)\n\tupdatedAt = updatedAt.UTC().Truncate(time.Second)\n\treturn &Account{id, name, createdAt, updatedAt}\n}", "title": "" }, { "docid": "33c73b75f3ea11e6d6aef1c0a4a7f58c", "score": "0.6051402", "text": "func CreateAccount(env *config.Env) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Read POST request body\n\t\tnewAccount, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tdefer r.Body.Close()\n\n\t\t// Read request body into Account object\n\t\tvar account models.Account\n\t\terr = json.Unmarshal(newAccount, &account)\n\t\tif err != nil {\n\t\t\thttp.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Validate Account fields\n\t\tvalid := account.Validate()\n\t\tif !valid {\n\t\t\thttp.Error(w, http.StatusText(http.StatusUnprocessableEntity), http.StatusUnprocessableEntity)\n\t\t\treturn\n\t\t}\n\n\t\t// Create User in database\n\t\tcreatedAccount, err := env.DB.CreateAccount(account)\n\t\tif sqliteErr, ok := err.(sqlite3.Error); ok {\n\t\t\tif sqliteErr.ExtendedCode == sqlite3.ErrConstraintUnique {\n\t\t\t\thttp.Error(w, http.StatusText(http.StatusConflict), http.StatusConflict)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tcreatedAccountJSON, _ := json.Marshal(createdAccount)\n\n\t\t// Send the created user JSON back in the response\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(createdAccountJSON)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "9ed4b4f8dd832d72f9479ea54ca472d7", "score": "0.6011831", "text": "func (a *App) CreateAccount(w http.ResponseWriter, r *http.Request) {\n\thandler.CreateAccount(a.DB, w, r)\n}", "title": "" }, { "docid": "86f852c61e038fcba40269bc739b85f2", "score": "0.6000034", "text": "func CreateAccount(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\n\t// define and assing payload model\n\trecord := model.Payload{}\n\n\t// decode payload\n\tdecoder := json.NewDecoder(r.Body)\n\n\tif err := decoder.Decode(&record); err != nil {\n\t\trespondError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tif err := db.Save(&record.Data).Error; err != nil {\n\t\trespondError(w, http.StatusInternalServerError, err.Error())\n\t\treturn \n\t}\n\trespondJSON(w, http.StatusCreated, record.Data)\n}", "title": "" }, { "docid": "980a15209bf08e96bf9239423b22c812", "score": "0.5965974", "text": "func AccountCreate(c *gin.Context) {\n\tvar temp AccountCreateInput\n\n\terr := c.ShouldBind(&temp)\n\tif err != nil {\n\t\tfmt.Println(\"cannot bind request object\")\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"result\": false,\n\t\t\t\"message\": \"missing username/password\",\n\t\t})\n\t\treturn\n\t}\n\n\t// Get database connection from GIN framework\n\tdb := c.MustGet(\"db\").(*gorm.DB)\n\thashpassword, _ := models.HashPassword(temp.Password)\n\tacc := models.Account{Username: temp.Username, Password: hashpassword}\n\n\tresult := db.Create(&acc)\n\n\tif result.Error != nil {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"result\": false,\n\t\t\t\"message\": \"Account is duplicated\",\n\t\t})\n\t\treturn\n\t}\n\n\tserver := models.Server{}\n\tdb.Where(\"Active = ?\", 1).First(&server)\n\n\tnextserver := models.Server{}\n\terrs := db.Where(\"id = ?\", server.ID+1).First(&nextserver)\n\tif errs != nil {\n\t\tdb.Where(\"id = ?\", 1).First(&nextserver)\n\t}\n\n\t// set active to next record\n\tserver.Active = 0\n\tdb.Save(&server)\n\tnextserver.Active = 1\n\tdb.Save(&nextserver)\n\n\t// response result\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"message\": \"Account is created\",\n\t\t\"result\": true,\n\t\t\"ftp\": server.Domain,\n\t\t\"live\": server.Domain,\n\t\t\"port\": server.Port,\n\t})\n}", "title": "" }, { "docid": "ed3948ef23e1d58857a97cf7b3148c9f", "score": "0.5964973", "text": "func (k *Keeper) CreateAccount(ctx sdk.Context, addr ethcmn.Address) {\n\tk.csdb.WithContext(ctx).CreateAccount(addr)\n}", "title": "" }, { "docid": "04f986c2c32ef2ce40d901c1d55c9df2", "score": "0.5961683", "text": "func NewAccount(ID AccountID, name, CPF string, balance Money, createdAt time.Time) Account {\n\treturn Account{\n\t\tid: ID,\n\t\tname: name,\n\t\tcpf: CPF,\n\t\tbalance: balance,\n\t\tcreatedAt: createdAt,\n\t}\n}", "title": "" }, { "docid": "41b9b3397c851cff874be65f6ef3b081", "score": "0.5960381", "text": "func (as *AccountService) Create(params CreateAccountParameters) error {\n\tname := strings.TrimSpace(params.Name)\n\n\t// Invariant: account names must be at least 4 characters long.\n\tif utf8.RuneCountInString(name) < minimumAccountNameLengthInRunes {\n\t\treturn ErrAccountNameTooShort\n\t}\n\n\t// Invariant: accounts must have a unique name.\n\taccount, err := as.accountRepo.FindByName(name)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif account != nil {\n\t\treturn ErrDuplicateAccountName\n\t}\n\n\temail := strings.TrimSpace(params.Email)\n\n\t// Invariant: accounts must have a unique email address.\n\taccount, err = as.accountRepo.FindByEmail(email)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif account != nil {\n\t\treturn ErrDuplicateAccountEmail\n\t}\n\n\tpasswordHash, err := as.PasswordService.Hash(params.Password)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata := CreateAccountData{\n\t\tName: name,\n\t\tEmail: email,\n\t\tPasswordHash: passwordHash,\n\t\tCreationIP: params.CreationIP,\n\t}\n\n\treturn as.accountRepo.Create(data)\n}", "title": "" }, { "docid": "2f5b9d9af4bb55e17283406ff9ccc27b", "score": "0.5929317", "text": "func (client *StorageAccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters StorageAccountCreateParameters, options *StorageAccountsBeginCreateOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2019-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, req.MarshalAsJSON(parameters)\n}", "title": "" }, { "docid": "4b4c269f94b32447e3e7320f4b72f0a0", "score": "0.5916257", "text": "func (s *Server) CreateAccount(ctx context.Context, in *CreateAccountMessage) (*SingleAccount, error) {\r\n\taccount, err := models.CreateAccount(in.Name)\r\n\tlog.Println(\"Created Account\")\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tvar acc = &Account{Id: account.ID, Name: account.Name}\r\n\treturn &SingleAccount{Item: acc}, nil\r\n}", "title": "" }, { "docid": "9128afef41f79ba0b57e1db150aa612c", "score": "0.59102905", "text": "func NewAccount(db *sql.DB, args ...interface{}) { //messagehandle.ErrorMsg {\n\tdbservice.CallWrite(\n\t\tdb,\n\t\tdbservice.MakeProcedureQueryStr(\"AccountNew_Write\", len(args)),\n\t\targs...,\n\t)\n}", "title": "" }, { "docid": "931e21b900811bbb82d81c7a10ea7e80", "score": "0.58983254", "text": "func (_Store *StoreTransactor) CreateAccount(opts *bind.TransactOpts) (*types.RawTransaction, error) {\n\treturn _Store.contract.Transact(opts, \"createAccount\")\n}", "title": "" }, { "docid": "9f90edac87930b14481910a345194041", "score": "0.58778244", "text": "func CreateNewAccount(name string, db *pg.DB) (*Account, error) {\n\taccount := New()\n\taccount.CardName = name\n\terr := account.Create(db)\n\treturn &account, err\n}", "title": "" }, { "docid": "804fd399bc9783a3cfa4d334944d6625", "score": "0.58719397", "text": "func (client *serviceClient) getAccountInfoCreateRequest(ctx context.Context, options *ServiceGetAccountInfoOptions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, client.con.Endpoint())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"restype\", \"account\")\n\treqQP.Set(\"comp\", \"properties\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"x-ms-version\", \"2019-12-12\")\n\treq.Raw().Header.Set(\"Accept\", \"application/xml\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c03d9f2b3ed665318b02e116cfce861a", "score": "0.58650357", "text": "func (a AccountsService) Create(ctx context.Context, account Account) (Account, error) {\n\tb, err := json.Marshal(account)\n\tif err != nil {\n\t\treturn Account{}, fmt.Errorf(\"error serialising account: %w\", err)\n\t}\n\tbuf := bytes.NewBuffer(b)\n\treq, err := a.client.NewRequest(ctx, http.MethodPost, a.buildURL(\"/\"), buf)\n\tif err != nil {\n\t\treturn Account{}, fmt.Errorf(\"error constructing request: %w\", err)\n\t}\n\tif account.ProfileID != \"\" {\n\t\terr = a.client.AddTokenCredentials(req)\n\t\tif err != nil {\n\t\t\treturn Account{}, err\n\t\t}\n\t}\n\tjsonRequest(req)\n\tres, err := a.client.Do(req)\n\tif err != nil {\n\t\treturn Account{}, fmt.Errorf(\"error making request: %w\", err)\n\t}\n\tresp, err := responseFromBody(res)\n\tif err != nil {\n\t\treturn Account{}, err\n\t}\n\n\t// standard checks\n\tif resp.Errors.Contains(serverError) {\n\t\treturn Account{}, ErrServerError\n\t}\n\tif resp.Errors.Contains(invalidFormatError) {\n\t\treturn Account{}, ErrInvalidFormatError\n\t}\n\tif resp.Errors.Contains(RequestError{\n\t\tSlug: requestErrAccessDenied,\n\t\tHeader: \"Authorization\",\n\t}) {\n\t\treturn Account{}, ErrUnauthorized\n\t}\n\n\t// req specific checks\n\tif resp.Errors.Contains(RequestError{\n\t\tSlug: requestErrMissing,\n\t\tField: \"/id\",\n\t}) {\n\t\treturn Account{}, ErrAccountRequestMissingID\n\t}\n\tif resp.Errors.Contains(RequestError{\n\t\tSlug: requestErrMissing,\n\t\tField: \"/profileID\",\n\t}) {\n\t\treturn Account{}, ErrAccountRequestMissingProfileID\n\t}\n\tif resp.Errors.Contains(RequestError{\n\t\tSlug: requestErrConflict,\n\t\tField: \"/id\",\n\t}) {\n\t\treturn Account{}, ErrAccountAlreadyRegistered\n\t}\n\n\tif len(resp.Errors) > 0 {\n\t\tyall.FromContext(ctx).WithField(\"errors\", resp.Errors).Error(\"unexpected error in response\")\n\t\treturn Account{}, ErrUnexpectedError\n\t}\n\n\tif len(resp.Accounts) < 1 {\n\t\treturn Account{}, fmt.Errorf(\"%w: no account found\", ErrUnexpectedResponse)\n\t}\n\treturn resp.Accounts[0], nil\n}", "title": "" }, { "docid": "768e39aa176411e712d2b72506d323fe", "score": "0.58482915", "text": "func CreateAccount() (*Account, error) {\n\tkey, err := btcec.NewPrivateKey(btcec.S256())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taccountKey := Key(*key)\n\n\treturn &Account{\n\t\tKeys: &accountKey,\n\t\tNameTx: make(map[string]UTXOList),\n\t}, nil\n}", "title": "" }, { "docid": "4e4586a854a9fefe706ebf4a7b97aaea", "score": "0.5838347", "text": "func NewAccount() *Account {\n\treturn &Account{}\n}", "title": "" }, { "docid": "d2349fb369a4f3a272e7419e8199f000", "score": "0.58299595", "text": "func NewCreateAccountOK() *CreateAccountOK {\n\n\treturn &CreateAccountOK{}\n}", "title": "" }, { "docid": "5ccb4660af6b37c55989415205d79d99", "score": "0.58046496", "text": "func (cl *ClientImpl) CreateAccount() (*Account, error) {\n\taccount, err := NewAccount()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := cl.SaveAccount(account); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn account, nil\n}", "title": "" }, { "docid": "1c3c1227ed95522e4302e22216dae5cf", "score": "0.57876384", "text": "func (s *server) createAccount(w http.ResponseWriter, r *http.Request) {\n\tdata := &payload.AccountRequest{}\n\tif err := render.Bind(r, data); err != nil {\n\t\trender.Render(w, r, payload.ErrInvalidRequest(err))\n\t\treturn\n\t}\n\n\t// Account.Balance is ignored on purpose, client should use deposit.\n\t// data.Balance = data.ProtectedBalance\n\n\tdata.Code = data.ProtectedCode\n\n\tswitch data.Code {\n\tcase model.CurrencyUSD, model.CurrencyEUR, model.CurrencyRUB:\n\t\tid, err := s.db.NewAccount(*data.Account)\n\t\tif err != nil {\n\t\t\trender.Render(w, r, payload.ErrInternal(err))\n\t\t\treturn\n\t\t}\n\n\t\taccount, err := s.db.GetAccount(id)\n\t\tif err != nil {\n\t\t\trender.Render(w, r, payload.ErrInternal(err))\n\t\t\treturn\n\t\t}\n\n\t\trender.Status(r, http.StatusCreated)\n\t\trender.Render(w, r, payload.NewAccountResponse(&account))\n\tdefault:\n\t\trender.Render(w, r, payload.ErrInvalidRequest(\n\t\t\tfmt.Errorf(\"unsupported currency code: %d\", data.Code),\n\t\t))\n\t}\n}", "title": "" }, { "docid": "fa40d95be35233c1c510fa57120a317f", "score": "0.57781655", "text": "func (client *Client) CreateAccount(account string) (keeper.Account, error) {\n\tclient.l.Infof(\"[CreateAccount] for account %s\", account)\n\t// GetAddress will create account if not exists\n\taddress, err := client.GetAddress(account)\n\tif err != nil {\n\t\treturn keeper.Account{}, err\n\t}\n\n\treturn keeper.Account{\n\t\tAccount: account,\n\t\tBalance: 0.0,\n\t\tAddresses: []string{address},\n\t}, nil\n}", "title": "" }, { "docid": "63a97bafae70c8c5a174d3f8072173bd", "score": "0.5767203", "text": "func CreateGenerateAccountLoginTokenRequest() (request *GenerateAccountLoginTokenRequest) {\n\trequest = &GenerateAccountLoginTokenRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Aas\", \"2015-07-01\", \"GenerateAccountLoginToken\", \"aas\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "239f47cde53c5697ac16815c4d50e254", "score": "0.5759336", "text": "func (a *UserManagementApiService) CreateUser(ctx context.Context, accountname string) ApiCreateUserRequest {\n\treturn ApiCreateUserRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\taccountname: accountname,\n\t}\n}", "title": "" }, { "docid": "867cb0e4489414f21ef99beb5642fe4c", "score": "0.5755824", "text": "func (u Usecase) CreateAccount(ctx context.Context, doc vos.Document, creditLimit vos.Money) (vos.AccountID, error) {\n\tconst operation = \"accounts.Usecase.CreateAccount\"\n\n\tlog := logger.FromCtx(ctx).WithFields(logrus.Fields{\n\t\t\"doc\": doc,\n\t})\n\n\tlog.Infoln(\"creating account\")\n\n\t_, err := strconv.Atoi(doc.String())\n\tif err != nil {\n\t\treturn \"\", ErrInvalidDocument\n\t}\n\n\tif creditLimit < 0 {\n\t\treturn \"\", ErrInvalidCreditLimit\n\t}\n\n\tacc := entities.NewAccount(doc, 0, creditLimit)\n\taccID, err := u.accRepo.CreateAccount(ctx, acc)\n\tif err != nil {\n\t\treturn \"\", domain.Error(operation, err)\n\t}\n\n\tlog.WithField(\"id\", accID).Infoln(\"account successfully created\")\n\n\treturn accID, nil\n}", "title": "" }, { "docid": "0303d3258397b7de844492224e5e3dd3", "score": "0.57484114", "text": "func (client *ApiClient) CreateAccount(account *Account) (*Account, *ApiError) {\n\tif err := account.Validate(); err != nil {\n\t\treturn nil, NewApiError(nil, err.Error())\n\t}\n\n\t// Retrying a POST request can raise a 409 Conflict, this is a scrappy work-around part 1:\n\t// Check for existing resource by id and raise a Conflict error now. Then Conflict errors for the POST request\n\t// can be interpreted as a retry scenario where the success of the first try was lost.\n\texisting, apiErr := client.FetchAccount(account.Id)\n\tif apiErr == nil {\n\t\tapiErr = NewApiError(nil, \"Account with id %s already exists\", existing.Id)\n\t\tapiErr.StatusCode = http.StatusConflict\n\t\treturn existing, apiErr\n\t} else if apiErr.StatusCode != http.StatusNotFound {\n\t\treturn nil, apiErr\n\t}\n\n\tresp, dec, apiErr := client.JsonRequest(http.MethodPost, AccountsPath, AccountCreation{account})\n\n\tif apiErr == nil {\n\t\tvar response AccountCreationResponse\n\t\tif err := dec.Decode(&response); err != nil {\n\t\t\tapiErr = NewApiError(resp, err.Error())\n\t\t}\n\t\tif e := resp.Body.Close(); e != nil {\n\t\t\tlog.Print(\"Closing of response body failed!\")\n\t\t}\n\t\treturn response.Data, apiErr\n\n\t} else if resp != nil && resp.StatusCode == http.StatusConflict {\n\t\t// Work-around part 2: In case of Conflict, fetch and return the existing resource.\n\t\t// This would introduce a race condition if the same id was used to create resources across multiple clients.\n\t\tif latest, err := client.FetchAccount(account.Id); err == nil {\n\t\t\treturn latest, nil\n\t\t}\n\t}\n\n\treturn nil, apiErr\n}", "title": "" }, { "docid": "163c4cac051b4140e20a62402ca811c1", "score": "0.57414615", "text": "func NewCreateAccount(ac AccountCreator, logger *log.Logger) *CreateAccount {\n\treturn &CreateAccount{\n\t\taccountCreator: ac,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "4dd481486dd8abcb99266241cafa102e", "score": "0.57321715", "text": "func NewCreateAccountParams() CreateAccountParams {\n\n\treturn CreateAccountParams{}\n}", "title": "" }, { "docid": "8079aa622fb64ef30ea23e4426b35b50", "score": "0.5723747", "text": "func NewAccount(name string) *Account {\n\ta := &Account{\n\t\tName: name,\n\t\tlimits: limits{-1, -1, -1, -1, 0, 0, 0},\n\t}\n\treturn a\n}", "title": "" }, { "docid": "30afde0cddbc0f9c770ca69dc18fdbfe", "score": "0.5719948", "text": "func (srv *OCSDiamServer) CreateAccount(\n\t_ context.Context,\n\tsubscriberID *lteprotos.SubscriberID,\n) (*orcprotos.Void, error) {\n\tsrv.accounts[subscriberID.Id] = &SubscriberAccount{\n\t\tChargingCredit: make(map[uint32]*CreditBucket),\n\t}\n\tglog.V(2).Infof(\"New account %s added\", subscriberID.Id)\n\treturn &orcprotos.Void{}, nil\n}", "title": "" }, { "docid": "ffa5e0cb8de29ffea2c5052e39312a2d", "score": "0.57179147", "text": "func (e Endpoints) CreateAccount(ctx context.Context, passphrase string) (address string, err error) {\n\trequest := CreateAccountRequest{Passphrase: passphrase}\n\tresponse, err := e.CreateAccountEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(CreateAccountResponse).Address, response.(CreateAccountResponse).Err\n}", "title": "" }, { "docid": "2b21391340f7ce77a42d7cf10aea0bf3", "score": "0.5706893", "text": "func (c *Client) NewListAccountRequest(ctx context.Context, path string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "6297cb2f12ca0a2057fa9b432b302bd1", "score": "0.56931734", "text": "func (a *DefaultApiService) CreateServiceAccount(ctx _context.Context) ApiCreateServiceAccountRequest {\n\treturn ApiCreateServiceAccountRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "e70c62378ae6420915782cbce9223482", "score": "0.5674164", "text": "func CreateAccount(ctx context.Context, realm, userID string, expires int) (*Account, error) {\n\tacc, err := FindAccountByUserID(ctx, realm, userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif acc != nil {\n\t\treturn nil, ErrAccountExists\n\t}\n\n\tnow := timestamp.Now()\n\ttoken, _ := id.ShortUUID() // temporary token to confirm the new account. this is not an authorization token or such!\n\n\tuid := \"\"\n\tfor {\n\t\t// make sure that the new clientID is unique\n\t\tuid, _ = id.ShortUUID()\n\t\tacc, err := LookupAccount(ctx, realm, uid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif acc == nil {\n\t\t\tbreak\n\t\t}\n\t\t// try again ...\n\t}\n\n\taccount := Account{\n\t\tRealm: realm,\n\t\tUserID: userID,\n\t\tClientID: uid,\n\t\tStatus: AccountUnconfirmed,\n\t\tToken: token,\n\t\tExpires: timestamp.IncT(timestamp.Now(), expires),\n\t\tConfirmed: 0,\n\t\tCreated: now,\n\t\tUpdated: now,\n\t}\n\n\tif err := UpdateAccount(ctx, &account); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &account, nil\n}", "title": "" }, { "docid": "0230d977021cff1682e8f72c9df58128", "score": "0.56740624", "text": "func AccountCreate(rpc nanostructs.NanoRPC, wallet string, optional map[string]string) (map[string]interface{}, error) {\n\tdata := map[string]string{\"action\": \"account_create\", \"wallet\": wallet}\n\n\t//If the length of optional arguments is > 0, iterate over them and make sure the arguments are valid.\n\t//If they're valid, add to the data map, if not return an error.\n\tif len(optional) > 0 {\n\t\tfor k, v := range optional {\n\t\t\tswitch strings.ToLower(k) {\n\t\t\tcase \"index\":\n\t\t\t\tif _, ok := data[k]; ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Duplicate key provided: %s\", k)\n\t\t\t\t}\n\t\t\t\t_, err := strconv.Atoi(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Invalid optional argument value: %s: %s\", k, v)\n\t\t\t\t}\n\t\t\t\tdata[k] = v\n\n\t\t\tcase \"work\":\n\t\t\t\tif _, ok := data[k]; ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Duplicate key provided: %s\", k)\n\t\t\t\t}\n\t\t\t\t_, err := strconv.ParseBool(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Invalid optional argument value: %s: %s\", k, v)\n\t\t\t\t}\n\t\t\t\tdata[k] = v\n\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Invalid optional argument key: %s: %s\", k, v)\n\t\t\t}\n\t\t}\n\t}\n\tresponse, createError := NodePost(rpc.Host, rpc.Port, &data)\n\tif createError != nil {\n\t\treturn nil, createError\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "fdc97815471c9834e53c5f2898f3cdaa", "score": "0.5673878", "text": "func (client *containerClient) getAccountInfoCreateRequest(ctx context.Context, options *containerClientGetAccountInfoOptions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"restype\", \"account\")\n\treqQP.Set(\"comp\", \"properties\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"x-ms-version\", \"2020-10-02\")\n\treq.Raw().Header.Set(\"Accept\", \"application/xml\")\n\treturn req, nil\n}", "title": "" }, { "docid": "6888bdf5c5976e04393cc7ea8d3929ac", "score": "0.56595266", "text": "func (lkb lazyKeybaseKeyring) CreateAccount(\n\tname, mnemonic, bip39Passwd, encryptPasswd string, account, index uint32,\n) (Info, error) {\n\n\tdb, err := keyring.Open(lkb.lkbToKeyringConfig())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newKeyringKeybase(db).CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd, account, index)\n}", "title": "" }, { "docid": "b1662508b19cdefc97057f0c7889ecf1", "score": "0.56534666", "text": "func (x *XClient) CreateContractAccount(from *account.Account, contractAccount string, opts ...RequestOption) (*Transaction, error) {\n\tif ok, _ := regexp.MatchString(`^XC\\d{16}@*`, contractAccount); !ok {\n\t\treturn nil, common.ErrInvalidContractAccount\n\t}\n\n\tsubRegexp := regexp.MustCompile(`\\d{16}`)\n\tcontractAccountByte := subRegexp.Find([]byte(contractAccount))\n\tcontractAccount = string(contractAccountByte)\n\treq, err := NewCreateContractAccountRequest(from, contractAccount, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn x.Do(req)\n}", "title": "" }, { "docid": "80b4da03c797d65988dfc57841a40e81", "score": "0.56311005", "text": "func (s *accountsServer) Create(ctx context.Context, req *api.Account) (resp *api.Account, err error) {\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\trErr := tx.Rollback()\n\t\t\tif rErr != nil {\n\t\t\t\tlogrus.Error(rErr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\terr = tx.Commit()\n\t}()\n\tcreatedAt, err := ptypes.Timestamp(req.GetCreatedAt())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = s.getBuilder(tx).Insert(\"accounts\").\n\t\tColumns(\n\t\t\t\"account_id\",\n\t\t\t\"description\",\n\t\t\t\"threshold\",\n\t\t\t\"balance\",\n\t\t\t\"created_at\",\n\t\t\t\"is_validator\",\n\t\t\t\"vote\",\n\t\t).\n\t\tValues(\n\t\t\treq.GetId(),\n\t\t\treq.GetDescription(),\n\t\t\treq.GetThreshold(),\n\t\t\treq.GetBalance(),\n\t\t\tcreatedAt,\n\t\t\treq.GetIsValidator(),\n\t\t\treq.GetVote(),\n\t\t).\n\t\tExecContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, signer := range req.GetSigners() {\n\t\t_, err = s.getBuilder(tx).Insert(\"account_signers\").\n\t\t\tColumns(\n\t\t\t\t\"account_id\",\n\t\t\t\t\"signer_id\",\n\t\t\t\t\"pubkey\",\n\t\t\t\t\"signature_algorithm\",\n\t\t\t\t\"hash_algorithm\",\n\t\t\t\t\"weight\",\n\t\t\t).\n\t\t\tValues(\n\t\t\t\treq.GetId(),\n\t\t\t\tsigner.GetName(),\n\t\t\t\tsigner.GetPubkey(),\n\t\t\t\tsigner.GetSignatureAlgorithm(),\n\t\t\t\tsigner.GetHashAlgorithm(),\n\t\t\t\tsigner.GetWeight(),\n\t\t\t).\n\t\t\tExecContext(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "4792ec39ca23e43209cd14f44bc1df4b", "score": "0.5611287", "text": "func (c *IAMClient) NewCreateUserRequest() *CreateUserRequest {\n\treq := &CreateUserRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "7ed96796b906a8a93ac68927e15a7605", "score": "0.5601751", "text": "func CreateAccount(owner string) *Account {\n\tnewAccount := Account{owner: owner, balance: 0}\n\treturn &newAccount\n}", "title": "" }, { "docid": "5f96b99c2622222c0637427baea97c1f", "score": "0.5598933", "text": "func (accManager AccountManager) CreateAccount(\n\tctx sdk.Context, referrer types.AccountKey, username types.AccountKey,\n\tresetKey, transactionKey, appKey crypto.PubKey, registerDeposit types.Coin) sdk.Error {\n\tif accManager.DoesAccountExist(ctx, username) {\n\t\treturn ErrAccountAlreadyExists(username)\n\t}\n\taccParams, err := accManager.paramHolder.GetAccountParam(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdepositWithFullCoinDay := registerDeposit\n\tif registerDeposit.IsGT(accParams.FirstDepositFullCoinDayLimit) {\n\t\tdepositWithFullCoinDay = accParams.FirstDepositFullCoinDayLimit\n\t}\n\tif err := accManager.storage.SetPendingCoinDayQueue(\n\t\tctx, username, &model.PendingCoinDayQueue{}); err != nil {\n\t\treturn err\n\t}\n\n\tif err := accManager.storage.SetBankFromAccountKey(ctx, username, &model.AccountBank{}); err != nil {\n\t\treturn err\n\t}\n\n\taccountInfo := &model.AccountInfo{\n\t\tUsername: username,\n\t\tCreatedAt: ctx.BlockHeader().Time.Unix(),\n\t\tResetKey: resetKey,\n\t\tTransactionKey: transactionKey,\n\t\tAppKey: appKey,\n\t}\n\tif err := accManager.storage.SetInfo(ctx, username, accountInfo); err != nil {\n\t\treturn err\n\t}\n\n\taccountMeta := &model.AccountMeta{\n\t\tLastActivityAt: ctx.BlockHeader().Time.Unix(),\n\t\tLastReportOrUpvoteAt: ctx.BlockHeader().Time.Unix(),\n\t\tTransactionCapacity: depositWithFullCoinDay,\n\t}\n\tif err := accManager.storage.SetMeta(ctx, username, accountMeta); err != nil {\n\t\treturn err\n\t}\n\tif err := accManager.storage.SetReward(ctx, username, &model.Reward{}); err != nil {\n\t\treturn err\n\t}\n\t// when open account, blockchain will give a certain amount lino with full coin day.\n\tif err := accManager.AddSavingCoinWithFullCoinDay(\n\t\tctx, username, depositWithFullCoinDay, referrer,\n\t\ttypes.InitAccountWithFullCoinDayMemo, types.TransferIn); err != nil {\n\t\treturn ErrAddSavingCoinWithFullCoinDay()\n\t}\n\tif err := accManager.AddSavingCoin(\n\t\tctx, username, registerDeposit.Minus(depositWithFullCoinDay), referrer,\n\t\ttypes.InitAccountRegisterDepositMemo, types.TransferIn); err != nil {\n\t\treturn ErrAddSavingCoin()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01139abc2d62815ab90155a28eb82417", "score": "0.5597543", "text": "func (suite *KeeperTestSuite) CreateAccount(initialBalance sdk.Coins, index int) authtypes.AccountI {\n\t_, addrs := app.GeneratePrivKeyAddressPairs(index + 1)\n\n\treturn suite.CreateAccountWithAddress(addrs[index], initialBalance)\n}", "title": "" }, { "docid": "0f7a9cfb8adefb31ec525a5ec22dc8d2", "score": "0.55903196", "text": "func (client *blobClient) getAccountInfoCreateRequest(ctx context.Context, options *blobClientGetAccountInfoOptions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"restype\", \"account\")\n\treqQP.Set(\"comp\", \"properties\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"x-ms-version\", \"2020-10-02\")\n\treq.Raw().Header.Set(\"Accept\", \"application/xml\")\n\treturn req, nil\n}", "title": "" }, { "docid": "4fc5ce1989c407f29e81e10e255af08d", "score": "0.5574741", "text": "func (provisioner *GenProvisioner) CreateAccount(account *model.Account, awsClient aws.AWS) error {\n\tlogger := provisioner.logger.WithField(\"account\", account.ID)\n\terr := createAccount(provisioner, account, logger, awsClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e928775193c7ad4cb452db6c66456dde", "score": "0.5572813", "text": "func NewAccount() (*Account, error) {\n\tconst dbDriver = \"postgresql\"\n\n\trep, err := repository.AccountFactory(dbDriver)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Account{\n\t\trep: rep,\n\t}, nil\n}", "title": "" }, { "docid": "9ecfdd06c3ab1e5c8ec87ff29a3905c9", "score": "0.5553891", "text": "func NewAccount(userId int, balance int) *Account {\n\treturn &Account{\n\t\tTransactions: make([]*Transaction, 0),\n\t\tUserId: userId,\n\t\tBalance: balance,\n\t}\n}", "title": "" }, { "docid": "3f4c5983eaa2c446f8b764d31be591ae", "score": "0.555282", "text": "func NewAccount(client *rpcplus.Client) *Account {\n\treturn &Account{\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "63e5cb30ae308b94cf2d30bf099577cb", "score": "0.55523443", "text": "func NewAccount(document Document, creditLimit AvailableCreditLimit) Account {\n\treturn &account{\n\t\tid: NewID(),\n\t\tcreatedAt: NewDate(),\n\t\tdocument: document,\n\t\tavailableCreditLimit: creditLimit,\n\t}\n}", "title": "" }, { "docid": "756dd1ea4a3f9139d6d77cbd2d1473f2", "score": "0.5540082", "text": "func (c *Client) NewGetAccountsRequest(ctx context.Context, path string, creatorPubkey *string, isCommitted *bool) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\tvalues := u.Query()\n\tif creatorPubkey != nil {\n\t\tvalues.Set(\"creator_pubkey\", *creatorPubkey)\n\t}\n\tif isCommitted != nil {\n\t\ttmp22 := strconv.FormatBool(*isCommitted)\n\t\tvalues.Set(\"is_committed\", tmp22)\n\t}\n\tu.RawQuery = values.Encode()\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "9e96ca584d51c332f667c5fea3004ab0", "score": "0.55343336", "text": "func NewCreateUserRequest(name string, email string, age int) (CreateUserRequest, error) {\n\n\tvar request CreateUserRequest\n\tvar err error\n\n\tif len(name) == 0 || len(email) == 0 || age <= 0 {\n\t\terr = errors.New(\"NewCreateUserRequest called without requested parameter\")\n\n\t} else {\n\t\trequest = createUserRequest{\n\t\t\tname: name,\n\t\t\temail: email,\n\t\t\tage: age,\n\t\t}\n\t}\n\n\treturn request, err\n}", "title": "" }, { "docid": "f6f054190d32c776d9d3fa0546572e71", "score": "0.55337596", "text": "func (mr *MockMeyCoinRPCServiceClientMockRecorder) CreateAccount(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, \"CreateAccount\", reflect.TypeOf((*MockMeyCoinRPCServiceClient)(nil).CreateAccount), varargs...)\n}", "title": "" }, { "docid": "24b5a49ae65cbc3ae87b94dca53d2847", "score": "0.5532423", "text": "func (c *Client) NewShowAccountRequest(ctx context.Context, path string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "f8614691611abfd5bb3ac12d04a05e4b", "score": "0.5529835", "text": "func NewAccount(name string, bal *big.Int) (*Account, error) {\n\tpriv, err := crypto.GenerateKey()\n\tif err != nil {\n\t\tfmt.Println(\"COULD NOT GENERATE PRIVATE KEY FOR: \", name)\n\t\treturn nil, err\n\t}\n\n\ttopt := bind.NewKeyedTransactor(priv)\n\ttopt.Nonce = big.NewInt(0)\n\ttopt.GasLimit = 21000\n\tvar ok bool\n\ttopt.GasPrice, ok = new(big.Int).SetString(\"10\", 10)\n\tif !ok {\n\t\treturn nil, errors.New(\"setting string\")\n\t}\n\n\treturn &Account{\n\t\tName: name,\n\t\tAddress: topt.From,\n\t\tTxOpts: topt,\n\t\tBalance: bal,\n\t\tPrivKey: priv,\n\t\tNonce: big.NewInt(0),\n\t}, nil\n}", "title": "" }, { "docid": "bc685eef512ae091f980e33a60acbb52", "score": "0.55232173", "text": "func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) {\n\t// TODO: port\n\treturn common.Address{}, nil\n}", "title": "" }, { "docid": "ddd825f5bf2660a615725e20a8a76a99", "score": "0.5521565", "text": "func (s *loggingService) CreateAccount(ctx context.Context, accnt Account) (err error) {\n\tdefer func(begin time.Time) {\n\t\t_ = s.logger.Log(\n\t\t\t\"method\", \"create_account\",\n\t\t\t\"account_id\", accnt.AccountID,\n\t\t\t\"currency\", accnt.Currency,\n\t\t\t\"took\", time.Since(begin),\n\t\t\t\"err\", err,\n\t\t)\n\t}(time.Now())\n\n\treturn s.s.CreateAccount(ctx, accnt)\n}", "title": "" }, { "docid": "1db30613a8f35016533439bec82f8962", "score": "0.54918796", "text": "func CreateAccount(xpubs []chainkd.XPub, quorum int, alias string, acctIndex uint64, deriveRule uint8) (*Account, error) {\n\tif acctIndex >= HardenedKeyStart {\n\t\treturn nil, ErrAccountIndex\n\t}\n\n\tsigner, err := signers.Create(\"account\", xpubs, quorum, acctIndex, deriveRule)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err)\n\t}\n\n\tid := signers.IDGenerate()\n\treturn &Account{Signer: signer, ID: id, Alias: strings.ToLower(strings.TrimSpace(alias))}, nil\n}", "title": "" }, { "docid": "8dab16c3da7361311458fe8a79c96ef4", "score": "0.5488841", "text": "func CmdCreate() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"create <noobaa-account-name>\",\n\t\tShort: \"Create noobaa account\",\n\t\tRun: RunCreate,\n\t}\n\tcmd.Flags().Bool(\"allow_bucket_create\", true,\n\t\t\"Should this account be allowed to create new buckets\")\n\tcmd.Flags().String(\"default_resource\", \"\", \"Set the default resource, on which new buckets will be created\")\n\tcmd.Flags().Bool(\"nsfs_account_config\", false, \"This flag is for creating nsfs account\")\n\tcmd.Flags().Int(\"uid\", -1, \"Set the nsfs uid\")\n\tcmd.Flags().Int(\"gid\", -1, \"Set the nsfs gid\")\n\tcmd.Flags().String(\"new_buckets_path\", \"/\", \"Change the path where new buckets will be created\")\n\tcmd.Flags().Bool(\"nsfs_only\", true, \"Set if this account is used only for nsfs\")\n\treturn cmd\n}", "title": "" }, { "docid": "2972f940704063e92d3476eba4436116", "score": "0.54715395", "text": "func CreateCreateResourcePackageRequest() (request *CreateResourcePackageRequest) {\n\trequest = &CreateResourcePackageRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"BssOpenApi\", \"2017-12-14\", \"CreateResourcePackage\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "82d13ac15b227d6aa304624ca2ccf3e1", "score": "0.54690266", "text": "func NewAccount(id int) *Account {\n\treturn &Account{\n\t\tID: id,\n\t\tAvailable: apd.New(0, 0),\n\t\tBlocked: apd.New(0, 0),\n\t}\n}", "title": "" }, { "docid": "7e9a5cf277ba4bf1a0e3173a52d956a1", "score": "0.54576856", "text": "func CreateAccountCmd(cdc *wire.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"create-account password\",\n\t\tShort: \"create an account\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn errors.New(\"需要参数password\")\n\t\t\t}\n\n\t\t\tpassword := args[0]\n\t\t\tacc := slim.AccountCreate(password)\n\n\t\t\toutput, err := wire.MarshalJSONIndent(cdc, acc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Println(string(output))\n\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7a3fe63a01738b5622fcd3e41b0bac51", "score": "0.5454457", "text": "func NewAccount(username string, password Password) Account {\n\treturn Account{\n\t\tUsername: username,\n\t\tPassword: password,\n\t}\n}", "title": "" }, { "docid": "660207e228d08c110060af138dcd32e8", "score": "0.54508656", "text": "func NewAccount(address string) *Account {\n\t// Since an account's id is derived from the address an account\n\t// can be shared by multiple pool clients.\n\treturn &Account{\n\t\tUUID: AccountID(address),\n\t\tAddress: address,\n\t}\n}", "title": "" }, { "docid": "218f4d35a39527f1fedc9b6f0fe49183", "score": "0.5450497", "text": "func (ss *StellarService) CreateAccount() (*keypair.Full, error) {\n\tkp, err := keypair.Random()\n\tif err != nil {\n\t\tlog.Println(\"Unable to create a keypair for stellar network\")\n\t\treturn nil, err\n\t}\n\t// Create and fund the address on TestNet, using friendbot\n\t_, err = ss.client.Fund(kp.Address())\n\tif err != nil {\n\t\tlog.Println(\"Unable to fund an account for stellar network\")\n\t\treturn nil, err\n\t}\n\tlog.Println(\"Account created on stellar\")\n\tlog.Println(\"Seed:\", kp.Seed())\n\tlog.Println(\"Address:\", kp.Address())\n\treturn kp, nil\n}", "title": "" }, { "docid": "58631b0efbbdff014b22703d2c0b8cc6", "score": "0.5443818", "text": "func CreateCreateSubAccountPermissionRequest() (request *CreateSubAccountPermissionRequest) {\n\trequest = &CreateSubAccountPermissionRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cloudwf\", \"2017-03-28\", \"CreateSubAccountPermission\", \"cloudwf\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "fc64a4bab4d7525406bd1f8d058d0fd7", "score": "0.543202", "text": "func (a *CustomersApiService) CreateCustomerAccount(ctx _context.Context, customerID string, createAccount CreateAccount, localVarOptionals *CreateCustomerAccountOpts) (Account, *_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 Account\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/customers/{customerID}/accounts\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"customerID\"+\"}\", _neturl.QueryEscape(parameterToString(customerID, \"\")), -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{\"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.XRequestID.IsSet() {\n\t\tlocalVarHeaderParams[\"X-Request-ID\"] = parameterToString(localVarOptionals.XRequestID.Value(), \"\")\n\t}\n\tif localVarOptionals != nil && localVarOptionals.XUserID.IsSet() {\n\t\tlocalVarHeaderParams[\"X-User-ID\"] = parameterToString(localVarOptionals.XUserID.Value(), \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = &createAccount\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v Account\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "d6de791ca675858f9bc2db0153d79c1e", "score": "0.54291177", "text": "func (s *UserManager) CreateAccount() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar rb struct {\n\t\t\tUsername string `json:\"username\"`\n\t\t\tPassword string `json:\"password\"`\n\t\t}\n\n\t\tif err := httputil.ReadJSON(r, &rb); err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\ts.log.Warnf(\"CreateAccount request: %v\", err)\n\t\t\t}\n\n\t\t\thttputil.WriteJSON(w, r, http.StatusBadRequest, ErrMalformedRequest)\n\n\t\t\treturn\n\t\t}\n\n\t\tvar user User\n\t\tif ok := user.SetName(rb.Username); !ok {\n\t\t\thttputil.WriteJSON(w, r, http.StatusBadRequest, ErrBadUsernameFormat)\n\t\t\treturn\n\t\t}\n\n\t\tif err := user.SetPassword(rb.Password); err != nil {\n\t\t\thttputil.WriteJSON(w, r, http.StatusBadRequest, err)\n\t\t\treturn\n\t\t}\n\n\t\tif err := s.db.AddUser(user); err != nil {\n\t\t\tif err == ErrNameNotAllowed {\n\t\t\t\thttputil.WriteJSON(w, r, http.StatusForbidden, ErrNameNotAllowed)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ts.log.WithError(err).Errorf(\"Failed to create user %q account\", user.Name)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t\thttputil.WriteJSON(w, r, http.StatusOK, true)\n\t}\n}", "title": "" }, { "docid": "09c2a891f0b48b9975b88d83dbd70784", "score": "0.54194003", "text": "func CreateAccount (w http.ResponseWriter, r *http.Request) {\n\thealthCheck() // determine which server to use\n\tresp, err := http.Post(server + \"/createAccount\", \"application/x-www-form-urlencoded\", r.Body)\n\n\tif err != nil{\n\t\tlog.Println(err)\n\t}\n\tif resp.StatusCode == 200 && err == nil{\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil{\n\t\t\tlog.Println(err)\n\t\t}\n\t\tuser := string(body)\n\t\texpire := time.Now().Add(time.Hour * 24)\n\t\tcookie := http.Cookie{\n\t\t\tName:\t\t\"user\",\n\t\t\tValue:\t\tuser,\n\t\t\tExpires:\texpire,\n\t\t}\n\t\thttp.SetCookie(w, &cookie)\n\t\thttp.Redirect(w, r, \"/gameSelect\", 301)\n\t}else{\n\t\thttp.Redirect(w, r, \"/createError\", 301)\n\t}\n}", "title": "" }, { "docid": "addf23b787bfd3f5b18dff742af5f49b", "score": "0.54020065", "text": "func (c *AccountController) Post(ctx iris.Context) {\n\tvar account resources.Account\n\tctx.ReadJSON(&account)\n\tresponse := c.Service.Create(&account)\n\tctx.JSON(response)\n}", "title": "" }, { "docid": "cdb7d8ffb158a476aea57c83b235ec1b", "score": "0.5400432", "text": "func NewAccount(custID string) *Account {\n\treturn &Account{\n\t\tCustID: custID,\n\t}\n}", "title": "" }, { "docid": "e22d81ddc7deeaef596a193277cc04ba", "score": "0.53959244", "text": "func (a *Accounts) Create(provider xerogolang.IProvider, session goth.Session) (*Accounts, error) {\n\tadditionalHeaders := map[string]string{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/xml\",\n\t}\n\n\tbody, err := xml.MarshalIndent(a, \" \", \"\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccountResponseBytes, err := provider.Create(session, \"Accounts\", additionalHeaders, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn unmarshalAccount(accountResponseBytes)\n}", "title": "" }, { "docid": "2b896badd9b8867c4336c105230a8358", "score": "0.53951764", "text": "func NewAccount(plant, account string) string {\n\treturn fmt.Sprintf(\"%s:%s\", plant, account)\n}", "title": "" }, { "docid": "af7fa86ee30b07d29782e17453545b38", "score": "0.53858113", "text": "func (_Store *StoreTransactorSession) CreateAccount() (*types.RawTransaction, error) {\n\treturn _Store.Contract.CreateAccount(&_Store.TransactOpts)\n}", "title": "" }, { "docid": "f8e885a1e9d1be8e48670515cc5bb929", "score": "0.53777367", "text": "func (r *resource) new(c echo.Context) error {\n\t// Bind Account Payload\n\taccount := new(Account)\n\tif err := c.Bind(account); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, \"Couldn't bind JSON payload to account Struct\")\n\t}\n\n\t// Verify Data\n\tif !account.isValid() {\n\t\treturn c.JSON(http.StatusBadRequest, \"This account is invalid\")\n\t}\n\tif account.isBlacklisted() {\n\t\treturn c.JSON(http.StatusForbidden, \"This account is blacklisted\")\n\t}\n\n\t// Complete Creation Date and UUID\n\taccount.UUID = uuid.New().String()\n\taccount.CreatedAt = time.Now().Unix()\n\taccount.UpdatedAt = time.Now().Unix()\n\n\t// Create Account\n\tif err := r.db.create(account); err != nil {\n\t\tr.log.Error(\"Error updating account into MongoDB\")\n\t\tc.JSON(http.StatusNoContent, err.Error())\n\t}\n\treturn c.JSON(http.StatusOK, account)\n}", "title": "" }, { "docid": "3855ba4121f34cc2b239858a53c1b0e9", "score": "0.53776103", "text": "func (h *apiHandler) CreateAccountHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Body == nil {\n\t\t\th.fail(w, errors.New(\"no body detected\"), http.StatusBadRequest, \"CreateAccountHandler\")\n\t\t\treturn\n\t\t}\n\n\t\tvar accountRequest handler.AccountRequest\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tif h.fail(w,\n\t\t\terrutil.Wrap(decoder.Decode(&accountRequest), \"decode failed\"),\n\t\t\thttp.StatusBadRequest, \"CreateAccountHandler\") {\n\n\t\t\treturn\n\t\t}\n\n\t\taccount, err := h.accountManager.AccountBuilder().\n\t\t\tSetUID(accountRequest.UID).\n\t\t\tSetCurrency(accountRequest.Currency).\n\t\t\tSetBalance(accountRequest.Balance).\n\t\t\tBuild(r.Context())\n\t\tif h.fail(w,\n\t\t\terrutil.Wrap(err, \"failed to create account\"),\n\t\t\thttp.StatusInternalServerError, \"CreateAccountHandler\") {\n\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\th.writeResponse(w, account)\n\t})\n}", "title": "" }, { "docid": "afc5c20f429a4b2f0ceaf3643cfec59a", "score": "0.5367169", "text": "func CreateGetUserSourceAccountRequest() (request *GetUserSourceAccountRequest) {\n\trequest = &GetUserSourceAccountRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cr\", \"2016-06-07\", \"GetUserSourceAccount\", \"/users/sourceAccount\", \"cr\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "title": "" }, { "docid": "3d755d70887c700a49af416c60acfb88", "score": "0.53660125", "text": "func NewControllersCreateAccountRequestWithDefaults() *ControllersCreateAccountRequest {\n\tthis := ControllersCreateAccountRequest{}\n\treturn &this\n}", "title": "" }, { "docid": "1211ca49e5bf35565b4c7ac8d33e0493", "score": "0.53553855", "text": "func (*AccountCreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_account_creation_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
0ad7235b7979ffff7a7a0a7e8da7e93d
HasUpperCase returns true if string has an uppercase letter
[ { "docid": "221795ba4cec8f7f13c0420809e09c11", "score": "0.87200165", "text": "func HasUpperCase(str string) bool {\n\tfor _, r := range str {\n\t\tif unicode.IsUpper(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" } ]
[ { "docid": "2639a332443f28da734338c785167716", "score": "0.78621763", "text": "func (s StringValue) IsUpperCase() bool {\n\treturn s.IsEqualTo(strings.ToUpper(s.value))\n}", "title": "" }, { "docid": "4c255ba0ded3e78b0f9050825eb9896b", "score": "0.7782568", "text": "func IsUppercase(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\treturn strings.ToUpper(s) == s\n}", "title": "" }, { "docid": "f7d62e2d180500783617bb6c497065a1", "score": "0.7761675", "text": "func IsUpper(str string) bool {\n\thasCased := false\n\tfor _, x := range str {\n\t\tisUpper, isLower := unicode.IsUpper(x), unicode.IsLower(x)\n\t\tif isUpper || isLower {\n\t\t\thasCased = true\n\t\t\tif isLower {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn hasCased\n}", "title": "" }, { "docid": "c4260bddd91c3b1a9a1fcce4d344f851", "score": "0.7686175", "text": "func IsUpper(s string) bool {\n\tisupper := false\n\n\tfor _, r := range s {\n\t\tif unicode.IsUpper(r) {\n\t\t\tisupper = true\n\t\t} else if !unicode.IsSpace(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn isupper\n}", "title": "" }, { "docid": "563dd6ba4aff8de565fdc1610fa9165a", "score": "0.75190115", "text": "func IsUpper(str string) bool {\n\tfor i := range str {\n\t\tascii := int(str[i])\n\t\tif !(ascii > 64 && ascii < 91) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6c64ca2a888bd7658a187d5817dc699b", "score": "0.7421309", "text": "func isCapitalized(s string) bool {\n\tch, _ := utf8.DecodeRuneInString(s)\n\treturn unicode.IsUpper(ch)\n}", "title": "" }, { "docid": "dba6e77cc2f9e757dcb911f07a3ecca7", "score": "0.7379284", "text": "func IsUpper(r rune) bool {\n\treturn is(upper, r)\n}", "title": "" }, { "docid": "a0164a54ad81fa45537e5d41b00122c9", "score": "0.7355899", "text": "func isUpper(ch rune) bool {\n\treturn ch >= 'A' && ch <= 'Z'\n}", "title": "" }, { "docid": "272be7408bdc4aa8dcdbe33970c32215", "score": "0.731745", "text": "func isUpper(r rune) bool {\n\treturn r <= 'Z' && r >= 'A'\n}", "title": "" }, { "docid": "ebc7a8f14aba1da2132b105a78d63c11", "score": "0.7078595", "text": "func IsCapitalized(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tr, _ := utf8.DecodeRuneInString(s)\n\treturn isUpper(r)\n}", "title": "" }, { "docid": "2939c8f32fcf1b15202d9e5fd845d68a", "score": "0.70441324", "text": "func IsCapitalized(n string) (ret bool) {\n\tfor _, r := range n {\n\t\tret = unicode.IsUpper(r)\n\t\tbreak\n\t}\n\treturn\n}", "title": "" }, { "docid": "797b2478ae2d059218a3e28490c462b5", "score": "0.69441867", "text": "func isAllUpper(remark string) (allUpper bool) {\n\tprintln(remark)\n\tfor _, c := range remark {\n\t\tif 'A' <= c && c <= 'Z' {\n\t\t\tallUpper = true\n\t\t} else if 'a' <= c && c <= 'z' {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "dde6b7743e801b0131a9b32616ff3cd2", "score": "0.69150895", "text": "func IsLetterUpper(b byte) bool {\n\tif b >= byte('A') && b <= byte('Z') {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1e863e676d70389031d8cf2728f6ff97", "score": "0.6848403", "text": "func IsUpperByte(str []byte) bool {\n\tfor i := range str {\n\t\tascii := str[i]\n\t\tif !(ascii > 64 && ascii < 91) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d6548cb55137154ac04d8a9bee26e530", "score": "0.68151593", "text": "func IsUpperSnakeCase(s string) bool {\n\tif s == \"\" || s[0] == '_' || s[len(s)-1] == '_' {\n\t\treturn false\n\t}\n\tfor _, r := range s {\n\t\tif !(isUpper(r) || isDigit(r) || r == '_') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "67439033d1ca120f7aefc7d3a8518ce6", "score": "0.6688765", "text": "func IsUpperPrefix(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tin := []rune(s)\n\treturn unicode.IsUpper(in[0])\n}", "title": "" }, { "docid": "05dbfa5e5644178a8a7a4183257201b3", "score": "0.66862434", "text": "func (s StringValidators) IsUpper() Validator {\n\treturn func() error {\n\t\tif s.Value == nil {\n\t\t\treturn Error(ErrStringIsUpper, nil)\n\t\t}\n\t\tfor _, r := range *s.Value {\n\t\t\tif !unicode.IsUpper(r) {\n\t\t\t\treturn Error(ErrStringIsUpper, *s.Value)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d2fc03d3b9e637c7961395985c1801eb", "score": "0.6548825", "text": "func UnicharIsupper(c rune) bool {\n\tc_c := (C.gunichar)(c)\n\n\tretC := C.g_unichar_isupper(c_c)\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "f867d500732aa96e5fb55cee022e02e9", "score": "0.6541216", "text": "func (o RandomStringOutput) Upper() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *RandomString) pulumi.BoolOutput { return v.Upper }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "a5e62bb18bd756db70b1b4bccee655b4", "score": "0.6537344", "text": "func ToUpper(s string) string", "title": "" }, { "docid": "a5e62bb18bd756db70b1b4bccee655b4", "score": "0.6537344", "text": "func ToUpper(s string) string", "title": "" }, { "docid": "549a7cd9ff8ec77e9a42bfe6697dfa0d", "score": "0.63434565", "text": "func IsUpperUnsafe(r rune) bool {\n\treturn isUnsafe(upper, r)\n}", "title": "" }, { "docid": "dfbdf47a3493673bdf440d4aa7b81e69", "score": "0.6306663", "text": "func capitalizedWord(word string, sugs []string) bool {\n\tif len(sugs) == 1 {\n\t\treturn strings.ToLower(sugs[0]) == word\n\t}\n\treturn false\n}", "title": "" }, { "docid": "75f866d49d602784bb2c7a5b7e178702", "score": "0.6280245", "text": "func IsASCIIUpper(r rune) bool {\n\treturn IsASCII(r) && unicode.IsUpper(r)\n}", "title": "" }, { "docid": "9c99ec470237766fc9685b1d4866a33f", "score": "0.6122738", "text": "func IsFirstAlphaUpper(s string) bool {\n\tif rxFirstAlphaUpper.MatchString(s) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "240efa49db03947401d306f04a7a3f3b", "score": "0.6104635", "text": "func isAllCaps(s string) bool {\n\tfor _, r := range s {\n\t\tif unicode.IsLetter(r) && !unicode.IsUpper(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "952a580a7b97195743fd28a5198c9a8f", "score": "0.59890836", "text": "func ToUpperSpecial(_case unicode.SpecialCase, s string) string", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.59842247", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.59842247", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.59842247", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.59842247", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "1802502637f84d90058a9631b665c186", "score": "0.59842247", "text": "func isExported(name string) bool {\n\trune, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(rune)\n}", "title": "" }, { "docid": "fa4162bb92cd5c6eeb76166eb0396c6c", "score": "0.5916937", "text": "func IsCamelCase(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tfor _, c := range s {\n\t\tif !(isLetter(c) || isDigit(c)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "868b1abd016a20088d113c3681a72930", "score": "0.58924806", "text": "func Upper(s string) string {\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "49c948fe6f409fb6e020246c87d9d6ed", "score": "0.58644474", "text": "func (t *Token) StartsUpper() bool {\n\tif len(t.runes) == 0 {\n\t\treturn false\n\t}\n\treturn unicode.IsUpper(t.runes[0])\n}", "title": "" }, { "docid": "89c5570cf9f7d207e1e3d4b1f9454bb4", "score": "0.58473593", "text": "func ToUpperCase(s string) string {\n\tif !utf8.ValidString(s) {\n\t\treturn s\n\t}\n\ts = strings.TrimFunc(s, unicode.IsSpace)\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "2c08b475ae4c026f0b974d86e450fe29", "score": "0.5787291", "text": "func IsAllCaps(remark string) bool {\n\tre := regexp.MustCompile(`[A-Za-z]`)\n\tcharCount := len(re.FindAll([]byte(remark), -1))\n\t\n\tif strings.ToUpper(remark) == remark && charCount > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "13a6c49bec67701c782aa427532b7653", "score": "0.57064366", "text": "func IsNuc(base rune) bool {\n\tbases := \"ATGC\"\n\treturn strings.ContainsRune(bases, unicode.ToUpper(base))\n}", "title": "" }, { "docid": "71df4770bec5d07370069e7f7852aa22", "score": "0.5691805", "text": "func upperCase(v string) (string, error) {\n\treturn strings.ToUpper(v), nil\n}", "title": "" }, { "docid": "3e90dff3551c6e779141c3c797b26f94", "score": "0.56897545", "text": "func IsExported(name string) bool {\n\tch, _ := utf8.DecodeRuneInString(name)\n\treturn unicode.IsUpper(ch)\n}", "title": "" }, { "docid": "adbdafe4a27b008bcc5a90fa3871039b", "score": "0.56654066", "text": "func (StringSrv) Uppercase(ctx context.Context, s string) (string, error) {\n\tif s == \"\" {\n\t\treturn \"\", ErrEmpty\n\t}\n\n\treturn strings.ToUpper(s), nil\n}", "title": "" }, { "docid": "05d1134093831d0ebb2959e2f4b0ee46", "score": "0.5656361", "text": "func allCaps(remark string) bool {\n\tm, _ := regexp.Match(\"[a-z]\", []byte(remark))\n\tM, _ := regexp.Match(\"[A-Z]\", []byte(remark))\n\treturn !m && M\n}", "title": "" }, { "docid": "8532238567b1127e18cd2af8b9a6f945", "score": "0.5637514", "text": "func (edit Editor) ToUpperCase() {\n\tedit.Call(\"toUpperCase\")\n}", "title": "" }, { "docid": "e4ed51745268c1cfb6c81fe03e2f4e04", "score": "0.5635529", "text": "func ToUpperSpecial(c unicode.SpecialCase, s string) string", "title": "" }, { "docid": "d3a6b97733204e40058520d40f37f70d", "score": "0.557914", "text": "func (SimpleStringService) Uppercase(s string) (string, error) {\n\tif s == \"\" {\n\t\treturn \"\", ErrEmpty\n\t}\n\treturn strings.ToUpper(s), nil\n\n}", "title": "" }, { "docid": "0c7b415cdbc6b2737e73c8192cd9bcfb", "score": "0.5562457", "text": "func hasRemovedCharAfterRemovedVowels(abbr string, word string) bool {\n\tif abbr == \"\" {\n\t\treturn false\n\t}\n\n\treturn hasRemovedChar(abbr, removeVowels(strings.ToLower(word)))\n}", "title": "" }, { "docid": "f08639c3a870aeddf857e01a616a9b96", "score": "0.5442005", "text": "func Upper(str cty.Value) (cty.Value, error) {\n\treturn UpperFunc.Call([]cty.Value{str})\n}", "title": "" }, { "docid": "f41bda28fe3de9ffbe981939244b649b", "score": "0.5436115", "text": "func (ms MyString) Uppercase() string {\n\t// need to cast MyString to string again\n\t// as ToUpper method only accepts string type\n\treturn strings.ToUpper(string(ms))\n}", "title": "" }, { "docid": "86cd6b1463eecf74e39458f221b2bcaa", "score": "0.54309106", "text": "func isYelling(remark string) bool {\n\tmatched, _ := regexp.Match(`[A-Za-z]`, []byte(remark))\n\treturn matched && strings.ToUpper(remark) == remark\n}", "title": "" }, { "docid": "463f954592e89154dbe4654132f6f2bd", "score": "0.5419979", "text": "func HasLetter(s string) bool {\n\tfor _, r := range s {\n\t\tif unicode.IsLetter(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a82e12049e64b3cdc816c0f6364ac526", "score": "0.5403677", "text": "func (c *caseState) isLowerUpper() bool {\n\t// for an Upper Lower sequence the deltas have to be in order\n\t//\tc: -1 0 -1\n\tswitch {\n\tcase c.deltaToUpper != -1:\n\t\treturn false\n\tcase c.deltaToLower != 0:\n\t\treturn false\n\tcase c.deltaToTitle != -1:\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7363b4164bac050eb730923c77463f67", "score": "0.5375597", "text": "func (s *UpdateAccountPasswordPolicyInput) SetRequireUppercaseCharacters(v bool) *UpdateAccountPasswordPolicyInput {\n\ts.RequireUppercaseCharacters = &v\n\treturn s\n}", "title": "" }, { "docid": "dfbfb3d1c3d78acb7cdaf448a0c7346d", "score": "0.5348405", "text": "func ToUpper(str string) string {\n\ts, _ := to(unicode.ToUpper, str)\n\treturn s\n}", "title": "" }, { "docid": "93db97ddf3d8b996ca472499c99a4dc6", "score": "0.5332837", "text": "func NewUpper() *StringProcessor { return NewStringProcessor(\"Upper\", strings.ToUpper) }", "title": "" }, { "docid": "4bd12f9e27ac0c31ceba2833cc2a05a5", "score": "0.53254545", "text": "func Command_ToUpper(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 1 {\n\t\trex.ErrorParamCount(\"str:toupper\", \"1\")\n\t}\n\n\tscript.RetVal = rex.NewValueString(strings.ToUpper(params[0].String()))\n}", "title": "" }, { "docid": "cfcb06a66e5977105974e89a21bb03af", "score": "0.53242064", "text": "func ToUpper(s string) string\t{ return Map(unicode.ToUpper, s) }", "title": "" }, { "docid": "d04afcbf7bb2ecc1f173eb0920b53204", "score": "0.5315795", "text": "func IsIsogram(word string) bool {\n\tvar seen []rune\n\n\tfmt.Printf(\"Testing word: '%v' \\n\", word)\n\n\tfor _, r := range word {\n\t\tif unicode.IsLetter(r) {\n\t\t\tif contains(seen, unicode.ToUpper(r)) {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\tseen = append(seen, unicode.ToUpper(r))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "6b48dcb0caa95c065404e706dbfd98f8", "score": "0.52960324", "text": "func isYelling(remark string) bool {\n\tletters := 0\n\tfor _, r := range remark {\n\t\tif unicode.IsLetter(r) {\n\t\t\tletters++\n\t\t\tif !unicode.IsUpper(r) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn letters > 0\n}", "title": "" }, { "docid": "cc2574908e5e1038b2b7203b643b583a", "score": "0.52938646", "text": "func TestValidator_Validate_NoUppercase_Invalid(t *testing.T) {\n\tval := NewValidator()\n\n\tpass := \"test45?%67&\"\n\tassert.False(t, val.Validate(pass), \"The password should be invalid\")\n}", "title": "" }, { "docid": "baee44243930d9716ae22e4ffed7e73f", "score": "0.52903706", "text": "func isPalindrome(input string) bool {\n\treturn strings.ToUpper(input) == reversed(strings.ToUpper(input))\n}", "title": "" }, { "docid": "3dfb830b15ce494526608854e50b06b0", "score": "0.5290114", "text": "func supportedString(strFunc string) bool {\n\treturn format.StringInSlice(strings.ToUpper(strFunc), []string{\"TRIM\", \"SUBSTRING\", \"CHAR_LENGTH\", \"CHARACTER_LENGTH\", \"LOWER\", \"UPPER\"})\n}", "title": "" }, { "docid": "d0ec2b63fb8425f1c39958fbb9f06900", "score": "0.527039", "text": "func (c *caseState) isUpperLower() bool {\n\t// for an Upper Lower sequence the deltas have to be in order\n\t//\tc: 0 1 0\n\tswitch {\n\tcase c.deltaToUpper != 0:\n\t\treturn false\n\tcase c.deltaToLower != 1:\n\t\treturn false\n\tcase c.deltaToTitle != 0:\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d0fe176ee7486160247c29657308c5b9", "score": "0.525176", "text": "func isExported(symbol string) bool {\n\tparts := strings.Split(symbol, \".\")\n\tif len(parts) == 1 {\n\t\treturn unicode.IsUpper(rune(symbol[0]))\n\t}\n\treturn unicode.IsUpper(rune(parts[1][0]))\n}", "title": "" }, { "docid": "7eb6218ca8d50de0a8e81e764c062b8d", "score": "0.5237043", "text": "func (s *PasswordPolicy) SetRequireUppercaseCharacters(v bool) *PasswordPolicy {\n\ts.RequireUppercaseCharacters = &v\n\treturn s\n}", "title": "" }, { "docid": "45059a0a2b45b08994d66b92bb0b1dac", "score": "0.5213446", "text": "func isAlphabet(s string) bool {\n\tif len(s) == utf8.RuneCountInString(s) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3b84691883c880118aba31b4ec4d2007", "score": "0.52113056", "text": "func capitalize(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tr, n := utf8.DecodeRuneInString(s)\n\n\treturn string(unicode.ToUpper(r)) + s[n:]\n}", "title": "" }, { "docid": "5634c0c2c5c6624d779b326c74776942", "score": "0.52006066", "text": "func toUpper(s string, args ...string) string {\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "5634c0c2c5c6624d779b326c74776942", "score": "0.52006066", "text": "func toUpper(s string, args ...string) string {\n\treturn strings.ToUpper(s)\n}", "title": "" }, { "docid": "4d524ebd7641a16d055d006c48006765", "score": "0.51854634", "text": "func (str *String) EndsWith(s string) bool {\n\treturn str.SubstringBegin(str.Len()-len(s)).ToString() == s\n}", "title": "" }, { "docid": "694a36ca23c47420621516c6c3ed5e9a", "score": "0.5185362", "text": "func (str *String) ContainsIgnoreCase(chars string) bool {\n\treturn str.ToLower().Contains(strings.ToLower(chars))\n}", "title": "" }, { "docid": "571b6a116d4cb437e751de284955afde", "score": "0.518158", "text": "func (vl VerbLevel) Upper() string {\n\treturn strings.ToUpper(vl.Name())\n}", "title": "" }, { "docid": "3d889956ba5b730cceda3b61b6ed6983", "score": "0.5174032", "text": "func (cu *CharacterUtils) ToUpperCase(buffer []rune) {\n\tfor i, v := range buffer {\n\t\tbuffer[i] = unicode.ToUpper(v)\n\t}\n}", "title": "" }, { "docid": "abedc5e9335b51314e1cce92976d3346", "score": "0.5171915", "text": "func (ob StringsModule) ToUpper(s string) string {\n\treturn _strings.ToUpper(s)\n}", "title": "" }, { "docid": "f0d89d72352c866b560146a45e74b856", "score": "0.5170828", "text": "func isLetter(letter byte) bool {\n\tisCapital := letter <= upperLetterIndexCap && letter >= lowerLetterIndexCap\n\tisSmall := letter <= upperLetterIndexSmall && letter >= lowerLetterIndexSmall\n\n\tif !isCapital && !isSmall {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5e3e3969f3ea0b0e37d2be395f51c648", "score": "0.5167143", "text": "func toAllUpperCase(word string) string {\n\tbuffer := new(bytes.Buffer)\n\tfor i := 0; i < len(word); i++ {\n\t\tbuffer.WriteRune(unicode.ToUpper(rune(word[i])))\n\t\tif (i < len(word)-1) && unicode.IsLower(rune(word[i])) && unicode.IsUpper(rune(word[i+1])) {\n\t\t\tbuffer.WriteByte('_')\n\t\t}\n\t}\n\treturn buffer.String()\n}", "title": "" }, { "docid": "1156c73695ccd11ff7a465835939a8ae", "score": "0.51568234", "text": "func HasEndst(word string) bool {\n\ts := strings.HasSuffix(word, \"s\")\n\tt := strings.HasSuffix(word, \"t\")\n\n\tif s == true || t == true {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "13a3d9b48c30eb2745017cdd82207c52", "score": "0.5145487", "text": "func capitalize(s string) string {\n\tstr := utf8string.NewString(s)\n\tif str.RuneCount() == 0 {\n\t\treturn \"\"\n\t}\n\tvar b strings.Builder\n\tb.WriteString(strings.ToUpper(string(str.At(0))))\n\tb.WriteString(str.Slice(1, str.RuneCount()))\n\treturn b.String()\n}", "title": "" }, { "docid": "26ef5b53853920823871923cea15a7b9", "score": "0.5142646", "text": "func ContainsFold(a, b string) bool {\n\treturn strings.Contains(strings.ToUpper(a), strings.ToUpper(b))\n}", "title": "" }, { "docid": "0fabbc9e46e97a205276037d3a21b65a", "score": "0.51378816", "text": "func capitalize(s string) string {\n\treturn strings.ToUpper(string(s[0])) + string(s[1:])\n}", "title": "" }, { "docid": "6fa8d6d5709dd86f7a0f398ee5082859", "score": "0.5129052", "text": "func capitalize(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\treturn strings.ToUpper(s[:1]) + s[1:]\n}", "title": "" }, { "docid": "efbd8229d044da12b158cf0f097a9db7", "score": "0.5127063", "text": "func IsIsogram(input string) bool {\n\n\tinput = strings.ToUpper(input)\n\tfor i, char := range input {\n\t\tif !unicode.IsLetter(char) {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(input[:i], string(char)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b89dbe92cdf65b4dcc4b4e11e8926aa2", "score": "0.5109706", "text": "func isYelling(remark string) bool {\n\treturn strings.ToUpper(remark) == remark\n}", "title": "" }, { "docid": "29d8b6e55995449fc10419ec526fcc6b", "score": "0.5107221", "text": "func ToUpperCamelCase(s string) string {\n\toutput := \"\"\n\tvar previous rune\n\tfor i, c := range strings.TrimSpace(s) {\n\t\tif !isDelimiter(c) {\n\t\t\tif i == 0 || isDelimiter(previous) || isUpper(c) {\n\t\t\t\toutput += string(unicode.ToUpper(c))\n\t\t\t} else {\n\t\t\t\toutput += string(unicode.ToLower(c))\n\t\t\t}\n\t\t}\n\t\tprevious = c\n\t}\n\treturn output\n}", "title": "" }, { "docid": "4925b838359391e8ab96522dd9ff48b8", "score": "0.5103833", "text": "func caseInsensitive(s, substr string) bool {\n\ts, substr = strings.ToUpper(s), strings.ToUpper(substr)\n\treturn strings.Contains(s, substr)\n}", "title": "" }, { "docid": "a25a30585ac466ffffe782501e1e039c", "score": "0.50763613", "text": "func checkString(c string) bool {\n\tIsLetter := regexp.MustCompile(`^[a-zA-Z]+$`).MatchString\n\tif !IsLetter(c) && c != \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "faac6ce3e624bae26fb184ece3a2357e", "score": "0.50622886", "text": "func isLetter(s string) bool {\n\treturn s == \"a\" || s == \"b\" || s == \"c\" || s == \"d\" || s == \"e\" || s == \"f\" || s == \"g\" || s == \"h\"\n}", "title": "" }, { "docid": "28a8cae1a53f7c06523b5c2eace5bf32", "score": "0.5052708", "text": "func containsLetter(remark string) bool {\n\tfor _, r := range remark {\n\t\tif (r > 'A' && r < 'Z') || (r > 'a' && r < 'z') {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d4086170586b1caa0254412cfcd584c4", "score": "0.5051206", "text": "func IsWord(inputStr string) bool {\n\tfor _, ch := range inputStr {\n\t\tif !unicode.IsLetter(ch) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ae65099381d8262979c8dd8a701bb1d3", "score": "0.50450456", "text": "func IsCamelCase(input string) bool {\n\tif !rxCamelCase.MatchString(input) {\n\t\treturn false\n\t}\n\tm := rxCamelCaseIdSuffix.FindStringSubmatch(input)\n\tif len(m) == 2 {\n\t\tif m[1] != \"Id\" {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a7ed9a4bb55ef5c546c48f5ad29ed3fe", "score": "0.50406265", "text": "func HasSuffix(s, suffix string) bool", "title": "" }, { "docid": "a7ed9a4bb55ef5c546c48f5ad29ed3fe", "score": "0.50406265", "text": "func HasSuffix(s, suffix string) bool", "title": "" }, { "docid": "5a9024bce9db2657bb769cde0cb4dec7", "score": "0.50364226", "text": "func (MyHero Avenger) UpperCase() string {\n\n\t// Notice how we drill down the custom object's (struct) field using the dot notaton:\n\treturn strings.ToUpper(MyHero.SuperHeroName)\n}", "title": "" }, { "docid": "06900ef056fd7d8fde4fe7936cdbe5e9", "score": "0.50358367", "text": "func isLetter(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') }", "title": "" }, { "docid": "06900ef056fd7d8fde4fe7936cdbe5e9", "score": "0.50358367", "text": "func isLetter(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') }", "title": "" }, { "docid": "a5f96d964e1f64dd821c3dd2f005859c", "score": "0.5031767", "text": "func (o ApplicationSettingsOutput) PasswordUppercaseRequired() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *ApplicationSettings) pulumi.BoolOutput { return v.PasswordUppercaseRequired }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "3acde5babfe2cfd6938b70240d6bd542", "score": "0.49929383", "text": "func HasCyr(s string) bool {\n\treturn strings.ContainsAny(s, cyr)\n}", "title": "" }, { "docid": "da108e8870b092dfe563d430e3c79043", "score": "0.49866638", "text": "func isTest(name, prefix string) bool {\n\tif !strings.HasPrefix(name, prefix) {\n\t\treturn false\n\t}\n\tif len(name) == len(prefix) { // \"Test\" is ok\n\t\treturn true\n\t}\n\trune, _ := utf8.DecodeRuneInString(name[len(prefix):])\n\treturn !unicode.IsLower(rune)\n}", "title": "" }, { "docid": "da108e8870b092dfe563d430e3c79043", "score": "0.49866638", "text": "func isTest(name, prefix string) bool {\n\tif !strings.HasPrefix(name, prefix) {\n\t\treturn false\n\t}\n\tif len(name) == len(prefix) { // \"Test\" is ok\n\t\treturn true\n\t}\n\trune, _ := utf8.DecodeRuneInString(name[len(prefix):])\n\treturn !unicode.IsLower(rune)\n}", "title": "" }, { "docid": "7073b3f6748bc17511733010e94a3d4f", "score": "0.4978751", "text": "func (o *UserTag) HasIgnoreCase() bool {\n\tif o != nil && o.IgnoreCase != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "433916da4abc68f0be548292bbbb4f79", "score": "0.49687013", "text": "func DisplayUpper(x string) {\n\tfmt.Println(\"Original text: \", x)\n\tfmt.Println(\"Revised text: \", strings.ToUpper(x))\n}", "title": "" } ]
dd3b136bd5ea51663fedc74f80a727dc
SequenceNr returns a local sequence number of a request assigned by the machine that created the link. If not present, 0 is returned.
[ { "docid": "bca76278e700664527ab5d41f4db5d11", "score": "0.63941085", "text": "func (m *MetaData) SequenceNr() (uint64, error) {\n\tif m == nil {\n\t\treturn 0, errors.New(errors.KsiInvalidArgumentError)\n\t}\n\tif m.sequenceNr == nil {\n\t\treturn 0, nil\n\t}\n\treturn *m.sequenceNr, nil\n}", "title": "" } ]
[ { "docid": "46c3313dcbb060eb7c5c9ac1a51ac497", "score": "0.62137395", "text": "func SequenceNum() uint64 {\n\treturn atomic.AddUint64(&seq, 1)\n}", "title": "" }, { "docid": "a3f85a9cc1133df7a66fbbfa62a2c1d6", "score": "0.59453374", "text": "func (op *StellarStandalone) getSeqNumber(address string) error {\n\taccountRequest := horizonclient.AccountRequest{AccountID: address}\n\thAccount0, err := op.client.AccountDetail(accountRequest)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"seq number: %s\\n\", hAccount0.Sequence)\n\treturn nil\n}", "title": "" }, { "docid": "e0a57ab08802ee726b0949cb7f27baf4", "score": "0.5854981", "text": "func (m ResendRequest) GetBeginSeqNo() (v int, err quickfix.MessageRejectError) {\n\tvar f field.BeginSeqNoField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "cfc7e3942ffc57721c3500fc1a618eb1", "score": "0.5726172", "text": "func (r *CRecord) SequenceNumber() int {\n\treturn r.RecordSequenceNumber\n}", "title": "" }, { "docid": "9b3b74e1671f25ad77ea06a04133dd3b", "score": "0.562286", "text": "func getSeq(address []byte) (int, error) {\n\tif seqFlag >= 0 {\n\t\treturn seqFlag, nil\n\t}\n\n\thttpClient := client.NewHTTP(txNodeFlag, \"/websocket\")\n\tacc, err := getAccWithClient(httpClient, address)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn acc.Sequence + 1, nil\n}", "title": "" }, { "docid": "f15a5b86aa1f1e0a082070dbc58ff0a9", "score": "0.556579", "text": "func getSeq(c *cli.Context, address []byte) (int, error) {\n\tif c.IsSet(\"sequence\") {\n\t\treturn c.Int(\"sequence\"), nil\n\t}\n\ttmAddr := c.String(\"node\")\n\tacc, err := getAcc(tmAddr, address)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn acc.Sequence + 1, nil\n}", "title": "" }, { "docid": "668b0774f674f83472b229f7d37d4dcd", "score": "0.547453", "text": "func (p *PingState) GetSeqNo() int {\n\ts := p.SeqNo\n\tp.SeqNo++\n\t// reset sequence no if we go above a 32-bit value\n\tif p.SeqNo > 65535 {\n\t\tlogp.Debug(\"pingstate\", \"Resetting sequence number\")\n\t\tp.SeqNo = 0\n\t}\n\treturn s\n}", "title": "" }, { "docid": "271cc5036be90988ac31e6e9d5123030", "score": "0.54733086", "text": "func (bb *Controller) SeqNo() uint16 {\n\tbb.seqno++\n\treturn bb.seqno\n}", "title": "" }, { "docid": "4272836e18b804a7aec823d4a40ec0dd", "score": "0.5442012", "text": "func (p *FrameRequestStream) InitialRequestN() uint32 {\n\treturn binary.BigEndian.Uint32(p.body.Bytes())\n}", "title": "" }, { "docid": "9cd694faf7e3f6ff19a6f4eb9cbfb490", "score": "0.53941214", "text": "func seqFromConn(c net.Conn) uint64 {\n\tr := regexp.MustCompile(\"([0-9])+$\")\n\tstr := r.FindString(c.RemoteAddr().String())\n\tid, _ := strconv.ParseInt(str, 10, 32)\n\tlog.D(\"Generated sequence %v from connection %s\", id, c.RemoteAddr().String())\n\treturn uint64(id)\n}", "title": "" }, { "docid": "bc871a9902e1a10aa0a374c95fe3ec42", "score": "0.5355457", "text": "func (msg *CommitTransactionResponse) GetSequenceNo() int64 {\n\treturn msg.HeaderGetSequenceNo()\n}", "title": "" }, { "docid": "3a62df1727e12d522d8d63cac9704626", "score": "0.5346069", "text": "func (b *Batch) SeqNum() uint64 {\n\tif len(b.data) == 0 {\n\t\tb.init(batchHeaderLen)\n\t}\n\treturn binary.LittleEndian.Uint64(b.seqNumData())\n}", "title": "" }, { "docid": "67a7bfe9c172613354a0eccb7ef9d67e", "score": "0.53333914", "text": "func (sreq *SerialRequest) RequestID() string {\n\treturn sreq.HeaderString(\"request-id\")\n}", "title": "" }, { "docid": "6a5d58ea22b375426e55d7ed1377fb94", "score": "0.52954733", "text": "func (m NoApplIDs) GetRefApplLastSeqNum() (v int, err quickfix.MessageRejectError) {\n\tvar f field.RefApplLastSeqNumField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "2705e10cc451c22068c3b9fecfb620f5", "score": "0.5203041", "text": "func (req *jsonRequest) GetSeq() uint64 {\n\treturn req.Seq\n}", "title": "" }, { "docid": "87165d84097c79758dc30632651da179", "score": "0.5121675", "text": "func (lbr *LibreReader) SerialNumber() (string, error) {\n\tresps, err := lbr.text_command(\"$sn?\")\n\tif resps.ok {\n\t\treturn resps.text, err\n\t} else if err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"command failure\")\n\t}\n}", "title": "" }, { "docid": "459c64c28aa40992d3c097dc8f4e67c0", "score": "0.5109537", "text": "func (m NoApplIDs) GetApplBegSeqNum() (v int, err quickfix.MessageRejectError) {\n\tvar f field.ApplBegSeqNumField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "41cf2efca59a48ddc61a74f775e9d8a1", "score": "0.50598526", "text": "func (o TrackingInfoResponsePtrOutput) SerialNumber() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TrackingInfoResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SerialNumber\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3092064bb6a8187f8325b0776af3a2a8", "score": "0.50350183", "text": "func (c *NumberSequence) NextNo() (string, error) {\n\tdb, err := sqlx.Connect(settings.Settings.Database.DriverName, settings.Settings.GetDbConn())\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", err\n\t}\n\tdefer db.Close()\n\n\tsqlString := \"WITH UPDATED AS (UPDATE number_sequence SET current_no = current_no + 1 WHERE id = $1 RETURNING current_no)\" +\n\t\t\" SELECT current_no FROM UPDATED\"\n\n\terr = db.Get(c.CurrentNo, sqlString, c.ID)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn \"\", err\n\t}\n\tstartPos, endPos := c.getIntegerPos(c.FormatNo)\n\n\treturn c.replaceNoText(c.FormatNo, c.CurrentNo, 0, startPos, endPos)\n}", "title": "" }, { "docid": "f3e6de6275d2e0abe0ae42eae49f3446", "score": "0.5030069", "text": "func (t *Controller) RequestId() string {\n\treturn t.Ctx.GetString(REQUEST_ID)\n}", "title": "" }, { "docid": "0aeb82c6d20cdedc2d6a9bb53e4064e2", "score": "0.5013923", "text": "func (m Message) ApplSeqNum() (*field.ApplSeqNumField, quickfix.MessageRejectError) {\n\tf := &field.ApplSeqNumField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "545de18bfa822ad093d23a6d6851ec5e", "score": "0.5013123", "text": "func (n *Names) SequenceInt() int {\n\ts, err := strconv.Atoi(n.Sequence)\n\tif err != nil {\n\t\tfmt.Printf(\"Coudld not convert sequence '%s' to int\", n.Sequence)\n\t\treturn 0\n\t}\n\treturn s\n}", "title": "" }, { "docid": "6c62557cef7222c2bd2959ed88077a42", "score": "0.5000597", "text": "func NextRequestID() uint64 {\n\treturn atomic.AddUint64(&reqid, 1)\n}", "title": "" }, { "docid": "39d89d28cc5c96174f6d75a6a45f495f", "score": "0.49920425", "text": "func (r *Reply) RequestID() string {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\n\treturn r.Envelope.RequestID\n}", "title": "" }, { "docid": "7c841fa5fb4658eae57b37022681715e", "score": "0.49808633", "text": "func (r Rule) RequestRouteID() RouteID {\n\treturn RouteID(binary.BigEndian.Uint32(r[50:]))\n}", "title": "" }, { "docid": "9fb21b1edabff63e85744ad8fedf9679", "score": "0.49783197", "text": "func (r *req) nextID() uint32 {\n\t// The high order bit is \"special\", and must always be set. (This is\n\t// how the peer will detect the end of the backtrace.)\n\tv := r.nextid | 0x80000000\n\tr.nextid++\n\treturn v\n}", "title": "" }, { "docid": "4864c66ac928e9d1f783af0404db7317", "score": "0.4969196", "text": "func (p Packet) GetSequence() uint64 { return p.Sequence }", "title": "" }, { "docid": "302acfc7446be1d06fcdac87d775325a", "score": "0.49574077", "text": "func getSequenceNumberInternal(name, version, configFolder string) (uint, error) {\n\textensionKeyName := getExtensionKeyName(name, version)\n\tk, err := registry.OpenKey(registry.LOCAL_MACHINE, extensionKeyName, registry.QUERY_VALUE)\n\tif err != nil {\n\t\tif err == registry.ErrNotExist {\n\t\t\t// This may happen if the extension isn't installed. Return a uniform error indicating this.\n\t\t\treturn 0, extensionerrors.ErrNotFound\n\t\t}\n\n\t\treturn 0, fmt.Errorf(\"VmExtension: Cannot open sequence registry key due to '%v'\", err)\n\t}\n\tdefer k.Close()\n\n\tvalue, _, err := k.GetIntegerValue(sequenceNumberKeyName)\n\tif err != nil {\n\t\tif err == registry.ErrNotExist {\n\t\t\treturn 0, extensionerrors.ErrNotFound\n\t\t}\n\t\treturn 0, fmt.Errorf(\"VmExtension: Cannot read sequence registry key due to '%v'\", err)\n\t}\n\n\treturn uint(value), nil\n}", "title": "" }, { "docid": "70b6c47ca7143fc9a79e70f472f61a79", "score": "0.49557263", "text": "func (cm *Manager) Sequence() uint64 {\r\n\treturn cm.SequenceVal\r\n}", "title": "" }, { "docid": "cbd0da6bab6ea7c59fab76e69c292a2f", "score": "0.4944281", "text": "func (s *ReservedNodeNotFoundFault) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "07c97c7d13afa1d7ce3a3cc9483c918d", "score": "0.4938698", "text": "func (o AuthenticatedOriginPullsCertificateOutput) SerialNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AuthenticatedOriginPullsCertificate) pulumi.StringOutput { return v.SerialNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "791e9697b5bedca0bc413a468974f3c7", "score": "0.49146956", "text": "func (s *ServiceLinkedRoleNotFoundFault) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "a667a5d9d95c1a8e8a9c972fb70216fe", "score": "0.4912753", "text": "func (m NoApplIDs) GetApplEndSeqNum() (v int, err quickfix.MessageRejectError) {\n\tvar f field.ApplEndSeqNumField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "34f39500bec491b4a9003f3e3b970306", "score": "0.4907216", "text": "func (o ClusterNodeResponseOutput) SerialNumber() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ClusterNodeResponse) string { return v.SerialNumber }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ec52a822c2039b77f086be229c915823", "score": "0.48938257", "text": "func (o ProcessOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Process) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "70ef98bac62d14077c255666e52af394", "score": "0.48901674", "text": "func (m Message) GetApplSeqNum(f *field.ApplSeqNumField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "897d880e8b058331d1eaec642145f994", "score": "0.48889476", "text": "func (cm *DBConnectionManager) NextSequenceID(tableName string) (int64, error) {\n\tconn, err := cm.ConnectionByTableName(tableName)\n\tif err != nil {\n\t\treturn 0, errors.WithStack(err)\n\t}\n\tif conn.Sequencer == nil {\n\t\treturn 0, errors.WithStack(err)\n\t}\n\treturn conn.Adapter.NextSequenceID(conn.Sequencer, sequencerTableName(tableName))\n}", "title": "" }, { "docid": "d60a8b1ae6e6fc1cdf443e0dfbf510ad", "score": "0.48782575", "text": "func (h *Handler) RequestID(r *http.Request) uuid.UUID {\n\tlogCtx, ok := r.Context().Value(middlewares.RequestIDContextKey).(middlewares.RequestIDContext)\n\n\tif !ok {\n\t\treturn uuid.Nil\n\t}\n\n\treturn logCtx.ID\n}", "title": "" }, { "docid": "d51a5c71dd98f16d23f9d253084c8288", "score": "0.48677245", "text": "func getRequestID(r *http.Request) string {\n\tid := r.Header.Get(\"X-Request-ID\")\n\n\t// Sets a default for request id when it is not forwarded in the X-Request-ID header\n\tif id == \"\" {\n\t\treturn \"00000000-0000-0000-0000-000000000000\"\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "f3b4ac6aa38cbf41b081efcbca04cea7", "score": "0.48662606", "text": "func (r *Operation) LedgerSequence() int32 {\n\tid := toid.Parse(r.ID)\n\treturn id.LedgerSequence\n}", "title": "" }, { "docid": "c5d0a24c50d77596d100da3e9b57bacd", "score": "0.4852263", "text": "func (r *Response) RequestId() string {\n\n\tvar uuid uuid.UUID\n\tif r.RequestFrame != nil {\n\t\tuuid = r.RequestFrame.Uid\n\t} else {\n\t\tuuid = r.Frame.RequestUid\n\t}\n\treturn uuid.String()\n}", "title": "" }, { "docid": "36ef6cff25d152d8a482b449fbbf824c", "score": "0.48505306", "text": "func (o TrackingInfoResponseOutput) SerialNumber() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TrackingInfoResponse) *string { return v.SerialNumber }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "992d9e3a2be0c924c1640dfe84e2de09", "score": "0.48435223", "text": "func (b *Base) Seqno() Seqno {\n\treturn b.outer.Seqno\n}", "title": "" }, { "docid": "ea2c911886aa2ce323756405a2a54458", "score": "0.48408577", "text": "func (cm *DBConnectionManager) CurrentSequenceID(tableName string) (int64, error) {\n\tconn, err := cm.ConnectionByTableName(tableName)\n\tif err != nil {\n\t\treturn 0, errors.WithStack(err)\n\t}\n\tif conn.Sequencer == nil {\n\t\treturn 0, errors.WithStack(err)\n\t}\n\treturn conn.Adapter.CurrentSequenceID(conn.Sequencer, sequencerTableName(tableName))\n}", "title": "" }, { "docid": "4b63e368ff49a38e2d8c7bed6dc488d5", "score": "0.4828916", "text": "func (c *RPCClient) getSeq() uint64 {\n\treturn atomic.AddUint64(&c.seq, 1)\n}", "title": "" }, { "docid": "8fd83c3cdea7163ff79e6d767485886d", "score": "0.48276934", "text": "func (s *InvalidARNFault) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "dd795d24ebd3d322f5c7423c9699b8b2", "score": "0.48129624", "text": "func (m ResendRequest) GetEndSeqNo() (v int, err quickfix.MessageRejectError) {\n\tvar f field.EndSeqNoField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "c277c13d346a47374367b443b698fba9", "score": "0.48099753", "text": "func (o *RequestrouterInstance1) GetNodeId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.NodeId\n}", "title": "" }, { "docid": "1bf82e0eab5c13f2448b95aefb1f5c21", "score": "0.48087722", "text": "func (o *CloneCreateRequest) LunSerialNumber() string {\n\tvar r string\n\tif o.LunSerialNumberPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.LunSerialNumberPtr\n\treturn r\n}", "title": "" }, { "docid": "d6e30f1aead401ec0b68f89bf34fa12f", "score": "0.4800281", "text": "func (o *BankTransferMigrateAccountRequest) GetRoutingNumber() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RoutingNumber\n}", "title": "" }, { "docid": "0806b74d95d9054c20c3e77094c8826b", "score": "0.47960335", "text": "func (si SignedIdentifiers) RequestID() string {\n\treturn si.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "title": "" }, { "docid": "dc58080f74526d870819d037d55c2a31", "score": "0.47887993", "text": "func (m ResendRequest) SetBeginSeqNo(v int) {\n\tm.Set(field.NewBeginSeqNo(v))\n}", "title": "" }, { "docid": "2e2a7e6fe4cdd1528db4cde02a15ec3c", "score": "0.47847807", "text": "func (s *ReplicaNotFoundException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "03db78e300b2d917219d510f1bfbe93a", "score": "0.4760478", "text": "func (s *PendingVerification) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "03db78e300b2d917219d510f1bfbe93a", "score": "0.4760478", "text": "func (s *PendingVerification) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "f8e934f3cf31419121a364304e918aef", "score": "0.47552514", "text": "func (req *Request) RequestID() string {\n\treturn req.requestID\n}", "title": "" }, { "docid": "fb7a248afac59a7407a6aa918d2185a8", "score": "0.47532716", "text": "func (listener *Listener) Seq() (out uint32) {\n\tlistener.lock.Lock()\n\tlistener.currSeq++\n\tout = listener.currSeq\n\tlistener.lock.Unlock()\n\treturn\n}", "title": "" }, { "docid": "a65889c533d2b1d4e484b05c810b1bc6", "score": "0.47482988", "text": "func generateSerialNumber() (*big.Int, error) {\n\tlimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tsn, err := rand.Int(rand.Reader, limit)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error generating serial number\")\n\t}\n\treturn sn, nil\n}", "title": "" }, { "docid": "bc69917ec0d91b6584ca1631453bad07", "score": "0.47479677", "text": "func (d dialect) GetSequence(manager dsc.Manager, name string) (int64, error) {\n\tvar result = make([]interface{}, 0)\n\tsuccess, err := manager.ReadSingle(&result, fmt.Sprintf(sequenceSQL, name), []interface{}{}, nil)\n\tif err != nil || !success {\n\t\treturn 0, err\n\t}\n\tcount, _ := strconv.ParseInt(result[0].(string), 10, 64)\n\tseq := count + 1\n\treturn seq, nil\n}", "title": "" }, { "docid": "55ae99ef7f0345b3bddfc2dfed8af0d9", "score": "0.47379628", "text": "func newRequestId() RequestId {\n\tb := make([]byte, 12)\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(b, uint32(time.Now().Unix()))\n\t// Machine, first 3 bytes of md5(hostname)\n\tif machineId == nil {\n\t\tinitMachineId()\n\t}\n\tb[4] = machineId[0]\n\tb[5] = machineId[1]\n\tb[6] = machineId[2]\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tpid := os.Getpid()\n\tb[7] = byte(pid >> 8)\n\tb[8] = byte(pid)\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint32(&requestIdCounter, 1)\n\tb[9] = byte(i >> 16)\n\tb[10] = byte(i >> 8)\n\tb[11] = byte(i)\n\treturn RequestId(b)\n}", "title": "" }, { "docid": "60802b39723c65405d877936adeff459", "score": "0.47371796", "text": "func (m *StakingRequest) GetNodeId() string {\n\tif m != nil {\n\t\treturn m.NodeId\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ec1ea1ccea65f83da7ece62df50c87e8", "score": "0.47309175", "text": "func (am AccountKeeper) GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint64, sdk.Error) {\n\tacc := am.GetAccount(ctx, addr)\n\tif acc == nil {\n\t\treturn 0, sdk.ErrUnknownAddress(addr.String())\n\t}\n\treturn acc.GetSequence(), nil\n}", "title": "" }, { "docid": "2edf98eaa12bdbc561a2500429fec086", "score": "0.47169423", "text": "func (s SystemInformationStructure) SerialNumber() string {\n\treturn get(s.Structure, 3)\n}", "title": "" }, { "docid": "e7717530cea339e76978e536bf77ade1", "score": "0.4714276", "text": "func (s SequenceNo) Number() uint16 {\n\treturn uint16(s)\n}", "title": "" }, { "docid": "a1f23130de278f628c70942205ca9a75", "score": "0.47122288", "text": "func (a *QosAdapter) GetSequence() int64 {\n\treturn a.sequence\n}", "title": "" }, { "docid": "f5f5892f104554163845a3ea1e8d64a6", "score": "0.47105715", "text": "func getNextId(name string) (int, error) {\n\t// 在并发场景下,这里需要锁\n\tvar mutex sync.Mutex\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\ts, err := persistence.GetSequence(name)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\ts.NextId++\n\terr = persistence.UpdateSequence(s)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn s.NextId, nil\n}", "title": "" }, { "docid": "be99c7fa47e80680e6408fa381a27934", "score": "0.47034353", "text": "func prNumber(jobName string) string {\n\tr := regexp.MustCompile(\"^PR-([0-9]+)(?::[\\\\w-]+)?$\")\n\tmatched := r.FindStringSubmatch(jobName)\n\tif matched == nil || len(matched) != 2 {\n\t\treturn \"\"\n\t}\n\tlog.Println(\"Build is a PR: \", matched[1])\n\treturn matched[1]\n}", "title": "" }, { "docid": "f1e0db2097d7747f4fa9da8b25d514ec", "score": "0.46996906", "text": "func (s *SMFWriter) SequenceNumber(no uint16) error {\n\t_, err := s.wr.Write(meta.SequenceNumber(no))\n\treturn err\n}", "title": "" }, { "docid": "1c3af227e7ca0b0198159b7e709aa1c7", "score": "0.46927068", "text": "func (b *Batch) nextSeqNum() uint64 {\n\treturn uint64(len(b.data)) | base.InternalKeySeqNumBatch\n}", "title": "" }, { "docid": "a12eff0d57de84f2cda639368f63de57", "score": "0.46832573", "text": "func (b *mysqlReader) nextSeqNo() uint64 {\n\tb.seqNo++\n\tif b.seqNo%SeqnoSaveInterval == 0 && !b.updateState(false) {\n\t\treturn 0\n\t}\n\treturn b.seqNo\n}", "title": "" }, { "docid": "8d8c1368bd97270d3675f25602c7f585", "score": "0.4682657", "text": "func (s *ACLNotFoundFault) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "5f7aacd3fd07f157c2a4b44fa5d6876d", "score": "0.4680772", "text": "func (sa *SimpleAccount) GetSequenceNumber() (int64, error) {\n\treturn sa.Sequence, nil\n}", "title": "" }, { "docid": "828e698db92f41cccaa4d019ef06a70c", "score": "0.46744308", "text": "func getRequestID(r *http.Request) string {\n\tcv := getContextValue(r, requestContextKey)\n\tif cv != nil {\n\t\treturn cv.(*RequestContext).ID\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "060881d6a55587b4b14f15894bfb4d67", "score": "0.4672767", "text": "func (id *overtFlakeID) SequenceID() uint16 {\n\treturn uint16(id.Upper() & 0xFFFF)\n}", "title": "" }, { "docid": "f391b5be0fa3ba190b1d7bd6cfe8215f", "score": "0.46711", "text": "func (pr PeekResponse) RequestID() string {\n\treturn pr.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "title": "" }, { "docid": "91f7344e1abd29cee613a8e5a2ec70a2", "score": "0.46649098", "text": "func (s *ReservedNodeAlreadyExistsFault) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "bf9804b3acf2ba53377fb76ab9927d0b", "score": "0.46645838", "text": "func (accManager AccountManager) GetSequence(ctx sdk.Context, address sdk.Address) (uint64, sdk.Error) {\n\tbank, err := accManager.storage.GetBank(ctx, address)\n\tif err != nil {\n\t\treturn 0, types.ErrGetSequence(err)\n\t}\n\treturn bank.Sequence, nil\n}", "title": "" }, { "docid": "12b805ea33c2629be7fa92436d71a01a", "score": "0.46638379", "text": "func GetNextSequenceNumber(id int, command string) int {\n\tsequenceLock.Lock()\n\tdefer sequenceLock.Unlock()\n\tsequenceNumber := nextSequenceNumber\n\texpectedResponseList = append(expectedResponseList,\n\t\texpectedResponseEntry{\n\t\t\tid: id,\n\t\t\tsequence: sequenceNumber,\n\t\t\tcommand: command,\n\t\t})\n\tnextSequenceNumber++\n\treturn sequenceNumber\n}", "title": "" }, { "docid": "b6e572ff2b1a9f01a05e467bfc934dd3", "score": "0.46621275", "text": "func (c *Client) nextRequestID() int32 {\n\treturn atomic.AddInt32(&c.requestID, 1)\n}", "title": "" }, { "docid": "276bd3ddf520afb6fb133b814757cbaa", "score": "0.46523872", "text": "func (h *portForwardProxy) requestID(stream httpstream.Stream) (string, error) {\n\trequestID := stream.Headers().Get(PortForwardRequestIDHeader)\n\tif len(requestID) == 0 {\n\t\treturn \"\", trace.BadParameter(\"port forwarding is not supported\")\n\t}\n\treturn requestID, nil\n}", "title": "" }, { "docid": "123830c5ad6bd46bbc15075c5afffa56", "score": "0.46447927", "text": "func (s *SHT3xDriver) SerialNumber() (sn uint32, err error) {\n\tret, err := s.sendCommandDelayGetResponse([]byte{0x37, 0x80}, nil, 2)\n\tif nil == err {\n\t\tsn = (uint32(ret[0]) << 16) | uint32(ret[1])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e55ad2121dd8fb91355ec88b437c2fa7", "score": "0.46441", "text": "func GetNumberSequenceByCode(code string, orgID int64) (NumberSequence, TransactionalInformation) {\n\tdb, err := sqlx.Connect(settings.Settings.Database.DriverName, settings.Settings.GetDbConn())\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn NumberSequence{}, TransactionalInformation{ReturnStatus: false, ReturnMessage: []string{err.Error()}}\n\t}\n\tdefer db.Close()\n\n\torg, _ := GetOrganizationByID(orgID)\n\n\tnumberSequence := NumberSequence{}\n\terr = db.Get(&numberSequence, \"SELECT number_sequence.*,\"+\n\t\t\"user_created.name as rec_created_by_user,\"+\n\t\t\"user_modified.name as rec_modified_by_user,\"+\n\t\t\"organization.description as organization\"+\n\t\t\"\tFROM number_sequence \"+\n\t\t\"\t\tINNER JOIN user_profile as user_created ON number_sequence.rec_created_by = user_created.id \"+\n\t\t\"\t\tINNER JOIN user_profile as user_modified ON number_sequence.rec_modified_by = user_modified.id \"+\n\t\t\"\t\tINNER JOIN organization as organization ON number_sequence.organization_id = organization.id \"+\n\t\t\"\tWHERE number_sequence.code=$1 and number_sequence.client_id=$2\", code, org.ClientID)\n\n\tif err != nil && err == sql.ErrNoRows {\n\t\treturn NumberSequence{}, TransactionalInformation{ReturnStatus: false, ReturnMessage: []string{ErrNumberSequenceNotFound.Error()}}\n\t} else if err != nil {\n\t\tlog.Error(err)\n\t\treturn NumberSequence{}, TransactionalInformation{ReturnStatus: false, ReturnMessage: []string{err.Error()}}\n\t}\n\treturn numberSequence, TransactionalInformation{ReturnStatus: true, ReturnMessage: []string{\"Successfully\"}}\n}", "title": "" }, { "docid": "ef85a2b0298ccaf1e46aa5401d045cb2", "score": "0.46367025", "text": "func (m *CreateSceneRequest_Action) GetSequence() (val int32, set bool) {\n\tif m.Sequence == nil {\n\t\treturn\n\t}\n\n\treturn *m.Sequence, true\n}", "title": "" }, { "docid": "642ea529920f155917931c6bf56ce93d", "score": "0.4636295", "text": "func (m Message) AllocLinkID() (*field.AllocLinkIDField, quickfix.MessageRejectError) {\n\tf := &field.AllocLinkIDField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "5c747da2dd3bd369bad143a67c524d87", "score": "0.46330974", "text": "func generateSimpleRequestExecutionID(req *http.Request) (executionID string) {\n\treturn fmt.Sprintf(\"%d\", time.Now().UnixNano())\n}", "title": "" }, { "docid": "212df4639375eb053783ac71a33eda71", "score": "0.46234646", "text": "func (s *ReplicaAlreadyExistsException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "caa4c4734cbe1846b9aad785414d0fff", "score": "0.46168265", "text": "func (g *GetFutureSaltsRequest) GetNum() (value int) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Num\n}", "title": "" }, { "docid": "2ffc199302738ed7ad1d01aea791b649", "score": "0.4611123", "text": "func (s *SubnetInUse) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "c5a7578ce51635b3004557b9aa042b62", "score": "0.4610076", "text": "func (store *fileStore) NextSenderMsgSeqNum() int {\n\treturn store.cache.NextSenderMsgSeqNum()\n}", "title": "" }, { "docid": "1a660a4c62af056ae2c762e82eb7b765", "score": "0.46082515", "text": "func (s *NoAvailableOrganizationException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "2415556edea4156e9ea6bb9d998d1152", "score": "0.46021554", "text": "func requestID() string {\n\tb := make([]byte, 6)\n\tio.ReadFull(rand.Reader, b)\n\treturn base64.StdEncoding.EncodeToString(b)\n}", "title": "" }, { "docid": "5f1a6febf07660a2fa1cf702766d60eb", "score": "0.45984572", "text": "func randomSerialNumber() int64 {\n\tr := mathrand.New(mathrand.NewSource(time.Now().UTC().UnixNano()))\n\treturn r.Int63()\n}", "title": "" }, { "docid": "5f1a6febf07660a2fa1cf702766d60eb", "score": "0.45984572", "text": "func randomSerialNumber() int64 {\n\tr := mathrand.New(mathrand.NewSource(time.Now().UTC().UnixNano()))\n\treturn r.Int63()\n}", "title": "" }, { "docid": "5cab24ef311e4e1349878765652c1439", "score": "0.45959485", "text": "func (o GetSoaRecordResultOutput) SerialNumber() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetSoaRecordResult) int { return v.SerialNumber }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "9eb4e80bf3f684c0a8fb9cd03f3827ca", "score": "0.45932683", "text": "func (s *Stream) Seq() int64 {\n\treturn atomic.LoadInt64(&s.wseq) - 1\n}", "title": "" }, { "docid": "10b2c1044fd96efdb46abdb9edcbc513", "score": "0.4590217", "text": "func (qml QueueMessagesList) RequestID() string {\n\treturn qml.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "title": "" }, { "docid": "ee8f2a0db12eeee2781c706839e24d75", "score": "0.45896927", "text": "func (mvcc *MVCC) Getseqno() uint64 {\n\treturn atomic.LoadUint64(&mvcc.seqno)\n}", "title": "" }, { "docid": "91d37f04c724f8396591d04038535b7b", "score": "0.45884177", "text": "func (o *Vm) GetLaunchNumber() int32 {\n\tif o == nil || o.LaunchNumber == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.LaunchNumber\n}", "title": "" }, { "docid": "d4249d608eee8a9515a4f4f60779c228", "score": "0.4587797", "text": "func (s *ResourceNotFoundException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" }, { "docid": "d4249d608eee8a9515a4f4f60779c228", "score": "0.45864078", "text": "func (s *ResourceNotFoundException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "title": "" } ]
c15877c9cce28c7c099f2115906b4ce9
HasGeneticCancerSyndrome returns a boolean if a field has been set.
[ { "docid": "c0dcd74ceebf2bebec6011501ff95b80", "score": "0.81807053", "text": "func (o *Ga4ghPatient) HasGeneticCancerSyndrome() bool {\n\tif o != nil && o.GeneticCancerSyndrome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "6ef93c452bc9a27003bb1ea7f079aa58", "score": "0.7019543", "text": "func (o *Ga4ghPatient) GetGeneticCancerSyndromeOk() (string, bool) {\n\tif o == nil || o.GeneticCancerSyndrome == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.GeneticCancerSyndrome, true\n}", "title": "" }, { "docid": "3700f499a7a669ba6db68c92c32bc239", "score": "0.6779536", "text": "func (o *Ga4ghPatient) SetGeneticCancerSyndrome(v string) {\n\to.GeneticCancerSyndrome = &v\n}", "title": "" }, { "docid": "9e0804efde5442b4a2399a9c52f990e4", "score": "0.65719527", "text": "func (o *Ga4ghPatient) GetGeneticCancerSyndrome() string {\n\tif o == nil || o.GeneticCancerSyndrome == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.GeneticCancerSyndrome\n}", "title": "" }, { "docid": "0a3ff1837d265f5d4da92c01dee9d6ec", "score": "0.6301763", "text": "func (o *Ga4ghPatient) HasDetailsOfPredispositionSyndrome() bool {\n\tif o != nil && o.DetailsOfPredispositionSyndrome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a658290d24e240b0632e8ae8e132dfa5", "score": "0.604458", "text": "func (o *Ga4ghPatient) HasFamilyHistoryOfPredispositionSyndrome() bool {\n\tif o != nil && o.FamilyHistoryOfPredispositionSyndrome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6dd0a6902fb0299041a14d64e75926f0", "score": "0.55219173", "text": "func (g *GoStruct) Truth() starlark.Bool {\n\treturn true\n}", "title": "" }, { "docid": "5c41d0b086895c49b9fbc73af4a25ed9", "score": "0.54078233", "text": "func (o *NiatelemetryNiaFeatureUsageAllOf) HasIsSynceFeatureUsed() bool {\n\tif o != nil && o.IsSynceFeatureUsed != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5f3f54e5f04640cfcd959331b1dab67b", "score": "0.5308491", "text": "func (me TBasicReferenceType) IsVerification() bool { return me.String() == \"Verification\" }", "title": "" }, { "docid": "d36abbe54c774d2eede55610c392cf4a", "score": "0.5243194", "text": "func (o *Ga4ghPatient) GetDetailsOfPredispositionSyndromeOk() (string, bool) {\n\tif o == nil || o.DetailsOfPredispositionSyndrome == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DetailsOfPredispositionSyndrome, true\n}", "title": "" }, { "docid": "fe366f7afdab1f247e2205fda98f2410", "score": "0.5207633", "text": "func (o *Ga4ghPatient) GetFamilyHistoryOfPredispositionSyndromeOk() (string, bool) {\n\tif o == nil || o.FamilyHistoryOfPredispositionSyndrome == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.FamilyHistoryOfPredispositionSyndrome, true\n}", "title": "" }, { "docid": "7091f603ff83d658ab30b12d7d8561d1", "score": "0.5141979", "text": "func (o *Ga4ghPatient) HasOtherGeneticConditionOrSignificantComorbidity() bool {\n\tif o != nil && o.OtherGeneticConditionOrSignificantComorbidity != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fecd04bf666b1469c45e187378a230b8", "score": "0.51184803", "text": "func (o *Ga4ghResult) HasGene() bool {\n\tif o != nil && o.Gene != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d2943f257bb393d6d5fb523c16b30d3b", "score": "0.50531614", "text": "func (c *SiadClient) Synced() (bool, error) {\n\tcg, err := c.siad.ConsensusGet()\n\treturn cg.Synced, err\n}", "title": "" }, { "docid": "dec07b65f0a1c4a800dbc2a6d8adcb53", "score": "0.50148875", "text": "func (o *Compartimento) HasRefGvm() bool {\n\tif o != nil && o.RefGvm.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3e0ecef91ee6f3d48277ac15dc8865c5", "score": "0.50143594", "text": "func (p *WorkflowClient) HasSynced() func() bool {\n\treturn p.informer.HasSynced()\n}", "title": "" }, { "docid": "38845fc9d095fb39828392a5aeb0f1d4", "score": "0.5013966", "text": "func (me TdegreeTypes) IsSomePostGraduate() bool { return me.String() == \"some post-graduate\" }", "title": "" }, { "docid": "c897cf6b5656feffde25fa7052fd632b", "score": "0.49882653", "text": "func (me TAssociationTypeType) IsReligious() bool { return me.String() == \"Religious\" }", "title": "" }, { "docid": "73967da6b40bb66431217731b3c5910a", "score": "0.4963163", "text": "func (a *EntryBlockSync) Synced() bool {\n\treturn a.Current.IsSameAs(&a.Target)\n}", "title": "" }, { "docid": "af71a93b6dea1910778d1f9f73fd252c", "score": "0.49372616", "text": "func HasSameDoubleConsonant(word string) bool {\n\ttoken := Parse(word)\n\tcc := strings.HasSuffix(token.VowCon, \"cc\")\n\tif cc == true {\n\t\twordLen := (len(word) - 1)\n\t\tletter := string(word[wordLen])\n\t\tletter2 := string(word[(wordLen - 1)])\n\t\tif letter == letter2 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "51b578532b138658e9cd528c780c288c", "score": "0.49215028", "text": "func (o *Ga4ghPatient) HasAutopsyTissueForResearch() bool {\n\tif o != nil && o.AutopsyTissueForResearch != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b25229039b91fd8b0973e13abcbb0a09", "score": "0.48862967", "text": "func (o *Metadata) HasCrn() bool {\n\tif o != nil && o.Crn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b31b758e430bea951f76aac07cdf0839", "score": "0.48823416", "text": "func (o *Tarefa) HasRefGvm() bool {\n\tif o != nil && o.RefGvm.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "82a7184537245994da35303967df91d9", "score": "0.48708284", "text": "func CollateReuqstToken(token string) bool {\n\thashed := sha512.Sum512([]byte(token))\n\treturn hex.EncodeToString(hashed[:]) == c.Config.WebSetting.SesamePrivateToken\n}", "title": "" }, { "docid": "ec7f0d7ef7a3d48adf4c59247a7ab2b6", "score": "0.48680267", "text": "func palindrome(s string) bool {\n\treturn reverse(s) == s\n}", "title": "" }, { "docid": "40a372ae4e7dcde8be7d7824e2bf9c2b", "score": "0.4834947", "text": "func (o *NiatelemetryNiaFeatureUsageAllOf) GetIsSynceFeatureUsed() bool {\n\tif o == nil || o.IsSynceFeatureUsed == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsSynceFeatureUsed\n}", "title": "" }, { "docid": "61de17d8eec898e56439175db2dab98c", "score": "0.48228288", "text": "func (d *Description) IsSynonym() bool {\n\treturn d.TypeId == int64(Synonym)\n}", "title": "" }, { "docid": "5e49d8c7459f2a7e5af27d63e27541f0", "score": "0.48155028", "text": "func (c *Controller) HasSynced() bool {\n\t// returns true if the controller has configured certificate successfully\n\t// at least once.\n\treturn atomic.LoadUint32(&c.syncedOnce) == 1\n}", "title": "" }, { "docid": "8af71744beb0e5de96be401d862b019e", "score": "0.48090655", "text": "func Synced(t *testing.T, node *framework.Node) bool {\n\tinfo, err := node.Info()\n\trequire.NoError(t, err)\n\treturn info.TangleTime.Synced\n}", "title": "" }, { "docid": "76ed671240a9dce22a4028dcdeb5880d", "score": "0.48076248", "text": "func (o *OrdemServico) HasRefGvm() bool {\n\tif o != nil && o.RefGvm.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2391cf11becd2f4e6e57b2719c458f41", "score": "0.48054937", "text": "func (cookie *PBSCookie) HasSync(familyName string) bool {\n\tif cookie == nil {\n\t\treturn false\n\t} else {\n\t\t_, ok := cookie.uids[familyName]\n\t\treturn ok\n\t}\n}", "title": "" }, { "docid": "ba971cbe081dd4d9ef907a248c0d2292", "score": "0.48035797", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.crds.HasSynced()\n}", "title": "" }, { "docid": "5e678d8d0efee8a3bfd09cdd91ede640", "score": "0.4782764", "text": "func main() {\n\tfmt.Println(hasPalindromePermutation(\"racerac\")) // true\n\tfmt.Println(hasPalindromePermutation(\"abcdefg\")) // false\n}", "title": "" }, { "docid": "f7427a85a96607cae7e0c7b65230f15b", "score": "0.47811455", "text": "func (me TGraduatingDegreeType) IsQualifying() bool { return me.String() == \"qualifying\" }", "title": "" }, { "docid": "b54a692bc734baa16c969798b3468e02", "score": "0.47751644", "text": "func (obj *peers) HasLastSync() bool {\n\treturn obj.lastSync != nil\n}", "title": "" }, { "docid": "4f9819c1bfdefd9fb9ebf3c43807b24d", "score": "0.47620916", "text": "func HasSynced(dc *appsv1.DeploymentConfig, generation int64) bool {\n\treturn dc.Status.ObservedGeneration >= generation\n}", "title": "" }, { "docid": "5a0a921886b5138c72bc2eef65767927", "score": "0.47576898", "text": "func (c *FunctionController) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "9df61a5438aa7d5cb9ba3fc5678e74f0", "score": "0.47556198", "text": "func (s Secret) KeygenDone() bool {\n\treturn s.ECDSA != nil && s.Paillier != nil\n}", "title": "" }, { "docid": "21a3c09fef9ab8924443f925a0179fb0", "score": "0.47473174", "text": "func (me TAcademicCreditCodeType) IsG() bool { return me.String() == \"G\" }", "title": "" }, { "docid": "ce1924307bab692472e6509ee5e13005", "score": "0.4741381", "text": "func (me TPublicationOtherTypeTypes) IsManual() bool { return me.String() == \"Manual\" }", "title": "" }, { "docid": "ea36cefacce71f6840e22fbb19d782e3", "score": "0.47384578", "text": "func IsPalindrome(node *Node) bool {\n\n}", "title": "" }, { "docid": "df34d7e17e934f4b6f74af3cfb12c0ee", "score": "0.47349474", "text": "func TangleTimeSynced() bool {\n\treturn isTangleTimeSynced.Load()\n}", "title": "" }, { "docid": "8484ad4df133f395956d2ae65dc26dfe", "score": "0.47301364", "text": "func (me TdegreeTypes) IsSomeHighSchoolOrEquivalent() bool {\n\treturn me.String() == \"some high school or equivalent\"\n}", "title": "" }, { "docid": "9dce84437725b4761a0ec023749e0232", "score": "0.47169513", "text": "func (t *Task) hasVerify() bool {\n\treturn t.Owner.Spec.Verify\n}", "title": "" }, { "docid": "9a4aa098eff585d81f5755a641907390", "score": "0.47012442", "text": "func (o *MyErratum) HasSynopsis() bool {\n\tif o != nil && !IsNil(o.Synopsis) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5393342b2424b819b9354d9103665c23", "score": "0.46719992", "text": "func (field CommonFlagField) Has(flag CommonFlag) bool {\n\treturn (field & flag.mask()) != 0\n}", "title": "" }, { "docid": "5973925fadeea5c620912fff3eeb4b40", "score": "0.4652533", "text": "func (s GuildID) IsValid() bool { return Snowflake(s).IsValid() }", "title": "" }, { "docid": "e8e3f9d9ba6a6fa3c8f71b87a4480c12", "score": "0.46471342", "text": "func (s *State) HasSetReferee(username string) bool {\n\tstatus, err := s.paymentDB.GetStatusIfFound(username)\n\tif err != nil || status == nil {\n\t\treturn false\n\t}\n\treturn status.RefereeCode != \"\"\n}", "title": "" }, { "docid": "46028a11b0bf4cdc7c669b4e9febebe3", "score": "0.4646678", "text": "func (s InteractionID) IsValid() bool { return Snowflake(s).IsValid() }", "title": "" }, { "docid": "4da16b9577da35c9c0d77bcc0cdf5321", "score": "0.46299496", "text": "func (tc *TelegrafController) HasSynced() bool {\n\treturn tc.informer.HasSynced()\n}", "title": "" }, { "docid": "a1c0dbbc485dce443d4f225d9ec3dd02", "score": "0.46261987", "text": "func (o *NiatelemetryNiaFeatureUsageAllOf) GetIsSynceFeatureUsedOk() (*bool, bool) {\n\tif o == nil || o.IsSynceFeatureUsed == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsSynceFeatureUsed, true\n}", "title": "" }, { "docid": "382232a9b2eb9f9a24d4eb51d4389d25", "score": "0.46156263", "text": "func (o *UtilizadorPerfilSeguranca) HasRefPerfilSeguranca() bool {\n\tif o != nil && o.RefPerfilSeguranca.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7fd78d5e67700f674f8139215fa161fa", "score": "0.46123332", "text": "func (me TdegreeTypes) IsSomeCollege() bool { return me.String() == \"some college\" }", "title": "" }, { "docid": "2d60b496a8fe85de90dc6e460a2bba90", "score": "0.4609284", "text": "func (o *Ga4ghPatient) HasPriorMalignancy() bool {\n\tif o != nil && o.PriorMalignancy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "950b899563f3787a2ae7fa6a968b5df1", "score": "0.45914996", "text": "func randBool() bool {\n\treturn rand.Intn(2) == 0\n}", "title": "" }, { "docid": "87b6519e8300d9f62b105cae442c1674", "score": "0.45914352", "text": "func (o *RetroResponseSchema) HasRetroResponse() bool {\n\tif o != nil && o.RetroResponse != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9a6aedc44b4a4ed1491878b5a995e8f3", "score": "0.45895448", "text": "func (me TdegreeTypes) IsGed() bool { return me.String() == \"ged\" }", "title": "" }, { "docid": "1b04ae601cde6d353b5e7b09fd8b61ff", "score": "0.45890945", "text": "func (gid GoogleID) RISC() bool {\n\tvar RISC bool\n\n\terr := db.QueryRow(\"SELECT RISC FROM agent WHERE gid = ?\", gid).Scan(&RISC)\n\tif err == sql.ErrNoRows {\n\t\tlog.Warnw(\"agent does not exist, checking RISC flag\", \"GID\", gid)\n\t} else if err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn RISC\n}", "title": "" }, { "docid": "94166dc9d19710c8e6f6a15eb4f0bfee", "score": "0.4587527", "text": "func (b *boolgen) gen() bool {\n\tif b.remaining == 0 {\n\t\tb.cache, b.remaining = b.src.Int63(), 63\n\t}\n\n\tresult := b.cache&0x01 == 1\n\tb.cache >>= 1\n\n\treturn result\n}", "title": "" }, { "docid": "c6c636a7acc1e3fb9be46306400b5d2a", "score": "0.45790732", "text": "func (o *Ga4ghPatient) GetDetailsOfPredispositionSyndrome() string {\n\tif o == nil || o.DetailsOfPredispositionSyndrome == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DetailsOfPredispositionSyndrome\n}", "title": "" }, { "docid": "9547b566907aaab99f8893a0de15499a", "score": "0.45735744", "text": "func hasPalindromePermutation(input string) bool {\n\tvar asciiChars [128]int\n\n\tfor _, c := range input {\n\t\tasciiChars[c]++\n\t}\n\tseenOddAlready := false\n\tfor _, c := range asciiChars {\n\t\tif c%2 != 0 {\n\t\t\tif seenOddAlready {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tseenOddAlready = true\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7877554c944f40ded05cd2fff1bfdf9d", "score": "0.457317", "text": "func (m *ExtensionProperty) GetIsSyncedFromOnPremises()(*bool) {\n return m.isSyncedFromOnPremises\n}", "title": "" }, { "docid": "208748de8e16c120ba0752f5979f7711", "score": "0.45666155", "text": "func (cntr *controller) HasSynced() bool {\n\ta := cntr.entryController.HasSynced()\n\treturn a\n}", "title": "" }, { "docid": "d175de59050c646fe013c29a9a1cc5bd", "score": "0.4561448", "text": "func (o *NiatelemetryNiaFeatureUsageAllOf) SetIsSynceFeatureUsed(v bool) {\n\to.IsSynceFeatureUsed = &v\n}", "title": "" }, { "docid": "d4c085bc175b64eba36a38808b0f302a", "score": "0.45600075", "text": "func (_GeneScienceInterface *GeneScienceInterfaceCaller) IsGeneScience(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _GeneScienceInterface.contract.Call(opts, out, \"isGeneScience\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ab95574d5c2f6eebcda1730889961531", "score": "0.45492736", "text": "func (o *CompartimentoEstado) HasRefCompartimento() bool {\n\tif o != nil && o.RefCompartimento.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "208b4df1c91496c901efd91a225d81ee", "score": "0.4546749", "text": "func (o *UpdateRegistrationFlowWithWebAuthnMethod) HasWebauthnRegister() bool {\n\tif o != nil && o.WebauthnRegister != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "81a621cc0551b7c0d7547f7a51bde730", "score": "0.45374486", "text": "func (s *Series) Truth() starlark.Bool {\n\t// NOTE: In python, calling bool(Series) raises this exception: \"ValueError: The truth\n\t// value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().\"\n\t// Since starlark does not have exceptions, just always return true.\n\treturn true\n}", "title": "" }, { "docid": "36e94f67efd2a960729330ae7bbd4380", "score": "0.45356074", "text": "func (m *PermissionsPolicyMutation) IsGlobalCleared() bool {\n\t_, ok := m.clearedFields[permissionspolicy.FieldIsGlobal]\n\treturn ok\n}", "title": "" }, { "docid": "39518ca7c72b12c76539455f5a2aef98", "score": "0.45178133", "text": "func (o *Ga4ghPatient) HasRace() bool {\n\tif o != nil && o.Race != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "3735d3b33d549511d444ca175acf65d4", "score": "0.45174623", "text": "func (me TRelationshipType) IsReferrer() bool { return me.String() == \"referrer\" }", "title": "" }, { "docid": "9196fc8522d3becf01378ad92bddb0b1", "score": "0.45167792", "text": "func (Writer) IsSynced() bool {\n\treturn true\n}", "title": "" }, { "docid": "3aa5cae7937af2df1bca8c961bb4c45e", "score": "0.45163286", "text": "func (s ChannelID) IsValid() bool { return Snowflake(s).IsValid() }", "title": "" }, { "docid": "6a240814c308d5f448d9be4737a0e3c5", "score": "0.45122352", "text": "func (m *Message) CheckPalindrome() (b bool) {\n\tif m.Palindrome == false && m.Content != \"\" {\n\t\tmid := len(m.Content) / 2\n\t\tlast := len(m.Content) - 1\n\t\tfor i := 0; i < mid; i++ {\n\t\t\tif m.Content[i] != m.Content[last-i] {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ec1e8d7f0af1615a382d1ceeb27c23ab", "score": "0.45104915", "text": "func (m *PatientMutation) ChecksymptomCleared() bool {\n\treturn m.cleared_Checksymptom\n}", "title": "" }, { "docid": "b27cb2945e4fbde7f5d716c4d0d60e29", "score": "0.45052266", "text": "func hasPalindromePermutation(s string) bool {\n\t// Solution: if every rune in the string - with at most one exception -\n\t// appears an even number of times, the string can form a palindrome.\n\n\t// First convert the string to a slice of runes, then sort it.\n\ta := []rune(s)\n\tsort.Slice(a, func(i, j int) bool { return a[i] < a[j] })\n\n\t// Then count each run of runes in the slice, returning false if we\n\t// encounter a second odd-count run. If we reach the end of the string\n\t// having seen zero or one odd-count runs, return true.\n\thasOddRun := false\n\tpos := 0 // current offset in a[]\n\tfor pos < len(a) {\n\t\ti := pos\n\t\tfor i < len(a) && a[i] == a[pos] {\n\t\t\ti++\n\t\t}\n\t\tif runLen := i - pos; runLen%2 == 1 {\n\t\t\tif hasOddRun {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\thasOddRun = true\n\t\t}\n\t\tpos = i\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4b465745c3650d163cc0ce4e1753174f", "score": "0.45016825", "text": "func Bool() bool {\n\treturn randIntRange(0, 1) == 1\n}", "title": "" }, { "docid": "1505164930115ead9bd4419ed7880182", "score": "0.45009065", "text": "func (o *SubmitSelfServiceFlowWithWebAuthnRegistrationMethod) HasWebauthnRegister() bool {\n\tif o != nil && o.WebauthnRegister != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bef79049fc75c5ffacb25d45f19c43f6", "score": "0.45002592", "text": "func (m *LocationMutation) SiteSurveyNeededCleared() bool {\n\t_, ok := m.clearedFields[location.FieldSiteSurveyNeeded]\n\treturn ok\n}", "title": "" }, { "docid": "df893ba62db4fd78994a2f210b92f16f", "score": "0.44991937", "text": "func (p *PalindromeNumber) IsPalindrome() bool {\n\tif p == nil {\n\t\treturn false\n\t}\n\treturn IsPalindromeNumber(p.input)\n}", "title": "" }, { "docid": "bdb27728ff193543480a76c81cb1cc7f", "score": "0.44989374", "text": "func (me TpositionTypes) IsDirectHire() bool { return me.String() == \"directHire\" }", "title": "" }, { "docid": "03571a5a14f9d4f0176e654474d89c85", "score": "0.4497888", "text": "func (p *PCR) QuoteVerified() bool {\n\treturn p.quoteVerified\n}", "title": "" }, { "docid": "e3a8597e5bd92e0c299b4d07c0369085", "score": "0.44974864", "text": "func (i PropertyMeta) IsRel() bool { return i.hasOne != \"\" || i.hasMany != \"\" }", "title": "" }, { "docid": "79bcb2100bd0424d50fb992fb8a65ceb", "score": "0.44942787", "text": "func (me TdegreeTypes) IsHighSchoolOrEquivalent() bool {\n\treturn me.String() == \"high school or equivalent\"\n}", "title": "" }, { "docid": "9d98c214b8dfb97892172ff5cc888e4e", "score": "0.4493798", "text": "func (o *Operator) HasGrad() bool {\n\treturn !isNil(o.Grad()) // safety wait for the backward goroutine to finish\n}", "title": "" }, { "docid": "f8c91a6e81ca10689babb472df8da516", "score": "0.44925594", "text": "func (o OptID) IsSet() bool { return o.Set }", "title": "" }, { "docid": "72e897447c9c9ceed6632d7ed039dbd2", "score": "0.44912237", "text": "func (o SFCSTEP) RTRIG() bool {\r\n\treturn o.mRTRIG.Q()\r\n}", "title": "" }, { "docid": "5223cc9be06ed5b9cfeb53f087731db1", "score": "0.44911724", "text": "func (p *PromptSet) Has(flag PromptSet) bool {\n\treturn (*p)&flag != 0\n}", "title": "" }, { "docid": "51745ccb972eb1f428df6bc76a8574ba", "score": "0.44894376", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "51745ccb972eb1f428df6bc76a8574ba", "score": "0.44894376", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "51745ccb972eb1f428df6bc76a8574ba", "score": "0.44894376", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "51745ccb972eb1f428df6bc76a8574ba", "score": "0.44894376", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "51745ccb972eb1f428df6bc76a8574ba", "score": "0.44894376", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "51745ccb972eb1f428df6bc76a8574ba", "score": "0.44894376", "text": "func (c *Controller) HasSynced() bool {\n\treturn c.informer.HasSynced()\n}", "title": "" }, { "docid": "6d22b5b910bbfcfd0ebb32235c7ab357", "score": "0.44890448", "text": "func (br *BaseRecord) IsGenesisRequired(ctx context.Context) (bool, error) {\n\tb, err := br.DB.Get(Key{})\n\tif err != nil {\n\t\tif err == store.ErrNotFound {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, errors.Wrap(err, \"genesis record fetch failed\")\n\t}\n\n\tif len(b) == 0 {\n\t\treturn false, errors.New(\"genesis record is empty (genesis hasn't properly finished)\")\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "d63735d8fde43cb572be95d76148d8a6", "score": "0.44883004", "text": "func ValidPalindrome(s string) bool {\n\tbytes:=[]byte(s)\n\tstart := 0\n\tend :=len(bytes)-1\n\tfor start<end{\n\tif bytes[start]!=bytes[end]{\n\t\treturn isPalindrome(bytes,start+1,end)||isPalindrome(bytes,start,end-1)\n\t}\n\tstart++\n\tend--\n}\nreturn true\n}", "title": "" }, { "docid": "6cae3c30ea833da3945054b67812be95", "score": "0.44832498", "text": "func (p *Person) Transient() bool { return p.UID == 0 }", "title": "" }, { "docid": "9e59f41abc4e432850fa320d3ced2fc5", "score": "0.44818866", "text": "func (me TCourseLevelCodeType) IsG() bool { return me.String() == \"G\" }", "title": "" }, { "docid": "18d89ed0269b5caada0c3dbaddc7c090", "score": "0.44808564", "text": "func IsPalindrome(s string) bool {\n\tvar reversed string\n\treversed = stringutil.Reverse(s)\n\treversed = stripSpaces(reversed)\n\ts = stripSpaces(s)\n\tprintln(\"s = \\t\\t\", s)\n\tprintln(\"reverse = \\t\", reversed)\n\n\treturn s == reversed\n}", "title": "" }, { "docid": "3293eec7bbdb36436f3664625095d10b", "score": "0.44790033", "text": "func (didDoc DidDocument) HasRelationship(\n\tsigner string,\n\trelationships ...string,\n) bool {\n\t// first check if the controller exists\n\tfor _, vm := range didDoc.VerificationMethods {\n\t\tif vm.BlockchainAccountID != BlockchainAccountID(signer) {\n\t\t\tcontinue\n\t\t}\n\n\t\tvrs := didDoc.GetVerificationRelationships(vm.Id)\n\t\tif len(intersection(vrs, relationships)) > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bf7df9105d24fe5e126c5bd6c2c48fb7", "score": "0.44769484", "text": "func (o *SecurityMonitoringSignalRuleQuery) HasCorrelatedByFields() bool {\n\treturn o != nil && o.CorrelatedByFields != nil\n}", "title": "" } ]
873473e99dbb1158e9a20e02a26627f0
MarshalJSON implements the json.Marshaller interface for type ProductFamiliesMetadata.
[ { "docid": "0fae167446fbeb5739914b430ab22a67", "score": "0.83462185", "text": "func (p ProductFamiliesMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", p.NextLink)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
[ { "docid": "3b9788f0e663f14ef56b3d677435799f", "score": "0.81260777", "text": "func (p ProductFamiliesMetadataDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cf072578d5b51f77b84d585dadd0d593", "score": "0.7741044", "text": "func (p ProductFamilies) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", p.NextLink)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b0610efca3938437ee7ac34fa045c4e8", "score": "0.7160126", "text": "func (p ProductFamily) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7c20bac10f51890a93dfbd7af730163b", "score": "0.71495456", "text": "func (p ProductFamilyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"availabilityInformation\", p.AvailabilityInformation)\n\tpopulate(objectMap, \"costInformation\", p.CostInformation)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"displayName\", p.DisplayName)\n\tpopulate(objectMap, \"filterableProperties\", p.FilterableProperties)\n\tpopulate(objectMap, \"hierarchyInformation\", p.HierarchyInformation)\n\tpopulate(objectMap, \"imageInformation\", p.ImageInformation)\n\tpopulate(objectMap, \"productLines\", p.ProductLines)\n\tpopulate(objectMap, \"resourceProviderDetails\", p.ResourceProviderDetails)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "34224eba82a363207714dde9ee0cefc1", "score": "0.71022856", "text": "func (p ProductFamiliesRequest) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"customerSubscriptionDetails\", p.CustomerSubscriptionDetails)\n\tpopulate(objectMap, \"filterableProperties\", p.FilterableProperties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "aae9b179a90105f5bc7ba21e2c5bc6bc", "score": "0.6580735", "text": "func (m MetadataEntityProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"applicableScenarios\", m.ApplicableScenarios)\n\tpopulate(objectMap, \"dependsOn\", m.DependsOn)\n\tpopulate(objectMap, \"displayName\", m.DisplayName)\n\tpopulate(objectMap, \"supportedValues\", m.SupportedValues)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "aae9b179a90105f5bc7ba21e2c5bc6bc", "score": "0.6580735", "text": "func (m MetadataEntityProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"applicableScenarios\", m.ApplicableScenarios)\n\tpopulate(objectMap, \"dependsOn\", m.DependsOn)\n\tpopulate(objectMap, \"displayName\", m.DisplayName)\n\tpopulate(objectMap, \"supportedValues\", m.SupportedValues)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "765973fa05acad9647becc5b6bb85428", "score": "0.6551841", "text": "func (p *ProductFamiliesMetadata) 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": "5e6109d854a18a5458c7d5971ae51109", "score": "0.650566", "text": "func (m MetadataEntity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"systemData\", m.SystemData)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "728bd15873e0e936e37e56661137ffa2", "score": "0.6457906", "text": "func (m Metadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"provisionedBy\", m.ProvisionedBy)\n\tpopulate(objectMap, \"provisionedByResourceId\", m.ProvisionedByResourceID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "133e58813e784e49d7f0ea839313757f", "score": "0.64541245", "text": "func (m MetadataEntity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "70b7ea710f72d3db43334b793b19f312", "score": "0.62518674", "text": "func (o GetFamiliesFamilyCodeVariantsOKBody) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataGetFamiliesFamilyCodeVariantsOKBodyAO0 struct {\n\t\tLinks *GetFamiliesFamilyCodeVariantsOKBodyGetFamiliesFamilyCodeVariantsOKBodyAO0Links `json:\"_links,omitempty\"`\n\n\t\tCurrentPage int64 `json:\"current_page,omitempty\"`\n\t}\n\n\tdataGetFamiliesFamilyCodeVariantsOKBodyAO0.Links = o.Links\n\n\tdataGetFamiliesFamilyCodeVariantsOKBodyAO0.CurrentPage = o.CurrentPage\n\n\tjsonDataGetFamiliesFamilyCodeVariantsOKBodyAO0, errGetFamiliesFamilyCodeVariantsOKBodyAO0 := swag.WriteJSON(dataGetFamiliesFamilyCodeVariantsOKBodyAO0)\n\tif errGetFamiliesFamilyCodeVariantsOKBodyAO0 != nil {\n\t\treturn nil, errGetFamiliesFamilyCodeVariantsOKBodyAO0\n\t}\n\t_parts = append(_parts, jsonDataGetFamiliesFamilyCodeVariantsOKBodyAO0)\n\tvar dataGetFamiliesFamilyCodeVariantsOKBodyAO1 struct {\n\t\tEmbedded *GetFamiliesFamilyCodeVariantsOKBodyGetFamiliesFamilyCodeVariantsOKBodyAO1Embedded `json:\"_embedded,omitempty\"`\n\t}\n\n\tdataGetFamiliesFamilyCodeVariantsOKBodyAO1.Embedded = o.Embedded\n\n\tjsonDataGetFamiliesFamilyCodeVariantsOKBodyAO1, errGetFamiliesFamilyCodeVariantsOKBodyAO1 := swag.WriteJSON(dataGetFamiliesFamilyCodeVariantsOKBodyAO1)\n\tif errGetFamiliesFamilyCodeVariantsOKBodyAO1 != nil {\n\t\treturn nil, errGetFamiliesFamilyCodeVariantsOKBodyAO1\n\t}\n\t_parts = append(_parts, jsonDataGetFamiliesFamilyCodeVariantsOKBodyAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "f9ef03694c9b3dc0f6d1c795ee4dd326", "score": "0.62514424", "text": "func (p *ProductFamilies) 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": "d8eb7c96f6055f5b530377b5f85dfd70", "score": "0.6068139", "text": "func (p ProductProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"availabilityInformation\", p.AvailabilityInformation)\n\tpopulate(objectMap, \"configurations\", p.Configurations)\n\tpopulate(objectMap, \"costInformation\", p.CostInformation)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"displayName\", p.DisplayName)\n\tpopulate(objectMap, \"filterableProperties\", p.FilterableProperties)\n\tpopulate(objectMap, \"hierarchyInformation\", p.HierarchyInformation)\n\tpopulate(objectMap, \"imageInformation\", p.ImageInformation)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "37ced5eeb293dd416ef2535d2ec44f3a", "score": "0.6056407", "text": "func (o GetFamiliesFamilyCodeVariantsOKBodyGetFamiliesFamilyCodeVariantsOKBodyAO1EmbeddedItemsItems0) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataAO0 struct {\n\t\tLinks *GetFamiliesFamilyCodeVariantsOKBodyGetFamiliesFamilyCodeVariantsOKBodyAO1EmbeddedItemsItems0AO0Links `json:\"_links,omitempty\"`\n\t}\n\n\tdataAO0.Links = o.Links\n\n\tjsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)\n\tif errAO0 != nil {\n\t\treturn nil, errAO0\n\t}\n\t_parts = append(_parts, jsonDataAO0)\n\tvar dataAO1 struct {\n\t\tCode *string `json:\"code\"`\n\n\t\tLabels *GetFamiliesFamilyCodeVariantsOKBodyGetFamiliesFamilyCodeVariantsOKBodyAO1EmbeddedItemsItems0AO1Labels `json:\"labels,omitempty\"`\n\n\t\tVariantAttributeSets []*GetFamiliesFamilyCodeVariantsOKBodyGetFamiliesFamilyCodeVariantsOKBodyAO1EmbeddedItemsItems0VariantAttributeSetsItems0 `json:\"variant_attribute_sets\"`\n\t}\n\n\tdataAO1.Code = o.Code\n\n\tdataAO1.Labels = o.Labels\n\n\tdataAO1.VariantAttributeSets = o.VariantAttributeSets\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "c0fa781ea4f3f71d19809c7c4f1eade0", "score": "0.60072786", "text": "func (p *ProductFamiliesMetadataDetails) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af07e189f6887a4e928da5d2519dcb62", "score": "0.5985728", "text": "func (p Product) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "79e3d5fe038be28aa5736cda804d025c", "score": "0.58886313", "text": "func (m ManagedInstanceFamilyCapability) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"reason\", m.Reason)\n\tpopulate(objectMap, \"sku\", m.SKU)\n\tpopulate(objectMap, \"status\", m.Status)\n\tpopulate(objectMap, \"supportedLicenseTypes\", m.SupportedLicenseTypes)\n\tpopulate(objectMap, \"supportedVcoresValues\", m.SupportedVcoresValues)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9e4c06248bd6d26d2d447ee3927aa8b4", "score": "0.58486325", "text": "func (m MeasureFamilyList) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataAO0 struct {\n\t\tLinks *MeasureFamilyListAO0Links `json:\"_links,omitempty\"`\n\t}\n\n\tdataAO0.Links = m.Links\n\n\tjsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)\n\tif errAO0 != nil {\n\t\treturn nil, errAO0\n\t}\n\t_parts = append(_parts, jsonDataAO0)\n\tvar dataAO1 struct {\n\t\tCode *string `json:\"code\"`\n\n\t\tStandard string `json:\"standard,omitempty\"`\n\n\t\tUnits []*MeasureFamilyListUnitsItems0 `json:\"units\"`\n\t}\n\n\tdataAO1.Code = m.Code\n\n\tdataAO1.Standard = m.Standard\n\n\tdataAO1.Units = m.Units\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "6415b174cb0e75580fd24da1d3bf4ec8", "score": "0.5834752", "text": "func (p Product) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8869db8a234b49172700b2a714fcbc87", "score": "0.5828506", "text": "func (j Metadata) MarshalJSON() ([]byte, error) {\n\tif j == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn j, nil\n}", "title": "" }, { "docid": "daf6140a367e3969b61a63848589a9c1", "score": "0.58282936", "text": "func (vspf VendorSkuPropertiesFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif vspf.SkuType != \"\" {\n\t\tobjectMap[\"skuType\"] = vspf.SkuType\n\t}\n\tif vspf.DeploymentMode != \"\" {\n\t\tobjectMap[\"deploymentMode\"] = vspf.DeploymentMode\n\t}\n\tif vspf.Preview != nil {\n\t\tobjectMap[\"preview\"] = vspf.Preview\n\t}\n\tif vspf.ManagedApplicationParameters != nil {\n\t\tobjectMap[\"managedApplicationParameters\"] = vspf.ManagedApplicationParameters\n\t}\n\tif vspf.ManagedApplicationTemplate != nil {\n\t\tobjectMap[\"managedApplicationTemplate\"] = vspf.ManagedApplicationTemplate\n\t}\n\tif vspf.VirtualNetworkFunctionTemplate != nil {\n\t\tobjectMap[\"virtualNetworkFunctionTemplate\"] = vspf.VirtualNetworkFunctionTemplate\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e710b68b55cbae2721a2c46ba809b0d8", "score": "0.58181256", "text": "func (m MetadataEntityListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", m.NextLink)\n\tpopulate(objectMap, \"value\", m.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e710b68b55cbae2721a2c46ba809b0d8", "score": "0.58181256", "text": "func (m MetadataEntityListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", m.NextLink)\n\tpopulate(objectMap, \"value\", m.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d587ead421097054f432f291e0ff6711", "score": "0.57630086", "text": "func (family Family) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"%q\", family)), nil\n}", "title": "" }, { "docid": "6d88303b97c2eb51245fa6bf5cea0a8f", "score": "0.575518", "text": "func (m ManagedHsmSKU) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tif m.Family == nil {\n\t\tm.Family = to.Ptr(ManagedHsmSKUFamilyB)\n\t}\n\tpopulate(objectMap, \"family\", m.Family)\n\tpopulate(objectMap, \"name\", m.Name)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ae56aee7dda5b042133dd3c7326f0ff5", "score": "0.57087564", "text": "func (v Metadata) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonBa0ee0e3EncodeGithubComSkydiveProjectSkydiveTopologyProbesLldp2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "1f2b6b07d22c721c0c1abd7ec5c73d2e", "score": "0.5688261", "text": "func (p ProductProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"autoRenew\", p.AutoRenew)\n\tpopulate(objectMap, \"availabilityId\", p.AvailabilityID)\n\tpopulate(objectMap, \"billingFrequency\", p.BillingFrequency)\n\tpopulate(objectMap, \"billingProfileDisplayName\", p.BillingProfileDisplayName)\n\tpopulate(objectMap, \"billingProfileId\", p.BillingProfileID)\n\tpopulate(objectMap, \"customerDisplayName\", p.CustomerDisplayName)\n\tpopulate(objectMap, \"customerId\", p.CustomerID)\n\tpopulate(objectMap, \"displayName\", p.DisplayName)\n\tpopulateTimeRFC3339(objectMap, \"endDate\", p.EndDate)\n\tpopulate(objectMap, \"invoiceSectionDisplayName\", p.InvoiceSectionDisplayName)\n\tpopulate(objectMap, \"invoiceSectionId\", p.InvoiceSectionID)\n\tpopulate(objectMap, \"lastCharge\", p.LastCharge)\n\tpopulateTimeRFC3339(objectMap, \"lastChargeDate\", p.LastChargeDate)\n\tpopulate(objectMap, \"productType\", p.ProductType)\n\tpopulate(objectMap, \"productTypeId\", p.ProductTypeID)\n\tpopulateTimeRFC3339(objectMap, \"purchaseDate\", p.PurchaseDate)\n\tpopulate(objectMap, \"quantity\", p.Quantity)\n\tpopulate(objectMap, \"reseller\", p.Reseller)\n\tpopulate(objectMap, \"skuDescription\", p.SKUDescription)\n\tpopulate(objectMap, \"skuId\", p.SKUID)\n\tpopulate(objectMap, \"status\", p.Status)\n\tpopulate(objectMap, \"tenantId\", p.TenantID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "44c63350e41138f748d2297a7437f543", "score": "0.56820905", "text": "func (d DimensionProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"displayName\", d.DisplayName)\n\tpopulate(objectMap, \"name\", d.Name)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8344560c6e4184ac7541f23734ad60ac", "score": "0.56661826", "text": "func (m MetadataItem) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"value\", m.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "99be1e900deff96cf360063a94b2c0f2", "score": "0.5651666", "text": "func (m MessagingRegionsProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"code\", m.Code)\n\tpopulate(objectMap, \"fullName\", m.FullName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c2532e69522a815973f0c734db6145f5", "score": "0.5640376", "text": "func (d DimensionProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"displayName\", d.DisplayName)\n\tpopulate(objectMap, \"name\", d.Name)\n\tpopulate(objectMap, \"toBeExportedForShoebox\", d.ToBeExportedForShoebox)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a8dfe599341b1007847f7d49b902a62c", "score": "0.55868906", "text": "func (p ProviderOperationsMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"displayName\", p.DisplayName)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"operations\", p.Operations)\n\tpopulate(objectMap, \"resourceTypes\", p.ResourceTypes)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "bfd8ac1d02007fa530f681797876fd03", "score": "0.5582317", "text": "func (m Metadata) MarshalJSON() ([]byte, error) {\n\tvar d *semtech.Datrparser\n\tvar t *semtech.Timeparser\n\n\t// Handle datr which can be either an uint or string depending of the modulation\n\tif m.Datr != nil {\n\t\td = new(semtech.Datrparser)\n\t\tif m.Modu != nil && *m.Modu == \"FSK\" {\n\t\t\t*d = semtech.Datrparser{Kind: \"uint\", Value: *m.Datr}\n\t\t} else {\n\t\t\t*d = semtech.Datrparser{Kind: \"string\", Value: *m.Datr}\n\t\t}\n\t}\n\n\t// Time :'( ... By default, we mashall them as RFC3339Nano and unmarshall them the best we can.\n\tif m.Time != nil {\n\t\tt = new(semtech.Timeparser)\n\t\t*t = semtech.Timeparser{Layout: time.RFC3339Nano, Value: m.Time}\n\t}\n\n\treturn json.Marshal(metadataProxy{\n\t\tmetadata: metadata(m),\n\t\tDatr: d,\n\t\tTime: t,\n\t})\n}", "title": "" }, { "docid": "d647d7592b4f706c7fbcd1feae950b26", "score": "0.55526626", "text": "func (b BrokerProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"deliveryCount\", b.DeliveryCount)\n\tpopulate(objectMap, \"lockToken\", b.LockToken)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2f48f244db2126d03cee7374e15661c1", "score": "0.55456626", "text": "func (p PrometheusHaClusterProviderInstanceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"clusterName\", p.ClusterName)\n\tpopulate(objectMap, \"hostname\", p.Hostname)\n\tpopulate(objectMap, \"prometheusUrl\", p.PrometheusURL)\n\tobjectMap[\"providerType\"] = \"PrometheusHaCluster\"\n\tpopulate(objectMap, \"sid\", p.Sid)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "da6c4644e0a0ede911277b0194dad78b", "score": "0.553472", "text": "func (i InstancePoolFamilyCapability) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", i.Name)\n\tpopulate(objectMap, \"reason\", i.Reason)\n\tpopulate(objectMap, \"status\", i.Status)\n\tpopulate(objectMap, \"supportedLicenseTypes\", i.SupportedLicenseTypes)\n\tpopulate(objectMap, \"supportedVcoresValues\", i.SupportedVcoresValues)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "60a0aaa01f55a062664b8ca5adb8f8bd", "score": "0.5531123", "text": "func (r MedicinalProductPackaged) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(struct {\n\t\tOtherMedicinalProductPackaged\n\t\tResourceType string `json:\"resourceType\"`\n\t}{\n\t\tOtherMedicinalProductPackaged: OtherMedicinalProductPackaged(r),\n\t\tResourceType: \"MedicinalProductPackaged\",\n\t})\n}", "title": "" }, { "docid": "eb88260ac324c966cc0edc80b6f7fef3", "score": "0.5530491", "text": "func (v PhotosetsGetInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson1c889379EncodeGithubComToomoreLazyflickrgoJsonstruct7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "9dccbc157586da30403c1fdded7ab32b", "score": "0.55303675", "text": "func (m ManagerProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"cisIntrinsicSettings\", m.CisIntrinsicSettings)\n\tpopulate(objectMap, \"provisioningState\", m.ProvisioningState)\n\tpopulate(objectMap, \"sku\", m.SKU)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f5a6a63722c8dfeec7dbd3d1a4e1a8b2", "score": "0.5514529", "text": "func (m ManagedHsm) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"location\", m.Location)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"sku\", m.SKU)\n\tpopulate(objectMap, \"systemData\", m.SystemData)\n\tpopulate(objectMap, \"tags\", m.Tags)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a447f4acf810da2218e912270bed71d5", "score": "0.54991454", "text": "func (v ResultMetaData) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson69c461c7EncodeCita6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "d23eedd0f8e582b151c2d054eecd4957", "score": "0.5495297", "text": "func (g GalleryImageProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"author\", g.Author)\n\tpopulateTimeRFC3339(objectMap, \"createdDate\", g.CreatedDate)\n\tpopulate(objectMap, \"description\", g.Description)\n\tpopulate(objectMap, \"enabled\", g.Enabled)\n\tpopulate(objectMap, \"icon\", g.Icon)\n\tpopulate(objectMap, \"imageReference\", g.ImageReference)\n\tpopulate(objectMap, \"isPlanAuthorized\", g.IsPlanAuthorized)\n\tpopulate(objectMap, \"planId\", g.PlanID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "75f1eee69384c20d7efc0f7d525d9494", "score": "0.54898614", "text": "func (sb StorageBundle) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fc6206fb579ecd7af14106c23a8a1491", "score": "0.54843307", "text": "func (p *ProductFamiliesRequest) 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 \"customerSubscriptionDetails\":\n\t\t\terr = unpopulate(val, \"CustomerSubscriptionDetails\", &p.CustomerSubscriptionDetails)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"filterableProperties\":\n\t\t\terr = unpopulate(val, \"FilterableProperties\", &p.FilterableProperties)\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": "7134369e84adb959b239a416d2783d52", "score": "0.54815555", "text": "func (a ADLSGen2FileSystemDataSetMappingProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"dataSetId\", a.DataSetID)\n\tpopulate(objectMap, \"dataSetMappingStatus\", a.DataSetMappingStatus)\n\tpopulate(objectMap, \"fileSystem\", a.FileSystem)\n\tpopulate(objectMap, \"provisioningState\", a.ProvisioningState)\n\tpopulate(objectMap, \"resourceGroup\", a.ResourceGroup)\n\tpopulate(objectMap, \"storageAccountName\", a.StorageAccountName)\n\tpopulate(objectMap, \"subscriptionId\", a.SubscriptionID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "071bb0bf5d9dfd25511014af2f27f4ac", "score": "0.5472186", "text": "func (b BlobMappingProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"containerName\", b.ContainerName)\n\tpopulate(objectMap, \"dataSetId\", b.DataSetID)\n\tpopulate(objectMap, \"dataSetMappingStatus\", b.DataSetMappingStatus)\n\tpopulate(objectMap, \"filePath\", b.FilePath)\n\tpopulate(objectMap, \"outputType\", b.OutputType)\n\tpopulate(objectMap, \"provisioningState\", b.ProvisioningState)\n\tpopulate(objectMap, \"resourceGroup\", b.ResourceGroup)\n\tpopulate(objectMap, \"storageAccountName\", b.StorageAccountName)\n\tpopulate(objectMap, \"subscriptionId\", b.SubscriptionID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9d5b3dbc1cba3bb03f9ffb0de4f5f399", "score": "0.54718846", "text": "func (b BaselineMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"value\", b.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6b1ed2b3d087da6eeb4eb967c0f1ee41", "score": "0.5466093", "text": "func (a ADLSGen2FileDataSetMappingProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"dataSetId\", a.DataSetID)\n\tpopulate(objectMap, \"dataSetMappingStatus\", a.DataSetMappingStatus)\n\tpopulate(objectMap, \"filePath\", a.FilePath)\n\tpopulate(objectMap, \"fileSystem\", a.FileSystem)\n\tpopulate(objectMap, \"outputType\", a.OutputType)\n\tpopulate(objectMap, \"provisioningState\", a.ProvisioningState)\n\tpopulate(objectMap, \"resourceGroup\", a.ResourceGroup)\n\tpopulate(objectMap, \"storageAccountName\", a.StorageAccountName)\n\tpopulate(objectMap, \"subscriptionId\", a.SubscriptionID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5b43dee120c01f76fe9847cce6cccd47", "score": "0.546042", "text": "func (d DeployerVMPackages) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"storageAccountId\", d.StorageAccountID)\n\tpopulate(objectMap, \"url\", d.URL)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d58ee3ada87ce81d9f18bd5f09f6dd88", "score": "0.5454893", "text": "func (m MetadataValue) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"value\", m.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d58ee3ada87ce81d9f18bd5f09f6dd88", "score": "0.5454893", "text": "func (m MetadataValue) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"value\", m.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a2d58cde8c36f99df240d8106f14a6f4", "score": "0.54424167", "text": "func (p ProviderOperationsMetadataListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", p.NextLink)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "69a31565b4ad1d51751d82b92b6a6215", "score": "0.54361755", "text": "func (agp ApplicationGroupProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif agp.Description != nil {\n\t\tobjectMap[\"description\"] = agp.Description\n\t}\n\tif agp.FriendlyName != nil {\n\t\tobjectMap[\"friendlyName\"] = agp.FriendlyName\n\t}\n\tif agp.HostPoolArmPath != nil {\n\t\tobjectMap[\"hostPoolArmPath\"] = agp.HostPoolArmPath\n\t}\n\tif agp.ApplicationGroupType != \"\" {\n\t\tobjectMap[\"applicationGroupType\"] = agp.ApplicationGroupType\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f659a3d9532ea91ffbddeb2845e3fad7", "score": "0.5422977", "text": "func (s SearchMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"aggregatedGroupingFields\", s.AggregatedGroupingFields)\n\tpopulate(objectMap, \"aggregatedValueField\", s.AggregatedValueField)\n\tpopulate(objectMap, \"coreSummaries\", s.CoreSummaries)\n\tpopulate(objectMap, \"eTag\", s.ETag)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulateTimeRFC3339(objectMap, \"lastUpdated\", s.LastUpdated)\n\tpopulate(objectMap, \"max\", s.Max)\n\tpopulate(objectMap, \"requestTime\", s.RequestTime)\n\tpopulate(objectMap, \"resultType\", s.ResultType)\n\tpopulate(objectMap, \"schema\", s.Schema)\n\tpopulate(objectMap, \"requestId\", s.SearchID)\n\tpopulate(objectMap, \"sort\", s.Sort)\n\tpopulateTimeRFC3339(objectMap, \"startTime\", s.StartTime)\n\tpopulate(objectMap, \"status\", s.Status)\n\tpopulate(objectMap, \"sum\", s.Sum)\n\tpopulate(objectMap, \"top\", s.Top)\n\tpopulate(objectMap, \"total\", s.Total)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "52faad2a84c8445a40cd9b14abd304eb", "score": "0.5419342", "text": "func (v VolumeGroupMetaData) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"applicationIdentifier\", v.ApplicationIdentifier)\n\tpopulate(objectMap, \"applicationType\", v.ApplicationType)\n\tpopulate(objectMap, \"deploymentSpecId\", v.DeploymentSpecID)\n\tpopulate(objectMap, \"globalPlacementRules\", v.GlobalPlacementRules)\n\tpopulate(objectMap, \"groupDescription\", v.GroupDescription)\n\tpopulate(objectMap, \"volumesCount\", v.VolumesCount)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84c3c79e0100ac3ef7a879f640cb83a4", "score": "0.5413642", "text": "func (p *ProductFamilyProperties) 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 \"availabilityInformation\":\n\t\t\terr = unpopulate(val, \"AvailabilityInformation\", &p.AvailabilityInformation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"costInformation\":\n\t\t\terr = unpopulate(val, \"CostInformation\", &p.CostInformation)\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 \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &p.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"filterableProperties\":\n\t\t\terr = unpopulate(val, \"FilterableProperties\", &p.FilterableProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hierarchyInformation\":\n\t\t\terr = unpopulate(val, \"HierarchyInformation\", &p.HierarchyInformation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"imageInformation\":\n\t\t\terr = unpopulate(val, \"ImageInformation\", &p.ImageInformation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"productLines\":\n\t\t\terr = unpopulate(val, \"ProductLines\", &p.ProductLines)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceProviderDetails\":\n\t\t\terr = unpopulate(val, \"ResourceProviderDetails\", &p.ResourceProviderDetails)\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": "72bd00fd62497e1889b7d02cd4a3c1da", "score": "0.54115176", "text": "func (m MetricSpecifications) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"aggregationType\", m.AggregationType)\n\tpopulate(objectMap, \"category\", m.Category)\n\tpopulate(objectMap, \"delegateMetricNameOverride\", m.DelegateMetricNameOverride)\n\tpopulate(objectMap, \"dimensions\", m.Dimensions)\n\tpopulate(objectMap, \"displayDescription\", m.DisplayDescription)\n\tpopulate(objectMap, \"displayName\", m.DisplayName)\n\tpopulate(objectMap, \"enableRegionalMdmAccount\", m.EnableRegionalMdmAccount)\n\tpopulate(objectMap, \"fillGapWithZero\", m.FillGapWithZero)\n\tpopulate(objectMap, \"isInternal\", m.IsInternal)\n\tpopulate(objectMap, \"metricFilterPattern\", m.MetricFilterPattern)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"resourceIdDimensionNameOverride\", m.ResourceIDDimensionNameOverride)\n\tpopulate(objectMap, \"sourceMdmAccount\", m.SourceMdmAccount)\n\tpopulate(objectMap, \"sourceMdmNamespace\", m.SourceMdmNamespace)\n\tpopulate(objectMap, \"supportedAggregationTypes\", m.SupportedAggregationTypes)\n\tpopulate(objectMap, \"supportedTimeGrainTypes\", m.SupportedTimeGrainTypes)\n\tpopulate(objectMap, \"unit\", m.Unit)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "260a21a4eaccec43ee5c554fb84ffa2f", "score": "0.5408278", "text": "func (f FunctionProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", f.Etag)\n\tpopulate(objectMap, \"properties\", f.Properties)\n\tobjectMap[\"type\"] = f.Type\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8c71e05c5020fcb2d5545b605070c5ef", "score": "0.54067236", "text": "func (p ProductsListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"nextLink\", p.NextLink)\n\tpopulate(objectMap, \"totalCount\", p.TotalCount)\n\tpopulate(objectMap, \"value\", p.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f924819e8b7cd5592024966107cc10c9", "score": "0.53972185", "text": "func (a AssemblyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"assemblyCulture\", a.AssemblyCulture)\n\tpopulate(objectMap, \"assemblyName\", a.AssemblyName)\n\tpopulate(objectMap, \"assemblyPublicKeyToken\", a.AssemblyPublicKeyToken)\n\tpopulate(objectMap, \"assemblyVersion\", a.AssemblyVersion)\n\tpopulateTimeRFC3339(objectMap, \"changedTime\", a.ChangedTime)\n\tpopulate(objectMap, \"content\", &a.Content)\n\tpopulate(objectMap, \"contentLink\", a.ContentLink)\n\tpopulate(objectMap, \"contentType\", a.ContentType)\n\tpopulateTimeRFC3339(objectMap, \"createdTime\", a.CreatedTime)\n\tpopulate(objectMap, \"metadata\", &a.Metadata)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4ce51fde4efd472580088b5867781f86", "score": "0.5394821", "text": "func (m ManagedHsmProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"createMode\", m.CreateMode)\n\tpopulate(objectMap, \"enablePurgeProtection\", m.EnablePurgeProtection)\n\tpopulate(objectMap, \"enableSoftDelete\", m.EnableSoftDelete)\n\tpopulate(objectMap, \"hsmUri\", m.HsmURI)\n\tpopulate(objectMap, \"initialAdminObjectIds\", m.InitialAdminObjectIDs)\n\tpopulate(objectMap, \"networkAcls\", m.NetworkACLs)\n\tpopulate(objectMap, \"privateEndpointConnections\", m.PrivateEndpointConnections)\n\tpopulate(objectMap, \"provisioningState\", m.ProvisioningState)\n\tpopulate(objectMap, \"publicNetworkAccess\", m.PublicNetworkAccess)\n\tpopulate(objectMap, \"regions\", m.Regions)\n\tpopulateTimeRFC3339(objectMap, \"scheduledPurgeDate\", m.ScheduledPurgeDate)\n\tpopulate(objectMap, \"securityDomainProperties\", m.SecurityDomainProperties)\n\tpopulate(objectMap, \"softDeleteRetentionInDays\", m.SoftDeleteRetentionInDays)\n\tpopulate(objectMap, \"statusMessage\", m.StatusMessage)\n\tpopulate(objectMap, \"tenantId\", m.TenantID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ccb7bc3463ffe06196bcf846d974da45", "score": "0.53937703", "text": "func (p ProductLineProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"availabilityInformation\", p.AvailabilityInformation)\n\tpopulate(objectMap, \"costInformation\", p.CostInformation)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"displayName\", p.DisplayName)\n\tpopulate(objectMap, \"filterableProperties\", p.FilterableProperties)\n\tpopulate(objectMap, \"hierarchyInformation\", p.HierarchyInformation)\n\tpopulate(objectMap, \"imageInformation\", p.ImageInformation)\n\tpopulate(objectMap, \"products\", p.Products)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "55f2cfc01fb16ac43a376404e6690e29", "score": "0.5371686", "text": "func (m ManualResolutionProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"targetId\", m.TargetID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c607fed5fd5887d1eb52ffbcbffec943", "score": "0.53629696", "text": "func (s StorageInsightProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"containers\", s.Containers)\n\tpopulate(objectMap, \"status\", s.Status)\n\tpopulate(objectMap, \"storageAccount\", s.StorageAccount)\n\tpopulate(objectMap, \"tables\", s.Tables)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b49f18b9e73c8626d599e0acfc81f610", "score": "0.53629315", "text": "func (o GetProductsProductFidPricesOKBody) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tgetProductsProductFidPricesOKBodyAO0, err := swag.WriteJSON(o.Envelope)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, getProductsProductFidPricesOKBodyAO0)\n\tvar dataGetProductsProductFidPricesOKBodyAO1 struct {\n\t\tData *models.ProductPrices `json:\"data,omitempty\"`\n\t}\n\n\tdataGetProductsProductFidPricesOKBodyAO1.Data = o.Data\n\n\tjsonDataGetProductsProductFidPricesOKBodyAO1, errGetProductsProductFidPricesOKBodyAO1 := swag.WriteJSON(dataGetProductsProductFidPricesOKBodyAO1)\n\tif errGetProductsProductFidPricesOKBodyAO1 != nil {\n\t\treturn nil, errGetProductsProductFidPricesOKBodyAO1\n\t}\n\t_parts = append(_parts, jsonDataGetProductsProductFidPricesOKBodyAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "e2859dfd95791101982473fafddb8b38", "score": "0.5362551", "text": "func (s SKU) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tif s.Family == nil {\n\t\ts.Family = to.Ptr(SKUFamilyA)\n\t}\n\tpopulate(objectMap, \"family\", s.Family)\n\tpopulate(objectMap, \"name\", s.Name)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5d753137b58bd79e5138502065eaffc1", "score": "0.5360644", "text": "func (a AggregateFunctionProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", a.Etag)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tobjectMap[\"type\"] = \"Aggregate\"\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "66f1672a0580b8a3fb140c5ae7e4fc1a", "score": "0.5351479", "text": "func (a APIResourceMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"ApiType\", a.APIType)\n\tpopulate(objectMap, \"brandColor\", a.BrandColor)\n\tpopulate(objectMap, \"connectionType\", a.ConnectionType)\n\tpopulate(objectMap, \"deploymentParameters\", a.DeploymentParameters)\n\tpopulate(objectMap, \"hideKey\", a.HideKey)\n\tpopulate(objectMap, \"provisioningState\", a.ProvisioningState)\n\tpopulate(objectMap, \"source\", a.Source)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"wsdlImportMethod\", a.WsdlImportMethod)\n\tpopulate(objectMap, \"wsdlService\", a.WsdlService)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "43d028ace9d1897228707f369529ac67", "score": "0.53418857", "text": "func (k KustoDatabaseDataSetMappingProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"dataSetId\", k.DataSetID)\n\tpopulate(objectMap, \"dataSetMappingStatus\", k.DataSetMappingStatus)\n\tpopulate(objectMap, \"kustoClusterResourceId\", k.KustoClusterResourceID)\n\tpopulate(objectMap, \"location\", k.Location)\n\tpopulate(objectMap, \"provisioningState\", k.ProvisioningState)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c6d936550a3fb47c000c9547581bd852", "score": "0.53404915", "text": "func (m PropertyDefinition) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\taO0, err := swag.WriteJSON(m.Entity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO0)\n\tvar dataAO1 struct {\n\t\tGroupFid string `json:\"groupFid,omitempty\"`\n\n\t\tKey string `json:\"key,omitempty\"`\n\n\t\tType string `json:\"type,omitempty\"`\n\n\t\tValidationConfig string `json:\"validationConfig,omitempty\"`\n\n\t\tValidationType string `json:\"validationType,omitempty\"`\n\n\t\tValueType string `json:\"valueType,omitempty\"`\n\n\t\tValues []string `json:\"values\"`\n\t}\n\n\tdataAO1.GroupFid = m.GroupFid\n\n\tdataAO1.Key = m.Key\n\n\tdataAO1.Type = m.Type\n\n\tdataAO1.ValidationConfig = m.ValidationConfig\n\n\tdataAO1.ValidationType = m.ValidationType\n\n\tdataAO1.ValueType = m.ValueType\n\n\tdataAO1.Values = m.Values\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "58c84a79124679326b25daca65a7716c", "score": "0.5340012", "text": "func (p ProductDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"count\", p.Count)\n\tpopulate(objectMap, \"deviceDetails\", p.DeviceDetails)\n\tpopulate(objectMap, \"displayInfo\", p.DisplayInfo)\n\tpopulate(objectMap, \"hierarchyInformation\", p.HierarchyInformation)\n\tpopulate(objectMap, \"productDoubleEncryptionStatus\", p.ProductDoubleEncryptionStatus)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b5529ed2c408af347ad9ecf0a095c732", "score": "0.5338733", "text": "func (p PropertiesFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"provisioningState\", p.ProvisioningState)\n\tpopulate(objectMap, \"publicLandMobileNetworkIdentifier\", p.PublicLandMobileNetworkIdentifier)\n\tpopulate(objectMap, \"serviceKey\", p.ServiceKey)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5f33c827991cd87de65902bb0c0d698d", "score": "0.5335872", "text": "func (m ManagementGroupProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"created\", m.Created)\n\tpopulateTimeRFC3339(objectMap, \"dataReceived\", m.DataReceived)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"isGateway\", m.IsGateway)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"sku\", m.SKU)\n\tpopulate(objectMap, \"serverCount\", m.ServerCount)\n\tpopulate(objectMap, \"version\", m.Version)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d341aff08698b285fea98b8d4196d462", "score": "0.53341854", "text": "func (i *DataCenterInfo) MarshalJSON() ([]byte, error) {\n\ttype named struct {\n\t\tName string `json:\"name\"`\n\t\tClass string `json:\"@class\"`\n\t}\n\tif i.Name == Amazon {\n\t\treturn json.Marshal(struct {\n\t\t\tnamed\n\t\t\tMetadata AmazonMetadataType `json:\"metadata\"`\n\t\t}{\n\t\t\tnamed{i.Name, \"com.netflix.appinfo.AmazonInfo\"},\n\t\t\ti.Metadata,\n\t\t})\n\t}\n\tclass := \"com.netflix.appinfo.MyDataCenterInfo\"\n\tif i.Name != MyOwn {\n\t\tclass = i.Class\n\t}\n\treturn json.Marshal(struct {\n\t\tnamed\n\t\tMetadata map[string]string `json:\"metadata,omitempty\"`\n\t}{\n\t\tnamed{i.Name, class},\n\t\ti.AlternateMetadata,\n\t})\n}", "title": "" }, { "docid": "5901e240019f25042133a85558518960", "score": "0.53331226", "text": "func (v PhotosetInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson1c889379EncodeGithubComToomoreLazyflickrgoJsonstruct8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "a11e848402ec14cfa6df35aa67605255", "score": "0.53269184", "text": "func (obj ProductTypeReference) MarshalJSON() ([]byte, error) {\n\ttype Alias ProductTypeReference\n\treturn json.Marshal(struct {\n\t\tTypeID string `json:\"typeId\"`\n\t\t*Alias\n\t}{TypeID: \"product-type\", Alias: (*Alias)(&obj)})\n}", "title": "" }, { "docid": "5680cac3a5b0ff2b74e031e9701d7e09", "score": "0.53262645", "text": "func (a AggregateFunctionProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", a.Etag)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tobjectMap[\"type\"] = \"Aggregate\"\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4da6bf5e253407cfe7d7ff81faa53603", "score": "0.53227824", "text": "func (r MedicinalProductIngredient) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(struct {\n\t\tOtherMedicinalProductIngredient\n\t\tResourceType string `json:\"resourceType\"`\n\t}{\n\t\tOtherMedicinalProductIngredient: OtherMedicinalProductIngredient(r),\n\t\tResourceType: \"MedicinalProductIngredient\",\n\t})\n}", "title": "" }, { "docid": "c91f6335598add2f44f9d52f93d1171f", "score": "0.53225815", "text": "func (d DatabaseExtensionsProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"operationMode\", d.OperationMode)\n\tpopulate(objectMap, \"storageKey\", d.StorageKey)\n\tpopulate(objectMap, \"storageKeyType\", d.StorageKeyType)\n\tpopulate(objectMap, \"storageUri\", d.StorageURI)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "49aef0832c84abeddc525ec0845d7079", "score": "0.53174126", "text": "func (a AzureFunctionOutputDataSourceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"apiKey\", a.APIKey)\n\tpopulate(objectMap, \"functionAppName\", a.FunctionAppName)\n\tpopulate(objectMap, \"functionName\", a.FunctionName)\n\tpopulate(objectMap, \"maxBatchCount\", a.MaxBatchCount)\n\tpopulate(objectMap, \"maxBatchSize\", a.MaxBatchSize)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "12b2dfe31e359b695c466b15173d6c85", "score": "0.5316006", "text": "func (vvnfpf VendorVirtualNetworkFunctionPropertiesFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif vvnfpf.VendorProvisioningState != \"\" {\n\t\tobjectMap[\"vendorProvisioningState\"] = vvnfpf.VendorProvisioningState\n\t}\n\tif vvnfpf.VirtualNetworkFunctionVendorConfigurations != nil {\n\t\tobjectMap[\"virtualNetworkFunctionVendorConfigurations\"] = vvnfpf.VirtualNetworkFunctionVendorConfigurations\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2c3c2739d72bd1715f1eacdda71c3e0a", "score": "0.5310883", "text": "func (d DisplayInfo) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"configurationDisplayName\", d.ConfigurationDisplayName)\n\tpopulate(objectMap, \"productFamilyDisplayName\", d.ProductFamilyDisplayName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5c16e17f6aebabfe9acd193fb4334d42", "score": "0.5310749", "text": "func (m Product) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\taO0, err := swag.WriteJSON(m.Entity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO0)\n\tvar dataAO1 struct {\n\t\tAllowQuantity int32 `json:\"allowQuantity,omitempty\"`\n\n\t\tDefaultPrice *ProductPrice `json:\"defaultPrice,omitempty\"`\n\n\t\tDefaultPriceFid string `json:\"defaultPriceFid,omitempty\"`\n\n\t\tManagerType string `json:\"managerType,omitempty\"`\n\n\t\tMaxQuantity int64 `json:\"maxQuantity,omitempty\"`\n\n\t\tParentFid string `json:\"parentFid,omitempty\"`\n\n\t\tProductType int32 `json:\"productType,omitempty\"`\n\n\t\tStatementDescription string `json:\"statementDescription,omitempty\"`\n\n\t\tTaxGroupFid string `json:\"taxGroupFid,omitempty\"`\n\n\t\tTaxable int64 `json:\"taxable,omitempty\"`\n\n\t\tTrialDays int32 `json:\"trialDays,omitempty\"`\n\t}\n\n\tdataAO1.AllowQuantity = m.AllowQuantity\n\n\tdataAO1.DefaultPrice = m.DefaultPrice\n\n\tdataAO1.DefaultPriceFid = m.DefaultPriceFid\n\n\tdataAO1.ManagerType = m.ManagerType\n\n\tdataAO1.MaxQuantity = m.MaxQuantity\n\n\tdataAO1.ParentFid = m.ParentFid\n\n\tdataAO1.ProductType = m.ProductType\n\n\tdataAO1.StatementDescription = m.StatementDescription\n\n\tdataAO1.TaxGroupFid = m.TaxGroupFid\n\n\tdataAO1.Taxable = m.Taxable\n\n\tdataAO1.TrialDays = m.TrialDays\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "50bac3c53eeca3df7499b30c9e71beb3", "score": "0.5309484", "text": "func (p *ProductFamily) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &p.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\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "18cf75ecd62da50222d223c6affe36f4", "score": "0.5309389", "text": "func (p ProviderSpecificProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tobjectMap[\"providerType\"] = p.ProviderType\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "90357341e0f90d66a6777b301bf22d5f", "score": "0.53031105", "text": "func (sap StorageAccountProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif sap.Description != nil {\n\t\tobjectMap[\"description\"] = sap.Description\n\t}\n\tif sap.StorageAccountStatus != \"\" {\n\t\tobjectMap[\"storageAccountStatus\"] = sap.StorageAccountStatus\n\t}\n\tif sap.DataPolicy != \"\" {\n\t\tobjectMap[\"dataPolicy\"] = sap.DataPolicy\n\t}\n\tif sap.StorageAccountCredentialID != nil {\n\t\tobjectMap[\"storageAccountCredentialId\"] = sap.StorageAccountCredentialID\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e944a22a4a472413b5f72ac729a33bc7", "score": "0.5298644", "text": "func (a ApplicationPackageProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"format\", a.Format)\n\tpopulateTimeRFC3339(objectMap, \"lastActivationTime\", a.LastActivationTime)\n\tpopulate(objectMap, \"state\", a.State)\n\tpopulate(objectMap, \"storageUrl\", a.StorageURL)\n\tpopulateTimeRFC3339(objectMap, \"storageUrlExpiry\", a.StorageURLExpiry)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "162038c808fe452a3292756afe56ffb8", "score": "0.5285366", "text": "func (s ServiceBusTopicOutputDataSourceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"authenticationMode\", s.AuthenticationMode)\n\tpopulate(objectMap, \"propertyColumns\", s.PropertyColumns)\n\tpopulate(objectMap, \"serviceBusNamespace\", s.ServiceBusNamespace)\n\tpopulate(objectMap, \"sharedAccessPolicyKey\", s.SharedAccessPolicyKey)\n\tpopulate(objectMap, \"sharedAccessPolicyName\", s.SharedAccessPolicyName)\n\tpopulate(objectMap, \"systemPropertyColumns\", s.SystemPropertyColumns)\n\tpopulate(objectMap, \"topicName\", s.TopicName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a93c08691f474a9f65efd92da9b76c0e", "score": "0.5283141", "text": "func (v PhotosGetInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson1c889379EncodeGithubComToomoreLazyflickrgoJsonstruct12(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "b140db9db1a54780d4fb817bc333b52e", "score": "0.5283058", "text": "func (s *ManySpecies) Marshal() ([]byte, error) {\n\treturn json.Marshal(s)\n}", "title": "" }, { "docid": "78f6997f1379c8bac293ae9f14ecfc6f", "score": "0.5278738", "text": "func (a PolicyDataChangeNotification_OpSpecDataMap) MarshalJSON() ([]byte, error) {\n\tvar err error\n\tobject := make(map[string]json.RawMessage)\n\n\tfor fieldName, field := range a.AdditionalProperties {\n\t\tobject[fieldName], err = json.Marshal(field)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error marshaling '%s': %w\", fieldName, err)\n\t\t}\n\t}\n\treturn json.Marshal(object)\n}", "title": "" }, { "docid": "d6d4795185a609d50fc6b3d81b3279ef", "score": "0.5276982", "text": "func (sdb SasDefinitionBundle) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0e05f6b6af10c911e6a737db07dae631", "score": "0.5275703", "text": "func (p *ManagementClientListProductFamiliesMetadataPager) PageResponse() ManagementClientListProductFamiliesMetadataResponse {\n\treturn p.current\n}", "title": "" }, { "docid": "ffe54cf008bd54de2535966721a22204", "score": "0.5268964", "text": "func (vs VendorSku) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif vs.VendorSkuPropertiesFormat != nil {\n\t\tobjectMap[\"properties\"] = vs.VendorSkuPropertiesFormat\n\t}\n\tif vs.Location != nil {\n\t\tobjectMap[\"location\"] = vs.Location\n\t}\n\tif vs.Tags != nil {\n\t\tobjectMap[\"tags\"] = vs.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c15d467060303a693f837d635f921e6e", "score": "0.5266442", "text": "func (c CommonProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"availabilityInformation\", c.AvailabilityInformation)\n\tpopulate(objectMap, \"costInformation\", c.CostInformation)\n\tpopulate(objectMap, \"description\", c.Description)\n\tpopulate(objectMap, \"displayName\", c.DisplayName)\n\tpopulate(objectMap, \"filterableProperties\", c.FilterableProperties)\n\tpopulate(objectMap, \"hierarchyInformation\", c.HierarchyInformation)\n\tpopulate(objectMap, \"imageInformation\", c.ImageInformation)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6bea42b2e18acc3201f0127f3d0d9e6f", "score": "0.5264701", "text": "func (r RegistryProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"adminUserEnabled\", r.AdminUserEnabled)\n\tpopulateTimeRFC3339(objectMap, \"creationDate\", r.CreationDate)\n\tpopulate(objectMap, \"loginServer\", r.LoginServer)\n\tpopulate(objectMap, \"networkRuleSet\", r.NetworkRuleSet)\n\tpopulate(objectMap, \"policies\", r.Policies)\n\tpopulate(objectMap, \"provisioningState\", r.ProvisioningState)\n\tpopulate(objectMap, \"status\", r.Status)\n\tpopulate(objectMap, \"storageAccount\", r.StorageAccount)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6bf2331cc38e4e1c93ad7eb236000b25", "score": "0.5263715", "text": "func (s ServiceBusTopicOutputDataSourceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"authenticationMode\", s.AuthenticationMode)\n\tpopulate(objectMap, \"propertyColumns\", s.PropertyColumns)\n\tpopulate(objectMap, \"serviceBusNamespace\", s.ServiceBusNamespace)\n\tpopulate(objectMap, \"sharedAccessPolicyKey\", s.SharedAccessPolicyKey)\n\tpopulate(objectMap, \"sharedAccessPolicyName\", s.SharedAccessPolicyName)\n\tpopulate(objectMap, \"systemPropertyColumns\", s.SystemPropertyColumns)\n\tpopulate(objectMap, \"topicName\", s.TopicName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e32d89b9371484dcb6cb7a05d6397624", "score": "0.52606505", "text": "func (m MessagingRegions) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"location\", m.Location)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"tags\", m.Tags)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2b9131b15c6e9d0682bb05444332b072", "score": "0.52588654", "text": "func (p Properties) MarshalJSON() ([]byte, error) {\n\tp.PackageType = PackageTypeWebServiceProperties\n\tobjectMap := make(map[string]interface{})\n\tif p.Title != nil {\n\t\tobjectMap[\"title\"] = p.Title\n\t}\n\tif p.Description != nil {\n\t\tobjectMap[\"description\"] = p.Description\n\t}\n\tif p.CreatedOn != nil {\n\t\tobjectMap[\"createdOn\"] = p.CreatedOn\n\t}\n\tif p.ModifiedOn != nil {\n\t\tobjectMap[\"modifiedOn\"] = p.ModifiedOn\n\t}\n\tif p.ProvisioningState != \"\" {\n\t\tobjectMap[\"provisioningState\"] = p.ProvisioningState\n\t}\n\tif p.Keys != nil {\n\t\tobjectMap[\"keys\"] = p.Keys\n\t}\n\tif p.ReadOnly != nil {\n\t\tobjectMap[\"readOnly\"] = p.ReadOnly\n\t}\n\tif p.SwaggerLocation != nil {\n\t\tobjectMap[\"swaggerLocation\"] = p.SwaggerLocation\n\t}\n\tif p.ExposeSampleData != nil {\n\t\tobjectMap[\"exposeSampleData\"] = p.ExposeSampleData\n\t}\n\tif p.RealtimeConfiguration != nil {\n\t\tobjectMap[\"realtimeConfiguration\"] = p.RealtimeConfiguration\n\t}\n\tif p.Diagnostics != nil {\n\t\tobjectMap[\"diagnostics\"] = p.Diagnostics\n\t}\n\tif p.StorageAccount != nil {\n\t\tobjectMap[\"storageAccount\"] = p.StorageAccount\n\t}\n\tif p.MachineLearningWorkspace != nil {\n\t\tobjectMap[\"machineLearningWorkspace\"] = p.MachineLearningWorkspace\n\t}\n\tif p.CommitmentPlan != nil {\n\t\tobjectMap[\"commitmentPlan\"] = p.CommitmentPlan\n\t}\n\tif p.Input != nil {\n\t\tobjectMap[\"input\"] = p.Input\n\t}\n\tif p.Output != nil {\n\t\tobjectMap[\"output\"] = p.Output\n\t}\n\tif p.ExampleRequest != nil {\n\t\tobjectMap[\"exampleRequest\"] = p.ExampleRequest\n\t}\n\tif p.Assets != nil {\n\t\tobjectMap[\"assets\"] = p.Assets\n\t}\n\tif p.Parameters != nil {\n\t\tobjectMap[\"parameters\"] = p.Parameters\n\t}\n\tif p.PackageType != \"\" {\n\t\tobjectMap[\"packageType\"] = p.PackageType\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
7a14bb3bf1d238ccae43c50be8e94ae1
Request returns request for DetectedApp collection
[ { "docid": "b18229c728389cf943e3e1735fe52c90", "score": "0.6424825", "text": "func (b *ManagedDeviceDetectedAppsCollectionRequestBuilder) Request() *ManagedDeviceDetectedAppsCollectionRequest {\n\treturn &ManagedDeviceDetectedAppsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" } ]
[ { "docid": "d685ea6e362dc9ad4114041baac90483", "score": "0.6371346", "text": "func (b *DeviceManagementDetectedAppsCollectionRequestBuilder) Request() *DeviceManagementDetectedAppsCollectionRequest {\n\treturn &DeviceManagementDetectedAppsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "e431890f8af5fd3327dc239dcc6e0f14", "score": "0.6158626", "text": "func (r *DeviceManagementDetectedAppsCollectionRequest) Get(ctx context.Context) ([]DetectedApp, error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\treturn r.Paging(ctx, \"GET\", query, nil)\n}", "title": "" }, { "docid": "781745447853c1a773eb7bd35831bef2", "score": "0.61559886", "text": "func (m *ManagedDevicesItemDetectedAppsRequestBuilder) Get(ctx context.Context, requestConfiguration *ManagedDevicesItemDetectedAppsRequestBuilderGetRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DetectedAppCollectionResponseable, 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, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreateDetectedAppCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DetectedAppCollectionResponseable), nil\n}", "title": "" }, { "docid": "5f37f53c9483394024edde907eaacc7b", "score": "0.6094877", "text": "func (b *DeviceManagementRequestBuilder) DetectedApps() *DeviceManagementDetectedAppsCollectionRequestBuilder {\n\tbb := &DeviceManagementDetectedAppsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/detectedApps\"\n\treturn bb\n}", "title": "" }, { "docid": "c35f71a158b509cd672e26dc97624ad7", "score": "0.601279", "text": "func (r *ManagedDeviceDetectedAppsCollectionRequest) Get(ctx context.Context) ([]DetectedApp, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "34b4503e2a1bb3b9ba096950bd02c1e4", "score": "0.5962261", "text": "func (b *ManagedDeviceRequestBuilder) DetectedApps() *ManagedDeviceDetectedAppsCollectionRequestBuilder {\n\tbb := &ManagedDeviceDetectedAppsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/detectedApps\"\n\treturn bb\n}", "title": "" }, { "docid": "aa39458c6444bc8ec6b95718d17955ca", "score": "0.59068567", "text": "func (b *TargetedManagedAppConfigurationAppsCollectionRequestBuilder) Request() *TargetedManagedAppConfigurationAppsCollectionRequest {\n\treturn &TargetedManagedAppConfigurationAppsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "57ddb9485a767bf23bcb93232b3a9dfb", "score": "0.5895901", "text": "func (b *AppVulnerabilityTaskMobileAppsCollectionRequestBuilder) Request() *AppVulnerabilityTaskMobileAppsCollectionRequest {\n\treturn &AppVulnerabilityTaskMobileAppsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "aafa5b43001c2b6310817a5468b91fcf", "score": "0.5819623", "text": "func (m *DeviceManagementRequestBuilder) DetectedApps()(*DetectedAppsRequestBuilder) {\n return NewDetectedAppsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "a0d30106cbabb7198a7c3387e13c4078", "score": "0.5796815", "text": "func (m *DeviceManagementRequestBuilder) DetectedApps()(*i53b822adbf609100b4c0e4ed0fa96d2a112352ee03fab86eef01c0ffdf52bb08.DetectedAppsRequestBuilder) {\n return i53b822adbf609100b4c0e4ed0fa96d2a112352ee03fab86eef01c0ffdf52bb08.NewDetectedAppsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "bad7d7415fcf90522fe78563ed1db05b", "score": "0.5660663", "text": "func (b *ManagedAppRegistrationIntendedPoliciesCollectionRequestBuilder) Request() *ManagedAppRegistrationIntendedPoliciesCollectionRequest {\n\treturn &ManagedAppRegistrationIntendedPoliciesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "72fdfc04bed686bb91d22a2967669682", "score": "0.5659294", "text": "func CreatePermanentDeleteAppRequest() (request *PermanentDeleteAppRequest) {\nrequest = &PermanentDeleteAppRequest{\nRpcRequest: &requests.RpcRequest{},\n}\nrequest.InitWithApiInfo(\"AMS\", \"2018-02-12\", \"PermanentDeleteApp\", \"\", \"\")\nreturn\n}", "title": "" }, { "docid": "5ae8131775c2ebf4a1e229d8926788dc", "score": "0.5572091", "text": "func (b *AppVulnerabilityTaskManagedDevicesCollectionRequestBuilder) Request() *AppVulnerabilityTaskManagedDevicesCollectionRequest {\n\treturn &AppVulnerabilityTaskManagedDevicesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "4590c505f7291f02cbaa5a6990a3aa56", "score": "0.5562219", "text": "func (b *AppCatalogsTeamsAppsCollectionRequestBuilder) Request() *AppCatalogsTeamsAppsCollectionRequest {\n\treturn &AppCatalogsTeamsAppsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "a565ae33918aa1f24f261ce2e1cf87eb", "score": "0.55225927", "text": "func (b *GraphServiceApplicationsCollectionRequestBuilder) Request() *GraphServiceApplicationsCollectionRequest {\n\treturn &GraphServiceApplicationsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "32504efe9cbada0357241a1b0d2050a8", "score": "0.5500946", "text": "func (b *ManagedAppRegistrationAppliedPoliciesCollectionRequestBuilder) Request() *ManagedAppRegistrationAppliedPoliciesCollectionRequest {\n\treturn &ManagedAppRegistrationAppliedPoliciesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "3f1e3307fae3e49cdfb1e424b17e4cdb", "score": "0.5476069", "text": "func (dm *DataManager) QueryApp(ctx context.Context, req *pb.QueryAppReq) (*pb.QueryAppResp, error) {\n\trtime := time.Now()\n\tmethod := common.GRPCMethod(ctx)\n\tlogger.V(2).Infof(\"%s[%s]| input[%+v]\", method, req.Seq, req)\n\n\tresponse := new(pb.QueryAppResp)\n\n\tdefer func() {\n\t\tcost := dm.collector.StatRequest(method, response.Code, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"%s[%s]| output[%dms][%+v]\", method, req.Seq, cost, response)\n\t}()\n\n\taction := appaction.NewQueryAction(ctx, dm.viper, dm.smgr, req, response)\n\tif err := dm.executor.Execute(action); err != nil {\n\t\tlogger.Errorf(\"%s[%s]| %+v\", method, req.Seq, err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "d4be2061cfe30ee09252c45a41ae4cf4", "score": "0.5473867", "text": "func (b *ManagedAppRegistrationOperationsCollectionRequestBuilder) Request() *ManagedAppRegistrationOperationsCollectionRequest {\n\treturn &ManagedAppRegistrationOperationsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "023b6e99521ec37f844c4c478d5a30f3", "score": "0.54663825", "text": "func (b *GraphServiceSuspiciousIPRiskEventsCollectionRequestBuilder) Request() *GraphServiceSuspiciousIPRiskEventsCollectionRequest {\n\treturn &GraphServiceSuspiciousIPRiskEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "74440ff271ea1847a01ed20fc719c9f1", "score": "0.5443223", "text": "func (m *GraphBaseServiceClient) App()(*ifc59747dbaa83f8f51942823114f4abfa41e0c0a64d67957f17e6b60407ce219.AppRequestBuilder) {\n return ifc59747dbaa83f8f51942823114f4abfa41e0c0a64d67957f17e6b60407ce219.NewAppRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "fdec582955eab7d173bf8c05aa715327", "score": "0.53848666", "text": "func (m *DeviceManagementRequestBuilder) DetectedAppsById(id string)(*i1fc4baac6aed0f5be3c916f9eb09379061c3a0c2c15a9b52bc4922b4bc48c6e1.DetectedAppItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"detectedApp%2Did\"] = id\n }\n return i1fc4baac6aed0f5be3c916f9eb09379061c3a0c2c15a9b52bc4922b4bc48c6e1.NewDetectedAppItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "c8086e0ec02d8d9eebbabc6ea474a64b", "score": "0.5379149", "text": "func NewAppDetailRequestWithoutParam() *AppDetailRequest {\n\n return &AppDetailRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/operate_backend/app/{clientId}\",\n Method: \"GET\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "9e6308ea042649e80cc39d4eb9baa7a3", "score": "0.5374838", "text": "func (r *MacOsVppAppRequest) Get(ctx context.Context) (resObj *MacOsVppApp, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "title": "" }, { "docid": "69da91d6f4f7adc098b8651e350f8831", "score": "0.53579646", "text": "func (dm *DataManager) QueryApp(ctx context.Context, req *pb.QueryAppReq) (*pb.QueryAppResp, error) {\n\trtime := time.Now()\n\tlogger.V(2).Infof(\"QueryApp[%d]| input[%+v]\", req.Seq, req)\n\tresponse := &pb.QueryAppResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_E_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := dm.collector.StatRequest(\"QueryApp\", response.ErrCode, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"QueryApp[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\taction := appaction.NewQueryAction(dm.viper, dm.smgr, req, response)\n\tdm.executor.Execute(action)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "80453ddbad706f1ebd1635354c6860d5", "score": "0.53326726", "text": "func GetSpecificApps(resp http.ResponseWriter, request *http.Request) {\n\tcors := HandleCors(resp, request)\n\tif cors {\n\t\treturn\n\t}\n\n\t//FIXME - shouldn't return everything :)\n\treturnData := fmt.Sprintf(`{\"success\": true, \"reason\": []}`)\n\tresp.WriteHeader(200)\n\tresp.Write([]byte(returnData))\n\treturn\n\n\t// Just need to be logged in\n\t// FIXME - should have some permissions?\n\tuser, err := HandleApiAuthentication(resp, request)\n\tif err != nil {\n\t\tlog.Printf(\"[WARNING] Api authentication failed in set new app: %s\", err)\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(request.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error with body read: %s\", err)\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\treturn\n\t}\n\n\ttype tmpStruct struct {\n\t\tSearch string `json:\"search\"`\n\t}\n\n\tvar tmpBody tmpStruct\n\terr = json.Unmarshal(body, &tmpBody)\n\tif err != nil {\n\t\tlog.Printf(\"[WARNING] Error with unmarshal tmpBody specific apps: %s\", err)\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\treturn\n\t}\n\n\t// FIXME - continue the search here with github repos etc.\n\t// Caching might be smart :D\n\tctx := getContext(request)\n\tworkflowapps, err := GetPrioritizedApps(ctx, user)\n\tif err != nil {\n\t\tlog.Printf(\"[WARNING] Error: Failed getting workflowapps: %s\", err)\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\treturn\n\t}\n\n\treturnValues := []WorkflowApp{}\n\tsearch := strings.ToLower(tmpBody.Search)\n\tfor _, app := range workflowapps {\n\t\tif !app.Activated && app.Generated {\n\t\t\t// This might be heavy with A LOT\n\t\t\t// Not too worried with todays tech tbh..\n\t\t\tappName := strings.ToLower(app.Name)\n\t\t\tappDesc := strings.ToLower(app.Description)\n\t\t\tif strings.Contains(appName, search) || strings.Contains(appDesc, search) {\n\t\t\t\t//log.Printf(\"Name: %s, Generated: %s, Activated: %s\", app.Name, strconv.FormatBool(app.Generated), strconv.FormatBool(app.Activated))\n\t\t\t\treturnValues = append(returnValues, app)\n\t\t\t}\n\t\t}\n\t}\n\n\tnewbody, err := json.Marshal(returnValues)\n\tif err != nil {\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(fmt.Sprintf(`{\"success\": false, \"reason\": \"Failed unpacking workflow executions\"}`)))\n\t\treturn\n\t}\n\n\treturnData = fmt.Sprintf(`{\"success\": true, \"reason\": %s}`, string(newbody))\n\tresp.WriteHeader(200)\n\tresp.Write([]byte(returnData))\n}", "title": "" }, { "docid": "da8b1a28085fb34f8f6ca7f4e667e701", "score": "0.5318808", "text": "func (m *MobileAppTroubleshootingEvent) GetAppLogCollectionRequests()([]AppLogCollectionRequestable) {\n val, err := m.GetBackingStore().Get(\"appLogCollectionRequests\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AppLogCollectionRequestable)\n }\n return nil\n}", "title": "" }, { "docid": "56fea93f1ac7b6a011bf00a185f970c9", "score": "0.5299261", "text": "func (b *ManagedMobileLobAppContentVersionsCollectionRequestBuilder) Request() *ManagedMobileLobAppContentVersionsCollectionRequest {\n\treturn &ManagedMobileLobAppContentVersionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "56fea93f1ac7b6a011bf00a185f970c9", "score": "0.5299261", "text": "func (b *ManagedMobileLobAppContentVersionsCollectionRequestBuilder) Request() *ManagedMobileLobAppContentVersionsCollectionRequest {\n\treturn &ManagedMobileLobAppContentVersionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "a15d9f2b09eb22fa4cd30ce9ced55865", "score": "0.5282817", "text": "func (b *TargetedManagedAppProtectionAssignmentsCollectionRequestBuilder) Request() *TargetedManagedAppProtectionAssignmentsCollectionRequest {\n\treturn &TargetedManagedAppProtectionAssignmentsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "779b8cd8c3d45701f016e75c6ebe3954", "score": "0.52622455", "text": "func (b *GraphServicePrivilegedOperationEventsCollectionRequestBuilder) Request() *GraphServicePrivilegedOperationEventsCollectionRequest {\n\treturn &GraphServicePrivilegedOperationEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "76c905f89d5f01c8220923d313fb1f27", "score": "0.5240441", "text": "func (r *AppVulnerabilityTaskMobileAppsCollectionRequest) Get(ctx context.Context) ([]AppVulnerabilityMobileApp, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "1295dbf8f3ce71cd126773e6d9acd140", "score": "0.5238105", "text": "func NewAppsRequestWithoutParam() *AppsRequest {\n\n return &AppsRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/operate_backend/apps\",\n Method: \"GET\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "48cf8eb85a31e1efcda67a8d3d60063f", "score": "0.52124745", "text": "func (b *GraphServiceMalwareRiskEventsCollectionRequestBuilder) Request() *GraphServiceMalwareRiskEventsCollectionRequest {\n\treturn &GraphServiceMalwareRiskEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "5ae2b02f24f62d4193ccdfc21ea88ea0", "score": "0.52001727", "text": "func (b *GraphServicePayloadResponseCollectionRequestBuilder) Request() *GraphServicePayloadResponseCollectionRequest {\n\treturn &GraphServicePayloadResponseCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "ffa2213d6675a039215566fa62373d6b", "score": "0.5182516", "text": "func (b *PolicyAppliesToCollectionRequestBuilder) Request() *PolicyAppliesToCollectionRequest {\n\treturn &PolicyAppliesToCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "12242e235317b113f814d84aa39329f2", "score": "0.5172789", "text": "func (b *GraphServicePrivilegedApprovalCollectionRequestBuilder) Request() *GraphServicePrivilegedApprovalCollectionRequest {\n\treturn &GraphServicePrivilegedApprovalCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "2e47773f9f48ff87c6a060248e333feb", "score": "0.5169684", "text": "func (a *Appc) App() *discovery.App {\n\treturn a.app.Copy()\n}", "title": "" }, { "docid": "0a384239aea20edb25c4cd25acc83e2e", "score": "0.51600415", "text": "func appList(w http.ResponseWriter, r *http.Request, t auth.Token) error {\n\tctx := r.Context()\n\tfilter := &app.Filter{}\n\tif name := r.URL.Query().Get(\"name\"); name != \"\" {\n\t\tfilter.NameMatches = name\n\t}\n\tif platform := r.URL.Query().Get(\"platform\"); platform != \"\" {\n\t\tfilter.Platform = platform\n\t}\n\tif teamOwner := r.URL.Query().Get(\"teamOwner\"); teamOwner != \"\" {\n\t\tfilter.TeamOwner = teamOwner\n\t}\n\tif owner := r.URL.Query().Get(\"owner\"); owner != \"\" {\n\t\tfilter.UserOwner = owner\n\t}\n\tif pool := r.URL.Query().Get(\"pool\"); pool != \"\" {\n\t\tfilter.Pool = pool\n\t}\n\tlocked, _ := strconv.ParseBool(r.URL.Query().Get(\"locked\"))\n\tif locked {\n\t\tfilter.Locked = true\n\t}\n\tif status, ok := r.URL.Query()[\"status\"]; ok {\n\t\tfilter.Statuses = status\n\t}\n\tif tags, ok := r.URL.Query()[\"tag\"]; ok {\n\t\tfilter.Tags = tags\n\t}\n\tcontexts := permission.ContextsForPermission(t, permission.PermAppRead)\n\tcontexts = append(contexts, permission.ContextsForPermission(t, permission.PermAppReadInfo)...)\n\tif len(contexts) == 0 {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n\tapps, err := app.List(ctx, appFilterByContext(contexts, filter))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(apps) == 0 {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n\tsimple, _ := strconv.ParseBool(r.URL.Query().Get(\"simplified\"))\n\textended, _ := strconv.ParseBool(r.URL.Query().Get(\"extended\"))\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tminiApps := make([]miniApp, len(apps))\n\tif simple {\n\t\tfor i, ap := range apps {\n\t\t\tur := app.AppUnitsResponse{Units: nil, Err: nil}\n\t\t\tminiApps[i], err = minifyApp(ap, ur, extended)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn json.NewEncoder(w).Encode(miniApps)\n\t}\n\tappUnits, err := app.Units(ctx, apps)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, app := range apps {\n\t\tminiApps[i], err = minifyApp(app, appUnits[app.Name], extended)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn json.NewEncoder(w).Encode(miniApps)\n}", "title": "" }, { "docid": "c721e87339ecac86b9fb56339f023a3f", "score": "0.515521", "text": "func (r *TargetedManagedAppConfigurationAppsCollectionRequest) Get(ctx context.Context) ([]ManagedMobileApp, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "4f95e0c3fd96bc811a2e515f97d0ddf0", "score": "0.5131638", "text": "func (b *DeviceManagementTroubleshootingEventsCollectionRequestBuilder) Request() *DeviceManagementTroubleshootingEventsCollectionRequest {\n\treturn &DeviceManagementTroubleshootingEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "f134ba7af59074b7d438c37e7ebd2c9c", "score": "0.5112642", "text": "func (b *GraphServiceRiskDetectionsCollectionRequestBuilder) Request() *GraphServiceRiskDetectionsCollectionRequest {\n\treturn &GraphServiceRiskDetectionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "43fd5a3e35fd8170ad2d9f5def89c7b9", "score": "0.5097437", "text": "func (b *OfficeGraphInsightsSharedCollectionRequestBuilder) Request() *OfficeGraphInsightsSharedCollectionRequest {\n\treturn &OfficeGraphInsightsSharedCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "dedb3a0342486bf55357366dfee57f9e", "score": "0.5095676", "text": "func (b *GraphServiceRequestBuilder) App() *CommsApplicationRequestBuilder {\n\tbb := &CommsApplicationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/app\"\n\treturn bb\n}", "title": "" }, { "docid": "11a8a875ac46e81d34ae7ad7f3cfba45", "score": "0.509123", "text": "func Query(eurekaURL string, appName string) ([]string, error) {\n\t// url := \"http://20.26.33.122:32010/eureka/apps/com.automationrhapsody.eureka.app/WKS-SOF-L011\"\n\n\turl := eurekaURL + \"/eureka/apps/\" + appName\n\tlog.I(\"Query:\", url)\n\n\tclient := &http.Client{}\n\trequest, e := http.NewRequest(\"GET\", url, nil)\n\trequest.Header.Add(\"Accept\", \"text/html,application/json;q=0.9,*/*;q=0.8\")\n\n\tif e != nil {\n\t\tlog.E(e)\n\t\treturn nil, e\n\t}\n\n\tresp, e := client.Do(request)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tdefer resp.Body.Close()\n\n\tlog.I(\"resp: \", resp.Status)\n\n\tbody, e := ioutil.ReadAll(resp.Body)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tif len(body) != 0 {\n\t\tlog.E(string(body))\n\t}\n\n\tapp := APP{}\n\te = json.ToObj(body, &app)\n\tif e != nil {\n\t\tlog.E(e)\n\t}\n\t// log.E(\"Show IP:\", app.Application.Name)\n\n\tcount := len(app.Application.Instance)\n\tresult := make([]string, count)\n\n\tfor i := 0; i < count; i++ {\n\t\tresult[i] = app.Application.Instance[i].HostName + \":\" + strconv.Itoa(app.Application.Instance[i].Port.Pt)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "71debfef83a83043b2a97d77fbc59ed8", "score": "0.5090643", "text": "func (b *UserTeamworkInstalledAppsCollectionRequestBuilder) Request() *UserTeamworkInstalledAppsCollectionRequest {\n\treturn &UserTeamworkInstalledAppsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "8abd39fc11cb5cc5c9b45502da151eb6", "score": "0.50707734", "text": "func (svc *V2Service) Query(query *AppsQuery) ([]App, error) {\n\tresp, err := svc.Repository.Read(olhttp.OLHTTPRequest{\n\t\tURL: svc.Endpoint,\n\t\tHeaders: map[string]string{\"Content-Type\": \"application/json\"},\n\t\tAuthMethod: \"bearer\",\n\t\tPayload: query,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar apps []App\n\tjson.Unmarshal(resp, &apps)\n\n\treturn apps, nil\n}", "title": "" }, { "docid": "1575048ecccc75356e1298d4e80d127c", "score": "0.5068937", "text": "func (b *MacOsVppAppAssignedLicensesCollectionRequestBuilder) Request() *MacOsVppAppAssignedLicensesCollectionRequest {\n\treturn &MacOsVppAppAssignedLicensesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "2784863b675f1b922344d9fb984dfc14", "score": "0.50652575", "text": "func (r *AppCatalogsTeamsAppsCollectionRequest) Get(ctx context.Context) ([]TeamsApp, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "e2ef70e233fdbbc9639c8484e08336c0", "score": "0.5064438", "text": "func (b *ManagedDeviceDeviceCompliancePolicyStatesCollectionRequestBuilder) Request() *ManagedDeviceDeviceCompliancePolicyStatesCollectionRequest {\n\treturn &ManagedDeviceDeviceCompliancePolicyStatesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "e16f68f825edb3017e1ca1ed66c21bf6", "score": "0.5064282", "text": "func (b *DeviceManagementResourceOperationsCollectionRequestBuilder) Request() *DeviceManagementResourceOperationsCollectionRequest {\n\treturn &DeviceManagementResourceOperationsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "b4a739119a2bcbc3f3e0df3d175acd4d", "score": "0.5059562", "text": "func (b *ListItemVersionsCollectionRequestBuilder) Request() *ListItemVersionsCollectionRequest {\n\treturn &ListItemVersionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "fc7d7ff236fb6d26b5088e806c2ea556", "score": "0.5056772", "text": "func (b *DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder) Request() *DeviceManagementDeviceCompliancePoliciesCollectionRequest {\n\treturn &DeviceManagementDeviceCompliancePoliciesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "f16d03546d0a3e65fc8f0dc87826b552", "score": "0.5054774", "text": "func queryApp(t *testing.T, appURL string, limit int) {\n\treq, err := http.NewRequest(\"GET\", appURL, nil)\n\trequire.NoError(t, err)\n\treq.Host = \"test.localhost\" // NOTE: cannot be inserted as a req.Header element, that is overwritten by this req.Host field.\n\treq.Header.Add(\"Cache-Control\", \"no-cache\")\n\treq.Header.Add(\"Connection\", \"keep-alive\")\n\t// Assert that the service is accessible. Unforetunately brittle single request.\n\ttr := &http.Transport{\n\t\tDisableKeepAlives: false,\n\t}\n\tclient := &http.Client{\n\t\tTransport: tr,\n\t}\n\n\t// retry mechanism\n\tvar resp *http.Response\n\tfor i := 0; i < limit; i++ {\n\t\ttime.Sleep(1 * time.Second) // reduce absurdly long wait period\n\t\tresp, err = client.Do(req)\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t\tcontinue\n\t\t}\n\t\tif resp != nil && resp.StatusCode == http.StatusOK {\n\t\t\terr = nil\n\t\t\tbreak\n\t\t}\n\t}\n\trequire.NoError(t, err)\n\tassert.NotNil(t, resp)\n\tassert.Equal(t, http.StatusOK, resp.StatusCode)\n\n\tbytes, err := ioutil.ReadAll(resp.Body)\n\trequire.NoError(t, err)\n\tassert.Contains(t, string(bytes), \"The Future of The Cloud is Decentralized\")\n}", "title": "" }, { "docid": "ba4c258ec32e5f3bbef37ab2c4a73e61", "score": "0.50479627", "text": "func (b *GraphServiceImpossibleTravelRiskEventsCollectionRequestBuilder) Request() *GraphServiceImpossibleTravelRiskEventsCollectionRequest {\n\treturn &GraphServiceImpossibleTravelRiskEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "9b2b1b367e46079bab92440e91efd06b", "score": "0.50405777", "text": "func (b *ManagedEBookDeviceStatesCollectionRequestBuilder) Request() *ManagedEBookDeviceStatesCollectionRequest {\n\treturn &ManagedEBookDeviceStatesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "03d552e3f950b7d32dbc5927f051bc18", "score": "0.50393075", "text": "func (b *GraphServiceDevicesCollectionRequestBuilder) Request() *GraphServiceDevicesCollectionRequest {\n\treturn &GraphServiceDevicesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "2a65e535f25535ce68b4fabaa874003c", "score": "0.5036108", "text": "func (b *DriveItemVersionsCollectionRequestBuilder) Request() *DriveItemVersionsCollectionRequest {\n\treturn &DriveItemVersionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "b4e061a2ad2d3ba72422bb4d3d1040cc", "score": "0.50345176", "text": "func (b *GraphServiceAccessReviewsCollectionRequestBuilder) Request() *GraphServiceAccessReviewsCollectionRequest {\n\treturn &GraphServiceAccessReviewsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "9d6b6d64ed12bbd8d43bf1046ce5cfd2", "score": "0.5031857", "text": "func (b *DeviceManagementDeviceCategoriesCollectionRequestBuilder) Request() *DeviceManagementDeviceCategoriesCollectionRequest {\n\treturn &DeviceManagementDeviceCategoriesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "facf0282fb43159b7bbe562d37a0a475", "score": "0.5029512", "text": "func (r *GraphServiceApplicationsCollectionRequest) Get(ctx context.Context) ([]Application, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "782462267cb21bbdace8c8740f3c85b8", "score": "0.5025236", "text": "func (b *CommsApplicationCallsCollectionRequestBuilder) Request() *CommsApplicationCallsCollectionRequest {\n\treturn &CommsApplicationCallsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "2bdda5050c88d075c68e1f8f542420dd", "score": "0.5025035", "text": "func (r *DeviceManagementDetectedAppsCollectionRequest) Add(ctx context.Context, reqObj *DetectedApp) (resObj *DetectedApp, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "title": "" }, { "docid": "2bd30531c4daa892429741f7e89ab14f", "score": "0.5017373", "text": "func (b *DeviceManagementManagedDevicesCollectionRequestBuilder) Request() *DeviceManagementManagedDevicesCollectionRequest {\n\treturn &DeviceManagementManagedDevicesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "0f9f836144f393a509a8975acd76ab06", "score": "0.50170857", "text": "func (b *GraphServiceAccessReviewDecisionsCollectionRequestBuilder) Request() *GraphServiceAccessReviewDecisionsCollectionRequest {\n\treturn &GraphServiceAccessReviewDecisionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "8c31728b51fae5e7c54578ff3295f374", "score": "0.50153255", "text": "func (client *AppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, options *AppsGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif appName == \"\" {\n\t\treturn nil, errors.New(\"parameter appName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{appName}\", url.PathEscape(appName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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-09-01-preview\")\n\tif options != nil && options.SyncStatus != nil {\n\t\treqQP.Set(\"syncStatus\", *options.SyncStatus)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "96153d9edc95c7d4bdfc6ad6264eb614", "score": "0.50144094", "text": "func (c *Client) Discover(app string) ([]*Response, error) {\n\n\t// First gets the proper uri from the right adapter\n\t// ex: \"/v1/endpoints/ID for mesos\n\trequest := c.Adapter.GetEndpointsRequest(app)\n\n\tdatas, err := c.doRequest(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := c.Adapter.ParseResponse(datas)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n\n}", "title": "" }, { "docid": "6d034e642e0c40f86284b00c40f7a540", "score": "0.50093675", "text": "func (r *ReplicatedCtl) AppInspect() ([]AppInspectResult, error) {\n\tvar results []AppInspectResult\n\traw, err := r.run(\"app\", \"inspect\")\n\tif err != nil {\n\t\treturn results, fmt.Errorf(\"could not inspect replicated apps: %w\", err)\n\t}\n\terr = json.Unmarshal(raw, &results)\n\tif err != nil {\n\t\treturn results, fmt.Errorf(\"could not parse app inspect return: %w\", err)\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "24d26ffde76c27b5d49a1e1f52c8327c", "score": "0.50079095", "text": "func (r *ManagedDeviceDetectedAppsCollectionRequest) Add(ctx context.Context, reqObj *DetectedApp) (resObj *DetectedApp, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "title": "" }, { "docid": "704ecedf8baf9d60a932d8a0509ecfca", "score": "0.50069046", "text": "func (b *GraphServiceLeakedCredentialsRiskEventsCollectionRequestBuilder) Request() *GraphServiceLeakedCredentialsRiskEventsCollectionRequest {\n\treturn &GraphServiceLeakedCredentialsRiskEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "7bba8d2daecb82196ebe7d97ed55ded4", "score": "0.5002556", "text": "func (b *ListActivitiesCollectionRequestBuilder) Request() *ListActivitiesCollectionRequest {\n\treturn &ListActivitiesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "da9ef6b5f98273b937f6077309b0ea0e", "score": "0.49820644", "text": "func (b *GraphServiceIdentityRiskEventsCollectionRequestBuilder) Request() *GraphServiceIdentityRiskEventsCollectionRequest {\n\treturn &GraphServiceIdentityRiskEventsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "2d6874a2c2e665ddc1a8e7d0d25e39db", "score": "0.49759418", "text": "func (client *AppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, options *AppsClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif appName == \"\" {\n\t\treturn nil, errors.New(\"parameter appName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{appName}\", url.PathEscape(appName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\tif options != nil && options.SyncStatus != nil {\n\t\treqQP.Set(\"syncStatus\", *options.SyncStatus)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6352fc77c895912c821ce1f7c1e27f8c", "score": "0.4972108", "text": "func getOldApps() map[string]interface{} {\n\tmarathonIP = \"http://10.198.161.42:8080/v2/apps\"\n\tmarathonURL := marathonIP + \"?id=\" + src\n\tres, err := http.Get(marathonURL)\n\tif err != nil {\n\t\tfmt.Printf(\"marathonURL err : %s\", err)\n\t}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"err : %s\", err)\n\t}\n\n\tjson.Unmarshal(body, &oldAppsSlice)\n\treturn oldAppsSlice\n}", "title": "" }, { "docid": "6169b9cf5a3773bd08cb5eb3359d51cb", "score": "0.4970177", "text": "func (dm *DataManager) QueryAppList(ctx context.Context, req *pb.QueryAppListReq) (*pb.QueryAppListResp, error) {\n\trtime := time.Now()\n\tmethod := common.GRPCMethod(ctx)\n\tlogger.V(2).Infof(\"%s[%s]| input[%+v]\", method, req.Seq, req)\n\n\tresponse := new(pb.QueryAppListResp)\n\n\tdefer func() {\n\t\tcost := dm.collector.StatRequest(method, response.Code, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"%s[%s]| output[%dms][%+v]\", method, req.Seq, cost, response)\n\t}()\n\n\taction := appaction.NewListAction(ctx, dm.viper, dm.smgr, req, response)\n\tif err := dm.executor.Execute(action); err != nil {\n\t\tlogger.Errorf(\"%s[%s]| %+v\", method, req.Seq, err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "361106bc98a315d9cd9d230f36c5eafd", "score": "0.49624956", "text": "func AppDetails(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\t// Get business layer\n\tbusiness, err := getBusiness(r)\n\tif err != nil {\n\t\tRespondWithError(w, http.StatusInternalServerError, \"Services initialization error: \"+err.Error())\n\t\treturn\n\t}\n\tnamespace := params[\"namespace\"]\n\tapp := params[\"app\"]\n\n\t// Fetch and build app\n\tappDetails, err := business.App.GetApp(namespace, app)\n\tif err != nil {\n\t\thandleErrorResponse(w, err)\n\t\treturn\n\t}\n\n\tRespondWithJSON(w, http.StatusOK, appDetails)\n}", "title": "" }, { "docid": "6ae9e33d95d5347d50b1f4c934e47127", "score": "0.49599388", "text": "func (b *GraphServiceApplicationTemplatesCollectionRequestBuilder) Request() *GraphServiceApplicationTemplatesCollectionRequest {\n\treturn &GraphServiceApplicationTemplatesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "a9aaba8a8e98cbf822003db9f4209d0e", "score": "0.49507672", "text": "func (b *GraphServiceProgramsCollectionRequestBuilder) Request() *GraphServiceProgramsCollectionRequest {\n\treturn &GraphServiceProgramsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "0ad0590b80a46b13cad2d5e708084c3c", "score": "0.49502873", "text": "func (b *GraphServiceAgreementAcceptancesCollectionRequestBuilder) Request() *GraphServiceAgreementAcceptancesCollectionRequest {\n\treturn &GraphServiceAgreementAcceptancesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "82840c5e877f9ed7acc2b9acc661c6da", "score": "0.49497896", "text": "func (dm *DataManager) QueryEffectedAppInstances(ctx context.Context,\n\treq *pb.QueryEffectedAppInstancesReq) (*pb.QueryEffectedAppInstancesResp, error) {\n\n\trtime := time.Now()\n\tmethod := common.GRPCMethod(ctx)\n\tlogger.V(2).Infof(\"%s[%s]| input[%+v]\", method, req.Seq, req)\n\n\tresponse := new(pb.QueryEffectedAppInstancesResp)\n\n\tdefer func() {\n\t\tcost := dm.collector.StatRequest(method, response.Code, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"%s[%s]| output[%dms][%+v]\", method, req.Seq, cost, response)\n\t}()\n\n\taction := appinstanceaction.NewEffectedAction(ctx, dm.viper, dm.smgr, req, response)\n\tif err := dm.executor.Execute(action); err != nil {\n\t\tlogger.Errorf(\"%s[%s]| %+v\", method, req.Seq, err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "8d9673811dd372e6979cda6178d5eff0", "score": "0.49425378", "text": "func List() (*http.Response, string, []error) {\n\tk := kumoru.New()\n\n\tk.Get(fmt.Sprintf(\"%s/v1/applications/\", k.EndPoint.Application))\n\tk.SignRequest(true)\n\treturn k.End()\n}", "title": "" }, { "docid": "900da49cd433a889ac2f2ca994ff53c9", "score": "0.49347162", "text": "func (c *Catalog) Request(hook GroupVersionHook) (schema.GroupVersionKind, error) {\n\tdescriptor, ok := c.gvhToHookDescriptor[hook]\n\tif !ok {\n\t\treturn emptyGroupVersionKind, errors.Errorf(\"failed to get request GVK for hook %s: hook is not registered in catalog %q\", hook, c.catalogName)\n\t}\n\n\treturn descriptor.request, nil\n}", "title": "" }, { "docid": "1231fafc31ddcf7347e845f8bb4f7fad", "score": "0.49320203", "text": "func (b *TrustFrameworkPoliciesCollectionRequestBuilder) Request() *TrustFrameworkPoliciesCollectionRequest {\n\treturn &TrustFrameworkPoliciesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "4915dcaf29004167b596b7d389a9a86e", "score": "0.4928315", "text": "func (b *GraphServicePrivilegedSignupStatusCollectionRequestBuilder) Request() *GraphServicePrivilegedSignupStatusCollectionRequest {\n\treturn &GraphServicePrivilegedSignupStatusCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "f1f973b1fe869b3954ce8c6c4edbaa2e", "score": "0.49246353", "text": "func (b *ManagedEBookCategoriesCollectionRequestBuilder) Request() *ManagedEBookCategoriesCollectionRequest {\n\treturn &ManagedEBookCategoriesCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "a6293a9d9734cf61c4c14594b3259990", "score": "0.49199298", "text": "func (b *ListItemsCollectionRequestBuilder) Request() *ListItemsCollectionRequest {\n\treturn &ListItemsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "c143fc1e433584d8c3cf1661044f8b13", "score": "0.491856", "text": "func (b *OfficeGraphInsightsUsedCollectionRequestBuilder) Request() *OfficeGraphInsightsUsedCollectionRequest {\n\treturn &OfficeGraphInsightsUsedCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "0a524c42d2ffd7311ca644b2e80a6f6b", "score": "0.49170664", "text": "func (b *GraphServiceOrganizationCollectionRequestBuilder) Request() *GraphServiceOrganizationCollectionRequest {\n\treturn &GraphServiceOrganizationCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "d052173de85a8c111b1c0eac818f2d22", "score": "0.49170315", "text": "func (c *APIClient) GetApp(ctx _context.Context, id int32) apiGetAppRequest {\n\treturn apiGetAppRequest{\n\t\tclient: c,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "8f09516531018d896a0638cf276aafae", "score": "0.49052754", "text": "func (*GetAppRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_v1_apps_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "fcd271e57ef6530d47286947ef15f29c", "score": "0.4905226", "text": "func (b *TrustFrameworkKeySetsCollectionRequestBuilder) Request() *TrustFrameworkKeySetsCollectionRequest {\n\treturn &TrustFrameworkKeySetsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "2c1b3cb101c861341973ea153be38585", "score": "0.4904304", "text": "func (client *AppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *AppsClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "39ed86034c7e5b0512b38874be603e47", "score": "0.48880655", "text": "func (b *GraphServiceDataPolicyOperationsCollectionRequestBuilder) Request() *GraphServiceDataPolicyOperationsCollectionRequest {\n\treturn &GraphServiceDataPolicyOperationsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "f669f8bd8e2133441566e3494dca7890", "score": "0.48872566", "text": "func (dm *DataManager) QueryAppList(ctx context.Context, req *pb.QueryAppListReq) (*pb.QueryAppListResp, error) {\n\trtime := time.Now()\n\tlogger.V(2).Infof(\"QueryAppList[%d]| input[%+v]\", req.Seq, req)\n\tresponse := &pb.QueryAppListResp{Seq: req.Seq, ErrCode: pbcommon.ErrCode_E_OK, ErrMsg: \"OK\"}\n\n\tdefer func() {\n\t\tcost := dm.collector.StatRequest(\"QueryAppList\", response.ErrCode, rtime, time.Now())\n\t\tlogger.V(2).Infof(\"QueryAppList[%d]| output[%dms][%+v]\", req.Seq, cost, response)\n\t}()\n\n\taction := appaction.NewListAction(dm.viper, dm.smgr, req, response)\n\tdm.executor.Execute(action)\n\n\treturn response, nil\n}", "title": "" }, { "docid": "dfe7743406aa6c7d72c2a8d07b54ab26", "score": "0.48842925", "text": "func (b *TargetedManagedAppConfigurationAssignmentsCollectionRequestBuilder) Request() *TargetedManagedAppConfigurationAssignmentsCollectionRequest {\n\treturn &TargetedManagedAppConfigurationAssignmentsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "4d9d6a5209fe7ff79f517982c385923e", "score": "0.48836017", "text": "func (b *DeviceManagementTermsAndConditionsCollectionRequestBuilder) Request() *DeviceManagementTermsAndConditionsCollectionRequest {\n\treturn &DeviceManagementTermsAndConditionsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "3f91cd7e74cb13f64e850011208faca8", "score": "0.48811325", "text": "func makeAppAttrRequest() []byte {\n\tvar attrRequest []byte\n\n\t// control byte\n\tappControlByte := byte(APP_START_SEQUENCE)\n\tappControlByte = setBit(appControlByte, 7, 1) //first app layer segment\n\tappControlByte = setBit(appControlByte, 6, 1) //last app layer segment\n\tappControlByte = setBit(appControlByte, 5, APP_CON_BIT) //\n\tappControlByte = setBit(appControlByte, 4, APP_UNS_BIT) //last app layer segment\n\tattrRequest = append(attrRequest, appControlByte)\n\n\tattrRequest = append(attrRequest, byte(APP_FUNC_CODE_READ)) // function code\n\n\t// Object header\n\tattrRequest = append(attrRequest, byte(APP_GROUP_0)) // group to be reading from\n\tattrRequest = append(attrRequest, byte(APP_GROUP_0_ALL_ATTRIBUTES)) // get all attributes\n\tattrRequest = append(attrRequest, byte(APP_GROUP_0_QUALIFIER)) // no object indexing\n\tappIndexRange := make([]byte, 2)\n\tbinary.LittleEndian.PutUint16(appIndexRange, APP_GROUP_0_RANGE) // range is irrelevant due to no indexing\n\tattrRequest = append(attrRequest, appIndexRange...)\n\n\treturn attrRequest\n}", "title": "" }, { "docid": "14877cd5a76eb3e1e5c05ba49c278cd1", "score": "0.48790106", "text": "func appListSatisfiesRequest(request versionRequest, appList []v1alpha1.ReleaseSpecApp) (bool, string, error) {\n\tvar actual string\n\tfor _, app := range appList {\n\t\tif app.Name == request.Name {\n\t\t\tactual = app.Version\n\t\t\tactualMatchesRequested, err := versionMatches(actual, request.Version)\n\t\t\tif err != nil {\n\t\t\t\treturn false, actual, microerror.Mask(err)\n\t\t\t}\n\n\t\t\tif actualMatchesRequested {\n\t\t\t\treturn true, actual, nil\n\t\t\t}\n\n\t\t\tbreak // No need to keep searching for this component.\n\t\t}\n\t}\n\treturn false, actual, nil\n}", "title": "" }, { "docid": "119b0a512c0b19748f2ecce92a7ca006", "score": "0.48768917", "text": "func (b *GraphServiceTeamsCollectionRequestBuilder) Request() *GraphServiceTeamsCollectionRequest {\n\treturn &GraphServiceTeamsCollectionRequest{\n\t\tBaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},\n\t}\n}", "title": "" }, { "docid": "7759da11edafea856e9721e41b301965", "score": "0.4876044", "text": "func (i *FakeAgentAPI) HandleApp(oper types.Operation, app netproto.App) (apps []netproto.App, err error) {\n\ti.Lock()\n\tdefer i.Unlock()\n\n\terr = utils.ValidateMeta(oper, app.Kind, app.ObjectMeta)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\t// Handle Get and LIST. This doesn't need any pipeline specific APIs\n\tswitch oper {\n\tcase types.Get:\n\t\tvar (\n\t\t\tdat []byte\n\t\t\tobj netproto.App\n\t\t)\n\t\tdat, err = i.InfraAPI.Read(app.Kind, app.GetKey())\n\t\tif err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrBadRequest, \"App: %s | Err: %v\", app.GetKey(), types.ErrObjNotFound))\n\t\t\treturn nil, errors.Wrapf(types.ErrBadRequest, \"App: %s | Err: %v\", app.GetKey(), types.ErrObjNotFound)\n\t\t}\n\t\terr = obj.Unmarshal(dat)\n\t\tif err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\treturn nil, errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err)\n\t\t}\n\t\tapps = append(apps, obj)\n\n\t\treturn\n\tcase types.List:\n\t\tvar (\n\t\t\tdat [][]byte\n\t\t)\n\t\tdat, err = i.InfraAPI.List(app.Kind)\n\t\tif err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrBadRequest, \"App: %s | Err: %v\", app.GetKey(), types.ErrObjNotFound))\n\t\t\treturn nil, errors.Wrapf(types.ErrBadRequest, \"App: %s | Err: %v\", app.GetKey(), types.ErrObjNotFound)\n\t\t}\n\n\t\tfor _, o := range dat {\n\t\t\tvar app netproto.App\n\t\t\terr := proto.Unmarshal(o, &app)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tapps = append(apps, app)\n\t\t}\n\n\t\treturn\n\tcase types.Create:\n\t\t// Alloc ID if ID field is empty. This will be pre-populated in case of config replays\n\t\tif app.Status.AppID == 0 {\n\t\t\tapp.Status.AppID = i.InfraAPI.AllocateID(types.AppID, 0)\n\t\t}\n\n\t\tappBytes, _ := app.Marshal()\n\n\t\tif err := i.InfraAPI.Store(app.Kind, app.GetKey(), appBytes); err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrBoltDBStoreCreate, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\treturn nil, errors.Wrapf(types.ErrBoltDBStoreCreate, \"App: %s | Err: %v\", app.GetKey(), err)\n\t\t}\n\t\treturn\n\n\tcase types.Update:\n\t\t// Get to ensure that the object exists\n\t\tvar existingApp netproto.App\n\t\tdat, err := i.InfraAPI.Read(app.Kind, app.GetKey())\n\t\tif err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrBadRequest, \"App: %s | Err: %v\", app.GetKey(), types.ErrObjNotFound))\n\t\t\treturn nil, errors.Wrapf(types.ErrBadRequest, \"App: %s | Err: %v\", app.GetKey(), types.ErrObjNotFound)\n\t\t}\n\t\terr = existingApp.Unmarshal(dat)\n\t\tif err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\treturn nil, errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err)\n\t\t}\n\n\t\t// Check for idempotency\n\t\tif proto.Equal(&app.Spec, &existingApp.Spec) {\n\t\t\t//log.Infof(\"App: %s | Info: %s \", app.GetKey(), types.InfoIgnoreUpdate)\n\t\t\treturn nil, nil\n\t\t}\n\n\t\t// Reuse ID from store\n\t\tapp.Status.AppID = existingApp.Status.AppID\n\n\t\tappBytes, _ := app.Marshal()\n\n\t\tif err := i.InfraAPI.Store(app.Kind, app.GetKey(), appBytes); err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrBoltDBStoreCreate, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\treturn nil, errors.Wrapf(types.ErrBoltDBStoreCreate, \"App: %s | Err: %v\", app.GetKey(), err)\n\t\t}\n\t\treturn nil, nil\n\tcase types.Delete:\n\t\tvar existingApp netproto.App\n\t\tdat, err := i.InfraAPI.Read(app.Kind, app.GetKey())\n\t\tif err != nil {\n\t\t\tlog.Infof(\"Controller API: %s | Err: %s\", types.InfoIgnoreDelete, err)\n\t\t\treturn nil, nil\n\t\t}\n\t\terr = existingApp.Unmarshal(dat)\n\t\tif err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\treturn nil, errors.Wrapf(types.ErrUnmarshal, \"App: %s | Err: %v\", app.GetKey(), err)\n\t\t}\n\t\tapp = existingApp\n\n\t\tif err := i.InfraAPI.Delete(app.Kind, app.GetKey()); err != nil {\n\t\t\tlog.Error(errors.Wrapf(types.ErrBoltDBStoreDelete, \"App: %s | Err: %v\", app.GetKey(), err))\n\t\t\treturn nil, errors.Wrapf(types.ErrBoltDBStoreDelete, \"App: %s | Err: %v\", app.GetKey(), err)\n\t\t}\n\t\treturn nil, nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "51c606cd7ee6682080a517bbd7351bdc", "score": "0.48713964", "text": "func (m *ManagedDevicesItemDetectedAppsRequestBuilder) ByDetectedAppId(detectedAppId string)(*ManagedDevicesItemDetectedAppsDetectedAppItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.BaseRequestBuilder.PathParameters {\n urlTplParams[idx] = item\n }\n if detectedAppId != \"\" {\n urlTplParams[\"detectedApp%2Did\"] = detectedAppId\n }\n return NewManagedDevicesItemDetectedAppsDetectedAppItemRequestBuilderInternal(urlTplParams, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" } ]
a113e4245765051224f5584b4e608133
+kubebuilder:rbac:groups=core,resources=endpoints,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=core,resources=endpoints/status,verbs=get;update;patch +kubebuilder:rbac:groups=core,resources=endpoints/finalizers,verbs=update Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the Endpoints object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user. For more details, check Reconcile and its Result here:
[ { "docid": "579f91d0085a1ffd3ba42928820aa39c", "score": "0.65027857", "text": "func (r *EndpointsReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = log.FromContext(ctx)\n\n\tendpoint := &corev1.Endpoints{}\n\tif err := r.Client.Get(ctx, req.NamespacedName, endpoint); err != nil {\n\t\t// add some debug information if it's not a NotFound error\n\n\t\tremoveEndpoint(req.NamespacedName.String())\n\n\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t// requeue (we'll need to wait for a new notification), and we can get them\n\t\t// on deleted requests.\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tmsg := fmt.Sprintf(\"received reconcile request for Endpoint %q (namespace: %q)\", endpoint.GetName(), endpoint.GetNamespace())\n\tlog.Log.Info(msg)\n\t// is object marked for deletion?\n\tif !endpoint.DeletionTimestamp.IsZero() {\n\t\tlog.Log.Info(\"Endpoint marked for deletion\")\n\t\t//removeEndpoint(req.NamespacedName.String())\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tr.addService(req.NamespacedName.String(),endpoint)\n\treturn ctrl.Result{}, nil\n}", "title": "" } ]
[ { "docid": "7c48806c0f1df81f6e69914c27bfef60", "score": "0.67327815", "text": "func (s *StatusReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error) {\n\t// We base our status on the pod facts, so ensure our facts are up to date.\n\tif err := s.PFacts.Collect(ctx, s.Vdb); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Use all subclusters, even ones that are scheduled for removal. We keep\n\t// reporting status on the deleted ones until the statefulsets are gone.\n\tfinder := MakeSubclusterFinder(s.Client, s.Vdb)\n\tsubclusters, err := finder.FindSubclusters(ctx, FindAll)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trefreshStatus := func(vdbChg *vapi.VerticaDB) error {\n\t\tvdbChg.Status.Subclusters = []vapi.SubclusterStatus{}\n\t\tfor i := range subclusters {\n\t\t\tif i == len(vdbChg.Status.Subclusters) {\n\t\t\t\tvdbChg.Status.Subclusters = append(vdbChg.Status.Subclusters, vapi.SubclusterStatus{})\n\t\t\t}\n\t\t\tif err := s.calculateSubclusterStatus(ctx, subclusters[i], &vdbChg.Status.Subclusters[i]); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to calculate subcluster status %s %w\", subclusters[i].Name, err)\n\t\t\t}\n\t\t}\n\t\ts.calculateClusterStatus(&vdbChg.Status)\n\t\treturn nil\n\t}\n\n\tif err := status.Update(ctx, s.Client, s.Vdb, refreshStatus); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "7fcea6e11b55ffa6d8d1a5092013810b", "score": "0.66215056", "text": "func (r *RqliteClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\tlog := r.Log.WithValues(\"Reconcile RqliteCluster \", req.Name, \" in namespace \", req.NamespacedName)\n\n\tlog.V(1).Info(\"Get Object Info\")\n\t//objectInfo := new(rqlitev1.RqliteCluster{})\n\tobjectInfo := &rqlitev1.RqliteCluster{}\n\terr := r.Get(context.TODO(), req.NamespacedName, objectInfo)\n\n\tif err != nil {\n\t\tlog.Error(err, \"Error during r.Get\")\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\tlog.Info(\"Dump Object Info\", \"ClusterName\", objectInfo.Spec.Name, \"ClusterSize\", objectInfo.Spec.ClusterSize)\n\n\tlog.V(1).Info(\"Update Object Status\")\n\tlog.V(1).Info(\"Get Object Current Status\", \"NAme\", objectInfo.Spec.Name, \"Status\", objectInfo.Status.CurrentStatus)\n\tif objectInfo.Status.CurrentStatus == \"\" {\n\t\tlog.V(1).Info(\"Creating new RqliteCluster)\n\t\tpod := newRqliteCluster(objectInfo)\n\t\tobjectInfo.Status.CurrentStatus = \"OK\"\n\t}\n\n\tlog.V(1).Info(\"Set Object Target Status : \", \"Name\", objectInfo.Spec.Name, \"Status \", objectInfo.Status.CurrentStatus)\n\n\terr = r.Status().Update(context.TODO(), objectInfo)\n\tif err != nil {\n\t\tlog.Error(err, \"Error during r.Status\")\n\t\treturn reconcile.Result{}, err\n\t}\n\t//if anything else happens\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "cfe88da9915527de2ab3f59043109d6e", "score": "0.6614533", "text": "func (r *ClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}()\n\n\tctx := context.WithValue(context.Background(), requestId, uuid.New())\n\tlog := log.Logger(ctx, \"controllers\", \"cluster_controller\", \"Reconcile\")\n\tlog.WithValues(\"cluster\", req.NamespacedName)\n\tlog.Info(\"Start of the request\")\n\t//Get the resource\n\tvar cluster managerv1alpha1.Cluster\n\tif err := r.Get(ctx, req.NamespacedName, &cluster); err != nil {\n\t\treturn ctrl.Result{}, ignoreNotFound(err)\n\t}\n\n\t// Retrieve k8s secret\n\t// Get the \"best\" Bearer token\n\t// Get the ManagedCluster k8s client\n\n\tstate := managerv1alpha1.Warning\n\n\tif cluster.Status.RetryCount > 3 {\n\t\tstate = managerv1alpha1.Error\n\t}\n\n\tsecret, err := r.K8sClient.GetK8sSecret(ctx, cluster.Spec.Config.BearerTokenSecret, cluster.ObjectMeta.Namespace)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to retrieve the bearer token for the given cluster\")\n\t\tdesc := fmt.Sprintf(\"unable to retrieve the bearer token for the given cluster due to error %s\", err.Error())\n\t\tr.Recorder.Event(&cluster, v1.EventTypeWarning, string(state), desc)\n\t\treturn r.UpdateStatus(ctx, &cluster, managerv1alpha1.ClusterStatus{RetryCount: cluster.Status.RetryCount + 1, ErrorDescription: desc}, state, errRequeueTime)\n\t}\n\tcfg, err := utils.PrepareK8sRestConfigFromClusterCR(ctx, &cluster, secret)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to prepare the rest config for the target cluster\", \"cluster\", cluster.Spec.Name)\n\t\tdesc := fmt.Sprintf(\"unable to prepare the rest config for the target cluster due to error %s\", err.Error())\n\t\tr.Recorder.Event(&cluster, v1.EventTypeWarning, string(state), desc)\n\t\treturn r.UpdateStatus(ctx, &cluster, managerv1alpha1.ClusterStatus{RetryCount: cluster.Status.RetryCount + 1, ErrorDescription: desc}, state, errRequeueTime)\n\t}\n\n\t// Isit being deleted?\n\tif cluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t//Good. This is not Delete use case\n\t\t//Lets check if this is very first time use case\n\t\tif !utils.ContainsString(cluster.ObjectMeta.Finalizers, finalizerName) {\n\t\t\tlog.Info(\"New cluster resource. Adding the finalizer\", \"finalizer\", finalizerName)\n\t\t\tcluster.ObjectMeta.Finalizers = append(cluster.ObjectMeta.Finalizers, finalizerName)\n\t\t\tr.UpdateMeta(ctx, &cluster)\n\t\t}\n\t\treturn r.HandleReconcile(ctx, req, &cluster, cfg)\n\n\t} else {\n\t\t//oh oh.. This is delete use case\n\t\t//Lets make sure to clean up the iam role\n\t\tif cluster.Status.RetryCount != 0 {\n\t\t\tcluster.Status.RetryCount = cluster.Status.RetryCount + 1\n\t\t}\n\t\tlog.Info(\"Cluster delete request\")\n\t\tif err := removeRBACInManagedCluster(ctx, cfg); err != nil {\n\t\t\tlog.Error(err, \"Unable to delete the cluster\")\n\t\t\tr.UpdateStatus(ctx, &cluster, managerv1alpha1.ClusterStatus{RetryCount: cluster.Status.RetryCount + 1, ErrorDescription: err.Error()}, managerv1alpha1.Error)\n\t\t\tr.Recorder.Event(&cluster, v1.EventTypeWarning, string(managerv1alpha1.Error), \"unable to delete the cluster due to \"+err.Error())\n\t\t\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n\t\t}\n\n\t\t// Ok. Lets delete the finalizer so controller can delete the custom object\n\t\tlog.Info(\"Removing finalizer from Cluster\")\n\t\tcluster.ObjectMeta.Finalizers = utils.RemoveString(cluster.ObjectMeta.Finalizers, finalizerName)\n\t\tr.UpdateMeta(ctx, &cluster)\n\t\tlog.Info(\"Successfully deleted cluster\")\n\t\tr.Recorder.Event(&cluster, v1.EventTypeNormal, \"Deleted\", \"Successfully deleted cluster\")\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "5774284dfb24cb561bdf5bd16fe8bdde", "score": "0.6564889", "text": "func (r *azureClusterReconciler) Reconcile(ctx context.Context) error {\n\tif err := r.createOrUpdateNetworkAPIServerIP(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to create or update network API server IP for cluster %s in location %s\", r.scope.ClusterName(), r.scope.Location())\n\t}\n\n\tif err := r.setFailureDomainsForLocation(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get availability zones\")\n\t}\n\n\tr.scope.SetControlPlaneIngressRules()\n\n\tif err := r.groupsSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile resource group\")\n\t}\n\n\tif err := r.vnetSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile virtual network\")\n\t}\n\n\tif err := r.securityGroupSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile network security group\")\n\t}\n\n\tif err := r.routeTableSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile route table\")\n\t}\n\n\tif err := r.subnetsSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile subnet\")\n\t}\n\n\tif err := r.publicIPSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile public IP\")\n\t}\n\n\tif err := r.loadBalancerSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile load balancer\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "40f24ab1a8c5ccc3ea606d90102b6785", "score": "0.65599406", "text": "func (a *Actuator) Reconcile(cluster *clusterv1.Cluster) error {\n\tlog := a.log.WithValues(\"cluster-name\", cluster.Name, \"cluster-namespace\", cluster.Namespace)\n\tlog.Info(\"Reconciling Cluster\")\n\n\tscope, err := scope.NewClusterScope(scope.ClusterScopeParams{\n\t\tCluster: cluster,\n\t\tLogger: a.log,\n\t})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to create scope: %+v\", err)\n\t}\n\n\tdefer scope.Close()\n\n\tec2svc := ec2.NewService(scope)\n\telbsvc := elb.NewService(scope)\n\tcertSvc := certificates.NewService(scope)\n\n\t// Store cert material in spec.\n\tif err := certSvc.ReconcileCertificates(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile certificates for cluster %q\", cluster.Name)\n\t}\n\n\tif err := ec2svc.ReconcileNetwork(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile network for cluster %q\", cluster.Name)\n\t}\n\n\tif err := ec2svc.ReconcileBastion(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile bastion host for cluster %q\", cluster.Name)\n\t}\n\n\tif err := elbsvc.ReconcileLoadbalancers(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile load balancers for cluster %q\", cluster.Name)\n\t}\n\n\tif cluster.Annotations == nil {\n\t\tcluster.Annotations = make(map[string]string)\n\t}\n\tcluster.Annotations[v1alpha2.AnnotationClusterInfrastructureReady] = v1alpha2.ValueReady\n\n\t// Store KubeConfig for Cluster API NodeRef controller to use.\n\tkubeConfigSecretName := remote.KubeConfigSecretName(cluster.Name)\n\tsecretClient := a.coreClient.Secrets(cluster.Namespace)\n\tif _, err := secretClient.Get(kubeConfigSecretName, metav1.GetOptions{}); err != nil && apierrors.IsNotFound(err) {\n\t\tkubeConfig, err := a.Deployer.GetKubeConfig(cluster, nil)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get kubeconfig for cluster %q\", cluster.Name)\n\t\t}\n\n\t\tkubeConfigSecret := &apiv1.Secret{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: kubeConfigSecretName,\n\t\t\t},\n\t\t\tStringData: map[string]string{\n\t\t\t\t\"value\": kubeConfig,\n\t\t\t},\n\t\t}\n\n\t\tif _, err := secretClient.Create(kubeConfigSecret); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to create kubeconfig secret for cluster %q\", cluster.Name)\n\t\t}\n\t} else if err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get kubeconfig secret for cluster %q\", cluster.Name)\n\t}\n\n\t// If the control plane is ready, try to delete the control plane configmap lock, if it exists, and return.\n\tif cluster.Annotations[v1alpha2.AnnotationControlPlaneReady] == v1alpha2.ValueReady {\n\t\tconfigMapName := scope.ControlPlaneConfigMapName()\n\t\tlog.Info(\"Checking for existence of control plane configmap lock\", \"configmap-name\", configMapName)\n\n\t\t_, err := a.coreClient.ConfigMaps(cluster.Namespace).Get(configMapName, metav1.GetOptions{})\n\t\tswitch {\n\t\tcase apierrors.IsNotFound(err):\n\t\t\t// It doesn't exist - no-op\n\t\tcase err != nil:\n\t\t\treturn errors.Wrapf(err, \"Error retrieving control plane configmap lock %q\", configMapName)\n\t\tdefault:\n\t\t\tif err := a.coreClient.ConfigMaps(cluster.Namespace).Delete(configMapName, nil); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"Error deleting control plane configmap lock %q\", configMapName)\n\t\t\t}\n\t\t}\n\n\t\t// Nothing more to reconcile - return early.\n\t\treturn nil\n\t}\n\n\tlog.Info(\"Cluster does not have ready annotation - checking for ready control plane machines\")\n\n\tmachineList := &clusterv1.MachineList{}\n\tif err := a.List(context.Background(), machineList, scope.ListOptionsLabelSelector()); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to retrieve machines in cluster %q\", cluster.Name)\n\t}\n\n\tcontrolPlaneMachines := util.GetControlPlaneMachinesFromList(machineList)\n\n\tmachineReady := false\n\tfor _, machine := range controlPlaneMachines {\n\t\tif machine.Status.NodeRef != nil {\n\t\t\tmachineReady = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !machineReady {\n\t\tlog.Info(\"No control plane machines are ready - requeuing cluster\")\n\t\treturn &controllerError.RequeueAfterError{RequeueAfter: waitForControlPlaneMachineDuration}\n\t}\n\n\tlog.Info(\"Setting cluster ready annotation\")\n\tcluster.Annotations[v1alpha2.AnnotationControlPlaneReady] = v1alpha2.ValueReady\n\n\treturn nil\n}", "title": "" }, { "docid": "7b9d861ba6bf39593ccfa7d0f0a940d2", "score": "0.65415525", "text": "func (r *azureManagedControlPlaneReconciler) Reconcile(ctx context.Context, scope *scope.ManagedControlPlaneScope) error {\n\tdecodedSSHPublicKey, err := base64.StdEncoding.DecodeString(scope.ControlPlane.Spec.SSHPublicKey)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to decode SSHPublicKey\")\n\t}\n\n\tmanagedClusterSpec := &managedclusters.Spec{\n\t\tName: scope.ControlPlane.Name,\n\t\tResourceGroup: scope.ControlPlane.Spec.ResourceGroup,\n\t\tLocation: scope.ControlPlane.Spec.Location,\n\t\tTags: scope.ControlPlane.Spec.AdditionalTags,\n\t\tVersion: strings.TrimPrefix(scope.ControlPlane.Spec.Version, \"v\"),\n\t\tSSHPublicKey: string(decodedSSHPublicKey),\n\t\tDNSServiceIP: scope.ControlPlane.Spec.DNSServiceIP,\n\t}\n\n\tif scope.ControlPlane.Spec.NetworkPlugin != nil {\n\t\tmanagedClusterSpec.NetworkPlugin = *scope.ControlPlane.Spec.NetworkPlugin\n\t}\n\tif scope.ControlPlane.Spec.NetworkPolicy != nil {\n\t\tmanagedClusterSpec.NetworkPolicy = *scope.ControlPlane.Spec.NetworkPolicy\n\t}\n\tif scope.ControlPlane.Spec.LoadBalancerSKU != nil {\n\t\tmanagedClusterSpec.LoadBalancerSKU = *scope.ControlPlane.Spec.LoadBalancerSKU\n\t}\n\n\tscope.V(2).Info(\"Reconciling managed cluster resource group\")\n\tif err := r.groupsSvc.Reconcile(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile managed cluster resource group\")\n\t}\n\n\tscope.V(2).Info(\"Reconciling managed cluster\")\n\tif err := r.reconcileManagedCluster(ctx, scope, managedClusterSpec); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile managed cluster\")\n\t}\n\n\tscope.V(2).Info(\"Reconciling endpoint\")\n\tif err := r.reconcileEndpoint(ctx, scope, managedClusterSpec); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile control plane endpoint\")\n\t}\n\n\tscope.V(2).Info(\"Reconciling kubeconfig\")\n\tif err := r.reconcileKubeconfig(ctx, scope, managedClusterSpec); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to reconcile kubeconfig secret\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3788feccce809ad18f557c653b964c53", "score": "0.65321887", "text": "func (r *RedPandaClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\t//// Reconcile successful - don't requeue\n\t//return ctrl.Result{}, nil\n\t//// Reconcile failed due to error - requeue\n\t//return ctrl.Result{}, err\n\t//// Requeue for any reason other than an error\n\t//return ctrl.Result{Requeue: true}, nil\n\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"redpandacluster\", req.NamespacedName)\n\n\tredPandaCluster := &eventstreamv1alpha1.RedPandaCluster{}\n\terr := r.Get(ctx, req.NamespacedName, redPandaCluster)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"RedPandaCluster resource not statefulSetFound. Ignoring...\")\n\t\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t\t}\n\t\tlog.Error(err, \"unable to fetch RedPandaCluster\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tserviceFound := &corev1.Service{}\n\terr = r.Get(ctx, types.NamespacedName{Name: redPandaCluster.Name, Namespace: redPandaCluster.Namespace}, serviceFound)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"Service not found. Trying to create one...\")\n\t\t\tvar rpService *corev1.Service\n\t\t\trpService = r.serviceFor(redPandaCluster)\n\t\t\tlog.Info(\"creating service \", \"Service.Namespace\", rpService.Namespace, \"Service.Name\", rpService.Name)\n\t\t\terr := r.Create(ctx, rpService)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new service\", \"Service.Namespace\", rpService.Namespace, \"Service.Name\", rpService.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\tlog.Info(\"unable to fetch Service resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// ConfigMap\n\tconfigMapFound := &corev1.ConfigMap{}\n\terr = r.Get(ctx, types.NamespacedName{Name: redPandaCluster.Name + \"base-config\", Namespace: redPandaCluster.Namespace}, configMapFound)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"ConfigMap not found. Trying to create one...\")\n\t\t\tvar rpConfigMap *corev1.ConfigMap\n\t\t\trpConfigMap = r.configMapFor(redPandaCluster)\n\t\t\terr := r.Create(ctx, rpConfigMap)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create ConfigMap resource\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\tlog.Info(\"unable to fetch Service resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// StatefulSet\n\tstatefulSetFound := &appsv1.StatefulSet{}\n\terr = r.Get(ctx, types.NamespacedName{Namespace: redPandaCluster.Namespace, Name: redPandaCluster.Name}, statefulSetFound)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"StatefulSet not found \")\n\t\t\tvar rpStatefulSet *appsv1.StatefulSet\n\t\t\trpStatefulSet = r.statefulSetFor(redPandaCluster, configMapFound, serviceFound)\n\t\t\terr := r.Create(ctx, rpStatefulSet)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create StatefulSet resource\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tobservedPods := &corev1.PodList{}\n\terr = r.List(ctx, observedPods, &client.ListOptions{\n\t\tLabelSelector: labels.SelectorFromSet(redPandaCluster.Labels),\n\t\tNamespace: redPandaCluster.Namespace,\n\t})\n\tif err != nil {\n\t\tlog.Error(err, \"unable to fetch PodList resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tvar observedNodes []string\n\tfor _, item := range observedPods.Items {\n\t\tobservedNodes = append(observedNodes, item.Name)\n\t}\n\tif !reflect.DeepEqual(observedNodes, redPandaCluster.Status.Nodes) {\n\t\tredPandaCluster.Status.Nodes = observedNodes\n\t\terr := r.Status().Update(ctx, redPandaCluster)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to update RedPandaClusterStatus\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\tlog.Info(\"reconcile loop ends\")\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "65bba33f4dc859e9c438ae8b337a5319", "score": "0.652659", "text": "func (r *reconciler) Reconcile(resourceName string) error {\n\tklog.V(4).Infof(\"Reconciling RBAC for %s\", resourceName)\n\n\terr := r.ensureRBACClusterRole(resourceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = r.ensureRBACClusterRoleBinding(resourceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "effa2559ba5f6f85f39ea473bceb0ae3", "score": "0.644316", "text": "func (rc *RouteController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\ttep := new(netv1alpha1.TunnelEndpoint)\n\tvar err error\n\tif err = rc.Get(ctx, req.NamespacedName, tep); err != nil && !k8sApiErrors.IsNotFound(err) {\n\t\tklog.Errorf(\"unable to fetch resource {%s} :%v\", req.String(), err)\n\t\treturn result, err\n\t}\n\t// In case the resource does not exist anymore, we just forget it.\n\tif k8sApiErrors.IsNotFound(err) {\n\t\treturn result, nil\n\t}\n\t// Here we check that the tunnelEndpoint resource has been fully processed. If not we do nothing.\n\tif tep.Status.GatewayIP == \"\" {\n\t\treturn result, nil\n\t}\n\tclusterIdentity := tep.Spec.ClusterIdentity\n\t_, remotePodCIDR := liqonetutils.GetPodCIDRS(tep)\n\t_, remoteExternalCIDR := liqonetutils.GetExternalCIDRS(tep)\n\t// Examine DeletionTimestamp to determine if object is under deletion.\n\tif tep.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tif !controllerutil.ContainsFinalizer(tep, liqoconst.LiqoRouteFinalizer(rc.podIP)) {\n\t\t\t// The object is not being deleted, so if it does not have our finalizer,\n\t\t\t// then lets add the finalizer and update the object. This is equivalent\n\t\t\t// registering our finalizer.\n\t\t\tcontrollerutil.AddFinalizer(tep, liqoconst.LiqoRouteFinalizer(rc.podIP))\n\t\t\tif err := rc.Update(ctx, tep); err != nil {\n\t\t\t\tif k8sApiErrors.IsConflict(err) {\n\t\t\t\t\tklog.V(4).Infof(\"%s -> unable to add finalizers to resource {%s}: %s\", clusterIdentity, req.String(), err)\n\t\t\t\t\treturn result, err\n\t\t\t\t}\n\t\t\t\tklog.Errorf(\"%s -> unable to add finalizers to resource {%s}: %s\", clusterIdentity, req.String(), err)\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// The object is being deleted, if we encounter an error while removing the routes than we record an\n\t\t// event on the resource to notify the user. The finalizer is not removed.\n\t\tif controllerutil.ContainsFinalizer(tep, liqoconst.LiqoRouteFinalizer(rc.podIP)) {\n\t\t\tklog.Infof(\"resource {%s} of type {%s} is being removed\", tep.Name, tep.GroupVersionKind().String())\n\t\t\tdeleted, err := rc.RemoveRoutesPerCluster(tep)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"%s -> unable to remove route for destinations {%s} and {%s}: %s\",\n\t\t\t\t\tclusterIdentity, remotePodCIDR, remoteExternalCIDR, err)\n\t\t\t\trc.Eventf(tep, \"Warning\", \"Processing\", \"unable to remove route: %s\", err.Error())\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif deleted {\n\t\t\t\tklog.Infof(\"%s -> route for destinations {%s} and {%s} correctly removed\",\n\t\t\t\t\tclusterIdentity, remotePodCIDR, remoteExternalCIDR)\n\t\t\t\trc.Eventf(tep, \"Normal\", \"Processing\", \"route for destination {%s} and {%s} correctly removed\",\n\t\t\t\t\tremotePodCIDR, remoteExternalCIDR)\n\t\t\t}\n\t\t\t// remove the finalizer from the list and update it.\n\t\t\tcontrollerutil.RemoveFinalizer(tep, liqoconst.LiqoRouteFinalizer(rc.podIP))\n\t\t\tif err := rc.Update(ctx, tep); err != nil {\n\t\t\t\tif k8sApiErrors.IsConflict(err) {\n\t\t\t\t\tklog.V(4).Infof(\"%s -> unable to add finalizers to resource {%s}: %s\", clusterIdentity, req.String(), err)\n\t\t\t\t\treturn result, err\n\t\t\t\t}\n\t\t\t\tklog.Errorf(\"%s -> unable to remove finalizers from resource {%s}: %s\", clusterIdentity, req.String(), err)\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t}\n\t\treturn result, nil\n\t}\n\tadded, err := rc.EnsureRoutesPerCluster(tep)\n\tif err != nil {\n\t\tklog.Errorf(\"%s -> unable to configure route for destinations {%s} and {%s}: %s\",\n\t\t\tclusterIdentity, remotePodCIDR, remoteExternalCIDR, err)\n\t\trc.Eventf(tep, \"Warning\", \"Processing\", \"unable to configure route for destinations {%s} and {%s}: %s\",\n\t\t\tremotePodCIDR, remoteExternalCIDR, err.Error())\n\t\treturn result, err\n\t}\n\tif added {\n\t\tklog.Infof(\"%s -> route for destinations {%s} and {%s} correctly configured\", clusterIdentity, remotePodCIDR, remoteExternalCIDR)\n\t\trc.Eventf(tep, \"Normal\", \"Processing\", \"route for destinations {%s} and {%s} configured\", remotePodCIDR, remoteExternalCIDR)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e622598fb01c4a115d6b8b10dac47419", "score": "0.64161", "text": "func (r *ServiceGraphReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"servicegraph\", req.NamespacedName)\n\n\t// your logic here\n\tservicegraph := &onlabv2.ServiceGraph{}\n\terr := r.Get(ctx, req.NamespacedName, servicegraph)\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\tlog.Info(\"Servicegraph resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get ServiceGraph resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t// printServiceGraph(servicegraph)\n\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\t// Check if the deployment for the node already exists, if not create a new one\n\t\tfound := &appsv1.Deployment{}\n\n\t\terr = r.Get(ctx, types.NamespacedName{Name: node.Name, Namespace: \"default\"}, found)\n\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\t//fmt.Printf(\"######### CREATE: %d node type: %T\\n\", i, node)\n\t\t\t// Define a new deployment for the node\n\t\t\tdep := r.deploymentForNode(node, servicegraph)\n\t\t\tlog.Info(\"Creating a new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\n\t\t\terr = r.Create(ctx, dep)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Deployment created successfully - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t} else if err != nil {\n\t\t\tlog.Error(err, \"Failed to get Deployment\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Ensure the deployment size is the same as the spec\n\t\tsize := int32(node.Replicas)\n\t\tif *found.Spec.Replicas != size {\n\t\t\tfound.Spec.Replicas = &size\n\t\t\terr = r.Update(ctx, found)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to update Deployment\", \"Deployment.Namespace\", found.Namespace, \"Deployment.Name\", found.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Spec updated - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\n\t\t// // Update/create services\n\n\t\t// foundSvc := &corev1.Service{}\n\n\t\t// err = r.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"name\"}, foundSvc)\n\n\t\t// if err != nil && errors.IsNotFound(err) {\n\t\t// \tsvc := r.serviceForNode(node, servicegraph)\n\t\t// \tlog.Info(\"Creating a new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t// Yes. This is not awesome, but works\n\t\t// \t// \t_ = r.Delete(ctx, svc)\n\t\t// \t// err = r.Create(ctx, svc)\n\t\t// \terr = r.Create(ctx, svc)\n\t\t// \tif err != nil {\n\t\t// \t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t\treturn ctrl.Result{}, err\n\t\t// \t}\n\t\t// \t// Deployment created successfully - return and requeue\n\t\t// \treturn ctrl.Result{Requeue: true}, nil\n\t\t// } else if err != nil {\n\t\t// \tlog.Error(err, \"Failed to get SVC\")\n\t\t// \treturn ctrl.Result{}, err\n\t\t// }\n\t}\n\n\t// Update/create services\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\tsvc := r.serviceForNode(node, servicegraph)\n\t\t// Yes. This is not awesome, but works\n\t\t//_ = r.Delete(ctx, svc)\n\t\terr = r.Create(ctx, svc)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// Deployment created successfully - return and requeue\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "39ce2e1d4df5bbf82085dd9b0d7e37de", "score": "0.6406576", "text": "func (reconciler *ClusterReconciler) reconcile() (ctrl.Result, error) {\n\tvar err error\n\n\t// Child resources of the cluster CR will be automatically reclaimed by K8S.\n\tif reconciler.observed.cluster == nil {\n\t\treconciler.log.Info(\"The cluster has been deleted, no action to take\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\terr = reconciler.reconcileConfigMap()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileJobManagerDeployment()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileJobManagerService()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileJobManagerIngress()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = reconciler.reconcileTaskManagerDeployment()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err := reconciler.reconcileJob()\n\n\treturn result, nil\n}", "title": "" }, { "docid": "ff6246916f46b0c44c1a6cdd3d8dd030", "score": "0.63962877", "text": "func (r clusterReconciler) Reconcile(_ context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {\n\t// Get the VSphereCluster resource for this request.\n\tvsphereCluster := &infrav1.VSphereCluster{}\n\tif err := r.Client.Get(r, req.NamespacedName, vsphereCluster); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tr.Logger.V(4).Info(\"VSphereCluster not found, won't reconcile\", \"key\", req.NamespacedName)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Fetch the CAPI Cluster.\n\tcluster, err := clusterutilv1.GetOwnerCluster(r, r.Client, vsphereCluster.ObjectMeta)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif cluster == nil {\n\t\tr.Logger.Info(\"Waiting for Cluster Controller to set OwnerRef on VSphereCluster\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\tif annotations.IsPaused(cluster, vsphereCluster) {\n\t\tr.Logger.V(4).Info(\"VSphereCluster %s/%s linked to a cluster that is paused\",\n\t\t\tvsphereCluster.Namespace, vsphereCluster.Name)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Create the patch helper.\n\tpatchHelper, err := patch.NewHelper(vsphereCluster, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to init patch helper for %s %s/%s\",\n\t\t\tvsphereCluster.GroupVersionKind(),\n\t\t\tvsphereCluster.Namespace,\n\t\t\tvsphereCluster.Name)\n\t}\n\n\t// Create the cluster context for this request.\n\tclusterContext := &capvcontext.ClusterContext{\n\t\tControllerContext: r.ControllerContext,\n\t\tCluster: cluster,\n\t\tVSphereCluster: vsphereCluster,\n\t\tLogger: r.Logger.WithName(req.Namespace).WithName(req.Name),\n\t\tPatchHelper: patchHelper,\n\t}\n\n\t// Always issue a patch when exiting this function so changes to the\n\t// resource are patched back to the API server.\n\tdefer func() {\n\t\tif err := clusterContext.Patch(); err != nil {\n\t\t\tif reterr == nil {\n\t\t\t\treterr = err\n\t\t\t}\n\t\t\tclusterContext.Logger.Error(err, \"patch failed\", \"cluster\", clusterContext.String())\n\t\t}\n\t}()\n\n\tif err := setOwnerRefsOnVsphereMachines(clusterContext); err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(err, \"failed to set owner refs on VSphereMachine objects\")\n\t}\n\n\t// Handle deleted clusters\n\tif !vsphereCluster.DeletionTimestamp.IsZero() {\n\t\treturn r.reconcileDelete(clusterContext)\n\t}\n\n\t// If the VSphereCluster doesn't have our finalizer, add it.\n\t// Requeue immediately after adding finalizer to avoid the race condition between init and delete\n\tif !ctrlutil.ContainsFinalizer(vsphereCluster, infrav1.ClusterFinalizer) {\n\t\tctrlutil.AddFinalizer(vsphereCluster, infrav1.ClusterFinalizer)\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// Handle non-deleted clusters\n\treturn r.reconcileNormal(clusterContext)\n}", "title": "" }, { "docid": "e7d99a8fee4d459ea56cd15df0045f13", "score": "0.6380839", "text": "func (r *KindClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := log.FromContext(ctx).WithValues(\"kindcluster\", req.NamespacedName)\n\n\t// Fetch the KindCluster instance\n\tkindCluster := &infrastructurev1alpha4.KindCluster{}\n\tif err := r.Get(ctx, req.NamespacedName, kindCluster); err != nil {\n\t\tif client.IgnoreNotFound(err) != nil {\n\t\t\tlog.Error(err, \"unable to fetch KindCluster\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Cluster no longer exists so lets stop now\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Fetch the owner Cluster\n\tcluster, err := util.GetOwnerCluster(ctx, r.Client, kindCluster.ObjectMeta)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get owner cluster\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif cluster == nil {\n\t\tlog.Info(\"Cluster Controller has not yet set OwnerRef\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif annotations.IsPaused(cluster, kindCluster) {\n\t\tlog.Info(\"KindCluster or linked Cluster is marked as paused. Won't reconcile\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog = log.WithValues(\"cluster\", kindCluster.Name)\n\thelper, err := patch.NewHelper(kindCluster, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrap(err, \"failed to init patch helper\")\n\t}\n\n\t// Ensure we always patch the resource with the latest changes when exiting function\n\tdefer func() {\n\t\thelper.Patch(\n\t\t\tcontext.TODO(),\n\t\t\tkindCluster,\n\t\t\tpatch.WithOwnedConditions{\n\t\t\t\tConditions: []clusterv1.ConditionType{\n\t\t\t\t\tclusterv1.ReadyCondition,\n\t\t\t\t}},\n\t\t)\n\t}()\n\n\tif !kindCluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t// The KindCluster is being deleted\n\t\tif controllerutil.ContainsFinalizer(kindCluster, finalizerName) {\n\t\t\tlog.Info(\"Deleting cluster\")\n\n\t\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseDeleting\n\t\t\tkindCluster.Status.Ready = false\n\t\t\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\t\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tif err := kindClient.DeleteCluster(kindCluster.NamespacedName()); err != nil {\n\t\t\t\tlog.Error(err, \"failed to delete cluster\")\n\t\t\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonDeleteFailed\n\t\t\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tcontrollerutil.RemoveFinalizer(kindCluster, finalizerName)\n\t\t\tlog.Info(\"Removed finalizer\")\n\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Ensure our finalizer is present\n\tcontrollerutil.AddFinalizer(kindCluster, finalizerName)\n\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif kindCluster.Status.Phase == nil || *kindCluster.Status.Phase == infrastructurev1alpha4.KindClusterPhasePending {\n\t\tlog.Info(\"Creating new cluster in Kind\")\n\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseCreating\n\t\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tif err := kindClient.CreateCluster(kindCluster); err != nil {\n\t\t\tlog.Error(err, \"failed to create cluster in kind\")\n\t\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonCreateFailed\n\t\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tkindCluster.Status.Ready = true\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseReady\n\t\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tlog.Info(\"Cluster created\")\n\t}\n\n\t// Ensure ready status is up-to-date\n\tisReady, err := kindClient.IsReady(kindCluster.NamespacedName())\n\tif err != nil {\n\t\tlog.Error(err, \"failed to check status of cluster\")\n\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonClusterNotFound\n\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\tkindCluster.Status.Ready = isReady\n\tif isReady {\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseReady\n\t} else {\n\t\tkindCluster.Status.Phase = &infrastructurev1alpha4.KindClusterPhaseCreating\n\t}\n\n\t// Ensure kubeconfig is up-to-date\n\tkc, err := kindClient.GetKubeConfig(kindCluster.NamespacedName())\n\tif err != nil {\n\t\tlog.Error(err, \"failed to check status of cluster\")\n\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonKubeConfig\n\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\tkindCluster.Status.KubeConfig = &kc\n\n\t// Populate the server endpoint details\n\tendpoint, err := kubeconfig.ExtractEndpoint(kc, kindCluster.NamespacedName())\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get control plane endpoint\")\n\t\tkindCluster.Status.FailureReason = &v1alpha4.FailureReasonEndpoint\n\t\tkindCluster.Status.FailureMessage = utils.StringPtr(err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\tkindCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{\n\t\tHost: endpoint.Host,\n\t\tPort: endpoint.Port,\n\t}\n\n\tif err := helper.Patch(ctx, kindCluster); err != nil {\n\t\tlog.Error(err, \"failed to update KindCluster status\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "daf04422c6dc758ec0854f6590bab876", "score": "0.6347092", "text": "func (r *NestedEtcdReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := r.Log.WithValues(\"nestedetcd\", req.NamespacedName)\n\tlog.Info(\"Reconciling NestedEtcd...\")\n\tvar netcd clusterv1.NestedEtcd\n\tif err := r.Get(ctx, req.NamespacedName, &netcd); err != nil {\n\t\treturn ctrl.Result{}, ctrlcli.IgnoreNotFound(err)\n\t}\n\tlog.Info(\"creating NestedEtcd\",\n\t\t\"namespace\", netcd.GetNamespace(),\n\t\t\"name\", netcd.GetName())\n\n\t// check if the ownerreference has been set by the NestedControlPlane controller.\n\towner := getOwner(netcd.ObjectMeta)\n\tif owner == (metav1.OwnerReference{}) {\n\t\t// requeue the request if the owner NestedControlPlane has\n\t\t// not been set yet.\n\t\tlog.Info(\"the owner has not been set yet, will retry later\",\n\t\t\t\"namespace\", netcd.GetNamespace(),\n\t\t\t\"name\", netcd.GetName())\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\tvar netcdSts appsv1.StatefulSet\n\tif err := r.Get(ctx, types.NamespacedName{\n\t\tNamespace: netcd.GetNamespace(),\n\t\tName: netcd.GetName(),\n\t}, &netcdSts); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// as the statefulset is not found, mark the NestedEtcd as unready\n\t\t\tif IsComponentReady(netcd.Status.CommonStatus) {\n\t\t\t\tnetcd.Status.Phase =\n\t\t\t\t\tstring(clusterv1.Unready)\n\t\t\t\tlog.V(5).Info(\"The corresponding statefulset is not found, \" +\n\t\t\t\t\t\"will mark the NestedEtcd as unready\")\n\t\t\t\tif err := r.Status().Update(ctx, &netcd); err != nil {\n\t\t\t\t\tlog.Error(err, \"fail to update the status of the NestedEtcd Object\")\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\t\t\t}\n\t\t\t// the statefulset is not found, create one\n\t\t\tif err := createNestedComponentSts(ctx,\n\t\t\t\tr.Client, netcd.ObjectMeta,\n\t\t\t\tnetcd.Spec.NestedComponentSpec,\n\t\t\t\tclusterv1.Etcd, owner.Name, log); err != nil {\n\t\t\t\tlog.Error(err, \"fail to create NestedEtcd StatefulSet\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\tlog.Info(\"successfully create the NestedEtcd StatefulSet\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\tlog.Error(err, \"fail to get NestedEtcd StatefulSet\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif netcdSts.Status.ReadyReplicas == netcdSts.Status.Replicas {\n\t\tlog.Info(\"The NestedEtcd StatefulSet is ready\")\n\t\tif IsComponentReady(netcd.Status.CommonStatus) {\n\t\t\t// As the NestedEtcd StatefulSet is ready, update NestedEtcd status\n\t\t\tip, err := getNestedEtcdSvcClusterIP(ctx, r.Client, netcd)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"fail to get NestedEtcd Service ClusterIP\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\tnetcd.Status.Phase = string(clusterv1.Ready)\n\t\t\tnetcd.Status.Addresses = []clusterv1.NestedEtcdAddress{\n\t\t\t\t{\n\t\t\t\t\tIP: ip,\n\t\t\t\t\tPort: 2379,\n\t\t\t\t},\n\t\t\t}\n\t\t\tlog.V(5).Info(\"The corresponding statefulset is ready, \" +\n\t\t\t\t\"will mark the NestedEtcd as ready\")\n\t\t\tif err := r.Status().Update(ctx, &netcd); err != nil {\n\t\t\t\tlog.Error(err, \"fail to update NestedEtcd Object\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\tlog.Info(\"Successfully set the NestedEtcd object to ready\",\n\t\t\t\t\"address\", netcd.Status.Addresses)\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// As the NestedEtcd StatefulSet is unready, mark the NestedEtcd as unready\n\t// if its current status is ready\n\tif IsComponentReady(netcd.Status.CommonStatus) {\n\t\tnetcd.Status.Phase = string(clusterv1.Unready)\n\t\tif err := r.Status().Update(ctx, &netcd); err != nil {\n\t\t\tlog.Error(err, \"fail to update NestedEtcd Object\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Successfully set the NestedEtcd object to unready\")\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "422535eb6d5d8be73e415771d3cc6b1e", "score": "0.6298655", "text": "func (r *FoundationDBClusterReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {\n\tcluster := &fdbtypes.FoundationDBCluster{}\n\n\terr := r.Get(ctx, request.NamespacedName, cluster)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tclusterLog := log.WithValues(\"namespace\", cluster.Namespace, \"cluster\", cluster.Name)\n\n\tif cluster.Spec.Skip {\n\t\tclusterLog.Info(\"Skipping cluster with skip value true\", \"skip\", cluster.Spec.Skip)\n\t\t// Don't requeue\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\terr = internal.NormalizeClusterSpec(cluster, r.DeprecationOptions)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tadminClient, err := r.getDatabaseClientProvider().GetAdminClient(cluster, r)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tdefer adminClient.Close()\n\n\tsupportedVersion, err := adminClient.VersionSupported(cluster.Spec.Version)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif !supportedVersion {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"version %s is not supported\", cluster.Spec.Version)\n\t}\n\n\tsubReconcilers := []clusterSubReconciler{\n\t\tupdateStatus{},\n\t\tupdateLockConfiguration{},\n\t\tupdateConfigMap{},\n\t\tcheckClientCompatibility{},\n\t\treplaceMisconfiguredProcessGroups{},\n\t\treplaceFailedProcessGroups{},\n\t\tdeletePodsForBuggification{},\n\t\taddProcessGroups{},\n\t\taddServices{},\n\t\taddPVCs{},\n\t\taddPods{},\n\t\tgenerateInitialClusterFile{},\n\t\tupdateSidecarVersions{},\n\t\tupdatePodConfig{},\n\t\tupdateLabels{},\n\t\tupdateDatabaseConfiguration{},\n\t\tchooseRemovals{},\n\t\texcludeInstances{},\n\t\tchangeCoordinators{},\n\t\tbounceProcesses{},\n\t\tupdatePods{},\n\t\tremoveServices{},\n\t\tremoveProcessGroups{},\n\t\tupdateStatus{},\n\t}\n\n\toriginalGeneration := cluster.ObjectMeta.Generation\n\tnormalizedSpec := cluster.Spec.DeepCopy()\n\tdelayedRequeue := false\n\n\tfor _, subReconciler := range subReconcilers {\n\t\t// We have to set the normalized spec here again otherwise any call to Update() for the status of the cluster\n\t\t// will reset all normalized fields...\n\t\tcluster.Spec = *(normalizedSpec.DeepCopy())\n\t\tclusterLog.Info(\"Attempting to run sub-reconciler\", \"subReconciler\", fmt.Sprintf(\"%T\", subReconciler))\n\n\t\trequeue := subReconciler.reconcile(r, ctx, cluster)\n\t\tif requeue == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif requeue.delayedRequeue {\n\t\t\tclusterLog.Info(\"Delaying requeue for sub-reconciler\",\n\t\t\t\t\"subReconciler\", fmt.Sprintf(\"%T\", subReconciler),\n\t\t\t\t\"message\", requeue.message)\n\t\t\tdelayedRequeue = true\n\t\t\tcontinue\n\t\t}\n\n\t\treturn processRequeue(requeue, subReconciler, cluster, r.Recorder, clusterLog)\n\t}\n\n\tif cluster.Status.Generations.Reconciled < originalGeneration || delayedRequeue {\n\t\tclusterLog.Info(\"Cluster was not fully reconciled by reconciliation process\", \"status\", cluster.Status.Generations)\n\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\tclusterLog.Info(\"Reconciliation complete\", \"generation\", cluster.Status.Generations.Reconciled)\n\tr.Recorder.Event(cluster, corev1.EventTypeNormal, \"ReconciliationComplete\", fmt.Sprintf(\"Reconciled generation %d\", cluster.Status.Generations.Reconciled))\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "4deb159275cfa8be72c09fa9a581e27b", "score": "0.6288743", "text": "func (r *Reconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {\n\tr.log.Debug(\"running\")\n\tinstance := &aropreviewv1alpha1.PreviewFeature{}\n\terr := r.client.Get(ctx, types.NamespacedName{Name: aropreviewv1alpha1.SingletonPreviewFeatureName}, instance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tclusterInstance := &arov1alpha1.Cluster{}\n\terr = r.client.Get(ctx, types.NamespacedName{Name: arov1alpha1.SingletonClusterName}, clusterInstance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Get endpoints from operator\n\tazEnv, err := azureclient.EnvironmentFromName(clusterInstance.Spec.AZEnvironment)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tresource, err := azure.ParseResourceID(clusterInstance.Spec.ResourceID)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// create refreshable authorizer from token\n\tazRefreshAuthorizer, err := clusterauthorizer.NewAzRefreshableAuthorizer(r.log, &azEnv, r.client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tauthorizer, err := azRefreshAuthorizer.NewRefreshableAuthorizerToken(ctx)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tflowLogsClient := network.NewFlowLogsClient(&azEnv, resource.SubscriptionID, authorizer)\n\tkubeSubnets := subnet.NewKubeManager(r.client, resource.SubscriptionID)\n\tsubnets := subnet.NewManager(&azEnv, resource.SubscriptionID, authorizer)\n\n\tfeatures := []feature{\n\t\tnsgflowlogs.NewFeature(flowLogsClient, kubeSubnets, subnets, clusterInstance.Spec.Location),\n\t}\n\n\terr = nil\n\tfor _, f := range features {\n\t\tthisErr := f.Reconcile(ctx, instance)\n\t\tif thisErr != nil {\n\t\t\t// Reconcile all features even if there is an error in some of them\n\t\t\terr = thisErr\n\t\t\tr.log.Errorf(\"error reconciling %q: %s\", f.Name(), err)\n\t\t}\n\t}\n\n\t// Controller-runtime will requeue when err != nil\n\treturn reconcile.Result{}, err\n}", "title": "" }, { "docid": "a220ad040a257147fa6e00d3c1633580", "score": "0.62621206", "text": "func (r *MultiClusterObservabilityReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\treqLogger.Info(\"Reconciling MultiClusterObservability\")\n\n\t// Fetch the MultiClusterObservability instance\n\tinstance := &mcov1beta1.MultiClusterObservability{}\n\terr := r.Client.Get(context.TODO(), types.NamespacedName{\n\t\tName: config.GetMonitoringCRName(),\n\t}, instance)\n\tif err != nil {\n\t\tif apierrors.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 ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Init finalizers\n\tisTerminating, err := r.initFinalization(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t} else if isTerminating {\n\t\treqLogger.Info(\"MCO instance is in Terminating status, skip the reconcile\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t//read image manifest configmap to be used to replace the image for each component.\n\tif _, err = config.ReadImageManifestConfigMap(r.Client); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Do not reconcile objects if this instance of mch is labeled \"paused\"\n\tif config.IsPaused(instance.GetAnnotations()) {\n\t\treqLogger.Info(\"MCO reconciliation is paused. Nothing more to do.\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tstorageClassSelected, err := getStorageClass(instance, r.Client)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t//instance.Namespace = config.GetDefaultNamespace()\n\tinstance.Spec.StorageConfig.StatefulSetStorageClass = storageClassSelected\n\t//Render the templates with a specified CR\n\trenderer := rendering.NewRenderer(instance)\n\ttoDeploy, err := renderer.Render(r.Client)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Failed to render multiClusterMonitoring templates\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tdeployer := deploying.NewDeployer(r.Client)\n\t//Deploy the resources\n\tfor _, res := range toDeploy {\n\t\tif res.GetNamespace() == config.GetDefaultNamespace() {\n\t\t\tif err := controllerutil.SetControllerReference(instance, res, r.Scheme); err != nil {\n\t\t\t\treqLogger.Error(err, \"Failed to set controller reference\")\n\t\t\t}\n\t\t}\n\t\tif err := deployer.Deploy(res); err != nil {\n\t\t\treqLogger.Error(err, fmt.Sprintf(\"Failed to deploy %s %s/%s\",\n\t\t\t\tres.GetKind(), config.GetDefaultNamespace(), res.GetName()))\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// expose observatorium api gateway\n\tresult, err := GenerateAPIGatewayRoute(r.Client, r.Scheme, instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// create the certificates\n\terr = createObservabilityCertificate(r.Client, r.Scheme, instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// create an Observatorium CR\n\tresult, err = GenerateObservatoriumCR(r.Client, r.Scheme, instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\t// generate grafana datasource to point to observatorium api gateway\n\tresult, err = GenerateGrafanaDataSource(r.Client, r.Scheme, instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\tenableManagedCluster, found := os.LookupEnv(\"ENABLE_MANAGED_CLUSTER\")\n\tif !found || enableManagedCluster != \"false\" {\n\t\t// create the placementrule\n\t\terr = createPlacementRule(r.Client, r.Scheme, instance)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tresult, err = r.UpdateStatus(instance)\n\tif result != nil {\n\t\treturn *result, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "98cc05963fb9fb40a5a0de751504331a", "score": "0.6240847", "text": "func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {\n\t_ = r.Log.WithValues(\"cluster\", req.NamespacedName)\n\t// Fetch the Cluster instance.\n\tcluster, err := r.resourceFetcher.FetchCluster(ctx, req.NamespacedName)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\t// Initialize the patch helper\n\tpatchHelper, err := patch.NewHelper(cluster, r.Client)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdefer func() {\n\t\t// Always attempt to patch the object and status after each reconciliation.\n\t\tif err := patchHelper.Patch(ctx, cluster); err != nil {\n\t\t\treterr = kerrors.NewAggregate([]error{reterr, err})\n\t\t}\n\t}()\n\n\t// Ignore deleted Clusters, this can happen when foregroundDeletion\n\t// is enabled\n\tif !cluster.DeletionTimestamp.IsZero() {\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// If the external object is paused, return without any further processing.\n\tif cluster.IsReconcilePaused() {\n\t\tr.Log.Info(\"eksa reconciliation is paused\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// dry run\n\tresult, err := r.reconcile(ctx, req.NamespacedName, true)\n\tif err != nil {\n\t\tr.Log.Error(err, \"Dry run failed to reconcile Cluster\")\n\t\treturn result, err\n\t}\n\t// non dry run\n\tresult, err = r.reconcile(ctx, req.NamespacedName, false)\n\tif err != nil {\n\t\tr.Log.Error(err, \"Failed to reconcile Cluster\")\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "449490340d33bc5cc36cb07e786d7893", "score": "0.62379974", "text": "func (r *IstioControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlogger := r.Log.WithValues(\"istiocontrolplane\", req.NamespacedName)\n\n\ticp := &servicemeshv1alpha1.IstioControlPlane{}\n\terr := r.Get(ctx, req.NamespacedName, icp)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\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\tif icp.Spec.Version == \"\" {\n\t\terr = errors.New(\"please set spec.version in your istiocontrolplane CR to be reconciled by this operator\")\n\t\tlogger.Error(err, \"\", \"name\", icp.Name, \"namespace\", icp.Namespace)\n\n\t\treturn reconcile.Result{\n\t\t\tRequeue: false,\n\t\t}, nil\n\t}\n\n\tif !IsIstioVersionSupported(icp.Spec.Version) {\n\t\terr = errors.New(\"intended Istio version is unsupported by this version of the operator\")\n\t\tlogger.Error(err, \"\", \"version\", icp.Spec.Version)\n\n\t\treturn reconcile.Result{\n\t\t\tRequeue: false,\n\t\t}, nil\n\t}\n\n\tif requeueNeeded, err := k8sutil.IsReqeueNeededCosNamespaceTermination(ctx, r.GetClient(), icp); requeueNeeded && err == nil {\n\t\tlogger.Info(\"namespace is terminating, requeue needed\")\n\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: nsTerminationRequeueDuration,\n\t\t}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult, err := r.reconcile(ctx, icp, logger)\n\tif err != nil {\n\t\tupdateErr := components.UpdateStatus(ctx, r.Client, icp, components.ConvertConfigStateToReconcileStatus(servicemeshv1alpha1.ConfigState_ReconcileFailed), err.Error())\n\t\tif updateErr != nil {\n\t\t\tlogger.Error(updateErr, \"failed to update state\")\n\n\t\t\treturn result, errors.WithStack(err)\n\t\t}\n\n\t\tif result.Requeue {\n\t\t\treturn result, nil\n\t\t}\n\n\t\treturn result, err\n\t}\n\n\tupdateErr := components.UpdateStatus(ctx, r.Client, icp, components.ConvertConfigStateToReconcileStatus(servicemeshv1alpha1.ConfigState_Available), \"\")\n\tif updateErr != nil && !k8serrors.IsNotFound(updateErr) {\n\t\tlogger.Error(updateErr, \"failed to update state\")\n\n\t\treturn result, errors.WithStack(err)\n\t}\n\n\terr = util.RemoveFinalizer(ctx, r.Client, icp, istioControlPlaneFinalizerID, true)\n\tif err != nil {\n\t\treturn result, errors.WithStack(err)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "276c097c3419e4b38386302eb417d367", "score": "0.6206529", "text": "func (s *Reconciler) Reconcile() (ReconcileResponse, error) {\n\tsyncFns := []func() error{\n\t\ts.validateClusterConfigAndSetDefaultsIfNotSet,\n\t\ts.buildClusterPlan,\n\t}\n\tfor _, syncFn := range syncFns {\n\t\terr := syncFn()\n\t\tif err != nil {\n\t\t\treturn ReconcileResponse{}, err\n\t\t}\n\t}\n\ts.resetClusterConfigReconcileErrorIfAny()\n\treturn s.makeReconcileResponse()\n}", "title": "" }, { "docid": "692aaf6aaaf1588068837da1501a7aa2", "score": "0.61932", "text": "func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) {\n\tlog := r.log.WithValues(strings.ToLower(r.gvk.Kind), req.NamespacedName)\n\tlog.V(1).Info(\"Reconciliation triggered\")\n\n\tobj := &unstructured.Unstructured{}\n\tobj.SetGroupVersionKind(*r.gvk)\n\terr = r.client.Get(ctx, req.NamespacedName, obj)\n\tif apierrors.IsNotFound(err) {\n\t\tlog.V(1).Info(\"Resource %s/%s not found, nothing to do\", req.NamespacedName.Namespace, req.NamespacedName.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tu := updater.New(r.client)\n\tdefer func() {\n\t\tapplyErr := u.Apply(ctx, obj)\n\t\tif err == nil && !apierrors.IsNotFound(applyErr) {\n\t\t\terr = applyErr\n\t\t}\n\t}()\n\n\tactionClient, err := r.actionClientGetter.ActionClientFor(obj)\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingClient, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeDeployed),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeInitialized),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\tupdater.EnsureDeployedRelease(nil),\n\t\t)\n\t\t// NOTE: If obj has the uninstall finalizer, that means a release WAS deployed at some point\n\t\t// in the past, but we don't know if it still is because we don't have an actionClient to check.\n\t\t// So the question is, what do we do with the finalizer? We could:\n\t\t// - Leave it in place. This would make the CR impossible to delete without either resolving this error, or\n\t\t// manually uninstalling the release, deleting the finalizer, and deleting the CR.\n\t\t// - Remove the finalizer. This would make it possible to delete the CR, but it would leave around any\n\t\t// release resources that are not owned by the CR (those in the cluster scope or in other namespaces).\n\t\t//\n\t\t// The decision made for now is to leave the finalizer in place, so that the user can intervene and try to\n\t\t// resolve the issue, instead of the operator silently leaving some dangling resources hanging around after the\n\t\t// CR is deleted.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// As soon as we get the actionClient, lookup the release and\n\t// update the status with this info. We need to do this as\n\t// early as possible in case other irreconcilable errors occur.\n\t//\n\t// We also make sure not to return any errors we encounter so\n\t// we can still attempt an uninstall if the CR is being deleted.\n\trel, err := actionClient.Get(obj.GetName())\n\tif errors.Is(err, driver.ErrReleaseNotFound) {\n\t\tu.UpdateStatus(updater.EnsureCondition(conditions.Deployed(corev1.ConditionFalse, \"\", \"\")))\n\t} else if err == nil {\n\t\tensureDeployedRelease(&u, rel)\n\t}\n\tu.UpdateStatus(updater.EnsureCondition(conditions.Initialized(corev1.ConditionTrue, \"\", \"\")))\n\n\tif obj.GetDeletionTimestamp() != nil {\n\t\terr := r.handleDeletion(ctx, actionClient, obj, log)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tvals, err := r.getValues(ctx, obj)\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingValues, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trel, state, err := r.getReleaseState(actionClient, obj, vals.AsMap())\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingReleaseState, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeDeployed),\n\t\t\tupdater.EnsureDeployedRelease(nil),\n\t\t)\n\t\treturn ctrl.Result{}, err\n\t}\n\tu.UpdateStatus(updater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionFalse, \"\", \"\")))\n\n\tfor _, h := range r.preHooks {\n\t\tif err := h.Exec(obj, vals, log); err != nil {\n\t\t\tlog.Error(err, \"pre-release hook failed\")\n\t\t}\n\t}\n\n\tswitch state {\n\tcase stateNeedsInstall:\n\t\trel, err = r.doInstall(actionClient, &u, obj, vals.AsMap(), log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\tcase stateNeedsUpgrade:\n\t\trel, err = r.doUpgrade(actionClient, &u, obj, vals.AsMap(), log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\tcase stateUnchanged:\n\t\tif err := r.doReconcile(actionClient, &u, rel, log); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\tdefault:\n\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected release state: %s\", state)\n\t}\n\n\tfor _, h := range r.postHooks {\n\t\tif err := h.Exec(obj, *rel, log); err != nil {\n\t\t\tlog.Error(err, \"post-release hook failed\", \"name\", rel.Name, \"version\", rel.Version)\n\t\t}\n\t}\n\n\tensureDeployedRelease(&u, rel)\n\tu.UpdateStatus(\n\t\tupdater.EnsureCondition(conditions.ReleaseFailed(corev1.ConditionFalse, \"\", \"\")),\n\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionFalse, \"\", \"\")),\n\t)\n\n\treturn ctrl.Result{RequeueAfter: r.reconcilePeriod}, nil\n}", "title": "" }, { "docid": "7a9c8ce66e72172c2742b2757ee7d3ea", "score": "0.61921513", "text": "func (r *RouterServiceReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\n\t// Fetch the Service\n\tsvc := &corev1.Service{}\n\terr := r.Client.Get(context.TODO(), request.NamespacedName, svc)\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// Only check LoadBalancer service types for annotations\n\t// Only set timeout annotations on services for < OCP 4.11. In 4.11+, the cluster-ingress-operator maintains this annotation\n\tif svc.Spec.Type == corev1.ServiceTypeLoadBalancer && !baseutils.IsVersionHigherThan(\"4.11\") {\n\t\tif !metav1.HasAnnotation(svc.ObjectMeta, ELBAnnotationKey) ||\n\t\t\tsvc.ObjectMeta.Annotations[ELBAnnotationKey] != ELBAnnotationValue {\n\t\t\treqLogger.Info(\"Updating annotation for \" + svc.Name)\n\t\t\tmetav1.SetMetaDataAnnotation(&svc.ObjectMeta, ELBAnnotationKey, ELBAnnotationValue)\n\t\t\terr = r.Client.Update(context.TODO(), svc)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Error updating service annotation\")\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t} else {\n\t\t\treqLogger.Info(\"skipping service \" + svc.Name + \" w/ proper annotations\")\n\t\t}\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "fcdd94d51f2b58ed5fdb95e126b1437c", "score": "0.6186936", "text": "func (r *reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {\n\tlog.Info(\"reconciling\", \"request\", request)\n\n\t// Only proceed if we can get the ingress resource.\n\tingress := &configv1.Ingress{}\n\tif err := r.cache.Get(ctx, request.NamespacedName, ingress); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlog.Info(\"ingress cr not found; reconciliation will be skipped\", \"request\", request)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to get ingress %q: %w\", request.NamespacedName, err)\n\t}\n\n\t// Get the list of componentRoutes defined in both the spec and status of the ingress resource that require\n\t// roles and roleBindings.\n\tcomponentRoutes := intersectingComponentRoutes(ingress.Spec.ComponentRoutes, ingress.Status.ComponentRoutes)\n\n\t// Ensure role and roleBindings exist for each valid componentRoute.\n\tfor _, componentRoute := range componentRoutes {\n\t\t// Ensure role.\n\t\troleName, err := r.ensureServiceCertKeyPairSecretRole(componentRoute)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to create role: %v\", err)\n\t\t}\n\n\t\t// Get the role just created so the UID is available for the ownerReference on the roleBinding.\n\t\trole := &rbacv1.Role{}\n\t\tif err := r.client.Get(ctx, types.NamespacedName{Namespace: r.config.SecretNamespace, Name: roleName}, role); err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\t// Ensure roleBinding.\n\t\tif err := r.ensureServiceCertKeyPairSecretRoleBinding(role, componentRoute); err != nil {\n\t\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to create roleBinding: %v\", err)\n\t\t}\n\t}\n\n\texistingHashes := sets.String{}\n\tfor _, cr := range componentRoutes {\n\t\texistingHashes.Insert(cr.Hash)\n\t}\n\n\t// Delete any roles or roleBindings that were generated for componentRoutes that are no longer defined.\n\t// RoleBindings are cleanedup by garbage collector due to owner reference to Role.\n\tif err := utilerrors.NewAggregate(r.deleteOrphanedRoles(componentRoutes, existingHashes)); err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"error(s) deleting orphaned roles: %v\", err)\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "1c8b3f9827708b0253a0286175cc4b5b", "score": "0.61557096", "text": "func (r *KcrdReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tLog := log.FromContext(ctx)\n\n\t// your logic here\n\n\tkcrd := &kapiv1.Kcrd{}\n\terr := r.Client.Get(ctx, req.NamespacedName, kcrd)\n\tfmt.Println(kcrd.Name)\n\n\tgetDep := &v1.Deployment{}\n\terr = r.Client.Get(ctx, req.NamespacedName, getDep)\n\tif errors.IsNotFound(err) {\n\t\tfmt.Println(\"new deployment creating... +++++++\")\n\t\tif err = r.Client.Create(ctx, newDeployment(kcrd)); err != nil {\n\t\t\tLog.Error(err, \"error creating deployments ++++++\")\n\t\t} else {\n\t\t\tfmt.Println(kcrd.Name + \"-dep \" + \"created +++++++++\")\n\t\t}\n\t}\n\n\tgetSvc := &v12.Service{}\n\terr = r.Client.Get(ctx, req.NamespacedName, getSvc)\n\tif errors.IsNotFound(err) {\n\t\tfmt.Println(\"new service creating... +++++++\")\n\t\tif err = r.Client.Create(ctx, newService(kcrd)); err != nil {\n\t\t\tLog.Error(err, \"error creating service ++++++\")\n\t\t} else {\n\t\t\tfmt.Println(kcrd.Name + \"-svc \" + \"created +++++++++\")\n\t\t}\n\t}\n\n\tgetIng := &netv1.Ingress{}\n\terr = r.Client.Get(ctx, req.NamespacedName, getIng)\n\tif errors.IsNotFound(err) {\n\t\tfmt.Println(\"new ingress creating... +++++++\")\n\t\tif err = r.Client.Create(ctx, newIngress(kcrd)); err != nil {\n\t\t\tLog.Error(err, \"error creating ingress ++++++\")\n\t\t} else {\n\t\t\tfmt.Println(kcrd.Name + \"-ing \" + \"created +++++++++\")\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "dbb960489f5c10948d877622343ed94a", "score": "0.61447823", "text": "func (s *Service) Reconcile(ctx context.Context) error {\n\tctx, log, done := tele.StartSpanWithLogger(ctx, \"inboundnatrules.Service.Reconcile\")\n\tdefer done()\n\n\t// Externally managed clusters might not have an LB\n\tif s.Scope.APIServerLBName() == \"\" {\n\t\tlog.V(4).Info(\"Skipping InboundNatRule reconciliation as the cluster has no LB configured\")\n\t\treturn nil\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, reconciler.DefaultAzureServiceReconcileTimeout)\n\tdefer cancel()\n\n\texistingRules, err := s.client.List(ctx, s.Scope.ResourceGroup(), s.Scope.APIServerLBName())\n\tif err != nil {\n\t\tresult := errors.Wrapf(err, \"failed to get existing NAT rules\")\n\t\ts.Scope.UpdatePutStatus(infrav1.InboundNATRulesReadyCondition, serviceName, result)\n\t\treturn result\n\t}\n\n\tportsInUse := make(map[int32]struct{})\n\tfor _, rule := range existingRules {\n\t\tportsInUse[*rule.InboundNatRulePropertiesFormat.FrontendPort] = struct{}{} // Mark frontend port as in use\n\t}\n\n\tspecs := s.Scope.InboundNatSpecs(portsInUse)\n\tif len(specs) == 0 {\n\t\treturn nil\n\t}\n\n\t// We go through the list of InboundNatSpecs to reconcile 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 creating) -> operationNotDoneError (i.e. creating in progress) -> no error (i.e. created)\n\tvar result error\n\tfor _, natRule := range specs {\n\t\t// If we are creating multiple inbound NAT rules, we could have a collision in finding an available frontend port since the newly created rule takes an available port, and we do not update portsInUse in the specs.\n\t\t// It doesn't matter in this case since we only create one rule per machine, but for multiple rules, we could end up restarting the Reconcile function each time to get the updated available ports.\n\t\t// TODO: We can update the available ports and recompute the specs each time, or alternatively, we could deterministically calculate the ports we plan on using to avoid collisions, i.e. rule #1 uses the first available port, rule #2 uses the second available port, etc.\n\t\tif _, err := s.CreateResource(ctx, natRule, 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.UpdatePutStatus(infrav1.InboundNATRulesReadyCondition, serviceName, result)\n\n\treturn result\n}", "title": "" }, { "docid": "8ab0bdd587f5ee0558b04c690b4df348", "score": "0.61191845", "text": "func (r *PodRefreshReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\t_ = r.Log.WithValues(\"secret\", req.NamespacedName)\n\n\tr.Log.Info(\"Reconciling CertManager TLS Certificates\")\n\n\t// Fetch secret in the cluster.\n\tsecret := &corev1.Secret{}\n\terr := r.Get(context.TODO(), req.NamespacedName, secret)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile req.\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 req.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// If secret doesn't have cert-manager annotations, stop reconciliing it. This is the failsafe to prevent\n\t// a bounce on a resource that is not a cert-manager-related secret.\n\t// DEPRECATED(2020-10-23): This exists as a safety precuation, but predicates should be filtering these out. Remove in the future.\n\tants := secret.GetAnnotations()\n\tif _, ok := ants[issuerKindAnnotation]; !ok {\n\t\tr.Log.Info(\"Secret is not a cert-manager issued certificate. Disregarding.\", \"Secret.Name\", secret.GetName(), \"Secret.Namespace\", secret.GetNamespace())\n\t\treturn reconcile.Result{}, nil\n\t}\n\tr.Log.Info(\"Secret is a cert-manager issued certificate. Checking deployments/statefulsets/daemonsets using Secret.\", \"Secret.Name\", secret.GetName(), \"Secret.Namespace\", secret.GetNamespace())\n\n\t// If Secret has been updated, try to find deployments in the same namespace that needs to be bounced.\n\tr.Log.V(2).Info(\"Looking for deployments in namespace using certificate\", \"Secret.Name\", secret.GetName(), \"Secret.Namespace\", secret.GetNamespace())\n\tdeployList := appsv1.DeploymentList{}\n\terr = r.List(context.TODO(), &deployList, &client.ListOptions{Namespace: secret.GetNamespace()})\n\tif err != nil {\n\t\tr.Log.Error(err, \"Error listing deployments\", \"req.Namespace\", secret.GetNamespace())\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// If Secret has been updated, try to find daemonsets in the same namespace that needs to be bounced.\n\tr.Log.V(2).Info(\"Looking for daemonsets in namespace using certificate\", \"Secret.Name\", secret.GetName(), \"Secret.Namespace\", secret.GetNamespace())\n\tdsetList := appsv1.DaemonSetList{}\n\terr = r.List(context.TODO(), &dsetList, &client.ListOptions{Namespace: secret.GetNamespace()})\n\tif err != nil {\n\t\tr.Log.Error(err, \"Error listing daemonsets\", \"req.Namespace\", secret.GetNamespace())\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// If Secret has been updated, try to find statefulsets in the same namespace that needs to be bounced.\n\tr.Log.V(2).Info(\"Looking for statefulset in namespace using certificate\", \"Secret.Name\", secret.GetName(), \"Secret.Namespace\", secret.GetNamespace())\n\tstsList := appsv1.StatefulSetList{}\n\terr = r.List(context.TODO(), &stsList, &client.ListOptions{Namespace: secret.GetNamespace()})\n\tif err != nil {\n\t\tr.Log.Error(err, \"Error listing statefulsets\", \"req.Namespace\", secret.GetNamespace())\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Since we are not sending a requeue if a refresh fails, we log it instead.\n\trefreshErrors := make([]refreshErrorData, 0)\n\tvar updateFailed bool\n\n\t// Check deployments in the relevant namespace\n\tfor _, deploy := range deployList.Items {\n\t\tr.Log.Info(\"Checking deployment for usage of certificate found in secret\", \"Secret\", secret.GetName(), \"Deployment\", deploy.GetName(), \"Namespace\", secret.GetNamespace()) //debug make higher verbosity level\n\t\tupdatedAt := time.Now().Format(\"2006-1-2.1504\")\n\t\tif hasAllowRestartAnnotation(deploy.ObjectMeta) && usesSecret(secret, deploy.Spec.Template.Spec) && outdatedSecretInUse(secret.GetName(), secret.GetResourceVersion(), deploy.GetObjectMeta().GetAnnotations()) {\n\t\t\tr.Event(&deploy, corev1.EventTypeNormal, refresh.reason, refresh.message)\n\t\t\tr.Log.Info(\"Deployment makes use of secret and has opted-in\", \"Secret\", secret.GetName(), \"Deployment\", deploy.GetName(), \"Namespace\", secret.GetNamespace())\n\t\t\tupdatedDeploy := deploy.DeepCopy()\n\t\t\tupdatedDeploy.ObjectMeta.Labels[timeRestartedLabel] = updatedAt\n\t\t\tupdatedDeploy.Spec.Template.ObjectMeta.Labels[timeRestartedLabel] = updatedAt\n\t\t\tupdateSecretRevisionAnnotation(secret.GetName(), secret.GetResourceVersion(), updatedDeploy.GetAnnotations())\n\t\t\tr.Log.Info(\"Initiating refresh\", \"Secret\", secret.GetName(), \"Deployment\", deploy.GetName(), \"Namespace\", secret.GetNamespace())\n\t\t\terr := r.Update(context.TODO(), updatedDeploy)\n\t\t\tif err != nil {\n\t\t\t\tr.Event(&deploy, corev1.EventTypeWarning, refreshFailure.reason, refreshFailure.message)\n\t\t\t\tr.Log.Error(err, \"Unable to restart deployment.\", \"Deployment.Name\", deploy.GetName())\n\t\t\t\trefreshErrors = append(refreshErrors, refreshErrorData{kind: deploy.Kind, name: deploy.GetName(), namespace: deploy.GetNamespace(), errorMsg: err.Error()})\n\t\t\t\tupdateFailed = true\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check daemonsets in the relevant namespace\n\tfor _, dset := range dsetList.Items {\n\t\tr.Log.Info(\"Checking Daemonset for usage of certificate found in secret\", \"Secret\", secret.GetName(), \"Daemonset\", dset.GetName(), \"Namespace\", secret.GetNamespace()) //debug make higher verbosity level\n\t\tupdatedAt := time.Now().Format(\"2006-1-2.1504\")\n\t\tif hasAllowRestartAnnotation(dset.ObjectMeta) && usesSecret(secret, dset.Spec.Template.Spec) && outdatedSecretInUse(secret.GetName(), secret.GetResourceVersion(), dset.GetObjectMeta().GetAnnotations()) {\n\t\t\tr.Log.Info(\"Daemonset makes use of secret and has opted-in\", \"Secret\", secret.GetName(), \"Daemonset\", dset.GetName(), \"Namespace\", secret.GetNamespace())\n\t\t\tupdatedDset := dset.DeepCopy()\n\t\t\tupdatedDset.ObjectMeta.Labels[timeRestartedLabel] = updatedAt\n\t\t\tupdatedDset.Spec.Template.ObjectMeta.Labels[timeRestartedLabel] = updatedAt\n\t\t\tupdateSecretRevisionAnnotation(secret.GetName(), secret.GetResourceVersion(), updatedDset.GetAnnotations())\n\t\t\tr.Log.Info(\"Initiating refresh\", \"Secret\", secret.GetName(), \"Daemonset\", dset.GetName(), \"Namespace\", secret.GetNamespace())\n\t\t\terr := r.Update(context.TODO(), updatedDset)\n\t\t\tif err != nil {\n\t\t\t\tr.Log.Error(err, \"Unable to restart Daemonset.\", \"Daemonset.Name\", dset.GetName())\n\t\t\t\tr.Event(&dset, corev1.EventTypeWarning, refreshFailure.reason, refreshFailure.message)\n\t\t\t\trefreshErrors = append(refreshErrors, refreshErrorData{kind: dset.Kind, name: dset.GetName(), namespace: dset.GetNamespace(), errorMsg: err.Error()})\n\t\t\t\tupdateFailed = true\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check statefulsets in the relevant namespace\n\tfor _, sts := range stsList.Items {\n\t\tr.Log.Info(\"Checking Statefulset for usage of certificate found in secret\", \"Secret\", secret.GetName(), \"Statefulset\", sts.GetName(), \"Namespace\", secret.GetNamespace()) //debug make higher verbosity level\n\t\tupdatedAt := time.Now().Format(\"2006-1-2.1504\")\n\t\tif hasAllowRestartAnnotation(sts.ObjectMeta) && usesSecret(secret, sts.Spec.Template.Spec) && outdatedSecretInUse(secret.GetName(), secret.GetResourceVersion(), sts.GetObjectMeta().GetAnnotations()) {\n\t\t\tr.Log.Info(\"Statefulset makes use of secret and has opted-in\", \"Secret\", secret.GetName(), \"Statefulset\", sts.GetName(), \"Namespace\", secret.GetNamespace())\n\t\t\tupdatedsts := sts.DeepCopy()\n\t\t\tupdatedsts.ObjectMeta.Labels[timeRestartedLabel] = updatedAt\n\t\t\tupdatedsts.Spec.Template.ObjectMeta.Labels[timeRestartedLabel] = updatedAt\n\t\t\tupdateSecretRevisionAnnotation(secret.GetName(), secret.GetResourceVersion(), updatedsts.GetAnnotations())\n\t\t\tr.Log.Info(\"Initiating refresh\", \"Secret\", secret.GetName(), \"Statefulset\", sts.GetName(), \"Namespace\", secret.GetNamespace())\n\t\t\terr := r.Update(context.TODO(), updatedsts)\n\t\t\tif err != nil {\n\t\t\t\tr.Log.Error(err, \"Unable to restart Statefulset.\", \"Statefulset.Name\", sts.GetName())\n\t\t\t\tr.Event(&sts, corev1.EventTypeWarning, refreshFailure.reason, refreshFailure.message)\n\t\t\t\trefreshErrors = append(refreshErrors, refreshErrorData{kind: sts.Kind, name: sts.GetName(), namespace: sts.GetNamespace(), errorMsg: err.Error()})\n\t\t\t\tupdateFailed = true\n\t\t\t}\n\t\t}\n\t}\n\n\t// If updating anything failed\n\t// TODO(komish): This requeues if _any_ of the refreshes fail, but this would cause a successful deployment to\n\t// be restarted continuously. Need to requeue but with only the failed deployment.\n\tif updateFailed {\n\t\tr.Log.Info(\"Resource(s) that opted-in to refreshes have failed to refresh but the request will not be requeued\",\n\t\t\t\"Secret.Name\", secret.GetName(),\n\t\t\t\"Secret.Namespace\", secret.GetNamespace(),\n\t\t\t\"Error Message\", refreshErrors)\n\t\t// return reconcile.Result{}, err // don't uncomment, see above.\n\t}\n\n\tr.Log.Info(\"Done Reconciling CertManager TLS Certificates\")\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "59cad0b0c8bbea08b6506fc40e7a69a8", "score": "0.61189425", "text": "func (r *RoleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t// The TeleportRole OpenAPI spec does not validate typing of Label fields like `node_labels`.\n\t// This means we can receive invalid data, by default it won't be unmarshalled properly and will crash the operator.\n\t// To handle this more gracefully we unmarshall first in an unstructured object.\n\t// The unstructured object will be converted later to a typed one, in r.UpsertExternal.\n\t// See `/operator/crdgen/schemagen.go` and https://github.com/gravitational/teleport/issues/15204 for context.\n\t// TODO: (Check how to handle multiple versions)\n\tobj := GetUnstructuredObjectFromGVK(TeleportRoleGVKV5)\n\treturn ResourceBaseReconciler{\n\t\tClient: r.Client,\n\t\tDeleteExternal: r.Delete,\n\t\tUpsertExternal: r.Upsert,\n\t}.Do(ctx, req, obj)\n}", "title": "" }, { "docid": "6849c0924c9dfab37560b3f5bb1dcfa8", "score": "0.6109033", "text": "func (r *ProvisioningReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t// provisioning.metal3.io is a singleton\n\t// Note: this check is here to make sure that the early startup configuration\n\t// is correct. For day 2 operatations the webhook will validate this.\n\tif req.Name != metal3iov1alpha1.ProvisioningSingletonName {\n\t\tklog.Info(\"ignoring invalid CR\", \"name\", req.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Make sure ClusterOperator exists\n\terr := r.ensureClusterOperator(nil)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tresult := ctrl.Result{}\n\tif !r.WebHookEnabled {\n\t\tif provisioning.WebhookDependenciesReady(r.OSClient) {\n\t\t\tklog.Info(\"restarting to enable the webhook\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\t// Keep checking for our webhook dependencies to be ready, so we can\n\t\t// enable the webhook.\n\t\tresult.RequeueAfter = 5 * time.Minute\n\t}\n\n\tenabled, err := r.isEnabled()\n\tif err != nil {\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"could not determine whether to run\")\n\t}\n\tif !enabled {\n\t\t// set ClusterOperator status to disabled=true, available=true\n\t\t// We're disabled; don't requeue\n\t\treturn ctrl.Result{}, errors.Wrapf(\n\t\t\tr.updateCOStatus(ReasonUnsupported, \"Nothing to do on this Platform\", \"\"),\n\t\t\t\"unable to put %q ClusterOperator in Disabled state\", clusterOperatorName)\n\t}\n\n\tbaremetalConfig, err := r.readProvisioningCR(ctx)\n\tif err != nil {\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\tif baremetalConfig == nil {\n\t\t// Provisioning configuration not available at this time.\n\t\t// Cannot proceed wtih metal3 deployment.\n\t\tklog.Info(\"Provisioning CR not found\")\n\t\treturn result, nil\n\t}\n\n\t// Make sure ClusterOperator's ownership is updated\n\terr = r.ensureClusterOperator(baremetalConfig)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Read container images from Config Map\n\tvar containerImages provisioning.Images\n\tif err := provisioning.GetContainerImages(&containerImages, r.ImagesFilename); err != nil {\n\t\t// Images config map is not valid\n\t\t// Provisioning configuration is not valid.\n\t\t// Requeue request.\n\t\tklog.ErrorS(err, \"invalid contents in images Config Map\")\n\t\tco_err := r.updateCOStatus(ReasonInvalidConfiguration, err.Error(), \"invalid contents in images Config Map\")\n\t\tif co_err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, co_err)\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Get cluster-wide proxy information\n\tclusterWideProxy, err := r.OSClient.ConfigV1().Proxies().Get(context.Background(), \"cluster\", metav1.GetOptions{})\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tinfo := r.provisioningInfo(baremetalConfig, &containerImages, clusterWideProxy)\n\n\t// Check if Provisioning Configuartion is being deleted\n\tdeleted, err := r.checkForCRDeletion(ctx, info)\n\tif err != nil {\n\t\tvar coErr error\n\t\tif deleted {\n\t\t\tcoErr = r.updateCOStatus(ReasonDeployTimedOut, err.Error(), \"Unable to delete a metal3 resource on Provisioning CR deletion\")\n\t\t} else {\n\t\t\tcoErr = r.updateCOStatus(ReasonInvalidConfiguration, err.Error(), \"Unable to add Finalizer on Provisioning CR\")\n\t\t}\n\t\tif coErr != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, coErr)\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\tif deleted {\n\t\treturn result, errors.Wrapf(\n\t\t\tr.updateCOStatus(ReasonComplete, \"all Metal3 resources deleted\", \"\"),\n\t\t\t\"unable to put %q ClusterOperator in Available state\", clusterOperatorName)\n\t}\n\n\tspecChanged := baremetalConfig.Generation != baremetalConfig.Status.ObservedGeneration\n\tif specChanged {\n\t\terr = r.updateCOStatus(ReasonSyncing, \"\", \"Applying metal3 resources\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Syncing state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\n\tif !r.WebHookEnabled {\n\t\t// Check if provisioning configuration is valid\n\t\tif err := baremetalConfig.ValidateBaremetalProvisioningConfig(); err != nil {\n\t\t\t// Provisioning configuration is not valid.\n\t\t\t// Requeue request.\n\t\t\tklog.Error(err, \"invalid config in Provisioning CR\")\n\t\t\terr = r.updateCOStatus(ReasonInvalidConfiguration, err.Error(), \"Unable to apply Provisioning CR: invalid configuration\")\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %v\", clusterOperatorName, err)\n\t\t\t}\n\t\t\t// Temporarily not requeuing request\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t}\n\n\t//Create Secrets needed for Metal3 deployment\n\tif err := provisioning.CreateAllSecrets(r.KubeClient.CoreV1(), ComponentNamespace, baremetalConfig, r.Scheme); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check Metal3 Deployment already exists and managed by MAO.\n\tmetal3DeploymentSelector, maoOwned, err := provisioning.CheckExistingMetal3Deployment(r.KubeClient.AppsV1(), ComponentNamespace)\n\tinfo.PodLabelSelector = metal3DeploymentSelector\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"failed to check for existing Metal3 Deployment\")\n\t}\n\n\tif maoOwned {\n\t\tklog.Info(\"Adding annotation for CBO to take ownership of metal3 deployment created by MAO\")\n\t}\n\n\tfor _, ensureResource := range []ensureFunc{\n\t\tprovisioning.EnsureMetal3Deployment,\n\t\tprovisioning.EnsureMetal3StateService,\n\t\tprovisioning.EnsureImageCache,\n\t} {\n\t\tupdated, err := ensureResource(info)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tif updated {\n\t\t\treturn result, r.Client.Status().Update(ctx, baremetalConfig)\n\t\t}\n\t}\n\n\tif specChanged {\n\t\tbaremetalConfig.Status.ObservedGeneration = baremetalConfig.Generation\n\t\terr = r.Client.Status().Update(ctx, baremetalConfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to update observed generation: %w\", err)\n\t\t}\n\t}\n\n\t// Determine the status of the deployment\n\tdeploymentState, err := provisioning.GetDeploymentState(r.KubeClient.AppsV1(), ComponentNamespace, baremetalConfig)\n\tif err != nil {\n\t\terr = r.updateCOStatus(ReasonNotFound, \"metal3 deployment inaccessible\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"failed to determine state of metal3 deployment\")\n\t}\n\tif deploymentState == appsv1.DeploymentReplicaFailure {\n\t\terr = r.updateCOStatus(ReasonDeployTimedOut, \"metal3 deployment rollout taking too long\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\n\t// Determine the status of the DaemonSet\n\tdaemonSetState, err := provisioning.GetDaemonSetState(r.KubeClient.AppsV1(), ComponentNamespace, baremetalConfig)\n\tif err != nil {\n\t\terr = r.updateCOStatus(ReasonNotFound, \"metal3 image cache daemonset inaccessible\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"failed to determine state of metal3 image cache daemonset\")\n\t}\n\tif daemonSetState == provisioning.DaemonSetReplicaFailure {\n\t\terr = r.updateCOStatus(ReasonDeployTimedOut, \"metal3 image cache rollout taking too long\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Degraded state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\tif deploymentState == appsv1.DeploymentAvailable && daemonSetState == provisioning.DaemonSetAvailable {\n\t\terr = r.updateCOStatus(ReasonComplete, \"metal3 pod and image cache are running\", \"\")\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unable to put %q ClusterOperator in Progressing state: %w\", clusterOperatorName, err)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "d48480baf30ee7dbd1c63ee50d123883", "score": "0.61071974", "text": "func (r *KubeFedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlogger := log.FromContext(ctx)\n\n\tobj := &corev1beta1.KubeFedCluster{}\n\tif err := r.Get(ctx, req.NamespacedName, obj); err != nil {\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tmgr, err := util.NewManager(obj, r.Namespace, r.Client, r.Scheme)\n\tif err != nil {\n\t\tlogger.Error(err, \"Unable to create manager\", \"cluster\", obj.Name)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tutil.AddclusterClient(obj.Name, mgr.GetClient())\n\n\tif err = (&typescontrollers.FederatedObjectReconciler{\n\t\tClient: mgr.GetClient(),\n\t\tScheme: mgr.GetScheme(),\n\t\tMaxConcurrentReconciles: r.MaxConcurrentReconciles,\n\t\tClusterName: util.FederationClusterName,\n\t\tTargetClusterName: obj.Name,\n\t}).SetupWithManager(mgr); err != nil {\n\t\tlogger.Error(err, \"Unable to create controller\", \"cluster\", obj.Name)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tgo mgr.Start(context.TODO())\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "a049de499f81fab3c73f6af4f9ab6c21", "score": "0.6105697", "text": "func (r *BalancingRuleReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"mitigationrule\", req.NamespacedName)\n\n\tlog.Info(\"start Reconcile\")\n\tbalancingRule := &api.BalancingRule{}\n\tif err := r.Get(ctx, req.NamespacedName, balancingRule); err != nil {\n\t\tlog.Error(err, \"unable to get mitigation rule\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// debug\n\tlog.Info(\"succeed to get mitigation rule\", \"mitigation rule\", balancingRule)\n\n\tvsList, err := r.IstioClientset.NetworkingV1alpha3().VirtualServices(virtualServiceNamespace).List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\tlog.Error(err, \"unable to get VirtualService list\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tlog.Info(\"succeed to get VirtualService List\", \"VirtualService\", vsList)\n\trm := make(map[Host]*RoutingRate)\n\tfor i := range vsList.Items {\n\t\titem := vsList.Items[i]\n\t\tfor ori := range item.OwnerReferences {\n\t\t\tif item.OwnerReferences[ori].Kind == \"BalancingRule\" {\n\t\t\t\tinternalHost := item.ObjectMeta.GetLabels()[\"InternalHost\"]\n\t\t\t\texternalHost := item.ObjectMeta.GetLabels()[\"ExternalHost\"]\n\t\t\t\tspec := item.Spec\n\t\t\t\thost := Host(spec.GetHosts()[0])\n\t\t\t\tvar iw int32\n\t\t\t\tvar ew int32\n\t\t\t\tfor _, ri := range spec.GetHttp()[0].GetRoute() {\n\t\t\t\t\tdw := ri.GetWeight()\n\t\t\t\t\tdh := ri.Destination.Host\n\t\t\t\t\tif dh == internalHost {\n\t\t\t\t\t\tiw = dw\n\t\t\t\t\t} else if dh == externalHost {\n\t\t\t\t\t\tew = dw\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trm[host] = &RoutingRate{\n\t\t\t\t\tHost: host,\n\t\t\t\t\tInternalWeight: iw,\n\t\t\t\t\tExternalWeight: ew,\n\t\t\t\t\tVersion: item.ObjectMeta.ResourceVersion,\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tcurrentRR := &RoutingRule{RuleMap: rm}\n\n\troutingRule, err := r.Calculator.Calculate(ctx, r.Log, currentRR, balancingRule.Spec)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to calculate routing rule\")\n\t\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, nil\n\t}\n\tfor _, v := range currentRR.RuleMap {\n\t\tlog.Info(\"current\", \"routing rule\", v)\n\t}\n\tfor _, v := range routingRule.RuleMap {\n\t\tlog.Info(\"latest\", \"routing rule\", v)\n\t}\n\tlog.Info(\"succeed to get routing rule\", \"routing rule\", routingRule)\n\n\t// check and renew authorization token to CloudRun before expired\n\tear := balancingRule.Spec.ExternalAuthorizationRef\n\tsn := balancingRule.Spec.SecretNamespace\n\tauthorization, needUpsert, err := r.getAuthorizationToken(sn, ear.Name, ear.Key)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to get authorization token from secret\", \"namespace\", sn, \"name\", ear.Name, \"key\", ear.Key)\n\t\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, nil\n\t}\n\tauthToken := authorization.getValue()\n\tauthTokenVersion := authorization.getVersion()\n\tif needUpsert {\n\t\tserviceURL := fmt.Sprintf(\"https://%s\", balancingRule.Spec.ExternalHost)\n\t\ttokenURL := fmt.Sprintf(\"/instance/service-accounts/default/identity?audience=%s\", serviceURL)\n\t\tauthToken, err = metadata.Get(tokenURL)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"unable to get metadata\", \"tokenURL\", tokenURL)\n\t\t\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, nil\n\t\t}\n\t\terr = r.upsertSecret(ctx, balancingRule, sn, ear.Name, authorization.getVersion(), ear.Key, authToken)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"unable to upsert secret\", \"namespace\", sn, \"name\", ear.Name, \"version\", authTokenVersion, \"key\", ear.Key)\n\t\t\t// want to continue processing when spike occur so not return\n\t\t}\n\t\tlog.Info(\"succeed to upsert secret\", \"namespace\", sn, \"name\", ear.Name, \"key\", ear.Key)\n\t}\n\n\tif currentRR.Equal(routingRule) {\n\t\treturn ctrl.Result{RequeueAfter: 90 * time.Second}, nil\n\t}\n\n\toakr := balancingRule.Spec.OptionalAuthorization.KeyRef\n\toaKey, err := r.getSecretValue(sn, oakr.Name, oakr.Key)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to get secret\")\n\t\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, nil\n\t}\n\toavr := balancingRule.Spec.OptionalAuthorization.ValueRef\n\toaValue, err := r.getSecretValue(sn, oavr.Name, oavr.Key)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to get secret\")\n\t\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, nil\n\t}\n\thihkr := balancingRule.Spec.HostInfoHeaderKeyRef\n\thostInfoHeaderKey, err := r.getSecretValue(sn, hihkr.Name, hihkr.Key)\n\tif err != nil {\n\t\tlog.Error(err, \"unable to get secret\")\n\t\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, nil\n\t}\n\terr = r.apply(balancingRule, currentRR, routingRule, hostInfoHeaderKey.value, balancingRule.Spec.GatewayName, authorization.getValue(), oaKey.value, oaValue.value)\n\n\t// TODO make RequeueAfter to be able change per loop\n\treturn ctrl.Result{RequeueAfter: reconcilePeriod}, err\n}", "title": "" }, { "docid": "e7517eeb347287ee8892def49e36092f", "score": "0.6069229", "text": "func (r *reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {\n\tlog.Info(\"reconciling\", \"request\", request)\n\n\t// Fetch the Ingress Controller object.\n\tingressController := &operatorv1.IngressController{}\n\tif err := r.cache.Get(ctx, request.NamespacedName, ingressController); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\t// This means the Ingress Controller object was already deleted/finalized.\n\t\t\tlog.Info(\"Ingress Controller not found; reconciliation will be skipped\", \"request\", request)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to get Ingress Controller %q: %w\", request, err)\n\t}\n\n\t// If the Ingress Controller is marked to be deleted, then return early. The corresponding RouteMetricsControllerRoutesPerShard metric label\n\t// will be deleted in \"ensureIngressDeleted\" function of ingresscontroller.\n\tif ingressController.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// NOTE: Even though the route admitted status should reflect validity of the namespace and route labelselectors, we still will validate\n\t// the namespace and route labels as there are still edge scenarios where the route status may be inaccurate.\n\n\t// List all the Namespaces filtered by our ingress's Namespace selector.\n\tnamespaceMatchingLabelsSelector := client.MatchingLabelsSelector{Selector: labels.Everything()}\n\tif ingressController.Spec.NamespaceSelector != nil {\n\t\tnamespaceSelector, err := metav1.LabelSelectorAsSelector(ingressController.Spec.NamespaceSelector)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"ingresscontroller has an invalid namespace selector\", \"ingresscontroller\",\n\t\t\t\tingressController.Name, \"namespaceSelector\", ingressController.Spec.NamespaceSelector)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\tnamespaceMatchingLabelsSelector = client.MatchingLabelsSelector{Selector: namespaceSelector}\n\t}\n\n\tnamespaceList := corev1.NamespaceList{}\n\tif err := r.cache.List(ctx, &namespaceList, namespaceMatchingLabelsSelector); err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to list Namespaces %q: %w\", request, err)\n\t}\n\t// Create a set of Namespaces to easily look up Namespaces that matches the Routes assigned to the Ingress Controller.\n\tnamespacesSet := sets.NewString()\n\tfor i := range namespaceList.Items {\n\t\tnamespacesSet.Insert(namespaceList.Items[i].Name)\n\t}\n\n\t// List routes filtered by our ingress's route selector.\n\trouteMatchingLabelsSelector := client.MatchingLabelsSelector{Selector: labels.Everything()}\n\tif ingressController.Spec.RouteSelector != nil {\n\t\trouteSelector, err := metav1.LabelSelectorAsSelector(ingressController.Spec.RouteSelector)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"ingresscontroller has an invalid route selector\", \"ingresscontroller\",\n\t\t\t\tingressController.Name, \"routeSelector\", ingressController.Spec.RouteSelector)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\trouteMatchingLabelsSelector = client.MatchingLabelsSelector{Selector: routeSelector}\n\t}\n\trouteList := routev1.RouteList{}\n\tif err := r.cache.List(ctx, &routeList, routeMatchingLabelsSelector); err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"failed to list Routes for the Shard %q: %w\", request, err)\n\t}\n\n\t// Variable to store the number of routes admitted by the Shard (Ingress Controller).\n\troutesAdmitted := 0\n\n\t// Iterate through the list Routes.\n\tfor _, route := range routeList.Items {\n\t\t// Check if the Route's Namespace matches one of the Namespaces in the set namespacesSet and\n\t\t// the Route is admitted by the Ingress Controller.\n\t\tif namespacesSet.Has(route.Namespace) && routeStatusAdmitted(route, ingressController.Name) {\n\t\t\t// If the Route is admitted then, the routesAdmitted should be incremented by 1 for the Shard.\n\t\t\troutesAdmitted++\n\t\t}\n\t}\n\n\t// Set the value of the metric to the number of routesAdmitted for the corresponding Shard (Ingress Controller).\n\tSetRouteMetricsControllerRoutesPerShardMetric(request.Name, float64(routesAdmitted))\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "dae24661350c3453dfa1fe293715f13f", "score": "0.60667217", "text": "func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) {\n\tlog := r.log.WithValues(strings.ToLower(r.gvk.Kind), req.NamespacedName)\n\n\tobj := &unstructured.Unstructured{}\n\tobj.SetGroupVersionKind(*r.gvk)\n\terr = r.client.Get(ctx, req.NamespacedName, obj)\n\tif apierrors.IsNotFound(err) {\n\t\treturn ctrl.Result{}, nil\n\t}\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tu := updater.New(r.client)\n\tdefer func() {\n\t\tapplyErr := u.Apply(ctx, obj)\n\t\tif err == nil && !apierrors.IsNotFound(applyErr) {\n\t\t\terr = applyErr\n\t\t}\n\t}()\n\n\tactionClient, err := r.actionClientGetter.ActionClientFor(obj)\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingClient, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeDeployed),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeInitialized),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\tupdater.EnsureDeployedRelease(nil),\n\t\t)\n\t\t// NOTE: If obj has the uninstall finalizer, that means a release WAS deployed at some point\n\t\t// in the past, but we don't know if it still is because we don't have an actionClient to check.\n\t\t// So the question is, what do we do with the finalizer? We could:\n\t\t// - Leave it in place. This would make the CR impossible to delete without either resolving this error, or\n\t\t// manually uninstalling the release, deleting the finalizer, and deleting the CR.\n\t\t// - Remove the finalizer. This would make it possible to delete the CR, but it would leave around any\n\t\t// release resources that are not owned by the CR (those in the cluster scope or in other namespaces).\n\t\t//\n\t\t// The decision made for now is to leave the finalizer in place, so that the user can intervene and try to\n\t\t// resolve the issue, instead of the operator silently leaving some dangling resources hanging around after the\n\t\t// CR is deleted.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// As soon as we get the actionClient, lookup the release and\n\t// update the status with this info. We need to do this as\n\t// early as possible in case other irreconcilable errors occur.\n\t//\n\t// We also make sure not to return any errors we encounter so\n\t// we can still attempt an uninstall if the CR is being deleted.\n\trel, err := actionClient.Get(obj.GetName())\n\tif errors.Is(err, driver.ErrReleaseNotFound) {\n\t\tu.UpdateStatus(updater.EnsureCondition(conditions.Deployed(corev1.ConditionFalse, \"\", \"\")))\n\t} else if err == nil {\n\t\tr.ensureDeployedRelease(&u, rel)\n\t}\n\tu.UpdateStatus(updater.EnsureCondition(conditions.Initialized(corev1.ConditionTrue, \"\", \"\")))\n\n\tfor _, ext := range r.preExtensions {\n\t\tif err := ext(ctx, obj, u.UpdateStatusCustom, r.log); err != nil {\n\t\t\tu.UpdateStatus(\n\t\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonReconcileError, err)),\n\t\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\t)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tif obj.GetDeletionTimestamp() != nil {\n\t\terr := r.handleDeletion(ctx, actionClient, obj, log)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tvals, err := r.getValues(ctx, obj)\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingValues, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trel, state, err := r.getReleaseState(actionClient, obj, vals.AsMap())\n\tif err != nil {\n\t\tu.UpdateStatus(\n\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonErrorGettingReleaseState, err)),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\tupdater.EnsureConditionUnknown(conditions.TypeDeployed),\n\t\t\tupdater.EnsureDeployedRelease(nil),\n\t\t)\n\t\treturn ctrl.Result{}, err\n\t}\n\tif state == statePending {\n\t\treturn r.handlePending(actionClient, rel, &u, log)\n\t}\n\n\tu.UpdateStatus(updater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionFalse, \"\", \"\")))\n\n\tfor _, h := range r.preHooks {\n\t\tif err := h.Exec(obj, vals, log); err != nil {\n\t\t\tlog.Error(err, \"pre-release hook failed\")\n\t\t}\n\t}\n\n\tswitch state {\n\tcase stateNeedsInstall:\n\t\trel, err = r.doInstall(actionClient, &u, obj, vals.AsMap(), log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\tcase stateNeedsUpgrade:\n\t\trel, err = r.doUpgrade(actionClient, &u, obj, vals.AsMap(), log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\tcase stateUnchanged:\n\t\tif err := r.doReconcile(actionClient, &u, rel, log); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\tdefault:\n\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected release state: %s\", state)\n\t}\n\n\tfor _, h := range r.postHooks {\n\t\tif err := h.Exec(obj, *rel, log); err != nil {\n\t\t\tlog.Error(err, \"post-release hook failed\", \"name\", rel.Name, \"version\", rel.Version)\n\t\t}\n\t}\n\n\tfor _, ext := range r.postExtensions {\n\t\tif err := ext(ctx, obj, u.UpdateStatusCustom, r.log); err != nil {\n\t\t\tu.UpdateStatus(\n\t\t\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionTrue, conditions.ReasonReconcileError, err)),\n\t\t\t\tupdater.EnsureConditionUnknown(conditions.TypeReleaseFailed),\n\t\t\t)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tr.ensureDeployedRelease(&u, rel)\n\tu.UpdateStatus(\n\t\tupdater.EnsureCondition(conditions.ReleaseFailed(corev1.ConditionFalse, \"\", \"\")),\n\t\tupdater.EnsureCondition(conditions.Irreconcilable(corev1.ConditionFalse, \"\", \"\")),\n\t)\n\n\treturn ctrl.Result{RequeueAfter: r.reconcilePeriod}, nil\n}", "title": "" }, { "docid": "ee4c6d3bffb1b8067e7f5679e66ae078", "score": "0.6034066", "text": "func (r *Microk8sConfigReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, rerr error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"microk8sconfig\", req.NamespacedName)\n\n\t// your logic here\n\tmicrok8sconfig := &bootstrapv1alpha1.Microk8sConfig{}\n\n\tif err := r.Client.Get(ctx, req.NamespacedName, microk8sconfig); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\tlog.Error(err, \"failed to get config\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Look up the owner of this KubeConfig if there is one\n\tconfigOwner, err := bsutil.GetConfigOwner(ctx, r.Client, microk8sconfig)\n\tif apierrors.IsNotFound(err) {\n\t\t// Could not find the owner yet, this is not an error and will rereconcile when the owner gets set.\n\t\treturn ctrl.Result{}, nil\n\t}\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get owner\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tif configOwner == nil {\n\t\tlog.Error(err, \"failed to get config-owner\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\tlog = log.WithValues(\"kind\", configOwner.GetKind(), \"version\", configOwner.GetResourceVersion(), \"name\", configOwner.GetName())\n\n\t// Initialize the patch helper\n\tpatchHelper, err := patch.NewHelper(microk8sconfig, r)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif configOwner.IsControlPlaneMachine() {\n\t\t_, err := r.setupControlPlaneBootstrapData(ctx, microk8sconfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, patchHelper.Patch(ctx, microk8sconfig)\n\t} else {\n\t\t// Worker node\n\t\t_, err := r.setupWorkerBootstrapData(ctx, microk8sconfig)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, patchHelper.Patch(ctx, microk8sconfig)\n\t}\n}", "title": "" }, { "docid": "82f84979e78f08bb76b978494a565bba", "score": "0.6030195", "text": "func (crc *clusterReconcileContext) reconcile() error {\n\tif crc.tinkerbellCluster.Spec.ControlPlaneEndpoint.Host == \"\" {\n\t\tif err := crc.populateControlplaneHost(); err != nil {\n\t\t\treturn fmt.Errorf(\"populating controlplane host: %w\", err)\n\t\t}\n\t}\n\n\t// TODO: How can we support changing that?\n\tif crc.tinkerbellCluster.Spec.ControlPlaneEndpoint.Port != KubernetesAPIPort {\n\t\tcrc.tinkerbellCluster.Spec.ControlPlaneEndpoint.Port = KubernetesAPIPort\n\t}\n\n\tcrc.tinkerbellCluster.Status.Ready = true\n\n\tcontrollerutil.AddFinalizer(crc.tinkerbellCluster, infrastructurev1alpha3.ClusterFinalizer)\n\n\tcrc.log.Info(\"Setting cluster status to ready\")\n\n\tif err := crc.patchHelper.Patch(crc.ctx, crc.tinkerbellCluster); err != nil {\n\t\treturn fmt.Errorf(\"patching cluster object: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "47a9d125e4b9abd54d36e5cbc62c9fb4", "score": "0.60264355", "text": "func (r *EventTrackerPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = log.FromContext(ctx)\n\n\tvar mutex = &sync.Mutex{}\n\tmutex.Lock()\n\n\tvar etp eventtrackerv1.EventTrackerPolicy\n\terr := r.Client.Get(context.Background(), req.NamespacedName, &etp)\n\tif errors.IsNotFound(err) {\n\t\tlogrus.Print(req.NamespacedName, \" not found\")\n\t\treturn ctrl.Result{}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tfor index, status := range etp.Statuses {\n\t\tif status.Result == utils.ConditionPassed && strings.ToLower(status.IsTriggered) == \"false\" {\n\t\t\tlogrus.Print(\"ResourceName: \" + status.ResourceName + \", WorkflowID: \" + status.WorkflowID)\n\t\t\tresponse, err := utils.SendRequest(status.WorkflowID)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tlogrus.Print(response)\n\n\t\t\tvar res apiResponse\n\t\t\terr = json.Unmarshal([]byte(response), &res)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tif res.Data.GitopsNotifer == \"Gitops Disabled\" {\n\t\t\t\tetp.Statuses[index].IsTriggered = \"false\"\n\t\t\t} else {\n\t\t\t\tetp.Statuses[index].IsTriggered = \"true\"\n\t\t\t}\n\t\t}\n\t}\n\n\terr = r.Client.Update(context.Background(), &etp)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdefer mutex.Unlock()\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "be479771105843f03899a3e484c815df", "score": "0.6002948", "text": "func (r *LabInstanceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tVMstart := time.Now()\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"labinstance\", req.NamespacedName)\n\n\t// get labInstance\n\tvar labInstance crownlabsv1alpha2.Instance\n\tif err := r.Get(ctx, req.NamespacedName, &labInstance); err != nil {\n\t\t// reconcile was triggered by a delete request\n\t\tlog.Info(\"Instance \" + req.Name + \" deleted\")\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\tns := v1.Namespace{}\n\tnamespaceName := types.NamespacedName{\n\t\tName: labInstance.Namespace,\n\t\tNamespace: \"\",\n\t}\n\n\t// It performs reconciliation only if the Instance belongs to whitelisted namespaces\n\t// by checking the existence of keys in labInstance namespace\n\tif err := r.Get(ctx, namespaceName, &ns); err == nil {\n\t\tif !instance_creation.CheckLabels(ns, r.NamespaceWhitelist.MatchLabels) {\n\t\t\tlog.Info(\"Namespace \" + req.Namespace + \" does not meet the selector labels\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t} else {\n\t\tlog.Error(err, \"unable to get Instance namespace\")\n\t}\n\tlog.Info(\"Namespace\" + req.Namespace + \" met the selector labels\")\n\t// The metadata.generation value is incremented for all changes, except for changes to .metadata or .status\n\t// if metadata.generation is not incremented there's no need to reconcile\n\tif labInstance.Status.ObservedGeneration == labInstance.ObjectMeta.Generation {\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// check if labTemplate exists\n\ttemplateName := types.NamespacedName{\n\t\tNamespace: labInstance.Spec.Template.Namespace,\n\t\tName: labInstance.Spec.Template.Name,\n\t}\n\tvar labTemplate crownlabsv1alpha2.Template\n\tif err := r.Get(ctx, templateName, &labTemplate); err != nil {\n\t\t// no Template related exists\n\t\tlog.Info(\"Template \" + templateName.Name + \" doesn't exist. Deleting Instance \" + labInstance.Name)\n\t\tr.EventsRecorder.Event(&labInstance, \"Warning\", \"LabTemplateNotFound\", \"Template \"+templateName.Name+\" not found in namespace \"+labTemplate.Namespace)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tr.EventsRecorder.Event(&labInstance, \"Normal\", \"LabTemplateFound\", \"Template \"+templateName.Name+\" found in namespace \"+labTemplate.Namespace)\n\tlabInstance.Labels = map[string]string{\n\t\t\"course-name\": strings.ReplaceAll(strings.ToLower(labTemplate.Spec.WorkspaceRef.Name), \" \", \"-\"),\n\t\t\"template-name\": labTemplate.Name,\n\t\t\"template-namespace\": labTemplate.Namespace,\n\t}\n\tlabInstance.Status.ObservedGeneration = labInstance.ObjectMeta.Generation\n\tif err := r.Update(ctx, &labInstance); err != nil {\n\t\tlog.Error(err, \"unable to update Instance labels\")\n\t}\n\n\t// prepare variables common to all resources\n\tname := fmt.Sprintf(\"%v-%.4s\", strings.ReplaceAll(labInstance.Name, \".\", \"-\"), uuid.New().String())\n\tnamespace := labInstance.Namespace\n\tif err := r.CreateEnvironment(&labInstance, &labTemplate, namespace, name, VMstart); err != nil {\n\t\tlog.Error(err, \"unable to Create Laboratory Environment\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// create secret referenced by VirtualMachineInstance (Cloudinit)\n\t// To be extracted in a configuration flag\n\tVmElaborationTimestamp := time.Now()\n\tVMElaborationDuration := VmElaborationTimestamp.Sub(VMstart)\n\telaborationTimes.Observe(VMElaborationDuration.Seconds())\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "86fd4b9f7b5dc2d5ea4d9230e980d58a", "score": "0.5994605", "text": "func (tcr *TinkerbellClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\n\tcrc, err := tcr.newReconcileContext(ctx, req.NamespacedName)\n\tif err != nil {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"creating reconciliation context: %w\", err)\n\t}\n\n\tif crc == nil {\n\t\treturn defaultRequeueResult(), nil\n\t}\n\n\tif !crc.tinkerbellCluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tcrc.log.Info(\"Removing cluster\")\n\n\t\treturn ctrl.Result{}, crc.reconcileDelete()\n\t}\n\n\tif crc.cluster == nil {\n\t\treturn defaultRequeueResult(), nil\n\t}\n\n\tif util.IsPaused(crc.cluster, crc.tinkerbellCluster) {\n\t\tcrc.log.Info(\"TinkerbellCluster is marked as paused. Won't reconcile\")\n\n\t\treturn defaultRequeueResult(), nil\n\t}\n\n\treturn ctrl.Result{}, crc.reconcile()\n}", "title": "" }, { "docid": "868f171725ec5181464316854ae65b5a", "score": "0.5984578", "text": "func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error) {\n\tlog.V(logging.Debug).Info(\"reconciling\", \"kind\", v1alpha1.ResourceGroupKindAPIVersion, \"request\", req)\n\n\tctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)\n\tdefer cancel()\n\n\trg := &v1alpha1.ResourceGroup{}\n\tif err := r.kube.Get(ctx, req.NamespacedName, rg); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{Requeue: false}, nil\n\t\t}\n\t\treturn reconcile.Result{Requeue: false}, errors.Wrapf(err, \"cannot get resource %s\", req.NamespacedName)\n\t}\n\n\tclient, err := r.Connect(ctx, rg)\n\tif err != nil {\n\t\trg.Status.SetFailed(reasonFetchingClient, err.Error())\n\t\treturn reconcile.Result{Requeue: true}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource has been deleted from the API server. Delete from Azure.\n\tif rg.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{Requeue: client.Delete(ctx, rg)}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource is unnamed. Assume it has not been created in Azure.\n\tif rg.Status.Name == \"\" {\n\t\treturn reconcile.Result{Requeue: client.Create(ctx, rg)}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource exists in the API server and Azure. Sync it.\n\treturn reconcile.Result{Requeue: client.Sync(ctx, rg)}, errors.Wrapf(r.kube.Update(ctx, rg), \"cannot update resource %s\", req.NamespacedName)\n}", "title": "" }, { "docid": "330df036d13fb50f0f54c8001ee4156f", "score": "0.59843814", "text": "func (r *RuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\n\t_ = r.Log.WithValues(\"rule\", req.NamespacedName)\n\n\tvar rule oathkeeperv1alpha1.Rule\n\n\tskipValidation := false\n\n\tif err := r.Get(ctx, req.NamespacedName, &rule); err != nil {\n\t\tif apierrs.IsNotFound(err) {\n\t\t\t// just return here, the finalizers have already run\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif !skipValidation {\n\t\tif err := rule.ValidateWith(r.ValidationConfig); err != nil {\n\t\t\trule.Status.Validation = &oathkeeperv1alpha1.Validation{}\n\t\t\trule.Status.Validation.Valid = boolPtr(false)\n\t\t\trule.Status.Validation.Error = stringPtr(err.Error())\n\t\t\tr.Log.Info(fmt.Sprintf(\"validation error in Rule %s/%s: \\\"%s\\\"\", rule.Namespace, rule.Name, err.Error()))\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\tr.Log.Error(err, \"unable to update Rule status\")\n\t\t\t\t//Invoke requeue directly without logging error with whole stacktrace\n\t\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t\t}\n\t\t\t// continue, as validation can't be fixed by requeuing request and we still have to update the configmap\n\t\t} else {\n\t\t\t// rule valid - set the status\n\t\t\trule.Status.Validation = &oathkeeperv1alpha1.Validation{}\n\t\t\trule.Status.Validation.Valid = boolPtr(true)\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\tr.Log.Error(err, \"unable to update Rule status\")\n\t\t\t\t//Invoke requeue directly without logging error with whole stacktrace\n\t\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t\t}\n\t\t}\n\t}\n\n\tvar rulesList oathkeeperv1alpha1.RuleList\n\n\tif rule.Spec.ConfigMapName != nil {\n\t\tif err := r.List(ctx, &rulesList, client.InNamespace(req.NamespacedName.Namespace)); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t} else {\n\t\tif err := r.List(ctx, &rulesList); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// examine DeletionTimestamp to determine if object is under deletion\n\tif rule.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 !containsString(rule.ObjectMeta.Finalizers, FinalizerName) {\n\t\t\trule.ObjectMeta.Finalizers = append(rule.ObjectMeta.Finalizers, FinalizerName)\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// The object is being deleted\n\t\tif containsString(rule.ObjectMeta.Finalizers, FinalizerName) {\n\t\t\t// our finalizer is present, so lets handle any external dependency\n\t\t\trulesList = rulesList.FilterOutRule(rule)\n\n\t\t\t// remove our finalizer from the list and update it.\n\t\t\trule.ObjectMeta.Finalizers = removeString(rule.ObjectMeta.Finalizers, FinalizerName)\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar err error\n\tvar oathkeeperRulesJSON []byte\n\n\tif rule.Spec.ConfigMapName != nil {\n\t\tr.Log.Info(fmt.Sprintf(\"Found ConfigMap definition in Rule %s/%s: Writing data to \\\"%s\\\"\", rule.Namespace, rule.Name, *rule.Spec.ConfigMapName))\n\t\toathkeeperRulesJSON, err = rulesList.FilterNotValid().FilterConfigMapName(rule.Spec.ConfigMapName).ToOathkeeperRules()\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t} else {\n\t\toathkeeperRulesJSON, err = rulesList.FilterNotValid().ToOathkeeperRules()\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tif err := r.OperatorMode.CreateOrUpdate(ctx, oathkeeperRulesJSON, &rule); err != nil {\n\t\tr.Log.Error(err, \"unable to process rules Configmap\")\n\t\tos.Exit(1)\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "1db8ed4c805298745672f04c0b0740a4", "score": "0.59815574", "text": "func (r *ImagePullSecretManagerServiceAccountReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := log.FromContext(ctx)\n\n\t// get the manager object in the specific namespace from API server\n\tserviceAccount := &corev1.ServiceAccount{}\n\tif err := r.Get(ctx, req.NamespacedName, serviceAccount); err != nil {\n\t\tlog.Error(err, \"Unable to fetch ImagePullSecretManager\")\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tannotations := serviceAccount.GetAnnotations()\n\n\tisReconcilable, isReconcilablePresent := annotations[reconcilableAnnotation]\n\treconcileWith, isReconcilableWithPresent := annotations[reconcileWithAnnotation]\n\n\tif !isReconcilablePresent || isReconcilable != \"true\" {\n\t\tlog.Info(\"Resource is marked as non-reconcilable\", \"serviceAccount\", serviceAccount.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif !isReconcilableWithPresent || reconcileWith == \"\" {\n\t\tlog.Info(\"No secrets attached to the resource, not adding secrets\", \"serviceAccount\", serviceAccount.Name)\n\t}\n\n\tsecrets := strings.Split(reconcileWith, \",\")\n\n\timagePullSecrets := []corev1.LocalObjectReference{}\n\n\tfor _, s := range secrets {\n\t\timagePullSecrets = append(imagePullSecrets, corev1.LocalObjectReference{\n\t\t\tName: strings.TrimSpace(s),\n\t\t})\n\t}\n\n\tserviceAccount.ImagePullSecrets = imagePullSecrets\n\n\t// mark serviceAccount as reconciled s.t. later reconciles don't pick up this serviceAccount again (see filters())\n\tserviceAccount.Annotations[reconciledAnnotation] = \"true\"\n\n\tif err := r.Update(ctx, serviceAccount); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlog.Info(\"Updated ServiceAccount with imagePullSecrets\", \"serviceAccount\", serviceAccount.Name)\n\n\t// TODO(fix): clarify if this operator's actions would clash with flux operator\n\n\treturn ctrl.Result{}, nil\n\n}", "title": "" }, { "docid": "e22ce948b5816d28f3b0d3ba9cf6e99d", "score": "0.59712857", "text": "func (r *Reconciler) reconcile(reqLogger logr.Logger, current *appsv1.DaemonSet) (reconcile.Result, error) {\n\t// Compare labels\n\tobjLabels := current.GetLabels()\n\n\tif !utils.CheckSubset(fbsyncer.Labels, objLabels) {\n\t\treqLogger.Info(\"Is not interesting\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tsyncers := []syncer.Interface{fbsyncer.NewFluentbitSyncer(r.client, r.scheme),\n\t\tfbsyncer.NewFluentbitCfgMapSyncer(r.client, r.scheme),\n\t}\n\n\tfor _, sync := range syncers {\n\t\tif err := syncer.Sync(context.TODO(), sync, r.recorder); err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "311881679ade39e2f74150e9987fea6f", "score": "0.5968668", "text": "func (kor *KubernetesOAMRouter) Reconcile(canary *flaggerv1.Canary) error {\n\tc := kor.innerK8sRouter\n\tapexName, _, _ := canary.GetServiceNames()\n\n\t// main svc also elect all the component pod\n\terr := c.reconcileService(canary, apexName, kor.componentName, canary.Spec.Service.Apex)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reconcileService failed: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "873b232cd2ee71377374af633d12343a", "score": "0.5967199", "text": "func (r *ServiceReconciler) Reconcile(request ctrl.Request) (ctrl.Result, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tinstance := &servingv1.Service{}\n\terr := r.client.Get(ctx, request.NamespacedName, instance)\n\tif err != nil {\n\t\tr.Log.WithValues(\"service\", request.NamespacedName).Error(err, \"unable to fetch Service\")\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tif !hasCorrectLabels(*instance) {\n\t\tr.Log.WithValues(\"service\", request.NamespacedName).Info(\"skipping reconcilation for a service without needed labels\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif !instance.Status.IsReady() {\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlog := r.Log.WithValues(\"kind\", instance.GetObjectKind().GroupVersionKind().Kind, \"name\", instance.GetName(), \"namespace\", instance.GetNamespace(), \"version\", instance.GetGeneration())\n\n\tlog.Info(\"Listing Revisions\")\n\tvar revisions servingv1.RevisionList\n\tif err := r.client.ListByLabel(ctx, instance.GetNamespace(), r.serviceLabel(instance), &revisions); err != nil {\n\t\tlog.Error(err, \"Cannot list Revisions\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := r.deleteRevisions(ctx, log, instance, revisions.Items); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{RequeueAfter: r.config.RequeueDuration}, nil\n}", "title": "" }, { "docid": "def7f17a0aeee0034f5570a8f6401a66", "score": "0.59633833", "text": "func (r *reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx, cancel := context.WithCancel(r.ctx)\n\tdefer cancel()\n\n\tconfigMap := &corev1.ConfigMap{}\n\tif err := r.client.Get(ctx, types2.NamespacedName{Namespace: req.Namespace, Name: req.Name}, configMap); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil // do nothing if the ConfigMap does not exist\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\tif configMap.Name == constants.BOMMetadataConfigMapName {\n\t\tif err := r.updateConditions(ctx); err != nil {\n\t\t\tif apierrors.IsConflict(errors.Cause(err)) {\n\t\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t\t}\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\ttkr, err := tkrFromConfigMap(configMap)\n\tif err != nil {\n\t\tr.log.Error(err, \"Could not create TKR from ConfigMap\", \"ConfigMap\", configMap.Name)\n\t\treturn ctrl.Result{}, nil // no need to retry: if the ConfigMap changes, we'll get called\n\t}\n\tif tkr == nil {\n\t\treturn ctrl.Result{}, nil // no need to retry: no TKR in this ConfigMap\n\t}\n\n\tif err := r.client.Create(ctx, tkr); err != nil {\n\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\treturn ctrl.Result{}, nil // the TKR already exists, we're done.\n\t\t}\n\t\treturn ctrl.Result{}, errors.Wrapf(err, \"could not create TKR: ConfigMap.name='%s'\", configMap.Name)\n\t}\n\tif err := r.client.Status().Update(ctx, tkr); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := r.updateConditions(ctx); err != nil {\n\t\tif apierrors.IsConflict(errors.Cause(err)) {\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "710df4da580280a0b5ef65fd09a2d1a7", "score": "0.5951989", "text": "func (r *CustomResourceDiscoverySetReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tvar (\n\t\tctx = context.Background()\n\t\tresult ctrl.Result\n\t)\n\n\tcrDiscoverySet := &corev1alpha1.CustomResourceDiscoverySet{}\n\tif err := r.Get(ctx, req.NamespacedName, crDiscoverySet); err != nil {\n\t\treturn result, client.IgnoreNotFound(err)\n\t}\n\n\tif util.AddFinalizer(crDiscoverySet, metav1.FinalizerDeleteDependents) {\n\t\tif err := r.Client.Update(ctx, crDiscoverySet); err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"updating CustomResourceDiscoverySet finalizers: %w\", err)\n\t\t}\n\t}\n\tif !crDiscoverySet.DeletionTimestamp.IsZero() {\n\t\t// nothing to do, let kube controller-manager foregroundDeletion wait until every created object is deleted\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// List ServiceClusters\n\tserviceClusterSelector, err := metav1.LabelSelectorAsSelector(&crDiscoverySet.Spec.ServiceClusterSelector)\n\tif err != nil {\n\t\treturn result, fmt.Errorf(\"parsing ServiceCluster selector: %w\", err)\n\t}\n\tserviceClusterList := &corev1alpha1.ServiceClusterList{}\n\tif err := r.List(ctx, serviceClusterList,\n\t\tclient.InNamespace(crDiscoverySet.Namespace),\n\t\tclient.MatchingLabelsSelector{Selector: serviceClusterSelector},\n\t); err != nil {\n\t\treturn result, fmt.Errorf(\"listing ServiceClusters: %w\", err)\n\t}\n\n\t// Reconcile CRDiscoveries\n\tvar unreadyCRDiscoveryNames []string\n\tvar readyCRDReferences []corev1alpha1.CustomResourceDiscoverySetCRDReference\n\texistingCRDiscoveryNames := map[string]struct{}{}\n\tfor _, serviceCluster := range serviceClusterList.Items {\n\t\tcurrentCRDiscovery, err := r.reconcileCRDiscovery(ctx, &serviceCluster, crDiscoverySet)\n\t\tif err != nil {\n\t\t\treturn result, fmt.Errorf(\n\t\t\t\t\"reconciling CustomResourceDiscovery for ServiceCluster %s: %w\", serviceCluster.Name, err)\n\t\t}\n\t\texistingCRDiscoveryNames[currentCRDiscovery.Name] = struct{}{}\n\n\t\tif currentCRDiscovery.IsReady() {\n\t\t\treadyCRDReferences = append(readyCRDReferences,\n\t\t\t\tcorev1alpha1.CustomResourceDiscoverySetCRDReference{\n\t\t\t\t\tCRD: corev1alpha1.ObjectReference{\n\t\t\t\t\t\tName: currentCRDiscovery.Status.ManagementClusterCRD.Name,\n\t\t\t\t\t},\n\t\t\t\t\tServiceCluster: corev1alpha1.ObjectReference{\n\t\t\t\t\t\tName: serviceCluster.Name,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} else {\n\t\t\tunreadyCRDiscoveryNames = append(unreadyCRDiscoveryNames, currentCRDiscovery.Name)\n\t\t}\n\t}\n\n\t// Cleanup uncontrolled CRDiscoveries\n\tcrDiscoveryList := &corev1alpha1.CustomResourceDiscoveryList{}\n\tif err := r.List(ctx, crDiscoveryList, client.MatchingLabels{\n\t\tcrDiscoveriesLabel: crDiscoverySet.Namespace + \".\" + crDiscoverySet.Name,\n\t},\n\t\tclient.InNamespace(crDiscoverySet.Namespace),\n\t); err != nil {\n\t\treturn result, fmt.Errorf(\n\t\t\t\"listing all CustomResourceDiscovery for this Set: %w\", err)\n\t}\n\tfor _, crDiscovery := range crDiscoveryList.Items {\n\t\t_, ok := existingCRDiscoveryNames[crDiscovery.Name]\n\t\tif ok {\n\t\t\tcontinue\n\t\t}\n\n\t\t// delete crDiscovery that should no longer exist\n\t\tif err := r.Delete(ctx, &crDiscovery); err != nil {\n\t\t\treturn result, fmt.Errorf(\"deleting CustomResourceDiscovery: %w\", err)\n\t\t}\n\t}\n\n\t// Report status\n\tcrDiscoverySet.Status.ManagementClusterCRDs = readyCRDReferences\n\tcrDiscoverySet.Status.ObservedGeneration = crDiscoverySet.Generation\n\tif len(unreadyCRDiscoveryNames) > 0 {\n\t\t// Unready\n\t\tcrDiscoverySet.Status.SetCondition(corev1alpha1.CustomResourceDiscoverySetCondition{\n\t\t\tType: corev1alpha1.CustomResourceDiscoverySetReady,\n\t\t\tStatus: corev1alpha1.ConditionFalse,\n\t\t\tReason: \"ComponentsUnready\",\n\t\t\tMessage: fmt.Sprintf(\n\t\t\t\t\"Some CustomResourceDiscovery objects are unready [%s]\", strings.Join(unreadyCRDiscoveryNames, \",\")),\n\t\t})\n\t} else {\n\t\t// Ready\n\t\tcrDiscoverySet.Status.SetCondition(corev1alpha1.CustomResourceDiscoverySetCondition{\n\t\t\tType: corev1alpha1.CustomResourceDiscoverySetReady,\n\t\t\tStatus: corev1alpha1.ConditionTrue,\n\t\t\tReason: \"ComponentsReady\",\n\t\t\tMessage: \"All CustomResourceDiscovery objects are ready.\",\n\t\t})\n\t}\n\n\tif err := r.Status().Update(ctx, crDiscoverySet); err != nil {\n\t\treturn result, fmt.Errorf(\"updating Status: %w\", err)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "246548fd381f99e539400667741b5cd3", "score": "0.59351933", "text": "func (r *TenantReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := clog.WithName(\"reconcile\").WithValues(\"tenant\", req.NamespacedName)\n\n\t// get tenant info\n\ttenant := tenantv1.Tenant{}\n\terr := r.Client.Get(ctx, req.NamespacedName, &tenant)\n\tif err != nil {\n\t\tlog.Warn(\"get tenant fail, %v\", err)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// if .spec.namespace not equal the standard name\n\tnsName := \"kubecube-tenant-\" + req.Name\n\tif tenant.Spec.Namespace != nsName {\n\t\ttenant.Spec.Namespace = nsName\n\t\terr = r.Client.Update(ctx, &tenant)\n\t\tif err != nil {\n\t\t\tlog.Error(\"update tenant .spec.namespace fail, %v\", err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// if annotation not content kubecube.io/sync, add it\n\tano := tenant.Annotations\n\tif ano == nil {\n\t\tano = make(map[string]string)\n\t}\n\tif _, ok := ano[\"kubecube.io/sync\"]; !ok {\n\t\tano[\"kubecube.io/sync\"] = \"1\"\n\t\ttenant.Annotations = ano\n\t\terr = r.Client.Update(ctx, &tenant)\n\t\tif err != nil {\n\t\t\tlog.Error(\"update tenant .metadata.annotations fail, %v\", err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// weather namespace exist, create one\n\tnamespace := corev1.Namespace{}\n\terr = r.Client.Get(ctx, types.NamespacedName{Name: nsName}, &namespace)\n\tif err != nil {\n\t\tif !errors.IsNotFound(err) {\n\t\t\tlog.Warn(\"get tenant namespaces fail, %v\", err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tnamespace := corev1.Namespace{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tKind: \"Namespace\",\n\t\t\t\tAPIVersion: \"v1\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: nsName,\n\t\t\t\tAnnotations: map[string]string{\n\t\t\t\t\t\"kubecube.io/sync\": \"1\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\terr = r.Client.Create(ctx, &namespace)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"create tenant namespaces fail, %v\", err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "0b36fb1172ab99e594eb0cd4175c3a65", "score": "0.5929874", "text": "func (r *ReconcileRethinkDBCluster) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"namespace\", request.Namespace, \"name\", request.Name)\n\treqLogger.Info(\"reconciling RethinkDBCluster\")\n\n\t// Fetch the RethinkDBCluster instance\n\tcluster := &rethinkdbv1alpha1.RethinkDBCluster{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, cluster)\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// 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// Verify resource defaults have been initialized\n\tif setDefaults(cluster) {\n\t\t// defaults updated, update and requeue\n\t\treqLogger.Info(\"default spec values initialized\")\n\t\treturn reconcile.Result{Requeue: true}, r.client.Update(context.TODO(), cluster)\n\t}\n\n\t// Reconcile the cluster CA secret\n\tcaSecret, err := r.reconcileCASecret(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile ca secret\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster CA configmap\n\terr = r.reconcileCAConfigMap(cluster, caSecret)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile ca configmap\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the admin service\n\terr = r.reconcileAdminService(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile admin service\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the driver service\n\terr = r.reconcileDriverService(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile driver service\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster TLS secrets\n\terr = r.reconcileTLSSecrets(cluster, caSecret)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile tls secrets\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster admin secret\n\terr = r.reconcileAdminSecret(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile admin secret\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Reconcile the cluster persistent volume claims\n\t// err = r.reconcilePersistentVolumeClaims(cluster)\n\t// if err != nil {\n\t// \treqLogger.Error(err, \"unable to reconcile persistent volume claims\")\n\t// \treturn reconcile.Result{}, err\n\t// }\n\n\t// Reconcile the cluster server pods\n\terr = r.reconcileServerPods(cluster)\n\tif err != nil {\n\t\treqLogger.Error(err, \"unable to reconcile server pods\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// No errors, return and don't requeue\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "bdd7ba3fa1e6098dffcaf98234b9694a", "score": "0.5919431", "text": "func (r *ChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\tlog := r.Log.WithValues(\"chart\", req.NamespacedName)\n\tinstance := &stablev1.Chart{}\n\tfinalizer := \"helm.operator.finalizer.io\"\n\tforGroundFinalizer := \"foregroundDeletion\"\n\t// your logic here\n\n\tif err := r.Get(ctx, req.NamespacedName, instance); err != nil {\n\t\treturn ctrl.Result{}, ignoreNotFound(err)\n\t}\n\tif instance.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tif !containsString(instance.ObjectMeta.Finalizers, finalizer) {\n\t\t\tinstance.ObjectMeta.Finalizers = append(instance.ObjectMeta.Finalizers, finalizer)\n\t\t\tif err := r.Update(context.Background(), instance); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\tif err := getChart(instance); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tyamlString, err := templateChart(instance)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tresources := bytes.Split(yamlString, []byte(`---`))\n\t\t// your logic here\n\t\tfor _, resource := range resources {\n\t\t\t// Helm sometimes templates just comments so skip these\n\t\t\tif !strings.Contains(string(resource), \"kind\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Decode the YAML to an object.\n\t\t\tu := &unstructured.Unstructured{Object: map[string]interface{}{}}\n\t\t\tif err := yaml.Unmarshal(resource, &u.Object); err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\t// set controller reference\n\t\t\tif err := ctrl.SetControllerReference(instance, u, r.Scheme); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// set namespace of the resource (by default helm does not template this out)\n\t\t\tu.SetNamespace(instance.Spec.NameSpaceSelector)\n\t\t\t// Get the reference of the resource to attach to the chart instance\n\t\t\tobjRef, err := ref.GetReference(r.Scheme, u)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"unable to make reference\", \"Object\", u.GetName())\n\t\t\t}\n\t\t\t// Get Key to fetch resource if exists\n\t\t\tkey, err := client.ObjectKeyFromObject(u)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// Get resource\n\t\t\tif err := r.Client.Get(ctx, key, u); err != nil {\n\t\t\t\t// if error is anything but is not found, return error\n\t\t\t\tif !apierrs.IsNotFound(err) {\n\t\t\t\t\tlog.Error(err, \"unable to get object, unknown error occured\")\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\n\t\t\t\t// set finalizer of resource\n\t\t\t\tu.SetFinalizers([]string{forGroundFinalizer})\n\n\t\t\t\t// Create Object\n\t\t\t\tif err := r.Create(ctx, u); err != nil {\n\t\t\t\t\tlog.Error(err, fmt.Sprintf(\"unable to apply %v\", u.GroupVersionKind()))\n\t\t\t\t\tinstance.Status.Status = \"Failed\"\n\t\t\t\t\tif err := r.UpdateStatus(instance); err != nil {\n\t\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\t\t\t\tlog.V(1).Info(fmt.Sprintf(\"Applying: %v\", u.GroupVersionKind()))\n\n\t\t\t\t// Check if resource reference is attached to instance, if not add it\n\t\t\t\tif !refInSlice(*objRef, instance.Status.Resource) {\n\t\t\t\t\tinstance.Status.Resource = append(instance.Status.Resource, *objRef)\n\t\t\t\t\tif err := r.UpdateStatus(instance); err != nil {\n\t\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcontinue\n\t\t\t// Implement Patch if resource already exist\n\t\t\t//log.V(1).Info(fmt.Sprintf(\"Updating: %v\", u.GroupVersionKind()))\n\t\t}\n\n\t\tinstance.Status.Status = \"Deployed\"\n\t\tif err := r.UpdateStatus(instance); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.V(1).Info(\"reconciling the Chart\")\n\t\treturn ctrl.Result{}, nil\n\t} else {\n\t\tif containsString(instance.ObjectMeta.Finalizers, finalizer) {\n\t\t\t// our finalizer is present, so lets handle any external dependency\n\t\t\tif err := r.deleteExternalResources(instance); err != nil {\n\t\t\t\t// if fail to delete the external dependency here, return with error\n\t\t\t\t// so that it can be retried\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// remove our finalizer from the list and update it.\n\t\t\tinstance.ObjectMeta.Finalizers = removeString(instance.ObjectMeta.Finalizers, finalizer)\n\t\t\tif err := r.Update(context.Background(), instance); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "ba1ada36c010a19413dd8cb95dc35c58", "score": "0.5917425", "text": "func (r *ConferenceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := log.FromContext(ctx)\n\n\t// TODO(user): your logic here\n\tlog.V(1).Info(\"Conference Controller:\", \"Namespace del recurso\", req.Namespace, \"Nombre del recurso\", req.Name)\n\n\tvar conference conferencev1.Conference\n\tif err := r.Get(ctx, req.NamespacedName, &conference); err != nil {\n\t\tlog.Error(err, \"unable to fetch Conference\")\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tvar services v1.ServiceList\n\tif err := r.List(ctx, &services, client.InNamespace(conference.Spec.Namespace), client.MatchingLabels{\"draft\": \"draft-app\"}); err != nil {\n\t\tlog.Error(err, \"unable to list conference services\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tfor _, service := range services.Items {\n\t\tlog.V(1).Info(\"Services\", \"Service\", service.Name)\n\t\t//Call each service and do a test to see if it is operational\n\t\tresp, err := http.Get(\"http://\" + service.Name + \".\" + conference.Spec.Namespace + \".svc.cluster.local/info\")\n\t\tif err != nil {\n\t\t\tif service.Name == \"fmtok8s-frontend\" {\n\t\t\t\tconference.Status.FrontendReady = false\n\t\t\t}\n\t\t\tif service.Name == \"fmtok8s-agenda\" {\n\t\t\t\tconference.Status.AgendaServiceReady = false\n\t\t\t}\n\t\t\tif service.Name == \"fmtok8s-c4p\" {\n\t\t\t\tconference.Status.C4pServiceReady = false\n\t\t\t}\n\t\t\tif service.Name == \"fmtok8s-email\" {\n\t\t\t\tconference.Status.EmailServiceReady = false\n\t\t\t}\n\t\t\tlog.V(1).Error(err, \"ServicesCheckNotOK\", \"Service\", service.Name)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tlog.V(1).Info(\"ServicesCheckOK\", \"Service\", service.Name, \"Response Code\", resp.StatusCode)\n\t\t\tif resp.StatusCode == 200 {\n\t\t\t\tif service.Name == \"fmtok8s-frontend\" {\n\t\t\t\t\tconference.Status.FrontendReady = true\n\t\t\t\t}\n\t\t\t\tif service.Name == \"fmtok8s-agenda\" {\n\t\t\t\t\tconference.Status.AgendaServiceReady = true\n\t\t\t\t}\n\t\t\t\tif service.Name == \"fmtok8s-c4p\" {\n\t\t\t\t\tconference.Status.C4pServiceReady = true\n\t\t\t\t}\n\t\t\t\tif service.Name == \"fmtok8s-email\" {\n\t\t\t\t\tconference.Status.EmailServiceReady = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif service.Name == \"fmtok8s-frontend\" {\n\t\t\tconference.Status.URL = service.Status.LoadBalancer.Ingress[0].IP\n\t\t\tlog.V(1).Info(\"Frontend\", \"IP\", conference.Status.URL)\n\t\t}\n\n\t}\n\tif conference.Status.AgendaServiceReady == true && conference.Status.EmailServiceReady == true &&\n\t\tconference.Status.C4pServiceReady == true && conference.Status.FrontendReady == true {\n\t\tconference.Status.Ready = true\n\n\t\tif conference.Spec.ProductionTestEnabled {\n\t\t\t// - Check if exists, if not create and trigger and report to status\n\t\t\tvar deployment appsV1.Deployment\n\t\t\tvar deploymentFound bool\n\t\t\tif err := r.Get(ctx, client.ObjectKey{\n\t\t\t\tNamespace: req.Namespace,\n\t\t\t\tName: \"kubebuilder-production-test\",\n\t\t\t}, &deployment); err != nil {\n\t\t\t\tdeploymentFound = false\n\t\t\t} else {\n\t\t\t\tdeploymentFound = true\n\t\t\t}\n\n\t\t\tif !deploymentFound {\n\t\t\t\tdeployment, _ := createProductionTestDeployment(&conference, req.Namespace, r.Scheme)\n\t\t\t\tif err := r.Create(ctx, &deployment); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable create production check deployment\")\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\n\t\t\t\t// @TODO: call production test endpoint and report back to status\n\t\t\t\tconference.Status.ProdTests = true\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tconference.Status.Ready = false\n\t}\n\n\tif err := r.Status().Update(ctx, &conference); err != nil {\n\t\tlog.Error(err, \"unable to update Conference status\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trequeue := ctrl.Result{RequeueAfter: time.Second * 5}\n\n\treturn requeue, nil\n}", "title": "" }, { "docid": "e197aabb44798e59c39b375a9b729686", "score": "0.5916679", "text": "func (r *DiscoveryConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := logr.FromContext(ctx)\n\n\t// Get discovery config. Die if there is none\n\tconfig := &discoveryv1.DiscoveryConfig{}\n\tif err := r.Get(ctx, types.NamespacedName{\n\t\tName: req.Name,\n\t\tNamespace: req.Namespace,\n\t}, config); err != nil {\n\t\tlog.Error(err, \"unable to fetch DiscoveryConfig\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Update the DiscoveryConfig status\n\t// config.Status.LastUpdateTime = &metav1.Time{Time: time.Now()}\n\t// if err := r.Status().Update(ctx, config); err != nil {\n\t// \tlog.Error(err, \"unable to update discoveryconfig status\")\n\t// \treturn ctrl.Result{}, err\n\t// }\n\n\t// Get user token from secret provided in config\n\tif len(config.Spec.ProviderConnections) == 0 {\n\t\tlog.Info(\"No provider connections in config. Returning.\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\tsecretName := config.Spec.ProviderConnections[0]\n\tocmSecret := &corev1.Secret{}\n\terr := r.Get(context.TODO(), types.NamespacedName{Name: secretName, Namespace: req.Namespace}, ocmSecret)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif _, ok := ocmSecret.Data[\"metadata\"]; !ok {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"Secret '%s' does not contain 'metadata' field\", secretName)\n\t}\n\n\tproviderConnection := &CloudRedHatProviderConnection{}\n\terr = yaml.Unmarshal(ocmSecret.Data[\"metadata\"], providerConnection)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tuserToken := providerConnection.OCMApiToken\n\n\t// Request ephemeral access token with user token. This will be used for OCM requests\n\tauthRequest := auth_domain.AuthRequest{\n\t\tToken: userToken,\n\t}\n\tif annotations := config.GetAnnotations(); annotations != nil {\n\t\tauthRequest.BaseURL = annotations[\"ocmBaseURL\"]\n\t}\n\taccessToken, err := auth_service.AuthClient.GetToken(authRequest)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// List all already-discovered clusters\n\tvar discoveredList discoveryv1.DiscoveredClusterList\n\tif err := r.List(ctx, &discoveredList, client.InNamespace(req.Namespace)); err != nil {\n\t\tlog.Error(err, \"unable to list discovered clusters\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\texisting := make(map[string]int, len(discoveredList.Items))\n\tfor i, cluster := range discoveredList.Items {\n\t\texisting[cluster.Name] = i\n\t}\n\n\t// List all managed clusters\n\tmanagedClusters := &unstructured.UnstructuredList{}\n\tmanagedClusters.SetGroupVersionKind(managedClusterGVK)\n\tif err := r.List(ctx, managedClusters); err != nil {\n\t\t// Capture case were ManagedClusters resource does not exist\n\t\tif !apimeta.IsNoMatchError(err) {\n\t\t\treturn ctrl.Result{}, errors.Wrapf(err, \"error listing managed clusters\")\n\t\t}\n\t}\n\n\tmanagedClusterIDs := make(map[string]int, len(managedClusters.Items))\n\tfor i, mc := range managedClusters.Items {\n\t\tname := getClusterID(mc)\n\t\tif name != \"\" {\n\t\t\tmanagedClusterIDs[getClusterID(mc)] = i\n\t\t}\n\t}\n\n\tvar createClusters []discoveryv1.DiscoveredCluster\n\tvar updateClusters []discoveryv1.DiscoveredCluster\n\tvar deleteClusters []discoveryv1.DiscoveredCluster\n\tvar unchangedClusters []discoveryv1.DiscoveredCluster\n\n\trequestConfig := cluster_domain.ClusterRequest{\n\t\tToken: accessToken,\n\t\tFilter: config.Spec.Filters,\n\t}\n\tif annotations := config.GetAnnotations(); annotations != nil {\n\t\trequestConfig.BaseURL = annotations[\"ocmBaseURL\"]\n\t}\n\tclusterClient := cluster_service.ClusterClientGenerator.NewClient(requestConfig)\n\n\tnewClusters, err := clusterClient.GetClusters()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tfor _, cluster := range newClusters {\n\t\t// Build a DiscoveredCluster object from the cluster information\n\t\tdiscoveredCluster := discoveredCluster(cluster)\n\t\tdiscoveredCluster.SetNamespace(req.Namespace)\n\n\t\t// Assign dummy status\n\t\tdiscoveredCluster.Spec.Subscription = discoveryv1.SubscriptionSpec{\n\t\t\tStatus: \"Active\",\n\t\t\tSupportLevel: \"None\",\n\t\t\tManaged: false,\n\t\t\tCreatorID: \"abc123\",\n\t\t}\n\n\t\t// Assign managed status\n\t\tif _, managed := managedClusterIDs[discoveredCluster.Spec.Name]; managed {\n\t\t\tsetManagedStatus(&discoveredCluster)\n\t\t}\n\n\t\t// Add reference to secret used for authentication\n\t\tdiscoveredCluster.Spec.ProviderConnections = nil\n\t\tsecretRef, err := ref.GetReference(r.Scheme, ocmSecret)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"unable to make reference to secret\", \"secret\", secretRef)\n\t\t}\n\t\tdiscoveredCluster.Spec.ProviderConnections = append(discoveredCluster.Spec.ProviderConnections, *secretRef)\n\n\t\tind, exists := existing[discoveredCluster.Name]\n\t\tif !exists {\n\t\t\t// Newly discovered cluster\n\t\t\tcreateClusters = append(createClusters, discoveredCluster)\n\t\t\tdelete(existing, discoveredCluster.Name)\n\t\t\tcontinue\n\t\t}\n\t\t// Cluster has already been discovered. Check for changes.\n\t\tif same(discoveredCluster, discoveredList.Items[ind]) {\n\t\t\tunchangedClusters = append(unchangedClusters, discoveredCluster)\n\t\t\tdelete(existing, discoveredCluster.Name)\n\t\t} else {\n\t\t\tupdated := discoveredList.Items[ind]\n\t\t\tupdated.Spec = discoveredCluster.Spec\n\t\t\tupdateClusters = append(updateClusters, updated)\n\t\t\tdelete(existing, discoveredCluster.Name)\n\t\t}\n\t}\n\n\t// Remaining clusters are no longer found by OCM and should be labeled for delete\n\tfor _, ind := range existing {\n\t\tdeleteClusters = append(deleteClusters, discoveredList.Items[ind])\n\t}\n\n\t// Create new clusters and clean up old ones\n\tfor _, cluster := range createClusters {\n\t\tcluster := cluster\n\t\tif err := ctrl.SetControllerReference(config, &cluster, r.Scheme); err != nil {\n\t\t\tlog.Error(err, \"failed to set controller reference\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tif err := r.Create(ctx, &cluster); err != nil {\n\t\t\tlog.Error(err, \"unable to create discovered cluster\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Created cluster\", \"Name\", cluster.Name)\n\t}\n\tfor _, cluster := range updateClusters {\n\t\tcluster := cluster\n\t\tif err := r.Update(ctx, &cluster); err != nil {\n\t\t\tlog.Error(err, \"unable to update discovered cluster\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Updated cluster\", \"Name\", cluster.Name)\n\t}\n\tfor _, cluster := range deleteClusters {\n\t\tcluster := cluster\n\t\tif err := r.Delete(ctx, &cluster); err != nil {\n\t\t\tlog.Error(err, \"unable to delete discovered cluster\", \"name\", cluster.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Deleted cluster\", \"Name\", cluster.Name)\n\t}\n\n\tlog.Info(\"Cluster categories\", \"Created\", len(createClusters), \"Updated\", len(updateClusters), \"Deleted\", len(deleteClusters), \"Unchanged\", len(unchangedClusters))\n\n\treturn ctrl.Result{RequeueAfter: reconciler.RefreshInterval}, nil\n}", "title": "" }, { "docid": "057b9506c7b7c817a2201adadad67735", "score": "0.5916576", "text": "func (r *ServiceManager) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := r.Log.WithValues(\"ServiceManager\", req.NamespacedName)\n\n\tvar service corev1.Service\n\tif err := r.Get(ctx, req.NamespacedName, &service); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\tlog.Error(err, \"unable to fetch Service\")\n\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t// requeue (we'll need to wait for a new notification), and we can get them\n\t\t// on deleted requests.\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tif !service.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tlog.Info(\"deleting the service\")\n\t\tserviceEndpoints := ServiceEndpoints{\n\t\t\tCluster: r.Name,\n\t\t\tService: req.NamespacedName,\n\t\t\t// TODO: fetch and update Endpoints\n\t\t\tLoadBalancerIP: \"\",\n\t\t}\n\t\tr.WorkQueue.Add(serviceEndpoints)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif len(service.Status.LoadBalancer.Ingress) > 0 {\n\t\tlog.Info(\"reconciling the service\")\n\t\tloadBalancerIP := service.Status.LoadBalancer.Ingress[0].IP\n\t\tserviceEndpoints := ServiceEndpoints{\n\t\t\tCluster: r.Name,\n\t\t\tService: req.NamespacedName,\n\t\t\t// TODO: fetch and update Endpoints\n\t\t\tLoadBalancerIP: loadBalancerIP,\n\t\t}\n\t\tr.WorkQueue.Add(serviceEndpoints)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "50c6b7709e8189a667a5e966655f32b4", "score": "0.59144986", "text": "func (r *DemoResourceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tkey := req.NamespacedName\n\tl := log.FromContext(ctx).WithValues(\"NamespacedName\", key)\n\n\tl.Info(\"This is the reconciliation loop of the simple-demo-operator.\")\n\n\tvar rsrc toolsv1.DemoResource\n\tif err := r.Get(ctx, key, &rsrc); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tl.Info(\"Whoops! We couldn't find the resource associated with this event.\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trsrc.Status.SpecMessage = rsrc.Spec.Message\n\tl.Info(\"Let's update the status with the message from the spec!\")\n\tif err := r.Status().Update(ctx, &rsrc, &client.UpdateOptions{}); err != nil {\n\t\tl.Info(\"Uh oh! I ran into something unexpected.\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tl.Info(\"All finished!\")\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "ff70d5ec401c35600c77ec1502616bf5", "score": "0.59126526", "text": "func (r *BackupLocationReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"backuplocation\", req.NamespacedName)\n\n\tvar backupLoc kubedrv1alpha1.BackupLocation\n\tif err := r.Get(ctx, req.NamespacedName, &backupLoc); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// we'll ignore not-found errors, since they can't be fixed by an immediate\n\t\t\t// requeue (we'll need to wait for a new notification).\n\t\t\tlog.Info(\"BackupLocation (\" + req.NamespacedName.Name + \") is not found\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\tlog.Error(err, \"unable to fetch BackupLocation\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Skip if spec hasn't changed. This check prevents reconcile on status\n\t// updates.\n\tif backupLoc.Status.ObservedGeneration == backupLoc.ObjectMeta.Generation {\n\t\tr.Log.Info(\"Skipping reconcile as generation number hasn't changed\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tfinalizer := \"backuplocation.finalizers.kubedr.catalogicsoftware.com\"\n\n\tif backupLoc.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// to registering our finalizer.\n\t\tif !containsString(backupLoc.ObjectMeta.Finalizers, finalizer) {\n\t\t\tbackupLoc.ObjectMeta.Finalizers = append(backupLoc.ObjectMeta.Finalizers, finalizer)\n\t\t\tif err := r.Update(context.Background(), &backupLoc); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// The object is being deleted\n\t\tif containsString(backupLoc.ObjectMeta.Finalizers, finalizer) {\n\t\t\t// our finalizer is present, handle any pre-deletion logic here.\n\n\t\t\t// remove our finalizer from the list and update it.\n\t\t\tbackupLoc.ObjectMeta.Finalizers = removeString(backupLoc.ObjectMeta.Finalizers, finalizer)\n\n\t\t\tif err := r.Update(context.Background(), &backupLoc); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\n\t\t// Nothing more to do for DELETE.\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Check annotations to see if repo is already initialized.\n\t// Ideally, we should check the repo itself to confirm that it is\n\t// initialized, instead of depending on annotation.\n\tinitAnnotation := \"initialized.annotations.kubedr.catalogicsoftware.com\"\n\n\tinitialized, exists := backupLoc.ObjectMeta.Annotations[initAnnotation]\n\tif exists && (initialized == \"true\") {\n\t\t// No need to initialize the repo.\n\t\tlog.Info(\"Repo is already initialized\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Annotation doesn't exist so we need to initialize the repo.\n\n\tinitPodName := backupLoc.Name + \"-init-pod\"\n\n\t// Since we don't generate a unique name for the pod that initializes the repo,\n\t// we need to explicitly check and delete the pod if it exists. We may eventually\n\t// use a unique name but that will also require cleanup of old pods.\n\tvar pod corev1.Pod\n\tif err := r.Get(ctx, types.NamespacedName{Namespace: req.Namespace, Name: initPodName}, &pod); err == nil {\n\t\tlog.Info(\"Found init pod, will delete it and continue...\")\n\t\tif err := r.Delete(ctx, &pod); ignoreNotFound(err) != nil {\n\t\t\tlog.Error(err, \"Error in deleting init pod\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tr.setStatus(&backupLoc, \"Initializing\", \"\")\n\n\t// Initialize the repo.\n\tinitPod, err := buildResticRepoInitPod(&backupLoc, log)\n\tif err != nil {\n\t\tlog.Error(err, \"Error in creating init pod\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := ctrl.SetControllerReference(&backupLoc, initPod, r.Scheme); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlog.Info(\"Starting a new Pod\", \"Pod.Namespace\", initPod.Namespace, \"Pod.Name\", initPod.Name)\n\terr = r.Create(ctx, initPod)\n\tif err != nil {\n\t\tr.Log.Error(err, \"Error in starting init pod\")\n\t\tr.setStatus(&backupLoc, \"Failed\", err.Error())\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "2e175a10a225d93391f7b1fd945a4737", "score": "0.5911676", "text": "func (r *Iter8Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\t_ = r.Log.WithValues(\"iter8\", req.NamespacedName)\n\n\t// your logic here\n\t// Fetch the Iter8 instance\n\tinstance := &iter8v1alpha1.Iter8{}\n\terr := r.Client.Get(context.TODO(), req.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\tr.Log.Info(\"Iter8 resource not found. Ignoring since object must be deleted.\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tr.Log.Error(err, \"Failed to get Iter8\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t// r.Log.Info(\"Reconcile\", \"Iter8 instance\", instance)\n\n\t// Add finalizer if not already present\n\tif !contains(instance.GetFinalizers(), finalizer) {\n\t\tr.Log.Info(\"finalize adding finalizer\", \"finalizer\", finalizer)\n\t\tinstance.SetFinalizers(append(instance.GetFinalizers(), finalizer))\n\t\tif err = r.Client.Update(context.TODO(), instance); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// Check whether object has been deleted\n\tif instance.GetDeletionTimestamp() != nil {\n\t\treturn ctrl.Result{}, r.finalize(instance)\n\t}\n\n\terr = r.crdsForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\terr = r.rbacForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\terr = r.controllerForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\terr = r.analyticsEngineForIter8(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Do other things\n\tr.Log.Info(\"Reconcile ending with nil\")\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "1fe0d0e058d366b74ff3d00bada9eaad", "score": "0.5911423", "text": "func (r *ResourceRequestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {\n\tvar resourceRequest discoveryv1alpha1.ResourceRequest\n\terr = r.Get(ctx, req.NamespacedName, &resourceRequest)\n\tif err != nil {\n\t\tklog.Errorf(\"unable to get resourceRequest %s: %s\", req.NamespacedName, err)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tremoteClusterID := resourceRequest.Spec.ClusterIdentity.ClusterID\n\n\tvar requireSpecUpdate bool\n\t// ensure the ForeignCluster existence, if not exists we have to add a new one\n\t// with IncomingPeering discovery method.\n\trequireSpecUpdate, err = r.ensureForeignCluster(ctx, &resourceRequest)\n\tif err != nil {\n\t\tklog.Errorf(\"%s -> Error generating resourceOffer: %s\", remoteClusterID, err)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif requireTenantDeletion(&resourceRequest) {\n\t\tif err = r.ensureTenantDeletion(ctx, &resourceRequest); err != nil {\n\t\t\tklog.Errorf(\"%s -> Error deleting Tenant: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\trequireSpecUpdate = true\n\t} else {\n\t\tnewRequireSpecUpdate := false\n\t\tif newRequireSpecUpdate, err = r.ensureTenant(ctx, &resourceRequest); err != nil {\n\t\t\tklog.Errorf(\"%s -> Error creating Tenant: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\trequireSpecUpdate = requireSpecUpdate || newRequireSpecUpdate\n\t}\n\n\tif requireSpecUpdate {\n\t\tif err = r.Client.Update(ctx, &resourceRequest); err != nil {\n\t\t\tklog.Error(err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// always requeue after a spec update\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdefer func() {\n\t\tnewErr := r.Client.Status().Update(ctx, &resourceRequest)\n\t\tif newErr != nil {\n\t\t\tklog.Error(newErr)\n\t\t\terr = newErr\n\t\t}\n\t}()\n\n\tif resourceRequest.Spec.WithdrawalTimestamp.IsZero() {\n\t\tr.Broadcaster.enqueueForCreationOrUpdate(remoteClusterID)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s -> Error generating resourceOffer: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t} else {\n\t\terr = r.invalidateResourceOffer(ctx, &resourceRequest)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"%s -> Error invalidating resourceOffer: %s\", remoteClusterID, err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "8eb1f41abc8ac3a2c6416a780d7cb72c", "score": "0.5909742", "text": "func (r *DnsEndpointReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"dnsendpoint\", req.NamespacedName)\n\n\t// Fetch the Dnsendpoint instance\n\tdnsendpoint := &k8sv1.DnsEndpoint{}\n\terr := r.Get(ctx, req.NamespacedName, dnsendpoint)\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\tlog.Info(\"DnsEndpoint resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get DnsEndpoint\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check if the service already exists, if not create a new one\n\tsvc := &corev1.Service{}\n\terr = r.Get(ctx, req.NamespacedName, svc)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Define a new service\n\t\t\tsvc = r.serviceForDnsEndpoint(dnsendpoint)\n\t\t\tlog.Info(\"Creating a new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t\terr = r.Create(ctx, svc)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Service created successfully - return and requeue\n\t\t\t// return ctrl.Result{Requeue: true}, nil\n\t\t} else {\n\t\t\tlog.Error(err, \"Failed to get Service\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// Resolve DNS and prepare EndpointAddress\n\tvar ips []string\n\tvar addresses []corev1.EndpointAddress\n\terr = sortedNsLookup(dnsendpoint.Spec.Dns, &ips)\n\tif err != nil {\n\t\tlog.Error(err, \"Could not resolve DNS\")\n\t\t// Could not resolve DNS - return and requeue after sleepTime\n\t\treturn ctrl.Result{RequeueAfter: sleepTime}, err\n\t}\n\tfor _, ip := range ips {\n\t\taddresses = append(addresses, corev1.EndpointAddress{IP: ip})\n\t}\n\tlog.Info(\"DNS resolve\", \"Host\", dnsendpoint.Spec.Dns, \"IPs\", ips)\n\n\t// Create endpoints\n\tendpoints := &corev1.Endpoints{}\n\terr = r.Get(ctx, req.NamespacedName, endpoints)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Define new endpoints\n\t\t\tendpoints = r.endpointsForDnsEndpoint(dnsendpoint, addresses)\n\t\t\tlog.Info(\"Creating new Endpoints\", \"Endpoints.Namespace\", endpoints.Namespace, \"Endpoints.Name\", endpoints.Name)\n\t\t\terr = r.Create(ctx, endpoints)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new Endpoints\", \"Endpoints.Namespace\", endpoints.Namespace, \"Endpoints.Name\", endpoints.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\tdnsendpoint.Status.Ips = ips\n\t\t\tlog.Info(\"Update DnsEpoint status\", \"DnsEpoint.Namespace\", dnsendpoint.Namespace, \"DnsEpoint.Name\", dnsendpoint.Name)\n\t\t\terr := r.Status().Update(ctx, dnsendpoint)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to update DnsEpoint status\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Endpoints created successfully - return and requeue after sleepTime\n\t\t\treturn ctrl.Result{RequeueAfter: sleepTime}, nil\n\t\t}\n\t\tlog.Error(err, \"Failed to get Endpoints\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tlog.Info(\"DNS cache\", \"Host\", dnsendpoint.Spec.Dns, \"IPs\", dnsendpoint.Status.Ips)\n\n\t// If IPs are changed, update endpoints and status\n\tif !reflect.DeepEqual(dnsendpoint.Status.Ips, ips) {\n\t\tendpoints.Subsets[0].Addresses = addresses\n\t\tlog.Info(\"Update Endpoints\", \"Endpoints.Namespace\", endpoints.Namespace, \"Endpoints.Name\", endpoints.Name)\n\t\terr = r.Update(ctx, endpoints)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to update Endpoints\", \"Endpoints.Namespace\", endpoints.Namespace, \"Endpoints.Name\", endpoints.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tdnsendpoint.Status.Ips = ips\n\t\tlog.Info(\"Update DnsEpoint status\", \"DnsEpoint.Namespace\", dnsendpoint.Namespace, \"DnsEpoint.Name\", dnsendpoint.Name)\n\t\terr := r.Status().Update(ctx, dnsendpoint)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to update DnsEpoint status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\t// Endpoints updated - return and requeue after sleepTime\n\treturn ctrl.Result{RequeueAfter: sleepTime}, nil\n}", "title": "" }, { "docid": "f6f2bec43d8d7634622eb322e825b551", "score": "0.5901584", "text": "func (r *Reconciler) Reconcile(log logr.Logger) error {\n\tlog = log.WithValues(\"component\", envoyutils.ComponentName)\n\n\tlog.V(1).Info(\"Reconciling\")\n\n\tif r.KafkaCluster.Spec.GetIngressController() == envoyutils.IngressControllerName {\n\t\tfor _, eListener := range r.KafkaCluster.Spec.ListenersConfig.ExternalListeners {\n\t\t\tif eListener.GetAccessMethod() == corev1.ServiceTypeLoadBalancer {\n\t\t\t\tingressConfigs, defaultControllerName, err := util.GetIngressConfigs(r.KafkaCluster.Spec, eListener)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tvar externalListernerResources []resources.ResourceWithLogAndExternalListenerSpecificInfos\n\t\t\t\texternalListernerResources = append(externalListernerResources,\n\t\t\t\t\tr.service,\n\t\t\t\t\tr.configMap,\n\t\t\t\t\tr.deployment,\n\t\t\t\t)\n\n\t\t\t\tif r.KafkaCluster.Spec.EnvoyConfig.GetDistruptionBudget().DisruptionBudget.Create {\n\t\t\t\t\texternalListernerResources = append(externalListernerResources, r.podDisruptionBudget)\n\t\t\t\t}\n\t\t\t\tfor name, ingressConfig := range ingressConfigs {\n\t\t\t\t\tif !util.IsIngressConfigInUse(name, defaultControllerName, r.KafkaCluster, log) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, res := range externalListernerResources {\n\t\t\t\t\t\to := res(log, eListener, ingressConfig, name, defaultControllerName)\n\t\t\t\t\t\terr := k8sutil.Reconcile(log, r.Client, o, r.KafkaCluster)\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}\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.V(1).Info(\"Reconciled\")\n\n\treturn nil\n}", "title": "" }, { "docid": "dfd74916c754aac290213a1aed391544", "score": "0.5901269", "text": "func (r *ElevatorReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"elevator\", req.NamespacedName)\n\n\t// 1. Fetch the Elevator object.\n\televator := &operatorv1alpha1.Elevator{}\n\tif err := r.Get(ctx, req.NamespacedName, elevator); err != nil {\n\t\t// If the Elevator object is already gone, we just ignore the NotFound error.\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\t// 2. Handle the deletion of the Elevator object (Remove the objects that the Elevator owns, and remove the finalizer).\n\tif !elevator.DeletionTimestamp.IsZero() {\n\t\tif err := r.handleDeletion(ctx, elevator); err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"handle deletion: %w\", err)\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Add finalizer\n\tif util.AddFinalizer(elevator, elevatorControllerFinalizer) {\n\t\tif err := r.Update(ctx, elevator); err != nil {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"updating Elevator finalizers: %w\", err)\n\t\t}\n\t}\n\n\t// 3. Reconcile the objects that owned by Elevator object.\n\t// Build the manifests of the Elevator controller manager.\n\tobjects, err := resourceselevator.Manifests(\n\t\tresourceselevator.Config{\n\t\t\tName: elevator.Name,\n\t\t\tNamespace: elevator.Namespace,\n\n\t\t\tProviderKind: elevator.Spec.ProviderCRD.Kind,\n\t\t\tProviderVersion: elevator.Spec.ProviderCRD.Version,\n\t\t\tProviderGroup: elevator.Spec.ProviderCRD.Group,\n\t\t\tProviderPlural: elevator.Spec.ProviderCRD.Plural,\n\n\t\t\tTenantKind: elevator.Spec.TenantCRD.Kind,\n\t\t\tTenantVersion: elevator.Spec.TenantCRD.Version,\n\t\t\tTenantGroup: elevator.Spec.TenantCRD.Group,\n\t\t\tTenantPlural: elevator.Spec.TenantCRD.Plural,\n\n\t\t\tDerivedCRName: elevator.Spec.DerivedCR.Name,\n\t\t})\n\tif err != nil {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"creating elevator manifests: %w\", err)\n\t}\n\n\tdeploymentIsReady, err := r.reconcileOwnedObjects(ctx, log, elevator, objects)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 4. Update the status of the Elevator object.\n\tif err := r.updateElevatorStatus(ctx, elevator, deploymentIsReady); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "c4da47d10da3c6805b11f74491235dc8", "score": "0.589746", "text": "func (c *KubernetesDefaultRouter) Reconcile(canary *flaggerv1.Canary) error {\n\tapexName, _, _ := canary.GetServiceNames()\n\n\t// main svc\n\terr := c.reconcileService(canary, apexName, fmt.Sprintf(\"%s-primary\", c.labelValue), canary.Spec.Service.Apex)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reconcileService failed: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1989b35f08a454fc5a43946b8501c71", "score": "0.589504", "text": "func (r *ReconcileServiceInstance) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\t// Fetch the ServiceInstance instance\n\tinstance := &osbv1alpha1.SFServiceInstance{}\n\terr := r.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\tlog.Printf(\"instance %s deleted\\n\", request.NamespacedName)\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn r.handleError(instance, reconcile.Result{}, err)\n\t}\n\n\tserviceID := instance.Spec.ServiceID\n\tplanID := instance.Spec.PlanID\n\tinstanceID := instance.GetName()\n\tbindingID := \"\"\n\tstate := instance.GetState()\n\tlabels := instance.GetLabels()\n\tlastOperation, ok := labels[lastOperationKey]\n\tif !ok {\n\t\tlastOperation = \"in_queue\"\n\t}\n\tvar requeue bool\n\tvar appliedResources []*unstructured.Unstructured\n\tvar remainingResource []osbv1alpha1.Source\n\n\tif instance.GetDeletionTimestamp().IsZero() {\n\t\tif !containsString(instance.GetFinalizers(), finalizerName) {\n\t\t\t// The object is not being deleted, so if it does not have our finalizer,\n\t\t\t// then lets add the finalizer and update the object.\n\t\t\tinstance.SetFinalizers(append(instance.GetFinalizers(), finalizerName))\n\t\t\tif err := r.Update(context.Background(), instance); err != nil {\n\t\t\t\treturn r.handleError(instance, reconcile.Result{Requeue: true}, nil)\n\t\t\t}\n\t\t}\n\t}\n\n\ttargetClient, err := r.clusterFactory.GetCluster(instanceID, bindingID, serviceID, planID)\n\tif err != nil {\n\t\treturn r.handleError(instance, reconcile.Result{}, err)\n\t}\n\n\tif state == \"delete\" && !instance.GetDeletionTimestamp().IsZero() {\n\t\t// The object is being deleted\n\t\tif containsString(instance.GetFinalizers(), finalizerName) {\n\t\t\t// our finalizer is present, so lets handle our external dependency\n\t\t\tremainingResource, err = r.resourceManager.DeleteSubResources(targetClient, instance.Status.Resources)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Delete sub resources error %s\\n\", err.Error())\n\t\t\t\trequeue = true\n\t\t\t} else {\n\t\t\t\terr = r.setInProgress(request.NamespacedName, state)\n\t\t\t\tif err != nil {\n\t\t\t\t\trequeue = true\n\t\t\t\t} else {\n\t\t\t\t\tlastOperation = state\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if state == \"in_queue\" || state == \"update\" {\n\t\texpectedResources, err := r.resourceManager.ComputeExpectedResources(r, instanceID, bindingID, serviceID, planID, osbv1alpha1.ProvisionAction, instance.GetNamespace())\n\t\tif err != nil {\n\t\t\treturn r.handleError(instance, reconcile.Result{}, err)\n\t\t}\n\n\t\terr = r.resourceManager.SetOwnerReference(instance, expectedResources, r.scheme)\n\t\tif err != nil {\n\t\t\treturn r.handleError(instance, reconcile.Result{}, err)\n\t\t}\n\n\t\tappliedResources, err = r.resourceManager.ReconcileResources(r, targetClient, expectedResources, instance.Status.Resources)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Reconcile error %s\\n\", err.Error())\n\t\t\trequeue = true\n\t\t} else {\n\t\t\terr = r.setInProgress(request.NamespacedName, state)\n\t\t\tif err != nil {\n\t\t\t\trequeue = true\n\t\t\t} else {\n\t\t\t\tlastOperation = state\n\t\t\t}\n\t\t}\n\t}\n\n\tif lastOperation == \"delete\" {\n\t\tremainingResource = []osbv1alpha1.Source{}\n\t\tfor _, subResource := range instance.Status.Resources {\n\t\t\tresource := &unstructured.Unstructured{}\n\t\t\tresource.SetKind(subResource.Kind)\n\t\t\tresource.SetAPIVersion(subResource.APIVersion)\n\t\t\tresource.SetName(subResource.Name)\n\t\t\tresource.SetNamespace(subResource.Namespace)\n\t\t\tnamespacedName := types.NamespacedName{\n\t\t\t\tName: resource.GetName(),\n\t\t\t\tNamespace: resource.GetNamespace(),\n\t\t\t}\n\t\t\terr := targetClient.Get(context.TODO(), namespacedName, resource)\n\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\tremainingResource = append(remainingResource, subResource)\n\t\t\t}\n\t\t}\n\t\tif err := r.updateDeprovisionStatus(targetClient, instance, remainingResource); err != nil {\n\t\t\treturn r.handleError(instance, reconcile.Result{}, err)\n\t\t}\n\t} else if lastOperation == \"in_queue\" || lastOperation == \"update\" {\n\t\terr = r.updateStatus(instanceID, bindingID, serviceID, planID, instance.GetNamespace(), appliedResources)\n\t\tif err != nil {\n\t\t\treturn r.handleError(instance, reconcile.Result{}, err)\n\t\t}\n\t}\n\treturn r.handleError(instance, reconcile.Result{Requeue: requeue}, nil)\n}", "title": "" }, { "docid": "40e3765b66c08c0b1aa0de7653e1deba", "score": "0.58903724", "text": "func (r *PrestoClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\t_ = r.Log.WithValues(\"prestocluster\", req.NamespacedName)\n\tvar log = r.Log.WithValues(\n\t\t\"cluster\", req.NamespacedName)\n\tvar controller = PrestoClusterController{\n\t\tk8sClient: r.Client,\n\t\trequest: req,\n\t\tinspected: InspectedClusterState{},\n\t\tcontext: context.Background(),\n\t\tlog: log,\n\t\trecorder: r.Recorder,\n\t}\n\treturn controller.reconcile(req)\n}", "title": "" }, { "docid": "4deefd2849609f20ff27916e7ea69f0f", "score": "0.5888004", "text": "func (r *RuleReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\n\tctx := context.Background()\n\t_ = r.Log.WithValues(\"rule\", req.NamespacedName)\n\n\tvar rule oathkeeperv1alpha1.Rule\n\tskipValidation := false\n\n\tif err := r.Get(ctx, req.NamespacedName, &rule); err != nil {\n\t\tif apierrs.IsNotFound(err) {\n\t\t\t// just return here, the finalizers have already run\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif !skipValidation {\n\t\tif err := rule.ValidateWith(r.ValidationConfig); err != nil {\n\t\t\trule.Status.Validation = &oathkeeperv1alpha1.Validation{}\n\t\t\trule.Status.Validation.Valid = boolPtr(false)\n\t\t\trule.Status.Validation.Error = stringPtr(err.Error())\n\t\t\tr.Log.Info(fmt.Sprintf(\"validation error in Rule %s/%s: \\\"%s\\\"\", rule.Namespace, rule.Name, err.Error()))\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\tr.Log.Error(err, \"unable to update Rule status\")\n\t\t\t\t//Invoke requeue directly without logging error with whole stacktrace\n\t\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t\t}\n\t\t\t// continue, as validation can't be fixed by requeuing request and we still have to update the configmap\n\t\t} else {\n\t\t\t// rule valid - set the status\n\t\t\trule.Status.Validation = &oathkeeperv1alpha1.Validation{}\n\t\t\trule.Status.Validation.Valid = boolPtr(true)\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\tr.Log.Error(err, \"unable to update Rule status\")\n\t\t\t\t//Invoke requeue directly without logging error with whole stacktrace\n\t\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t\t}\n\t\t}\n\t}\n\n\tvar rulesList oathkeeperv1alpha1.RuleList\n\n\tif err := r.List(ctx, &rulesList, client.InNamespace(req.NamespacedName.Namespace)); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// examine DeletionTimestamp to determine if object is under deletion\n\tif rule.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 !containsString(rule.ObjectMeta.Finalizers, FinalizerName) {\n\t\t\trule.ObjectMeta.Finalizers = append(rule.ObjectMeta.Finalizers, FinalizerName)\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// The object is being deleted\n\t\tif containsString(rule.ObjectMeta.Finalizers, FinalizerName) {\n\t\t\t// our finalizer is present, so lets handle any external dependency\n\t\t\trulesList = rulesList.FilterOutRule(rule)\n\n\t\t\t// remove our finalizer from the list and update it.\n\t\t\trule.ObjectMeta.Finalizers = removeString(rule.ObjectMeta.Finalizers, FinalizerName)\n\t\t\tif err := r.Update(ctx, &rule); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\toathkeeperRulesJSON, err := rulesList.FilterNotValid().\n\t\tFilterConfigMapName(rule.Spec.ConfigMapName).\n\t\tToOathkeeperRules()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tconfigMap := r.RuleConfigmap\n\tif rule.Spec.ConfigMapName != nil {\n\t\tconfigMap = types.NamespacedName{\n\t\t\tName: *rule.Spec.ConfigMapName,\n\t\t\tNamespace: req.NamespacedName.Namespace,\n\t\t}\n\t}\n\tif err := r.updateOrCreateRulesConfigmap(ctx, configMap, string(oathkeeperRulesJSON)); err != nil {\n\t\tr.Log.Error(err, \"unable to process rules Configmap\")\n\t\tos.Exit(1)\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "80a520b87a0fd06fa1f1a4eae7084d57", "score": "0.5881118", "text": "func (r *ReconcileProvisioner) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"sfcluster\", req.NamespacedName)\n\n\t// Fetch the SFCluster\n\tclusterInstance := &resourcev1alpha1.SFCluster{}\n\terr := r.Get(ctx, req.NamespacedName, clusterInstance)\n\tif err != nil {\n\t\tif apiErrors.IsNotFound(err) {\n\t\t\t// Object not found, return.\n\t\t\terr = removeClusterFromWatch(req.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\tlog.Error(err, \"Failed to get SFCluster...\", \"clusterId\", req.NamespacedName.Name)\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\tclusterID := clusterInstance.GetName()\n\tlog.Info(\"reconciling cluster\", \"clusterID\", clusterID)\n\n\t//reconcile primaryClusterID in the configmap\n\terr = r.reconcilePrimaryClusterIDConfig()\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Get targetClient for targetCluster\n\ttargetClient, err := r.clusterRegistry.GetClient(clusterID)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 2. Get deploment instance for provisioner\n\tdeplomentInstance := &appsv1.Deployment{}\n\terr = r.Get(ctx, types.NamespacedName{\n\t\tName: constants.ProvisionerTemplateName,\n\t\tNamespace: constants.InteroperatorNamespace,\n\t}, deplomentInstance)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to get provisioner deployment from master cluster\", \"clusterId\", clusterID)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 3. Register sf CRDs\n\terr = r.registerSFCrds(clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 4. Add watches on resources in target sfcluster. Must be done after\n\t// registering sf crds, since we are trying to watch on sfserviceinstance\n\t// and sfservicebinding.\n\terr = addClusterToWatch(clusterID)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 5. Create/Update Namespace in target cluster for provisioner\n\tnamespace := deplomentInstance.GetNamespace()\n\terr = r.reconcileNamespace(namespace, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 6. Creating/Updating sfcluster in target cluster\n\terr = r.reconcileSfClusterCrd(clusterInstance, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 7. Creating/Updating kubeconfig secret for sfcluster in target cluster\n\t// Fetch current primary cluster id from configmap\n\tinteroperatorCfg := r.cfgManager.GetConfig()\n\tcurrPrimaryClusterID := interoperatorCfg.PrimaryClusterID\n\n\terr = r.reconcileSecret(namespace, clusterInstance.Spec.SecretRef, clusterID, targetClient)\n\tif err != nil {\n\t\t// Skip if secret not found for leader cluster\n\t\tif !(apiErrors.IsNotFound(err) && clusterID == currPrimaryClusterID) {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(\"Ignoring secret not found error for leader cluster\", \"clusterId\", clusterID,\n\t\t\t\"secretRef\", clusterInstance.Spec.SecretRef)\n\t}\n\n\t// 8. Deploy cluster rolebinding\n\terr = r.reconcileClusterRoleBinding(namespace, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// 9. Creating/Updating imagepull secrets for provisioner deployment in target cluster\n\tfor _, secretRef := range deplomentInstance.Spec.Template.Spec.ImagePullSecrets {\n\t\terr = r.reconcileSecret(namespace, secretRef.Name, clusterID, targetClient)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// 10. Create Deployment in target cluster for provisioner\n\terr = r.reconcileDeployment(deplomentInstance, clusterID, targetClient)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trequeueAfter, err := time.ParseDuration(interoperatorCfg.ClusterReconcileInterval)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to parse ClusterReconcileInterval\",\n\t\t\t\"ClusterReconcileInterval\", interoperatorCfg.ClusterReconcileInterval)\n\t\trequeueAfter, _ = time.ParseDuration(constants.DefaultClusterReconcileInterval)\n\t}\n\treturn ctrl.Result{\n\t\tRequeueAfter: requeueAfter,\n\t}, nil\n}", "title": "" }, { "docid": "9cd160e3114660a6789c96e154093888", "score": "0.58790445", "text": "func (r *ReconcileKubemanager) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tvar err error\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling Kubemanager\")\n\tinstanceType := \"kubemanager\"\n\tinstance := &v1alpha1.Kubemanager{}\n\tcassandraInstance := v1alpha1.Cassandra{}\n\tzookeeperInstance := v1alpha1.Zookeeper{}\n\trabbitmqInstance := v1alpha1.Rabbitmq{}\n\tconfigInstance := v1alpha1.Config{}\n\n\terr = r.Client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil && errors.IsNotFound(err) {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tcassandraActive := cassandraInstance.IsActive(instance.Spec.ServiceConfiguration.CassandraInstance,\n\t\trequest.Namespace, r.Client)\n\tzookeeperActive := zookeeperInstance.IsActive(instance.Spec.ServiceConfiguration.ZookeeperInstance,\n\t\trequest.Namespace, r.Client)\n\trabbitmqActive := rabbitmqInstance.IsActive(instance.Labels[\"contrail_cluster\"],\n\t\trequest.Namespace, r.Client)\n\tconfigActive := configInstance.IsActive(instance.Labels[\"contrail_cluster\"],\n\t\trequest.Namespace, r.Client)\n\tif !configActive || !cassandraActive || !rabbitmqActive || !zookeeperActive {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tmanagerInstance, err := instance.OwnedByManager(r.Client, request)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif managerInstance != nil {\n\t\tif managerInstance.Spec.Services.Kubemanagers != nil {\n\t\t\tfor _, kubemanagerManagerInstance := range managerInstance.Spec.Services.Kubemanagers {\n\t\t\t\tif kubemanagerManagerInstance.Name == request.Name {\n\t\t\t\t\tinstance.Spec.CommonConfiguration = utils.MergeCommonConfiguration(\n\t\t\t\t\t\tmanagerInstance.Spec.CommonConfiguration,\n\t\t\t\t\t\tkubemanagerManagerInstance.Spec.CommonConfiguration)\n\t\t\t\t\terr = r.Client.Update(context.TODO(), instance)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tconfigMap, err := instance.CreateConfigMap(request.Name+\"-\"+instanceType+\"-configmap\",\n\t\tr.Client,\n\t\tr.Scheme,\n\t\trequest)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tintendedDeployment, err := instance.PrepareIntendedDeployment(GetDeployment(),\n\t\t&instance.Spec.CommonConfiguration,\n\t\trequest,\n\t\tr.Scheme)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tinstance.AddVolumesToIntendedDeployments(intendedDeployment,\n\t\tmap[string]string{configMap.Name: request.Name + \"-\" + instanceType + \"-volume\"})\n\n\tvar serviceAccountName string\n\tif instance.Spec.ServiceConfiguration.ServiceAccount != \"\" {\n\t\tserviceAccountName = instance.Spec.ServiceConfiguration.ServiceAccount\n\t} else {\n\t\tserviceAccountName = \"contrail-service-account\"\n\t}\n\n\tvar clusterRoleName string\n\tif instance.Spec.ServiceConfiguration.ClusterRole != \"\" {\n\t\tclusterRoleName = instance.Spec.ServiceConfiguration.ClusterRole\n\t} else {\n\t\tclusterRoleName = \"contrail-cluster-role\"\n\t}\n\n\tvar clusterRoleBindingName string\n\tif instance.Spec.ServiceConfiguration.ClusterRoleBinding != \"\" {\n\t\tclusterRoleBindingName = instance.Spec.ServiceConfiguration.ClusterRoleBinding\n\t} else {\n\t\tclusterRoleBindingName = \"contrail-cluster-role-binding\"\n\t}\n\n\texistingServiceAccount := &corev1.ServiceAccount{}\n\terr = r.Client.Get(context.TODO(), types.NamespacedName{Name: serviceAccountName, Namespace: instance.Namespace}, existingServiceAccount)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tserviceAccount := &corev1.ServiceAccount{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\tKind: \"ServiceAccount\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: serviceAccountName,\n\t\t\t\tNamespace: instance.Namespace,\n\t\t\t},\n\t\t}\n\t\tcontrollerutil.SetControllerReference(instance, serviceAccount, r.Scheme)\n\t\terr = r.Client.Create(context.TODO(), serviceAccount)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\texistingClusterRole := &rbacv1.ClusterRole{}\n\terr = r.Client.Get(context.TODO(), types.NamespacedName{Name: clusterRoleName}, existingClusterRole)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tclusterRole := &rbacv1.ClusterRole{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"rbac/v1\",\n\t\t\t\tKind: \"ClusterRole\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: clusterRoleName,\n\t\t\t\tNamespace: instance.Namespace,\n\t\t\t},\n\t\t\tRules: []rbacv1.PolicyRule{{\n\t\t\t\tVerbs: []string{\n\t\t\t\t\t\"*\",\n\t\t\t\t},\n\t\t\t\tAPIGroups: []string{\n\t\t\t\t\t\"*\",\n\t\t\t\t},\n\t\t\t\tResources: []string{\n\t\t\t\t\t\"*\",\n\t\t\t\t},\n\t\t\t}},\n\t\t}\n\t\tcontrollerutil.SetControllerReference(instance, clusterRole, r.Scheme)\n\t\terr = r.Client.Create(context.TODO(), clusterRole)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\texistingClusterRoleBinding := &rbacv1.ClusterRoleBinding{}\n\terr = r.Client.Get(context.TODO(), types.NamespacedName{Name: clusterRoleBindingName}, existingClusterRoleBinding)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tclusterRoleBinding := &rbacv1.ClusterRoleBinding{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"rbac/v1\",\n\t\t\t\tKind: \"ClusterRoleBinding\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: clusterRoleBindingName,\n\t\t\t\tNamespace: instance.Namespace,\n\t\t\t},\n\t\t\tSubjects: []rbacv1.Subject{{\n\t\t\t\tKind: \"ServiceAccount\",\n\t\t\t\tName: serviceAccountName,\n\t\t\t\tNamespace: instance.Namespace,\n\t\t\t}},\n\t\t\tRoleRef: rbacv1.RoleRef{\n\t\t\t\tAPIGroup: \"rbac.authorization.k8s.io\",\n\t\t\t\tKind: \"ClusterRole\",\n\t\t\t\tName: clusterRoleName,\n\t\t\t},\n\t\t}\n\t\tcontrollerutil.SetControllerReference(instance, clusterRoleBinding, r.Scheme)\n\t\terr = r.Client.Create(context.TODO(), clusterRoleBinding)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\tintendedDeployment.Spec.Template.Spec.ServiceAccountName = serviceAccountName\n\tfor idx, container := range intendedDeployment.Spec.Template.Spec.Containers {\n\t\tif container.Name == \"kubemanager\" {\n\t\t\tcommand := []string{\"bash\", \"-c\",\n\t\t\t\t\"/usr/bin/python /usr/bin/contrail-kube-manager -c /etc/mycontrail/kubemanager.${POD_IP}\"}\n\t\t\t//command = []string{\"sh\", \"-c\", \"while true; do echo hello; sleep 10;done\"}\n\t\t\t(&intendedDeployment.Spec.Template.Spec.Containers[idx]).Command = command\n\n\t\t\tvolumeMountList := []corev1.VolumeMount{}\n\t\t\tif len((&intendedDeployment.Spec.Template.Spec.Containers[idx]).VolumeMounts) > 0 {\n\t\t\t\tvolumeMountList = (&intendedDeployment.Spec.Template.Spec.Containers[idx]).VolumeMounts\n\t\t\t}\n\t\t\tvolumeMount := corev1.VolumeMount{\n\t\t\t\tName: request.Name + \"-\" + instanceType + \"-volume\",\n\t\t\t\tMountPath: \"/etc/mycontrail\",\n\t\t\t}\n\t\t\tvolumeMountList = append(volumeMountList, volumeMount)\n\t\t\t(&intendedDeployment.Spec.Template.Spec.Containers[idx]).VolumeMounts = volumeMountList\n\t\t\t(&intendedDeployment.Spec.Template.Spec.Containers[idx]).Image = instance.Spec.ServiceConfiguration.Images[container.Name]\n\t\t}\n\t}\n\n\tfor idx, container := range intendedDeployment.Spec.Template.Spec.InitContainers {\n\t\tfor containerName, image := range instance.Spec.ServiceConfiguration.Images {\n\t\t\tif containerName == container.Name {\n\t\t\t\t(&intendedDeployment.Spec.Template.Spec.InitContainers[idx]).Image = image\n\t\t\t}\n\t\t}\n\t}\n\n\terr = instance.CompareIntendedWithCurrentDeployment(intendedDeployment,\n\t\t&instance.Spec.CommonConfiguration,\n\t\trequest,\n\t\tr.Scheme,\n\t\tr.Client,\n\t\tfalse)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tpodIPList, podIPMap, err := instance.PodIPListAndIPMap(request, r.Client)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif len(podIPList.Items) > 0 {\n\t\terr = instance.InstanceConfiguration(request,\n\t\t\tpodIPList,\n\t\t\tr.Client)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\terr = instance.SetPodsToReady(podIPList, r.Client)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\terr = instance.ManageNodeStatus(podIPMap, r.Client)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\terr = instance.SetInstanceActive(r.Client, &instance.Status, intendedDeployment, request)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "f9be21f03f63d334835ddbdbf48de479", "score": "0.5861698", "text": "func (c *ECSDeploymentControllerImpl) Reconcile(u *v1alpha1.ECSDeployment) error {\n\t// Implement controller logic here\n\t// TODO: create services too\n\t// TODO: ensure we don't have a race condition if we deploy multiple controllers\n\tlog.Printf(\"Running reconcile ECSDeployment for: %s\\n\", u.Name)\n\td := c.si.KubernetesClientSet.AppsV1beta2().Deployments(u.Namespace)\n\n\tdList, err := d.List(metav1.ListOptions{\n\t\tLabelSelector: DEPLOYMENT_LABEL + \"=\" + u.GetName(),\n\t})\n\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to lookup deployments for %s: %v\", u.Name, err)\n\t\tlog.Printf(\"%v\", err)\n\t\treturn err\n\t}\n\n\tif len(dList.Items) == 0 {\n\t\tlog.Printf(\"Creating deployment for ECSDeployment %v\", u)\n\t\tnewDep, err := ecsDeploymentToDeployment(u)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"warning: deployment was not created:%v\", err)\n\t\t}\n\n\t\tlog.Printf(\"Creating deployment %v\", newDep)\n\t\t_, err = d.Create(newDep)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%v\", err)\n\t\t\treturn fmt.Errorf(\"Failed to create deployment for ECSDeployment '%s': %v\", u.GetName(), err)\n\t\t}\n\t}\n\n\ts := c.si.KubernetesClientSet.CoreV1().Services(u.Namespace)\n\n\tsList, err := s.List(metav1.ListOptions{\n\t\tLabelSelector: DEPLOYMENT_LABEL + \"=\" + u.GetName(),\n\t})\n\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to lookup services for %s: %v\", u.Name, err)\n\t\tlog.Printf(\"%v\", err)\n\t\treturn err\n\t}\n\n\tif len(sList.Items) == 0 {\n\t\tlog.Printf(\"Creating service for ECSDeployment %v\", u)\n\t\tnewSvc, err := ecsDeploymentToService(u)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"warning: service was not created:%v\", err)\n\t\t}\n\n\t\tlog.Printf(\"Creating service %v\", newSvc)\n\t\t_, err = s.Create(newSvc)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%v\", err)\n\t\t\treturn fmt.Errorf(\"Failed to create service for ECSDeployment '%s': %v\", u.GetName(), err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6a604b6eee3cddc815bda734efe29ea", "score": "0.584724", "text": "func (r *StatusReconciler) Reconcile() error {\n\n\tlogData := map[string]interface{}{\n\t\t\"PipelineDeployment.Namespace\": r.pipelineDeployment.Spec.DeploymentNamespace,\n\t\t\"PipelineDeployment.Name\": r.pipelineDeployment.Spec.DeploymentName,\n\t}\n\treqLogger := log.WithValues(\"data\", logData)\n\n\tpipelineDeploymentStatus, err := r.getStatus(r.pipelineDeployment, r.request)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Failed to get PipelineDeployment status.\")\n\t\treturn err\n\t}\n\n\tnotifMessages := []*algov1beta1.NotifMessage{}\n\n\tif r.pipelineDeployment.Status.Status != pipelineDeploymentStatus.Status {\n\t\tr.pipelineDeployment.Status.Status = pipelineDeploymentStatus.Status\n\n\t\tloglevel := v1beta1.LOGLEVELS_INFO\n\t\tnotifType := v1beta1.NOTIFTYPES_PIPELINE_DEPLOYMENT_STATUS\n\t\tnotifMessage := &algov1beta1.NotifMessage{\n\t\t\tMessageTimestamp: time.Now(),\n\t\t\tLevel: &loglevel,\n\t\t\tType: &notifType,\n\t\t\tDeploymentStatusMessage: &algov1beta1.DeploymentStatusMessage{\n\t\t\t\tDeploymentOwner: r.pipelineDeployment.Spec.DeploymentOwner,\n\t\t\t\tDeploymentName: r.pipelineDeployment.Spec.DeploymentName,\n\t\t\t\tStatus: r.pipelineDeployment.Status.Status,\n\t\t\t},\n\t\t}\n\n\t\tnotifMessages = append(notifMessages, notifMessage)\n\n\t}\n\n\t// Iterate the existing deployment statuses and update if changed\n\tfor _, deplStatus := range r.pipelineDeployment.Status.ComponentStatuses {\n\t\tfor _, newDeplStatus := range pipelineDeploymentStatus.ComponentStatuses {\n\t\t\tif newDeplStatus.DeploymentName == deplStatus.DeploymentName {\n\n\t\t\t\tif !cmp.Equal(deplStatus, newDeplStatus) {\n\t\t\t\t\tdeplStatus = newDeplStatus\n\t\t\t\t\t//reqLogger.Info(\"Deployment Status Differences\", \"Differences\", diff)\n\t\t\t\t\tloglevel := v1beta1.LOGLEVELS_INFO\n\t\t\t\t\tnotifType := v1beta1.NOTIFTYPES_PIPELINE_DEPLOYMENT\n\t\t\t\t\tnotifMessage := &algov1beta1.NotifMessage{\n\t\t\t\t\t\tMessageTimestamp: time.Now(),\n\t\t\t\t\t\tLevel: &loglevel,\n\t\t\t\t\t\tType: &notifType,\n\t\t\t\t\t\tDeploymentStatusMessage: &algov1beta1.DeploymentStatusMessage{\n\t\t\t\t\t\t\tDeploymentOwner: r.pipelineDeployment.Spec.DeploymentOwner,\n\t\t\t\t\t\t\tDeploymentName: r.pipelineDeployment.Spec.DeploymentName,\n\t\t\t\t\t\t\tStatus: r.pipelineDeployment.Status.Status,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\n\t\t\t\t\tnotifMessages = append(notifMessages, notifMessage)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\t// Iterate the existing pod statuses and update if changed\n\tfor _, podStatus := range r.pipelineDeployment.Status.PodStatuses {\n\t\tfor _, newPodStatus := range pipelineDeploymentStatus.PodStatuses {\n\t\t\tif newPodStatus.PodName == podStatus.PodName {\n\n\t\t\t\tif !cmp.Equal(podStatus, newPodStatus) {\n\t\t\t\t\tpodStatus = newPodStatus\n\n\t\t\t\t\t// reqLogger.Info(\"Deployment Pod Status Differences\", \"Differences\", diff)\n\t\t\t\t\tloglevel := v1beta1.LOGLEVELS_INFO\n\t\t\t\t\tnotifType := v1beta1.NOTIFTYPES_PIPELINE_DEPLOYMENT_POD\n\t\t\t\t\tnotifMessage := &algov1beta1.NotifMessage{\n\t\t\t\t\t\tMessageTimestamp: time.Now(),\n\t\t\t\t\t\tLevel: &loglevel,\n\t\t\t\t\t\tType: &notifType,\n\t\t\t\t\t\tDeploymentStatusMessage: &algov1beta1.DeploymentStatusMessage{\n\t\t\t\t\t\t\tDeploymentOwner: r.pipelineDeployment.Spec.DeploymentOwner,\n\t\t\t\t\t\t\tDeploymentName: r.pipelineDeployment.Spec.DeploymentName,\n\t\t\t\t\t\t\tStatus: r.pipelineDeployment.Status.Status,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\n\t\t\t\t\tnotifMessages = append(notifMessages, notifMessage)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\tif !cmp.Equal(r.pipelineDeployment.Status, *pipelineDeploymentStatus) {\n\t\t// reqLogger.Info(\"Pipeline Deployment Status Differences\", \"Differences\", diff)\n\n\t\t//r.pipelineDeployment.Status = *pipelineDeploymentStatus\n\t\tpatch := client.MergeFrom(r.pipelineDeployment.DeepCopy())\n\t\tr.pipelineDeployment.Status = *pipelineDeploymentStatus\n\t\terr := r.client.Patch(r.context, r.pipelineDeployment, patch)\n\n\t\t//err = r.client.Status().Update(r.context, r.pipelineDeployment)\n\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Failed to patch PipelineDeployment status.\")\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// Send all notifications\n\tif len(notifMessages) > 0 {\n\t\tutils.NotifyAll(notifMessages)\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "441a63efafefd9779ebe8f14f50282df", "score": "0.58312184", "text": "func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error) {\n\tlog.V(logging.Debug).Info(\"reconciling\", \"kind\", v1alpha1.ReplicationGroupKindAPIVersion, \"request\", req)\n\n\tctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)\n\tdefer cancel()\n\n\trd := &v1alpha1.ReplicationGroup{}\n\tif err := r.kube.Get(ctx, req.NamespacedName, rd); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{Requeue: false}, nil\n\t\t}\n\t\treturn reconcile.Result{Requeue: false}, errors.Wrapf(err, \"cannot get resource %s\", req.NamespacedName)\n\t}\n\n\tclient, err := r.Connect(ctx, rd)\n\tif err != nil {\n\t\trd.Status.SetFailed(reasonFetchingClient, err.Error())\n\t\treturn reconcile.Result{Requeue: true}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource has been deleted from the API server. Delete from AWS.\n\tif rd.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{Requeue: client.Delete(ctx, rd)}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The group is unnamed. Assume it has not been created in AWS.\n\tif rd.Status.GroupName == \"\" {\n\t\trequeue, authToken := client.Create(ctx, rd)\n\t\tif err := r.upsertSecret(ctx, connectionSecretWithPassword(rd, authToken)); err != nil {\n\t\t\trd.Status.SetFailed(reasonSyncingSecret, err.Error())\n\t\t\trequeue = true\n\t\t}\n\t\treturn reconcile.Result{Requeue: requeue}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\tif err := r.upsertSecret(ctx, connectionSecret(rd)); err != nil {\n\t\trd.Status.SetFailed(reasonSyncingSecret, err.Error())\n\t\treturn reconcile.Result{Requeue: true}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n\t}\n\n\t// The resource exists in the API server and AWS. Sync it.\n\treturn reconcile.Result{Requeue: client.Sync(ctx, rd)}, errors.Wrapf(r.kube.Update(ctx, rd), \"cannot update resource %s\", req.NamespacedName)\n}", "title": "" }, { "docid": "bf243298a543f30f8b00755eae15e85b", "score": "0.5827515", "text": "func (r *ReconcileDeployment) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling Deployment\")\n\tkey := request.Namespace + \"/\" + request.Name\n\tstartTime := time.Now()\n\tklog.V(4).Infof(\"Started syncing deployment %q (%v)\", key, startTime)\n\tdefer func() {\n\t\tklog.V(4).Infof(\"Finished syncing deployment %q (%v)\", key, time.Since(startTime))\n\t}()\n\n\t// Fetch the Deployment instance\n\tdeployment := &ketiv1.Deployment{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, deployment)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tklog.V(2).Infof(\"Deployment %v has been deleted\", key)\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\tr.initDeployment(deployment)\n\td := deployment.DeepCopy()\n\teverything := metav1.LabelSelector{}\n\tif reflect.DeepEqual(d.Spec.Selector, &everything) {\n\t\tif d.Status.ObservedGeneration < d.Generation {\n\t\t\td.Status.ObservedGeneration = d.Generation\n\t\t\tdep, err := r.KetiClient.Deployments(d.Namespace).UpdateStatus(d)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorln(err)\n\t\t\t}\n\t\t\tklog.Infoln(dep.Name, \"Update State Complete\")\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\trsList, err := r.getReplicaSetsForDeployment(d)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\t// List all Pods owned by this Deployment, grouped by their ReplicaSet.\n\t// Current uses of the podMap are:\n\t//\n\t// * check if a Pod is labeled correctly with the pod-template-hash label.\n\t// * check that no old Pods are running in the middle of Recreate Deployments.\n\tpodMap, err := r.getPodMapForDeployment(d, rsList)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif d.DeletionTimestamp != nil {\n\t\treturn reconcile.Result{}, r.syncStatusOnly(d, rsList)\n\t}\n\n\t// Update deployment conditions with an Unknown condition when pausing/resuming\n\t// a deployment. In this way, we can be sure that we won't timeout when a user\n\t// resumes a Deployment with a set progressDeadlineSeconds.\n\tif err = r.checkPausedConditions(d); err != nil {\n\t\treturn reconcile.Result{},err\n\t}\n\n\tif d.Spec.Paused {\n\t\treturn reconcile.Result{}, r.sync(d, rsList)\n\t}\n\n\t// rollback is not re-entrant in case the underlying replica sets are updated with a new\n\t// revision so we should ensure that we won't proceed to update replica sets until we\n\t// make sure that the deployment has cleaned up its rollback spec in subsequent enqueues.\n\tif getRollbackTo(d) != nil {\n\t\treturn reconcile.Result{}, r.rollback(d, rsList)\n\t}\n\n\tscalingEvent, err := r.isScalingEvent(d, rsList)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tif scalingEvent {\n\t\treturn reconcile.Result{}, r.sync(d, rsList)\n\t}\n\n\tswitch d.Spec.Strategy.Type {\n\tcase ketiv1.RecreateDeploymentStrategyType:\n\t\treturn reconcile.Result{}, r.rolloutRecreate(d, rsList, podMap)\n\tcase ketiv1.RollingUpdateDeploymentStrategyType:\n\t\treturn reconcile.Result{}, r.rolloutRolling(d, rsList)\n\t}\n\treturn reconcile.Result{}, fmt.Errorf(\"unexpected deployment strategy type: %s\", d.Spec.Strategy.Type)\n}", "title": "" }, { "docid": "822d0bf9d9aa0871d877ec8d46c67fbd", "score": "0.5825954", "text": "func (d *dataplane) Reconcile(ctx context.Context, object controllers.Object) (res *reconcile.Result, err error) {\n\tdp := object.(*v1alpha1.DataPlane)\n\t// Get the control plane object, if not found error, add Owner reference to control plane object\n\tif err := d.setOwnerForDataplane(ctx, dp); err != nil {\n\t\treturn results.Failed, fmt.Errorf(\"setting owner reference for dataplane, %w\", err)\n\t}\n\t// Create a launch template and ASG with desired node count\n\tfor _, reconciler := range []reconciler{\n\t\td.launchTemplate.Reconcile,\n\t\td.instances.Reconcile,\n\t} {\n\t\tif err := reconciler(ctx, dp); err != nil {\n\t\t\treturn results.Failed, err\n\t\t}\n\t}\n\tzap.S().Infof(\"[%s] data plane reconciled\", dp.Spec.ClusterName)\n\treturn results.Created, nil\n}", "title": "" }, { "docid": "20be94a48c92b5e714e49b1c54484fac", "score": "0.58210087", "text": "func (bmc *Controller) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tll := bmc.log.WithFields(logrus.Fields{\n\t\t\"method\": \"Reconcile\",\n\t\t\"name\": req.Name,\n\t})\n\n\tvar err error\n\t// if name in request doesn't start with namePrefix controller tries to read k8s node object at first\n\t// however if it get NotFound error it tries to read Node object as well\n\tif !strings.HasPrefix(req.Name, namePrefix) {\n\t\tk8sNode := new(coreV1.Node)\n\t\terr = bmc.k8sClient.ReadCR(context.Background(), req.Name, \"\", k8sNode)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\tll.Infof(\"Reconcile k8s node %s\", k8sNode.Name)\n\t\t\treturn bmc.reconcileForK8sNode(k8sNode)\n\t\tcase !k8sError.IsNotFound(err):\n\t\t\tll.Errorf(\"Unable to read node object: %v\", err)\n\t\t\treturn ctrl.Result{Requeue: true}, err\n\t\t}\n\t}\n\n\t// try to read Node\n\tbmNode := new(nodecrd.Node)\n\terr = bmc.k8sClient.ReadCR(context.Background(), req.Name, \"\", bmNode)\n\tswitch {\n\tcase err == nil:\n\t\tll.Infof(\"Reconcile Node %s\", bmNode.Name)\n\t\treturn bmc.reconcileForCSIBMNode(bmNode)\n\tcase !k8sError.IsNotFound(err):\n\t\tll.Errorf(\"Unable to read Node object: %v\", err)\n\t\treturn ctrl.Result{Requeue: true}, err\n\t}\n\n\tll.Warnf(\"unable to detect for which object (%s) that reconcile is. The object may have been deleted\", req.String())\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "b37a78206796b108592ce173a3c5a1e0", "score": "0.5812214", "text": "func (r *MysqlUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t// your logic here.\n\tuser := mysqluser.New(&apiv1alpha1.MysqlUser{})\n\n\terr := r.Get(ctx, req.NamespacedName, user.Unwrap())\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\tuserLog.Info(\"mysql user not found, maybe deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\toldStatus := user.Status.DeepCopy()\n\n\t// If mysql user has been deleted then delete it from mysql cluster.\n\tif !user.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\treturn ctrl.Result{}, r.removeUser(ctx, user)\n\t}\n\n\t// Write the desired status into mysql cluster.\n\truErr := r.reconcileUserInCluster(ctx, user)\n\tif err := r.updateStatusAndErr(ctx, user, oldStatus, ruErr); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Enqueue the resource again after to keep the resource up to date in mysql\n\t// in case is changed directly into mysql.\n\treturn ctrl.Result{\n\t\tRequeue: true,\n\t\tRequeueAfter: 2 * time.Minute,\n\t}, nil\n}", "title": "" }, { "docid": "f2a7ffcb6fcb3970958c8295a8196117", "score": "0.5811422", "text": "func (ec *EtcdCustodian) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tec.logger.Info(\"Custodian controller reconciliation started\")\n\tetcd := &druidv1alpha1.Etcd{}\n\tif err := ec.Get(ctx, req.NamespacedName, etcd); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlogger := ec.logger.WithValues(\"etcd\", kutil.Key(etcd.Namespace, etcd.Name).String())\n\n\t// TODO: (timuthy) remove this as it could block important health checks\n\tif etcd.Status.LastError != nil && *etcd.Status.LastError != \"\" {\n\t\tlogger.Info(fmt.Sprintf(\"Requeue item because of last error: %v\", *etcd.Status.LastError))\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: 30 * time.Second,\n\t\t}, nil\n\t}\n\n\tselector, err := metav1.LabelSelectorAsSelector(etcd.Spec.Selector)\n\tif err != nil {\n\t\tlogger.Error(err, \"Error converting etcd selector to selector\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tstatusCheck := status.NewChecker(ec.Client, ec.config)\n\tif err := statusCheck.Check(ctx, logger, etcd); err != nil {\n\t\tlogger.Error(err, \"Error executing status checks\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\trefMgr := NewEtcdDruidRefManager(ec.Client, ec.Scheme, etcd, selector, etcdGVK, nil)\n\n\tstsList, err := refMgr.FetchStatefulSet(ctx, etcd)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Requeue if we found more than one or no StatefulSet.\n\t// The Etcd controller needs to decide what to do in such situations.\n\tif len(stsList.Items) != 1 {\n\t\tif err := ec.updateEtcdStatus(ctx, logger, etcd, nil); err != nil {\n\t\t\tlogger.Error(err, \"Error while updating ETCD status when no statefulset found\")\n\t\t}\n\t\treturn ctrl.Result{\n\t\t\tRequeueAfter: 5 * time.Second,\n\t\t}, nil\n\t}\n\n\tif err := ec.updateEtcdStatus(ctx, logger, etcd, &stsList.Items[0]); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{RequeueAfter: ec.config.SyncPeriod}, nil\n}", "title": "" }, { "docid": "a398c7946dbb367180711138893d437d", "score": "0.5796255", "text": "func (r *ServingRuntimeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := r.Log.WithValues(\"servingruntime\", req.NamespacedName)\n\tlog.V(1).Info(\"ServingRuntime reconciler called\")\n\n\t// Reconcile the model mesh cluster config map\n\truntimes := &api.ServingRuntimeList{}\n\terr := r.Client.List(ctx, runtimes)\n\tif err != nil {\n\t\treturn RequeueResult, err\n\t}\n\n\td := &appsv1.Deployment{}\n\terr = r.Client.Get(ctx, types.NamespacedName{\n\t\tName: r.DeploymentName,\n\t\tNamespace: r.DeploymentNamespace,\n\t}, d)\n\tif err != nil {\n\t\treturn RequeueResult, fmt.Errorf(\"Could not get the controller deployment: %w\", err)\n\t}\n\n\tcc := modelmesh.ClusterConfig{\n\t\tRuntimes: runtimes,\n\t\tNamespace: req.Namespace,\n\t\tScheme: r.Scheme,\n\t}\n\n\tif err = cc.Apply(ctx, d, r.Client); err != nil {\n\t\treturn RequeueResult, fmt.Errorf(\"Could not apply the modelmesh type-constraints configmap: %w\", err)\n\t}\n\n\t//reconcile this serving runtime\n\trt := &api.ServingRuntime{}\n\terr = r.Client.Get(ctx, req.NamespacedName, rt)\n\tif errors.IsNotFound(err) {\n\t\tr.Log.Info(\"Runtime is not found\")\n\n\t\t// remove runtime from info map\n\t\tr.runtimeInfoMapMutex.Lock()\n\t\tdefer r.runtimeInfoMapMutex.Unlock()\n\n\t\tif r.runtimeInfoMap != nil {\n\t\t\t// this is safe even if the entry doesn't exist\n\t\t\tdelete(r.runtimeInfoMap, req.NamespacedName)\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// If invalid ServerType is provided in rt.Spec or if this value doesn't match with that of the specified container, delete the deployment\n\tif err = validateServingRuntimeSpec(rt); err != nil {\n\t\twerr := fmt.Errorf(\"Invalid ServingRuntime Spec: %w\", err)\n\t\treturn ctrl.Result{}, werr\n\t}\n\n\t// construct the deployment\n\tconfig := r.ConfigProvider.GetConfig()\n\tmmDeployment := modelmesh.Deployment{\n\t\tServiceName: config.InferenceServiceName,\n\t\tName: req.Name,\n\t\tNamespace: req.Namespace,\n\t\tOwner: rt,\n\t\tDefaultVModelOwner: PredictorCRSourceId,\n\t\tLog: log,\n\t\tMetrics: config.Metrics.Enabled,\n\t\tPrometheusPort: config.Metrics.Port,\n\t\tPrometheusScheme: config.Metrics.Scheme,\n\t\tModelMeshImage: config.ModelMeshImage.TaggedImage(),\n\t\tModelMeshResources: config.ModelMeshResources.ToKubernetesType(),\n\t\tPullerImage: config.StorageHelperImage.TaggedImage(),\n\t\tPullerImageCommand: config.StorageHelperImage.Command,\n\t\tPullerResources: config.StorageHelperResources.ToKubernetesType(),\n\t\tPort: config.InferenceServicePort,\n\t\tGrpcMaxMessageSize: config.GrpcMaxMessageSizeBytes,\n\t\t// Replicas is set below\n\t\tTLSSecretName: config.TLS.SecretName,\n\t\tTLSClientAuth: config.TLS.ClientAuth,\n\t\tEtcdSecretName: config.GetEtcdSecretName(),\n\t\tServiceAccountName: config.ServiceAccountName,\n\t\tEnableAccessLogging: config.EnableAccessLogging,\n\t\tClient: r.Client,\n\t}\n\n\t// if the runtime is disabled, delete the deployment\n\tif rt.Disabled() {\n\t\tlog.Info(\"Deployment is disabled for this runtime\")\n\t\terr = mmDeployment.Delete(ctx, r.Client)\n\t\tif err != nil {\n\t\t\twerr := fmt.Errorf(\"Could not delete the model mesh deployment: %w\", err)\n\t\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, werr\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\treplicas, requeueDuration, err := r.determineReplicasAndRequeueDuration(ctx, log, config, rt)\n\tif err != nil {\n\t\twerr := fmt.Errorf(\"Could not determine replicas: %w\", err)\n\t\treturn RequeueResult, werr\n\t}\n\tmmDeployment.Replicas = replicas\n\terr = mmDeployment.Apply(ctx)\n\tif err != nil {\n\t\tif errors.IsConflict(err) {\n\t\t\t// this can occur during normal operations if the deployment was updated\n\t\t\t// during this reconcile loop\n\t\t\tlog.Info(\"Could not apply model mesh deployment due to resource conflict\")\n\t\t\treturn RequeueResult, nil\n\t\t}\n\t\twerr := fmt.Errorf(\"Could not apply the model mesh deployment: %w\", err)\n\t\treturn ctrl.Result{RequeueAfter: 5 * time.Second}, werr\n\t}\n\treturn ctrl.Result{RequeueAfter: requeueDuration}, nil\n}", "title": "" }, { "docid": "db63a1047570a0e70d858b6f8bc1ed25", "score": "0.57905096", "text": "func (s *Service) Reconcile(ctx context.Context) error {\n\tctx, _, done := tele.StartSpanWithLogger(ctx, \"privatedns.Service.Reconcile\")\n\tdefer done()\n\n\tctx, cancel := context.WithTimeout(ctx, reconciler.DefaultAzureServiceReconcileTimeout)\n\tdefer cancel()\n\n\tzoneSpec, links, records := s.Scope.PrivateDNSSpec()\n\tif zoneSpec == nil {\n\t\treturn nil\n\t}\n\n\tmanaged, err := s.reconcileZone(ctx, zoneSpec)\n\tif managed {\n\t\ts.Scope.UpdatePutStatus(infrav1.PrivateDNSZoneReadyCondition, serviceName, err)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmanaged, err = s.reconcileLinks(ctx, links)\n\tif managed {\n\t\ts.Scope.UpdatePutStatus(infrav1.PrivateDNSLinkReadyCondition, serviceName, err)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.reconcileRecords(ctx, records)\n\ts.Scope.UpdatePutStatus(infrav1.PrivateDNSRecordReadyCondition, serviceName, err)\n\treturn err\n}", "title": "" }, { "docid": "7315876450ff870ab7e9afed47341cad", "score": "0.5787525", "text": "func (r *JoinedClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"joinedcluster\", req.NamespacedName)\n\tvar err error\n\tvar joinedCluster clustermanagerv1alpha1.JoinedCluster\n\tif err = r.Get(ctx, req.NamespacedName, &joinedCluster); err != nil {\n\t\tif apierrs.IsNotFound(err) {\n\t\t\t//handle delete of the JoinedCluster CR\n\t\t\tlog.Error(err, \"Unable to get JoinedCluster from the server\")\n\t\t\treturn ctrl.Result{}, ignoreNotFound(err)\n\t\t}\n\t}\n\n\t// handle finalizer\n\t// register a custom finalizer\n\tjoinedClusterFinalizer := \"storage.finalizers.onprem.openshift.io\"\n\n\t// examine DeletionTimestamp to determine if object is under deletion\n\tif joinedCluster.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 !containsString(joinedCluster.ObjectMeta.Finalizers, joinedClusterFinalizer) {\n\t\t\tjoinedCluster.ObjectMeta.Finalizers = append(joinedCluster.ObjectMeta.Finalizers, joinedClusterFinalizer)\n\t\t\tif err = r.Update(context.Background(), &joinedCluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// The object is being deleted\n\t\tif containsString(joinedCluster.ObjectMeta.Finalizers, joinedClusterFinalizer) {\n\t\t\t// our finalizer is present, so lets handle any external dependency\n\t\t\tif err = r.deleteExternalResources(&req, &joinedCluster); err != nil {\n\t\t\t\t// if fail to delete the external dependency here, return with error\n\t\t\t\t// so that it can be retried\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// remove our finalizer from the list and update it.\n\t\t\tjoinedCluster.ObjectMeta.Finalizers = removeString(joinedCluster.ObjectMeta.Finalizers, joinedClusterFinalizer)\n\t\t\tif err = r.Update(context.Background(), &joinedCluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t//continue with the controller logic\n\tcondition := joinedCluster.IsCondition(clustermanagerv1alpha1.ConditionTypeReadyToJoin)\n\tif joinedCluster.Status.ClusterAgentInfo != nil {\n\t\t//ready to join, check for staleness, disconnects\n\t\tsinceLastUpdate := time.Since(joinedCluster.Status.ClusterAgentInfo.LastUpdateTime.Time)\n\t\tif sinceLastUpdate >= joinedCluster.Spec.StaleDuration.Duration &&\n\t\t\tsinceLastUpdate < joinedCluster.Spec.DisconnectDuration.Duration {\n\t\t\tjoinedCluster.SetCondition(clustermanagerv1alpha1.ConditionTypeAgentStale)\n\t\t} else if sinceLastUpdate > joinedCluster.Spec.DisconnectDuration.Duration {\n\t\t\tjoinedCluster.SetCondition(clustermanagerv1alpha1.ConditionTypeAgentDisconnected)\n\t\t}\n\n\t} else if condition == nil {\n\t\t// not ready to join, create SA, rolebinding KubeConfig\n\t\t// set ServiceAccount and JoinCommand status subresource fields.\n\t\tserviceAccount, err := createServiceAccount(r, &req, &joinedCluster, log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tsaSecret, err := getSecret(r, serviceAccount, log)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Error getting the sa secret\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t_, err = createRoleBinding(r, &req, &joinedCluster, log)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tserverUrl, err := getServerUrl(r, log)\n\t\tif _, exists := saSecret.Data[\"service-ca.crt\"]; exists {\n\t\t\tif _, exists := saSecret.Data[\"token\"]; exists {\n\t\t\t\tjoinSecret, err := createJoinSecret(r, saSecret.Data[\"service-ca.crt\"], saSecret.Data[\"token\"], joinedCluster.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\t\t\t\tyamlFile, err := ioutil.ReadFile(yamlFilePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Info(\"Cannot read yaml file from the deployment dir\")\n\t\t\t\t\treturn ctrl.Result{}, err\n\t\t\t\t}\n\t\t\t\tjoinCommand := fmt.Sprintf(joinCommandTemplate, joinSecret.Name, joinSecret.Namespace,\n\t\t\t\t\tjoinSecret.Name, joinSecret.Namespace, joinedCluster.Name, joinedCluster.Namespace, serverUrl, string(yamlFile))\n\t\t\t\tlog.Info(\"Command output:\", \"joincommand\", joinCommand)\n\t\t\t\tjoinedCluster.Status.JoinCommand = &joinCommand\n\n\t\t\t} else {\n\t\t\t\tlog.Info(\"Couldn't find the token key in the secret\")\n\t\t\t\treturn ctrl.Result{}, errors.New(\"Token key not found for the sa secret\")\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Info(\"Couldn't find the service-ca.crt key in the secret\")\n\t\t\treturn ctrl.Result{}, errors.New(\"service-ca.crt not found in the secret\")\n\t\t}\n\t\t// at this point we have a role binding created, now get the sa token and create\n\t\t// kubeconfig file.\n\t\tsaName := serviceAccount.Name\n\t\tjoinedCluster.Status.ServiceAccountName = &saName\n\t\tjoinedCluster.SetCondition(clustermanagerv1alpha1.ConditionTypeReadyToJoin)\n\t}\n\n\t//update the status subresource now on the API server\n\tif err := r.Status().Update(ctx, &joinedCluster); err != nil {\n\t\tlog.Error(err, \"unable to update JoinedCluster status\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "02bd9faf621dfdf55ad22d17d9390035", "score": "0.5782887", "text": "func (r *LabelerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t_ = log.FromContext(ctx)\n\n\tlabeler := &nulllabelerv1.Labeler{}\n\n\tif err := r.Client.Get(ctx, req.NamespacedName, labeler); err != nil {\n\t\t// Error reading the object - requeue the request.\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tpodList := &core.PodList{}\n\n\tr.Client.List(context.Background(), podList)\n\n\tfor _, pod := range podList.Items {\n\t\tif pod.Labels == nil {\n\t\t\tpod.Labels = map[string]string{\"null-labeler\": labeler.Spec.Label}\n\t\t} else {\n\t\t\tpod.Labels[\"null-labeler\"] = labeler.Spec.Label\n\t\t}\n\t\tr.Update(ctx, &pod) //TODO: Care about the error returned here\n\t}\n\n\t// your logic here\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "63eef18cf03b3fc2bbc5078aba9ba6bc", "score": "0.5777644", "text": "func (c *Controller) Reconcile(ctx context.Context) error {\n\tvar (\n\t\tl = log.WithFields(logrus.Fields{\n\t\t\t\"component\": \"Controller.Reconcile\",\n\t\t})\n\t)\n\n\t// retrieve all CiliumBGPPeeringPolicies\n\tpolicies, err := c.PolicyLister.List()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list CiliumBGPPeeringPolicies\")\n\t}\n\tl.WithField(\"count\", len(policies)).Debug(\"Successfully listed CiliumBGPPeeringPolicies\")\n\n\t// perform policy selection based on node.\n\tlabels, err := c.NodeSpec.Labels()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve labels for Node: %w\", err)\n\t}\n\tpolicy, err := PolicySelection(ctx, labels, policies)\n\tif err != nil {\n\t\tl.WithError(err).Error(\"Policy selection failed\")\n\t\tc.FullWithdrawal(ctx)\n\t\treturn err\n\t}\n\tif policy == nil {\n\t\t// no policy was discovered, tell router manager to withdrawal peers if\n\t\t// they are configured.\n\t\tl.Debug(\"No BGP peering policy applies to this node, any existing BGP sessions will be removed.\")\n\t\tc.FullWithdrawal(ctx)\n\t\treturn nil\n\t}\n\n\t// apply policy defaults to have consistent default config across sub-systems\n\tpolicy = policy.DeepCopy() // deepcopy to not modify the policy object in store\n\tpolicy.SetDefaults()\n\n\terr = c.validatePolicy(policy)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid BGP peering policy %s: %w\", policy.Name, err)\n\t}\n\n\t// parse any virtual router specific attributes defined on this node via\n\t// kubernetes annotations\n\t//\n\t// if we notice one or more malformed annotations report the errors up and\n\t// fail reconciliation.\n\tannotations, err := c.NodeSpec.Annotations()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve Node's annotations: %w\", err)\n\t}\n\n\tannoMap, err := NewAnnotationMap(annotations)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse annotations: %w\", err)\n\t}\n\n\tpodCIDRs, err := c.NodeSpec.PodCIDRs()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve Node's pod CIDR ranges: %w\", err)\n\t}\n\n\tcurrentNodeName, err := c.NodeSpec.CurrentNodeName()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve current node's name: %w\", err)\n\t}\n\n\tipv4, _ := ip.AddrFromIP(nodeaddr.GetIPv4())\n\tipv6, _ := ip.AddrFromIP(nodeaddr.GetIPv6())\n\n\t// define our current point-in-time control plane state.\n\tstate := &ControlPlaneState{\n\t\tPodCIDRs: podCIDRs,\n\t\tAnnotations: annoMap,\n\t\tIPv4: ipv4,\n\t\tIPv6: ipv6,\n\t\tCurrentNodeName: currentNodeName,\n\t}\n\n\t// call bgp sub-systems required to apply this policy's BGP topology.\n\tl.Debug(\"Asking configured BGPRouterManager to configure peering\")\n\tif err := c.BGPMgr.ConfigurePeers(ctx, policy, state); err != nil {\n\t\treturn fmt.Errorf(\"failed to configure BGP peers, cannot apply BGP peering policy: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "060951113f674fdf923a0a27687f337f", "score": "0.5773218", "text": "func (r *OpenStackClientReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t_ = context.Background()\n\t_ = r.Log.WithValues(\"openstackclient\", req.NamespacedName)\n\n\tinstance := &controlplanev1beta1.OpenStackClient{}\n\terr := r.Client.Get(context.TODO(), req.NamespacedName, instance)\n\tr.Log.Info(\"OpenStackClient values\", \"Name\", instance.Name, \"Namespace\", instance.Namespace, \"Secret\", instance.Spec.OpenStackConfigSecret, \"Spec\", fmt.Sprintf(\"%T\", instance.Spec), \"Image\", instance.Spec.ContainerImage)\n\tif err != nil {\n\t\tif k8s_errors.IsNotFound(err) {\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t}\n\n\terr = r.reconcileDeployment(instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "852b43939a61a9aab08c4ee69b4d7c96", "score": "0.57725614", "text": "func (r *ElasticWebReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t// 会用到context\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"elasticweb\", req.NamespacedName)\n\n\t// your logic here\n\n\tlog.Info(\"1. start reconcile logic\")\n\n\t// 实例化数据结构\n\tinstance := &elasticwebv1.ElasticWeb{}\n\n\t// 通过客户端工具查询,查询条件是\n\terr := r.Get(ctx, req.NamespacedName, instance)\n\n\tif err != nil {\n\n\t\t// 如果没有实例,就返回空结果,这样外部就不再立即调用Reconcile方法了\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"2.1. instance not found, maybe removed\")\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\n\t\tlog.Error(err, \"2.2 error\")\n\t\t// 返回错误信息给外部\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlog.Info(\"3. instance : \" + instance.String())\n\n\t// 查找deployment\n\tdeployment := &appsv1.Deployment{}\n\n\t// 用客户端工具查询\n\terr = r.Get(ctx, req.NamespacedName, deployment)\n\n\t// 查找时发生异常,以及查出来没有结果的处理逻辑\n\tif err != nil {\n\t\t// 如果没有实例就要创建了\n\t\tif errors.IsNotFound(err) {\n\t\t\tlog.Info(\"4. deployment not exists\")\n\n\t\t\t// 如果对QPS没有需求,此时又没有deployment,就啥事都不做了\n\t\t\tif *(instance.Spec.TotalQPS) < 1 {\n\t\t\t\tlog.Info(\"5.1 not need deployment\")\n\t\t\t\t// 返回\n\t\t\t\treturn ctrl.Result{}, nil\n\t\t\t}\n\n\t\t\t// 先要创建service\n\t\t\tif err = createServiceIfNotExists(ctx, r, instance, req); err != nil {\n\t\t\t\tlog.Error(err, \"5.2 error\")\n\t\t\t\t// 返回错误信息给外部\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// 立即创建deployment\n\t\t\tif err = createDeployment(ctx, r, instance); err != nil {\n\t\t\t\tlog.Error(err, \"5.3 error\")\n\t\t\t\t// 返回错误信息给外部\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// 如果创建成功就更新状态\n\t\t\tif err = updateStatus(ctx, r, instance); err != nil {\n\t\t\t\tlog.Error(err, \"5.4. error\")\n\t\t\t\t// 返回错误信息给外部\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// 创建成功就可以返回了\n\t\t\treturn ctrl.Result{}, nil\n\t\t} else {\n\t\t\tlog.Error(err, \"7. error\")\n\t\t\t// 返回错误信息给外部\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// 如果查到了deployment,并且没有返回错误,就走下面的逻辑\n\n\t// 根据单QPS和总QPS计算期望的副本数\n\texpectReplicas := getExpectReplicas(instance)\n\n\t// 当前deployment的期望副本数\n\trealReplicas := *deployment.Spec.Replicas\n\n\tlog.Info(fmt.Sprintf(\"9. expectReplicas [%d], realReplicas [%d]\", expectReplicas, realReplicas))\n\n\t// 如果相等,就直接返回了\n\tif expectReplicas == realReplicas {\n\t\tlog.Info(\"10. return now\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// 如果不等,就要调整\n\t*(deployment.Spec.Replicas) = expectReplicas\n\n\tlog.Info(\"11. update deployment's Replicas\")\n\t// 通过客户端更新deployment\n\tif err = r.Update(ctx, deployment); err != nil {\n\t\tlog.Error(err, \"12. update deployment replicas error\")\n\t\t// 返回错误信息给外部\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlog.Info(\"13. update status\")\n\n\t// 如果更新deployment的Replicas成功,就更新状态\n\tif err = updateStatus(ctx, r, instance); err != nil {\n\t\tlog.Error(err, \"14. update status error\")\n\t\t// 返回错误信息给外部\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "20d5601d7c854661a05450c1dfbb50b5", "score": "0.5766558", "text": "func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := log.WithValues(\"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\tlog.Info(\"Reconciling\")\n\n\t// Fetch the ObservabilityAddon instance in hub cluster\n\thubObsAddon := &oav1beta1.ObservabilityAddon{}\n\terr := r.HubClient.Get(ctx, types.NamespacedName{Name: obAddonName, Namespace: hubNamespace}, hubObsAddon)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to get observabilityaddon in hub cluster\", \"namespace\", hubNamespace)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Fetch the ObservabilityAddon instance in local cluster\n\tobsAddon := &oav1beta1.ObservabilityAddon{}\n\terr = r.Client.Get(ctx, types.NamespacedName{Name: obAddonName, Namespace: namespace}, obsAddon)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to get observabilityaddon\", \"namespace\", namespace)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\thubObsAddon.Status = obsAddon.Status\n\n\terr = r.HubClient.Status().Update(ctx, hubObsAddon)\n\tif err != nil {\n\t\tlog.Error(err, \"Failed to update status for observabilityaddon in hub cluster\", \"namespace\", hubNamespace)\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "508c3b3eee8d2abc01ae8716a1f06d42", "score": "0.57654", "text": "func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tr.log.Debug(\"Reconciling\")\n\tctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)\n\tdefer cancel()\n\t// fetch the app context\n\tappContext := &v1alpha2.ApplicationContext{}\n\tif err := r.client.Get(ctx, request.NamespacedName, appContext); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// stop processing this resource\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, errors.Wrap(err, errGetAppContex)\n\t}\n\n\tctx = util.SetNamespaceInCtx(ctx, appContext.Namespace)\n\tdm, err := discoverymapper.New(r.mgr.GetConfig())\n\tif err != nil {\n\t\treturn reconcile.Result{}, fmt.Errorf(\"create discovery dm fail %w\", err)\n\t}\n\t// fetch the appRevision it points to\n\tappRevision := &v1alpha2.ApplicationRevision{}\n\tkey := types.NamespacedName{Namespace: appContext.Namespace, Name: appContext.Spec.ApplicationRevisionName}\n\tif err := r.client.Get(ctx, key, appRevision); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// stop processing this resource\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, errors.Wrap(err, errGetAppRevision)\n\t}\n\n\t// copy the status\n\tacRaw := appRevision.Spec.ApplicationConfiguration\n\tappConfig, err := ConvertRawExtention2AppConfig(acRaw)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tappConfig.Status = appContext.Status\n\t// the name of the appConfig has to be the same as the appContext\n\tappConfig.ObjectMeta = metav1.ObjectMeta{Namespace: appContext.Namespace, Name: appContext.Name, UID: appContext.UID}\n\t// call into the old ac Reconciler and copy the status back\n\tacReconciler := ac.NewReconciler(r.mgr, dm, r.log, ac.WithRecorder(r.record), ac.WithApplyOnceOnlyMode(r.applyMode))\n\treconResult := acReconciler.ACReconcile(ctx, appConfig, r.log)\n\tappContext.Status = appConfig.Status\n\t// always update ac status and set the error\n\terr = errors.Wrap(r.client.Status().Update(ctx, appContext), errUpdateAppContextStatus)\n\t// use the controller build-in backoff mechanism if an error occurs\n\tif err != nil {\n\t\treconResult.RequeueAfter = 0\n\t}\n\treturn reconResult, err\n}", "title": "" }, { "docid": "e9964848132aac54eccd86610b04df2b", "score": "0.5743098", "text": "func (c *Controller) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tdefer metricsC.ReconcileDuration.EvaluateDurationForType(\"node_drive_controller\")()\n\t// read name\n\tdriveName := req.Name\n\t// TODO why do we need 60 seconds here?\n\t// create context\n\tctx, cancelFn := context.WithTimeout(context.Background(), 60*time.Second)\n\tdefer cancelFn()\n\n\t// customize logging\n\tlog := c.log.WithFields(logrus.Fields{\"method\": \"drive/Reconcile\", \"name\": driveName})\n\n\t// obtain corresponding drive\n\tdrive := &drivecrd.Drive{}\n\tif err := c.client.ReadCR(ctx, driveName, \"\", drive); err != nil {\n\t\tlog.Errorf(\"Failed to read Drive %s CR\", driveName)\n\t\t// TODO is this correct error here?\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tlog.Infof(\"Drive changed: %v\", drive)\n\n\tusage := drive.Spec.GetUsage()\n\thealth := drive.Spec.GetHealth()\n\tid := drive.Spec.GetUUID()\n\ttoUpdate := false\n\n\tswitch usage {\n\tcase apiV1.DriveUsageInUse:\n\t\tif health == apiV1.HealthSuspect || health == apiV1.HealthBad {\n\t\t\t// TODO update health of volumes\n\t\t\tdrive.Spec.Usage = apiV1.DriveUsageReleasing\n\t\t\ttoUpdate = true\n\t\t}\n\tcase apiV1.DriveUsageReleasing:\n\t\tvolumes, err := c.crHelper.GetVolumesByLocation(ctx, id)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{RequeueAfter: base.DefaultRequeueForVolume}, err\n\t\t}\n\t\tallFound := true\n\t\tfor _, vol := range volumes {\n\t\t\tstatus, found := drive.Annotations[fmt.Sprintf(\n\t\t\t\t\"%s/%s\", apiV1.DriveAnnotationVolumeStatusPrefix, vol.Name)]\n\t\t\tif !found || status != apiV1.VolumeUsageReleased {\n\t\t\t\tallFound = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif allFound {\n\t\t\tdrive.Spec.Usage = apiV1.DriveUsageReleased\n\t\t\teventMsg := fmt.Sprintf(\"Drive is ready for replacement, %s\", drive.GetDriveDescription())\n\t\t\tc.eventRecorder.Eventf(drive, eventing.NormalType, eventing.DriveReadyForReplacement, eventMsg)\n\t\t\ttoUpdate = true\n\t\t}\n\n\tcase apiV1.DriveUsageReleased:\n\t\tstatus, found := drive.Annotations[apiV1.DriveAnnotationReplacement]\n\t\tif !found || status != apiV1.DriveAnnotationReplacementReady {\n\t\t\tbreak\n\t\t}\n\t\ttoUpdate = true\n\t\tdrive.Spec.Usage = apiV1.DriveUsageRemoving\n\t\tfallthrough\n\tcase apiV1.DriveUsageRemoving:\n\t\tvolumes, err := c.crHelper.GetVolumesByLocation(ctx, id)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{RequeueAfter: base.DefaultRequeueForVolume}, err\n\t\t}\n\t\tif c.checkAllVolsRemoved(volumes) {\n\t\t\tdrive.Spec.Usage = apiV1.DriveUsageRemoved\n\t\t\tstatus, err := c.driveMgrClient.Locate(ctx, &api.DriveLocateRequest{Action: apiV1.LocateStart, DriveSerialNumber: drive.Spec.SerialNumber})\n\t\t\tif err != nil || status.Status != apiV1.LocateStatusOn {\n\t\t\t\tlog.Errorf(\"Failed to locate LED of drive %s, err %v\", drive.Spec.SerialNumber, err)\n\t\t\t\tdrive.Spec.Usage = apiV1.DriveUsageFailed\n\t\t\t\t// send error level alert\n\t\t\t\teventMsg := fmt.Sprintf(\"Failed to locale LED, %s\", drive.GetDriveDescription())\n\t\t\t\tc.eventRecorder.Eventf(drive, eventing.ErrorType, eventing.DriveReplacementFailed, eventMsg)\n\t\t\t} else {\n\t\t\t\t// send info level alert\n\t\t\t\teventMsg := fmt.Sprintf(\"Drive successfully replaced, %s\", drive.GetDriveDescription())\n\t\t\t\tc.eventRecorder.Eventf(drive, eventing.NormalType, eventing.DriveSuccessfullyReplaced, eventMsg)\n\t\t\t}\n\t\t\ttoUpdate = true\n\t\t}\n\tcase apiV1.DriveUsageRemoved:\n\t\tif drive.Spec.Status == apiV1.DriveStatusOffline {\n\t\t\t// drive was removed from the system. need to clean corresponding custom resource\n\t\t\tif err := c.client.DeleteCR(ctx, drive); err != nil {\n\t\t\t\tlog.Errorf(\"Failed to delete Drive %s CR\", driveName)\n\t\t\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t\t\t}\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t}\n\n\t// update drive CR if needed\n\tif toUpdate {\n\t\tif err := c.client.UpdateCR(ctx, drive); err != nil {\n\t\t\tlog.Errorf(\"Failed to update Drive %s CR\", driveName)\n\t\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "3c70cf3a0a374edeb8726945e5852e93", "score": "0.57421756", "text": "func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operatorv1alpha1.ConfigService, namespace string, csv *olmv1alpha1.ClusterServiceVersion) error {\n\tmerr := &util.MultiErr{}\n\n\t// Create k8s resources required by service\n\tif service.Resources != nil {\n\t\tfor _, res := range service.Resources {\n\t\t\tif res.APIVersion == \"\" {\n\t\t\t\treturn fmt.Errorf(\"The APIVersion of k8s resource is empty for operator \" + service.Name)\n\t\t\t}\n\n\t\t\tif res.Kind == \"\" {\n\t\t\t\treturn fmt.Errorf(\"The Kind of k8s resource is empty for operator \" + service.Name)\n\t\t\t}\n\t\t\tif res.Name == \"\" {\n\t\t\t\treturn fmt.Errorf(\"The Name of k8s resource is empty for operator \" + service.Name)\n\t\t\t}\n\t\t\tvar k8sResNs string\n\t\t\tif res.Namespace == \"\" {\n\t\t\t\tk8sResNs = namespace\n\t\t\t} else {\n\t\t\t\tk8sResNs = res.Namespace\n\t\t\t}\n\n\t\t\tvar k8sRes unstructured.Unstructured\n\t\t\tk8sRes.SetAPIVersion(res.APIVersion)\n\t\t\tk8sRes.SetKind(res.Kind)\n\t\t\tk8sRes.SetName(res.Name)\n\t\t\tk8sRes.SetNamespace(k8sResNs)\n\n\t\t\terr := r.Client.Get(ctx, types.NamespacedName{\n\t\t\t\tName: res.Name,\n\t\t\t\tNamespace: k8sResNs,\n\t\t\t}, &k8sRes)\n\n\t\t\tif err != nil && !apierrors.IsNotFound(err) {\n\t\t\t\tmerr.Add(errors.Wrapf(err, \"failed to get k8s resource %s/%s\", k8sResNs, res.Name))\n\t\t\t} else if apierrors.IsNotFound(err) {\n\t\t\t\tif err := r.createK8sResource(ctx, k8sRes, res.Data, res.Labels, res.Annotations); err != nil {\n\t\t\t\t\tmerr.Add(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif checkLabel(k8sRes, map[string]string{constant.OpreqLabel: \"true\"}) && res.Force {\n\t\t\t\t\t// Update k8s resource\n\t\t\t\t\tklog.V(3).Info(\"Found existing k8s resource: \" + res.Name)\n\t\t\t\t\tif err := r.updateK8sResource(ctx, k8sRes, res.Data, res.Labels, res.Annotations); err != nil {\n\t\t\t\t\t\tmerr.Add(err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tklog.V(2).Infof(\"Skip the k8s resource %s/%s which is not created by ODLM\", res.Kind, res.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(merr.Errors) != 0 {\n\t\t\treturn merr\n\t\t}\n\t}\n\n\talmExamples := csv.GetAnnotations()[\"alm-examples\"]\n\n\t// Convert CR template string to slice\n\tvar almExampleList []interface{}\n\terr := json.Unmarshal([]byte(almExamples), &almExampleList)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to convert alm-examples in the Subscription %s/%s to slice\", namespace, service.Name)\n\t}\n\n\tfoundMap := make(map[string]bool)\n\tfor cr := range service.Spec {\n\t\tfoundMap[cr] = false\n\t}\n\n\t// Merge OperandConfig and ClusterServiceVersion alm-examples\n\tfor _, almExample := range almExampleList {\n\t\t// Create an unstructured object for CR and check its value\n\t\tvar crFromALM unstructured.Unstructured\n\t\tcrFromALM.Object = almExample.(map[string]interface{})\n\n\t\tname := crFromALM.GetName()\n\t\tspec := crFromALM.Object[\"spec\"]\n\t\tif spec == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\terr := r.Client.Get(ctx, types.NamespacedName{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t}, &crFromALM)\n\n\t\tfor cr := range service.Spec {\n\t\t\tif strings.EqualFold(crFromALM.GetKind(), cr) {\n\t\t\t\tfoundMap[cr] = true\n\t\t\t}\n\t\t}\n\n\t\tif err != nil && !apierrors.IsNotFound(err) {\n\t\t\tmerr.Add(errors.Wrapf(err, \"failed to get the custom resource %s/%s\", namespace, name))\n\t\t\tcontinue\n\t\t} else if apierrors.IsNotFound(err) {\n\t\t\t// Create Custom Resource\n\t\t\tif err := r.compareConfigandExample(ctx, crFromALM, service, namespace); err != nil {\n\t\t\t\tmerr.Add(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tif checkLabel(crFromALM, map[string]string{constant.OpreqLabel: \"true\"}) {\n\t\t\t\t// Update or Delete Custom Resource\n\t\t\t\tif err := r.existingCustomResource(ctx, crFromALM, spec.(map[string]interface{}), service, namespace); err != nil {\n\t\t\t\t\tmerr.Add(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tklog.V(2).Info(\"Skip the custom resource not created by ODLM\")\n\t\t\t}\n\t\t}\n\t}\n\tif len(merr.Errors) != 0 {\n\t\treturn merr\n\t}\n\n\tfor cr, found := range foundMap {\n\t\tif !found {\n\t\t\tklog.Warningf(\"Custom resource %v doesn't exist in the alm-example of %v\", cr, csv.GetName())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5328bffc174e008cf7b5261017c5d1fa", "score": "0.57272696", "text": "func ReconcileRBAC(er record.EventRecorder, k8sClient client.Client, saNamespace string, resNames *factory.ForwarderResourceNames, owner metav1.OwnerReference) error {\n\tdesiredCRB := NewMetaDataReaderClusterRoleBinding(saNamespace, resNames.MetadataReaderClusterRoleBinding, resNames.ServiceAccount, owner)\n\tif err := reconcile.ClusterRoleBinding(k8sClient, resNames.MetadataReaderClusterRoleBinding, func() *rbacv1.ClusterRoleBinding { return desiredCRB }); err != nil {\n\t\treturn err\n\t}\n\tdesiredSCCRole := NewServiceAccountSCCRole(saNamespace, resNames.CommonName, owner)\n\tif err := reconcile.Role(er, k8sClient, desiredSCCRole); err != nil {\n\t\treturn err\n\t}\n\n\tdesiredSCCRoleBinding := NewServiceAccountSCCRoleBinding(saNamespace, resNames.CommonName, resNames.ServiceAccount, owner)\n\treturn reconcile.RoleBinding(er, k8sClient, desiredSCCRoleBinding)\n}", "title": "" }, { "docid": "a3474d4bdd9b0bfdaabe622d99c12665", "score": "0.5718753", "text": "func (r *DeploymentReconciler) Reconcile(o types.NamespacedName, generatorFn DeploymentGeneratorFn) (reconcile.Result, error) {\n\n\tdeployment := &appsv1.Deployment{}\n\terr := r.client.Get(r.ctx, types.NamespacedName{Name: o.Name, Namespace: o.Namespace}, deployment)\n\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\tr.logger.V(1).Info(\"Deployment not found\")\n\t\t\tdeployment := generatorFn()\n\t\t\tif err := controllerutil.SetControllerReference(r.owner, deployment, r.scheme); err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t\tif err := r.client.Create(r.ctx, deployment); err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t\tr.logger.Info(\"Created Deployment\")\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tdesired := generatorFn()\n\n\tupdated, err := r.reconcileDeployment(deployment, desired)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif updated {\n\t\tif err := r.client.Update(r.ctx, deployment); err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tr.logger.Info(\"Deployment Updated\")\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "3562d71270b8bebf063431d56f91c196", "score": "0.5717814", "text": "func (a *applicationPlanReconciler) Reconcile() error {\n\ttaskRunner := helper.NewTaskRunner(nil, a.logger)\n\ttaskRunner.AddTask(\"SyncPlan\", a.syncPlan)\n\ttaskRunner.AddTask(\"SyncLimits\", a.syncLimits)\n\ttaskRunner.AddTask(\"SyncPricingRules\", a.syncPricingRules)\n\n\terr := taskRunner.Run()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "95b7f1f0db9376560fb68667d4a98394", "score": "0.57130915", "text": "func (r *ManagedResourceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\t_ = r.Log.WithValues(\"managedresource\", req.NamespacedName)\n\n\t// Get managed resource k8s object\n\tmanagedResource := &paasv1beta1.ManagedResource{}\n\tif err := r.Get(ctx, req.NamespacedName, managedResource); err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\tlog.Error(err)\n\t\t}\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\t// Process object source\n\t_, _, managedObject, managedObjectKey, err := utils.ProcessSource(managedResource.Spec.Source)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tmanagedObjectFinalizer := \"managedobject.finalizers.managedresources.paas.il\"\n\n\t// Delete the managed object if its CR is being deleted\n\tif !managedResource.DeletionTimestamp.IsZero() && controllerutil.ContainsFinalizer(managedResource, managedObjectFinalizer) {\n\t\tcontrollerutil.RemoveFinalizer(managedResource, managedObjectFinalizer)\n\n\t\t// Delete object if it exists\n\t\tif err := r.Client.Delete(ctx, managedObject); err != nil && !apierrors.IsNotFound(err) {\n\t\t\tlog.Error(err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Update finalizers field for CR\n\t\tif err := r.Client.Update(ctx, managedResource); err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Add finalizer for managed resource\n\tcontrollerutil.AddFinalizer(managedResource, managedObjectFinalizer)\n\n\t// Annotate managed object with its owner namespace and name\n\tmanagedResourceAnnotations := managedObject.(controllerutil.Object).GetAnnotations()\n\tif managedResourceAnnotations == nil {\n\t\tmanagedResourceAnnotations = make(map[string]string)\n\t}\n\tmanagedResourceAnnotations[utils.ManagedResourceAnnotation] = req.NamespacedName.String()\n\tmanagedObject.(controllerutil.Object).SetAnnotations(managedResourceAnnotations)\n\n\t// Try getting object from cluster\n\tclusterObject := managedObject.DeepCopyObject()\n\tif err = r.Client.Get(ctx, managedObjectKey, clusterObject); err != nil {\n\n\t\tif apierrors.IsNotFound(err) {\n\n\t\t\t// Create the managed object\n\t\t\tif err := r.Client.Create(ctx, managedObject); err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\treturn ctrl.Result{}, errors.New(\"an error occurred while trying to create the object: \" + err.Error())\n\t\t\t}\n\n\t\t} else {\n\t\t\tlog.Error(err)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t} else {\n\n\t\t// Insert .metadata.resourceVersion field into managed object\n\t\tmanagedObject.(controllerutil.Object).SetResourceVersion(clusterObject.(controllerutil.Object).GetResourceVersion())\n\n\t\t// Update the managed object\n\t\tif err := r.Client.Update(ctx, managedObject); err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn ctrl.Result{}, errors.New(\"an error occurred while trying to update the object: \" + err.Error())\n\t\t}\n\t}\n\n\t// Update managed resource with finalizer field\n\tif err := r.Update(context.Background(), managedResource); err != nil {\n\t\tlog.Error(err)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "f8ecabfe539e1c7a059e943235ad6ed1", "score": "0.5709532", "text": "func (r *RedisClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", req.Namespace, \"Request.Name\", req.Name)\n\treqLogger.Info(\"Reconciling RedisCluster\")\n\n\t// Fetch the RedisCluster instance\n\tinstance := &redisv1beta1.RedisCluster{}\n\terr := r.Client.Get(ctx, req.NamespacedName, instance)\n\tif err != nil {\n\t\treqLogger.Info(\"Error when retrieving namespaced name\", \"namespacedName\", req.NamespacedName)\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\treqLogger.Info(\"RedisCluster delete\")\n\t\t\tinstance.Namespace = req.NamespacedName.Namespace\n\t\t\tinstance.Name = req.NamespacedName.Name\n\t\t\tr.handler.metaCache.Del(instance)\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\treqLogger.V(5).Info(fmt.Sprintf(\"RedisCluster Spec:\\n %+v\", instance))\n\n\tif err = r.handler.Do(instance); err != nil {\n\t\tif err.Error() == needRequeueMsg {\n\t\t\treturn ctrl.Result{RequeueAfter: 20 * time.Second}, nil\n\t\t}\n\t\treqLogger.Error(err, \"Reconcile handler\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err = r.handler.rcChecker.CheckSentinelReadyReplicas(instance); err != nil {\n\t\treqLogger.Info(err.Error())\n\t\treturn ctrl.Result{RequeueAfter: 20 * time.Second}, nil\n\t}\n\n\treturn ctrl.Result{RequeueAfter: time.Duration(reconcileTime) * time.Second}, nil\n}", "title": "" }, { "docid": "4d127128a4f134ba83041ba61183dbdd", "score": "0.5707078", "text": "func (r *FruitsCatalogGReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\t//ctx := context.Background()\n\treqLogger := r.Log.WithValues(\"fruitscatalogg\", req.NamespacedName)\n\n\t// your logic here\n\treqLogger.Info(\"Starting reconcile loop for \" + req.NamespacedName.Name)\n\t// Fetch the FruitsCatalogG instance of this reconcile request.\n\tinstance := &redhatcomv1alpha1.FruitsCatalogG{}\n\terr := r.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif apierrors.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\treqLogger.Info(\"FruitsCatalogG resource not found. Ignoring since object must be deleted.\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treqLogger.Error(err, \"Failed to get FruitsCatalogG.\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check if the FruitsCatalogG instance is marked to be deleted, which is\n\t// indicated by the deletion timestamp being set.\n\tisFruitsCatalogGMarkedToBeDeleted := instance.GetDeletionTimestamp() != nil\n\tif isFruitsCatalogGMarkedToBeDeleted {\n\t\tif contains(instance.GetFinalizers(), \"finalizer.fruitscatalogg.redhat.com\") {\n\t\t\t// Run finalization logic for finalizer. If the\n\t\t\t// finalization logic fails, don't remove the finalizer so\n\t\t\t// that we can retry during the next reconciliation.\n\t\t\tif err := r.finalizeFruitsCatalogG(reqLogger, instance); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\t// Remove finalizer. Once all finalizers have been\n\t\t\t// removed, the object will be deleted.\n\t\t\tcontrollerutil.RemoveFinalizer(instance, \"finalizer.fruitscatalogg.redhat.com\")\n\t\t\terr := r.Update(context.TODO(), instance)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Ensure all required resources are up-to-date.\n\tinstallMongodb := instance.Spec.MongoDB.Install\n\tif installMongodb {\n\t\t// Deal with MongoDB connection credentials.\n\t\tmongodbSecret := deployment.CreateSecretForMongoDB(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, mongodbSecret, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), mongodbSecret); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbSecret.Name+\" Secret\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Create \" + mongodbSecret.Name + \" Secret for MongoDB connection details\")\n\t\t\tinstance.Status.Secret = mongodbSecret.Name + \" is holding connection details to MongoDB\"\n\t\t}\n\n\t\t// Deal with MongoDB persistentn volume.\n\t\tif instance.Spec.MongoDB.Persistent {\n\t\t\tmongodbPVC := deployment.CreatePersistentVolumeClaimMongoDB(&instance.Spec, instance.Namespace)\n\t\t\tcontrollerutil.SetControllerReference(instance, mongodbPVC, r.Scheme)\n\t\t\tif err := r.Client.Create(context.TODO(), mongodbPVC); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbPVC.Name+\" PVC\")\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t} else if err == nil {\n\t\t\t\treqLogger.Info(\"Apply \" + mongodbPVC.Name + \" PVC for MongoDB\")\n\t\t\t}\n\t\t}\n\n\t\t// Deal with MongoDB deployment and service.\n\t\tmongodbDeployment := deployment.CreateDeploymentForMongoDB(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, mongodbDeployment, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), mongodbDeployment); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbDeployment.Name+\" Deployment\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Apply \" + mongodbDeployment.Name + \" Deployment for MongoDB\")\n\t\t\tinstance.Status.MongoDB = mongodbDeployment.Name + \" is the Deployment for MongoDB\"\n\t\t}\n\t\tmongodbService := deployment.CreateServiceForMongoDB(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, mongodbService, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), mongodbService); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+mongodbService.Name+\" Service\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Apply \" + mongodbService.Name + \" Service for MongoDB\")\n\t\t}\n\t}\n\n\t// Deal with WebApp deployment and service.\n\twebappDeployment := deployment.CreateDeploymentForWebapp(&instance.Spec, instance.Namespace)\n\tcontrollerutil.SetControllerReference(instance, webappDeployment, r.Scheme)\n\tif err := r.Client.Create(context.TODO(), webappDeployment); err != nil && !errors.IsAlreadyExists(err) {\n\t\treqLogger.Error(err, \"Error while creating \"+webappDeployment.Name+\" Deployment\")\n\t\treturn ctrl.Result{}, err\n\t} else if err != nil && errors.IsAlreadyExists(err) {\n\t\t// Check if we got the correct number of replicas.\n\t\tif *webappDeployment.Spec.Replicas != instance.Spec.WebApp.ReplicaCount {\n\t\t\twebappDeployment.Spec.Replicas = &instance.Spec.WebApp.ReplicaCount\n\t\t\tif err2 := r.Client.Update(context.TODO(), webappDeployment); err2 != nil {\n\t\t\t\treqLogger.Error(err2, \"Error while updating replicas in \"+webappDeployment.Name+\" Deployment\")\n\t\t\t\treturn ctrl.Result{}, err2\n\t\t\t} else if err2 == nil {\n\t\t\t\treqLogger.Info(\"Update replicas \" + webappDeployment.Name + \" Deployment for WebApp\")\n\t\t\t\tinstance.Status.WebApp = webappDeployment.Name + \" is the Deployment for WebApp\"\n\t\t\t}\n\t\t}\n\t} else if err == nil {\n\t\treqLogger.Info(\"Apply \" + webappDeployment.Name + \" Deployment for WebApp\")\n\t\tinstance.Status.WebApp = webappDeployment.Name + \" is the Deployment for WebApp\"\n\t}\n\twebappService := deployment.CreateServiceForWebapp(&instance.Spec, instance.Namespace)\n\tcontrollerutil.SetControllerReference(instance, webappService, r.Scheme)\n\tif err := r.Client.Create(context.TODO(), webappService); err != nil && !errors.IsAlreadyExists(err) {\n\t\treqLogger.Error(err, \"Error while creating \"+webappService.Name+\" Service\")\n\t\treturn ctrl.Result{}, err\n\t} else if err == nil {\n\t\treqLogger.Info(\"Apply \" + webappService.Name + \" Service for WebApp\")\n\t}\n\n\t// Finally check if we're on OpenShift of Vanilla Kubernetes.\n\tisOpenShift := false\n\n\t// The discovery package is used to discover APIs supported by a Kubernetes API server.\n\tconfig, err := ctrl.GetConfig()\n\tif err == nil && config != nil {\n\t\tdclient, err := getDiscoveryClient(config)\n\t\tif err == nil && dclient != nil {\n\t\t\tapiGroupList, err := dclient.ServerGroups()\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Info(\"Error while querying ServerGroups, assuming we're on Vanilla Kubernetes\")\n\t\t\t} else {\n\t\t\t\tfor i := 0; i < len(apiGroupList.Groups); i++ {\n\t\t\t\t\tif strings.HasSuffix(apiGroupList.Groups[i].Name, \".openshift.io\") {\n\t\t\t\t\t\tisOpenShift = true\n\t\t\t\t\t\treqLogger.Info(\"We detected being on OpenShift! Wouhou!\")\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} else {\n\t\t\treqLogger.Info(\"Cannot retrieve a DiscoveryClient, assuming we're on Vanilla Kubernetes\")\n\t\t}\n\t}\n\t// Create a Route if we're on OpenShift ;-)\n\tif isOpenShift {\n\t\tappRoute := deployment.CreateRouteForWebapp(&instance.Spec, instance.Namespace)\n\t\tcontrollerutil.SetControllerReference(instance, appRoute, r.Scheme)\n\t\tif err := r.Client.Create(context.TODO(), appRoute); err != nil && !errors.IsAlreadyExists(err) {\n\t\t\treqLogger.Error(err, \"Error while creating \"+appRoute.Name+\" Route\")\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if err == nil {\n\t\t\treqLogger.Info(\"Apply \" + appRoute.Name + \" Route for WebApp\")\n\t\t}\n\n\t\t// Maybe on next reconciliation loop ?\n\t\treqLogger.Info(\"Looking for route \" + appRoute.ObjectMeta.Name + \" on namespace \" + instance.Namespace)\n\t\terr = r.Client.Get(context.TODO(), types.NamespacedName{Name: appRoute.ObjectMeta.Name, Namespace: instance.Namespace}, appRoute)\n\t\tif err == nil {\n\t\t\tinstance.Status.Route = appRoute.Status.Ingress[0].Host\n\t\t} else {\n\t\t\treqLogger.Error(err, \"Error while reading Route for getting its Status.Ingress[0].Host field\")\n\t\t}\n\t}\n\n\t// Updating the Status that is modeled as a subresource. This way we can update\n\t// the status of our resources without increasing the ResourceGeneration metadata field.\n\tr.Status().Update(context.Background(), instance)\n\n\t// end of logic block\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "0dc90e675bb0d3283ccd1dcb006d9ef0", "score": "0.5705845", "text": "func (r *NicClusterPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := r.Log.WithValues(\"nicclusterpolicy\", req.NamespacedName)\n\treqLogger.V(consts.LogLevelInfo).Info(\"Reconciling NicClusterPolicy\")\n\n\t// Fetch the NicClusterPolicy instance\n\tinstance := &mellanoxv1alpha1.NicClusterPolicy{}\n\terr := r.Get(context.TODO(), req.NamespacedName, instance)\n\tif err != nil {\n\t\tif apiErrors.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\treqLogger.V(consts.LogLevelError).Info(\"Error occurred on GET CRD request from API server.\", \"error:\", err)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif req.Name != consts.NicClusterPolicyResourceName {\n\t\terr := r.handleUnsupportedInstance(instance, req, reqLogger)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Create a new State service catalog\n\tsc := state.NewInfoCatalog()\n\tif instance.Spec.OFEDDriver != nil || instance.Spec.NVPeerDriver != nil ||\n\t\tinstance.Spec.RdmaSharedDevicePlugin != nil {\n\t\t// Create node infoProvider and add to the service catalog\n\t\treqLogger.V(consts.LogLevelInfo).Info(\"Creating Node info provider\")\n\t\tnodeList := &corev1.NodeList{}\n\t\terr = r.List(context.TODO(), nodeList, nodeinfo.MellanoxNICListOptions...)\n\t\tif err != nil {\n\t\t\t// Failed to get node list\n\t\t\treqLogger.V(consts.LogLevelError).Info(\"Error occurred on LIST nodes request from API server.\", \"error:\", err)\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tnodePtrList := make([]*corev1.Node, len(nodeList.Items))\n\t\tnodeNames := make([]*string, len(nodeList.Items))\n\t\tfor i := range nodePtrList {\n\t\t\tnodePtrList[i] = &nodeList.Items[i]\n\t\t\tnodeNames[i] = &nodeList.Items[i].Name\n\t\t}\n\t\treqLogger.V(consts.LogLevelDebug).Info(\"Node info provider with\", \"Nodes:\", nodeNames)\n\t\tinfoProvider := nodeinfo.NewProvider(nodePtrList)\n\t\tsc.Add(state.InfoTypeNodeInfo, infoProvider)\n\t}\n\t// Create manager\n\tmanagerStatus, err := r.stateManager.SyncState(instance, sc)\n\tr.updateCrStatus(instance, managerStatus)\n\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\terr = r.updateNodeLabels(instance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif managerStatus.Status != state.SyncStateReady {\n\t\treturn reconcile.Result{\n\t\t\tRequeueAfter: time.Duration(config.FromEnv().Controller.RequeueTimeSeconds) * time.Second,\n\t\t}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "040c54453baf2140e05065e227979231", "score": "0.57008", "text": "func (r *ClusterServiceVersionReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := r.Log.WithValues(\"Request.Name\", request.Name, \"Request.Namespace\", request.Namespace)\n\treqLogger.Info(\"Reconciling ClusterServiceVersion\")\n\t// Fetch the ClusterServiceVersion instance\n\tCSV := &olmv1alpha1.ClusterServiceVersion{}\n\terr := r.Client.Get(context.TODO(), request.NamespacedName, CSV)\n\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\treqLogger.Error(err, \"clusterserviceversion does not exist\")\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\treqLogger.Error(err, \"Failed to get clusterserviceversion\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tannotations := CSV.GetAnnotations()\n\tif annotations == nil {\n\t\tannotations = make(map[string]string)\n\t}\n\n\t// check if CSV is being deleted\n\t// if yes -> finalizer logic\n\t// if no -> do nothing\n\tif !CSV.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t//Run finalization logic for the CSV.\n\t\tresult, isReconcile, err := r.finalizeCSV(CSV)\n\t\tif isReconcile {\n\t\t\treturn result, err\n\t\t}\n\t}\n\n\tresult, isRequeue, err := r.reconcileMeterDefAnnotation(CSV, annotations)\n\n\t// check if err is instance of json.parsing error\n\t// if yes -> add failiure annotation\n\n\tif isRequeue {\n\t\treturn result, err\n\t}\n\tsub := &olmv1alpha1.SubscriptionList{}\n\n\tif err := r.Client.List(context.TODO(), sub, client.InNamespace(request.NamespacedName.Namespace)); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\thasMarketplaceSub := false\n\tif len(sub.Items) > 0 {\n\t\treqLogger.V(4).Info(\"found Subscription in namespaces\", \"count\", len(sub.Items))\n\t\t// add razee watch label to CSV if subscription has rhm/operator label\n\t\tfor _, s := range sub.Items {\n\t\t\tif value, ok := s.GetLabels()[operatorTag]; ok {\n\t\t\t\tif value == \"true\" {\n\t\t\t\t\tif len(s.Status.InstalledCSV) == 0 {\n\t\t\t\t\t\treqLogger.Info(\"Requeue clusterserviceversion to wait for subscription getting installedCSV updated\")\n\t\t\t\t\t\treturn reconcile.Result{RequeueAfter: time.Second * 5}, nil\n\t\t\t\t\t}\n\n\t\t\t\t\tif s.Status.InstalledCSV == request.NamespacedName.Name {\n\t\t\t\t\t\treqLogger.Info(\"found Subscription with installed CSV\")\n\t\t\t\t\t\thasMarketplaceSub = true\n\n\t\t\t\t\t\tif v, ok := CSV.GetLabels()[watchTag]; !ok || v != \"lite\" {\n\t\t\t\t\t\t\terr := retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\t\t\t\t\t\t\terr := r.Client.Get(context.TODO(),\n\t\t\t\t\t\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\t\t\t\t\t\tName: CSV.GetName(),\n\t\t\t\t\t\t\t\t\t\tNamespace: CSV.GetNamespace(),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tCSV)\n\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tlabels := CSV.GetLabels()\n\n\t\t\t\t\t\t\t\tif labels == nil {\n\t\t\t\t\t\t\t\t\tlabels = make(map[string]string)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tlabels[watchTag] = \"lite\"\n\t\t\t\t\t\t\t\tCSV.SetLabels(labels)\n\n\t\t\t\t\t\t\t\treturn r.Client.Update(context.TODO(), CSV)\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treqLogger.Error(err, \"Failed to patch clusterserviceversion with razee/watch-resource: lite label\")\n\t\t\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treqLogger.Info(\"Patched clusterserviceversion with razee/watch-resource: lite label\")\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\treqLogger.Info(\"No patch needed on clusterserviceversion resource\")\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} else {\n\t\treqLogger.Info(\"Did not find Subscription in namespaces\")\n\t}\n\n\tif !hasMarketplaceSub {\n\t\treqLogger.Info(\"Does not have marketplace sub, ignoring CSV for future\")\n\t\tif v, ok := CSV.GetAnnotations()[ignoreTag]; !ok || v != ignoreTagValue {\n\t\t\tretryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\t\t\terr := r.Client.Get(context.TODO(),\n\t\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\t\tName: CSV.GetName(),\n\t\t\t\t\t\tNamespace: CSV.GetNamespace(),\n\t\t\t\t\t},\n\t\t\t\t\tCSV)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tannotations := CSV.GetAnnotations()\n\n\t\t\t\tif annotations == nil {\n\t\t\t\t\tannotations = make(map[string]string)\n\t\t\t\t}\n\n\t\t\t\tannotations[ignoreTag] = ignoreTagValue\n\t\t\t\tCSV.SetAnnotations(annotations)\n\n\t\t\t\treturn r.Client.Update(context.TODO(), CSV)\n\t\t\t})\n\n\t\t\tif retryErr != nil {\n\t\t\t\treqLogger.Error(retryErr, \"Failed to patch clusterserviceversion ignore tag\")\n\t\t\t\treturn reconcile.Result{Requeue: true}, retryErr\n\t\t\t}\n\t\t\treqLogger.V(4).Info(\"Patched clusterserviceversion with ignore tag\")\n\t\t} else {\n\t\t\treqLogger.V(4).Info(\"No patch needed on clusterserviceversion resource for ignore tag\")\n\t\t}\n\t}\n\n\treqLogger.Info(\"reconcilation complete\")\n\treturn reconcile.Result{RequeueAfter: time.Minute * 1}, nil\n}", "title": "" }, { "docid": "83e66cf84c70daa99b47d688419d6d10", "score": "0.56949383", "text": "func (r *ConfigAuditReportReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t// your logic here\n\t// Fetch the ConfigAuditReport instance\n\tinstance := &aquasecurityv1alpha1.ConfigAuditReport{}\n\terr := r.Client.Get(context.TODO(), req.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\tworkloadInfo, err := r.getWorkloadInfo(instance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// if !instance.ObjectMeta.DeletionTimestamp.IsZero() {\n\t// \t// The object is not being deleted, so do nothing\n\t// \tlogger.Info(\"Remove the original report\")\n\t// \tlogger.Info(\"workloadInfo\")\n\t// \terr := r.removeReport(workloadInfo)\n\t// \tif err != nil {\n\t// \t\treturn reconcile.Result{}, err\n\t// \t}\n\t// \treturn reconcile.Result{}, nil\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 !containsString(instance.GetFinalizers(), finalizerName) {\n\t\t\taddFinalizer(instance, finalizerName)\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\tif containsString(instance.GetFinalizers(), finalizerName) {\n\t\t\t// our finalizer is present, so lets handle any external dependency\n\t\t\tif err := r.removeReport(workloadInfo); err != nil {\n\t\t\t\t// if fail to delete the external dependency here, return with error\n\t\t\t\t// so that it can be retried\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\n\t\t\t// remove our finalizer from the list and update it.\n\t\t\tremoveFinalizer(instance, finalizerName)\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\n\t\t// Stop reconciliation as the item is being deleted\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\terr = r.generateReport(ctx, workloadInfo)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "188cd20952ab7f683c412f53e62db897", "score": "0.56939244", "text": "func (a dpCtrl) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tlogger := log.WithFields(log.Fields{\n\t\t\"name\": request.NamespacedName.Name,\n\t\t\"namespace\": request.NamespacedName.Namespace,\n\t})\n\tlogger.Debug(\"attempting to reconcile the application deployment\")\n\n\tapp := &appsv1.AppDeployment{}\n\tif err := a.mgr.GetClient().Get(context.Background(), request.NamespacedName, app); err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "37861ce05e96ff7970aca3956db804ba", "score": "0.5692717", "text": "func (r *ChartGroupReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {\n\treclog := acglog.WithValues(\"namespace\", request.Namespace, \"acg\", request.Name)\n\treclog.Info(\"Reconciling\")\n\n\tinstance := &av1.ArmadaChartGroup{}\n\tinstance.SetNamespace(request.Namespace)\n\tinstance.SetName(request.Name)\n\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\n\tif apierrors.IsNotFound(err) {\n\t\t// We are working asynchronously. By the time we receive the event,\n\t\t// the object is already gone\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tif err != nil {\n\t\treclog.Error(err, \"Failed to lookup ArmadaChartGroup\")\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tinstance.Init()\n\tmgr := r.managerFactory.NewArmadaChartGroupManager(instance)\n\treclog = reclog.WithValues(\"acg\", mgr.ResourceName())\n\n\tvar shouldRequeue bool\n\tif shouldRequeue, err = r.updateFinalizers(instance); shouldRequeue {\n\t\t// Need to requeue because finalizer update does not change metadata.generation\n\t\treturn reconcile.Result{Requeue: true}, err\n\t}\n\n\tif err := r.ensureSynced(mgr, instance); err != nil {\n\t\tif !instance.IsDeleted() {\n\t\t\t// TODO(jeb): Changed the behavior to stop only if we are not\n\t\t\t// in a delete phase.\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t}\n\n\tif instance.IsDeleted() {\n\t\tif shouldRequeue, err = r.deleteArmadaChartGroup(mgr, instance); shouldRequeue {\n\t\t\t// Need to requeue because finalizer update does not change metadata.generation\n\t\t\treturn reconcile.Result{Requeue: true}, err\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif instance.IsTargetStateUninitialized() {\n\t\treclog.Info(\"TargetState uninitialized; skipping\")\n\t\terr = r.updateResource(instance)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\terr = r.client.Status().Update(context.TODO(), instance)\n\t\treturn reconcile.Result{}, err\n\t}\n\n\thrc := av1.HelmResourceCondition{\n\t\tType: av1.ConditionInitialized,\n\t\tStatus: av1.ConditionStatusTrue,\n\t}\n\tinstance.Status.SetCondition(hrc, instance.Spec.TargetState)\n\n\tswitch {\n\tcase !mgr.IsInstalled():\n\t\tif shouldRequeue, err = r.installArmadaChartGroup(mgr, instance); shouldRequeue {\n\t\t\t// we updated the ownership of the charts. Let's wake up\n\t\t\t// one more time later to enable the first chart.\n\t\t\treturn reconcile.Result{RequeueAfter: r.reconcilePeriod}, err\n\t\t}\n\t\treturn reconcile.Result{}, err\n\tcase mgr.IsUpdateRequired():\n\t\tif shouldRequeue, err = r.updateArmadaChartGroup(mgr, instance); shouldRequeue {\n\t\t\treturn reconcile.Result{RequeueAfter: r.reconcilePeriod}, err\n\t\t}\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tforcedRequeue, err := r.reconcileArmadaChartGroup(mgr, instance)\n\tif err != nil {\n\t\t// Let's don't force a requeue.\n\t\treturn reconcile.Result{}, err\n\t}\n\tif forcedRequeue {\n\t\t// We have been waked up out of order ?\n\t\treturn reconcile.Result{RequeueAfter: r.reconcilePeriod}, nil\n\t}\n\n\treclog.Info(\"Reconciled ChartGroup\")\n\tif err = r.updateResourceStatus(instance); err != nil {\n\t\treturn reconcile.Result{Requeue: true}, err\n\t}\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "7b4a0a0f4c044003f988ebee79bc4358", "score": "0.5692224", "text": "func (r *MilvusClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tif !config.IsDebug() {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tr.logger.Error(err.(error), \"reconcile panic\")\n\t\t\t}\n\t\t}()\n\t}\n\n\tmilvuscluster := &milvusiov1alpha1.MilvusCluster{}\n\tif err := r.Get(ctx, req.NamespacedName, milvuscluster); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// The resource may have be deleted after reconcile request coming in\n\t\t\t// Reconcile is done\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\treturn ctrl.Result{}, fmt.Errorf(\"error get milvus cluster: %w\", err)\n\t}\n\n\t// Finalize\n\tif milvuscluster.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tif !controllerutil.ContainsFinalizer(milvuscluster, MCFinalizerName) {\n\t\t\tcontrollerutil.AddFinalizer(milvuscluster, MCFinalizerName)\n\t\t\tif err := r.Update(ctx, milvuscluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tif controllerutil.ContainsFinalizer(milvuscluster, MCFinalizerName) {\n\t\t\tif err := r.Finalize(ctx, *milvuscluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\tcontrollerutil.RemoveFinalizer(milvuscluster, MCFinalizerName)\n\t\t\tif err := r.Update(ctx, milvuscluster); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\t// Stop reconciliation as the item is being deleted\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Start reconcile\n\tr.logger.Info(\"start reconcile\")\n\told := milvuscluster.DeepCopy()\n\n\tif err := r.SetDefault(ctx, milvuscluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif !IsEqual(old.Spec, milvuscluster.Spec) {\n\t\treturn ctrl.Result{}, r.Update(ctx, milvuscluster)\n\t}\n\n\tif err := r.ReconcileAll(ctx, *milvuscluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := r.UpdateStatus(ctx, milvuscluster); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif milvuscluster.Status.Status == v1alpha1.StatusUnHealthy {\n\t\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n\t}\n\n\tif config.IsDebug() {\n\t\tdiff, err := client.MergeFrom(old).Data(milvuscluster)\n\t\tif err != nil {\n\t\t\tr.logger.Info(\"Update diff\", \"diff\", string(diff))\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "cf9ba8d280f7b6f1ca54addd67025e58", "score": "0.5687043", "text": "func (c *Client) Reconcile(podCIDRs []string) error {\n\t// TODO add an IPSet for migrated routes for reconciliation too.\n\n\tdesiredPodCIDRs := sets.NewString(podCIDRs...)\n\n\t// Remove orphaned podCIDRs from antreaPodIPSet.\n\tentries, err := ipset.ListEntries(antreaPodIPSet)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, entry := range entries {\n\t\tif desiredPodCIDRs.Has(entry) {\n\t\t\tcontinue\n\t\t}\n\t\tklog.V(4).Infof(\"Deleting orphaned ip %s from ipset\", entry)\n\t\tif err := ipset.DelEntry(antreaPodIPSet, entry); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Remove orphaned routes from host network.\n\tactualRouteMap, err := c.listIPRoutes()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing ip routes: %v\", err)\n\t}\n\tfor podCIDR, actualRoutes := range actualRouteMap {\n\t\tif desiredPodCIDRs.Has(podCIDR) {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, route := range actualRoutes {\n\t\t\tklog.V(4).Infof(\"Deleting orphaned route %v\", route)\n\t\t\tif err := netlink.RouteDel(route); err != nil && err != unix.ESRCH {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9f17712ed3d67fa3efd6dd88f592f2e", "score": "0.5666128", "text": "func (r *DaemonSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqNamespace := req.NamespacedName.Namespace\n\tif reqNamespace != KubeNs && reqNamespace != ControllerNs {\n\t\tr.Log.WithValues(\"daemonset\", req.NamespacedName)\n\t\tdaemonsets := &appsv1.DaemonSet{}\n\t\terr := r.Get(context.TODO(), req.NamespacedName, daemonsets)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tif isDaemonSetReady(daemonsets) {\n\t\t\tcontainers := daemonsets.Spec.Template.Spec.Containers\n\t\t\tfor i, c := range containers {\n\t\t\t\tif isImagePresent(c.Image) {\n\t\t\t\t\tvar msg string\n\t\t\t\t\tmsg = fmt.Sprintf(\"Retagging image %s of daemonset: %s\", c.Image, daemonsets.Name)\n\t\t\t\t\tsetupLog.Info(msg)\n\t\t\t\t\timg, err := images.Process(c.Image)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tmsg = fmt.Sprintf(\"Failed to process image: %s\", img)\n\t\t\t\t\t\tsetupLog.Error(err, msg)\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t\t// update image\n\t\t\t\t\tmsg = fmt.Sprintf(\"Updating image %s of daemonset: %s\", c.Image, daemonsets.Name)\n\t\t\t\t\tsetupLog.Info(msg)\n\t\t\t\t\tdaemonsets.Spec.Template.Spec.Containers[i].Image = img\n\t\t\t\t\terr = r.Update(context.TODO(), daemonsets)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t\tmsg = fmt.Sprintf(\"Updated image: %s -> %s\", c.Image, img)\n\t\t\t\t\tsetupLog.Info(msg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "f176f24cecc512b2013f04b347391de9", "score": "0.5647125", "text": "func (r *LimitadorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqLogger := r.Logger().WithValues(\"limitador\", req.NamespacedName)\n\treqLogger.V(1).Info(\"Reconciling Limitador\")\n\n\t// Delete Limitador deployment and service if needed\n\tlimitadorObj := &limitadorv1alpha1.Limitador{}\n\tif err := r.Client().Get(ctx, req.NamespacedName, limitadorObj); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// The deployment and the service should be deleted automatically\n\t\t\t// because they have an owner ref to Limitador\n\t\t\treturn ctrl.Result{}, nil\n\t\t} else {\n\t\t\treqLogger.Error(err, \"Failed to get Limitador object.\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\tif limitadorObj.GetDeletionTimestamp() != nil { // Marked to be deleted\n\t\treqLogger.V(1).Info(\"marked to be deleted\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tlimitadorService := limitador.LimitadorService(limitadorObj)\n\terr := r.ReconcileService(ctx, limitadorService, reconcilers.CreateOnlyMutator)\n\treqLogger.V(1).Info(\"reconcile service\", \"error\", err)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdeployment := limitador.LimitadorDeployment(limitadorObj)\n\terr = r.ReconcileDeployment(ctx, deployment, mutateLimitadorDeployment)\n\treqLogger.V(1).Info(\"reconcile deployment\", \"error\", err)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "eb9f50baf2f9480912c9557680cbbd65", "score": "0.5640206", "text": "func (r *GatekeeperReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlogger := r.Log.WithValues(\"gatekeeper\", req.NamespacedName)\n\tlogger.Info(\"Reconciling Gatekeeper\")\n\n\tif req.Name != defaultGatekeeperCrName {\n\t\terr := fmt.Errorf(\"Gatekeeper resource name must be '%s'\", defaultGatekeeperCrName)\n\t\tlogger.Error(err, \"Invalid Gatekeeper resource name\")\n\t\t// Return success to avoid requeue\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tgatekeeper := &operatorv1alpha1.Gatekeeper{}\n\terr := r.Get(ctx, req.NamespacedName, gatekeeper)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tisGatekeeperMarkedToBeDeleted := gatekeeper.GetDeletionTimestamp() != nil\n\tif isGatekeeperMarkedToBeDeleted {\n\t\tif sets.NewString(gatekeeper.GetFinalizers()...).Has(gatekeeperFinalizer) {\n\n\t\t\tif err := r.finalizeGatekeeper(logger, gatekeeper); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\n\t\t\tcontrollerutil.RemoveFinalizer(gatekeeper, gatekeeperFinalizer)\n\t\t\terr := r.Update(ctx, gatekeeper)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif !sets.NewString(gatekeeper.GetFinalizers()...).Has(gatekeeperFinalizer) {\n\t\tif err := r.addFinalizer(logger, gatekeeper); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\terr = r.deployGatekeeperResources(gatekeeper)\n\tif err != nil {\n\t\treturn ctrl.Result{}, errors.Wrap(err, \"Unable to deploy Gatekeeper resources\")\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "4fa5eef5228d829fb33e2713e10d3e2a", "score": "0.56377655", "text": "func (r *AtReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := ctrllog.FromContext(ctx)\n\treqLogger := log.WithValues(\"namespace\", req.Namespace, \"at\", req.Name)\n\treqLogger.Info(\"=== Reconciling At\")\n\t// Fetch the At instance\n\tinstance := &cnatv1alpha1.At{}\n\terr := r.Get(context.TODO(), req.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 - return and don't requeue:\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request:\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// If no phase set, default to pending (the initial phase):\n\tif instance.Status.Phase == \"\" {\n\t\tinstance.Status.Phase = cnatv1alpha1.PhasePending\n\t}\n\n\t// Now let's make the main case distinction: implementing\n\t// the state diagram PENDING -> RUNNING -> DONE\n\tswitch instance.Status.Phase {\n\tcase cnatv1alpha1.PhasePending:\n\t\treqLogger.Info(\"Phase: PENDING\")\n\t\t// As long as we haven't executed the command yet, we need to check if it's time already to act:\n\t\treqLogger.Info(\"Checking schedule\", \"Target\", instance.Spec.Schedule)\n\t\t// Check if it's already time to execute the command with a tolerance of 2 seconds:\n\t\td, err := timeUntilSchedule(instance.Spec.Schedule)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Schedule parsing failure\")\n\t\t\t// Error reading the schedule. Wait until it is fixed.\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\treqLogger.Info(\"Schedule parsing done\", \"diff\", fmt.Sprintf(\"%v\", d))\n\t\tif d > 0 {\n\t\t\t// Not yet time to execute the command, wait until the scheduled time\n\t\t\treturn reconcile.Result{RequeueAfter: d}, nil\n\t\t}\n\t\treqLogger.Info(\"It's time!\", \"Ready to execute\", instance.Spec.Command)\n\t\tinstance.Status.Phase = cnatv1alpha1.PhaseRunning\n\tcase cnatv1alpha1.PhaseRunning:\n\t\treqLogger.Info(\"Phase: RUNNING\")\n\t\tpod := newPodForCR(instance)\n\t\t// Set At instance as the owner and controller\n\t\tif err := controllerutil.SetControllerReference(instance, pod, r.Scheme); err != nil {\n\t\t\t// requeue with error\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tfound := &corev1.Pod{}\n\t\terr = r.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found)\n\t\t// Try to see if the pod already exists and if not\n\t\t// (which we expect) then create a one-shot pod as per spec:\n\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\terr = r.Create(context.TODO(), pod)\n\t\t\tif err != nil {\n\t\t\t\t// requeue with error\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\treqLogger.Info(\"Pod launched\", \"name\", pod.Name)\n\t\t} else if err != nil {\n\t\t\t// requeue with error\n\t\t\treturn ctrl.Result{}, err\n\t\t} else if found.Status.Phase == corev1.PodFailed || found.Status.Phase == corev1.PodSucceeded {\n\t\t\treqLogger.Info(\"Container terminated\", \"reason\", found.Status.Reason, \"message\", found.Status.Message)\n\t\t\tinstance.Status.Phase = cnatv1alpha1.PhaseDone\n\t\t} else {\n\t\t\t// don't requeue because it will happen automatically when the pod status changes\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\tcase cnatv1alpha1.PhaseDone:\n\t\treqLogger.Info(\"Phase: DONE\")\n\t\treturn ctrl.Result{}, nil\n\tdefault:\n\t\treqLogger.Info(\"NOP\")\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t// Update the At instance, setting the status to the respective phase:\n\terr = r.Status().Update(context.TODO(), instance)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Don't requeue. We should be reconcile because either the pod or the CR changes.\n\n\treturn ctrl.Result{}, nil\n}", "title": "" } ]
4f55499dc8d4c16cf1a7a045835823c7
NewListPager Get the Dapr Components for a managed environment. Generated from API version 20230501 resourceGroupName The name of the resource group. The name is case insensitive. environmentName Name of the Managed Environment. options DaprComponentsClientListOptions contains the optional parameters for the DaprComponentsClient.NewListPager method.
[ { "docid": "51415f1f5e11f3064b1f5517312343fe", "score": "0.72811824", "text": "func (client *DaprComponentsClient) NewListPager(resourceGroupName string, environmentName string, options *DaprComponentsClientListOptions) *runtime.Pager[DaprComponentsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[DaprComponentsClientListResponse]{\n\t\tMore: func(page DaprComponentsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *DaprComponentsClientListResponse) (DaprComponentsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, environmentName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn DaprComponentsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn DaprComponentsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn DaprComponentsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" } ]
[ { "docid": "299203889bbeb11792a0293f2a00b4d4", "score": "0.57258266", "text": "func (client *CredentialSetsClient) NewListPager(resourceGroupName string, registryName string, options *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CredentialSetsClientListResponse]{\n\t\tMore: func(page CredentialSetsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CredentialSetsClientListResponse) (CredentialSetsClientListResponse, error) {\n\t\t\tctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, \"CredentialSetsClient.NewListPager\")\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CredentialSetsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CredentialSetsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CredentialSetsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t\tTracer: client.internal.Tracer(),\n\t})\n}", "title": "" }, { "docid": "82ea45c0bfb855a2879e8773cb2c04f8", "score": "0.5686244", "text": "func (client *SpacecraftsClient) NewListPager(resourceGroupName string, options *SpacecraftsClientListOptions) *runtime.Pager[SpacecraftsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SpacecraftsClientListResponse]{\n\t\tMore: func(page SpacecraftsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SpacecraftsClientListResponse) (SpacecraftsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SpacecraftsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SpacecraftsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SpacecraftsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "115ff3fd24ca830d0c44d1cbb4a5c61d", "score": "0.5659821", "text": "func (client *ProjectsClient) NewListPager(resourceGroupName string, storageMoverName string, options *ProjectsClientListOptions) *runtime.Pager[ProjectsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ProjectsClientListResponse]{\n\t\tMore: func(page ProjectsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ProjectsClientListResponse) (ProjectsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, storageMoverName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ProjectsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ProjectsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ProjectsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "df6ea79abfd95a500688164fc362b0f2", "score": "0.5623932", "text": "func (client *FluxConfigurationsClient) NewListPager(resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, options *FluxConfigurationsClientListOptions) *runtime.Pager[FluxConfigurationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[FluxConfigurationsClientListResponse]{\n\t\tMore: func(page FluxConfigurationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *FluxConfigurationsClientListResponse) (FluxConfigurationsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn FluxConfigurationsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn FluxConfigurationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn FluxConfigurationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "a236bd1acbc97b3f9f6dab69de93eb24", "score": "0.55644447", "text": "func (client *BuildpackBindingClient) NewListPager(resourceGroupName string, serviceName string, buildServiceName string, builderName string, options *BuildpackBindingClientListOptions) *runtime.Pager[BuildpackBindingClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[BuildpackBindingClientListResponse]{\n\t\tMore: func(page BuildpackBindingClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *BuildpackBindingClientListResponse) (BuildpackBindingClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, serviceName, buildServiceName, builderName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn BuildpackBindingClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn BuildpackBindingClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn BuildpackBindingClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "44061be05cd1866d0d4febcc1bf5055f", "score": "0.5560826", "text": "func (client *ManagersClient) NewListPager(options *ManagersClientListOptions) *runtime.Pager[ManagersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ManagersClientListResponse]{\n\t\tMore: func(page ManagersClientListResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ManagersClientListResponse) (ManagersClientListResponse, error) {\n\t\t\treq, err := client.listCreateRequest(ctx, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ManagersClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ManagersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ManagersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "d03ba6bec14b3c53e293633a57340f08", "score": "0.5490489", "text": "func (client *EndpointsClient) NewListPager(resourceGroupName string, storageMoverName string, options *EndpointsClientListOptions) *runtime.Pager[EndpointsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[EndpointsClientListResponse]{\n\t\tMore: func(page EndpointsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *EndpointsClientListResponse) (EndpointsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, storageMoverName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn EndpointsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn EndpointsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn EndpointsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "5e3498ab5896437721b81f908b788408", "score": "0.5488282", "text": "func (client *CertificatesClient) NewListPager(resourceGroupName string, serviceName string, options *CertificatesClientListOptions) *runtime.Pager[CertificatesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CertificatesClientListResponse]{\n\t\tMore: func(page CertificatesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CertificatesClientListResponse) (CertificatesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, serviceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CertificatesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CertificatesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CertificatesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "5ca5d29cce0df5d1e285c7fc6e739f3c", "score": "0.54829586", "text": "func (client *DeploymentOperationsClient) NewListPager(resourceGroupName string, deploymentName string, options *DeploymentOperationsClientListOptions) *runtime.Pager[DeploymentOperationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[DeploymentOperationsClientListResponse]{\n\t\tMore: func(page DeploymentOperationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *DeploymentOperationsClientListResponse) (DeploymentOperationsClientListResponse, error) {\n\t\t\tctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, \"DeploymentOperationsClient.NewListPager\")\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, deploymentName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn DeploymentOperationsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn DeploymentOperationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn DeploymentOperationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t\tTracer: client.internal.Tracer(),\n\t})\n}", "title": "" }, { "docid": "f44031c853255c595497d8c08e3fd597", "score": "0.5480351", "text": "func ExampleManagedEnvironmentsClient_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\tclient, err := armappcontainers.NewManagedEnvironmentsClient(\"8efdecc5-919e-44eb-b179-915dca89ebf9\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByResourceGroupPager(\"examplerg\", nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "742ec13acecc5ce4b56f35c0fafa68b9", "score": "0.54662275", "text": "func (client *VirtualClustersClient) NewListPager(options *VirtualClustersClientListOptions) *runtime.Pager[VirtualClustersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VirtualClustersClientListResponse]{\n\t\tMore: func(page VirtualClustersClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VirtualClustersClientListResponse) (VirtualClustersClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VirtualClustersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "4da4cc335a51eb2c4a89118b05aee203", "score": "0.54564893", "text": "func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{\n\t\tMore: func(page ClustersClientListResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClustersClientListResponse) (ClustersClientListResponse, error) {\n\t\t\treq, err := client.listCreateRequest(ctx, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClustersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "a7f3c9b616bc372dd7bfe863683d3dc0", "score": "0.54424274", "text": "func (client *MembersClient) NewListPager(resourceGroupName string, options *MembersClientListOptions) *runtime.Pager[MembersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[MembersClientListResponse]{\n\t\tMore: func(page MembersClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *MembersClientListResponse) (MembersClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn MembersClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn MembersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn MembersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "db3615b3298da225afb81cec77cb4349", "score": "0.5406713", "text": "func (client *ServerAdministratorsClient) NewListPager(resourceGroupName string, serverName string, options *ServerAdministratorsClientListOptions) *runtime.Pager[ServerAdministratorsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ServerAdministratorsClientListResponse]{\n\t\tMore: func(page ServerAdministratorsClientListResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ServerAdministratorsClientListResponse) (ServerAdministratorsClientListResponse, error) {\n\t\t\treq, err := client.listCreateRequest(ctx, resourceGroupName, serverName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ServerAdministratorsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ServerAdministratorsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ServerAdministratorsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "bf1cf5d64d8b3b3ce0869f4d609d5636", "score": "0.5395364", "text": "func (client *SQLManagedInstancesClient) NewListPager(options *SQLManagedInstancesClientListOptions) *runtime.Pager[SQLManagedInstancesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SQLManagedInstancesClientListResponse]{\n\t\tMore: func(page SQLManagedInstancesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SQLManagedInstancesClientListResponse) (SQLManagedInstancesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SQLManagedInstancesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SQLManagedInstancesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SQLManagedInstancesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "1c6a384127ba8a06adf9a3e1f440ac7b", "score": "0.5393554", "text": "func (client *OpenShiftClustersClient) NewListPager(options *OpenShiftClustersClientListOptions) *runtime.Pager[OpenShiftClustersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[OpenShiftClustersClientListResponse]{\n\t\tMore: func(page OpenShiftClustersClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *OpenShiftClustersClientListResponse) (OpenShiftClustersClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn OpenShiftClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn OpenShiftClustersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn OpenShiftClustersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "97caaebe2c6f001698f6b9b1a4f5e6a8", "score": "0.53595775", "text": "func (client *ReplicationNetworkMappingsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationNetworkMappingsClientListOptions) *runtime.Pager[ReplicationNetworkMappingsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ReplicationNetworkMappingsClientListResponse]{\n\t\tMore: func(page ReplicationNetworkMappingsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ReplicationNetworkMappingsClientListResponse) (ReplicationNetworkMappingsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ReplicationNetworkMappingsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ReplicationNetworkMappingsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ReplicationNetworkMappingsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "3200e340fc6235fae90bdaa21abaef7e", "score": "0.53340584", "text": "func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClientListResponse]{\n\t\tMore: func(page ClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "3200e340fc6235fae90bdaa21abaef7e", "score": "0.53340584", "text": "func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClientListResponse]{\n\t\tMore: func(page ClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "1426a1b5fc8840edb242cae3e52f7a2a", "score": "0.5332704", "text": "func (client *MigrationConfigsClient) NewListPager(resourceGroupName string, namespaceName string, options *MigrationConfigsClientListOptions) *runtime.Pager[MigrationConfigsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[MigrationConfigsClientListResponse]{\n\t\tMore: func(page MigrationConfigsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *MigrationConfigsClientListResponse) (MigrationConfigsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, namespaceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn MigrationConfigsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn MigrationConfigsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn MigrationConfigsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "f3ef42f7e04c4460d4665a7177939431", "score": "0.5307094", "text": "func (client *SAPApplicationServerInstancesClient) NewListPager(resourceGroupName string, sapVirtualInstanceName string, options *SAPApplicationServerInstancesClientListOptions) *runtime.Pager[SAPApplicationServerInstancesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SAPApplicationServerInstancesClientListResponse]{\n\t\tMore: func(page SAPApplicationServerInstancesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SAPApplicationServerInstancesClientListResponse) (SAPApplicationServerInstancesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SAPApplicationServerInstancesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SAPApplicationServerInstancesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SAPApplicationServerInstancesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "92e08928024f4c12c9a016d85277c62d", "score": "0.5278922", "text": "func (client *SecretsClient) NewListPager(resourceGroupName string, labName string, userName string, options *SecretsClientListOptions) *runtime.Pager[SecretsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SecretsClientListResponse]{\n\t\tMore: func(page SecretsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SecretsClientListResponse) (SecretsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, labName, userName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SecretsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SecretsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SecretsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "da27d5bad731f3476f2348767c01c11e", "score": "0.52512944", "text": "func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{\n\t\tMore: func(page OperationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn OperationsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn OperationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn OperationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "32f93337111be6cedb5935c1711717b8", "score": "0.52320915", "text": "func (client *PrivateZonesClient) NewListPager(options *PrivateZonesClientListOptions) *runtime.Pager[PrivateZonesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[PrivateZonesClientListResponse]{\n\t\tMore: func(page PrivateZonesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *PrivateZonesClientListResponse) (PrivateZonesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn PrivateZonesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn PrivateZonesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn PrivateZonesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "b06d8ca4c57c7eaf48dd9f0f543bb03b", "score": "0.52264625", "text": "func (client *DiskEncryptionSetsClient) NewListPager(options *DiskEncryptionSetsClientListOptions) *runtime.Pager[DiskEncryptionSetsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[DiskEncryptionSetsClientListResponse]{\n\t\tMore: func(page DiskEncryptionSetsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *DiskEncryptionSetsClientListResponse) (DiskEncryptionSetsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn DiskEncryptionSetsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.pl.Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn DiskEncryptionSetsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn DiskEncryptionSetsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "554153e018c7f3a9a73c881c008f3cce", "score": "0.5214698", "text": "func (client *VirtualNetworksClient) NewListPager(resourceGroupName string, labName string, options *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListResponse]{\n\t\tMore: func(page VirtualNetworksClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VirtualNetworksClientListResponse) (VirtualNetworksClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, labName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualNetworksClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualNetworksClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VirtualNetworksClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "a233b7a2a6017ef2273cb316bc62a3f5", "score": "0.5209407", "text": "func (client *DaprComponentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, environmentName string, options *DaprComponentsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif environmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter environmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{environmentName}\", url.PathEscape(environmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "007d0f090f37b59c7dcb1a78162f4015", "score": "0.5167767", "text": "func (client *ConfigurationStoresClient) NewListPager(options *ConfigurationStoresClientListOptions) *runtime.Pager[ConfigurationStoresClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ConfigurationStoresClientListResponse]{\n\t\tMore: func(page ConfigurationStoresClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ConfigurationStoresClientListResponse) (ConfigurationStoresClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ConfigurationStoresClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ConfigurationStoresClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ConfigurationStoresClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "8bb4e1a5aabfe2d1aeb7fc41d925998e", "score": "0.51436317", "text": "func (client *ViewsClient) NewListPager(options *ViewsClientListOptions) *runtime.Pager[ViewsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ViewsClientListResponse]{\n\t\tMore: func(page ViewsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ViewsClientListResponse) (ViewsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ViewsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ViewsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ViewsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "c2993a72e3052647b6080d86dd32a8e8", "score": "0.51422614", "text": "func (client *ProblemClassificationsClient) NewListPager(serviceName string, options *ProblemClassificationsClientListOptions) *runtime.Pager[ProblemClassificationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ProblemClassificationsClientListResponse]{\n\t\tMore: func(page ProblemClassificationsClientListResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ProblemClassificationsClientListResponse) (ProblemClassificationsClientListResponse, error) {\n\t\t\treq, err := client.listCreateRequest(ctx, serviceName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ProblemClassificationsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ProblemClassificationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ProblemClassificationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "06d3b5bda9f9e0705637510a27d3bb71", "score": "0.5122316", "text": "func (client *ServicesClient) NewListPager(options *ServicesClientListOptions) *runtime.Pager[ServicesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ServicesClientListResponse]{\n\t\tMore: func(page ServicesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ServicesClientListResponse) (ServicesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ServicesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ServicesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ServicesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "3f86af111a79f5126124d3fe03846abd", "score": "0.5076527", "text": "func (client *LabsClient) NewListVhdsPager(resourceGroupName string, name string, options *LabsClientListVhdsOptions) *runtime.Pager[LabsClientListVhdsResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[LabsClientListVhdsResponse]{\n\t\tMore: func(page LabsClientListVhdsResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *LabsClientListVhdsResponse) (LabsClientListVhdsResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listVhdsCreateRequest(ctx, resourceGroupName, name, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn LabsClientListVhdsResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn LabsClientListVhdsResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn LabsClientListVhdsResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listVhdsHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "71c3fc6fa8bc89897fcb052920a1fe09", "score": "0.5042808", "text": "func (client *PlacementPoliciesClient) NewListPager(resourceGroupName string, privateCloudName string, clusterName string, options *PlacementPoliciesClientListOptions) *runtime.Pager[PlacementPoliciesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[PlacementPoliciesClientListResponse]{\n\t\tMore: func(page PlacementPoliciesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *PlacementPoliciesClientListResponse) (PlacementPoliciesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, privateCloudName, clusterName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn PlacementPoliciesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn PlacementPoliciesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn PlacementPoliciesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "60cf799ff4e7ce3f51304176d9369729", "score": "0.5028203", "text": "func (client *ConnectionMonitorsClient) NewListPager(resourceGroupName string, networkWatcherName string, options *ConnectionMonitorsClientListOptions) *runtime.Pager[ConnectionMonitorsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ConnectionMonitorsClientListResponse]{\n\t\tMore: func(page ConnectionMonitorsClientListResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ConnectionMonitorsClientListResponse) (ConnectionMonitorsClientListResponse, error) {\n\t\t\treq, err := client.listCreateRequest(ctx, resourceGroupName, networkWatcherName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ConnectionMonitorsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ConnectionMonitorsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ConnectionMonitorsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "f5c5a05568e2233e515358ec541477dc", "score": "0.5027698", "text": "func (client *RecommendationsClient) NewListPager(options *RecommendationsClientListOptions) *runtime.Pager[RecommendationsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[RecommendationsClientListResponse]{\n\t\tMore: func(page RecommendationsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *RecommendationsClientListResponse) (RecommendationsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn RecommendationsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn RecommendationsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn RecommendationsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "6d4b82e5055952fc996db6ec810c8b8f", "score": "0.50260085", "text": "func ExampleManagedEnvironmentsClient_NewListBySubscriptionPager() {\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\tclient, err := armappcontainers.NewManagedEnvironmentsClient(\"8efdecc5-919e-44eb-b179-915dca89ebf9\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListBySubscriptionPager(nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb49f678eeb807dc1e6fcdd6a3d9a75a", "score": "0.49896964", "text": "func (client *ManagedInstancesClient) List(options *ManagedInstancesListOptions) *ManagedInstancesListPager {\n\treturn &ManagedInstancesListPager{\n\t\tclient: client,\n\t\trequester: func(ctx context.Context) (*policy.Request, error) {\n\t\t\treturn client.listCreateRequest(ctx, options)\n\t\t},\n\t\tadvancer: func(ctx context.Context, resp ManagedInstancesListResponse) (*policy.Request, error) {\n\t\t\treturn runtime.NewRequest(ctx, http.MethodGet, *resp.ManagedInstanceListResult.NextLink)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "45945a60b5866086680dd1893cdb8c68", "score": "0.49824375", "text": "func ExampleManagedClustersClient_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\tclient, err := armcontainerservice.NewManagedClustersClient(\"subid1\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fa63b670a4311a1d503129186bbb156a", "score": "0.4978364", "text": "func (client *VirtualRoutersClient) NewListPager(options *VirtualRoutersClientListOptions) *runtime.Pager[VirtualRoutersClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VirtualRoutersClientListResponse]{\n\t\tMore: func(page VirtualRoutersClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VirtualRoutersClientListResponse) (VirtualRoutersClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualRoutersClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualRoutersClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VirtualRoutersClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "d855a468957ecb5a9c3fbbe3fd7d1447", "score": "0.4943488", "text": "func (client *PreRulesClient) NewListPager(globalRulestackName string, options *PreRulesClientListOptions) *runtime.Pager[PreRulesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[PreRulesClientListResponse]{\n\t\tMore: func(page PreRulesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *PreRulesClientListResponse) (PreRulesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, globalRulestackName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn PreRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn PreRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn PreRulesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "23e59ac60954c8717dcbc5b55d3694b8", "score": "0.49354473", "text": "func ExampleExemptionsClient_NewListForManagementGroupPager() {\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\tclient, err := armpolicy.NewExemptionsClient(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListForManagementGroupPager(\"DevOrg\",\n\t\t&armpolicy.ExemptionsClientListForManagementGroupOptions{Filter: to.Ptr(\"atScope()\")})\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6d00732bef74817e0369ee0258175650", "score": "0.49198273", "text": "func (client *AssessmentsMetadataClient) NewListPager(options *AssessmentsMetadataClientListOptions) *runtime.Pager[AssessmentsMetadataClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[AssessmentsMetadataClientListResponse]{\n\t\tMore: func(page AssessmentsMetadataClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *AssessmentsMetadataClientListResponse) (AssessmentsMetadataClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn AssessmentsMetadataClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn AssessmentsMetadataClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn AssessmentsMetadataClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "3b97b2bf946bfb2edbedb3d3e82bb32c", "score": "0.490379", "text": "func (client *CacheRulesClient) NewListPager(resourceGroupName string, registryName string, options *CacheRulesClientListOptions) *runtime.Pager[CacheRulesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CacheRulesClientListResponse]{\n\t\tMore: func(page CacheRulesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CacheRulesClientListResponse) (CacheRulesClientListResponse, error) {\n\t\t\tctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, \"CacheRulesClient.NewListPager\")\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CacheRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CacheRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CacheRulesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t\tTracer: client.internal.Tracer(),\n\t})\n}", "title": "" }, { "docid": "7bf6645e1095d056b25192772ca44761", "score": "0.49012804", "text": "func (client *CatalogsClient) NewListDeviceGroupsPager(resourceGroupName string, catalogName string, listDeviceGroupsRequest ListDeviceGroupsRequest, options *CatalogsClientListDeviceGroupsOptions) *runtime.Pager[CatalogsClientListDeviceGroupsResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CatalogsClientListDeviceGroupsResponse]{\n\t\tMore: func(page CatalogsClientListDeviceGroupsResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CatalogsClientListDeviceGroupsResponse) (CatalogsClientListDeviceGroupsResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listDeviceGroupsCreateRequest(ctx, resourceGroupName, catalogName, listDeviceGroupsRequest, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CatalogsClientListDeviceGroupsResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CatalogsClientListDeviceGroupsResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CatalogsClientListDeviceGroupsResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listDeviceGroupsHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "061054cb0fecdf8b1cd27a085325be89", "score": "0.48878473", "text": "func (client *VendorSKUsClient) NewListPager(vendorName string, options *VendorSKUsClientListOptions) *runtime.Pager[VendorSKUsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VendorSKUsClientListResponse]{\n\t\tMore: func(page VendorSKUsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VendorSKUsClientListResponse) (VendorSKUsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, vendorName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VendorSKUsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn VendorSKUsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VendorSKUsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "4a8f62ff5f4d6da4e0112e81683ffd47", "score": "0.48812193", "text": "func (client *PlansClient) NewListPager(options *PlansClientListOptions) *runtime.Pager[PlansClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[PlansClientListResponse]{\n\t\tMore: func(page PlansClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *PlansClientListResponse) (PlansClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn PlansClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn PlansClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn PlansClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "40f1b0315609f1a3920b1a2e3a491fc0", "score": "0.4857011", "text": "func ExampleExemptionsClient_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\tclient, err := armpolicy.NewExemptionsClient(\"ae640e6b-ba3e-4256-9d62-2993eecfa6f2\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(&armpolicy.ExemptionsClientListOptions{Filter: to.Ptr(\"atScope()\")})\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "48b0c3cbd2f6a3e29e13470ec37f71e9", "score": "0.48499316", "text": "func (client *PrefixListGlobalRulestackClient) NewListPager(globalRulestackName string, options *PrefixListGlobalRulestackClientListOptions) *runtime.Pager[PrefixListGlobalRulestackClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[PrefixListGlobalRulestackClientListResponse]{\n\t\tMore: func(page PrefixListGlobalRulestackClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *PrefixListGlobalRulestackClientListResponse) (PrefixListGlobalRulestackClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, globalRulestackName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn PrefixListGlobalRulestackClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn PrefixListGlobalRulestackClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn PrefixListGlobalRulestackClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "849e0273206d086316a18a61f8d9bb54", "score": "0.48143163", "text": "func (client *WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) NewListPager(resourceGroupName string, workspaceName string, options *WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListOptions) *runtime.Pager[WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse]{\n\t\tMore: func(page WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse) (WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, workspaceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn WorkspaceManagedSQLServerVulnerabilityAssessmentsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "1e67146a8193ebe7224517df17a84f3e", "score": "0.4718962", "text": "func (client *ClustersClient) NewListLanguageExtensionsPager(resourceGroupName string, clusterName string, options *ClustersClientListLanguageExtensionsOptions) *runtime.Pager[ClustersClientListLanguageExtensionsResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClustersClientListLanguageExtensionsResponse]{\n\t\tMore: func(page ClustersClientListLanguageExtensionsResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClustersClientListLanguageExtensionsResponse) (ClustersClientListLanguageExtensionsResponse, error) {\n\t\t\treq, err := client.listLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListLanguageExtensionsResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListLanguageExtensionsResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClustersClientListLanguageExtensionsResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listLanguageExtensionsHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "cd03dfda65cfcd4660f7a2aa72e86626", "score": "0.47093892", "text": "func (client *SnapshotsClient) NewListPager(reportName string, options *SnapshotsClientListOptions) *runtime.Pager[SnapshotsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SnapshotsClientListResponse]{\n\t\tMore: func(page SnapshotsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SnapshotsClientListResponse) (SnapshotsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, reportName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SnapshotsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SnapshotsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SnapshotsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "784d23691d739a7c33a2ee337ebcd526", "score": "0.47074085", "text": "func (uko *UkoV4) NewManagedKeysPager(options *ListManagedKeysOptions) (pager *ManagedKeysPager, err error) {\n\tif options.Offset != nil && *options.Offset != 0 {\n\t\terr = fmt.Errorf(\"the 'options.Offset' field should not be set\")\n\t\treturn\n\t}\n\n\tvar optionsCopy ListManagedKeysOptions = *options\n\tpager = &ManagedKeysPager{\n\t\thasNext: true,\n\t\toptions: &optionsCopy,\n\t\tclient: uko,\n\t}\n\treturn\n}", "title": "" }, { "docid": "8813d23c09b4864d28148f93106e0df7", "score": "0.4685298", "text": "func (client *AutomationRulesClient) NewListPager(resourceGroupName string, workspaceName string, options *AutomationRulesClientListOptions) *runtime.Pager[AutomationRulesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[AutomationRulesClientListResponse]{\n\t\tMore: func(page AutomationRulesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *AutomationRulesClientListResponse) (AutomationRulesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, workspaceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn AutomationRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn AutomationRulesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn AutomationRulesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "aa876ee5cda2c332393e3bf355afc7c3", "score": "0.46694207", "text": "func (client *BastionHostsClient) NewListPager(options *BastionHostsClientListOptions) *runtime.Pager[BastionHostsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[BastionHostsClientListResponse]{\n\t\tMore: func(page BastionHostsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *BastionHostsClientListResponse) (BastionHostsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn BastionHostsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn BastionHostsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn BastionHostsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "1f256f3f212bb59419a1a5a992c46a4e", "score": "0.46643114", "text": "func (client *CatalogsClient) NewListDevicesPager(resourceGroupName string, catalogName string, options *CatalogsClientListDevicesOptions) *runtime.Pager[CatalogsClientListDevicesResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CatalogsClientListDevicesResponse]{\n\t\tMore: func(page CatalogsClientListDevicesResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CatalogsClientListDevicesResponse) (CatalogsClientListDevicesResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listDevicesCreateRequest(ctx, resourceGroupName, catalogName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CatalogsClientListDevicesResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CatalogsClientListDevicesResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CatalogsClientListDevicesResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listDevicesHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "abdc5526be4963fe0366e9a469e4ef24", "score": "0.46462294", "text": "func NewComponents(platform string, daprClient scheme.Interface) Components {\n\tc := components{}\n\tc.platform = platform\n\n\tif platform == \"kubernetes\" {\n\t\tc.getComponentsFn = c.getKubernetesComponents\n\t\tc.daprClient = daprClient\n\t} else if platform == \"standalone\" {\n\t\tc.getComponentsFn = c.getStandaloneComponents\n\t}\n\treturn &c\n}", "title": "" }, { "docid": "a2f87e7a6f6882209746ed9026999b44", "score": "0.4644948", "text": "func ExampleSecretsClient_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\tclient, err := armdevtestlabs.NewSecretsClient(\"{subscriptionId}\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(\"resourceGroupName\",\n\t\t\"{labName}\",\n\t\t\"{userName}\",\n\t\t&armdevtestlabs.SecretsClientListOptions{Expand: nil,\n\t\t\tFilter: nil,\n\t\t\tTop: nil,\n\t\t\tOrderby: nil,\n\t\t})\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fce1d3a2381a1fecbd166c32f6b2d9df", "score": "0.4632565", "text": "func (client *IscsiServersClient) NewListByDevicePager(deviceName string, resourceGroupName string, managerName string, options *IscsiServersClientListByDeviceOptions) *runtime.Pager[IscsiServersClientListByDeviceResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[IscsiServersClientListByDeviceResponse]{\n\t\tMore: func(page IscsiServersClientListByDeviceResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *IscsiServersClientListByDeviceResponse) (IscsiServersClientListByDeviceResponse, error) {\n\t\t\treq, err := client.listByDeviceCreateRequest(ctx, deviceName, resourceGroupName, managerName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn IscsiServersClientListByDeviceResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn IscsiServersClientListByDeviceResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn IscsiServersClientListByDeviceResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByDeviceHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "c8304107959fd2c524f990f14642b124", "score": "0.46295708", "text": "func (client *TransparentDataEncryptionsClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, options *TransparentDataEncryptionsClientListByDatabaseOptions) *runtime.Pager[TransparentDataEncryptionsClientListByDatabaseResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[TransparentDataEncryptionsClientListByDatabaseResponse]{\n\t\tMore: func(page TransparentDataEncryptionsClientListByDatabaseResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *TransparentDataEncryptionsClientListByDatabaseResponse) (TransparentDataEncryptionsClientListByDatabaseResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn TransparentDataEncryptionsClientListByDatabaseResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn TransparentDataEncryptionsClientListByDatabaseResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn TransparentDataEncryptionsClientListByDatabaseResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByDatabaseHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "da9b90e3e39685cdccfe383e521b6b85", "score": "0.4603448", "text": "func (client *WorkflowRunActionRepetitionsRequestHistoriesClient) NewListPager(resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string, options *WorkflowRunActionRepetitionsRequestHistoriesClientListOptions) *runtime.Pager[WorkflowRunActionRepetitionsRequestHistoriesClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[WorkflowRunActionRepetitionsRequestHistoriesClientListResponse]{\n\t\tMore: func(page WorkflowRunActionRepetitionsRequestHistoriesClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *WorkflowRunActionRepetitionsRequestHistoriesClientListResponse) (WorkflowRunActionRepetitionsRequestHistoriesClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn WorkflowRunActionRepetitionsRequestHistoriesClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn WorkflowRunActionRepetitionsRequestHistoriesClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn WorkflowRunActionRepetitionsRequestHistoriesClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "0dbe9b5eac7492201b68c3fba9fb8aae", "score": "0.45805052", "text": "func (client *ReplicationAlertSettingsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationAlertSettingsClientListOptions) *runtime.Pager[ReplicationAlertSettingsClientListResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ReplicationAlertSettingsClientListResponse]{\n\t\tMore: func(page ReplicationAlertSettingsClientListResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ReplicationAlertSettingsClientListResponse) (ReplicationAlertSettingsClientListResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ReplicationAlertSettingsClientListResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ReplicationAlertSettingsClientListResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ReplicationAlertSettingsClientListResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "8871fea338f9ad977a915a38edd3b1ff", "score": "0.45773128", "text": "func ExampleVolumesClient_NewListByDevicePager() {\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\tclient, err := armstorsimple8000series.NewVolumesClient(\"4385cf00-2d3a-425a-832f-f4285b1c9dce\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByDevicePager(\"Device05ForSDKTest\",\n\t\t\"ResourceGroupForSDKTest\",\n\t\t\"ManagerForSDKTest1\",\n\t\tnil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1196d448edfd100293d8bc00891e62b1", "score": "0.45756143", "text": "func (client *BuildpackBindingClient) NewListForClusterPager(resourceGroupName string, serviceName string, options *BuildpackBindingClientListForClusterOptions) *runtime.Pager[BuildpackBindingClientListForClusterResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[BuildpackBindingClientListForClusterResponse]{\n\t\tMore: func(page BuildpackBindingClientListForClusterResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *BuildpackBindingClientListForClusterResponse) (BuildpackBindingClientListForClusterResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listForClusterCreateRequest(ctx, resourceGroupName, serviceName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn BuildpackBindingClientListForClusterResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn BuildpackBindingClientListForClusterResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn BuildpackBindingClientListForClusterResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listForClusterHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "9c44653284c81517a20807d25592c52b", "score": "0.45677972", "text": "func ExampleManagedClustersClient_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\tclient, err := armcontainerservice.NewManagedClustersClient(\"subid1\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByResourceGroupPager(\"rg1\",\n\t\tnil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c96364e856c40ed8aa6297130a6f7ce", "score": "0.4559302", "text": "func ExampleVirtualMachineScaleSetsClient_NewListByLocationPager() {\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\tclient, err := armcompute.NewVirtualMachineScaleSetsClient(\"{subscription-id}\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByLocationPager(\"eastus\", nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1629c93645bdc467313ff48c9eee64d8", "score": "0.45590758", "text": "func ExampleOperationsClient_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 := armhybriddatamanager.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewOperationsClient().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.AvailableProviderOperations = armhybriddatamanager.AvailableProviderOperations{\n\t\t// \tValue: []*armhybriddatamanager.AvailableProviderOperation{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/write\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Create or update Job definitions\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Creates or updates Job definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Job definitions\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/delete\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Delete Job definitions\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Job definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Job definitions\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Job definitions\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Job definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Job definitions\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/jobDefinitions/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Job definitions\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Job definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Job definitions\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/listResults/action\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Get job defintions\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get job definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Job definitions\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/run/action\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Run job defintions\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Run job definitions\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Job definitions\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataStores/operationResults/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Operation results\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Operation results\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Operation results\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/operationResults/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Operation results\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Operation results\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Operation results\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/jobs/operationResults/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Operation results\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Operation results\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Operation results\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/operationResults/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Operation results\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Operation results\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Operation results\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/publicKeys/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Public keys\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Public keys\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Public keys\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Data services\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Data services\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Data services\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataStores/write\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Create or update Datastores\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Creates or updates Datastores\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Datastores\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataStores/delete\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Delete Datastores\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Datastores\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Datastores\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataStores/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Datastores\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Datastores\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Datastores\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataStoreTypes/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Datastore types\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Datastore types\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Datastore types\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/delete\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Delete Data managers\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Delete Data managers\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Data managers\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Data managers\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Data managers\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Data managers\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/write\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Create or update Data managers\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Creates or updates Data managers\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Data managers\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/jobs/cancel/action\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Cancel jobs\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Cancel jobs\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Jobs\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/jobs/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Jobs\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Jobs\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Jobs\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/jobs/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Jobs\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Jobs\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Jobs\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobs/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read Jobs\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get Jobs\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Jobs\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/dataManagers/dataServices/jobDefinitions/jobs/resume/action\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Resume jobs\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Resumes jobs\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"Jobs\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"Microsoft.HybridData/read\"),\n\t\t// \t\t\tDisplay: &armhybriddatamanager.AvailableProviderOperationDisplay{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Read ArmApiRes_Microsoft.HybridData\"),\n\t\t// \t\t\t\tOperation: to.Ptr(\"Get ArmApiRes_Microsoft.HybridData\"),\n\t\t// \t\t\t\tProvider: to.Ptr(\"Microsoft.HybridData\"),\n\t\t// \t\t\t\tResource: to.Ptr(\"ArmApiRes_Microsoft.HybridData\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tOrigin: to.Ptr(\"user\"),\n\t\t// \t\t\tProperties: map[string]any{\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "24f4c4dfa96f43eba1062546bd907e90", "score": "0.45578632", "text": "func ExampleManagedEnvironmentsClient_NewListWorkloadProfileStatesPager() {\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\tclient, err := armappcontainers.NewManagedEnvironmentsClient(\"8efdecc5-919e-44eb-b179-915dca89ebf9\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListWorkloadProfileStatesPager(\"examplerg\", \"jlaw-demo1\", nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "56fcd2645c9382df20d6501500b45193", "score": "0.45426443", "text": "func NewListOptions(page int, filter string) *ListOptions {\n\treturn &ListOptions{PageOptions: &PageOptions{Page: page}, Filter: filter}\n}", "title": "" }, { "docid": "f1061dafe24883e1eb1d62a7d944bdea", "score": "0.45318657", "text": "func (client *IscsiServersClient) NewListByManagerPager(resourceGroupName string, managerName string, options *IscsiServersClientListByManagerOptions) *runtime.Pager[IscsiServersClientListByManagerResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[IscsiServersClientListByManagerResponse]{\n\t\tMore: func(page IscsiServersClientListByManagerResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *IscsiServersClientListByManagerResponse) (IscsiServersClientListByManagerResponse, error) {\n\t\t\treq, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn IscsiServersClientListByManagerResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn IscsiServersClientListByManagerResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn IscsiServersClientListByManagerResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByManagerHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "eda8bfdd90c3ada5653609bd93cd8367", "score": "0.45306152", "text": "func ExampleExemptionsClient_NewListForResourcePager() {\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\tclient, err := armpolicy.NewExemptionsClient(\"ae640e6b-ba3e-4256-9d62-2993eecfa6f2\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListForResourcePager(\"TestResourceGroup\",\n\t\t\"Microsoft.Compute\",\n\t\t\"virtualMachines/MyTestVm\",\n\t\t\"domainNames\",\n\t\t\"MyTestComputer.cloudapp.net\",\n\t\t&armpolicy.ExemptionsClientListForResourceOptions{Filter: nil})\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b2297406251b0986dc014d72aa0c62b", "score": "0.45043683", "text": "func ExampleApplicationClient_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\tclient, err := armservicefabricmesh.NewApplicationClient(\"00000000-0000-0000-0000-000000000000\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByResourceGroupPager(\"sbz_demo\",\n\t\tnil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "15189135318c613920071bfabb825d31", "score": "0.45012182", "text": "func (client *ConfigurationStoresClient) NewListDeletedPager(options *ConfigurationStoresClientListDeletedOptions) *runtime.Pager[ConfigurationStoresClientListDeletedResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ConfigurationStoresClientListDeletedResponse]{\n\t\tMore: func(page ConfigurationStoresClientListDeletedResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ConfigurationStoresClientListDeletedResponse) (ConfigurationStoresClientListDeletedResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listDeletedCreateRequest(ctx, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn ConfigurationStoresClientListDeletedResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ConfigurationStoresClientListDeletedResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ConfigurationStoresClientListDeletedResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listDeletedHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "036ec8333f98fd31880c811edcd38e1f", "score": "0.4500817", "text": "func (client *InstanceFailoverGroupsClient) NewListByLocationPager(resourceGroupName string, locationName string, options *InstanceFailoverGroupsClientListByLocationOptions) *runtime.Pager[InstanceFailoverGroupsClientListByLocationResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[InstanceFailoverGroupsClientListByLocationResponse]{\n\t\tMore: func(page InstanceFailoverGroupsClientListByLocationResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *InstanceFailoverGroupsClientListByLocationResponse) (InstanceFailoverGroupsClientListByLocationResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByLocationCreateRequest(ctx, resourceGroupName, locationName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn InstanceFailoverGroupsClientListByLocationResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn InstanceFailoverGroupsClientListByLocationResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn InstanceFailoverGroupsClientListByLocationResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByLocationHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "6b72863991e523af617c95b644a7767a", "score": "0.44886494", "text": "func ExampleVolumesClient_NewListByVolumeContainerPager() {\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\tclient, err := armstorsimple8000series.NewVolumesClient(\"4385cf00-2d3a-425a-832f-f4285b1c9dce\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByVolumeContainerPager(\"Device05ForSDKTest\",\n\t\t\"volumeContainerForSDKTest\",\n\t\t\"ResourceGroupForSDKTest\",\n\t\t\"ManagerForSDKTest1\",\n\t\tnil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0dedf94feeda3ce039736d51e30f36b7", "score": "0.44866955", "text": "func (client *SQLManagedInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *SQLManagedInstancesClientListByResourceGroupOptions) *runtime.Pager[SQLManagedInstancesClientListByResourceGroupResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[SQLManagedInstancesClientListByResourceGroupResponse]{\n\t\tMore: func(page SQLManagedInstancesClientListByResourceGroupResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *SQLManagedInstancesClientListByResourceGroupResponse) (SQLManagedInstancesClientListByResourceGroupResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn SQLManagedInstancesClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn SQLManagedInstancesClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn SQLManagedInstancesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByResourceGroupHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "b3e6c5b5f3a65db8e4b6863bfc0162c8", "score": "0.44835868", "text": "func ExampleReplicationProtectionContainersClient_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\tclient, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient(\"vault1\",\n\t\t\"resourceGroupPS1\",\n\t\t\"c183865e-6077-46f2-a3b1-deb0f4f4650a\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e8d32e75356d24f784757cfbac05ee6", "score": "0.4468034", "text": "func List(c *gophercloud.ServiceClient) pagination.Pager {\n\turl := listURL(c)\n\tcreatePage := func(r pagination.PageResult) pagination.Page {\n\t\treturn PoolPage{pagination.SinglePageBase(r)}\n\t}\n\treturn pagination.NewPager(c, url, createPage)\n}", "title": "" }, { "docid": "c43d73c34656970985694b1d297d50bc", "score": "0.4455974", "text": "func (client *AzureBareMetalInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureBareMetalInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureBareMetalInstancesClientListByResourceGroupResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[AzureBareMetalInstancesClientListByResourceGroupResponse]{\n\t\tMore: func(page AzureBareMetalInstancesClientListByResourceGroupResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *AzureBareMetalInstancesClientListByResourceGroupResponse) (AzureBareMetalInstancesClientListByResourceGroupResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn AzureBareMetalInstancesClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn AzureBareMetalInstancesClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn AzureBareMetalInstancesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByResourceGroupHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "db0118a60c961049d4b088242486c15c", "score": "0.44540393", "text": "func ExampleLocationClient_NewListCapabilitiesPager() {\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 := armcontainerinstance.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewLocationClient().NewListCapabilitiesPager(\"westus\", 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.CapabilitiesListResult = armcontainerinstance.CapabilitiesListResult{\n\t\t// \tValue: []*armcontainerinstance.Capabilities{\n\t\t// \t\t{\n\t\t// \t\t\tCapabilities: &armcontainerinstance.CapabilitiesCapabilities{\n\t\t// \t\t\t\tMaxCPU: to.Ptr[float32](4),\n\t\t// \t\t\t\tMaxGpuCount: to.Ptr[float32](4),\n\t\t// \t\t\t\tMaxMemoryInGB: to.Ptr[float32](14),\n\t\t// \t\t\t},\n\t\t// \t\t\tGpu: to.Ptr(\"K80\"),\n\t\t// \t\t\tIPAddressType: to.Ptr(\"Public\"),\n\t\t// \t\t\tLocation: to.Ptr(\"West US\"),\n\t\t// \t\t\tOSType: to.Ptr(\"Linux\"),\n\t\t// \t\t\tResourceType: to.Ptr(\"containerGroups\"),\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tCapabilities: &armcontainerinstance.CapabilitiesCapabilities{\n\t\t// \t\t\t\tMaxCPU: to.Ptr[float32](4),\n\t\t// \t\t\t\tMaxGpuCount: to.Ptr[float32](0),\n\t\t// \t\t\t\tMaxMemoryInGB: to.Ptr[float32](14),\n\t\t// \t\t\t},\n\t\t// \t\t\tGpu: to.Ptr(\"None\"),\n\t\t// \t\t\tIPAddressType: to.Ptr(\"Public\"),\n\t\t// \t\t\tLocation: to.Ptr(\"West US\"),\n\t\t// \t\t\tOSType: to.Ptr(\"Windows\"),\n\t\t// \t\t\tResourceType: to.Ptr(\"containerGroups\"),\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "b540513d54103eeaf15810598b3ce74a", "score": "0.4445536", "text": "func ExampleAssignmentsClient_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\tclient, err := armguestconfiguration.NewAssignmentsClient(\"mySubscriptionId\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(\"myResourceGroupName\",\n\t\t\"myVMName\",\n\t\tnil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1c05e007c65d169cde2cf05db505b141", "score": "0.44372252", "text": "func NewCmdCatalogListServices(name, fullName string) *cobra.Command {\n\to := NewListServicesOptions()\n\treturn &cobra.Command{\n\t\tUse: name,\n\t\tShort: \"Lists all available services\",\n\t\tLong: \"Lists all available services\",\n\t\tExample: fmt.Sprintf(servicesExample, fullName),\n\t\tArgs: cobra.ExactArgs(0),\n\t\tAnnotations: map[string]string{\"machineoutput\": \"json\"},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgenericclioptions.GenericRun(o, cmd, args)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "560c01f29941dd19408c27a9f5b38aca", "score": "0.44216207", "text": "func (client *ClustersClient) NewListFollowerDatabasesPager(resourceGroupName string, clusterName string, options *ClustersClientListFollowerDatabasesOptions) *runtime.Pager[ClustersClientListFollowerDatabasesResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClustersClientListFollowerDatabasesResponse]{\n\t\tMore: func(page ClustersClientListFollowerDatabasesResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClustersClientListFollowerDatabasesResponse) (ClustersClientListFollowerDatabasesResponse, error) {\n\t\t\treq, err := client.listFollowerDatabasesCreateRequest(ctx, resourceGroupName, clusterName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListFollowerDatabasesResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListFollowerDatabasesResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClustersClientListFollowerDatabasesResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listFollowerDatabasesHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "8d157d54d52afe5c6207edf5ffb4cf9f", "score": "0.44215468", "text": "func (client *CatalogsClient) NewListByResourceGroupPager(resourceGroupName string, options *CatalogsClientListByResourceGroupOptions) *runtime.Pager[CatalogsClientListByResourceGroupResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[CatalogsClientListByResourceGroupResponse]{\n\t\tMore: func(page CatalogsClientListByResourceGroupResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *CatalogsClientListByResourceGroupResponse) (CatalogsClientListByResourceGroupResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn CatalogsClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn CatalogsClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn CatalogsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByResourceGroupHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "3103fc8856c10341756341a355ff5beb", "score": "0.44201463", "text": "func (client *VirtualClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualClustersClientListByResourceGroupOptions) *runtime.Pager[VirtualClustersClientListByResourceGroupResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[VirtualClustersClientListByResourceGroupResponse]{\n\t\tMore: func(page VirtualClustersClientListByResourceGroupResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *VirtualClustersClientListByResourceGroupResponse) (VirtualClustersClientListByResourceGroupResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualClustersClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn VirtualClustersClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn VirtualClustersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByResourceGroupHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "6c09357e21e92ee5d11161052b24908c", "score": "0.44087988", "text": "func ExampleVolumeGroupsClient_NewListByNetAppAccountPager() {\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 := armnetapp.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewVolumeGroupsClient().NewListByNetAppAccountPager(\"myRG\", \"account1\", 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.VolumeGroupList = armnetapp.VolumeGroupList{\n\t\t// \tValue: []*armnetapp.VolumeGroup{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"group1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.NetApp/netAppAccounts/volumeGroups\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/volumeGroups/group1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"eastus\"),\n\t\t// \t\t\tProperties: &armnetapp.VolumeGroupListProperties{\n\t\t// \t\t\t\tGroupMetaData: &armnetapp.VolumeGroupMetaData{\n\t\t// \t\t\t\t\tApplicationIdentifier: to.Ptr(\"DEV\"),\n\t\t// \t\t\t\t\tApplicationType: to.Ptr(armnetapp.ApplicationTypeSAPHANA),\n\t\t// \t\t\t\t\tGroupDescription: to.Ptr(\"Volume group\"),\n\t\t// \t\t\t\t\tVolumesCount: to.Ptr[int64](5),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(\"Succeeded\"),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "7fd461b080808501331430016ff5fab2", "score": "0.44022635", "text": "func ExampleAddonsClient_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 := armavs.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewAddonsClient().NewListPager(\"group1\", \"cloud1\", 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.AddonList = armavs.AddonList{\n\t\t// \tValue: []*armavs.Addon{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"srm\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AVS/privateClouds/addons\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/srm\"),\n\t\t// \t\t\tProperties: &armavs.AddonSrmProperties{\n\t\t// \t\t\t\tAddonType: to.Ptr(armavs.AddonTypeSRM),\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded),\n\t\t// \t\t\t\tLicenseKey: to.Ptr(\"41915178-A8FF-4A4D-B683-6D735AF5E3F5\"),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "7541c42fe71c87e359a21197eb54b304", "score": "0.44020504", "text": "func ExampleImagesClient_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\tclient, err := armcompute.NewImagesClient(\"{subscription-id}\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "211beaddc040cb9620b8977876062f96", "score": "0.4401262", "text": "func ExampleExpressRouteCircuitsClient_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 := armnetwork.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewExpressRouteCircuitsClient().NewListPager(\"rg1\", 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.ExpressRouteCircuitListResult = armnetwork.ExpressRouteCircuitListResult{\n\t\t// \tValue: []*armnetwork.ExpressRouteCircuit{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"circuitName1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.Network/expressRouteCircuits\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"westus\"),\n\t\t// \t\t\tEtag: to.Ptr(\"W/\\\"832b28c3-f5fd-4d2a-a2cb-6e4a2fe452b3\\\"\"),\n\t\t// \t\t\tProperties: &armnetwork.ExpressRouteCircuitPropertiesFormat{\n\t\t// \t\t\t\tAllowClassicOperations: to.Ptr(false),\n\t\t// \t\t\t\tAuthorizations: []*armnetwork.ExpressRouteCircuitAuthorization{\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName/authorizations/MyAuthorization1\"),\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"MyAuthorization1\"),\n\t\t// \t\t\t\t\t\tEtag: to.Ptr(\"W/\\\"832b28c3-f5fd-4d2a-a2cb-6e4a2fe452b3\\\"\"),\n\t\t// \t\t\t\t\t\tProperties: &armnetwork.AuthorizationPropertiesFormat{\n\t\t// \t\t\t\t\t\t\tAuthorizationKey: to.Ptr(\"authkey\"),\n\t\t// \t\t\t\t\t\t\tAuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable),\n\t\t// \t\t\t\t\t\t\tProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t}},\n\t\t// \t\t\t\tCircuitProvisioningState: to.Ptr(\"Enabled\"),\n\t\t// \t\t\t\tGatewayManagerEtag: to.Ptr(\"113\"),\n\t\t// \t\t\t\tPeerings: []*armnetwork.ExpressRouteCircuitPeering{\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),\n\t\t// \t\t\t\tServiceKey: to.Ptr(\"a1410692-ed3b-4ceb-b94a-b90b95d398d1\"),\n\t\t// \t\t\t\tServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{\n\t\t// \t\t\t\t\tBandwidthInMbps: to.Ptr[int32](200),\n\t\t// \t\t\t\t\tPeeringLocation: to.Ptr(\"peeringLocation\"),\n\t\t// \t\t\t\t\tServiceProviderName: to.Ptr(\"providerName\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateProvisioned),\n\t\t// \t\t\t},\n\t\t// \t\t\tSKU: &armnetwork.ExpressRouteCircuitSKU{\n\t\t// \t\t\t\tName: to.Ptr(\"Standard_MeteredData\"),\n\t\t// \t\t\t\tFamily: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData),\n\t\t// \t\t\t\tTier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"circuitName2\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.Network/expressRouteCircuits\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName2\"),\n\t\t// \t\t\tLocation: to.Ptr(\"westus\"),\n\t\t// \t\t\tEtag: to.Ptr(\"W/\\\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\\\"\"),\n\t\t// \t\t\tProperties: &armnetwork.ExpressRouteCircuitPropertiesFormat{\n\t\t// \t\t\t\tAllowClassicOperations: to.Ptr(false),\n\t\t// \t\t\t\tAuthorizations: []*armnetwork.ExpressRouteCircuitAuthorization{\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRouteCircuits/circuitName2/authorizations/MyAuthorization2\"),\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"MyAuthorization2\"),\n\t\t// \t\t\t\t\t\tEtag: to.Ptr(\"W/\\\"e33c875f-48df-4a91-b7d3-eb95b5ddbb89\\\"\"),\n\t\t// \t\t\t\t\t\tProperties: &armnetwork.AuthorizationPropertiesFormat{\n\t\t// \t\t\t\t\t\t\tAuthorizationKey: to.Ptr(\"authkey\"),\n\t\t// \t\t\t\t\t\t\tAuthorizationUseStatus: to.Ptr(armnetwork.AuthorizationUseStatusAvailable),\n\t\t// \t\t\t\t\t\t\tProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t}},\n\t\t// \t\t\t\tCircuitProvisioningState: to.Ptr(\"Enabled\"),\n\t\t// \t\t\t\tGatewayManagerEtag: to.Ptr(\"\"),\n\t\t// \t\t\t\tPeerings: []*armnetwork.ExpressRouteCircuitPeering{\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),\n\t\t// \t\t\t\tServiceKey: to.Ptr(\"6569625a-9ba4-498b-9719-14d778eef609\"),\n\t\t// \t\t\t\tServiceProviderProperties: &armnetwork.ExpressRouteCircuitServiceProviderProperties{\n\t\t// \t\t\t\t\tBandwidthInMbps: to.Ptr[int32](200),\n\t\t// \t\t\t\t\tPeeringLocation: to.Ptr(\"peeringLocation\"),\n\t\t// \t\t\t\t\tServiceProviderName: to.Ptr(\"providerName\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tServiceProviderProvisioningState: to.Ptr(armnetwork.ServiceProviderProvisioningStateNotProvisioned),\n\t\t// \t\t\t},\n\t\t// \t\t\tSKU: &armnetwork.ExpressRouteCircuitSKU{\n\t\t// \t\t\t\tName: to.Ptr(\"Standard_MeteredData\"),\n\t\t// \t\t\t\tFamily: to.Ptr(armnetwork.ExpressRouteCircuitSKUFamilyMeteredData),\n\t\t// \t\t\t\tTier: to.Ptr(armnetwork.ExpressRouteCircuitSKUTierStandard),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "44572e067d5b02bf73a122ca93c8723c", "score": "0.43941385", "text": "func (client *ClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ClustersClientListByResourceGroupOptions) *runtime.Pager[ClustersClientListByResourceGroupResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[ClustersClientListByResourceGroupResponse]{\n\t\tMore: func(page ClustersClientListByResourceGroupResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *ClustersClientListByResourceGroupResponse) (ClustersClientListByResourceGroupResponse, error) {\n\t\t\treq, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn ClustersClientListByResourceGroupResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn ClustersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByResourceGroupHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "6dc9293207279572fd59411c5c670f17", "score": "0.43924522", "text": "func ExampleServiceClient_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 := armservicefabricmesh.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewServiceClient().NewListPager(\"sbz_demo\", \"sampleApplication\", 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.ServiceResourceDescriptionList = armservicefabricmesh.ServiceResourceDescriptionList{\n\t\t// \tValue: []*armservicefabricmesh.ServiceResourceDescription{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"helloWorldService\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.ServiceFabricMesh/services\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sbz_demo/providers/Microsoft.ServiceFabricMesh/applications/sampleApplication/services/helloWorldService\"),\n\t\t// \t\t\tProperties: &armservicefabricmesh.ServiceResourceProperties{\n\t\t// \t\t\t\tDescription: to.Ptr(\"SeaBreeze Hello World Service.\"),\n\t\t// \t\t\t\tHealthState: to.Ptr(armservicefabricmesh.HealthStateOk),\n\t\t// \t\t\t\tReplicaCount: to.Ptr[int32](1),\n\t\t// \t\t\t\tStatus: to.Ptr(armservicefabricmesh.ResourceStatusReady),\n\t\t// \t\t\t\tCodePackages: []*armservicefabricmesh.ContainerCodePackageProperties{\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"helloWorldCode\"),\n\t\t// \t\t\t\t\t\tEndpoints: []*armservicefabricmesh.EndpointProperties{\n\t\t// \t\t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\t\tName: to.Ptr(\"helloWorldListener\"),\n\t\t// \t\t\t\t\t\t\t\tPort: to.Ptr[int32](80),\n\t\t// \t\t\t\t\t\t}},\n\t\t// \t\t\t\t\t\tImage: to.Ptr(\"seabreeze/sbz-helloworld:1.0-alpine\"),\n\t\t// \t\t\t\t\t\tResources: &armservicefabricmesh.ResourceRequirements{\n\t\t// \t\t\t\t\t\t\tRequests: &armservicefabricmesh.ResourceRequests{\n\t\t// \t\t\t\t\t\t\t\tCPU: to.Ptr[float64](1),\n\t\t// \t\t\t\t\t\t\t\tMemoryInGB: to.Ptr[float64](1),\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}},\n\t\t// \t\t\t\tNetworkRefs: []*armservicefabricmesh.NetworkRef{\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sbz_demo/providers/Microsoft.ServiceFabricMesh/networks/sampleNetwork\"),\n\t\t// \t\t\t\t\t\tEndpointRefs: []*armservicefabricmesh.EndpointRef{\n\t\t// \t\t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\t\tName: to.Ptr(\"helloWorldListener\"),\n\t\t// \t\t\t\t\t\t}},\n\t\t// \t\t\t\t}},\n\t\t// \t\t\t\tOSType: to.Ptr(armservicefabricmesh.OperatingSystemTypeLinux),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "a697a862c221398667f2342795d40b29", "score": "0.43905947", "text": "func ExampleEdgeModulesClient_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\tclient, err := armvideoanalyzer.NewEdgeModulesClient(\"591e76c3-3e97-44db-879c-3e2b12961b62\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(\"testrg\",\n\t\t\"testaccount2\",\n\t\t&armvideoanalyzer.EdgeModulesClientListOptions{Top: nil})\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "367a138d25063a841d42b3d3dcda5c6d", "score": "0.43852842", "text": "func ExampleAccountConnectorsClient_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\tclient, err := armsecurity.NewAccountConnectorsClient(\"20ff7fc3-e762-44dd-bd96-b71116dcdc23\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0236df3f1cf8f52b436974995821564c", "score": "0.438446", "text": "func ExampleLedgerClient_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\tclient, err := armconfidentialledger.NewLedgerClient(\"0000000-0000-0000-0000-000000000001\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByResourceGroupPager(\"DummyResourceGroupName\",\n\t\t&armconfidentialledger.LedgerClientListByResourceGroupOptions{Filter: nil})\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "437e04561eac38a8cc92eed70f50e606", "score": "0.43833312", "text": "func (c *Client) NewListContainersPager(o *ListContainersOptions) *runtime.Pager[ListContainersResponse] {\n\treturn c.svc.NewListContainersPager(o)\n}", "title": "" }, { "docid": "0c6ba1d72a0f21aaa2ba65920d8c82b0", "score": "0.43767455", "text": "func cmdListComponents(ccmd *cobra.Command, args []string) {\n\taplSvc := apl.NewClient()\n\n\toutput := runListCommand(&componentParams, aplSvc.Components.List)\n\n\tif output != nil {\n\t\tfields := []string{\"ID\", \"Name\", \"Category\", \"Versions\"}\n\t\tprintTableResultsCustom(output.([]apl.Component), fields)\n\t}\n}", "title": "" }, { "docid": "4927165601b14ee07205fbbce72fa7a4", "score": "0.4372808", "text": "func NewComponentsCommand() *cobra.Command {\n\n\tcmd := createListCommand(cmdListComponents, \"components\", \"\")\n\tgetCmd := createGetCommand(cmdGetComponents, \"component\", \"\")\n\n\t// command flags\n\tcmd.Flags().StringVar(&componentParams.Name, \"name\", \"\", \"Filter components by category\")\n\tcmd.Flags().StringVar(&componentParams.Category, \"category\", \"\", \"Filter components by category\")\n\n\t// add sub commands\n\tcmd.AddCommand(getCmd)\n\n\treturn cmd\n\n}", "title": "" }, { "docid": "1ce7c6f79109c6caedfd998b6fd489d1", "score": "0.43704918", "text": "func (client *DevicesClient) NewListByManagerPager(resourceGroupName string, managerName string, options *DevicesClientListByManagerOptions) *runtime.Pager[DevicesClientListByManagerResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[DevicesClientListByManagerResponse]{\n\t\tMore: func(page DevicesClientListByManagerResponse) bool {\n\t\t\treturn false\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *DevicesClientListByManagerResponse) (DevicesClientListByManagerResponse, error) {\n\t\t\treq, err := client.listByManagerCreateRequest(ctx, resourceGroupName, managerName, options)\n\t\t\tif err != nil {\n\t\t\t\treturn DevicesClientListByManagerResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn DevicesClientListByManagerResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn DevicesClientListByManagerResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByManagerHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "69fee86f39e0e62f356b67be4b8f3fde", "score": "0.43603057", "text": "func ExampleFileServersClient_NewListByDevicePager() {\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\tclient, err := armstorsimple1200series.NewFileServersClient(\"9eb689cd-7243-43b4-b6f6-5c65cb296641\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListByDevicePager(\"HSDK-DMNJB2PET0\",\n\t\t\"ResourceGroupForSDKTest\",\n\t\t\"hAzureSDKOperations\",\n\t\tnil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c29e77d3a65da2c014bb6cee14eb3e1e", "score": "0.4354148", "text": "func ExampleExemptionsClient_NewListForManagementGroupPager() {\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 := armpolicy.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewExemptionsClient().NewListForManagementGroupPager(\"DevOrg\", &armpolicy.ExemptionsClientListForManagementGroupOptions{Filter: to.Ptr(\"atScope()\")})\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.ExemptionListResult = armpolicy.ExemptionListResult{\n\t\t// \tValue: []*armpolicy.Exemption{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"ResearchBudgetExemption\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.Authorization/policyExemptions\"),\n\t\t// \t\t\tID: to.Ptr(\"/providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyExemptions/ResearchBudgetExemption\"),\n\t\t// \t\t\tProperties: &armpolicy.ExemptionProperties{\n\t\t// \t\t\t\tDescription: to.Ptr(\"Exempt demo cluster from limit sku\"),\n\t\t// \t\t\t\tDisplayName: to.Ptr(\"Exempt demo cluster\"),\n\t\t// \t\t\t\tExemptionCategory: to.Ptr(armpolicy.ExemptionCategoryWaiver),\n\t\t// \t\t\t\tMetadata: map[string]any{\n\t\t// \t\t\t\t\t\"reason\": \"Temporary exemption for a expensive VM demo\",\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tPolicyAssignmentID: to.Ptr(\"/providers/Microsoft.Management/managementGroups/HardwareDivision/providers/Microsoft.Authorization/policyAssignments/CostManagement\"),\n\t\t// \t\t\t\tPolicyDefinitionReferenceIDs: []*string{\n\t\t// \t\t\t\t\tto.Ptr(\"Limit_Skus\")},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tSystemData: &armpolicy.SystemData{\n\t\t// \t\t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-07-01T01:01:01.1075056Z\"); return t}()),\n\t\t// \t\t\t\t\tCreatedBy: to.Ptr(\"string\"),\n\t\t// \t\t\t\t\tCreatedByType: to.Ptr(armpolicy.CreatedByTypeUser),\n\t\t// \t\t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-07-01T02:01:01.1075056Z\"); return t}()),\n\t\t// \t\t\t\t\tLastModifiedBy: to.Ptr(\"string\"),\n\t\t// \t\t\t\t\tLastModifiedByType: to.Ptr(armpolicy.CreatedByTypeUser),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t\t\t{\n\t\t// \t\t\t\tName: to.Ptr(\"VNetIsMonitored\"),\n\t\t// \t\t\t\tType: to.Ptr(\"Microsoft.Authorization/policyExemptions\"),\n\t\t// \t\t\t\tID: to.Ptr(\"/providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyExemptions/VNetIsMonitored\"),\n\t\t// \t\t\t\tProperties: &armpolicy.ExemptionProperties{\n\t\t// \t\t\t\t\tDescription: to.Ptr(\"Exempt jump box open ports from limit ports policy\"),\n\t\t// \t\t\t\t\tDisplayName: to.Ptr(\"Exempt jump box open ports\"),\n\t\t// \t\t\t\t\tExemptionCategory: to.Ptr(armpolicy.ExemptionCategoryMitigated),\n\t\t// \t\t\t\t\tMetadata: map[string]any{\n\t\t// \t\t\t\t\t\t\"reason\": \"Need to open RDP port to corp net\",\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tPolicyAssignmentID: to.Ptr(\"/providers/Microsoft.Management/managementGroups/HardwareDivision/providers/Microsoft.Authorization/policyAssignments/LimitPorts\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tSystemData: &armpolicy.SystemData{\n\t\t// \t\t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-07-01T01:01:01.1075056Z\"); return t}()),\n\t\t// \t\t\t\t\tCreatedBy: to.Ptr(\"string\"),\n\t\t// \t\t\t\t\tCreatedByType: to.Ptr(armpolicy.CreatedByTypeUser),\n\t\t// \t\t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-07-01T02:01:01.1075056Z\"); return t}()),\n\t\t// \t\t\t\t\tLastModifiedBy: to.Ptr(\"string\"),\n\t\t// \t\t\t\t\tLastModifiedByType: to.Ptr(armpolicy.CreatedByTypeUser),\n\t\t// \t\t\t\t},\n\t\t// \t\t}},\n\t\t// \t}\n\t}\n}", "title": "" }, { "docid": "b537baab88298697d68ed5dfe5a01999", "score": "0.43486217", "text": "func ExampleWorkspacesClient_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\tclient, err := armsynapse.NewWorkspacesClient(\"00000000-1111-2222-3333-444444444444\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := client.NewListPager(nil)\n\tfor pager.More() {\n\t\tnextResult, 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 nextResult.Value {\n\t\t\t// TODO: use page item\n\t\t\t_ = v\n\t\t}\n\t}\n}", "title": "" } ]
5661ea29b9014a040faaf511b9d154c1
/ ApplicationDelete Method for ApplicationDelete Deletes an application and all associated data. Warning this deletes it all, including your data This deletes everything created with the application, including any volumes, LUNs, NFS export policies, CIFS shares, and initiator groups. Initiator groups are only destroyed if they were created as part of an application and are no longer in use by other applications. Learn more [&x60;DOC /application&x60;](docsapplicationoverview) [&x60;DOC Asynchronous operations&x60;](docsdocsSynchronousandasynchronousoperations)
[ { "docid": "fb718375b45957b2d51a262429921c8f", "score": "0.71220887", "text": "func (a *ApplicationApiService) ApplicationDelete(ctx _context.Context, uuid string) (JobLinkResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue JobLinkResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/application/applications/{uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"uuid\"+\"}\", _neturl.QueryEscape(parameterToString(uuid, \"\")), -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\", \"application/hal+json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 202 {\n\t\t\tvar v JobLinkResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\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": "2c11c9a7561117a4a5139b84cb139602", "score": "0.7590632", "text": "func DeleteApplication(request *http.Request) (string, interface{}) {\n\tappName := request.FormValue(\"app_name\")\n\tnamespace := request.FormValue(\"ns\")\n\trc, exsit := sync.ListReplicationController[namespace][appName]\n\tif !exsit {\n\t\treturn r.StatusNotFound, \"application named \" + appName + ` does't exist`\n\t}\n\tif err := resource.DeleteResource(&rc); err != nil {\n\t\treturn r.StatusInternalServerError, \"delete application err: \" + err.Error()\n\t}\n\tsvc := sync.ListService[namespace][appName]\n\tif &svc == nil {\n\t\treturn r.StatusNotFound, \"application named \" + appName + `does't exist`\n\t}\n\tif err := resource.DeleteResource(&svc); err != nil {\n\t\treturn r.StatusInternalServerError, \"delete application err: \" + err.Error()\n\t}\n\tapp := &application.App{Name: appName}\n\tif err := app.Delete(); err != nil {\n\t\treturn r.StatusInternalServerError, \"the application is delete,but update the application's status err: \" + err.Error()\n\t}\n\treturn r.StatusNoContent, \"delete app successed\"\n}", "title": "" }, { "docid": "82693bd91f0b92c874a94435caed8dff", "score": "0.74983764", "text": "func (client BaseClient) DeleteApplication(ctx context.Context, applicationID string) (result autorest.Response, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/BaseClient.DeleteApplication\")\n defer func() {\n sc := -1\n if result.Response != nil {\n sc = result.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n req, err := client.DeleteApplicationPreparer(ctx, applicationID)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"DeleteApplication\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.DeleteApplicationSender(req)\n if err != nil {\n result.Response = resp\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"DeleteApplication\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.DeleteApplicationResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"DeleteApplication\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "3590b64eebdb7b0567bccb0ea95a3756", "score": "0.7246492", "text": "func (p *provider) DeleteApplication(ctx context.Context, applicationObjectID string) (autorest.Response, error) {\n\treturn p.appClient.Delete(ctx, applicationObjectID)\n}", "title": "" }, { "docid": "293ee0ce1493b67aff8f9311283b1ce7", "score": "0.7214468", "text": "func (service *ApplicationService) DeleteApplication(app *Application) error {\n\tjobType := \"deleteApplication\"\n\ttaskDescription := fmt.Sprintf(\"Deleting Application: %s\", app.Name)\n\treturn service.sendTask(app, jobType, taskDescription)\n}", "title": "" }, { "docid": "864982d4032ba18920ef5f58eebef423", "score": "0.70182246", "text": "func DeleteApplication(applicationRepository data.AppRepository) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tid, err := strconv.ParseInt(vars[\"id\"], 10, 64)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tappClaims, ok := common.FromContext(r.Context())\n\t\tif ok != true {\n\t\t\tpanic(errors.New(\"cannot get value from context\"))\n\t\t}\n\t\t_, err = applicationRepository.DeleteApplication(appClaims.Username, id)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}\n}", "title": "" }, { "docid": "bbee90e438cf9d15dba8a7bc7b55b72d", "score": "0.68866706", "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": "33b5914bc921fa0027ac77ead0c09b2f", "score": "0.6837296", "text": "func (client BaseClient) DeleteApplicationResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n }", "title": "" }, { "docid": "87d65226883d4c6dc39e5f6b8241b9ca", "score": "0.68290234", "text": "func (querier *ModelQuerier) DeleteApplication(user *User, appName string) (*User, error) {\n\n\t// Search for the app to delete.\n\tvar appToDelete Application\n\tvar newApps []Application\n\tfor i, app := range user.Applications {\n\t\tif app.Name == appName {\n\t\t\tnewApps = append(user.Applications[:i], user.Applications[i+1:]...)\n\t\t\tappToDelete = app\n\t\t}\n\t}\n\n\t// If an app with that name does not exist.\n\tif newApps == nil {\n\t\treturn nil, errors.New(\"Could not find application with that name\")\n\t}\n\n\t// Drop the app's table.\n\terr := r.DB(\"test\").TableDrop(appToDelete.TableName).Exec(querier.session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Resave the user with the updated application list.\n\tuser.Applications = newApps\n\treturn querier.Save(user)\n}", "title": "" }, { "docid": "230b69c778118f9be28bde5bc514ded7", "score": "0.6794069", "text": "func (client *Client) DeleteApplication(name string) (*DeploymentID, error) {\n\t/* step: check of the application already exists */\n\tclient.log(\"DeleteApplication() Deleting the application: %s\", name)\n\tdeployID := new(DeploymentID)\n\tif err := client.apiDelete(fmt.Sprintf(\"%s/%s\", MARATHON_API_APPS, trimRootPath(name)), nil, deployID); err != nil {\n\t\treturn nil, err\n\t}\n\treturn deployID, nil\n}", "title": "" }, { "docid": "145a8ea55bd03cf1f1d1f0ccbcf9821b", "score": "0.6681967", "text": "func (client BaseClient) DeleteApplicationSender(req *http.Request) (*http.Response, error) {\n sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n return autorest.SendWithSender(client, req, sd...)\n }", "title": "" }, { "docid": "67a30c638844fd07f0e79efbb5d85734", "score": "0.6637262", "text": "func deleteApp(c *cli.Context) error {\n\tif c.Bool(\"all\") {\n\t\treturn deleteAll(c)\n\t}\n\n\tif len(c.Args()) == 0 {\n\t\treturn fmt.Errorf(\"name required\")\n\t}\n\n\tif c.String(\"cluster\") == \"\" {\n\t\treturn fmt.Errorf(\"cluster required\")\n\t}\n\n\tswan, err := getRemote(\"swan\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif swan == \"\" {\n\t\treturn fmt.Errorf(\"swan address not found\")\n\t}\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"DELETE\", fmt.Sprintf(\"%s/apps/%s\", swan, c.Args()[0]), nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Make new request failed: %s\", err.Error())\n\t}\n\n\t_, err = client.Do(req)\n\n\treturn err\n}", "title": "" }, { "docid": "9ab5921e77e4c66a95f2a80e71f4aaca", "score": "0.6621732", "text": "func RunAppDelete(app string) error {\n\tspinner.Start()\n\tdefer spinner.Stop()\n\t// get appID from name\n\tapp, err := EnsureAppID(app)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// request\n\treq, err := http.NewRequest(http.MethodDelete, common.AccAPIURL+\"/app/\"+app, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := session.SendRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tspinner.Stop()\n\t// decode\n\tvar res deleteRespBody\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&res)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// output\n\tfmt.Println(res.Message)\n\treturn nil\n}", "title": "" }, { "docid": "4797e490597a840631fcb318283848fb", "score": "0.63774997", "text": "func (cmd *DeleteApplicationCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/v1/projects/%v/applications/%v\", url.QueryEscape(cmd.Projectid), url.QueryEscape(cmd.Appid))\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.DeleteApplication(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "title": "" }, { "docid": "79993857467dadcd14038a377f8762cc", "score": "0.6374888", "text": "func DeleteApp(ctx context.Context, engine string, appName string, headers http.Header, tlsClientConfig *tls.Config) {\n\tglobal := PrepareEngineState(ctx, headers, tlsClientConfig, false, true).Global\n\tappID, _ := applyNameToIDTransformation(appName)\n\tsucc, err := global.DeleteApp(ctx, appID)\n\tif err != nil {\n\t\tlog.Fatalf(\"could not delete app with name '%s' and ID '%s': %s\\n\", appName, appID, err)\n\t} else if !succ {\n\t\tlog.Fatalf(\"could not delete app with name '%s' and ID '%s'\\n\", appName, appID)\n\t}\n\tSetAppIDToKnownApps(appName, appID, true)\n}", "title": "" }, { "docid": "fddaadae2daf7f0445df8d35679868a6", "score": "0.6281562", "text": "func (cf CloudFormation) DeleteApp(appName string) error {\n\tif err := cf.appStackSet.Delete(fmt.Sprintf(\"%s-infrastructure\", appName)); err != nil {\n\t\treturn err\n\t}\n\treturn cf.cfnClient.DeleteAndWait(fmt.Sprintf(\"%s-infrastructure-roles\", appName))\n}", "title": "" }, { "docid": "2a3cc0e020e947e237d24799985f49fd", "score": "0.62604946", "text": "func (as *AppStorage) DeleteApp(id string) error {\n\tif !bson.IsObjectIdHex(id) {\n\t\treturn model.ErrorWrongDataFormat\n\t}\n\ts := as.db.Session(AppsCollection)\n\tdefer s.Close()\n\n\terr := s.C.RemoveId(bson.ObjectIdHex(id))\n\treturn err\n}", "title": "" }, { "docid": "9e7f8386fe4adb328ae9f06a9a87c0f5", "score": "0.62527746", "text": "func newSubCmdApplicationDelete(gOpt *common.GlobalOptions) *cobra.Command {\n\n\to := newDeleteOptions(gOpt)\n\n\tcmd := &cobra.Command{\n\t\tUse: `delete {-n|--name NAME}`,\n\t\tShort: \"Delete an application.\",\n\t\tLong: `Delete an application registered by FuseML`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcommon.CheckErr(o.InitializeClients(gOpt.URL, gOpt.Timeout, gOpt.Verbose))\n\t\t\tcommon.CheckErr(o.validate())\n\t\t\tcommon.CheckErr(o.run())\n\t\t},\n\t\tArgs: cobra.ExactArgs(0),\n\t}\n\n\tcmd.Flags().StringVarP(&o.Name, \"name\", \"n\", \"\", \"application name\")\n\tcmd.MarkFlagRequired(\"name\")\n\treturn cmd\n}", "title": "" }, { "docid": "1c3c2aac98f48c08c2d21324a3d8642a", "score": "0.62453187", "text": "func (a *ApplicationManager) Delete(ctx context.Context, log *zap.SugaredLogger, seedClient ctrlruntimeclient.Client, userClient ctrlruntimeclient.Client, applicationInstallation *appskubermaticv1.ApplicationInstallation) (util.StatusUpdater, error) {\n\ttemplateProvider, err := providers.NewTemplateProvider(ctx, log, seedClient, a.Kubeconfig, a.ApplicationCache, applicationInstallation, a.SecretNamespace, a.CABundleFile)\n\tif err != nil {\n\t\treturn util.NoStatusUpdate, fmt.Errorf(\"failed to initialize template provider: %w\", err)\n\t}\n\n\treturn templateProvider.Uninstall(applicationInstallation)\n}", "title": "" }, { "docid": "1a39ef2438964986d081f4a5f8659e6e", "score": "0.623271", "text": "func (c *Client) ApplicationGroupDelete(ctx context.Context, objID string) error {\n\tparams := application_group.NewApplicationGroupDeleteParams()\n\tparams.ID = objID\n\tparams.Context = ctx\n\tc.Log.Debugf(\"Deleting ApplicationGroup %s\", params.ID)\n\tsAPI := c.ClientAPI.ApplicationGroup()\n\t_, err := sAPI.ApplicationGroupDelete(params)\n\tif err != nil {\n\t\tif e, ok := err.(*application_group.ApplicationGroupDeleteDefault); ok {\n\t\t\terr = NewError(e.Payload)\n\t\t}\n\t\tc.Log.Errorf(\"Delete ApplicationGroup %s error: %s\", params.ID, err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30616b7d3b2220b94fd07926390143d2", "score": "0.6223298", "text": "func (client BaseClient) DeleteApplicationPreparer(ctx context.Context, applicationID string) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"applicationId\": autorest.Encode(\"path\",applicationID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsDelete(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v2/applications/{applicationId}\",pathParameters))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "12186d1aea6c025e264f99bdd82a9dd0", "score": "0.62138444", "text": "func (s *Service) DeleteApp(ctx context.Context, req *pbcs.DeleteAppReq) (*pbcs.DeleteAppResp, error) {\n\tkt := kit.FromGrpcContext(ctx)\n\tresp := new(pbcs.DeleteAppResp)\n\n\tauthRes := &meta.ResourceAttribute{Basic: &meta.Basic{Type: meta.App, Action: meta.Delete, ResourceID: req.Id},\n\t\tBizID: req.BizId}\n\terr := s.authorizer.AuthorizeWithResp(kt, resp, authRes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := &pbds.DeleteAppReq{\n\t\tId: req.Id,\n\t\tBizId: req.BizId,\n\t}\n\t_, err = s.client.DS.DeleteApp(kt.RpcCtx(), r)\n\tif err != nil {\n\t\tlogs.Errorf(\"delete app failed, err: %v, rid: %s\", err, kt.Rid)\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "c78ec8053e502256c10cb18ba46dce61", "score": "0.62036145", "text": "func (m MStub) AppDelete(appID AppID) error {\n\tif m.AppDelFail {\n\t\treturn errors.New(\"unable to delete app\")\n\t}\n\tif m.AppDelHalfFail {\n\t\tif m.FailCounter.Counter%2 == 0 {\n\t\t\tm.FailCounter.Counter++\n\t\t\treturn errors.New(\"unable to delete app\")\n\t\t}\n\t\tm.FailCounter.Counter++\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1fa13e00bcd5cffa12c2e65f1d4a196", "score": "0.61809266", "text": "func (m *ApplicationsWithAppIdRequestBuilder) Delete(ctx context.Context, requestConfiguration *ApplicationsWithAppIdRequestBuilderDeleteRequestConfiguration)(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": "2d28b118c9c6ee967c07ab0ee09ce05c", "score": "0.6179551", "text": "func Remove(a *app.App) {\n lock.Lock()\n defer lock.Unlock()\n\n removeCapabilities(a)\n removeDependencies(a)\n removeInstanceId(a)\n msg_archive.RemoveAppsMessages(a)\n}", "title": "" }, { "docid": "4f206800705878dbe728111b6541b5b3", "score": "0.6176127", "text": "func cleanupApp(kubectlArgs []string, clients map[string]kubeclient.Interface, filepath string) {\n\targs := append(kubectlArgs, \"-f\", filepath)\n\tfor k := range clients {\n\t\tglog.Infof(\"Deleting app from cluster %s\", k)\n\t\tdeleteArgs := append(args, []string{\"delete\", fmt.Sprintf(\"--context=%s\", k)}...)\n\t\tkubeutils.ExecuteCommand(deleteArgs)\n\t}\n}", "title": "" }, { "docid": "2d6303166b738054ac6089d7181dce47", "score": "0.6167489", "text": "func (querier *ModelQuerier) DeleteApplicationData(\n\tapp *Application, path lib.Path) error {\n\n\t// Empty the table if the path is root.\n\tif path.IsRoot() {\n\t\terr := r.Table(app.TableName).Delete().Exec(querier.session)\n\t\treturn err\n\t}\n\n\t// Delete the top-level doc if the path isn't nested.\n\tif len(path.RemainingSegments) == 0 {\n\t\terr := r.Table(app.TableName).Filter(map[string]string{\n\t\t\t\"name\": path.TopLevelDocName}).Delete().Exec(querier.session)\n\t\treturn err\n\t}\n\n\t// If the path is nested, read the data, then delete the given entry from the map,\n\t// then resave.\n\n\t// The below code is partly taken from ReadApplicationData and can probably be refactored.\n\tres, err := r.Table(app.TableName).Filter(map[string]string{\"name\": path.TopLevelDocName}).Run(querier.session)\n\tdefer res.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the top-level doc for this query doesn't exist, return nil.\n\tif res.IsNil() {\n\t\treturn nil\n\t}\n\n\tvar doc appDoc\n\terr = res.One(&doc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnextMapLevel, ok := doc.Data.(map[string]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\n\t// Dive into the nested maps.\n\tfor idx, segment := range path.RemainingSegments {\n\t\t// Try to get the next nested level for each remaining segment.\n\t\t_, ok = nextMapLevel[segment]\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\n\t\t// If this is the last segment, delete it from the map and replace in the db.\n\t\tif idx == len(path.RemainingSegments)-1 {\n\t\t\tdelete(nextMapLevel, segment)\n\t\t\terr = r.Table(app.TableName).Get(doc.ID).Replace(doc).Exec(querier.session)\n\t\t\treturn err\n\t\t}\n\n\t\tnextMapLevel, ok = nextMapLevel[segment].(map[string]interface{})\n\t\t// The nest doesn't go any further, so return nil.\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// This should never be reached.\n\tlog.Println(\"ERROR: This should never be reached.\")\n\treturn nil\n}", "title": "" }, { "docid": "8c3778b58343089d0dce796a539e5f52", "score": "0.61423355", "text": "func (a *ApplicationsController) Delete(rw http.ResponseWriter, req *http.Request, pathParams httprouter.Params) {\n\tpparam := pathParams.ByName(\"name\")\n\terr := a.AppStore.Delete(pparam)\n\tif err != nil {\n\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\trw.Write([]byte(fmt.Sprintf(`{\"message\":\"Unkown error, %v\", \"type\": \"error\"}`, err)))\n\t\treturn\n\t}\n\trw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "8c348218c007804dfa09d2afd5d1a50c", "score": "0.6124672", "text": "func ExampleApplicationGroupsClient_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 := armdesktopvirtualization.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.NewApplicationGroupsClient().Delete(ctx, \"resourceGroup1\", \"applicationGroup1\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "title": "" }, { "docid": "5ec42816693feba39570c6421620b3e9", "score": "0.611274", "text": "func (a *ApplicationApiService) DeleteApplicationApiV1AppAppIdDeleteExecute(r ApiDeleteApplicationApiV1AppAppIdDeleteRequest) (*_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\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ApplicationApiService.DeleteApplicationApiV1AppAppIdDelete\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/app/{app_id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"app_id\"+\"}\", _neturl.PathEscape(parameterToString(r.appId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif strlen(r.appId) < 1 {\n\t\treturn nil, reportError(\"appId must have at least 1 elements\")\n\t}\n\tif strlen(r.appId) > 256 {\n\t\treturn nil, reportError(\"appId must have less than 256 elements\")\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 := a.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 := a.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\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\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 HttpErrorOut\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 HttpErrorOut\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 HttpErrorOut\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 HttpErrorOut\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 == 422 {\n\t\t\tvar v HTTPValidationError\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}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4fae72056c416ca091f66ac32dc55850", "score": "0.6102518", "text": "func (w *Wrapper) DeleteApp(clusterID string, appName string, p *AuxiliaryParams) (*apps.DeleteClusterAppV4OK, error) {\n\tparams := apps.NewDeleteClusterAppV4Params().WithClusterID(clusterID).WithAppName(appName)\n\tsetParams(p, w, params)\n\n\tauthWriter, err := getAuthorization(w)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tresponse, err := w.gsclient.Apps.DeleteClusterAppV4(params, authWriter)\n\tif err != nil {\n\t\treturn nil, clienterror.New(err)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "fe7275f1ad0ab6971bdfbb477ccf6663", "score": "0.61005336", "text": "func (a *Client) DeleteApp(params *DeleteAppParams) (*DeleteAppNoContent, 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/{appID}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteAppReader{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.(*DeleteAppNoContent)\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": "df2093c4ca1b1bb3fe268044b0f54d34", "score": "0.60776883", "text": "func (adm Admin) DeleteApp(AppID string) error {\n\tappID := C.CString(AppID)\n\tdefer C.free(unsafe.Pointer(appID))\n\t_, err := await(C.tanker_admin_delete_app(adm.admin, appID))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffef40f544f308786f2bc590bca029f", "score": "0.6076957", "text": "func (c *cfDeleteWrapper) MultiAppDelete(cli plugin.CliConnection) {\n\n\t// Get the list of apps to be delete\n\tapps := spiltString(cmdOptions.AppName)\n\n\t// Check with user if they want to continue\n\tif !cmdOptions.Force {\n\t\tyesOrNoConfirmation(cmdOptions.AppName)\n\t}\n\n\t// Get the app and delete the app\n\tcheckDeleteApp(cli, apps, false)\n\n}", "title": "" }, { "docid": "4651bc3d661bb52454928c14d7f957aa", "score": "0.60303634", "text": "func appsDestroy(db *gorm.DB, app *App) error {\n\treturn db.Delete(app).Error\n}", "title": "" }, { "docid": "686d87c95e068a9defe966c794407301", "score": "0.6016138", "text": "func checkDeleteApp(cli plugin.CliConnection, apps []string, exit bool) {\n\n\t// loop through the app list and delete the app\n\tfor _, app := range apps {\n\n\t\t// Get the app info\n\t\tappInfo, _ := cli.GetApp(app)\n\n\t\t// App not found\n\t\tif appInfo.Guid == \"\" {\n\t\t\thandleError(fmt.Sprintf(\"ERROR: App \\\"%s\\\" not found on the current org & space, continuing with remaining apps...\", app), exit)\n\t\t} else {\n\t\t\t// Run the curl command to delete the app\n\t\t\toutput, err := cli.CliCommandWithoutTerminalOutput(\"curl\", \"-X\", \"DELETE\", fmt.Sprintf(\"/v2/apps/%s\", appInfo.Guid))\n\t\t\tif err != nil {\n\t\t\t\thandleError(fmt.Sprintf(\"ERROR: Received error when deleting the app \\\"%s\\\", err: %v\", appInfo.Name, err), exit)\n\t\t\t\tfmt.Println(\"continuing with other apps, if there is any...\")\n\t\t\t}\n\n\t\t\t// If we found any message, that means the CLI wants to tell us something is wrong\n\t\t\tif len(output) > 1 {\n\t\t\t\thandleError(fmt.Sprintf(\"ERROR: Something went wrong when deleting the app \\\"%s\\\", message: \\n%v\", appInfo.Name, output), exit)\n\t\t\t\tfmt.Println(\"continuing with other apps, if there is any...\")\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"\\nSuccessfully deleted the app \\\"\" + appInfo.Name + \"\\\"\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d20a6252845abe88ea66785f2e31fa8c", "score": "0.6014257", "text": "func (a *ApplicationDaoImpl) DeleteApp(appID string) error {\n\tvar app model.Application\n\tif err := a.DB.Where(\"app_id=?\", appID).Find(&app).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn bcode.ErrApplicationNotFound\n\t\t}\n\t\treturn err\n\t}\n\treturn a.DB.Delete(&app).Error\n}", "title": "" }, { "docid": "fc1217379e03268b4a5d07c08b12597a", "score": "0.60075533", "text": "func DeleteAppSession(c *gin.Context) {\n\n\tvar eventsSubscReqData *models.EventsSubscReqData\n\terr := c.ShouldBindJSON(eventsSubscReqData)\n\tif err != nil {\n\t\teventsSubscReqData = nil\n\t}\n\n\treq := http_wrapper.NewRequest(c.Request, eventsSubscReqData)\n\treq.Params[\"appSessionId\"], _ = c.Params.Get(\"appSessionId\")\n\tchannelMsg := message.NewHttpChannelMessage(message.EventDeleteAppSession, req)\n\n\tmessage.SendMessage(channelMsg)\n\trecvMsg := <-channelMsg.HttpChannel\n\n\tHTTPResponse := recvMsg.HTTPResponse\n\tc.JSON(HTTPResponse.Status, HTTPResponse.Body)\n}", "title": "" }, { "docid": "6ec42d767c54fc93f7597149ecff775f", "score": "0.59855956", "text": "func (as *AppStorage) DeleteApp(id string) error {\n\treturn nil\n}", "title": "" }, { "docid": "6ec42d767c54fc93f7597149ecff775f", "score": "0.59855956", "text": "func (as *AppStorage) DeleteApp(id string) error {\n\treturn nil\n}", "title": "" }, { "docid": "209fd33799fc15757ea237ad33ffec22", "score": "0.59819126", "text": "func (app *Application) Delete() (num int64, err error){\n\to := orm.NewOrm()\n\to.Using(\"default\")\n\tnum, err = o.Delete(app)\n\treturn\n}", "title": "" }, { "docid": "169eab20f152271512d2771d2ece9837", "score": "0.5969449", "text": "func (r *DeviceAppManagementRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "0d1d6d3fea1732d14b2d459658b4ab19", "score": "0.59572715", "text": "func TestFinalizeAppDeletion(t *testing.T) {\n\tapp := newFakeApp()\n\tctrl := newFakeController(app)\n\n\tfakeAppCs := ctrl.applicationClientset.(*appclientset.Clientset)\n\tpatched := false\n\tfakeAppCs.ReactionChain = nil\n\tfakeAppCs.AddReactor(\"patch\", \"*\", func(action kubetesting.Action) (handled bool, ret runtime.Object, err error) {\n\t\tpatched = true\n\t\treturn true, nil, nil\n\t})\n\terr := ctrl.finalizeApplicationDeletion(app)\n\t// TODO: use an interface to fake out the calls to GetResourcesWithLabel and DeleteResourceWithLabel\n\t// For now just ensure we have an expected error condition\n\tassert.Error(t, err) // Change this to assert.Nil when we stub out GetResourcesWithLabel/DeleteResourceWithLabel\n\tassert.False(t, patched) // Change this to assert.True when we stub out GetResourcesWithLabel/DeleteResourceWithLabel\n\n}", "title": "" }, { "docid": "405f3324511f675e2913ef5819e09538", "score": "0.5947154", "text": "func DeleteAppConfig() {\n\tconfigMap := &corev1.ConfigMap{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ConfigMap\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"fluentd-app-config\",\n\t\t\tNamespace: config.Namespace,\n\t\t\tLabels: config.Labels,\n\t\t},\n\t}\n\tConfigLock.Lock()\n\tdefer ConfigLock.Unlock()\n\tsdkdecorator.CallSdkFunctionWithLogging(sdk.Delete)(configMap)\n}", "title": "" }, { "docid": "57147f0f061ade87a0b45cf135b09a01", "score": "0.5936507", "text": "func (recv *AppInfo) Delete() bool {\n\tretC := C.g_app_info_delete((*C.GAppInfo)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "2ac77fb2d1a761d7b38731344f936824", "score": "0.59296733", "text": "func (c *BackendAppsManagementStore) DeleteApp(appID string) error {\n\terr := c.repository.DeleteOne(backends.NewFilter().Match(\"id\", appID))\n\tif err != nil {\n\t\tif err.Error() == \"not found\" {\n\t\t\treturn goa.ErrNotFound(\"no app found!\")\n\t\t}\n\t\treturn goa.ErrInternal(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a6041507c545dd84bc7d3d81db645e7c", "score": "0.5924435", "text": "func (dr *DBRepo) DeleteApp(dbID, appID int) error {\n\tsql := `delete from t_meta_app_db_map where app_id = ? and db_id = ?;`\n\tlog.Debugf(\"metadata DBRepo.DeleteApp() delete sql: %s\", sql)\n\t_, err := dr.Execute(sql, appID, dbID)\n\n\treturn err\n}", "title": "" }, { "docid": "2ac0f26b1b0e241d136209cdd2e6f5ac", "score": "0.59135586", "text": "func DeleteAppConfig() {\n\tconfigMap := &corev1.ConfigMap{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ConfigMap\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"fluent-bit-app-config\",\n\t\t\tNamespace: config.Namespace,\n\t\t\tLabels: config.Labels,\n\t\t},\n\t}\n\tConfigLock.Lock()\n\tdefer ConfigLock.Unlock()\n\tsdkdecorator.CallSdkFunctionWithLogging(sdk.Delete)(configMap)\n}", "title": "" }, { "docid": "88b5b443f0aa6192310315e66978f03b", "score": "0.5911547", "text": "func (c *cfDeleteWrapper) DeleteAppUsingManifest(cli plugin.CliConnection) {\n\n\t// Manifest\n\tm := new(Manifest)\n\n\t// Check if the manifest file exists and get the content\n\toutput := readManifest()\n\n\t// Get the app name from the manifest\n\terr := yaml.Unmarshal(output, &m)\n\tif err != nil {\n\t\thandleError(fmt.Sprintf(\"Encounteed error when unmarshaling the manifest ym, err: %v\", err), true)\n\t}\n\n\t// Check & Delete the app name\n\tif len(m.Applications) > 0 && m.Applications[0].Name != \"\" {\n\n\t\t// Extract app name\n\t\tvar apps []string\n\t\tfor _, a := range m.Applications {\n\t\t\tapps = append(apps, a.Name)\n\t\t}\n\n\t\t// Check with user if they want to continue\n\t\tif !cmdOptions.Force {\n\t\t\tyesOrNoConfirmation(strings.Join(apps, \",\"))\n\t\t}\n\n\t\t// Get the app and delete the app\n\t\tcheckDeleteApp(cli, apps, false)\n\n\t} else {\n\t\thandleError(\"Unable to find any information from manifest\", true)\n\t}\n}", "title": "" }, { "docid": "003a51900f074106d0a28a14749861f1", "score": "0.58687794", "text": "func (c *Client) DeleteApp(id string) error {\n\tresp, err := c.request(http.MethodDelete, fmt.Sprintf(\"/apps/%s\", url.PathEscape(id)), \"application/json\", nil)\n\tif err == nil {\n\t\tresp.Close()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "003a51900f074106d0a28a14749861f1", "score": "0.58687794", "text": "func (c *Client) DeleteApp(id string) error {\n\tresp, err := c.request(http.MethodDelete, fmt.Sprintf(\"/apps/%s\", url.PathEscape(id)), \"application/json\", nil)\n\tif err == nil {\n\t\tresp.Close()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "db2ee9391dca20f166967e96629e8725", "score": "0.5860998", "text": "func (a ApplicationApi) DeleteAppService(appId string, serviceId string) (*APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Delete\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/application/{appId}/service/{serviceId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"appId\"+\"}\", fmt.Sprintf(\"%v\", appId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"serviceId\"+\"}\", fmt.Sprintf(\"%v\", serviceId), -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/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: \"DeleteAppService\", 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": "24aa96c93217c7f351b91026b7862608", "score": "0.5858787", "text": "func deleteMobileApp(db *database.Database, app *database.MobileApp) error {\n\treturn db.RawDB().\n\t\tUnscoped().\n\t\tWhere(\"id = ?\", app.ID).\n\t\tDelete(&database.MobileApp{}).\n\t\tError\n}", "title": "" }, { "docid": "b33800018ab3353515bb0fe1977cc66b", "score": "0.5854236", "text": "func (am *ArtifactMap) DeleteApp(appGUID string) {\n\tam.DeleteItem(ResourceTypeApp, appGUID, ArtifactEntryCompareTypeID)\n}", "title": "" }, { "docid": "c7b4adf14390badd39c2bed04854c28e", "score": "0.5817715", "text": "func (r *ManagedAppOperationRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "dec884c43d17a9fc5ea683344134f05a", "score": "0.5809763", "text": "func (k Keeper) deleteApplicationFromStakingSet(ctx sdk.Context, application types.Application) {\n\tstore := ctx.KVStore(k.storeKey)\n\tstore.Delete(types.KeyForAppInStakingSet(application))\n\tctx.Logger().Info(\"Removing App From Staking Set \" + application.Address.String())\n}", "title": "" }, { "docid": "4c53f25fa3ae7f8260034d001de569c8", "score": "0.5804984", "text": "func (client *Client) DeleteMessageApp(request *DeleteMessageAppRequest) (response *DeleteMessageAppResponse, err error) {\n\tresponse = CreateDeleteMessageAppResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "07e07f6f11510304a90e31aeb7e875c4", "score": "0.57610244", "text": "func (m *ApplicationItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ApplicationItemRequestBuilderDeleteRequestConfiguration)(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": "4dda939b5c854d1e843317977bf4606b", "score": "0.5743202", "text": "func (r *ManagedMobileAppRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "662a43edbce2dab4f00bce49574a6aa0", "score": "0.5731609", "text": "func deleteEdgeAppResource(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {\n\t// Warning or errors can be collected in a slice type\n\tvar diags diag.Diagnostics\n\tclient := (meta.(Client)).Client\n\tname := rdEntryStr(d, \"name\")\n\tid := rdEntryStr(d, \"id\")\n\terrMsgPrefix := getErrMsgPrefix(\"Edge App\", name, id, \"Delete\")\n\tcfg, err := getEdgeApp(client, name, id)\n\tif err != nil {\n\t\treturn diag.Errorf(\"%s Failed to get EdgeApp. err: %s\", errMsgPrefix, err.Error())\n\t}\n\tif cfg == nil {\n\t\tlog.Printf(\"%s Unexpected Error. nil config\", errMsgPrefix)\n\t\treturn diags\n\t}\n\tclient.XRequestIdPrefix = \"TF-edgeapp-delete\"\n\turlExtension := getEdgeAppUrl(name, id, \"delete\")\n\trspData := &swagger_models.ZsrvResponse{}\n\t_, err = client.SendReq(\"DELETE\", urlExtension, nil, rspData)\n\tif err != nil {\n\t\treturn diag.Errorf(\"%s. Request Failed. err: %s\", errMsgPrefix, err.Error())\n\t}\n\tlog.Printf(\"[INFO] Edge App %s(id:%s) Delete Successful.\", name, cfg.ID)\n\treturn diags\n}", "title": "" }, { "docid": "ec033f3e28a7ed58e9ec49f55fcac454", "score": "0.5731325", "text": "func deleteAuthorizedApp(db *database.Database, key string) error {\n\tapp, err := db.FindAuthorizedAppByAPIKey(key)\n\tif err != nil {\n\t\tif database.IsNotFound(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"failed to lookup api key: %w\", err)\n\t}\n\n\treturn db.RawDB().\n\t\tUnscoped().\n\t\tWhere(\"id = ?\", app.ID).\n\t\tDelete(&database.AuthorizedApp{}).\n\t\tError\n}", "title": "" }, { "docid": "be50b84e5c296de5ed1e507f8b989fd0", "score": "0.5730381", "text": "func (c *AppClient) Delete() *AppDelete {\n\tmutation := newAppMutation(c.config, OpDelete)\n\treturn &AppDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "3fe743c409eb7636936b65ab63f50161", "score": "0.57216185", "text": "func (r *ManagedAppProtectionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "a82085a1a7868744e93a57e9c1a01888", "score": "0.5720556", "text": "func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, options *ApplicationsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif applicationName == \"\" {\n\t\treturn nil, errors.New(\"parameter applicationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{applicationName}\", url.PathEscape(applicationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "058abd8dba20b0e5b828500d39f95646", "score": "0.56999874", "text": "func (a *AppsEndpoint) Delete(project, service, app string, force bool) (*StatusResponse, *http.Response, error) {\n\tu := fmt.Sprintf(\"apps/%s/services/%s/apps/%s\", project, service, app)\n\treq, err := a.client.NewRequest(\"DELETE\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Add force parameter.\n\tif force {\n\t\tvalues := req.URL.Query()\n\t\tvalues.Add(\"force\", strconv.FormatBool(force))\n\t\treq.URL.RawQuery = values.Encode()\n\t}\n\tstatus := new(StatusResponse)\n\tresp, err := a.client.Do(req, status)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn status, resp, err\n}", "title": "" }, { "docid": "205a991f298e4b6bb7a3ee58cedb7af7", "score": "0.56977606", "text": "func (r *ManagedMobileLobAppRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "2020e36e776294a49696dc67a90f8cc1", "score": "0.56972295", "text": "func (r *ManagedAppRegistrationRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "462b65353d6b90126148927fbb40c487", "score": "0.5691908", "text": "func DeleteAppAppsBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AppsController, appID string) (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(\"/apps/%v\", appID),\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[\"appId\"] = []string{fmt.Sprintf(\"%v\", appID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"AppsTest\"), rw, req, prms)\n\tdeleteAppCtx, _err := app.NewDeleteAppAppsContext(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.DeleteApp(deleteAppCtx)\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": "79ad9205635c3113a59ac833920b152e", "score": "0.568604", "text": "func ExampleAppsClient_BeginDelete() {\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 := armappplatform.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewAppsClient().BeginDelete(ctx, \"myResourceGroup\", \"myservice\", \"myapp\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "title": "" }, { "docid": "bef781db6419205206da555f6434ad61", "score": "0.56777185", "text": "func (r *IOSVPPAppRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "6d4a0b08a858229448c6d25ffc76fafe", "score": "0.5669307", "text": "func (u *App) Delete(c echo.Context, id string) error {\n\tif err := u.rbac.EnforceRole(c, model.AdminRole); err != nil {\n\t\treturn err\n\t}\n\n\titem, err := u.udb.View(u.db, id)\n\tif err = zaplog.ZLog(err); err != nil {\n\t\treturn err\n\t}\n\n\tif item.Status != model.StatusDraft {\n\t\treturn errors.New(\"Apenas é possível eliminar bolsas em rascunho\")\n\t}\n\n\tvar count int\n\tif err := u.db.Model(&model.Application{}).Where(\"scholarship = ?\", id).Count(&count).Error; err == nil && count > 0 {\n\t\treturn errors.New(\"Elimine primeiro as candidaturas associadas a esta bolsa\")\n\t}\n\n\treturn u.udb.Delete(u.db, id)\n}", "title": "" }, { "docid": "c17221f09b29960a51f4580bd3c54507", "score": "0.565039", "text": "func (client ApplianceDefinitionsClient) Delete(resourceGroupName string, applianceDefinitionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {\n\tresultChan := make(chan autorest.Response, 1)\n\terrChan := make(chan error, 1)\n\tif err := validation.Validate([]validation.Validation{\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\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}},\n\t\t{TargetValue: applianceDefinitionName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"applianceDefinitionName\", Name: validation.MaxLength, Rule: 64, Chain: nil},\n\t\t\t\t{Target: \"applianceDefinitionName\", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {\n\t\terrChan <- validation.NewErrorWithValidationError(err, \"managedapplications.ApplianceDefinitionsClient\", \"Delete\")\n\t\tclose(errChan)\n\t\tclose(resultChan)\n\t\treturn resultChan, errChan\n\t}\n\n\tgo func() {\n\t\tvar err error\n\t\tvar result autorest.Response\n\t\tdefer func() {\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t}\n\t\t\tresultChan <- result\n\t\t\tclose(resultChan)\n\t\t\tclose(errChan)\n\t\t}()\n\t\treq, err := client.DeletePreparer(resourceGroupName, applianceDefinitionName, cancel)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"managedapplications.ApplianceDefinitionsClient\", \"Delete\", nil, \"Failure preparing request\")\n\t\t\treturn\n\t\t}\n\n\t\tresp, err := client.DeleteSender(req)\n\t\tif err != nil {\n\t\t\tresult.Response = resp\n\t\t\terr = autorest.NewErrorWithError(err, \"managedapplications.ApplianceDefinitionsClient\", \"Delete\", resp, \"Failure sending request\")\n\t\t\treturn\n\t\t}\n\n\t\tresult, err = client.DeleteResponder(resp)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"managedapplications.ApplianceDefinitionsClient\", \"Delete\", resp, \"Failure responding to request\")\n\t\t}\n\t}()\n\treturn resultChan, errChan\n}", "title": "" }, { "docid": "cc9cede0584575f3f8ee9d3b103c774b", "score": "0.56389046", "text": "func (client *Client) DeleteMessageAppWithCallback(request *DeleteMessageAppRequest, callback func(response *DeleteMessageAppResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DeleteMessageAppResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DeleteMessageApp(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": "6c96743f76f9a7d63897b245e665fa2f", "score": "0.56345856", "text": "func (c *LcmController) deleteAppPkgRecords(packageId, tenantId, clientIp string) error {\n\tappPkgRec := &models.AppPackageRecord{\n\t\tAppPkgId: packageId + tenantId,\n\t}\n\n\terr := c.Db.ReadData(appPkgRec, util.AppPkgId)\n\tif err != nil {\n\t\tc.HandleLoggingForError(clientIp, util.StatusNotFound, util.RecordDoesNotExist)\n\t\treturn err\n\t}\n\tvar origin = appPkgRec.Origin\n\n\terr = c.deleteAppPackageRecord(packageId, tenantId)\n\tif err != nil {\n\t\tc.HandleLoggingForError(clientIp, util.StatusInternalServerError, err.Error())\n\t\treturn err\n\t}\n\n\terr = c.deleteTenantRecord(clientIp, tenantId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappPackageStaleRec := &models.AppPackageStaleRec{\n\t\tAppPkgId: packageId,\n\t\tTenantId: tenantId,\n\t}\n\n\tif strings.EqualFold(origin, \"mepm\") {\n\t\terr = c.Db.InsertOrUpdateData(appPackageStaleRec, util.AppPkgId)\n\t\tif err != nil && err.Error() != util.LastInsertIdNotSupported {\n\t\t\tc.HandleLoggingForError(clientIp, util.StatusInternalServerError, err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cb4328c553ceb71435162aa78071fa0", "score": "0.5625038", "text": "func (client BaseClient) DeleteAllDisabledApplicationsResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n }", "title": "" }, { "docid": "c72f0c38c67d9f5a424d16a48d848c90", "score": "0.56061584", "text": "func cleanUpApplicationRevision(ctx context.Context, h *AppHandler) error {\n\tif DisableAllApplicationRevision {\n\t\treturn nil\n\t}\n\tsortedRevision, err := GetSortedAppRevisions(ctx, h.r.Client, h.app.Name, h.app.Namespace)\n\tif err != nil {\n\t\treturn err\n\t}\n\tappRevisionInUse := gatherUsingAppRevision(h)\n\tneedKill := len(sortedRevision) - h.r.appRevisionLimit - len(appRevisionInUse)\n\tif needKill <= 0 {\n\t\treturn nil\n\t}\n\tklog.InfoS(\"Going to garbage collect app revisions\", \"limit\", h.r.appRevisionLimit,\n\t\t\"total\", len(sortedRevision), \"using\", len(appRevisionInUse), \"kill\", needKill)\n\n\tfor _, rev := range sortedRevision {\n\t\tif needKill <= 0 {\n\t\t\tbreak\n\t\t}\n\t\t// don't delete app revision in use\n\t\tif appRevisionInUse[rev.Name] {\n\t\t\tcontinue\n\t\t}\n\t\tif err := h.r.Delete(ctx, rev.DeepCopy()); err != nil && !apierrors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t\tneedKill--\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2141b1ff3e7fed3d7dfdb84a645fa40b", "score": "0.55885017", "text": "func (v1 *V1) DeleteAppArg(launch *launcher.AppLauncher, appName string) error {\n\tv1.mu.Lock()\n\tdefer v1.mu.Unlock()\n\n\tconf := v1.Launcher\n\n\tconfigChanged := deleteAppArg(conf, appName)\n\n\tif !configChanged {\n\t\treturn nil\n\t}\n\tlaunch.ResetConfig(launcher.AppLauncherConfig{\n\t\tVisorPK: v1.PK,\n\t\tApps: conf.Apps,\n\t\tServerAddr: conf.ServerAddr,\n\t\tDisplayNodeIP: conf.DisplayNodeIP,\n\t})\n\treturn v1.flush(v1)\n}", "title": "" }, { "docid": "d11ce45abdd0ec25f130c1d0719a5a14", "score": "0.55816543", "text": "func (r *ManagedAppStatusRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "fee8e23debea585e3591fc84e9a1e9b9", "score": "0.5567107", "text": "func ExampleGalleryApplicationVersionsClient_BeginDelete() {\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 := armcompute.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginDelete(ctx, \"myResourceGroup\", \"myGalleryName\", \"myGalleryApplicationName\", \"1.0.0\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "title": "" }, { "docid": "c9a82c1d0a59c73b0a27dfed7eeded06", "score": "0.5563387", "text": "func AppsDestroy(ctx *cli.Context) error {\n\t_, name := detectAppFromRepo()\n\tif ctx.String(\"app\") != \"\" {\n\t\tlogrus.Debug(\"Override application name: \" + ctx.String(\"app\"))\n\t\tname = ctx.String(\"app\")\n\t}\n\tif ctx.Args().First() != \"\" {\n\t\tlogrus.Debug(\"Override application name: \" + ctx.Args().First())\n\t\tname = ctx.Args().First()\n\t}\n\tif name == \"\" {\n\t\treturn cli.NewExitError(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"%s No app specified.\\n%s USAGE: herogate apps:destroy APPNAME\",\n\t\t\t\tcolor.New(color.FgRed).Sprint(\"▸\"),\n\t\t\t\tcolor.New(color.FgRed).Sprint(\"▸\"),\n\t\t\t),\n\t\t\t1,\n\t\t)\n\t}\n\n\treturn processAppsDestroy(&appsDestroyContext{\n\t\tname: name,\n\t\tapp: ctx.App,\n\t\tconfirm: ctx.String(\"confirm\"),\n\t\tclient: api.NewClient(&api.ClientOption{\n\t\t\tRegion: \"us-east-1\", // NOTE: Currently, Fargate supported region is only `us-east-1`\n\t\t}),\n\t})\n}", "title": "" }, { "docid": "fa9b99d96ddfa907612a14878023a582", "score": "0.5542218", "text": "func DeleteAllApplicationPipeline(db database.Executer, applicationID int64) error {\n\tquery := `\n\t\tDELETE FROM application_pipeline_notif WHERE application_pipeline_id IN (\n\t\t\tSELECT id FROM application_pipeline WHERE application_id = $1\n\t\t)`\n\tif _, err := db.Exec(query, applicationID); err != nil {\n\t\treturn err\n\t}\n\n\tquery = `DELETE FROM application_pipeline WHERE application_id= $1`\n\tif _, err := db.Exec(query, applicationID); err != nil {\n\t\treturn err\n\t}\n\n\tquery = `DELETE FROM hook WHERE application_id = $1`\n\tif _, err := db.Exec(query, applicationID); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3830161eab45fd2f4bbea27524823314", "score": "0.55359256", "text": "func (r *ManagedAppPolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "e9d82e4eeddb48e0b26478a651536c60", "score": "0.55224115", "text": "func (a *Client) DeleteApplicationsWeb(params *DeleteApplicationsWebParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteApplicationsWebNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteApplicationsWebParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteApplicationsWeb\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/applications/web/{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: &DeleteApplicationsWebReader{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.(*DeleteApplicationsWebNoContent)\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 deleteApplicationsWeb: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "681967f9d3e5d5424cb47faadc74c6f7", "score": "0.5475746", "text": "func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (result autorest.Response, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/AppsClient.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: 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\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+[^\\.]$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"web.AppsClient\", \"Delete\", err.Error())\n\t}\n\n\treq, err := client.DeletePreparer(ctx, resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsClient\", \"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, \"web.AppsClient\", \"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, \"web.AppsClient\", \"Delete\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "91bdfef3dcd21b2c915dee41885acb84", "score": "0.54721165", "text": "func (client AndroidClient) DeleteAppForMAMPolicySender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "eb2965a177b0aa8f05d6e9c5b7b1e658", "score": "0.54686606", "text": "func DeleteAppAppsOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AppsController, appID string) 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(\"/apps/%v\", appID),\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[\"appId\"] = []string{fmt.Sprintf(\"%v\", appID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"AppsTest\"), rw, req, prms)\n\tdeleteAppCtx, _err := app.NewDeleteAppAppsContext(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.DeleteApp(deleteAppCtx)\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 != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\n\t// Return results\n\treturn rw\n}", "title": "" }, { "docid": "d846d1211a91a63e9d70f69ed65a1c81", "score": "0.54669213", "text": "func (client *ApplicationGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationGroupName string, options *ApplicationGroupsClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif applicationGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter applicationGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{applicationGroupName}\", url.PathEscape(applicationGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-09-03-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c0ad0780ac79f43e53ec4d0f10b4a8e3", "score": "0.5463838", "text": "func (m *Mockstore) DeleteApplication(name string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteApplication\", name)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7a483f34666661c3c748e88ee5d1c7c2", "score": "0.54557955", "text": "func (r *IOSManagedAppProtectionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "3e88f0a739f4fc1ac3944da235074da6", "score": "0.54436934", "text": "func (app *Application) DeleteAppointment(c echo.Context) error {\n\ttoken := c.Param(\"token\")\n\n\tif err := app.CheckToken(token); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, Response{Error: err.Error()})\n\t}\n\n\tid := c.Param(\"id\")\n\n\tif err := app.db.DeleteAppointment(id); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, Response{Error: err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, Response{Ok: true})\n}", "title": "" }, { "docid": "4310fd5e809a1222f242c27a72a77d7b", "score": "0.5436257", "text": "func (c *LcmController) delAppPkgRecords(clientIp, packageId, tenantId, hostIp string) error {\n\tappPkgHostRec := &models.AppPackageHostRecord{\n\t\tPkgHostKey: packageId + tenantId + hostIp,\n\t}\n\n\terr := c.Db.ReadData(appPkgHostRec, util.PkgHostKey)\n\tif err != nil {\n\t\tc.HandleLoggingForError(clientIp, util.StatusNotFound,\n\t\t\tutil.RecordDoesNotExist)\n\t\treturn err\n\t}\n\tvar origin = appPkgHostRec.Origin\n\n\terr = c.deleteAppPackageHostRecord(hostIp, packageId, tenantId)\n\tif err != nil {\n\t\tc.HandleLoggingForError(clientIp, util.StatusInternalServerError, err.Error())\n\t\treturn err\n\t}\n\n\terr = c.deleteTenantRecord(clientIp, tenantId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappPackageHostStaleRec := &models.AppPackageHostStaleRec{\n\t\tPackageId: packageId,\n\t\tTenantId: tenantId,\n\t\tHostIp: hostIp,\n\t}\n\n\tif strings.EqualFold(origin, \"mepm\") {\n\t\terr = c.Db.InsertOrUpdateData(appPackageHostStaleRec, util.PkgId)\n\t\tif err != nil && err.Error() != util.LastInsertIdNotSupported {\n\t\t\tc.HandleLoggingForError(clientIp, util.StatusInternalServerError, err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de6119de994ed40c9689a03df44dd10", "score": "0.5429801", "text": "func BatchDelete(c *gin.Context) {\n\t// userId, _ := c.Get(\"userId\")\n\tapplicationId := cast.ToUint64(c.Param(\"id\"))\n\n\tvar req ApplicationUsersRequest\n\tif err := c.ShouldBindJSON(&req); err != nil {\n\t\tlog.Warnf(\"BatchDelete bind params err: %v\", err)\n\t\tapi.SendResponse(c, errno.ErrBind, nil)\n\t\treturn\n\t}\n\n\tvar users []uint64\n\tfor _, user := range req.Users {\n\t\tusers = append(users, uint64(user))\n\t}\n\n\terr := service.Svc.ApplicationUser().BatchDelete(c, applicationId, users)\n\n\tif err != nil {\n\t\tapi.SendResponse(c, errno.ErrDeleteApplicationUser, nil)\n\t\treturn\n\t}\n\tapi.SendResponse(c, nil, nil)\n}", "title": "" }, { "docid": "e019bbd9b38de0e4a691ea1286077ee9", "score": "0.5422928", "text": "func (r *TargetedManagedAppProtectionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "5cbb716545f7c451a75d799cc997aa3d", "score": "0.54156715", "text": "func (client AndroidClient) DeleteAppForMAMPolicyResponder(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": "ee33cac3555f8fe6508bc220abc5d740", "score": "0.5413266", "text": "func DeleteAppV2(db *sql.DB, params martini.Params, r render.Render) {\n\tappid := params[\"appid\"]\n\n\t// Make sure that UUID is valid and we have deployments for it\n\tif _, err := uuid.ParseHex(appid); err != nil {\n\t\tutils.ReportInvalidRequest(\"Invalid app UUID\", r)\n\t}\n\n\tvar count int\n\tif err := db.QueryRow(\"select count(*) from v2.deployments where appid = $1\", appid).Scan(&count); err != nil {\n\t\tutils.ReportError(err, r)\n\t\treturn\n\t}\n\n\tif count < 1 {\n\t\tutils.ReportNotFoundError(r)\n\t\treturn\n\t}\n\n\t// Get all deployments for the app ID\n\trows, err := db.Query(\"select name, space from v2.deployments where appid = $1\", appid)\n\tif err != nil {\n\t\tutils.ReportError(err, r)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\ttype deletionError struct {\n\t\tDeploymentName string `json:\"deploymentName\"`\n\t\tDeploymentSpace string `json:\"deploymentSpace\"`\n\t\tError string `json:\"error\"`\n\t}\n\n\tvar deletionErrors []deletionError\n\tvar deletedApps []string\n\n\tfor rows.Next() {\n\t\tvar dName string\n\t\tvar dSpace string\n\t\tif err = rows.Scan(&dName, &dSpace); err != nil {\n\t\t\tutils.ReportError(err, r)\n\t\t\treturn\n\t\t}\n\n\t\t_, err := DeleteDeploymentV2(db, dName, dSpace)\n\t\tif err != nil {\n\t\t\tdeletionErrors = append(deletionErrors, deletionError{\n\t\t\t\tDeploymentName: dName,\n\t\t\t\tDeploymentSpace: dSpace,\n\t\t\t\tError: err.Error(),\n\t\t\t})\n\t\t} else {\n\t\t\t_, err2 := db.Exec(\"delete from v2.deployments where name = $1 and space = $2\", dName, dSpace)\n\t\t\tif err2 != nil {\n\t\t\t\tdeletionErrors = append(deletionErrors, deletionError{\n\t\t\t\t\tDeploymentName: dName,\n\t\t\t\t\tDeploymentSpace: dSpace,\n\t\t\t\t\tError: err2.Error(),\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tdeletedApps = append(deletedApps, dName+\"-\"+dSpace)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(deletionErrors) > 0 {\n\t\tr.JSON(http.StatusInternalServerError, struct {\n\t\t\tStatus int `json:\"status\"`\n\t\t\tMessage string `json:\"message\"`\n\t\t\tErrors []deletionError `json:\"errors\"`\n\t\t}{\n\t\t\thttp.StatusInternalServerError,\n\t\t\t\"One or more deployments for the specified app could not be deleted\",\n\t\t\tdeletionErrors,\n\t\t})\n\t\treturn\n\t}\n\n\tr.JSON(http.StatusOK, deletedApps)\n}", "title": "" }, { "docid": "df844d292eedf5ad6f67ab83b09487f5", "score": "0.53856647", "text": "func (m *MockapplicationStore) DeleteApplication(name string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteApplication\", name)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2cfefd04d67fbf8abdb1c43952b9febd", "score": "0.53848034", "text": "func (client BaseClient) DeleteAllDisabledApplications(ctx context.Context, notSeenFor string) (result autorest.Response, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/BaseClient.DeleteAllDisabledApplications\")\n defer func() {\n sc := -1\n if result.Response != nil {\n sc = result.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n req, err := client.DeleteAllDisabledApplicationsPreparer(ctx, notSeenFor)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"DeleteAllDisabledApplications\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.DeleteAllDisabledApplicationsSender(req)\n if err != nil {\n result.Response = resp\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"DeleteAllDisabledApplications\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.DeleteAllDisabledApplicationsResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"azureiiotopcregistry.BaseClient\", \"DeleteAllDisabledApplications\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "dbe06aa30480ad15fc6c9e7736c9ba6c", "score": "0.5380729", "text": "func DeleteAppointment(w http.ResponseWriter, r *http.Request) {\n\t//OBJEK RESPONSE\n\tPrintln(\"Endpoint Hit: DeleteAppointment\")\n\tvar response models.AppointmentResponse\n\n\tvars := mux.Vars(r)\n\n\tstatus := method.Remove(vars[\"id\"])\n\n\tif status == false {\n\t\tmessage := \"Appointment Failed to Update\"\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(400)\n\t\tresponse.Status = false\n\t\tresponse.Message = message\n\t\t// response.Data = result\n\t\tjson.NewEncoder(w).Encode(response)\n\t} else {\n\t\tmessage := \"Appointment Deleted Succesfully\"\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(301)\n\t\tresponse.Status = true\n\t\tresponse.Message = message\n\t\tjson.NewEncoder(w).Encode(response)\n\t}\n\n}", "title": "" }, { "docid": "191a54b17bf4ac97777fa52e22c2c92a", "score": "0.53771716", "text": "func (client BaseClient) DeleteAllDisabledApplicationsSender(req *http.Request) (*http.Response, error) {\n sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n return autorest.SendWithSender(client, req, sd...)\n }", "title": "" }, { "docid": "fd296d84decc9ce7c4cd0cdab0bdcb90", "score": "0.5337982", "text": "func (mr *MockstoreMockRecorder) DeleteApplication(name interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteApplication\", reflect.TypeOf((*Mockstore)(nil).DeleteApplication), name)\n}", "title": "" }, { "docid": "ac596d3b157260a4c9db717892897a78", "score": "0.5332387", "text": "func DeleteAppAppsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AppsController, appID string) (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(\"/apps/%v\", appID),\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[\"appId\"] = []string{fmt.Sprintf(\"%v\", appID)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"AppsTest\"), rw, req, prms)\n\tdeleteAppCtx, _err := app.NewDeleteAppAppsContext(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.DeleteApp(deleteAppCtx)\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\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": "" } ]
68a824f8fb6f8273ac3d5b055f4efc82
WithHTTPClient adds the HTTPClient to the update apple i a p config params
[ { "docid": "b24a07dc3a3e7f32a799de279a7fa075", "score": "0.7321484", "text": "func (o *UpdateAppleIAPConfigParams) WithHTTPClient(client *http.Client) *UpdateAppleIAPConfigParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" } ]
[ { "docid": "dde0bd6eb81c5a39d4ee0d83a811aa43", "score": "0.7829986", "text": "func (o *UpdateAppleIAPConfigParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "db4746afdbcbf0cb6cee37c8cc785e9d", "score": "0.74039453", "text": "func (o *ConfigUpdateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "0c1df8df2b592b13a46a52b1a58dd06f", "score": "0.7355434", "text": "func (o *UpdateSteamIAPConfigParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "2b4aa3aeaf5ea6b8390691610e1226ca", "score": "0.72800356", "text": "func (c *Config) WithHTTPClient(client *http.Client) *Config {\n c.HTTPClient = client\n return c\n}", "title": "" }, { "docid": "617fe9ddcfcae2097e65184953564574", "score": "0.7208434", "text": "func (o *UpdateAlertConfigurationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "ab5b79bc1e42ba2def20084c01da7e95", "score": "0.715532", "text": "func (o *V1UpdateConfigParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "14a3eaddd172a77b897fbec622360d54", "score": "0.71237725", "text": "func WithHTTPClient(c *http.Client) ClientOption {\n\treturn func(config *clientConfig) {\n\t\tconfig.client = c\n\t}\n}", "title": "" }, { "docid": "cd9ef94800d3b81ec5d4c036d16d5ad3", "score": "0.7117679", "text": "func (o *ConfigUpdateParams) WithHTTPClient(client *http.Client) *ConfigUpdateParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "85d5a09d37ee9c0dd8c1be0ecaab6526", "score": "0.7077614", "text": "func (o *UpdateCustomPropertyForDeviceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "671868c3954e5be6939192c026cba3ea", "score": "0.70517516", "text": "func WithHTTPClient(client *http.Client) Option {\n\treturn optionFunc(func(c *config) {\n\t\tif client != nil {\n\t\t\tc.HTTPClient = client\n\t\t}\n\t})\n}", "title": "" }, { "docid": "54198195ad972381c177d3376aac826e", "score": "0.70499164", "text": "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *uaHTTPClient) {\n\t\tc.httpClient = httpClient\n\t}\n}", "title": "" }, { "docid": "6becae18b18bdf697e3bee06570358f6", "score": "0.69973487", "text": "func WithHTTPClient(httpcl *http.Client) Option {\n\treturn func(c *httpClient) {\n\t\tc.client = httpcl\n\t}\n}", "title": "" }, { "docid": "5ad35a225965e5a386543976267e6482", "score": "0.69935", "text": "func WithHTTPClient(httpclient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpclient\n\t}\n}", "title": "" }, { "docid": "69d136f87cfc09163d37258494a43067", "score": "0.69871473", "text": "func (o *UpdateIPSecConnectionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "724399b23b013c6a5c94f0b12ce8fccf", "score": "0.6980836", "text": "func (o *UpdateTicketParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f7c086321232971c60a12583bfa29b86", "score": "0.6973496", "text": "func (o *CreateNonSITAddressUpdateRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "acecfeb07d42cf7d1b684189eb674801", "score": "0.6972727", "text": "func WithHTTPClient(client httpClient) Opt {\n\treturn func(o *Client) {\n\t\to.http = client\n\t}\n}", "title": "" }, { "docid": "4bd60c2b7c5eb50cddee4426ba11a9b2", "score": "0.69687384", "text": "func (o *WeaviateThingsPropertiesUpdateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "528836d25bdc0bb404ab5fd8167a3901", "score": "0.6938824", "text": "func (o *UplodLootBoxPluginConfigCertParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "0bfbd646efe2a278c7b5e679fe9528c0", "score": "0.69382226", "text": "func WithHTTPClient(client HTTPClient) ClientOpt {\n\treturn func(o *clientOptions) {\n\t\to.http = client\n\t}\n}", "title": "" }, { "docid": "0bfbd646efe2a278c7b5e679fe9528c0", "score": "0.69382226", "text": "func WithHTTPClient(client HTTPClient) ClientOpt {\n\treturn func(o *clientOptions) {\n\t\to.http = client\n\t}\n}", "title": "" }, { "docid": "be6a5ff83b5e21b623b8c2d7c3d56933", "score": "0.6913368", "text": "func (fc *FakeClient) SetHTTPClient(httpClient *http.Client) {}", "title": "" }, { "docid": "0759a40f5aad46de6644ca96c44a6791", "score": "0.6899093", "text": "func WithHTTPClient(client *http.Client) Option {\n\treturn func(options *Options) {\n\t\toptions.Client = client\n\t}\n}", "title": "" }, { "docid": "0416dd488e6ecf6f1bbb8c256273aaa0", "score": "0.68961453", "text": "func (o *UpdateAccountParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "173a0a4fdbc5ce8c522dbe0c3ea6bebb", "score": "0.6888711", "text": "func WithHTTPClient(client *http.Client) ClientOption {\n\treturn func(opts *ClientOptions) {\n\t\topts.client = client\n\t}\n}", "title": "" }, { "docid": "b1064826d512839b4dbdf5908984c18f", "score": "0.68874604", "text": "func WithHTTPClient(client *http.Client) Option {\n\treturn func(api *API) {\n\t\tapi.httpClient = client\n\t}\n}", "title": "" }, { "docid": "b73a92b66b69b84cde1944ea6d32510b", "score": "0.6878659", "text": "func (o *ServiceInstanceUpdateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "60ec9e8ad517997a98908c4b267a6227", "score": "0.68684274", "text": "func (o *UpdateEscalationPolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4256c3fac7e1481456645d949f5377b5", "score": "0.68620336", "text": "func (c *Client) WithHTTPClient(client *http.Client) *Client {\n c.HTTPClient = client\n return c\n}", "title": "" }, { "docid": "9eec6e9a3e90ca9aec55acda7a97b619", "score": "0.6861476", "text": "func (o *UpdateCompartmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "afba9a362decc94ef3f57ec6c4d4350b", "score": "0.68587476", "text": "func WithHTTPClient(client *http.Client) Option {\n\treturn func(c *Client) {\n\t\tc.httpClient = client\n\t}\n}", "title": "" }, { "docid": "2b63c9819b99fe37e2922d52477fd4d5", "score": "0.68537897", "text": "func (o *UpdateAlertChannelParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "362ed3d356a3275894d38ac5aabc5d80", "score": "0.68527067", "text": "func WithHTTPClient(c *http.Client) Option {\n\treturn func(o *options) {\n\t\to.httpClient = c\n\t}\n}", "title": "" }, { "docid": "21e5c9efddce5e232afe3a6a414880f0", "score": "0.6839904", "text": "func (o *UpdateCatalogEntryAttributesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "bd1de7cf410a3112c5eb3b5c71c805aa", "score": "0.6809452", "text": "func (o *CreateAppParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "e909b8f0a705fd5f5f8129a0c15a0f36", "score": "0.6808468", "text": "func (o *GetACartParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4ee492f1ff714fc08ac8a2e5164c2c07", "score": "0.68027663", "text": "func (o *ReplaceApplicationUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "66d7c9ebd98dfe745ae2f1a067b56605", "score": "0.67995214", "text": "func (o *ReplaceChangeaspecificPbxDeviceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "d18f1539cd3ecb1dc5e6159f6d02fc19", "score": "0.6797549", "text": "func (o *GetaspecificManagerSecretaryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "20d552461fa4699c9fa7485239998d31", "score": "0.67935973", "text": "func (o *UpdateBuildParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f1c255ca886c423ba71637910018b0e9", "score": "0.6789595", "text": "func WithHTTPClient(client *http.Client) Option {\n\treturn withHTTPClient{client}\n}", "title": "" }, { "docid": "1cfb4cf0c661982f775707fcaf01b256", "score": "0.6786099", "text": "func (o *UpdateNetworkBluetoothSettingsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "d2718751c575e9c56b63a8b099d55336", "score": "0.67819047", "text": "func (o *UpdateSoftwarePackageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "09bd6b9129ca8232c4831cbde04da2e0", "score": "0.6767763", "text": "func (o *UpdateTaskStateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "57b6972c202f1fc25a92e3348dd24440", "score": "0.6764799", "text": "func (o *UpdateCapabilityUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "935dadddcbb08d900275a55f0d314aee", "score": "0.67635477", "text": "func WithHTTPClient(httpClient HTTPClient) Option {\n\treturn func(t *tinifyClient) error {\n\t\tif httpClient == nil {\n\t\t\treturn errFailedSetHTTPClient\n\t\t}\n\n\t\tt.httpClient = httpClient\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1ef99adfa9f1cc2d5aa86fb8ef6e10e5", "score": "0.6761787", "text": "func (o *ResourceControlUpdateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "50c712bbcd0490f760c324989d027430", "score": "0.6761643", "text": "func (o *UpdateFeedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "7cd9ed6342c0b46c6d50658fc98b213c", "score": "0.6761451", "text": "func (c *Client) WithHTTPClient(newHTTPClient httpclient.HTTPClient) {\n\tc.httpClient = newHTTPClient\n}", "title": "" }, { "docid": "dbb630d9a5e84837ef33c3b4e5adbb23", "score": "0.674869", "text": "func (o *UpdateUserAttributesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "b1b955f94d7adb5001a0b490dc941935", "score": "0.6742303", "text": "func (o *UpdateCustomPropertyForTenantParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "0a1d52962b114080b793c4e3f8fc565d", "score": "0.67161053", "text": "func (c *Config) WithHTTPClient(client *http.Client) *Config {\n\tc.HTTPClient = client\n\treturn c\n}", "title": "" }, { "docid": "0da18e4110f5213359788119c8193e78", "score": "0.66963804", "text": "func (o *FavoriteARecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "2adfc7e60447b5a2b636d3fdb854e751", "score": "0.6692819", "text": "func (o *UpdateAuthUserParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "03fe949b8823ba130c287fdaa4772dc5", "score": "0.6690235", "text": "func (o *AddComponentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "7dfaef2d736d620ff9fee3c2ba5c7bd5", "score": "0.66897976", "text": "func (o *GetPrivateAddToAddressBookParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "86f9ee46fbc1670e7211b43002d58fbb", "score": "0.66859126", "text": "func (o *AddUpdateActivitiesGoalsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "c3d392788c4df7e9387e469dcd12732e", "score": "0.6677818", "text": "func (o *UpdateCloudSettingsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "b8483f8cef54194165e69771d9902603", "score": "0.6662964", "text": "func (o *AddLibraryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "834f92be073c6bf9d2a19b66759659ac", "score": "0.6658474", "text": "func (o *AddPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "8a96100518a43aaffdcdb10646b45b6b", "score": "0.6658164", "text": "func WithHTTPClient(httpClient *http.Client) Option {\n\treturn func(cfg *config) {\n\t\tcfg.httpClient = httputil.NewLoggingClient(httpClient, \"ping_idp_client\",\n\t\t\tfunc(evt *zerolog.Event) *zerolog.Event {\n\t\t\t\treturn evt.Str(\"provider\", \"ping\")\n\t\t\t})\n\t}\n}", "title": "" }, { "docid": "9910803c79b24862141af64f27c86a3d", "score": "0.66560644", "text": "func (o *OperatorUpdateOperatorParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "73b57585ceebee246550e2fe9927ba76", "score": "0.66549295", "text": "func (o *AddInvokeFunctionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "fc03537d4f89fdd915ad9d817b034ac0", "score": "0.66548514", "text": "func (o *UpdateSettingsKrb5DomainParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "525fa9a956925098590e901b65e95708", "score": "0.66451573", "text": "func (o *ListAppsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "01c274a53baa695f1b38082fa341e66d", "score": "0.6643576", "text": "func (o *PostIamAPIKeysMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "c8f983f9eeab56b59ab76851ac7aafe2", "score": "0.6643346", "text": "func (o *UpdateNetworkUplinkSettingsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "4ac459b6d60c67a99ace907be1e6219e", "score": "0.66426", "text": "func (o *PutDevicesDeviceidUdapiVersionUdapiurlParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "13f42da531d2079dd022db1941575f18", "score": "0.66421866", "text": "func (o *UpdateProxyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "d98deb21706e17402740cc8e874ca0e7", "score": "0.663948", "text": "func (o *SubmitParameterContextUpdateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "f3623e100a42b94ab7dd4349f5cb7d3c", "score": "0.6626874", "text": "func WithHTTPClient(val *http.Client) Option {\n\treturn func(o *Options) {\n\t\to.HTTPClient = val\n\t}\n}", "title": "" }, { "docid": "60f18924a0ccfd801169f47ab755a4f8", "score": "0.6626579", "text": "func WithHTTPClient(client *http.Client) ClientOption {\n\treturn func(metaclient *Client) { metaclient.client = client }\n}", "title": "" }, { "docid": "42ac3e558487204cf86d8d96c2af121c", "score": "0.66233826", "text": "func (o *AddDeliveryNotesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "30869021b0b82db0774febc3d7908f5d", "score": "0.6622093", "text": "func (o *AddAPIKeyPrivilegeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "01360825917970468ca1c3686a7245e5", "score": "0.6617008", "text": "func (o *UpdateCustomPropertyForSensorParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "fda5fac969152742ccbfdc0913dbcb61", "score": "0.6612802", "text": "func (o *ModifyAddressParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "dabed4d97317a1b46f5fbdcba3e7766b", "score": "0.6609149", "text": "func (o *CreateElfImageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "eeadfa7cdd96a4b82aa8653edef5050d", "score": "0.66081804", "text": "func (o *ApproveParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "1579b7d231ef9b0f22aeaaf1ecc405fc", "score": "0.6604812", "text": "func (o *OpenAPIDiscoveryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "6ad7dad04c2249d046ac237fce0fab2d", "score": "0.6604219", "text": "func (o *CatalogCostStorageV1UpdatePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "a26353e6d92bac552ec79888cc05ef8e", "score": "0.66024286", "text": "func WithHTTPClient(httpClient *http.Client) Option {\n\treturn func(er *EarningsReport) error {\n\t\ter.httpClient = httpClient\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "295d912b2b404fce40d1050752922b75", "score": "0.66016173", "text": "func (o *UpdateCustomTagOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "7bed3793e2f2cec5454a2ce641becbd7", "score": "0.66010374", "text": "func (o *PostItemCommandParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7138d62676e0f7c88a9c56c3fb5b86e3", "score": "0.6598975", "text": "func WithHTTPClient(doer HttpRequestDoer) ClientOption {\n\treturn func(c *Client) error {\n\t\tc.Client = doer\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e0c0a39f239d17e883a27570cd82ab06", "score": "0.65980536", "text": "func (o *EmailTemplatePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "96af97f7d2afb63c635eed18290f1e3f", "score": "0.6596558", "text": "func WithHTTPClient(hc *http.Client) Opt {\n\treturn func(c *Client) error {\n\t\tif hc == nil {\n\t\t\treturn OptError{\n\t\t\t\tName: \"WithHTTPClient\",\n\t\t\t\tMessage: \"The client provided cannot be nil\",\n\t\t\t}\n\t\t}\n\t\tc.http = hc\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "0fa2a644c85dc709e3cbdd9b90f7057c", "score": "0.6593352", "text": "func (o *UpdateFeedViewParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" }, { "docid": "99a04174510fa6d6e2c081e1d5827277", "score": "0.6586091", "text": "func (o *PatchSecretStorePathToSecretParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "title": "" } ]
72a92eef9c2497e2dfb1640b34b56b30
Get the groups that this node belong to
[ { "docid": "88ec509900e6e5c0dee8407e6d3e84fe", "score": "0.6470292", "text": "func GetGroupOfNode(nodeName string) ([]string, error) {\n\tvar groups []string\n\t//nInterface, err := k8sassist.NewNodes()\n\t//if err != nil {\n\t//\tlogs.Error(\"Failed to get node client interface\")\n\t//\treturn nil, err\n\t//}\n\n\tvar config k8sassist.K8sAssistConfig\n\tconfig.KubeConfigPath = kubeConfigPath()\n\tk8sclient := k8sassist.NewK8sAssistClient(&config)\n\tnInterface := k8sclient.AppV1().Node()\n\n\tnNode, err := nInterface.Get(nodeName)\n\tif err != nil {\n\t\tlogs.Error(\"Failed to get K8s node\")\n\t\treturn nil, err\n\t}\n\tfor key, _ := range nNode.ObjectMeta.Labels {\n\t\tif !strings.Contains(key, K8sLabel) {\n\t\t\texist, err := NodeGroupExists(key)\n\t\t\tif err != nil {\n\t\t\t\tlogs.Error(\"Failed to get nodegroup\")\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif exist {\n\t\t\t\tgroups = append(groups, key)\n\t\t\t}\n\t\t}\n\t}\n\treturn groups, nil\n}", "title": "" } ]
[ { "docid": "a91db4de38b85554ff6540473df09bd3", "score": "0.7234361", "text": "func (z *Zookeeper) Groups() (nodes []string, err error) {\n\tif nodes, _, err = z.c.Children(z.config.Zookeeper.GroupRoot); err != nil {\n\t\tlog.Errorf(\"zk.Children(\\\"%s\\\") error(%v)\", z.config.Zookeeper.GroupRoot, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1291ace8747908243cec3de56f0b85fd", "score": "0.72076005", "text": "func GetGroups() Groups {\n\treturn groups\n}", "title": "" }, { "docid": "ca23b60fe8e40eedd02927efb788dbbf", "score": "0.68279374", "text": "func (o *Node) GetGroups() *Array {\n\tlog.Println(\"Calling Node.GetGroups()\")\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_groups\", goArguments, \"*Array\")\n\n\treturnValue := goRet.Interface().(*Array)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "c3931d20731871815886ba1be81a642d", "score": "0.68070316", "text": "func (w *Wallet) Groups() []string {\n\tvar groups []string\n\tvar exist bool\n\n\tfor _, entry := range w.Entries {\n\t\texist = false\n\t\tfor _, group := range groups {\n\t\t\tif group == entry.Group {\n\t\t\t\texist = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif exist == false && entry.Group != \"\" {\n\t\t\tgroups = append(groups, entry.Group)\n\t\t}\n\t}\n\n\treturn groups\n}", "title": "" }, { "docid": "270b1cfabe0914f8121865233ec4cf54", "score": "0.67746323", "text": "func (c *Conn) Groups() []Group {\n\treturn c.groups.Groups()\n}", "title": "" }, { "docid": "eaed6ff029818cc4ac3ffd2fe5c6d4b7", "score": "0.67554134", "text": "func (c *Syncer) Groups() (res []*Group) {\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\n\tfor _, g := range c.groups {\n\t\tres = append(res, g)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "460bed2c50be25a9e1d7e688e17661ec", "score": "0.6733695", "text": "func (r StateV011) GetGroups() ([]string, error) {\n\tvar groups []string\n\n\tfor _, m := range r.Modules {\n\t\tfor _, resource := range m.Resources {\n\t\t\tif resource.Type == \"ansible_group\" {\n\t\t\t\tgroups = append(groups, resource.Primary.ID)\n\t\t\t}\n\t\t}\n\t}\n\n\tsort.Strings(groups)\n\treturn groups, nil\n}", "title": "" }, { "docid": "d0753aa5bf2ca9aca40e3639227f2ceb", "score": "0.6674604", "text": "func GetGroups() []*Group {\n\tvar r []*Group\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tfor _, g := range groups {\n\t\tr = append(r, g)\n\t}\n\tsort.SliceStable(r, func(i, j int) bool {\n\t\treturn r[i].Name() < r[j].Name()\n\t})\n\treturn r\n}", "title": "" }, { "docid": "48ce8633488fbb1fb9a64b21d8106c4e", "score": "0.6649174", "text": "func (g Graph) GetGroups(w http.ResponseWriter, r *http.Request) {\n\tcon, err := g.initLdap()\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"Failed to initialize ldap\")\n\t\terrorcode.ServiceNotAvailable.Render(w, r, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// TODO make filter configurable\n\tresult, err := g.ldapSearch(con, \"(objectClass=posixGroup)\", g.config.Ldap.BaseDNGroups)\n\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"Failed search ldap with filter: '(objectClass=posixGroup)'\")\n\t\terrorcode.ServiceNotAvailable.Render(w, r, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tgroups := make([]*msgraph.Group, 0, len(result.Entries))\n\n\tfor _, group := range result.Entries {\n\t\tgroups = append(\n\t\t\tgroups,\n\t\t\tcreateGroupModelFromLDAP(\n\t\t\t\tgroup,\n\t\t\t),\n\t\t)\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, &listResponse{Value: groups})\n}", "title": "" }, { "docid": "5ad8aa9b0f2412bcf6cddb97eb684f7f", "score": "0.6624334", "text": "func (k Keeper) GetGroups(ctx sdk.Context, id types.DeploymentID) []types.Group {\n\tstore := ctx.KVStore(k.skey)\n\tkey := groupsKey(id)\n\n\tvar vals []types.Group\n\n\titer := sdk.KVStorePrefixIterator(store, key)\n\n\tfor ; iter.Valid(); iter.Next() {\n\t\tvar val types.Group\n\t\tk.cdc.MustUnmarshal(iter.Value(), &val)\n\t\tvals = append(vals, val)\n\t}\n\n\titer.Close()\n\treturn vals\n}", "title": "" }, { "docid": "fd17481907f6e70c829fff345d3b8db3", "score": "0.6570014", "text": "func (c *Client) GetGroups(location string) (rootNode *Group, err error) {\n\tdc, err := c.GetDatacenter(location, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgl, err := extractLink(dc.Links, \"group\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.GetGroup(gl.Id)\n}", "title": "" }, { "docid": "e705442ae0eec34a8f3902f238931419", "score": "0.6560776", "text": "func (k *ShardingGroupKeeper) Groups() map[string]*ShardingGroup {\n\tk.RLock()\n\tdefer k.RUnlock()\n\n\t// do a copy\n\tgroups := make(map[string]*ShardingGroup, len(k.groups))\n\tfor key, value := range k.groups {\n\t\tgroups[key] = value\n\t}\n\treturn groups\n}", "title": "" }, { "docid": "aaeb23f881d9a8f2104ed2c42dea96e5", "score": "0.65537643", "text": "func (t *Test) Groups() []string {\n\tout := make([]string, 0, len(t.groups))\n\tfor _, gi := range t.groups {\n\t\tout = append(out, gi.name)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "7756f3d46610254e547663ce369dde21", "score": "0.6528698", "text": "func (t *TokenReview) Groups() []string {\n\treturn t.Status.User.Groups\n}", "title": "" }, { "docid": "2063db6d3be6143e450548b76f69deb9", "score": "0.6492339", "text": "func (o *MonitorDowntimeMatchResponseAttributes) GetGroups() []string {\n\tif o == nil || o.Groups == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.Groups\n}", "title": "" }, { "docid": "1eff9ee4bdee5ebb9b5aa8d331870f0a", "score": "0.64413035", "text": "func GetGroups() []Group {\n\tsession, err := mgo.Dial(MongoURL)\n\tif err != nil {\n\t\tlog.Println(\"Could not connect to mongo: \", err.Error())\n\t\treturn nil\n\t}\n\tdefer session.Close()\n\n\t// Optional. Switch the session to a monotonic behavior.\n\tsession.SetMode(mgo.Monotonic, true)\n\n\tc := session.DB(\"GroupsService\").C(\"Groups\")\n\tvar Groups []Group\n\terr = c.Find(bson.M{}).All(&Groups)\n\n\treturn Groups\n}", "title": "" }, { "docid": "61fde2a77f654e089cc7cf4f5f3de940", "score": "0.63897675", "text": "func (o *SceneState) GetNodeGroups(idx int64) *PoolStringArray {\n\tlog.Println(\"Calling SceneState.GetNodeGroups()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(idx)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"get_node_groups\", goArguments, \"*PoolStringArray\")\n\n\treturnValue := goRet.Interface().(*PoolStringArray)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "9f0337cb2749a82e0b1bcf47b2d5a9cd", "score": "0.6371484", "text": "func (sDB *SegmentDB) Groups() (SegmentGroupCollection, error) {\n\tsgc := SegmentGroupCollection{}\n\terr := sDB.MySQL.Select(&sgc, \"SELECT id, name, code, type, sorting, created_at, updated_at \"+\n\t\t\"FROM segment_groups ORDER BY sorting\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sgc, nil\n}", "title": "" }, { "docid": "c6be7bcbcd82967d539fa0617744f871", "score": "0.63576245", "text": "func (o *ServiceLevelObjectiveRequest) GetGroups() []string {\n\tif o == nil || o.Groups == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.Groups\n}", "title": "" }, { "docid": "d134443adef7ba239051569b83667c2a", "score": "0.6338393", "text": "func GetGroups(ctx context.Context) []string {\n\tgroups := ctx.Value(GroupProviderCtxKey)\n\tif groups != nil {\n\t\treturn groups.([]string)\n\t}\n\treturn []string{}\n}", "title": "" }, { "docid": "6e68c2b10d49ccac4cec2dfbe9228ec5", "score": "0.629042", "text": "func (e *MessagesEmojiGroups) GetGroups() (value []EmojiGroup) {\n\tif e == nil {\n\t\treturn\n\t}\n\treturn e.Groups\n}", "title": "" }, { "docid": "4ae100ccf411c2b2360a02aa5103607d", "score": "0.62766904", "text": "func (o UserInfoPtrOutput) Groups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v UserInfo) []string { return v.Groups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "130c3e381ab6d13aac0ab7608357575a", "score": "0.6269966", "text": "func (p *Permissions) Groups(uuid string) (gs []string, err error) {\n\tvar g groups\n\n\terr = p.db.Read(func(txn turtleDB.Txn) (err error) {\n\t\tif g, err = p.getGroups(txn, uuid); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tgs = g.Slice()\n\t\treturn\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "a53b394c4c5d1148c4cae6b4a7f170bc", "score": "0.6251852", "text": "func (pkg *Package) Groups() StringList {\n\tptr := unsafe.Pointer(C.alpm_pkg_get_groups(pkg.pmpkg))\n\treturn StringList{(*list)(ptr)}\n}", "title": "" }, { "docid": "4e01467bdd064d489e2f8c859ac5ea93", "score": "0.62387323", "text": "func (i *IpsGroups) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/ips.groups\", &i.Value, options...)\n}", "title": "" }, { "docid": "4ebf96a0119a2ca475901c0816a5f93c", "score": "0.6231823", "text": "func (g *GroupCounts) Groups() []GroupCount {\n\tif g == nil {\n\t\treturn nil\n\t}\n\treturn g.groups\n}", "title": "" }, { "docid": "8d9922f9a354f41d4f6b576037e6dd0c", "score": "0.62265694", "text": "func (li *LocalIni) Groups() []*store.Group {\n\treturn li.groups\n}", "title": "" }, { "docid": "a92dd7eac9a5fe01c5304bea851b474f", "score": "0.622415", "text": "func (o BrokerUserOutput) Groups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BrokerUser) []string { return v.Groups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "42bf8139673e190a912b9111f468e8ca", "score": "0.6202401", "text": "func (o *Enterprise) Groups(info *bambou.FetchingInfo) (GroupsList, *bambou.Error) {\n\n\tvar list GroupsList\n\terr := bambou.CurrentSession().FetchChildren(o, GroupIdentity, &list, info)\n\treturn list, err\n}", "title": "" }, { "docid": "38c25c18b4ababee0600a89bed45c7e1", "score": "0.61924815", "text": "func (clsp *CloudifyScaleProvider) NodeGroups() []cloudprovider.NodeGroup {\n\tnodes := []cloudprovider.NodeGroup{}\n\titems, err := clsp.GetDeploymentNodeInfo()\n\tif err != nil {\n\t\tglog.Errorf(\"Cloudify error: %s\\n\", err.Error())\n\t}\n\n\tif items == nil {\n\t\tglog.Errorf(\"no deployments found !!!\")\n\t}\n\n\tfor _, dep := range items {\n\t\tglog.V(4).Infof(\"NodeGroups, Deployment: %+v\", dep[\"id\"])\n\t\tdeployment, err := clsp.client.GetDeployment(dep[\"id\"])\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Cloudify error: %s\\n\", err.Error())\n\t\t\treturn nodes\n\t\t}\n\n\t\tif deployment.ScalingGroups != nil {\n\t\t\tfor groupName := range deployment.ScalingGroups {\n\t\t\t\tnodes = append(nodes, NodeToNodeGroup(clsp.client, dep[\"id\"], groupName, dep[\"node_data_type\"]))\n\t\t\t}\n\t\t}\n\t}\n\tglog.Warningf(\"NodeGroups: %+v\", nodes)\n\treturn nodes\n}", "title": "" }, { "docid": "19a37530c49acaa3da9b6b7b8444d629", "score": "0.61841553", "text": "func (o *UserDetail) GetGroups() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Groups\n}", "title": "" }, { "docid": "69550d27740a6f0e4a775ffb348f924b", "score": "0.6145768", "text": "func (recv *KeyFile) GetGroups() ([]string, uint64) {\n\tvar c_length C.gsize\n\n\tretC := C.g_key_file_get_groups((*C.GKeyFile)(recv.native), &c_length)\n\tretGo := []string{}\n\tfor p := retC; *p != nil; p = (**C.char)(C.gpointer((uintptr(C.gpointer(p)) + uintptr(C.sizeof_gpointer)))) {\n\t\ts := C.GoString(*p)\n\t\tretGo = append(retGo, s)\n\t}\n\tdefer C.g_strfreev(retC)\n\n\tlength := (uint64)(c_length)\n\n\treturn retGo, length\n}", "title": "" }, { "docid": "a24a9ad360d1ad7a28c16bc5c1727d72", "score": "0.6143531", "text": "func GetGroups(grpPath, qString string) {\n\n\tvar grp liqutil.GroupList\n\n\t//fmt.Println(grpPath + qString)\n\tbody := liqutil.CallAPI(grpPath + qString)\n\n\terr := json.Unmarshal(body, &grp)\n\tif err != nil {\n\t\tfmt.Println(\"Error unmarshalling group data.\")\n\t\tos.Exit(1)\n\t}\n\n\tfor _, g := range grp.Response.Data {\n\t\tfmt.Printf(\"Group ID: %-10v\", g.GrpID)\n\t\tfmt.Printf(\"Group Name: %v\\n\", g.GroupName)\n\t\tGetGroupResource(grpPath + \"group/details/\" + strconv.Itoa(g.GrpID))\n\t}\n\n}", "title": "" }, { "docid": "fa51c1a97aa42186d551bf94b9a7a6d0", "score": "0.6137076", "text": "func (g GroupsService) List() ([]*Group, error) {\n\tgroups, err := g.idMap()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist := make([]*Group, 0, len(groups))\n\tfor _, ll := range groups {\n\t\tlist = append(list, ll)\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "3255ff15b8f207b4617f5ffad977a7c4", "score": "0.6132058", "text": "func (ocp *OciCloudProvider) NodeGroups() []cloudprovider.NodeGroup {\n\tnodePools := ocp.poolManager.GetInstancePools()\n\tresult := make([]cloudprovider.NodeGroup, 0, len(nodePools))\n\tfor _, nodePool := range nodePools {\n\t\tresult = append(result, nodePool)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c780157f0dc836a4848d6a1bfbd89644", "score": "0.612231", "text": "func (r *Redis) GroupList() gredis.IGroupList {\n\treturn GroupList{\n\t\tredis: r,\n\t}\n}", "title": "" }, { "docid": "83c6e37f54a853d219625b71d2e66df3", "score": "0.61124367", "text": "func (ng *NodeGroup) GetNodesInGroup(group *proto.NodeGroup, opt *cloudprovider.CommonOption) ([]*proto.Node, error) {\n\treturn nil, cloudprovider.ErrCloudNotImplemented\n}", "title": "" }, { "docid": "07fd3e247194b193775d1956a34d71d3", "score": "0.6098306", "text": "func (m *Manager) getDirectGroups(e *pb.Entity) []string {\n\tif e.GetMeta() == nil {\n\t\treturn []string{}\n\t}\n\n\treturn e.GetMeta().GetGroups()\n}", "title": "" }, { "docid": "341137349aa96d5bc92e9b4602add538", "score": "0.60954475", "text": "func GetGroups(lc *LDAPClient) (data string, err error) {\n\terr = lc.Connect()\n\tdefer lc.Close()\n\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \", err.Error())\n\t\treturn\n\t}\n\tfilter := \"(objectClass=sambaGroupMapping)\"\n\tattrs := []string{\"cn\", \"gidNumber\", \"memberUid\"}\n\tbasedn := fmt.Sprintf(\"ou=Group,%s\", lc.BaseDn)\n\tgroups, err := lc.Search(filter, attrs, basedn)\n\tif err != nil {\n\t\treturn\n\t}\n\tgroupsbytes, err := json.MarshalIndent(groups, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \", err.Error())\n\t\treturn\n\t}\n\tdata = string(groupsbytes)\n\treturn\n}", "title": "" }, { "docid": "cf1074f94c3f1d2b23f0bc0a18ca9c1f", "score": "0.6078108", "text": "func (r ResourceGroupScanner) GetGroups() ([]string, error) {\n\ttab := make([]string, 0)\n\tfor list, err := r.GroupsClient.ListComplete(context.Background(), \"\", nil); list.NotDone(); err = list.NextWithContext(context.Background()) {\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"GetGroups(): GroupsClient.ListComplete failed\")\n\t\t}\n\t\trgName := *list.Value().Name\n\t\ttab = append(tab, rgName)\n\t}\n\treturn tab, nil\n}", "title": "" }, { "docid": "4d842289b6d9ba47f99eb56d40e72d45", "score": "0.6070164", "text": "func (m *Notebook) GetSectionGroups()([]SectionGroupable) {\n val, err := m.GetBackingStore().Get(\"sectionGroups\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]SectionGroupable)\n }\n return nil\n}", "title": "" }, { "docid": "5f3ebe18aa85e2f7ae9dc4ed6f6f7cc3", "score": "0.60680306", "text": "func (o UserInfoOutput) Groups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v UserInfo) []string { return v.Groups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "007da6a6848dd3ae76d0806d79dfeb1b", "score": "0.6067311", "text": "func (GroupController) GetGroups() (int, map[string]interface{}, error) {\n\tlogger.Logging(logger.DEBUG, \"IN\")\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\t// Connect to the database.\n\tdb, err := dbConnector.Connect()\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\tdefer db.Close()\n\n\tgroups, err := db.GetAllGroups()\n\tif err != nil {\n\t\tlogger.Logging(logger.ERROR, err.Error())\n\t\treturn results.ERROR, nil, err\n\t}\n\n\tres := make(map[string]interface{})\n\tres[GROUPS] = groups\n\n\treturn results.OK, res, err\n}", "title": "" }, { "docid": "c0b4d2dc572b7af45ad0e0dc24c42fed", "score": "0.60546833", "text": "func (c *Client) Groups(userID string) (*Groups, error) {\n\n\tvar response = &Groups{}\n\terr := c.call(\"users/\"+userID+\"/groups\", \"GET\", nil, response)\n\treturn response, err\n}", "title": "" }, { "docid": "e0a52b8a09684c0e68e8bc5f95c008b1", "score": "0.6041053", "text": "func GetGroupIDs() []string {\n\tvar r []string\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tfor k, _ := range groups {\n\t\tr = append(r, k)\n\t}\n\tsort.SliceStable(r, func(i, j int) bool {\n\t\treturn r[i] < r[j]\n\t})\n\treturn r\n}", "title": "" }, { "docid": "928fec015741ad8ba6a44f0ed9a1b5af", "score": "0.60202724", "text": "func (c *Client) Groups() (model.AdminQuery, error) {\n\treturn model.AdminQuery{}, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "e0e87b8625c9036d6f183eb11e03295d", "score": "0.6003583", "text": "func getGroups(\n\ttoken string,\n\turl string) ([]string, error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tlog.Printf(\"failed in building group request\", err)\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+token)\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"%s %s %s\", req.Method, req.URL, err)\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"got %d\", resp.StatusCode)\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tjson, err := simplejson.NewJson(body)\n\tif err != nil {\n\t\tlog.Printf(\"failed in fetching groups info\", err)\n\t\treturn nil, err\n\t}\n\tjsonGroups, err := json.Array()\n\tif err != nil {\n\t\tlog.Printf(\"failed in parsing groups info\", err)\n\t\treturn nil, err\n\t}\n\n\tvar groups []string\n\tfor _, grp := range jsonGroups {\n\t\tgroups = append(groups, grp.(map[string]interface{})[\"id\"].(string))\n\t}\n\n\treturn groups, nil\n}", "title": "" }, { "docid": "aa19b6308dbb7949243bc749a5dd2923", "score": "0.5983617", "text": "func GetGroup(name string) ([]string, error) {\n\tgroup, err := GetDBValue(\"[group::\" + name + \"]\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmembers := strings.Split(group, \" \")\n\n\treturn members, nil\n}", "title": "" }, { "docid": "6c209f7c70978efb3ecfb7f52887c133", "score": "0.59823674", "text": "func (s *Service) Group(c context.Context, mid int64) (groupPHP []*model.GroupPHP, err error) {\n\tvar groups []*usmdl.PendantGroupInfo\n\tip := metadata.String(c, metadata.RemoteIP)\n\tif groups, err = s.dao.Group(c, ip); err != nil {\n\t\tlog.Error(\"s.dao.Group(%d) error(%v)\", mid, err)\n\t\treturn\n\t}\n\tfor _, g := range groups {\n\t\tif g.ID == 30 || g.ID == 31 {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, p := range g.SubPendant {\n\t\t\tp.BCoin = p.BCoin / 100\n\t\t\tp.Image = model.FormatImgURL(mid, p.Image)\n\t\t\tp.ImageModel = model.FormatImgURL(mid, p.ImageModel)\n\t\t}\n\t\tgh := &model.GroupPHP{}\n\t\tgh.Name = g.Name\n\t\tgh.Count = g.Number\n\t\tgh.Pendant = g.SubPendant\n\t\tgroupPHP = append(groupPHP, gh)\n\t}\n\treturn\n}", "title": "" }, { "docid": "eaec3fb7cfa11db99456d3c66c898d55", "score": "0.59819216", "text": "func (m *Matcher) Groups() int {\n\treturn m.groups\n}", "title": "" }, { "docid": "022e1c20463e769a5cd36bd6b1c5b826", "score": "0.59802556", "text": "func (o *CustomService) GetProcessGroups() []string {\n\tif o == nil || o.ProcessGroups == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.ProcessGroups\n}", "title": "" }, { "docid": "96394af773ff1d4b4f725275faf47e50", "score": "0.5968625", "text": "func (c *client) GetGroups(query string) ([]*admin.Group, error) {\n\tg := make([]*admin.Group, 0)\n\tvar err error\n\n\tif query != \"\" {\n\t\terr = c.service.Groups.List().Customer(\"my_customer\").Query(query).Pages(context.TODO(), func(groups *admin.Groups) error {\n\t\t\tg = append(g, groups.Groups...)\n\t\t\treturn nil\n\t\t})\n\t} else {\n\t\terr = c.service.Groups.List().Customer(\"my_customer\").Pages(context.TODO(), func(groups *admin.Groups) error {\n\t\t\tg = append(g, groups.Groups...)\n\t\t\treturn nil\n\t\t})\n\n\t}\n\treturn g, err\n}", "title": "" }, { "docid": "054b270bc1f79d0a96f375c4cee3f76a", "score": "0.5941864", "text": "func (c *Cluster) GetNodeGroups() map[string]ClusterNodeGroup {\n\tif c.NodeGroups == nil {\n\t\treturn nil\n\t}\n\treturn *c.NodeGroups\n}", "title": "" }, { "docid": "cece01d6d4112d7aa7080a78dea6378e", "score": "0.5941063", "text": "func (e *externalGrpcCloudProvider) NodeGroups() []cloudprovider.NodeGroup {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\tif e.nodeGroupsCache != nil {\n\t\tklog.V(5).Info(\"Returning cached NodeGroups\")\n\t\treturn e.nodeGroupsCache\n\t}\n\tnodeGroups := make([]cloudprovider.NodeGroup, 0)\n\tctx, cancel := context.WithTimeout(context.Background(), grpcTimeout)\n\tdefer cancel()\n\tklog.V(5).Info(\"Performing gRPC call NodeGroups\")\n\tres, err := e.client.NodeGroups(ctx, &protos.NodeGroupsRequest{})\n\tif err != nil {\n\t\tklog.V(1).Infof(\"Error on gRPC call NodeGroups: %v\", err)\n\t\treturn nodeGroups\n\t}\n\tfor _, pbNg := range res.GetNodeGroups() {\n\t\tng := &NodeGroup{\n\t\t\tid: pbNg.Id,\n\t\t\tminSize: int(pbNg.MinSize),\n\t\t\tmaxSize: int(pbNg.MaxSize),\n\t\t\tdebug: pbNg.Debug,\n\t\t\tclient: e.client,\n\t\t}\n\t\tnodeGroups = append(nodeGroups, ng)\n\t}\n\te.nodeGroupsCache = nodeGroups\n\treturn nodeGroups\n}", "title": "" }, { "docid": "5d352978fdb1cc41e22953122ceee9c2", "score": "0.59383595", "text": "func (g *Group) Groups() []*Group {\n\tallGroups := make([]*Group, 0, len(g.groups))\n\tfor _, gg := range g.groups {\n\t\tallGroups = append(allGroups, gg)\n\t}\n\n\tsort.Sort(byGroupNameAlphabetic(allGroups))\n\treturn allGroups\n}", "title": "" }, { "docid": "0b91ce179b39b512d68e7e249da33627", "score": "0.5933988", "text": "func (o AdminRoleTargetsOutput) Groups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AdminRoleTargets) pulumi.StringArrayOutput { return v.Groups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "4dd84b0e3a98f3c47f38e60ffe871640", "score": "0.59293324", "text": "func (m *Manager) GetGroups() (map[cgroup.Subsystem][]string, error) {\n\tresult := make(map[cgroup.Subsystem][]string)\n\tfor sub := range subsystems {\n\t\t// skip devices subsystem (only cpuset and memory)\n\t\tif sub == cgroup.DevicesSubsystem {\n\t\t\tcontinue\n\t\t}\n\t\tinfo, err := ioutil.ReadDir(path.Join(CGroupBase, string(sub)))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, dir := range info {\n\t\t\tif !dir.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresult[sub] = append(result[sub], dir.Name())\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "63f54a13e0749c2abb6f82fa89fe3917", "score": "0.5924281", "text": "func (c *Client) GetGroups() (results *map[string]Group, err error) {\n\tstartURL, err := url.Parse(c.endpointURL.String())\n\tif err != nil {\n\t\treturn\n\t}\n\n\tstartURL.Path = path.Join(startURL.Path, \"/Groups\")\n\n\tvar resultGroup = make(map[string]Group)\n\n\tsi := 1\n\tfor {\n\t\tc.logger.Debug(\"Getting Groups Page\", zap.Int(\"startIndex\", si))\n\n\t\tr, err := c.getGroupPage(startURL, si)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, group := range r.Resources {\n\t\t\tc.logger.Debug(\"Add group to map\", zap.String(\"group\", group.DisplayName))\n\t\t\tresultGroup[group.DisplayName] = group\n\t\t}\n\n\t\tsi = si + 10\n\t\tif si > r.TotalResults {\n\t\t\tc.logger.Debug(\"Last Page obtained\", zap.Int(\"totalResults\", r.TotalResults))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn &resultGroup, nil\n}", "title": "" }, { "docid": "1010d5f2d38f11a930785e259f6822b6", "score": "0.59010816", "text": "func (l *LinkAggregationGroups) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/link_aggregation.groups\", &l.Value, options...)\n}", "title": "" }, { "docid": "f5df7d27ccdf3422bb8ade347029037c", "score": "0.5876049", "text": "func (s *fileStore) ListGroups() ([]Group, error) {\n\treturn s.groups, nil\n}", "title": "" }, { "docid": "1fd83f7abf5ae88671645342f0e5c358", "score": "0.58749396", "text": "func (groups *Groups) GetGroups(correlationid string) error {\n\tcachegroups, found := Profilecache.Get(\"groups\")\n\tif found {\n\t\tjson.Unmarshal(cachegroups.([]byte), groups)\n\t\treturn nil\n\t} else {\n\t\treq, err := client.NewRequest(\n\t\t\tConfig,\n\t\t\t\"GET\",\n\t\t\t\"/papi/v1/groups\",\n\t\t\tnil,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tedge.PrintHttpRequestCorrelation(req, true, correlationid)\n\n\t\tres, err := client.Do(Config, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tedge.PrintHttpResponseCorrelation(res, true, correlationid)\n\n\t\tif client.IsError(res) {\n\t\t\treturn client.NewAPIError(res)\n\t\t}\n\n\t\tif err = client.BodyJSON(res, groups); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbyt, _ := json.Marshal(groups)\n\t\tProfilecache.Set(\"groups\", byt, cache.DefaultExpiration)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "6293808c1cad395c31424023a72628fe", "score": "0.58695364", "text": "func (c *githubConnector) getGroups(ctx context.Context, client *http.Client, groupScope bool, userLogin string) ([]string, error) {\n\tswitch {\n\tcase len(c.orgs) > 0:\n\t\treturn c.groupsForOrgs(ctx, client, userLogin)\n\tcase c.org != \"\":\n\t\treturn c.teamsForOrg(ctx, client, c.org)\n\tcase groupScope && c.loadAllGroups:\n\t\treturn c.userGroups(ctx, client)\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "2e77b9aae633301290cb73abc8686eb9", "score": "0.5854588", "text": "func (client *HearthstoneAPI) SetGroups() []string {\n\treturn client.setGroups\n}", "title": "" }, { "docid": "c900a1982fd1eef7546e2a5fd222e3ae", "score": "0.58528745", "text": "func (o LookupAppGroupAssignmentsResultOutput) Groups() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupAppGroupAssignmentsResult) []string { return v.Groups }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "dad20876929ef03b82c46c4361c943ff", "score": "0.5852624", "text": "func (s *ScanGroupsStats) Groups() []*GroupStats {\n\ts.groupLock.RLock()\n\tdefer s.groupLock.RUnlock()\n\tgroups := make([]*GroupStats, 0)\n\tfor _, group := range s.groups {\n\t\tgroups = append(groups, s.GetGroup(group.GroupID))\n\t}\n\treturn groups\n}", "title": "" }, { "docid": "5fa85798580f9b3ab7472f2346ba0298", "score": "0.58341974", "text": "func GetInstanceGroups(kopsBinary, clusterName string, env []string) ([]*api.InstanceGroup, error) {\n\targs := []string{\n\t\tkopsBinary, \"get\", \"instancegroups\", \"--name\", clusterName, \"-ojson\",\n\t}\n\tc := exec.Command(args[0], args[1:]...)\n\tc.SetEnv(env...)\n\tvar stdout bytes.Buffer\n\tc.SetStdout(&stdout)\n\tvar stderr bytes.Buffer\n\tc.SetStderr(&stderr)\n\tif err := c.Run(); err != nil {\n\t\tklog.Warningf(\"failed to run %s; stderr=%s\", strings.Join(args, \" \"), stderr.String())\n\t\treturn nil, fmt.Errorf(\"error querying instance groups from %s: %w\", strings.Join(args, \" \"), err)\n\t}\n\n\tvar igs []*api.InstanceGroup\n\tif err := json.Unmarshal(stdout.Bytes(), &igs); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing instance groups json: %w\", err)\n\t}\n\treturn igs, nil\n}", "title": "" }, { "docid": "323aaddb508b96dc4f6ac2a688044ac3", "score": "0.5820956", "text": "func (g *GroupSuccessResponse) Groups() []objects.Group {\n\tgroups := make([]objects.Group, len(g.groups), len(g.groups))\n\tcopy(groups, g.groups)\n\n\treturn groups\n}", "title": "" }, { "docid": "a832a0a3fc6e8d604e38559072a45dc8", "score": "0.5807347", "text": "func (m *RuleManager) GetRuleGroups() []*RuleGroup {\n\tm.RLock()\n\tdefer m.RUnlock()\n\tgroups := make([]*RuleGroup, 0, len(m.ruleConfig.groups))\n\tfor _, g := range m.ruleConfig.groups {\n\t\tgroups = append(groups, g)\n\t}\n\tsort.Slice(groups, func(i, j int) bool {\n\t\treturn groups[i].Index < groups[j].Index ||\n\t\t\t(groups[i].Index == groups[j].Index && groups[i].ID < groups[j].ID)\n\t})\n\treturn groups\n}", "title": "" }, { "docid": "0832522d9633f1fc83495614539d6268", "score": "0.579914", "text": "func (s *GroupService) All() ([]*Group, *Response, error) {\n\tpath := \"api/v2/groups\"\n\n\treq, rerr := s.client.NewRequest(\"GET\", path, nil)\n\tif rerr != nil {\n\t\treturn nil, nil, rerr\n\t}\n\n\t// request populates Feed slice\n\tgroups := make([]*Group, 0)\n\tresp, err := s.client.Do(req, &groups)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn groups, resp, nil\n}", "title": "" }, { "docid": "0486f074e62189f97493749ecd8b74e9", "score": "0.5797265", "text": "func (s *UserService) GetGroups(ctx context.Context, user *UserRepresentation) ([]GroupRepresentation, error) {\n\n\tpath := \"/realms/{realm}/users/{id}/groups\"\n\n\tvar groups []GroupRepresentation\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\": user.ID,\n\t\t}).\n\t\tSetResult(&groups).\n\t\tGet(path)\n\n\treturn groups, err\n}", "title": "" }, { "docid": "a75150647f56fdcaf64d7fbf99c71d40", "score": "0.5787471", "text": "func (b *Bridge) Groups() *GroupsService { return &GroupsService{bridge: b} }", "title": "" }, { "docid": "6e35fcf843f556dbd45dad172a624092", "score": "0.57863474", "text": "func (r StateV011) GetGroupsForHost(host string) ([]string, error) {\n\tvar resource ResourceV011\n\tgroups := []string{}\n\n\tv, err := r.GetHost(host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresource = v.(ResourceV011)\n\n\tfor attrName, attr := range resource.Primary.Attributes {\n\t\tif strings.HasPrefix(attrName, \"groups.\") {\n\t\t\tif attrName == \"groups.#\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpieces := strings.SplitN(attrName, \".\", 2)\n\t\t\tif len(pieces) == 2 {\n\t\t\t\tgroups = append(groups, attr)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn groups, nil\n}", "title": "" }, { "docid": "a0cce93732e085abbc4ec28c1bfb2a94", "score": "0.5785087", "text": "func (c Control) ListGroups(userId string) *[]string {\n\tgroupIds := []string{}\n\tfor _, g := range c.groups {\n\t\tgroupIds = append(groupIds, g.Id)\n\t}\n\n\tlog.Printf(\"List groups for user %s\", userId)\n\treturn &groupIds\n}", "title": "" }, { "docid": "7b6ff359ad3c5936dbcbc5eb76215c1f", "score": "0.57848245", "text": "func (dir *Directory) GetGroups(criteria GroupCriteria) (*Groups, error) {\n\terr := client.get(\n\t\tbuildAbsoluteURL(dir.Groups.Href, criteria.toQueryString()),\n\t\tdir.Groups,\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn dir.Groups, nil\n}", "title": "" }, { "docid": "a351f51191e19f75bb388ffd9682d050", "score": "0.57746255", "text": "func (o *MonitorGroupSearchResponse) GetGroups() []MonitorGroupSearchResult {\n\tif o == nil || o.Groups == nil {\n\t\tvar ret []MonitorGroupSearchResult\n\t\treturn ret\n\t}\n\treturn o.Groups\n}", "title": "" }, { "docid": "cc4b28d525eabd21887c64f6759cfa36", "score": "0.5771056", "text": "func GetGroups(facLink, educationType string) ([]string, error) {\n\tvar (\n\t\taddr = \"https://www.sgu.ru/schedule/\" + facLink\n\t\tgroup string\n\t\tgroups []string\n\t)\n\n\tres, err := http.Get(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"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\treturn nil, err\n\t}\n\n\tdoc.Find(\".form_education\").Each(func(_ int, s *goquery.Selection) {\n\t\tif s.ChildrenFiltered(\"legend\").Text() == \"Дневная форма обучения\" {\n\t\t\ts.Find(\".group-type\").Each(func(_ int, t *goquery.Selection) {\n\t\t\t\ttyp := t.ChildrenFiltered(\"legend\").Text()\n\t\t\t\tif typ == educationType {\n\t\t\t\t\tt.Find(\"a\").Each(func(_ int, g *goquery.Selection) {\n\t\t\t\t\t\tgroup = g.Text()\n\t\t\t\t\t\tgroups = append(groups, group)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n\n\treturn groups, nil\n}", "title": "" }, { "docid": "64daea5b134ee653649f39d660bcba6e", "score": "0.57559705", "text": "func (recv *BookmarkFile) GetGroups(uri string) ([]string, uint64, error) {\n\tc_uri := C.CString(uri)\n\tdefer C.free(unsafe.Pointer(c_uri))\n\n\tvar c_length C.gsize\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_bookmark_file_get_groups((*C.GBookmarkFile)(recv.native), c_uri, &c_length, &cThrowableError)\n\tretGo := []string{}\n\tfor p := retC; *p != nil; p = (**C.char)(C.gpointer((uintptr(C.gpointer(p)) + uintptr(C.sizeof_gpointer)))) {\n\t\ts := C.GoString(*p)\n\t\tretGo = append(retGo, s)\n\t}\n\tdefer C.g_strfreev(retC)\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\tlength := (uint64)(c_length)\n\n\treturn retGo, length, goError\n}", "title": "" }, { "docid": "fd3424dfdce6821f1941a9e838bedc5c", "score": "0.57489055", "text": "func GetGroups(w http.ResponseWriter, r *http.Request) {\n\tvar groups []model.Group\n\tmodel.DB().Model(&groups).Related(&model.User{}, \"Users\")\n\tmodel.DB().Preload(\"Users\").Preload(\"Owner\").Where(\"status = ?\", 0).Find(&groups)\n\n\tresponse := make([]responseGroup, 0, len(groups))\n\tfor i := range groups {\n\t\tlenUsers := len(groups[i].Users)\n\t\tif lenUsers > 0 {\n\t\t\tplayers := make([]responsePlayer, lenUsers)\n\t\t\tfor j := range groups[i].Users {\n\t\t\t\tplayers[j] = responsePlayer{\n\t\t\t\t\tID: groups[i].Users[j].ID.String(),\n\t\t\t\t\tUsername: groups[i].Users[j].Username,\n\t\t\t\t\tIsCPU: groups[i].Users[j].IsCPU,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse = append(response, responseGroup{\n\t\t\t\tID: groups[i].ID.String(),\n\t\t\t\tGroupName: groups[i].Name,\n\t\t\t\tPlayersMax: groups[i].PlayersMax,\n\t\t\t\tGameType: groups[i].GameType,\n\t\t\t\tDifficulty: groups[i].Difficulty,\n\t\t\t\tStatus: 0,\n\t\t\t\tLanguage: groups[i].Language,\n\t\t\t\tNbRound: groups[i].NbRound,\n\t\t\t\tOwnerName: groups[i].Owner.Username,\n\t\t\t\tOwnerID: groups[i].OwnerID.String(),\n\t\t\t\tPlayers: players,\n\t\t\t})\n\t\t}\n\t}\n\trbody.JSON(w, http.StatusOK, response)\n}", "title": "" }, { "docid": "4da5ecec9e8354eec55118be55565f01", "score": "0.57485574", "text": "func (a *Auth) getGroups(token string) ([]Group, error) {\n\tvar groups Groups\n\n\tgc, ok := a.groupsCache[token]\n\tif ok && (time.Since(gc.cacheTime) < a.cacheTTL) && len(gc.groups) > 0 {\n\t\treturn gc.groups, nil\n\t}\n\n\tnextLink := a.groupEndpoint\n\tfor nextLink != \"\" {\n\t\treq, err := http.NewRequest(\"GET\", nextLink, nil)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"creating new request to group endpoint\")\n\t\t}\n\n\t\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", token))\n\t\tresponse, err := http.DefaultClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"getting group membership info\")\n\t\t}\n\t\tif response.StatusCode != http.StatusOK {\n\t\t\treturn nil, fmt.Errorf(\"getting group membership info: %s\", response.Status)\n\t\t}\n\n\t\tvar g Groups\n\t\tif err = json.NewDecoder(response.Body).Decode(&g); err != nil {\n\t\t\treturn groups.Groups, errors.Wrap(err, \"failed unmarshalling group membership response\")\n\t\t}\n\n\t\tresponse.Body.Close()\n\t\tgroups.Groups = append(groups.Groups, g.Groups...)\n\t\tnextLink = g.NextLink\n\t}\n\n\tif len(groups.Groups) == 0 {\n\t\treturn nil, fmt.Errorf(\"no groups found\")\n\t}\n\n\ta.groupsCache[token] = cachedGroups{\n\t\tcacheTime: time.Now(),\n\t\tgroups: groups.Groups,\n\t}\n\treturn groups.Groups, nil\n}", "title": "" }, { "docid": "0958a6a8d1c5d70138110c5417fa999f", "score": "0.5729295", "text": "func (_ UserAliases) Groups(p graphql.ResolveParams) ([]string, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := val.([]string)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'groups'\")\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "42a8a2b7f1d41ad5b4388f13033b0791", "score": "0.57275844", "text": "func GetGroups(server string) (*systerapb.FetchGroupsResponse, error) {\n\tr, err := client.FetchGroups(context.Background(), &systerapb.FetchGroupsRequest{\n\t\tServerName: server,\n\t})\n\treturn r, err\n}", "title": "" }, { "docid": "4de16fcd56320d52b7ec04eacbaeba5d", "score": "0.5726177", "text": "func GetTokenGroups(token syscall.Token) (TokenGroups, error) {\n\tp, err := getInfo(token, syscall.TokenGroups, 50)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgroupCount := *(*uint32)(p)\n\tif groupCount > 200 {\n\t\t// simple protection against invalid memory - how much is too much?\n\t\treturn nil, errors.Errorf(\"invalid groupcount? %x\", groupCount)\n\t}\n\ttokengroups := make(TokenGroups, groupCount)\n\tp = unsafe.Pointer(uintptr(p) + 8)\n\tfor i := uint32(0); i < groupCount; i++ {\n\t\tgroup := *(*syscall.SIDAndAttributes)(p)\n\t\ttokengroups[i] = group\n\t\tp = unsafe.Pointer(uintptr(p) + unsafe.Sizeof(group))\n\t}\n\treturn tokengroups, nil\n}", "title": "" }, { "docid": "3ec36bbd650459cc9219ecf35b3e5c02", "score": "0.57232326", "text": "func groups(f *fg.Flags) []jobs.TaskGroupName {\n\tnames := []jobs.TaskGroupName{}\n\tfor _, n := range f.Groups {\n\t\tnames = append(names, jobs.TaskGroupName(n))\n\t}\n\treturn names\n}", "title": "" }, { "docid": "160735da427562903c1f36b48927157f", "score": "0.57200676", "text": "func (tc *Client) ListGroups() ([]model.Group, error) {\n\tgroups := make([]model.Group, 0)\n\n\tresp, err := tc.Call(tc.dtlsclient.BuildGETMessage(\"/15004\"))\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"Unable to call Trådfri Gateway\")\n\t\treturn groups, err\n\t}\n\n\tgroupIds := make([]int, 0)\n\terr = json.Unmarshal(resp.Payload, &groupIds)\n\tif err != nil {\n\t\tlogrus.Info(\"Unable to parse groups list into JSON: \" + err.Error())\n\t\treturn groups, err\n\t}\n\n\tfor _, groupId := range groupIds {\n\t\tgroup, _ := tc.GetGroup(groupId)\n\t\tgroups = append(groups, group)\n\t}\n\treturn groups, nil\n}", "title": "" }, { "docid": "cf9afa51e63eeae40409ba9e98064256", "score": "0.57135534", "text": "func (rg *ResourceGroup) GetGroupStates() *GroupStates {\n\trg.RLock()\n\tdefer rg.RUnlock()\n\tswitch rg.Mode {\n\tcase rmpb.GroupMode_RUMode: // RU mode\n\t\ttokens := &GroupStates{\n\t\t\tRU: rg.RUSettings.RU.GroupTokenBucketState.Clone(),\n\t\t}\n\t\treturn tokens\n\tcase rmpb.GroupMode_RawMode: // Raw mode\n\t\ttokens := &GroupStates{\n\t\t\tCPU: rg.RawResourceSettings.CPU.GroupTokenBucketState.Clone(),\n\t\t\tIORead: rg.RawResourceSettings.IOReadBandwidth.GroupTokenBucketState.Clone(),\n\t\t\tIOWrite: rg.RawResourceSettings.IOWriteBandwidth.GroupTokenBucketState.Clone(),\n\t\t}\n\t\treturn tokens\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0c74a904aa73537a56370acac7b4101", "score": "0.5707673", "text": "func (p *StoragePlan) NodeShardGroups() []meta.ShardGroupInfo {\n\treturn p.groups\n}", "title": "" }, { "docid": "e730349e158c5df13e2c6db7055c8a96", "score": "0.56960285", "text": "func (n *Network) CidrGroups() map[string][]string {\n\treturn n.CidrGroups_\n}", "title": "" }, { "docid": "58b07605ee0a7bea3a9a29964d57abfe", "score": "0.5686413", "text": "func (nmap *Nodemap) GetGroup(x, y int) int {\n\tiWidth := nmap.bounds.Dx()\n\treturn nmap.assignments[y*iWidth+x]\n}", "title": "" }, { "docid": "967a2b125539c63eb138adf35db1d620", "score": "0.56732565", "text": "func (r *Relay) Groups(group string) *GroupOperations {\n\treturn &GroupOperations{\n\t\tgroup: group,\n\t\te: r.exchange,\n\t\trelay: r,\n\t}\n}", "title": "" }, { "docid": "60167384e261d822fdcdf0f6c973fc7e", "score": "0.5664252", "text": "func (costInsightsAwsServer) GetUserGroups(context.Context, *pb.UserGroupsRequest) (*pb.UserGroupsResponse, error) {\n\tgroups := []*pb.Group{\n\t\t{Id: \"default-group\"},\n\t}\n\treturn &pb.UserGroupsResponse{Groups: groups}, nil\n}", "title": "" }, { "docid": "b501f914afaf24ed39a8a83ecf55cf9e", "score": "0.56571114", "text": "func (ds *DoitServer) GetGroupsByDomain(d *Domain) ([]*Group, error) {\n\tg := []*Group{}\n\tgormErr := ds.Store.Conn.Find(&g).Related(\"Vars\").Related(\"Hosts\")\n\tif gormErr.Error != nil {\n\t\treturn nil, gormErr.Error\n\t}\n\treturn g, nil\n}", "title": "" }, { "docid": "91b111f86d3df91e7804148dd4ec3025", "score": "0.56366384", "text": "func (o *SnippetDTO) GetProcessGroups() map[string]RevisionDTO {\n\tif o == nil || o.ProcessGroups == nil {\n\t\tvar ret map[string]RevisionDTO\n\t\treturn ret\n\t}\n\treturn *o.ProcessGroups\n}", "title": "" }, { "docid": "ccfd481dfd5b14d8b469b571ee1f5e85", "score": "0.5632631", "text": "func (kubemark *KubemarkCloudProvider) NodeGroups() []cloudprovider.NodeGroup {\n\treturn []cloudprovider.NodeGroup{}\n}", "title": "" }, { "docid": "c9b20d057a4901c36a5aa9dfad64aa11", "score": "0.5617838", "text": "func (c *Client) GetGroups(ctx context.Context) ([]*Group, error) {\n\turl := c.addAccessTokenToUrl(GetGroupsUrl)\n\tr, err := c.Get(ctx, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp struct {\n\t\tGroups []*Group `json:\"groups\"`\n\t}\n\tbts, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = json.Unmarshal(bts, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp.Groups, nil\n}", "title": "" }, { "docid": "022cdffabb628e95a26b8762af571e61", "score": "0.5608707", "text": "func (cli *IdentityClient) Groups() *GroupClient {\n\treturn &GroupClient{cli}\n}", "title": "" }, { "docid": "b6c7f94cd57dff0881e56a8b3e293593", "score": "0.558634", "text": "func (k Keeper) Groups(goCtx context.Context, request *group.QueryGroupsRequest) (*group.QueryGroupsResponse, error) {\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\tit, err := k.groupTable.PrefixScan(ctx.KVStore(k.key), 1, math.MaxUint64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer it.Close()\n\n\tvar groups []*group.GroupInfo\n\tpageRes, err := orm.Paginate(it, request.Pagination, &groups)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &group.QueryGroupsResponse{\n\t\tGroups: groups,\n\t\tPagination: pageRes,\n\t}, nil\n}", "title": "" }, { "docid": "052c22caa23f5e5652c08be456aabb8d", "score": "0.55727", "text": "func (p *Provider) GetGroupNodes(group string) ([]string, error) {\n\t// TODO: make this hit the compute API directly instead of shelling out to gcloud.\n\t// TODO: make gce/gke implement InstanceGroups, so we can eliminate the per-provider logic\n\tzone, err := getGCEZoneForGroup(group)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toutput, err := exec.Command(\"gcloud\", \"compute\", \"instance-groups\", \"managed\",\n\t\t\"list-instances\", group, \"--project=\"+framework.TestContext.CloudConfig.ProjectID,\n\t\t\"--zone=\"+zone).CombinedOutput()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get nodes in instance group %s: %s\", group, output)\n\t}\n\tre := regexp.MustCompile(\".*RUNNING\")\n\tlines := re.FindAllString(string(output), -1)\n\tfor i, line := range lines {\n\t\tlines[i] = line[:strings.Index(line, \" \")]\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "4a5938a2620475fdd5409d362ef79710", "score": "0.55701774", "text": "func HandleGetGroups(msg *app.Message) (interface{}, error) {\n\tif gState.db == nil {\n\t\treturn nil, fmt.Errorf(\"no database\")\n\t}\n\n\t// Retrieve groups\n\tgroups, err := gState.db.ReadGroups()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to read groups: %s\", err)\n\t}\n\n\treturn groups, nil\n}", "title": "" }, { "docid": "821e85455c206ee796f684f9e667ba50", "score": "0.5561106", "text": "func execGetgroups(_ int, p *gop.Context) {\n\tret, ret1 := syscall.Getgroups()\n\tp.Ret(0, ret, ret1)\n}", "title": "" }, { "docid": "990b6294e1f4bcb4b4a425b2a16a8477", "score": "0.5557072", "text": "func NewGroups() *Groups {\n\tgroups := &Groups{}\n\treturn groups\n}", "title": "" } ]
3d07fdeacbbcb9dc0481a89e584647f9
Sets the dimensions of the scissor box.
[ { "docid": "1ec47267e74e8ae0ba798773efd8004e", "score": "0.52141684", "text": "func (c *Context) Scissor(x, y, width, height int) {\n\tc.Call(\"scissor\", x, y, width, height)\n}", "title": "" } ]
[ { "docid": "f3891768e263913b777701af285077e3", "score": "0.6471897", "text": "func SetScissor(args ...int32) {\n\tif args == nil {\n\t\tgl.Disable(gl.SCISSOR_TEST)\n\t\tstates.back().scissor = false\n\t} else if len(args) == 4 {\n\t\tx, y, width, height := args[0], args[1], args[2], args[3]\n\t\tgl.Enable(gl.SCISSOR_TEST)\n\t\tif glState.currentCanvas != nil {\n\t\t\tgl.Scissor(x, y, width, height)\n\t\t} else {\n\t\t\t// With no Canvas active, we need to compensate for glScissor starting\n\t\t\t// from the lower left of the viewport instead of the top left.\n\t\t\tgl.Scissor(x, glState.viewport[3]-(y+height), width, height)\n\t\t}\n\t\tstates.back().scissorBox = []int32{x, y, width, height}\n\t\tstates.back().scissor = true\n\t} else {\n\t\tpanic(\"incorrect number of arguments to setscissor\")\n\t}\n}", "title": "" }, { "docid": "a2918286af6acb9b5208970e3b34bfaa", "score": "0.62089574", "text": "func (rect *Rectangle) SetSize(w, h float64) {\n rect.Width = w\n rect.Height = h\n}", "title": "" }, { "docid": "a2c337b68ca22e1fa4be4ded0e0ad71a", "score": "0.6085784", "text": "func (p *Palette) SetSize(sx, sy int) {\n\tp.grid.SetSize(sx, sy)\n}", "title": "" }, { "docid": "2e203f74456231d7ccba1918dd112f92", "score": "0.60237306", "text": "func (obj Device) SetScissorRect(pRect RECT) (err Error) {\n\tcpRect := pRect.toC()\n\terr = toErr(C.IDirect3DDevice9SetScissorRect(obj.handle, &cpRect))\n\treturn\n}", "title": "" }, { "docid": "a836568724278d9c4f4473b54327a016", "score": "0.5951854", "text": "func (s *Swatch) SetSize(sx, sy int) {\n\tif sx != sy {\n\t\tpanic(fmt.Sprintf(\"Swatchs must have square dimensions, %d != %d\", sx, sy))\n\t}\n\ts.size = sx\n}", "title": "" }, { "docid": "c555d2fa8c8dcdcd8b2dfee20becb8ff", "score": "0.59157187", "text": "func (screen *Screen) SetSize(width, height int) {\n\tif height > screen.height {\n\t\tfor x := 0; x < screen.width; x++ {\n\t\t\ttermbox.SetCell(x, screen.height-1, ' ', screen.fg, screen.bg)\n\t\t}\n\t\tscreen.Flush()\n\t}\n\n\tscreen.width = width\n\tscreen.height = height\n}", "title": "" }, { "docid": "dbc29d2b872967be9b891c215e2ef8d2", "score": "0.5845387", "text": "func SetCanvasSize(w, h int) {\n\tcanvas.Set(\"width\", w)\n\tcanvas.Set(\"height\", h)\n\twidth = canvas.Get(\"width\").Int()\n\theight = canvas.Get(\"height\").Int()\n\tlog.Println(\"resized canvas\")\n}", "title": "" }, { "docid": "bc26868b01c8c83b9c02151068d41e88", "score": "0.57858163", "text": "func (state *State) ScreenSetSize(width, height int) {\n\tstate.screen.SetSize(width, height)\n}", "title": "" }, { "docid": "fff3da46146d6f9a587a41aa2e75830e", "score": "0.5687967", "text": "func (g *Grid) SetSize(sx, sy int) {\n\tpanic(\"set size not implemented\")\n}", "title": "" }, { "docid": "7f440a9099281bdeee8179d914b295d9", "score": "0.567188", "text": "func setPanelSize(p *sdk.Panel, width, height int) {\n\tp.GridPos.W = &width\n\tp.GridPos.H = &height\n}", "title": "" }, { "docid": "7893e041d9d46b8b464236b1ec67047e", "score": "0.56601787", "text": "func (cv *Canvas) SetBounds(x, y, w, h int) {\n\tif !cv.offscreen {\n\t\tcv.x, cv.y = x, y\n\t\tcv.fx, cv.fy = float64(x), float64(y)\n\t}\n\tcv.w, cv.h = w, h\n\tcv.fw, cv.fh = float64(w), float64(h)\n\tactiveCanvas = nil\n}", "title": "" }, { "docid": "d2df40d4b2c81240cc3b082161b35dcd", "score": "0.5635758", "text": "func (s *SelectableWidget) Size(width, height float32) *SelectableWidget {\n\ts.width, s.height = width, height\n\treturn s\n}", "title": "" }, { "docid": "1acd5f2433ffca81bc89e069ec251735", "score": "0.5622739", "text": "func (rect *Rectangle) Set(x, y, w, h float64) {\n rect.X = x\n rect.Y = y\n rect.Width = w\n rect.Height = h\n}", "title": "" }, { "docid": "b704a93241c6ef66e9c9f917b874fb86", "score": "0.5607693", "text": "func (r *Rect) SetSize(s Size) {\n\tr.W = s.W\n\tr.H = s.H\n}", "title": "" }, { "docid": "cfe536fd883ab108945e4daccc9cae5c", "score": "0.5592274", "text": "func (r Roster) SetRect(x, y, width, height int) {\n\tr.flex.SetRect(x, y, width, height)\n}", "title": "" }, { "docid": "973468572b3fdec22595ac1b0d68dad2", "score": "0.5529292", "text": "func (s *Screen) SetSize(sz image.Point) {\n\ts.v.Rect.Max = sz\n}", "title": "" }, { "docid": "78483688c2336a6e9046c0da47be2e12", "score": "0.5429328", "text": "func (w *Window) setSize(s Size) { w.onSetSize.Handle(w, &w.size, s) }", "title": "" }, { "docid": "5243dcc5cff47978c455d4c678684fb7", "score": "0.54228747", "text": "func (gm *Geom2DInt) SetRect(r image.Rectangle) {\n\tgm.Pos = r.Min\n\tgm.Size = r.Size()\n}", "title": "" }, { "docid": "6de93cbeccbe7510c0fac549aae15755", "score": "0.5414728", "text": "func SetWindowSize(width, height int) {\n\tif width <= 0 || height <= 0 {\n\t\tpanic(\"ebiten: width and height must be positive\")\n\t}\n\tui.Get().Window().SetSize(width, height)\n}", "title": "" }, { "docid": "f2b70b5c9792ce0463f5d97915cba2d0", "score": "0.53898317", "text": "func (rect *Rectangle) SetSizeVector(size *Vector) {\n rect.Width = size.X\n rect.Height = size.Y\n}", "title": "" }, { "docid": "0365eb4486371ecb32e898f395fb1108", "score": "0.53449297", "text": "func (obj *Positioner) SetSize(width int32, height int32) {\n\tobj.Conn().SendRequest(obj, 1, width, height)\n}", "title": "" }, { "docid": "d41b5874bed1cfef019b1d2de2287e52", "score": "0.5342324", "text": "func (w *Window) SetSize(width, height int) {\n\tw.glfwWindow.SetSize(width, height)\n}", "title": "" }, { "docid": "7359266d5e1d10ec44fc83230f820446", "score": "0.52414626", "text": "func Scissor(x int, y int, width int, height int) {\n\tC.glScissor(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height))\n}", "title": "" }, { "docid": "4213c456e2f030e9bccf2217a045b7c4", "score": "0.5228046", "text": "func (e *Escpos) Size(width uint8, height uint8) *Escpos {\n\t// Values > 5 are not supported by esc/pos, so we'll set 5 as the maximum.\n\tif width > 5 {\n\t\twidth = 5\n\t}\n\tif height > 5 {\n\t\theight = 5\n\t}\n\te.Style.Width = width\n\te.Style.Height = height\n\treturn e\n}", "title": "" }, { "docid": "090e7e187df406df211aa0290dd171fb", "score": "0.5163824", "text": "func (c *Client) SetWinSize(width, height int) {\n\twidth = 1000 //todo:: work around\n\terr := c.term.SetSize(width, height)\n\tif err != nil {\n\t\tlog.Println(\"SetWinSize failed: \", width, height)\n\t}\n\tc.termWidth, c.termHeight = width, height\n}", "title": "" }, { "docid": "324662a4c4db5ad36ea368e50acacace", "score": "0.5155135", "text": "func (r *Rectangle) ScaleBy(sc int) {\n\tr.Width = r.Width * sc\n\tr.Height = r.Height * sc\n}", "title": "" }, { "docid": "23ed19ce8376365072913cfbd48d23b8", "score": "0.51376635", "text": "func IntersectScissor(x, y, width, height int32) {\n\trect := states.back().scissorBox\n\n\tif !states.back().scissor {\n\t\trect[0] = 0\n\t\trect[1] = 0\n\t\trect[2] = math.MaxInt32\n\t\trect[3] = math.MaxInt32\n\t}\n\n\tx1 := int32(math.Max(float64(rect[0]), float64(x)))\n\ty1 := int32(math.Max(float64(rect[1]), float64(y)))\n\tx2 := int32(math.Min(float64(rect[0]+rect[2]), float64(x+width)))\n\ty2 := int32(math.Min(float64(rect[1]+rect[3]), float64(y+height)))\n\n\tSetScissor(x1, y1, int32(math.Max(0, float64(x2-x1))), int32(math.Max(0, float64(y2-y1))))\n}", "title": "" }, { "docid": "91fb901d2d9e7d088162015c76e2dcea", "score": "0.5052281", "text": "func (p *Primitive2D) SetSize(size mgl32.Vec2) {\n\tp.size = size\n\tp.modelMatrix.size = mgl32.Scale3D(p.size.X(), p.size.Y(), 1)\n\tp.modelMatrix.dirty = true\n}", "title": "" }, { "docid": "654321954ee4b352816c1c65000f69ad", "score": "0.5045708", "text": "func SetViewportSize(w, h int32) {\n\tSetViewport(0, 0, w, h)\n}", "title": "" }, { "docid": "5a034b45cb9cb7229b72706c6aca43c5", "score": "0.50085855", "text": "func SetWindowSizeLimits(minw, minh, maxw, maxh int) {\n\tui.Get().Window().SetSizeLimits(minw, minh, maxw, maxh)\n}", "title": "" }, { "docid": "99bf1af151c7d34850580ff9ddb3724f", "score": "0.50006247", "text": "func main() {\r\n\tr, err := rectangle.New(2, 34)\r\n\tc := cercle.Cercle{Rayon: 2.0}\r\n\r\n\tif err != nil {\r\n\t\tlog.Panicln(err)\r\n\t}\r\n\tfmt.Println(*r)\r\n\tvar new_value uint = 4\r\n\tr.Resize(&new_value, &new_value)\r\n\tfmt.Println(*r)\r\n\tr.Resize(nil, &new_value)\r\n\tfmt.Println(*r)\r\n\r\n\tPrintSurface(r)\r\n\tPrintSurface(c)\r\n}", "title": "" }, { "docid": "bed892361327567fcce26669c49d4630", "score": "0.49642873", "text": "func (s *shoe) SetSize(size int) {\n\ts.size = size\n}", "title": "" }, { "docid": "38a2cbf46d772bb3e4f0376fed40a113", "score": "0.49506813", "text": "func (surface *XlibSurface) SetSize(width, height int) {\n\tC.cairo_xlib_surface_set_size(surface.Ptr, C.int(width), C.int(height))\n\tif err := surface.status(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "44df58c92cdf8dcbf36ce6c8cc74c736", "score": "0.49424505", "text": "func (widget *Widget) SetSizeRequest(width, height int) {\r\n\twidget.Candy().Guify(\"gtk_widget_set_size_request\", widget, width, height)\r\n}", "title": "" }, { "docid": "35793a9c0ff8a9be38406246e971194b", "score": "0.49377978", "text": "func (r *Reactive) SetDim(w, h float64) {\n\tr.SetLogicDim(w, h)\n\tr.RSpace.SetDim(w, h)\n}", "title": "" }, { "docid": "39625ee554d5a8d0773a9296551834dc", "score": "0.49377832", "text": "func (renderer *Renderer) SetLogicalSize(w, h int32) error {\n\treturn errorFromInt(int(\n\t\tC.SDL_RenderSetLogicalSize(renderer.cptr(), C.int(w), C.int(h))))\n}", "title": "" }, { "docid": "01d0c10c1f353310a67b1409d5ee53e2", "score": "0.49340644", "text": "func SetWindowSize(width, height int) {\n\n\tif paunchWindow.glfwWindow == nil {\n\t\tpaunchWindow.width = width\n\t\tpaunchWindow.height = height\n\t\tif paunchWindow.nativeWidth == 0 && paunchWindow.nativeHeight == 0 {\n\t\t\tpaunchWindow.nativeWidth = width\n\t\t\tpaunchWindow.nativeHeight = height\n\t\t}\n\t} else {\n\t\tpaunchWindow.glfwWindow.SetSize(width, height)\n\t}\n}", "title": "" }, { "docid": "c885eb774523c37a0e498816698e2683", "score": "0.49193525", "text": "func GetScissor() (x, y, w, h int32) {\n\treturn states.back().scissorBox[0], states.back().scissorBox[1], states.back().scissorBox[2], states.back().scissorBox[3]\n}", "title": "" }, { "docid": "2670a6f8ec36134407f8892bcef094aa", "score": "0.4919054", "text": "func (t *wScreen) resize() {}", "title": "" }, { "docid": "9a370b008c61931027b959b16a95543d", "score": "0.49132788", "text": "func SetWindowSize(width int32, height int32) {\n\tcwidth, _ := (C.int)(width), cgoAllocsUnknown\n\tcheight, _ := (C.int)(height), cgoAllocsUnknown\n\tC.SetWindowSize(cwidth, cheight)\n}", "title": "" }, { "docid": "ad6c11ff1cd4e0c080883387931e65a8", "score": "0.4911102", "text": "func SetBounds(widget *gtk.Widget, x, y, width, height int) {\n\tp := unsafe.Pointer(widget.GObject)\n\tC.goey_set_bounds((*C.GtkWidget)(p), C.gint(x), C.gint(y), C.gint(width), C.gint(height))\n}", "title": "" }, { "docid": "1165a84f18ecc83fde6cfcac9b42740d", "score": "0.4910374", "text": "func (w *Window) SetBounds(x, y, width, height int) {\n\tif width < 0 {\n\t\twidth = 0\n\t}\n\tif height < 0 {\n\t\theight = 0\n\t}\n\tif w.handle != 0 {\n\t\t// The window will receive a WM_SIZE which will handle anchoring child\n\t\t// controls.\n\t\tw32.SetWindowPos(\n\t\t\tw.handle, 0,\n\t\t\tx, y, width, height,\n\t\t\tw32.SWP_NOOWNERZORDER|w32.SWP_NOZORDER,\n\t\t)\n\t} else {\n\t\tw.clientWidth, w.clientHeight = w.InnerSize()\n\t\tw.x = x\n\t\tw.y = y\n\t\tw.width = width\n\t\tw.height = height\n\t\tw.repositionChidrenByAnchors()\n\t}\n}", "title": "" }, { "docid": "1660014b6e0096c1600657ddb196192e", "score": "0.49080244", "text": "func (cv *Canvas) Size() (int, int) { return cv.w, cv.h }", "title": "" }, { "docid": "596d44ef0557b2629a68c2a56cc240fb", "score": "0.49060264", "text": "func (b *Image) SetRect(r image.Rectangle, c Bit) {\n\tr = r.Intersect(b.Rect)\n\tif !r.Empty() {\n\t\tfor y := r.Min.Y; y < r.Max.Y; y++ {\n\t\t\ti := b.PixOffset(r.Min.X, y)\n\t\t\tj := b.PixOffset(r.Max.X, y)\n\t\t\t// loop on all pixels (bytes) of this horizontal line\n\t\t\tfor x := i; x < j; x++ {\n\t\t\t\tb.Pix[x] = c.V\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8e8eb52b4f342e6a345f3a6d22b455b4", "score": "0.49004808", "text": "func (wb *WindowBase) SetSizePixels(size Size) error {\n\tbounds := wb.window.BoundsPixels()\n\n\treturn wb.SetBoundsPixels(bounds.SetSize(size))\n}", "title": "" }, { "docid": "8b16d01bb28ab60659a8089e8d17075d", "score": "0.48968345", "text": "func (page *Page) SetCropBox(upperLeftX, upperLeftY, lowerRightX, lowerRightY float32) {\n\tpage.cropBox = []float32{upperLeftX, upperLeftY, lowerRightX, lowerRightY}\n}", "title": "" }, { "docid": "a194d728c8e9fed4fdba75ffab9fb595", "score": "0.48861945", "text": "func (t *Tess) SetRectangle(left, top, width, height int) {\n\tC.TessBaseAPISetRectangle(t.tba, C.int(left), C.int(top), C.int(width), C.int(height))\n}", "title": "" }, { "docid": "8c76503cd8d80f83488948f292f27546", "score": "0.4871194", "text": "func (wb *WindowBase) SetSize(size Size) error {\n\treturn wb.SetSizePixels(wb.SizeFrom96DPI(size))\n}", "title": "" }, { "docid": "cdc281c1104a280304510add97d00cb8", "score": "0.48685682", "text": "func Scissor(x int32, y int32, width int32, height int32) {\n\tcx, _ := (C.GLint)(x), cgoAllocsUnknown\n\tcy, _ := (C.GLint)(y), cgoAllocsUnknown\n\tcwidth, _ := (C.GLsizei)(width), cgoAllocsUnknown\n\tcheight, _ := (C.GLsizei)(height), cgoAllocsUnknown\n\tC.glScissor(cx, cy, cwidth, cheight)\n}", "title": "" }, { "docid": "cdc281c1104a280304510add97d00cb8", "score": "0.48685682", "text": "func Scissor(x int32, y int32, width int32, height int32) {\n\tcx, _ := (C.GLint)(x), cgoAllocsUnknown\n\tcy, _ := (C.GLint)(y), cgoAllocsUnknown\n\tcwidth, _ := (C.GLsizei)(width), cgoAllocsUnknown\n\tcheight, _ := (C.GLsizei)(height), cgoAllocsUnknown\n\tC.glScissor(cx, cy, cwidth, cheight)\n}", "title": "" }, { "docid": "c24e79150e233b2c2c1911b3c25ebe9a", "score": "0.48599982", "text": "func (m *AzureManager) SetScaleSetSize(asConfig *ScaleSet, size int64) error {\n\top, err := m.scaleSetClient.Get(m.resourceGroupName, asConfig.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\top.Sku.Capacity = &size\n\top.VirtualMachineScaleSetProperties.ProvisioningState = nil\n\tcancel := make(chan struct{})\n\n\t_, errChan := m.scaleSetClient.CreateOrUpdate(m.resourceGroupName, asConfig.Name, op, cancel)\n\treturn <-errChan\n}", "title": "" }, { "docid": "6a3c04b48b8ee2c9b1546c4a936be843", "score": "0.48236617", "text": "func(preferences *Preferences) setWindowSize(size WindowSize) {\n\tpreferences.Size = size\n\n\tpreferences.Save()\n}", "title": "" }, { "docid": "16cc07270ef89e45d717f21f532b4974", "score": "0.4778465", "text": "func (gm *Geom2DInt) SizeRect() image.Rectangle {\n\treturn image.Rect(0, 0, gm.Size.X, gm.Size.Y)\n}", "title": "" }, { "docid": "58ef9ba7f66e4c4b34b68c2cf7ab3cda", "score": "0.47780842", "text": "func (i *ImageCapture) SetPixelSize(width int, height int) {\n\tcanvas := GetCanvas(i, i.canvasID())\n\tcanvas.SetAttribute(\"width\", width)\n\tcanvas.SetAttribute(\"height\", height)\n}", "title": "" }, { "docid": "7bca0d851e582eb96e720872aabf2042", "score": "0.47732386", "text": "func (r rect) scaleArea(s float64) float64 {\n\treturn r.w * r.h * s\n}", "title": "" }, { "docid": "30adb48c59fbc6b6195ad24c0676641a", "score": "0.4772252", "text": "func (d *DockerDialer) SetWindowSize(height, weight int) {\n\td.Height = height\n\td.Weight = weight\n}", "title": "" }, { "docid": "c53f948f6fc62f1a44b02d29b5cfb037", "score": "0.4766495", "text": "func (wb *WindowBase) SetBounds(bounds Rectangle) error {\n\treturn wb.SetBoundsPixels(wb.RectangleFrom96DPI(bounds))\n}", "title": "" }, { "docid": "7a7364ef2e9728902176f65bd77be4b0", "score": "0.47542915", "text": "func (wb *WindowBase) SetBoundsPixels(bounds Rectangle) error {\n\tif !win.MoveWindow(\n\t\twb.hWnd,\n\t\tint32(bounds.X),\n\t\tint32(bounds.Y),\n\t\tint32(bounds.Width),\n\t\tint32(bounds.Height),\n\t\ttrue) {\n\n\t\treturn lastError(\"MoveWindow\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "80a91799de18cd98686bfa0caedf679e", "score": "0.47315407", "text": "func (winpty *WinPTY) SetSize(ws_col, ws_row uint32) (err error) {\n\tvar errorPtr uintptr\n\tdefer winpty_error_free.Call(errorPtr)\n\n\tif ws_col == 0 || ws_row == 0 {\n\t\treturn\n\t}\n\n\tsizeSetRet, _, lastErr := winpty_set_size.Call(\n\t\twinpty.agent,\n\t\tuintptr(ws_col),\n\t\tuintptr(ws_row),\n\t\tuintptr(unsafe.Pointer(&errorPtr)))\n\tif sizeSetRet == uintptr(NIL_POINTER_VALUE) {\n\t\treturn winpty.getFormattedErrorMessage(\n\t\t\t\"Unable to set size.\",\n\t\t\tlastErr,\n\t\t\terrorPtr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "939b2773565f220b0b61de11b57b4580", "score": "0.47258395", "text": "func (s *Square) ScaleBy(sc int) {\n\ts.Length = s.Length * sc\n}", "title": "" }, { "docid": "54c2e37609574623d615a012a48bd1f7", "score": "0.4724436", "text": "func SetWindowSize(w, h int) {\n\tcw := (C.int)(w)\n\tch := (C.int)(h)\n\tC.SetWindowSize(cw, ch)\n}", "title": "" }, { "docid": "da75de4517fc2a24b50739ddb064a2d6", "score": "0.46946195", "text": "func (screen *Screen) Resize() *Screen {\n\tscreen.Width, screen.Height = termbox.Size()\n\treturn screen\n}", "title": "" }, { "docid": "88894c7adbc3de428e4689752d0d8ac9", "score": "0.46782792", "text": "func (b *Button) SetSize(width, height float32) {\n\tb.rect.SetSize(sf.Vector2f{width, height})\n\tb.rect.SetOrigin(sf.Vector2f{b.rect.GetSize().X / 2, b.rect.GetSize().Y / 2})\n\tb.alignTextCenter()\n}", "title": "" }, { "docid": "d953a591b7732dee906f3201438fac6a", "score": "0.46733445", "text": "func (mo *VirtualMachine) SetScreenResolution(\n\twidth int32, height int32,\n) error {\n\n\trequest := struct {\n\t\tXMLName xml.Name `xml:\"SetScreenResolution\"`\n\t\tThis *ManagedObjectReference `xml:\"_this,omitempty\"`\n\t\tWidth int32 `xml:\"width,omitempty\"`\n\t\tHeight int32 `xml:\"height,omitempty\"`\n\t}{\n\t\tThis: &ManagedObjectReference{Type: mo.ManagedObject.Type, Value: mo.ManagedObject.Value},\n\t\tWidth: width,\n\t\tHeight: height,\n\t}\n\n\tif session == nil {\n\t\tpanic(\"You need to create a vSphereSession first\")\n\t}\n\n\terr := session.invoke(request, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "d0759fa2bb9b9f6cfb9dcbe5586f8ac7", "score": "0.46479195", "text": "func (screen *Screen) Size() (int, int) {\n\treturn termbox.Size()\n}", "title": "" }, { "docid": "a0e682717d9d601de7e3722db9bba408", "score": "0.46236777", "text": "func (r Rect) Size() Vec {\n\treturn Vec{r.W, r.H}\n}", "title": "" }, { "docid": "88e4299ccec59fd8a69cd1f71393f233", "score": "0.46225762", "text": "func BeginScissorMode(x, y, width, height int32) {\n\tcx := (C.int)(x)\n\tcy := (C.int)(y)\n\tcwidth := (C.int)(width)\n\tcheight := (C.int)(height)\n\tC.BeginScissorMode(cx, cy, cwidth, cheight)\n}", "title": "" }, { "docid": "077d99f36c6e7216b5542773c49113be", "score": "0.46092096", "text": "func (db *MDBM) SetWindowSize(wsize uint) (int, error) {\n\terr := db.checkAvailable()\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tif wsize < db.minpagesize {\n\t\treturn -1, fmt.Errorf(\"wsize should be at least 2 pages, SC_PAGESIZE=%d, wsize=%d\", db.minpagesize, wsize)\n\t}\n\n\trv, _, err := db.cgoRun(func() (int, error) {\n\t\t_, err := C.mdbm_set_window_size(db.pmdbm, C.size_t(wsize))\n\t\treturn 0, err\n\t})\n\n\treturn rv, err\n}", "title": "" }, { "docid": "9bf9d42b8a918adc3566c3da624ba889", "score": "0.45944777", "text": "func Size() (cols, rows int) {\n\treturn termbox.Size()\n}", "title": "" }, { "docid": "879a20bcad539e2963caf31ed66cc4eb", "score": "0.4589314", "text": "func (l *Life) Resize(w, h int) {\n\tb := newBoard(w, h, l.board.maxHP)\n\tf := newBoard(w, h, l.board.maxHP)\n\n\tfor x := 0; x < l.w && x < w; x++ {\n\t\tfor y := 0; y < l.h && y < h; y++ {\n\t\t\tb.update(x, y, l.board.getHP(x, y))\n\t\t\tf.update(x, y, l.board.getHP(x, y))\n\t\t}\n\t}\n\n\tl.board = b\n\tl.buffer = f\n\tl.w = w\n\tl.h = h\n}", "title": "" }, { "docid": "0ddcb71feeb35fd77c7a89aeb70a70fa", "score": "0.4583329", "text": "func (c *Container) SetSize(width, height int) *Container {\n\tc.width = width\n\tc.height = height\n\treturn c\n}", "title": "" }, { "docid": "7da472ff4cac0ca52b66a866972a7a15", "score": "0.45785218", "text": "func (p *Primitive2D) SetSizeFromTexture() {\n\tif p.texture == nil {\n\t\treturn\n\t}\n\tp.SetSize(mgl32.Vec2{float32(p.texture.width), float32(p.texture.height)})\n}", "title": "" }, { "docid": "deea2ece805e323667cf40676c711ffb", "score": "0.4571573", "text": "func Size(columns int, rows int) GridOption {\n\treturn gridOptionFunc(\n\t\tfunc(grid *Grid) error {\n\t\t\tif columns < 0 || rows < 0 {\n\t\t\t\treturn errors.New(\"columns and height must both be >= 0, but got (\" + strconv.Itoa(columns) + \", \" + strconv.Itoa(rows) + \")\")\n\t\t\t}\n\t\t\tgrid.columns = columns\n\t\t\tgrid.rows = rows\n\t\t\treturn nil\n\t\t},\n\t)\n}", "title": "" }, { "docid": "265c52fc0c4fa6e1b9247e1e0fac3190", "score": "0.45707306", "text": "func (o *_RadioButtonO) Size(s win.SIZE) *_RadioButtonO { _OwSz(&o.size, s); return o }", "title": "" }, { "docid": "da6cabe018c0796900f99d259e871a36", "score": "0.45669013", "text": "func (w *Window) SetSize(s Size) {\n\tif w.parent != nil {\n\t\tw.setSize(s)\n\t}\n}", "title": "" }, { "docid": "1b9e87426a38c6924071d2704ce3c96d", "score": "0.455877", "text": "func (self *COverlayControllerT) SetSize(\n\tsize *CSizeT,\n) {\n\n\tC.cefingo_overlay_controller_set_size((*C.cef_overlay_controller_t)(self.pc_overlay_controller), (*C.cef_size_t)(size))\n\n}", "title": "" }, { "docid": "76889cd9d35abfdc81d8a054af491905", "score": "0.45583457", "text": "func (w *Window) SetResizable(res Resizable) {\n\n\tw.resizable = res\n}", "title": "" }, { "docid": "dc52042bd57abc86d2bd4ddd98e61ed5", "score": "0.4557773", "text": "func WindowSetSize(ctx context.Context, width int, height int) {\n\tappFrontend := getFrontend(ctx)\n\tappFrontend.WindowSetSize(width, height)\n}", "title": "" }, { "docid": "22ca9d25d1e41ef7550843f048ca1205", "score": "0.45497668", "text": "func (pc *TwoD) SetRange(min, max, sigma float32) {\n\tpc.Min.Set(min, min)\n\tpc.Max.Set(max, max)\n\tpc.Sigma.Set(sigma, sigma)\n}", "title": "" }, { "docid": "16e3c0f8edefa8d059f72cbf7d5596a7", "score": "0.454509", "text": "func (wb *WindowBase) SetWidthPixels(value int) error {\n\tbounds := wb.window.BoundsPixels()\n\tbounds.Width = value\n\n\treturn wb.SetBoundsPixels(bounds)\n}", "title": "" }, { "docid": "4f434116a8f01f03e0ce28dced2f9828", "score": "0.45309412", "text": "func (c *Cube) ScaleBy(sc int) {\n\tc.Length = c.Length * sc\n}", "title": "" }, { "docid": "ee54654cda7ed479f33ecaf0ea85d108", "score": "0.4522433", "text": "func (self *WebGLRenderer) Resize(width int, height int) {\n self.Object.Call(\"resize\", width, height)\n}", "title": "" }, { "docid": "65100abcc4575e6a34b3a119deeda423", "score": "0.45212528", "text": "func (pt *pttag) resize(ww, wh int) {\n\tpt.cam2.SetOrthographic(0, float64(ww), 0, float64(wh), 0, 50)\n}", "title": "" }, { "docid": "05257a0aefe4ad40b128141070dcdf17", "score": "0.45178515", "text": "func (w *Window) Size() Size { return w.size }", "title": "" }, { "docid": "5ca14b51b3690d90ff4739dbc4fffe29", "score": "0.45139772", "text": "func Resize(x, y, width, height int) {\n\tprogbar.Resize(x, y, width, height)\n}", "title": "" }, { "docid": "d86c47969c02eeeb2534375919895fa6", "score": "0.44901907", "text": "func BeginScissorMode(x int32, y int32, width int32, height int32) {\n\tcx, _ := (C.int)(x), cgoAllocsUnknown\n\tcy, _ := (C.int)(y), cgoAllocsUnknown\n\tcwidth, _ := (C.int)(width), cgoAllocsUnknown\n\tcheight, _ := (C.int)(height), cgoAllocsUnknown\n\tC.BeginScissorMode(cx, cy, cwidth, cheight)\n}", "title": "" }, { "docid": "2ad022716f84cbd09bc11e8c15472df4", "score": "0.4478074", "text": "func (r Rect) Resized(size Vec) Rect {\n\treturn Rect{\n\t\tX: r.X,\n\t\tY: r.Y,\n\t\tW: size.X,\n\t\tH: size.Y,\n\t}\n}", "title": "" }, { "docid": "2ef9b3b884c23e1296e8b9dae0d3923f", "score": "0.44711715", "text": "func (c *Client) SetWindowRect(rect WindowRect) error {\n\t_, err := c.transport.Send(\"WebDriver:SetWindowRect\", map[string]interface{}{\"x\": rect.X, \"y\": rect.Y, \"width\": math.Floor(rect.Width), \"height\": math.Floor(rect.Height)})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60e0884dbc49f4778067f63dc097c967", "score": "0.44641218", "text": "func (c *Context) Scissor(x, y, width, height int) gfx.ContextStateValue {\n\treturn s.CSV{\n\t\tValue: [4]int32{int32(x), int32(y), int32(width), int32(height)},\n\t\tDefaultValue: [4]int32{0, 0, 0, 0}, // TODO(slimsag): track real default scissor values\n\t\tKey: csScissor,\n\t\tGLCall: glScissor,\n\t}\n}", "title": "" }, { "docid": "204a652fc577a697026c80b0be67e49f", "score": "0.44599658", "text": "func (obj *Toplevel) SetMaxSize(width int32, height int32) {\n\tobj.Conn().SendRequest(obj, 7, width, height)\n}", "title": "" }, { "docid": "427ab28aa9912cfe586015c344d1f792", "score": "0.44501707", "text": "func (c *controller) resize() {\n\tw, h := ui.TerminalDimensions()\n\tc.Grid.SetRect(0, 0, w, h)\n}", "title": "" }, { "docid": "78221d03f0ce8962ff714134c799d0c1", "score": "0.4446508", "text": "func (self *TraitScreen) SetResolution(dpi float64) {\n\tC.gdk_screen_set_resolution(self.CPointer, C.gdouble(dpi))\n\treturn\n}", "title": "" }, { "docid": "94116a58b318a51f447780d30298cebe", "score": "0.4443662", "text": "func (pc *Paint) Scale(x, y float32) {\n\tpc.XForm = pc.XForm.Scale(x, y)\n}", "title": "" }, { "docid": "ef1add2c2a8222d8188373fe61344628", "score": "0.44364825", "text": "func (obj *Toplevel) Resize(seat *wayland.Seat, serial uint32, edges ToplevelResizeEdge) {\n\tobj.Conn().SendRequest(obj, 6, seat, serial, edges)\n}", "title": "" }, { "docid": "81c30a15e007b9049661034b2729abb6", "score": "0.44311458", "text": "func SetViewport(x, y, w, h int32) {\n\tscreenWidth = w\n\tscreenHeight = h\n\t// Set the viewport to top-left corner.\n\tgl.Viewport(int(y), int(x), int(screenWidth), int(screenHeight))\n\tglState.viewport = []int32{y, x, screenWidth, screenHeight}\n\tglState.projectionStack.Load(mgl32.Ortho(float32(x), float32(screenWidth), float32(screenHeight), float32(y), -1, 1))\n\tSetScissor(states.back().scissorBox[0], states.back().scissorBox[1], states.back().scissorBox[2], states.back().scissorBox[3])\n}", "title": "" }, { "docid": "e78e0e1c1b41108f1d424e007c7e1150", "score": "0.44183135", "text": "func WithBoardSize(size int) GameOption {\n\treturn func(g *Game) {\n\t\tg.dimension = Dimension{X: size, Y: size}\n\t}\n}", "title": "" }, { "docid": "9c1bb1aa4effe02cd77accd7f6840354", "score": "0.4416832", "text": "func (w *Window) SetClientSize(s Size) { w.onSetClientSize.Handle(w, &w.clientArea.Size, s) }", "title": "" }, { "docid": "d6d3b9bf155614522c5810c542dc7c3f", "score": "0.441435", "text": "func (wb *WindowBase) SetWidth(value int) error {\n\treturn wb.SetWidthPixels(wb.IntFrom96DPI(value))\n}", "title": "" }, { "docid": "158097ab05c607ec6c71732d0e29bbc4", "score": "0.4406798", "text": "func (g *OWImg) setRes() *OWImg {\n if !g.gotimg {\n return g\n }\n if g.width==3840 && g.height==2160 {\n g.res=SIZE_4K\n } else if g.width==1920 && g.height==1080 {\n g.res=SIZE_1080\n } else if g.width==2560 && g.height==1440 {\n g.res=SIZE_WQHD\n } else {\n if config.dbg_screen {\n fmt.Println(\"WARNING: Unknown screen size \",g.width,\" x\",g.height)\n }\n }\n return g\n}", "title": "" }, { "docid": "e6ecb733df8c6c742c1d380f6b2b007f", "score": "0.44021487", "text": "func (self *COverlayControllerT) SetBounds(\n\tbounds *CRectT,\n) {\n\n\tC.cefingo_overlay_controller_set_bounds((*C.cef_overlay_controller_t)(self.pc_overlay_controller), (*C.cef_rect_t)(bounds))\n\n}", "title": "" } ]
1dab691f1311c4e656e1ecbf69c84ed8
String returns the string representation
[ { "docid": "9132adc080fb36af8ac809f001e30add", "score": "0.0", "text": "func (s DescribeFleetsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "da4d8b897637d127f500cb4192484dc7", "score": "0.7215058", "text": "func (s CreateAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "da4d8b897637d127f500cb4192484dc7", "score": "0.7215058", "text": "func (s CreateAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cdd3975194547c61a108d58ed15e80f9", "score": "0.72000957", "text": "func (s CreateCanaryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34c567f8898a96587259623a960aed10", "score": "0.7199919", "text": "func (s Library) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ID: \" + reform.Inspect(s.ID, true)\n\tres[1] = \"UserID: \" + reform.Inspect(s.UserID, true)\n\tres[2] = \"VolumeID: \" + reform.Inspect(s.VolumeID, true)\n\tres[3] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[4] = \"UpdatedAt: \" + reform.Inspect(s.UpdatedAt, true)\n\treturn strings.Join(res, \", \")\n}", "title": "" }, { "docid": "02433023548636b43fdb9c5c7daa3d24", "score": "0.7177383", "text": "func (r Info) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "title": "" }, { "docid": "1e43f6c070cc544374daaa292daafb52", "score": "0.7166947", "text": "func (s ReEncryptOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8e4fe833d77ab2b8fff952da4633082f", "score": "0.7118059", "text": "func (s CreateFHIRDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a714f2369d7589a06e3a30e45c8d3af7", "score": "0.7087492", "text": "func String() string {\n\toutput := output{\n\t\tRerun: Rerun,\n\t\tVariables: Variables,\n\t\tItems: Items,\n\t}\n\tvar err error\n\tvar b []byte\n\tif Indent == \"\" {\n\t\tb, err = json.Marshal(output)\n\t} else {\n\t\tb, err = json.MarshalIndent(output, \"\", Indent)\n\t}\n\tif err != nil {\n\t\tmessageErr := Errorf(\"Error in parser. Please report this output to https://github.com/drgrib/alfred/issues: %v\", err)\n\t\tpanic(messageErr)\n\t}\n\ts := string(b)\n\treturn s\n}", "title": "" }, { "docid": "5f852464f63d5c224a8563b127c35be7", "score": "0.70870787", "text": "func (s CreateQuickConnectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4a813dc767189960ad1be527c1b4af20", "score": "0.7079275", "text": "func (r *Registry) String() string {\n\tout := make([]string, 0, len(r.nameToObject))\n\tfor name, object := range r.nameToObject {\n\t\tout = append(out, fmt.Sprintf(\"* %s:\\n%s\", name, object.serialization))\n\t}\n\treturn strings.Join(out, \"\\n\\n\")\n}", "title": "" }, { "docid": "2cae19dd5a22d12e749547a3710fa88a", "score": "0.70782894", "text": "func (s CreateSceneOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "99fc90bb98c4a4fdb840ef2fa5146b35", "score": "0.7067719", "text": "func (s CreateSafetyRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0946ec6681f4fb3be65751cddcf9e86b", "score": "0.7031721", "text": "func (s CreateLanguageModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "523b728cec548f4c061afc537c6c3f1f", "score": "0.70269966", "text": "func (o QtreeCreateResponse) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "ca6cfce600a50661e012269aab671386", "score": "0.7026298", "text": "func (r SendAll) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "title": "" }, { "docid": "c85f0d2dd851bda5393a40d806147cae", "score": "0.70251423", "text": "func (r ReceiveAll) String() string {\n\tJSON, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\treturn string(JSON)\n}", "title": "" }, { "docid": "41b3a66cdf57e42f7584a5e34d50ce7c", "score": "0.7021565", "text": "func (enc *simpleEncoding) String() string {\n\treturn \"simpleEncoding(\" + enc.baseName + \")\"\n}", "title": "" }, { "docid": "f40788c2f368832d94044c0f54581f5d", "score": "0.70164025", "text": "func (s CreateDatabaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e202a9e69747517773cd593b63f9a324", "score": "0.701059", "text": "func (z Zamowienium) String() string {\n\tjz, _ := json.Marshal(z)\n\treturn string(jz)\n}", "title": "" }, { "docid": "37b155138c139822d50b994c5a3331e5", "score": "0.7010184", "text": "func (s CreateHITTypeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a90b1cd453fed3b87c28a6fe629cb853", "score": "0.70022964", "text": "func (s CreateProgramOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "422c43efcbb59d20e0b383fdc8e563e4", "score": "0.6997043", "text": "func (s CreateEntityOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37ae39d3ccfcc677077bc3f72107897b", "score": "0.6996532", "text": "func (s CreateProjectVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11bd81a70e0089315b6c9455e3f5df2e", "score": "0.6992619", "text": "func (o *Addshifttraderequest) String() string {\n \n \n \n \n o.AcceptableIntervals = []string{\"\"} \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": "16575f85eb478fd3f57fe7f5bda8e048", "score": "0.69909185", "text": "func (s CreateUseCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ed0d7c77f85e5e068da5f098ebc34e5d", "score": "0.69900763", "text": "func (r Rooms) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "title": "" }, { "docid": "a980ea84e6b5527c94c8b0c65a993d75", "score": "0.69862556", "text": "func (i Info) String() string {\n\ts, _ := i.toJSON()\n\treturn s\n}", "title": "" }, { "docid": "131cba7eca5d1d29c90d261a95d68de0", "score": "0.6985364", "text": "func (o *Botversionsummary) 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": "bbf938d517185ce9c70234343a635b24", "score": "0.6975378", "text": "func (e ExternalCfps) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "784ee9f257530849e4ad1ca3dea002bf", "score": "0.69738907", "text": "func (s CreateTrustStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a24befa7ad8ebac4cc208a6e3052136e", "score": "0.69624275", "text": "func String() string {\n\treturn fmt.Sprintf(\n\t\t\"AppVersion = %s\\n\"+\n\t\t\t\"VCSRef = %s\\n\"+\n\t\t\t\"BuildVersion = %s\\n\"+\n\t\t\t\"BuildDate = %s\",\n\t\tAppVersion, VCSRef, BuildVersion, Date,\n\t)\n}", "title": "" }, { "docid": "7575b0442f2a0b85621e7da4d309d8c9", "score": "0.6961772", "text": "func (s CreateDataLakeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "edea32e6794e33a9ff01a58b4f666123", "score": "0.69603413", "text": "func (s CreateSolutionVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4a45f69b5f063f1a344c09f6eefc1967", "score": "0.69507927", "text": "func (s GetSceneOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b26bd8a52e185b7a026d2748338b009f", "score": "0.6946753", "text": "func (i NotMachine) String() string { return toString(i) }", "title": "" }, { "docid": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fc6e98c6d9fd9eb8170d77d6bee5a75a", "score": "0.6944943", "text": "func (s StartPipelineReprocessingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5fc9138f7da9056810c7b0f71ac73226", "score": "0.694029", "text": "func (s CreateDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b443cde18f05bf5d53e718863ebd2f2e", "score": "0.69369334", "text": "func (s CreateSequenceStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1bacf45015eda4e5ae5fe493a6ab38bc", "score": "0.69332623", "text": "func (o *Adjustablelivespeakerdetection) String() string {\n \n \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": "42012657dfcf41498b818ec3722ef7b7", "score": "0.69287163", "text": "func (s CreateRateBasedRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3129b5c1ba47b102390adc5a08588787", "score": "0.692656", "text": "func (r Resiliency) String() string {\n\tb, _ := json.Marshal(r)\n\treturn string(b)\n}", "title": "" }, { "docid": "a16096d57c892e61588546ecc8a603c5", "score": "0.6924643", "text": "func (s RestoreFromRecoveryPointOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "319427ee487bbab329bf5062e9823839", "score": "0.69216746", "text": "func (s CreateWaveOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fab33327052f4fca0264595fb5271250", "score": "0.69213074", "text": "func (o QtreeCreateResponseResult) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4289cc8455f8f6094a3a56497d8bc17e", "score": "0.69181406", "text": "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "aebdcb877925fbdd5aacec2bdf68ce44", "score": "0.6917802", "text": "func (s CreateBotLocaleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ee1c82439f428593804e7d41e67a88bb", "score": "0.6911058", "text": "func (s DeleteAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5e7e7302372ed8f20eca668f9d524a94", "score": "0.69104654", "text": "func (z Zamowienia) String() string {\n\tjz, _ := json.Marshal(z)\n\treturn string(jz)\n}", "title": "" }, { "docid": "ad47f192d74a333770b858cab44b6f33", "score": "0.6909528", "text": "func (i *Info) String() string {\n\tb, _ := json.Marshal(i)\n\treturn string(b)\n}", "title": "" }, { "docid": "3b1b3eb588e7c29fe4534253b6f2b0d8", "score": "0.690845", "text": "func (s ProcessingFeatureStoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34c1651468512254fa45a030cf56bc0e", "score": "0.690454", "text": "func (s ExportProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "aa6338bd20e7dcdbfa2632e520a0d88b", "score": "0.6899065", "text": "func (r RoomOccupancies) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "title": "" }, { "docid": "96ef342fe8cf5557a84d9167044e4cf6", "score": "0.6896141", "text": "func (r *InterRecord) String() string {\n\tbuf := r.Bytes()\n\tdefer ffjson.Pool(buf)\n\n\treturn string(buf)\n}", "title": "" }, { "docid": "c1e61dcc3f2c005835b59fad0a71e8da", "score": "0.6894107", "text": "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c1e61dcc3f2c005835b59fad0a71e8da", "score": "0.6894107", "text": "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c1e61dcc3f2c005835b59fad0a71e8da", "score": "0.6894107", "text": "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a5e6bd3d299bc70ea9f627f3bf8ee552", "score": "0.68921995", "text": "func (o *Coretype) String() string {\n \n \n \n \n \n o.ValidationFields = []string{\"\"} \n \n o.ItemValidationFields = []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": "f57cce8a80729632f7fc697c6b968a9f", "score": "0.68920684", "text": "func (s CreateLayerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "40b8edf6d967383e8106938ccad88ad2", "score": "0.689124", "text": "func (s CreateModelCardOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "feda623e451bcb7803b9e13ba396c477", "score": "0.68893504", "text": "func (o *Limitchangerequestdetails) String() string {\n \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": "03a4267d679e666456e77c59c2ee2e95", "score": "0.688871", "text": "func (s NetworkPathComponentDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9f6067a06b13eac4bd62229ac3260acd", "score": "0.6884391", "text": "func (t Terms) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "9fa00867abcf6d8ab9fed0e75a9a9754", "score": "0.6882336", "text": "func (g GetObjectOutput) String() string {\n\treturn helper.Prettify(g)\n}", "title": "" }, { "docid": "955c1eeabb701ac1156330b80125358e", "score": "0.6880731", "text": "func (s StartContactEvaluationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7f200868f4a23c32d394037d6a5707e6", "score": "0.68767136", "text": "func (o *Interactionstatsalert) String() string {\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": "328d864c8b9c74ecafe47e27d4ad016f", "score": "0.68766147", "text": "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "328d864c8b9c74ecafe47e27d4ad016f", "score": "0.68766147", "text": "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b44362490bf5430c61f0481e22490ff9", "score": "0.68751997", "text": "func (o *Digitalcondition) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "17bac114831881c3c952d45921839f81", "score": "0.68735147", "text": "func (r RoomOccupancy) String() string {\n\tjr, _ := json.Marshal(r)\n\treturn string(jr)\n}", "title": "" }, { "docid": "1c803a05279aba9fa4dfce16573abbad", "score": "0.68734384", "text": "func (d *Diagram) String() string { return toString(d) }", "title": "" }, { "docid": "f0c2503c23369768adee5f8226ac9e9b", "score": "0.68731403", "text": "func (o *Outboundroute) String() string {\n \n \n \n \n o.ClassificationTypes = []string{\"\"} \n \n \n o.ExternalTrunkBases = []Domainentityref{{}} \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": "38167540dad3daaaa2851aa7c2116d55", "score": "0.6871602", "text": "func (s CreateCodeRepositoryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7629ffc579da02c648cad037e83e4d0", "score": "0.6869421", "text": "func (s CreateActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3035d06dfe8d01239abdaa36bc88b188", "score": "0.68684965", "text": "func (s CreateBotOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eabc99ae3484254931e3a33f1f575bdc", "score": "0.68673396", "text": "func (s ResolutionTechniques) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7b96d0f3a17dc72eb3ecd41a7cc8b7d", "score": "0.68622416", "text": "func (s CreateTrialComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "23e46064e1f02b9e7be58282680576de", "score": "0.6862084", "text": "func (c CourseCode) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "1cdad9caaf72275da4ef3e46c448a1a3", "score": "0.6859391", "text": "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "title": "" }, { "docid": "1707cd60a09d81d11db2741a5b07f69f", "score": "0.6857645", "text": "func (p polynomial) String() (str string) {\n\tfor _, m := range p.monomials {\n\t\tstr = str + \" \" + m.String() + \" +\"\n\t}\n\tstr = strings.TrimRight(str, \"+\")\n\treturn \"f(x) = \" + strings.TrimSpace(str)\n}", "title": "" }, { "docid": "3ab6d8e4ffa02c276637e4fbda71e824", "score": "0.6853781", "text": "func (s CreateThingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "31c3b5fb99fb89dbc34c98dababcb023", "score": "0.68523467", "text": "func (r *RUT) String() string {\n\treturn r.Format(DefaultFormatter)\n}", "title": "" }, { "docid": "3f1a632e93310c4f56222960d6eedb1c", "score": "0.6851581", "text": "func (s CreatePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e720d0998dee8ef341d5721e69c93664", "score": "0.6846037", "text": "func (o *Crossplatformpolicycreate) String() string {\n \n \n \n \n \n \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": "fab03f3de5dfc681fcdfd75047ac20c0", "score": "0.6844023", "text": "func (s BotVersionLocaleDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2dce016c3492718d27fc3f5767f356a0", "score": "0.6843859", "text": "func (s LifeCycleLastTestInitiated) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9ed06659a80fd638d530acbb8578da77", "score": "0.68434954", "text": "func (s DeleteMultiplexProgramOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5279750ae5344e06aacacad3d45f5087", "score": "0.68419206", "text": "func (s GetObjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37cf0f1f58fcd6e8d2c60985d6599a77", "score": "0.68416274", "text": "func (s LifeCycleLastTestReverted) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "af7e83b226664a10979cb02f117182c4", "score": "0.684033", "text": "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3bbb441c948dd64b26a37963d561e98f", "score": "0.6839815", "text": "func (s CreateComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9e02b410726e603391050dc45b25c1be", "score": "0.68363225", "text": "func (s CreateIntegrationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b24ccb404b432321c466ee6016239108", "score": "0.6835165", "text": "func (o *Commonruleconditions) String() string {\n o.Clauses = []Commonruleconditions{{}} \n o.Predicates = []Commonrulepredicate{{}} \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": "7ec7db57eeffaa74e9e813a38e0303e1", "score": "0.68334675", "text": "func (t Test1s) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "a8a47d4a09785fd90d7fd6e55979d71e", "score": "0.68327725", "text": "func (o *Directrouting) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "7f4a1cc6dc8657ca823e506e250aecf0", "score": "0.6832733", "text": "func (s CreateContactFlowOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
0ffa837f8cd84176fe56b11c0af33a7c
NewSandboxClient takes an APIKey and returns a sandbox API Client
[ { "docid": "5990c3f1722a272aeaeee95d0067cbda", "score": "0.83752143", "text": "func NewSandboxClient(key string) *Client {\n\treturn &Client{\n\t\tAPIKey: key,\n\t\tapiURL: APIEndpoint(true),\n\t}\n}", "title": "" } ]
[ { "docid": "1407e68fac0d91f3b9426c7b8c7783f3", "score": "0.72963303", "text": "func NewSandboxClient(token Token, httpClient *http.Client) *Client {\n\treturn newClient(defaultBaseURL, sandboxDomain, token, httpClient)\n}", "title": "" }, { "docid": "cbc1c46e5de895889531b1ffef8581f4", "score": "0.7043901", "text": "func (l *Client) NewSandbox() *Sandbox {\n\ts := &Sandbox{}\n\ts.client = l\n\treturn s\n}", "title": "" }, { "docid": "29adceca4810e367cf466ac72fe5ccfd", "score": "0.6447652", "text": "func (l *client) NewSandbox() *Sandbox {\n\ts := &Sandbox{}\n\ts.client = l\n\ts.Config = make(map[string]string)\n\ts.NetworkConfig.Mode = NetworkNone\n\ts.NetworkConfig.ModeData = make(map[string]string)\n\n\treturn s\n}", "title": "" }, { "docid": "082cc9d10c0053caaca25049dd021c90", "score": "0.6138178", "text": "func NewClient(httpClient *http.Client, apikey string) *Service {\n\treturn &Service{\n\t\tsling: sling.New().Client(httpClient).Base(baseURL).Set(\"Authorization\", apikey),\n\t}\n}", "title": "" }, { "docid": "15c4499059b5623bb932177a7e372d0d", "score": "0.61376214", "text": "func NewClient(apiKey string) (*Client, error) {\n\n\tif len(apiKey) == 0 {\n\t\treturn nil, fmt.Errorf(\"API key required\")\n\t}\n\tiptrace := Client{APIKey: apiKey, BaseURI: defaultBaseURI}\n\tiptrace.HTTPClient = NewHTTPClient(iptrace.APIKey, iptrace.BaseURI)\n\tiptrace.setup()\n\treturn &iptrace, nil\n}", "title": "" }, { "docid": "1a8fa5558f365b08fc7b3e84e2a2d15d", "score": "0.61374426", "text": "func NewClient(apiKey string) *Client {\n\tclient := &Client{APIBase: \"https://api.wit.ai\"}\n\tAPIKey = apiKey\n\treturn client\n}", "title": "" }, { "docid": "a8329c3d2bbb8d8cfc150e9fd98a16e7", "score": "0.60839146", "text": "func NewClient(apikey string) (*Client, error) {\n\tconfig := &Config{\n\t\tAddress: endpoint,\n\t\tHTTPClient: http.DefaultClient,\n\t\tAPIKey: apikey,\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "6ab3383c8eec36585a6811d40c537d10", "score": "0.60661113", "text": "func NewClient(baseURL string, apiKey string) Client {\n\tservice := &client{\n\t\thttpClient: &http.Client{Timeout: 10 * time.Second},\n\t\tbaseURL: baseURL,\n\t\tapiKey: apiKey,\n\t}\n\tservice.startRateLimiter()\n\treturn service\n}", "title": "" }, { "docid": "c070cde71d542092ca3a355e17faa792", "score": "0.6039846", "text": "func NewClient(key string, options ...clientOption) (*client, error) {\n\tvar url string\n\tif url = os.Getenv(\"TAPPAY_SERVER\"); url == \"\" {\n\t\turl = APIURL\n\t}\n\n\t// defaultTimeout is the default timeout on the http.Client used the by the library\n\t// This is chosen according to the document\n\t// https://docs.tappaysdk.com/tutorial/zh/back.html\n\tconst defaultTimeout = 30 * time.Second\n\thttpClient := &http.Client{\n\t\tTimeout: defaultTimeout,\n\t}\n\n\tcli := &client{\n\t\tpartnerKey: key,\n\t\thttpClient: httpClient,\n\t\turl: url,\n\t}\n\n\tfor _, option := range options {\n\t\toption(cli)\n\t}\n\tu, err := sanitizeURL(cli.url)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"supplied server %q is not valid: %v\", cli.url, err)\n\t}\n\tcli.url = u.String()\n\treturn cli, nil\n}", "title": "" }, { "docid": "f69054ba42e31076e3f9c38dc330bf96", "score": "0.6003571", "text": "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\thttp: &http.Client{\n\t\t\tTimeout: 30 * time.Second,\n\t\t},\n\t\tAPIKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "e225de5416728846a6181ae747608dc6", "score": "0.59938943", "text": "func NewClient(apiKey string) (*Client, error) {\n\tif len(apiKey) == 0 {\n\t\treturn nil, stackedErrors.WithStack(ErrorMissingAPIKey)\n\t}\n\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn nil, stackedErrors.WithStack(err)\n\t}\n\n\tc := &Client{\n\t\tbaseURL: u,\n\t\tClient: http.Client{\n\t\t\tTransport: transport{\n\t\t\t\tapiKey: apiKey,\n\t\t\t\tnext: http.DefaultTransport,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "23acf2ca54800f18708648e16da50201", "score": "0.5975796", "text": "func NewClient(baseURL, apiKey string) *Client {\n\treturn &Client{baseURL: baseURL, apiKey: apiKey, httpClient: http.Client{}}\n}", "title": "" }, { "docid": "3c0865cd955414ee89bd26dd4a6a22d7", "score": "0.5974988", "text": "func NewClient() (*Client, error) {\n\tssn, err := GetSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tAPIKey: ssn.APIKey,\n\t}\n\n\tif err := client.loadSDKServices(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to load IBM SDK services\")\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "0a9525fb8f6804d95c27791b18a68cfa", "score": "0.5952798", "text": "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\tclient: &http.Client{Transport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\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\tDualStack: true,\n\t\t\t}).DialContext,\n\t\t\tDisableKeepAlives: true,\n\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t}},\n\t\tapiKey: apiKey,\n\t\tURL: DefaultURL,\n\t}\n}", "title": "" }, { "docid": "282851c8a13589c9de63f9bdf978f0bf", "score": "0.5933486", "text": "func GetClient(apiKey string) *Client {\n\t//default to prod API\n\tapi := &Client{url: \"https://api.smartsheet.com/2.0\", apiKey: apiKey}\n\tapi.client = &http.Client{} //per docs clients should be made once, https://golang.org/pkg/net/http/\n\n\treturn api\n}", "title": "" }, { "docid": "e21fe402996557554e4f91c840707a1b", "score": "0.5928684", "text": "func NewClient(apiKey string, apiSecret string, apiBackend razorpay.Backend) *Client {\n\treturn &Client{razorpay.NewClient(apiKey, apiSecret, apiBackend)}\n}", "title": "" }, { "docid": "e21fe402996557554e4f91c840707a1b", "score": "0.5928684", "text": "func NewClient(apiKey string, apiSecret string, apiBackend razorpay.Backend) *Client {\n\treturn &Client{razorpay.NewClient(apiKey, apiSecret, apiBackend)}\n}", "title": "" }, { "docid": "e21fe402996557554e4f91c840707a1b", "score": "0.5928684", "text": "func NewClient(apiKey string, apiSecret string, apiBackend razorpay.Backend) *Client {\n\treturn &Client{razorpay.NewClient(apiKey, apiSecret, apiBackend)}\n}", "title": "" }, { "docid": "26ad2c5e32584bf8e9bcebc6591ea1d1", "score": "0.592156", "text": "func NewClient(apiUserID, apiUserKey string) *Client {\n\tbaseURL, _ := url.Parse(defaultAPIURL)\n\n\tc := &Client{\n\t\tclient: http.DefaultClient,\n\t\tUserAgent: userAgent,\n\t\tAPIUserID: apiUserID,\n\t\tAPIUserKey: apiUserKey,\n\t\tBaseURL: baseURL,\n\t}\n\n\t// Endpoint communications\n\tc.Objects = &ObjectsCli{c}\n\tc.Temp = &TempCli{c}\n\tc.Streams = &StreamsCli{c}\n\tc.Players = &PlayersCli{c}\n\tc.Download = &DownloadCli{c}\n\tc.DownloadTasks = &DownloadTasksCli{c}\n\tc.Transcoder = &TranscoderCli{c}\n\tc.TranscoderTasks = &TranscoderTasksCli{c}\n\tc.Storage = &StorageCli{c}\n\n\treturn c\n}", "title": "" }, { "docid": "822cb8383ac0846d0fefa9ef7bed1a90", "score": "0.58846974", "text": "func NewClient(consumerKey, consumerSecret, oauthToken, oauthSecret, realmID string, isSandbox bool) *quickbooks {\n\tq := &quickbooks{}\n\tq.oauthClient = oauth.NewConsumer(\n\t\tconsumerKey,\n\t\tconsumerSecret,\n\t\toauth.ServiceProvider{\n\t\t\tAuthorizeTokenUrl: sdk.AuthorizeURL,\n\t\t\tRequestTokenUrl: sdk.RequestTokenURL,\n\t\t\tAccessTokenUrl: sdk.AccessTokenURL,\n\t\t},\n\t)\n\n\tq.accessToken = &oauth.AccessToken{\n\t\tToken: oauthToken,\n\t\tSecret: oauthSecret,\n\t}\n\n\tq.realmID = realmID\n\n\tif isSandbox {\n\t\tq.baseURL = sdk.SandboxURL\n\t} else {\n\t\tq.baseURL = sdk.ProductionURL\n\t}\n\n\treturn q\n}", "title": "" }, { "docid": "d143a68778a22d791c6f42a5c9b78467", "score": "0.58829355", "text": "func NewClient(apiKey string) Client {\n\treturn &defaultClient{\n\t\tapiKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "e6cfed3f14c066b18cd4ad2c1e41935e", "score": "0.58817434", "text": "func NewClient(baseURL string, apiKey string) Client {\n\treturn &httpClient{\n\t\tapiKey: apiKey,\n\t\tbaseURL: baseURL,\n\t\tinst: &http.Client{},\n\t}\n}", "title": "" }, { "docid": "54e865b6c838312be64f8d64b536987c", "score": "0.5861729", "text": "func NewClient(apiKey string) (client *TestClient) {\n\treturn &TestClient{\n\t\tOK: true,\n\t\tAPIKey: apiKey,\n\t\tTemplates: make(map[string]*mandrill.Template, 0),\n\t\tSubaccounts: make(map[string]*mandrill.Subaccount, 0),\n\t}\n}", "title": "" }, { "docid": "dab04d2e50f68515c0ea2c6f7105216a", "score": "0.585264", "text": "func NewClient(shopwareAPIBaseURL string, privateToken string) *Client {\n\n\tc := &Client{\n\t\tshopwareAPIBaseURL: shopwareAPIBaseURL,\n\t\tprivateToken: privateToken,\n\t}\n\tfuture := &models.Context{}\n\tc.do(\"GET\", \"/store-api/v3/context\", nil, future)\n\tc.contextToken = future.Token\n\tc.Context = *future\n\n\treturn c\n\n}", "title": "" }, { "docid": "1be8703d73d8986cf96dffca8f1d1dbc", "score": "0.58522207", "text": "func NewClient(api string, baseURI string, org string) *Client {\n\n\tif !strings.HasSuffix(baseURI, \"/\") {\n\t\tbaseURI += \"/\"\n\t}\n\n\treturn &Client{\n\t\tclient: &http.Client{},\n\t\tsentryAPIKey: api,\n\t\tsentryURI: baseURI,\n\t\tsentryOrg: org,\n\t}\n}", "title": "" }, { "docid": "fa953f1faa0286f483fa620729bf313d", "score": "0.58463055", "text": "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\tC: http.Client{\n\t\t\tTimeout: 5 * time.Second,\n\t\t},\n\t\tService: \"https://saucenao.com\",\n\t\tAPIKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "ccff81c5807cec6843740f31b0123822", "score": "0.5845016", "text": "func NewClient(apiURL, apiName, apiKey string) *Client {\n\treturn &Client{\n\t\tapiName: apiName,\n\t\tapiKey: apiKey,\n\t\tapiURL: apiURL,\n\t\tclient: &http.Client{},\n\t}\n}", "title": "" }, { "docid": "6f4783b25409a4783075c975652b25b4", "score": "0.58321977", "text": "func newClient(apiKey string) *Client {\n\tvar url *url.URL\n\turl, _ = url.Parse(\"https://vulners.com/api/v3\")\n\treturn &Client{baseURL: url, apiKey: apiKey}\n}", "title": "" }, { "docid": "3f5fdba1831fe27f191a07c89b233e52", "score": "0.579238", "text": "func NewClient(apiKey string) *Client {\n\treturn &Client{&http.Client{}, defaultURL, apiKey}\n}", "title": "" }, { "docid": "efadf757f44a9b1c324ee638b02e62e3", "score": "0.5771686", "text": "func NewClient(apiKey string) *Client {\n\tu, _ := url.ParseRequestURI(DefaultBaseURL)\n\treturn &Client{\n\t\tclient: &http.Client{},\n\t\tapiKey: apiKey,\n\t\tbaseURL: u,\n\t}\n}", "title": "" }, { "docid": "71464856637b8a867635723a9016eda8", "score": "0.57546896", "text": "func NewClient(httpClient *http.Client, apiID, apiKey string) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tclient := &Client{}\n\n\tclient.SetHTTPClient(httpClient)\n\tclient.SetAPIID(apiID)\n\tclient.SetAPIKey(apiKey)\n\tclient.SetBaseURL(BaseURL)\n\tclient.SetDebug(false)\n\tclient.SetUserAgent(userAgent)\n\tclient.SetMediaType(mediaType)\n\tclient.SetCharset(charset)\n\n\treturn client\n}", "title": "" }, { "docid": "10e4f78fab23c6db2990a0db1c6fffcf", "score": "0.57299256", "text": "func NewClient(apiToken string) *Client {\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\treturn &Client{\n\t\tapiToken: apiToken,\n\t\tbaseURL: baseURL,\n\t\tHTTPClient: &http.Client{Timeout: 5 * time.Second},\n\t}\n}", "title": "" }, { "docid": "34bb3a6fa43b648bea9d639a49543800", "score": "0.57264984", "text": "func NewClient(url, apiKey string) *Client {\n\treturn &Client{\n\t\turl: url,\n\t\tapiKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "1c776a766c2ef8c4dff15aa3a9e351b4", "score": "0.572545", "text": "func NewClient(username, password, partner, vendor string, usesSandbox bool) *PayPalClient {\n\tendpoint := PayflowProductionURL\n\tif usesSandbox {\n\t\tendpoint = PayflowSandboxURL\n\t}\n\n\treturn &PayPalClient{\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tPartner: partner,\n\t\tVendor: vendor,\n\t\tEndpoint: endpoint,\n\t\tUsesSandbox: usesSandbox,\n\t\tClient: new(http.Client),\n\t}\n}", "title": "" }, { "docid": "85eeeb4b46dec0ef5b13781a9765ab90", "score": "0.5722454", "text": "func NewClient(key string) *Client {\n\treturn &Client{\n\t\tAPIKey: key,\n\t\tapiURL: APIEndpoint(false),\n\t}\n}", "title": "" }, { "docid": "ccd77183b7534d02e12d8cca52fc98a0", "score": "0.5717126", "text": "func NewClient(apiToken string) *Client {\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\tclient := &Client{\n\t\ttoken: apiToken,\n\t\tclient: http.DefaultClient,\n\t\tbaseURL: baseURL,\n\t\tuserAgent: defaultUserAgent,\n\t}\n\tclient.Me = newMeService(client)\n\tclient.Projects = newProjectService(client)\n\tclient.Stories = newStoryService(client)\n\tclient.Memberships = newMembershipService(client)\n\tclient.Iterations = newIterationService(client)\n\tclient.Activity = newActivitiesService(client)\n\tclient.Epic = newEpicService(client)\n\treturn client\n}", "title": "" }, { "docid": "e603adadbb8b0ac5347c04deb2e87d00", "score": "0.5714729", "text": "func NewClient(pubkey *string, privkey *string) *APIKeyAuthentication {\n\tif CoinbaseAPIKey == \"\" && pubkey != nil {\n\t\tCoinbaseAPIKey = *pubkey\n\t}\n\tif CoinbaseAPISecret == \"\" && privkey != nil {\n\t\tCoinbaseAPISecret = *privkey\n\t}\n\tCBAccount = &APIKeyAuthentication{\n\t\tKey: CoinbaseAPIKey,\n\t\tSecret: CoinbaseAPISecret,\n\t\tBaseURL: CoinbaseBaseURL,\n\t\tClient: *http.DefaultClient,\n\t}\n\treturn CBAccount\n}", "title": "" }, { "docid": "2b39267dab33303f2d0efa402de66bbc", "score": "0.5697733", "text": "func NewBankAPI(client *http.Client) BankAPI {\n\treturn BankAPI{client: client}\n}", "title": "" }, { "docid": "e625abe89b02a425a637b12b61d0ed51", "score": "0.5687137", "text": "func New(apiKey string) *Client {\n\tclient := new(Client)\n\tclient.apiKey = apiKey\n\treturn client\n}", "title": "" }, { "docid": "0f4daeeb0199711e4333f2caf789aa9b", "score": "0.5658205", "text": "func NewClientWithKey(apiKey string) (*Client, error) {\n\tc := &Client{\n\t\tapiKey: apiKey,\n\t\tclient: http.DefaultClient}\n\n\terr := c.setBaseURL(defaultBaseURL)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.FundamentalService = &FundamentalService{client: c}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "e4bca7e3e06ba52cc671b71a445acb1e", "score": "0.5650469", "text": "func NewClient(token string, baseURL string) *Client {\n\tif baseURL == \"\" {\n\t\tbaseURL = apiURL\n\t}\n\treturn &Client{\n\t\tbaseURL: baseURL,\n\t\ttoken: token,\n\t}\n}", "title": "" }, { "docid": "fa95f477acf32837d2111ee252ebbee0", "score": "0.5646527", "text": "func NewClient(key string) *Client {\n\treturn &Client{key, &http.Client{}, \"https://api.paylike.io\"}\n}", "title": "" }, { "docid": "bf752ca9557182f42a1636982c137fc3", "score": "0.56403303", "text": "func NewClient(apiKey string) Client {\n\treturn Client{\n\t\tapiKey: apiKey,\n\t\tURL: getEnv(\"CHECKLY_API_URL\", \"https://api.checklyhq.com\"),\n\t\tHTTPClient: http.DefaultClient,\n\t}\n}", "title": "" }, { "docid": "b23c5caa5ff724a9cdef455fe80043b0", "score": "0.56281006", "text": "func NewClient(key, url string) *Client {\n\treturn &Client{\n\t\turl: url,\n\t\theader: req.Header{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"Accept\": \"application/json\",\n\t\t\t\"X-Api-Key\": key,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8973a75d528a633516123ef905b9c974", "score": "0.5627236", "text": "func newSandboxes(c *DevopsV1Client) *sandboxes {\n\treturn &sandboxes{\n\t\tclient: c.RESTClient(),\n\t}\n}", "title": "" }, { "docid": "bb047177540e91de1f770eb519176fc9", "score": "0.561904", "text": "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "title": "" }, { "docid": "51d7f600d77f85319118d0e3d82a357c", "score": "0.56080455", "text": "func New(address, apiKey string, httpClient *http.Client) *Client {\n\tclient := Client{\n\t\tAddress: strings.TrimRight(address, \"/\"),\n\t\tAPIKey: apiKey,\n\t\thttpClient: httpClient,\n\t}\n\n\treturn &client\n}", "title": "" }, { "docid": "d2623ef534a0a7ccf3f899df7468ad85", "score": "0.5597479", "text": "func NewClient(apiKey, appKey string) *Client {\n\treturn &Client{\n\t\tapiKey: apiKey,\n\t\tappKey: appKey,\n\t\tHttpClient: http.DefaultClient,\n\t}\n}", "title": "" }, { "docid": "df4825ba9d45abf7e0c0d08833bff918", "score": "0.55915254", "text": "func NewClient(url string) *Client {\n\n\thttpClient := http.DefaultClient\n\tbaseURL := fmt.Sprintf(\"%s%s/\", url, APIVersion)\n\treturn &Client{\n\t\tsling: sling.New().Client(httpClient).Base(baseURL),\n\t}\n}", "title": "" }, { "docid": "95e58f6b8165b0177a169229d3a82fa0", "score": "0.55888337", "text": "func NewClient(accessKeyId, accessKeySecret string) *Client {\n\tendpoint := os.Getenv(\"SLB_ENDPOINT\")\n\tif endpoint == \"\" {\n\t\tendpoint = SLBDefaultEndpoint\n\t}\n\treturn NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)\n}", "title": "" }, { "docid": "c22841fc23f97feced0aade112c29eed", "score": "0.55873626", "text": "func NewClient(endPoint, id, key string) (*Client, error) {\n\treturn &Client{endPoint, id, key, \"\", false}, nil\n}", "title": "" }, { "docid": "2f88583ca707fa93f76036dedf72582e", "score": "0.5586372", "text": "func NewClient(creds Authenticator, apiBaseURL string, httpClient httpClient) *Client {\n\tif apiBaseURL == \"\" {\n\t\tapiBaseURL = fmt.Sprintf(\"https://%s.api.dragonchain.com\", creds.GetDragonchainID())\n\t}\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tclient := &Client{\n\t\tcreds: creds,\n\t\tapiBaseURL: apiBaseURL,\n\t\thttpClient: httpClient,\n\t}\n\n\treturn client\n}", "title": "" }, { "docid": "84e31310d4743959328a4837e95b3e89", "score": "0.5584519", "text": "func NewClient(service, apiID, apiKey string, client *http.Client) *Client {\n\tc := &Client{\n\t\tservice: service,\n\t\tapiID: apiID,\n\t\tapiKey: apiKey,\n\t\tclient: client,\n\t}\n\tif c.client == nil {\n\t\tc.client = http.DefaultClient\n\t}\n\treturn c\n}", "title": "" }, { "docid": "c4020ff90ce192e10e4cdfbca293eb92", "score": "0.55721945", "text": "func New(apiKey string, secretKey string, opts ...ClientOption) (*client, error) {\n\tc := &client{\n\t\tidGenerator: &id.Generator{},\n\t\tsignatureGenerator: &auth.Generator{},\n\t\tclock: clockwork.NewRealClock(),\n\t\trequester: api.Requester{\n\t\t\tClient: http.DefaultClient,\n\t\t\tBaseURL: productionBaseURL,\n\t\t},\n\t}\n\n\tif err := c.UpdateConfig(apiKey, secretKey, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "9ab3498bf55f51cecf9fdbeb17701ab1", "score": "0.5564306", "text": "func NewClient(key, secret string) (cl *Client, err error) {\n\tcl = &Client{\n\t\tconn: &http.Client{},\n\t\tenv: newEnvironment(),\n\t}\n\n\tif key != \"\" {\n\t\tcl.env.apiKey = key\n\t\tcl.env.apiSecret = secret\n\t}\n\treturn cl, nil\n}", "title": "" }, { "docid": "29c9bf11b94d5e44cf6424b2964726a2", "score": "0.556389", "text": "func NewClient(key, secretKey string) (*Client, error) {\n\tif key == \"\" || secretKey == \"\" {\n\t\treturn &Client{}, errors.New(\"key is missing\")\n\t}\n\n\tbaseurl, _ := url.Parse(defalutBaseURL)\n\tclient := &http.Client{Timeout: time.Duration(10) * time.Second}\n\n\tcli := &Client{accessKey: key, secretAccessKey: secretKey, BaseURL: baseurl, HTTPClient: client}\n\n\treturn cli, nil\n}", "title": "" }, { "docid": "524974dff6119c76e5bc0e8f3fc5c033", "score": "0.55632734", "text": "func NewClient(apiKey string, apiSecret string) (Client, error) {\n\treturn newClientWithURLs(apiKey, apiSecret, generalAPIEndpoint, marketAPIEndpoint, accountAPIEndpoint, marketsAPIEndpoint)\n}", "title": "" }, { "docid": "233f3afc047efd21503202df83ba4108", "score": "0.55514", "text": "func New(apiKey string) *Client {\n\tc := &http.Client{Timeout: 30 * time.Second}\n\n\treturn &Client{\n\t\tc: c,\n\t\tapiKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "5597e8b00e437d7a5a25e921df9d4e14", "score": "0.5547029", "text": "func NewSandboxController(client api.ControllerClient) sb.Controller {\n\treturn &remoteSandboxController{client: client}\n}", "title": "" }, { "docid": "6a90c44ac4b448fabbf06261295baa4f", "score": "0.5543042", "text": "func NewClient(sugar *zap.SugaredLogger, url, signingKey string) (*Client, error) {\n\tconst timeout = time.Minute\n\tclient := &http.Client{Timeout: timeout}\n\treturn &Client{sugar: sugar, url: url, client: client, signingKey: signingKey}, nil\n}", "title": "" }, { "docid": "d40337f9464ff1df1c92f71d04e45f58", "score": "0.5542616", "text": "func NewClient(cacheDB *bbolt.DB, cacheKey string, orgID int64) (*Client, error) {\n\ttransactionalStore := newTransactionalStore(cacheDB)\n\tlocalStoreConfig, err := newLocalStoreConfig(transactionalStore, cacheKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlocalStoreDirector, err := newLocalStoreDirector(transactionalStore, cacheKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttargetStore := newTargetStore(transactionalStore, cacheKey)\n\tc := &Client{\n\t\torgID: orgID,\n\t\tconfigLocalStore: localStoreConfig,\n\t\tconfigRemoteStore: newRemoteStoreConfig(targetStore),\n\t\tdirectorLocalStore: localStoreDirector,\n\t\tdirectorRemoteStore: newRemoteStoreDirector(targetStore),\n\t\ttargetStore: targetStore,\n\t\ttransactionalStore: transactionalStore,\n\t}\n\tc.configTUFClient = client.NewClient(c.configLocalStore, c.configRemoteStore)\n\tc.directorTUFClient = client.NewClient(c.directorLocalStore, c.directorRemoteStore)\n\treturn c, nil\n}", "title": "" }, { "docid": "a8f84dcebc9376c0222dc458779b61ae", "score": "0.5541026", "text": "func NewClient(config *sdk.Config, credential *auth.Credential) *Client {\n\tvar handler sdk.RequestHandler = func(c *sdk.Client, req request.Common) (request.Common, error) {\n\t\terr := req.SetProjectId(PickResourceID(req.GetProjectId()))\n\t\treturn req, err\n\t}\n\tvar (\n\t\tuaccountClient = *uaccount.NewClient(config, credential)\n\t\tuhostClient = *uhost.NewClient(config, credential)\n\t\tunetClient = *unet.NewClient(config, credential)\n\t\tvpcClient = *vpc.NewClient(config, credential)\n\t\tudpnClient = *udpn.NewClient(config, credential)\n\t\tpathxClient = *pathx.NewClient(config, credential)\n\t\tudiskClient = *udisk.NewClient(config, credential)\n\t\tulbClient = *ulb.NewClient(config, credential)\n\t\tudbClient = *udb.NewClient(config, credential)\n\t\tumemClient = *umem.NewClient(config, credential)\n\t\tuphostClient = *uphost.NewClient(config, credential)\n\t\tpuhostClient = *puhost.NewClient(config, credential)\n\t\tpudbClient = *pudb.NewClient(config, credential)\n\t\tpumemClient = *pumem.NewClient(config, credential)\n\t\tppathxClient = *ppathx.NewClient(config, credential)\n\t)\n\n\tuaccountClient.Client.AddRequestHandler(handler)\n\tuhostClient.Client.AddRequestHandler(handler)\n\tunetClient.Client.AddRequestHandler(handler)\n\tvpcClient.Client.AddRequestHandler(handler)\n\tudpnClient.Client.AddRequestHandler(handler)\n\tpathxClient.Client.AddRequestHandler(handler)\n\tudiskClient.Client.AddRequestHandler(handler)\n\tulbClient.Client.AddRequestHandler(handler)\n\tudbClient.Client.AddRequestHandler(handler)\n\tumemClient.Client.AddRequestHandler(handler)\n\tuphostClient.Client.AddRequestHandler(handler)\n\tpuhostClient.Client.AddRequestHandler(handler)\n\tpudbClient.Client.AddRequestHandler(handler)\n\tpumemClient.Client.AddRequestHandler(handler)\n\tppathxClient.Client.AddRequestHandler(handler)\n\n\treturn &Client{\n\t\tuaccountClient,\n\t\tuhostClient,\n\t\tunetClient,\n\t\tvpcClient,\n\t\tudpnClient,\n\t\tpathxClient,\n\t\tudiskClient,\n\t\tulbClient,\n\t\tudbClient,\n\t\tumemClient,\n\t\tuphostClient,\n\t\tpuhostClient,\n\t\tpudbClient,\n\t\tpumemClient,\n\t\tppathxClient,\n\t}\n}", "title": "" }, { "docid": "ebdd4ec7061392c31b6e18bc41653ecb", "score": "0.5540005", "text": "func NewClient(domain, apikey string, l *log.Logger) (c *Client, err error) {\n\tc = &Client{}\n\tc.l = l\n\tc.httpclient = &http.Client{Timeout: 5 * time.Second} // TODO: provide ability to configure\n\tc.domain = domain\n\tc.apikey = apikey\n\tc.baseURL, err = url.Parse(fmt.Sprintf(\"https://%s.canary.tools/api/v1/\", domain))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tc.l.Debug(\"pinging console...\")\n\terr = c.Ping()\n\treturn\n}", "title": "" }, { "docid": "76dbfda2b03ba72f402151db4ecf4432", "score": "0.5537942", "text": "func NewClient(pkey, skey string) (*Client, error) {\n\tswitch {\n\tcase pkey == \"\" && skey == \"\":\n\t\treturn nil, ErrInvalidKey\n\tcase pkey != \"\" && !strings.HasPrefix(pkey, \"pkey_\"):\n\t\treturn nil, ErrInvalidKey\n\tcase skey != \"\" && !strings.HasPrefix(skey, \"skey_\"):\n\t\treturn nil, ErrInvalidKey\n\t}\n\n\tclient := &Client{\n\t\tClient: &http.Client{Transport: transport},\n\t\tdebug: false,\n\t\tpkey: pkey,\n\t\tskey: skey,\n\n\t\tEndpoints: map[internal.Endpoint]string{},\n\t}\n\n\tif len(build.Default.ReleaseTags) > 0 {\n\t\tclient.GoVersion = build.Default.ReleaseTags[len(build.Default.ReleaseTags)-1]\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "16fc43c11883d6bfef41ccb64a39b0ef", "score": "0.5537004", "text": "func (c *Config) NewClient() *APIClient {\n\tclient := api.NewClient(c.AccessToken, c.AccessTokenSecret, c.Zone)\n\n\tif c.AcceptLanguage != \"\" {\n\t\tclient.AcceptLanguage = c.AcceptLanguage\n\t}\n\tif c.APIRootURL != \"\" {\n\t\tapi.SakuraCloudAPIRoot = c.APIRootURL\n\t}\n\tif c.RetryMax > 0 {\n\t\tclient.RetryMax = c.RetryMax\n\t}\n\tif c.RetryInterval > 0 {\n\t\tclient.RetryInterval = time.Duration(c.RetryInterval) * time.Second\n\t}\n\tif c.TimeoutMinute > 0 {\n\t\tclient.DefaultTimeoutDuration = time.Duration(c.TimeoutMinute) * time.Minute\n\t}\n\n\thttpClient := &http.Client{}\n\tif c.APIRequestTimeout > 0 {\n\t\thttpClient.Timeout = time.Duration(c.APIRequestTimeout) * time.Second\n\t}\n\tif c.APIRequestRateLimit > 0 {\n\t\thttpClient.Transport = &api.RateLimitRoundTripper{RateLimitPerSec: c.APIRequestRateLimit}\n\t}\n\tclient.HTTPClient = httpClient\n\n\tif c.TraceMode {\n\t\tclient.TraceMode = true\n\t\tlog.SetPrefix(\"[DEBUG] \")\n\t}\n\tclient.UserAgent = \"Terraform for SakuraCloud/v\" + Version\n\n\treturn &APIClient{\n\t\tClient: client,\n\t}\n}", "title": "" }, { "docid": "410a6dce265998408fb17f497ae602a5", "score": "0.5529644", "text": "func NewClient(httpClient *http.Client, space string, apiKey string) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(\"https://\" + space + \".backlog.com/api/v2/\")\n\tc := &Client{client: httpClient, BaseURL: baseURL, apiKey: apiKey}\n\tc.common.client = c\n\tc.Space = (*SpaceService)(&c.common)\n\tc.Projects = (*ProjectsService)(&c.common)\n\tc.Issues = (*IssuesService)(&c.common)\n\treturn c\n}", "title": "" }, { "docid": "d250b7294b50ff337f34720814e93bf4", "score": "0.5526636", "text": "func newClientWithURL(url string, apiKey string, apiSecret string) (Client, error) {\n\treturn newClientWithURLs(apiKey, apiSecret, url, url, url, url)\n}", "title": "" }, { "docid": "bb950d921b82ca02c7c9132f363cdc77", "score": "0.55196637", "text": "func NewClient(host, apiKey string) *Client {\n\treturn &Client{\n\t\thost: host,\n\t\tapiKey: apiKey,\n\t\tclient: http.DefaultClient,\n\t}\n}", "title": "" }, { "docid": "db7ce72834bcbc85f35700674b7d52a4", "score": "0.5518074", "text": "func New(apiKey string, apiSecret string) *Client {\n\treturn &Client{\n\t\tClient: defaultHTTPClient,\n\t\tAPIKey: apiKey,\n\t\tAPISecret: apiSecret,\n\t}\n}", "title": "" }, { "docid": "2c76098511e3eaed719e7e8b05ee4ab8", "score": "0.55166596", "text": "func NewAPIClient() (APIClient, error) {\n\tsession, err := session.NewSession(&aws.Config{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create AWS root session: %v\", err)\n\t}\n\n\treturn &sdkAPIClient{\n\t\tsession: session,\n\t\tiamSvc: iam.New(session),\n\t\tstsSvc: sts.New(session),\n\t}, nil\n}", "title": "" }, { "docid": "4ae12d66c55e883e82d362891c5c9fce", "score": "0.5512753", "text": "func NewClient(apiKey string) *Client {\n\tc := new(Client)\n\tc.httpClient = &http.Client{}\n\tc.apiKey = apiKey\n\treturn c\n}", "title": "" }, { "docid": "4db6996dcf0afc4af0c6906b700b21ed", "score": "0.550535", "text": "func NewClient(httpClient *http.Client, username string, password string) *Client {\n\tbase := sling.New().Client(httpClient).Base(msfUrl)\n\tbase.SetBasicAuth(username, password)\n\treturn &Client{\n\t\tsling: base,\n\t\tNBA: newNBAService(base.New()),\n\t}\n}", "title": "" }, { "docid": "89f50227c7b83ca511b1ecfaa2d5e5a9", "score": "0.5502232", "text": "func NewClient(apiKey, secretKey string, sugar *zap.SugaredLogger, options ...Option) (*Client, error) {\n\tclnt := &Client{\n\t\tAPIKey: apiKey,\n\t\tSecretKey: secretKey,\n\t\tsugar: sugar,\n\t}\n\tfor _, opt := range options {\n\t\tif err := opt(clnt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\t//Set Default rate limiter to the limit spefified by https://github.com/huobiapi/API_Docs_en/wiki/Request_Process\n\tif clnt.rateLimiter == nil {\n\t\tconst huobiDefaultRateLimit = 10\n\t\tclnt.rateLimiter = rate.NewLimiter(rate.Limit(huobiDefaultRateLimit), 1)\n\t}\n\treturn clnt, nil\n\n}", "title": "" }, { "docid": "62baf8288c4942ffd2f578f21155f4b3", "score": "0.5498505", "text": "func NewClient(baseURL, apiUsername, apiPassword, senderID string) *Client {\n\treturn &Client{\n\t\tclient: http.DefaultClient,\n\t\tbaseURL: baseURL,\n\t\tapiUsername: apiUsername,\n\t\tapiPassword: apiPassword,\n\t\tsenderID: senderID,\n\t}\n}", "title": "" }, { "docid": "2343f59633d3b6d0d76265b04de902ef", "score": "0.5491799", "text": "func NewClient(apiKey string) *Client {\n\treturn NewCustomClient(apiKey, ClientConfig{})\n}", "title": "" }, { "docid": "21b32eb5549909e7c5a2143e029529fa", "score": "0.5484717", "text": "func NewClient() (Client, error) {\n\ttoken, err := iv_auth.LoadCredentials()\n\tif err != nil {\n\t\tlog.Panicln(err)\n\t}\n\n\treturn &client{oauthToken: token}, nil\n}", "title": "" }, { "docid": "72b51af89b21e28db921fc6672395160", "score": "0.547745", "text": "func newClient(ctx context.Context, cfg vcConfig) (*vsClient, error) {\n\tu := url.URL{\n\t\tScheme: \"https\",\n\t\tHost: cfg.server,\n\t\tPath: \"sdk\",\n\t}\n\n\tu.User = url.UserPassword(cfg.user, cfg.password)\n\tinsecure := cfg.insecure\n\n\tgc, err := govmomi.NewClient(ctx, &u, insecure)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"connecting to vSphere API: %w\", err)\n\t}\n\n\trc := rest.NewClient(gc.Client)\n\ttm := tags.NewManager(rc)\n\n\tvsc := vsClient{\n\t\tgovmomi: gc,\n\t\trest: rc,\n\t\ttagManager: tm,\n\t}\n\n\terr = vsc.rest.Login(ctx, u.User)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"logging into rest api: %w\", err)\n\t}\n\n\treturn &vsc, nil\n}", "title": "" }, { "docid": "45b48be34fd3473435f37367ff45667f", "score": "0.5474904", "text": "func NewClient() *coinbasepro.Client {\n\t// Load .env file for secret values\n\terr := godotenv.Load()\n if err != nil {\n log.Fatal(\"Error loading .env file\")\n\t}\n\n\t// Create our coinbase pro client\n\tclient := coinbasepro.NewClient()\n\n\t// And set the various options for it\n\tclient.UpdateConfig(&coinbasepro.ClientConfig{\n\t\tBaseURL: \"https://api-public.sandbox.pro.coinbase.com\",\n\t\tKey: os.Getenv(\"COINBASE_KEY\"),\n\t\tPassphrase: os.Getenv(\"COINBASE_PASSPHRASE\"),\n\t\tSecret: os.Getenv(\"COINBASE_SECRET\"),\n\t})\n\n\treturn client\n}", "title": "" }, { "docid": "9c812e66ef96e3e8e17cb9db87d4cbfc", "score": "0.54739374", "text": "func ApiClient(key string, secret string) Client {\n\treturn Client{\n\t\tkey: key,\n\t\tsecret: secret,\n\t\thttpClient: http.DefaultClient,\n\t}\n}", "title": "" }, { "docid": "425e19033bc0a699ba0be30ee0e9fc4b", "score": "0.5466868", "text": "func NewClient(accessToken string, version string, httpClient *http.Client) *Client {\n\ttype Params struct {\n\t\tAccessToken string `url:\"access_token,omitempty\"`\n\t\tLocale string `url:\"locale,omitempty\"`\n\t}\n\n\tparams := &Params{AccessToken: accessToken, Locale: \"*\"}\n\n\tclient := &Client{\n\t\tAccessToken: accessToken,\n\t\tsling: sling.New().Client(httpClient).Base(baseURL).\n\t\t\tSet(\"Content-Type\", contentTypeHeader(version)).\n\t\t\tQueryStruct(params),\n\t}\n\n\tclient.rl = rate.New(10, time.Second*1)\n\n\treturn client\n}", "title": "" }, { "docid": "78cf0cca89b1fd8f8185e260a4afb9d3", "score": "0.546624", "text": "func newClient() *sts.STS {\n\tsess := session.Must(session.NewSessionWithOptions(session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t}))\n\tconfig := aws.NewConfig()\n\tif debug {\n\t\tconfig.WithLogLevel(aws.LogDebugWithHTTPBody)\n\t}\n\treturn sts.New(sess, config)\n}", "title": "" }, { "docid": "078fea053f7bd201e3b6d84434816f5d", "score": "0.5456232", "text": "func NewClient(clientID, secret, APIBase string) *Client {\n\treturn &Client{\n\t\t&http.Client{},\n\t\tclientID,\n\t\tsecret,\n\t\tAPIBase,\n\t\tnil,\n\t}\n}", "title": "" }, { "docid": "5420e02524a2eca78e7cfbf161419772", "score": "0.5455538", "text": "func NewClient(with ...ClientOption) *Client {\n\ttimeout := DefaultTimeout\n\n\tclient := &Client{\n\t\tclient: &http.Client{\n\t\t\tTimeout: timeout,\n\t\t},\n\t\tbase: getBaseURL(url.URL{\n\t\t\tScheme: \"https\",\n\t\t\tHost: \"api.secrethub.io\",\n\t\t}),\n\t\tuserAgent: DefaultUserAgent,\n\t}\n\tclient.Options(with...)\n\treturn client\n}", "title": "" }, { "docid": "74fec262956592488c9b99dd23eaaf53", "score": "0.54544675", "text": "func NewClient(api string) *Client {\n\tclient := &Client{\n\t\tapi: api,\n\t}\n\treturn client\n}", "title": "" }, { "docid": "a40fb1dd4d8299b2750ce6f560e13d31", "score": "0.5448209", "text": "func NewClient(subdomain, apiKey string) *Client {\n\tc := &Client{Client: recurly.NewClient(subdomain, apiKey)}\n\n\t// Attach mock implementations.\n\tc.Client.Accounts = &c.Accounts\n\tc.Client.AddOns = &c.AddOns\n\tc.Client.Adjustments = &c.Adjustments\n\tc.Client.Billing = &c.Billing\n\tc.Client.Coupons = &c.Coupons\n\tc.Client.CreditPayments = &c.CreditPayments\n\tc.Client.Redemptions = &c.Redemptions\n\tc.Client.Invoices = &c.Invoices\n\tc.Client.Plans = &c.Plans\n\tc.Client.Purchases = &c.Purchases\n\tc.Client.ShippingAddresses = &c.ShippingAddresses\n\tc.Client.ShippingMethods = &c.ShippingMethods\n\tc.Client.Subscriptions = &c.Subscriptions\n\tc.Client.Transactions = &c.Transactions\n\treturn c\n}", "title": "" }, { "docid": "9de4b42e8902bd531fdb32839e64bf81", "score": "0.54435205", "text": "func NewClient(accessToken string, version string, httpClient *http.Client) *Client {\n\tclient := &Client{\n\t\tAccessToken: accessToken,\n\t\tsling: sling.New().Client(httpClient).Base(baseURL).\n\t\t\tSet(\"Content-Type\", contentTypeHeader(version)).\n\t\t\tSet(\"Authorization\", authorizationHeader(accessToken)),\n\t}\n\n\tclient.rl = rate.New(10, time.Second*1)\n\n\treturn client\n}", "title": "" }, { "docid": "2d03f04713265a00add5b72f1c8a8922", "score": "0.5427735", "text": "func NewClient(apiTokenID string, apiSecret string, logger *log.Logger) (*Client, error) {\n\tif len(apiTokenID) == 0 {\n\t\treturn nil, fmt.Errorf(\"apiTokenID is not set\")\n\t}\n\n\tif len(apiSecret) == 0 {\n\t\treturn nil, fmt.Errorf(\"apiSecret is not set\")\n\t}\n\n\tpublicUrl, err := url.ParseRequestURI(baseUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprivateUrl, err := url.ParseRequestURI(privateBaseUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar discardLogger = log.New(ioutil.Discard, \"\", log.LstdFlags)\n\tif logger == nil {\n\t\tlogger = discardLogger\n\t}\n\n\tclient := &http.Client{Timeout: time.Duration(10) * time.Second}\n\treturn &Client{URL: publicUrl, PrivateURL: privateUrl, ApiTokenID: apiTokenID, ApiSecret: apiSecret, HTTPClient: client, Logger: logger}, nil\n\n}", "title": "" }, { "docid": "b6d2bb3789b2d471a9b4569945dd1a33", "score": "0.54036874", "text": "func NewClient(uri, loginID, key string, options ...ClientOpt) (Client, error) {\n\tif len(uri) == 0 {\n\t\treturn nil, errors.New(errors.KsiInvalidFormatError).AppendMessage(\"Missing endpoint URI.\")\n\t}\n\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn nil, errors.New(errors.KsiNetworkError).SetExtError(err).\n\t\t\tAppendMessage(\"Unable to parse URI\")\n\t}\n\n\tschm, isKsi := adjustScheme(u.Scheme)\n\tu.Scheme = schm\n\n\t// Select loginId and key.\n\tvar l, k string\n\tif loginID != \"\" {\n\t\tl = loginID\n\t} else {\n\t\tl = u.User.Username()\n\t}\n\tif key != \"\" {\n\t\tk = key\n\t} else {\n\t\tif pass, isSet := u.User.Password(); isSet {\n\t\t\tk = pass\n\t\t}\n\t}\n\n\tvar tmp Client\n\n\tswitch u.Scheme {\n\tcase \"http\", \"https\":\n\t\thttpClient := newHTTPClient(u.String(), isKsi)\n\t\thttpClient.loginID = l\n\t\thttpClient.key = k\n\t\ttmp = httpClient\n\tcase \"tcp\":\n\t\ttcpClient := newTCPClient(u.Hostname(), u.Port())\n\t\ttcpClient.loginID = l\n\t\ttcpClient.key = k\n\t\ttmp = tcpClient\n\tdefault:\n\t\treturn nil, errors.New(errors.KsiInvalidFormatError).AppendMessage(\"Unknown URI scheme\")\n\t}\n\n\t// Apply options.\n\tfor _, setter := range options {\n\t\tif err := setOption(tmp, setter); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn tmp, nil\n}", "title": "" }, { "docid": "e66ee1690ada91c59706485c31fca2da", "score": "0.5402032", "text": "func NewClient(httpClient *http.Client) (*Client, error) {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tc := &Client{}\n\n\tbaseURL, _ := url.Parse(DefaultBaseURL)\n\tvsspsBaseURL, _ := url.Parse(DefaultVsspsBaseURL)\n\tvsaexBaseURL, _ := url.Parse(DefaultVsaexBaseURL)\n\n\tc.client = httpClient\n\tc.BaseURL = *baseURL\n\tc.VsspsBaseURL = *vsspsBaseURL\n\tc.VsaexBaseURL = *vsaexBaseURL\n\tc.UserAgent = userAgent\n\n\tc.Boards = &BoardsService{client: c}\n\tc.BuildDefinitions = &BuildDefinitionsService{client: c}\n\tc.Builds = &BuildsService{client: c}\n\tc.DeliveryPlans = &DeliveryPlansService{client: c}\n\tc.Favourites = &FavouritesService{client: c}\n\tc.Git = &GitService{client: c}\n\tc.Iterations = &IterationsService{client: c}\n\tc.PolicyEvaluations = &PolicyEvaluationsService{client: c}\n\tc.PullRequests = &PullRequestsService{client: c}\n\tc.Teams = &TeamsService{client: c}\n\tc.Tests = &TestsService{client: c}\n\tc.Users = &UsersService{client: c}\n\tc.UserEntitlements = &UserEntitlementsService{client: c}\n\tc.WorkItems = &WorkItemsService{client: c}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "43c2d63c74d7db36c50ea525e4d35440", "score": "0.5391359", "text": "func NewClient(c *Config) *rapi.APIClient {\n\n\t// Configure the endpoint host\n\tapiHost := \"console.rumble.run\"\n\tif envHost := os.Getenv(\"RUMBLE_API_HOST\"); envHost != \"\" {\n\t\tapiHost = envHost\n\t}\n\tif c.Host != \"\" {\n\t\tapiHost = c.Host\n\t}\n\n\t// Configure the authorization header\n\theaders := make(map[string]string)\n\tapiKey := os.Getenv(\"RUMBLE_API_KEY\")\n\tif c.Key != \"\" {\n\t\tapiKey = c.Key\n\t}\n\tif apiKey != \"\" {\n\t\theaders[\"Authorization\"] = \"Bearer \" + apiKey\n\t}\n\n\t// Create the client\n\treturn rapi.NewAPIClient(&rapi.Configuration{\n\t\tHost: apiHost,\n\t\tBasePath: \"/api/v1.0\",\n\t\tScheme: \"https\",\n\t\tDefaultHeader: headers,\n\t})\n}", "title": "" }, { "docid": "6cff90be4a31d198a0d86226cf08f3df", "score": "0.5388484", "text": "func NewStashClient(username, token string, optFns ...gitprovider.ClientOption) (*ProviderClient, error) {\n\turl := &url.URL{}\n\n\topts, err := gitprovider.MakeClientOptions(optFns...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a *http.Client using the transport chain\n\tclient, err := gitprovider.BuildClientFromTransportChain(opts.GetTransportChain())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif opts.Domain == nil {\n\t\treturn nil, errors.New(\"host is required\")\n\t}\n\n\thost := *opts.Domain\n\n\tlogger := logr.Discard()\n\tif opts.Logger != nil {\n\t\tlogger = *opts.Logger\n\t}\n\n\turl, err = url.Parse(host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tst, err := NewClient(client, host, nil, &logger, WithAuth(username, token))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// By default, turn destructive actions off. But allow overrides.\n\tdestructiveActions := false\n\tif opts.EnableDestructiveAPICalls != nil {\n\t\tdestructiveActions = *opts.EnableDestructiveAPICalls\n\t}\n\n\treturn newClient(st, host, token, destructiveActions, logger), nil\n}", "title": "" }, { "docid": "7462102198ab651aa922a7ef758f31b5", "score": "0.5370816", "text": "func NewClient(host, apikey string) *Client {\n\t// Setup a custom transport that ignores SSL certificate errors.\n\t// TODO: This probably isn't what needs to happen long term...\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\n\treturn &Client{\n\t\tHost: host,\n\t\tApiKey: apikey,\n\t\tScheme: DefaultScheme,\n\t\thttpClient: &http.Client{Transport: tr},\n\t}\n}", "title": "" }, { "docid": "4a698e64cc33281d2278344d87aca238", "score": "0.5365937", "text": "func NewClient(accessToken string) *Client {\n\treturn &Client{\n\t\ttoken: accessToken,\n\t\tunmarshal: json.Unmarshal,\n\t\tmarshal: json.Marshal,\n\t\tclient: &http.Client{},\n\t\tdebug: utils.GetEnv(envDebug, \"false\") == \"true\",\n\t\tlog: log.New(os.Stderr, \"slackapi\", log.LstdFlags|log.Lshortfile),\n\t}\n}", "title": "" }, { "docid": "b7129f0038dd05f3dde9dfb67ed6eb08", "score": "0.5362758", "text": "func DefaultHTTPClientFactory(cc *cli.Context) (*http.Client, error) {\n\tif cc == nil {\n\t\tlogrus.Panic(\"cli context has not been set\")\n\t}\n\tvar c http.Client\n\tcookieJar, _ := cookiejar.New(nil)\n\n\tif cc.GlobalIsSet(\"apiSession\") {\n\t\tvar cookies []*http.Cookie\n\t\tcookie := &http.Cookie{\n\t\t\tName: \"SESSION\",\n\t\t\tValue: cc.GlobalString(\"apiSession\"),\n\t\t}\n\t\tcookies = append(cookies, cookie)\n\t\tu, _ := url.Parse(os.Getenv(\"SPINNAKER_API\"))\n\t\tcookieJar.SetCookies(u, cookies)\n\t}\n\n\tc = http.Client{\n\t\tTimeout: time.Duration(cc.GlobalInt(\"clientTimeout\")) * time.Second,\n\t\tJar: cookieJar,\n\t}\n\n\tvar certPath string\n\tvar keyPath string\n\n\n\tif cc.GlobalIsSet(\"certPath\") {\n\t\tcertPath = cc.GlobalString(\"certPath\")\n\t} else if os.Getenv(\"SPINNAKER_CLIENT_CERT\") != \"\" {\n\t\tcertPath = os.Getenv(\"SPINNAKER_CLIENT_CERT\")\n\t} else {\n\t\tcertPath = \"\"\n\t}\n\tif cc.GlobalIsSet(\"keyPath\") {\n\t\tkeyPath = cc.GlobalString(\"keyPath\")\n\t} else if os.Getenv(\"SPINNAKER_CLIENT_KEY\") != \"\" {\n\t\tkeyPath = os.Getenv(\"SPINNAKER_CLIENT_KEY\")\n\t} else {\n\t\tkeyPath = \"\"\n\t}\n\tif cc.GlobalIsSet(\"iapToken\") {\n\t\tiapToken = cc.GlobalString(\"iapToken\")\n\t} else if os.Getenv(\"SPINNAKER_IAP_TOKEN\") != \"\" {\n\t\tiapToken = os.Getenv(\"SPINNAKER_IAP_TOKEN\")\n\t} else {\n\t\tiapToken = \"\"\n\t}\n\tc.Transport = &http.Transport{\n\t\tTLSClientConfig: &tls.Config{},\n\t}\n\n\tif certPath != \"\" && keyPath != \"\" {\n\t\tlogrus.Debug(\"Configuring TLS with pem cert/key pair\")\n\t\tcert, err := tls.LoadX509KeyPair(certPath, keyPath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"loading x509 keypair\")\n\t\t}\n\n\t\tclientCA, err := ioutil.ReadFile(certPath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"loading client CA\")\n\t\t}\n\n\t\tclientCertPool := x509.NewCertPool()\n\t\tclientCertPool.AppendCertsFromPEM(clientCA)\n\n\t\tc.Transport.(*http.Transport).TLSClientConfig.MinVersion = tls.VersionTLS12\n\t\tc.Transport.(*http.Transport).TLSClientConfig.PreferServerCipherSuites = true\n\t\tc.Transport.(*http.Transport).TLSClientConfig.Certificates = []tls.Certificate{cert}\n\t\tc.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = true\n\t}\n\n\tif cc.GlobalIsSet(\"insecure\") {\n\t\tc.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = true\n\t}\n\n\treturn &c, nil\n}", "title": "" }, { "docid": "6a6137e7e15f3a51ba93de44996fa7db", "score": "0.53597987", "text": "func NewClient(apiKey string, httpClient HTTPClient) *Client {\n\treturn &Client{\n\t\tapiKey: apiKey,\n\t\tclient: httpClient,\n\t\tLanguage: \"en-us\", // change after creating a new client\n\t}\n}", "title": "" }, { "docid": "c6eb8a4e41aa6ce7f55abf70cced9df5", "score": "0.5355774", "text": "func NewClient(url, token string, debug bool) *Client {\n\tc := Client{\n\t\tBaseURL: url,\n\t\t// AccessToken: token,\n\t\tDebug: debug,\n\t}\n\n\tapi := req.New()\n\t//trans, _ := api.Client().Transport.(*http.Transport)\n\t//trans.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\tc.client = api\n\n\treturn &c\n}", "title": "" }, { "docid": "ac9fffa88d804a592c98317f92fce375", "score": "0.53490704", "text": "func NewClient(authToken string) *Client {\n\treturn &Client{\n\t\tBaseURL: apiURLv1,\n\t\tHTTPClient: newTransport(),\n\t\tauthToken: authToken,\n\t\tidOrg: \"\",\n\t}\n}", "title": "" }, { "docid": "f09b701abdf9eea0a23219f39cf507f6", "score": "0.53479594", "text": "func New(sid string, token string) *Client {\n\treturn &Client{\n\t\taccountSid: sid,\n\t\tauthToken: token,\n\t\tmessageFrom: \"Genesis\",\n\t}\n}", "title": "" }, { "docid": "99d5e9312bb987715b3cf6c8529c3a19", "score": "0.53477377", "text": "func NewClient(apiKey string, options ...OptionFunc) *Client {\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\tc := &Client{\n\t\tclient: &http.Client{\n\t\t\tTimeout: time.Second * 10,\n\t\t},\n\t\tbaseURL: baseURL,\n\t\tapiKey: apiKey,\n\t\tuserAgent: \"github.com/barthr/newsapi\",\n\t}\n\n\tfor _, opt := range options {\n\t\topt(c)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "15f6126044cf01d92a69f82361b4b429", "score": "0.5346238", "text": "func New(cfg *config.Config) (c *Client) {\n\tc = &Client{\n\t\tapi: httpclient.NewHttpClient(),\n\t\tdebug: cfg.Debug,\n\t\tlastAt: time.Now().UTC(),\n\t\tsecret: cfg.APISecret,\n\t\turl: cfg.APIUrl,\n\t\tversion: cfg.APIVersion,\n\t\twait: 1 * time.Second,\n\t}\n\n\tc.api.Defaults(httpclient.Map{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/json\",\n\t\thttpclient.OPT_USERAGENT: \"go-crex24\",\n\t\t\"X-CREX24-API-KEY\": cfg.APIKey,\n\t})\n\tif c.debug {\n\t\tfmt.Println(\"X-CREX24-API-KEY:\", c.api.Headers[\"X-CREX24-API-KEY\"])\n\t\tfmt.Println(\"Client.api.Headers:\", c.api.Headers)\n\t}\n\treturn\n}", "title": "" } ]
1b14ae1c3147e1dc4d4378114fc27150
CitySearch returns a list of cities found with a search query example: `CitySearch("new york")` will return new your new york as one of the results accuweather api docs:
[ { "docid": "1f6bea438ed293bb4d3c1bbc94383507", "score": "0.86156994", "text": "func (c *Client) CitySearch(search string) ([]*Location, error) {\n\taccuRequest := c.newAccuRequest()\n\treq := &searchRequest{\n\t\tAccuAPIRequest: *accuRequest,\n\t\tQuery: search,\n\t}\n\n\tvar result []*Location\n\terr := c.getJSON(\"/locations/v1/cities/search\", req, &result)\n\treturn result, err\n}", "title": "" } ]
[ { "docid": "dd629917fee5dddf0c055c062413bc04", "score": "0.6922376", "text": "func (db *Db) SearchCityCountry(query string) ([]*locationpb.SearchCityCountry, error) {\n\tvar cities []*locationpb.SearchCityCountry\n\t_, err := db.Client.Query(&cities, `SELECT search_result, city_id FROM \"public\".search_city_country(?)`, query)\n\treturn cities, err\n}", "title": "" }, { "docid": "c0765daeb7c65bc53f63c17971785ed5", "score": "0.6791789", "text": "func (db *Db) SearchCityProvince(query string) ([]*locationpb.SearchCityCountry, error) {\n\tvar cities []*locationpb.SearchCityCountry\n\t_, err := db.Client.Query(&cities, `SELECT search_result, city_id FROM \"public\".search_city_province(?)`, query)\n\treturn cities, err\n}", "title": "" }, { "docid": "40d2305743e44c4e64f1ce20d4e8ca1f", "score": "0.6615206", "text": "func (c *Client) Search(query string) ([]Place, error) {\n\tvar cli http.Client\n\n\treq, err := http.NewRequest(http.MethodGet, apiSearch, nil)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"could not create HTTP request: %w\", err)\n\t}\n\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\n\tform := make(url.Values)\n\tform.Add(\"q\", query)\n\tform.Add(\"format\", \"jsonv2\")\n\tswitch c.AddressDetails {\n\tcase true:\n\t\tform.Add(\"addressdetails\", \"1\")\n\tdefault:\n\t\tform.Add(\"addressdetails\", \"0\")\n\t}\n\tif c.AcceptLanguages != nil {\n\t\tform.Add(\"accept-language\", strings.Join(c.AcceptLanguages, \",\"))\n\t}\n\treq.URL.RawQuery = form.Encode()\n\n\tresp, err := cli.Do(req)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"could not send request to OpenStreetMap: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tout := new(bytes.Buffer)\n\t\tio.Copy(out, resp.Body)\n\t\treturn nil, xerrors.Errorf(\n\t\t\t\"invalid status code %s (%d):\\n%s\",\n\t\t\tresp.Status, resp.StatusCode, out.String(),\n\t\t)\n\t}\n\n\tvar places []Place\n\terr = json.NewDecoder(resp.Body).Decode(&places)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"could not decode JSON reply from %q: %w\", req, err)\n\t}\n\n\treturn places, nil\n}", "title": "" }, { "docid": "ee7b8e1ce9f579b4edb1a22cd91be0d7", "score": "0.6591848", "text": "func (cr *Core) CityList(provinceID int) (res CityListResponse, err error) {\n\turlPath := fmt.Sprintf(\"city?province=%v\", provinceID)\n\theaders := map[string]string{\n\t\t\"key\": cr.Client.APIKey,\n\t}\n\terr = cr.CallPro(fasthttp.MethodGet, urlPath, headers, nil, &res)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "e58098264bdc61ee7f3e0f20f1a2c545", "score": "0.65159756", "text": "func Search(query string) ([]Place, error) {\n\treturn DefaultClient.Search(query)\n}", "title": "" }, { "docid": "f0ee48385821691dbc86d42690db2907", "score": "0.63982415", "text": "func City(b []byte) engin.Result {\n\tr := cityRe.FindAllSubmatch(b, -1)\n\tvar result engin.Result\n\tfor _, v := range r {\n\t\tname := string(v[2])\n\t\tresult.Requests = append(result.Requests, engin.Request{\n\t\t\tURL: string(v[1]),\n\t\t\tParser: func(b []byte) engin.Result {\n\t\t\t\treturn User(b, name)\n\t\t\t},\n\t\t})\n\t\tresult.Items = append(result.Items, name)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "b2e139cc8ba30d2f78fc200f07bd465d", "score": "0.63933724", "text": "func (req fedSearchRequest) searchCityOnly(logger log.Logger, searcher *searcher, searchType string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif logger != nil {\n\t\t\trequestID, userID := moovhttp.GetRequestID(r), moovhttp.GetUserID(r)\n\t\t\tlogger.Log(\"searchFEDACH\", fmt.Sprintf(\"search by city %s\", req.City), \"requestID\", requestID, \"userID\", userID)\n\t\t}\n\n\t\tswitch searchType {\n\t\tcase ACH:\n\t\t\tachP := searcher.ACHFindCityOnly(extractSearchLimit(r), req.City)\n\t\t\tw := setResponseHeader(w)\n\t\t\tif err := json.NewEncoder(w).Encode(&searchResponse{ACHParticipants: achP}); err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase WIRE:\n\t\t\twireP := searcher.WIREFindCityOnly(extractSearchLimit(r), req.City)\n\t\t\tw := setResponseHeader(w)\n\t\t\tif err := json.NewEncoder(w).Encode(&searchResponse{WIREParticipants: wireP}); err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36904acb30ef716a7b8f90f1fea1c7a5", "score": "0.63496494", "text": "func City(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "687bb766fcda444f2f2a31cc472f3689", "score": "0.63009334", "text": "func (o *Address) City(exec boil.Executor, mods ...qm.QueryMod) cityQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"city_id=?\", o.CityID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Cities(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`city`\")\n\n\treturn query\n}", "title": "" }, { "docid": "806f49eb04a44c53da1b3c79f9c17a58", "score": "0.6266756", "text": "func (w weatherService) CityWeather(name string) (Weather, error) {\n\tif name == \"\" {\n\t\treturn Weather{}, errors.New(\"invalid name; should be non empty string\")\n\t}\n\n\tresp, err := http.Get(fmt.Sprintf(endpoint, url.QueryEscape(name), w.apiKey))\n\tif err != nil {\n\t\treturn Weather{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == http.StatusNotFound {\n\t\treturn Weather{}, errors.New(\"city not found\")\n\t}\n\n\tvar apiResp apiResponse\n\terr = json.NewDecoder(resp.Body).Decode(&apiResp)\n\tif err != nil {\n\t\treturn Weather{}, err\n\t}\n\n\tvar forecast Weather\n\tforecast.Temperature = apiResp.Main.Temp\n\n\tfor _, w := range apiResp.Weather {\n\t\tforecast.Description = w.Description\n\t\tbreak // only interested in first result\n\t}\n\n\treturn forecast, nil\n}", "title": "" }, { "docid": "adfe5b5f47acdeda099255b770f9973e", "score": "0.6085442", "text": "func City(city, country string) *Config {\n\treturn &Config{query: fmt.Sprintf(\"%s/%s\", country, city)}\n}", "title": "" }, { "docid": "45b4dc4cfa78fd0266f9fc6cda2d90a1", "score": "0.604061", "text": "func GetCities(accessToken string, provinceCode string) ([]definitions.City, error) {\n\tresponse, err := SimpleGet(constant.BaseURI, constant.CommonGetCity, \"?access_token=\", accessToken, \"&province=\", provinceCode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !response.NoError {\n\t\treturn nil, errors.New(response.Error)\n\t}\n\tvar cityArr []map[string]string\n\tif err := json.Unmarshal(response.OriginalBytes, &cityArr); err != nil {\n\t\treturn nil, err\n\t}\n\tvar cities []definitions.City\n\tfor _, city := range cityArr {\n\t\tfor key, value := range city {\n\t\t\tcities = append(cities, definitions.City{CityCode: key, CityName: value})\n\t\t}\n\t}\n\treturn cities, nil\n}", "title": "" }, { "docid": "b82d334574e779dbabd75408a79c62a2", "score": "0.603321", "text": "func GetCitiesByState(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcdCountry := params[\"cd_country\"]\n\tcdState := params[\"cd_state\"]\n\tvar state State\n\n\ts := GetMongoSession()\n\tdefer s.Close()\n\n\tc := s.DB(\"airports\").C(\"cities\")\n\tquery := bson.M{\"$and\": []bson.M{\n\t\tbson.M{\"cd_country\": cdCountry},\n\t\tbson.M{\"cd_state\": cdState},\n\t}}\n\terr := c.Find(query).One(&state)\n\tif err != nil {\n\t\tif err != mgo.ErrNotFound {\n\t\t\tpanic(err)\n\t\t}\n\t\tfmt.Println(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err = json.NewEncoder(w).Encode(state); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "397ef62a864f2ff18af52dfe28cbf2e9", "score": "0.59914595", "text": "func TestSearch__fedachCityOnlySearchRequest(t *testing.T) {\n\tu, _ := url.Parse(\"https://moov.io/fed/ach/search?city=CALDWELL\")\n\treq := readFEDSearchRequest(u)\n\tif req.City != \"CALDWELL\" {\n\t\tt.Errorf(\"req.City=%s\", req.City)\n\t}\n\tif !req.cityOnly() {\n\t\tt.Errorf(\"req is not city only\")\n\t}\n}", "title": "" }, { "docid": "219455dfa5a70dbabdb943741657f297", "score": "0.5978814", "text": "func TestSearch__fedwireCityOnlySearchRequest(t *testing.T) {\n\tu, _ := url.Parse(\"https://moov.io/fed/wire/search?city=IOWA City\")\n\treq := readFEDSearchRequest(u)\n\tif req.City != \"IOWA CITY\" {\n\t\tt.Errorf(\"req.City=%s\", req.City)\n\t}\n\tif !req.cityOnly() {\n\t\tt.Errorf(\"req is not city only\")\n\t}\n}", "title": "" }, { "docid": "a4a412b3a9585fc16e0b9ec4d597aae8", "score": "0.59626687", "text": "func City(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "bcb7ae27ef9b1c0f0db21239d4d1e62d", "score": "0.591924", "text": "func findcity(name string) City{\n\tvar city City\n\tapi_key := \"AIzaSyB3FzjaP3F-piuwV0mRdawQhX7R5ogJdx8\"\n\tstr := \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+name+\"&key=\"+api_key\n\tm, err := apicaller.Callapi(str)\n\tif (err != nil){\n\t\tfmt.Println(err)\n\t\treturn city\n\t}\n\tdecodecity(name, m, &city)\n\treturn city\n}", "title": "" }, { "docid": "dacc92ddc76570b3a59ffd92d5f9bcd7", "score": "0.5911079", "text": "func (c *Client) ByCityName(city string) (*OpenWeatherMap, error) {\n\treq, err := c.Request(http.MethodGet, \"/weather\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery := req.URL.Query()\n\tquery.Add(\"q\", city)\n\tquery.Add(\"APPID\", c.key)\n\treq.URL.RawQuery = query.Encode()\n\n\tvar weather OpenWeatherMap\n\t_, err = c.Do(req, &weather)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &weather, nil\n}", "title": "" }, { "docid": "e9ee1e1604d7283ffa140f93847d805f", "score": "0.5868403", "text": "func City(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "cd819bf493f4ea23b14c06141dea5ce2", "score": "0.5841544", "text": "func getCityOr404(db *gorm.DB, name string, w http.ResponseWriter, r *http.Request) *[]model.City {\n\tCities := []model.City{}\n\terr := db.Where(\"name_search LIKE ?\", \"%\"+name+\"%\").Find(&Cities).Error\n\n\tif err != nil {\n\t\trespondError(w, http.StatusNotFound, err.Error())\n\t\treturn nil\n\t}\n\treturn &Cities\n}", "title": "" }, { "docid": "a28da1da0722d14a9a1ea3ef4023d244", "score": "0.5835205", "text": "func GetCityInfo(u url.URL) (CityInfo, error) {\n\tvar ci CityInfo\n\n\tres, err := http.Get(u.String())\n\tif err != nil {\n\t\treturn ci, err\n\t}\n\tdefer res.Body.Close()\n\n\t// Parse the HTML document\n\tdoc, err := goquery.NewDocumentFromReader(res.Body)\n\tif err != nil {\n\t\treturn ci, err\n\t}\n\n\t// Find city and country\n\tdoc.Find(\".breadcrumb_link\").Each(func(i int, el *goquery.Selection) {\n\t\tnextContent, exists := el.Next().Attr(\"content\")\n\t\tif !exists {\n\t\t\treturn\n\t\t}\n\t\tif nextContent == \"2\" {\n\t\t\tci.Country = el.Children().First().Text()\n\t\t}\n\t\tif nextContent == \"3\" {\n\t\t\tci.City = el.Children().First().Text()\n\t\t}\n\t})\n\n\t// Find the monthly cost for a single person without rent\n\tdoc.Find(\".emp_number\").Each(func(i int, el *goquery.Selection) {\n\t\tif !strings.Contains(el.Parent().Text(), \"A single person estimated monthly costs\") {\n\t\t\treturn\n\t\t}\n\t\tel.Find(\".in_other_currency\").Remove()\n\t\tvalStr := getFloatString(el.Text())\n\t\tif ci.MonthlyCost, err = strconv.ParseFloat(valStr, 64); err != nil {\n\t\t\tlog.Printf(\"error parsing monthly cost for %s: %v\", u.String(), err)\n\t\t}\n\t})\n\n\t// Find rent prices and net salary\n\tdoc.Find(\".priceValue \").Each(func(i int, el *goquery.Selection) {\n\t\tvar varPtr *float64\n\t\tswitch {\n\t\tcase strings.Contains(el.Parent().Text(), \"Apartment (1 bedroom) in City Centre\"):\n\t\t\tvarPtr = &ci.SmallAptCentre\n\t\tcase strings.Contains(el.Parent().Text(), \"Apartment (1 bedroom) Outside of Centre\"):\n\t\t\tvarPtr = &ci.SmallAptOutside\n\t\tcase strings.Contains(el.Parent().Text(), \"Apartment (3 bedrooms) in City Centre\"):\n\t\t\tvarPtr = &ci.LargeAptCentre\n\t\tcase strings.Contains(el.Parent().Text(), \"Apartment (3 bedrooms) Outside of Centre\"):\n\t\t\tvarPtr = &ci.LargeAptOutside\n\t\tcase strings.Contains(el.Parent().Text(), \"Average Monthly Net Salary (After Tax)\"):\n\t\t\tvarPtr = &ci.NetSalary\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t\tvalStr := getFloatString(el.Text())\n\t\tif val, err := strconv.ParseFloat(valStr, 64); err == nil {\n\t\t\t*varPtr = val\n\t\t} else {\n\t\t\tlog.Printf(\"error parsing price for %s (original: %s): %v\", u.String(), el.Text(), err)\n\t\t}\n\t})\n\n\tci.MoneyAfterMonthlyCost = ci.NetSalary - ci.MonthlyCost\n\tci.MoneyAfterSmallAptCentre = ci.NetSalary - ci.SmallAptCentre\n\tci.MoneyAfterSmallAptOutside = ci.NetSalary - ci.SmallAptOutside\n\tci.MoneyAfterLargeAptCentre = ci.NetSalary - ci.LargeAptCentre\n\tci.MoneyAfterLargeAptOutside = ci.NetSalary - ci.LargeAptOutside\n\n\tci.MoneyAfterSmallAptCentreAndMonthlyCost = ci.MoneyAfterSmallAptCentre - ci.MonthlyCost\n\tci.MoneyAfterSmallAptOutsideAndMonthlyCost = ci.MoneyAfterSmallAptOutside - ci.MonthlyCost\n\tci.MoneyAfterLargeAptCentreAndMonthlyCost = ci.MoneyAfterLargeAptCentre - ci.MonthlyCost\n\tci.MoneyAfterLargeAptOutsideAndMonthlyCost = ci.MoneyAfterLargeAptOutside - ci.MonthlyCost\n\n\treturn ci, nil\n}", "title": "" }, { "docid": "7fe14cd8ee05fc6bc2c8e0b5cb7138bd", "score": "0.581953", "text": "func GetAllCities() ([]*dto.CityDTO, error) {\n\tcities := dal.GetAllCities()\n\treturn dto.CityDALToDTOArr(cities)\n}", "title": "" }, { "docid": "92411ee8c48817a904e38fc7607edcd5", "score": "0.58169234", "text": "func CityContains(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "8767fb9f79de06b96d9d8b4d477048c0", "score": "0.58045787", "text": "func (d *DB) Get_city(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, city)\n}", "title": "" }, { "docid": "72ec389408d99d4b402ad932da25b799", "score": "0.57839316", "text": "func Get_city(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, city))\n}", "title": "" }, { "docid": "0a84ba2d133d876892593d021330f0df", "score": "0.57526696", "text": "func City() string {\n\treturn cities[IntBetween(0, len(cities)-1)]\n}", "title": "" }, { "docid": "318940fb12ef5f872011f359f6c1ff3c", "score": "0.5676686", "text": "func (f *CityFilter) Filter(values url.Values, query *elastic.BoolQuery) error {\n\tdecoder := form.NewDecoder()\n\terr := decoder.Decode(f, values)\n\n\tif values.Get(\"city\") != \"\" {\n\t\tquery.Filter(elastic.NewTermQuery(\"properties.city\", f.City))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "93c51ea9ea4df55300b9c1d6dbaf65f6", "score": "0.5673619", "text": "func ParseCityList(contents []byte) engine.ParseResult{\n\tre := regexp.MustCompile(cityListRe)\n\tmatch := re.FindAllSubmatch(contents,-1)\n\tresult := engine.ParseResult{}\n\ti := 1;\n\tfor _,m := range match{\n\t\tresult.Items = append(result.Items,\"City \"+string(m[2]))\n\t\tresult.Requests = append(result.Requests,engine.Request{\n\t\t\tURL:string(m[1]),\n\t\t\tParserFunc:ParseCity,\n\t\t})\n\t\ti++\n\t\tif i == 10{\n\t\t\tbreak\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "49d3cf52411892aaedae993f377cee2e", "score": "0.5644141", "text": "func (c *Client) ClanSearch(params url.Values) (clans ClanSearchResult, err error) {\n\tvar b []byte\n\tpath := \"/clans\"\n\tif b, err = c.get(path, params); err == nil {\n\t\terr = json.Unmarshal(b, &clans)\n\t}\n\treturn\n}", "title": "" }, { "docid": "275bd7061993dfc2347c0b4c086bd783", "score": "0.56402725", "text": "func NewCityFilter() *CityFilter {\n\treturn &CityFilter{City: false}\n}", "title": "" }, { "docid": "1319eb1bbec5f594f1241d9a42b09096", "score": "0.56321174", "text": "func (client *Client) CategoriesSearch(request CategoriesSearchParam) (response CategoriesSearchResponse, err error) {\n\turl := fmt.Sprintf(\"/categories\")\n\n\tif err := client.query(url, &request, &response); err != nil {\n\t\treturn response, err\n\t}\n\treturn response, nil\n\n}", "title": "" }, { "docid": "cfdaa3c215c767bed7986415529cb8e3", "score": "0.5612277", "text": "func City() string {\n\treturn randomFrom(jsonData.Cities)\n}", "title": "" }, { "docid": "900041e2bb5264badf87488e63adf284", "score": "0.55719787", "text": "func (db *Db) GetCityData(countryISO string) ([]CityQuery, error) {\n\tvar cityData []CityQuery\n\t_, err := db.Client.Query(&cityData, `SELECT * FROM \"google_maps\".city WHERE country_iso_code LIKE ?`, countryISO)\n\treturn cityData, err\n}", "title": "" }, { "docid": "fbd10fa3f87737ae5044b99068801def", "score": "0.55639523", "text": "func CityContains(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "8e5cb1f0bc28ef269c81982d606a0611", "score": "0.55631196", "text": "func (a *CarHandler) SearchCar(c echo.Context) error {\n\n\tresListCar, err := a.CarUsecase.FetchByKeyword(c.Request().Context(), c.QueryParam(\"q\"))\n\n\tif err != nil {\n\t\treturn c.JSON(http.StatusOK, ResponseError{Message: err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, resListCar)\n}", "title": "" }, { "docid": "756621a7e3bdc84a53be21f97f604882", "score": "0.5525538", "text": "func (r *Reader) City(ipAddress net.IP) (*City, error) {\n\tif isCity&r.databaseType == 0 {\n\t\treturn nil, InvalidMethodError{\"City\", r.Metadata().DatabaseType}\n\t}\n\tvar city City\n\terr := r.mmdbReader.Lookup(ipAddress, &city)\n\treturn &city, err\n}", "title": "" }, { "docid": "d009e4707d195d5aba3174846359a2d8", "score": "0.55252314", "text": "func CityContains(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "2921171c7fb7bc9a4bfd6b8c26c1a319", "score": "0.5475125", "text": "func CityIn(vs ...string) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(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(FieldCity), v...))\n\t})\n}", "title": "" }, { "docid": "c463f8e526212a33c4702711a00820b6", "score": "0.547068", "text": "func CarsSearch(Myconn *adabas.Connection, vv string, mv string, cv string, limite uint64) CarList {\n\t// creating Read Request with MAP\n\treadRequest, cerr := Myconn.CreateMapReadRequest(&Carinfo{})\n\tif cerr != nil {\n\t\tfmt.Printf(\"CreateMapReadRequest() error=%v\\n\", cerr)\n\t}\n\t// Assigning query's fields\n\terr := readRequest.QueryFields(\"Vendor,Model,Color\")\n\tif err != nil {\n\t\tfmt.Printf(\"QueryFields() error=%v\\n\", err)\n\t}\n\treadRequest.Limit = limite\n\t// Performing the query ordered by NAME\n\tcherche := \"\"\n\tif vv != \"\" {\n\t\tcherche = cherche + \"Vendor=\" + vv\n\t\tif cv != \"\" || mv != \"\" {\n\t\t\tcherche = cherche + \" AND \"\n\t\t}\n\t}\n\tif mv != \"\" {\n\t\tcherche = cherche + \"Model=\" + mv\n\t\tif cv != \"\" {\n\t\t\tcherche = cherche + \" AND \"\n\t\t}\n\t}\n\tif cv != \"\" {\n\t\tcherche = cherche + \"Color=\" + cv\n\t}\n\tfmt.Printf(\"car search with :%v\\n\", cherche)\n\tresult, err := readRequest.ReadLogicalWith(cherche)\n\tif err != nil {\n\t\tfmt.Printf(\"ReadLogicalWith() error=%v\\n\", err)\n\t}\n\tvar carlist CarList\n\tcarlist.Vehicules = make([]*Carinfo, 0)\n\tfor _, v := range result.Data {\n\t\tcarlist.Vehicules = append(carlist.Vehicules, v.(*Carinfo))\n\t}\n\treturn carlist\n}", "title": "" }, { "docid": "d6b01335d9d8124d4b54ea08b91924a0", "score": "0.54568034", "text": "func Search(terms []string) Params {\n\treturn Params{make(url.Values), SearchURL}.Country(CN).Terms(terms)\n}", "title": "" }, { "docid": "a709de086d27effe3e697d4821bcb311", "score": "0.54486376", "text": "func (o *Workloadv1Location) SetCity(v string) {\n\to.City = &v\n}", "title": "" }, { "docid": "4012aa18afe22f51b3a1d07d42f6e585", "score": "0.54388887", "text": "func (w *webClient) Search(ctx context.Context, q *spb.SearchRequest) (*spb.SearchReply, error) {\n\tvar reply spb.SearchReply\n\treturn &reply, web.Call(w.addr, \"search\", q, &reply)\n}", "title": "" }, { "docid": "eae89a0c99f9b445e0d128d304cfc64e", "score": "0.54344565", "text": "func (m *Manager) GetProvinceCities(province string) []City {\n\tvar res []City\n\tq := fmt.Sprintf(\"SELECT %s FROM %s AS c WHERE province=?\",\n\t\tGetSelectFields(CityTableFull, \"c\"),\n\t\tCityTableFull,\n\t)\n\t_, err := m.GetRDbMap().Select(&res, q, province)\n\tassert.Nil(err)\n\treturn res\n}", "title": "" }, { "docid": "2f46a837955f15840a28650b17fea6b6", "score": "0.542788", "text": "func (b *GroupsEditBuilder) City(v int) *GroupsEditBuilder {\n\tb.Params[\"city\"] = v\n\treturn b\n}", "title": "" }, { "docid": "e8dc0c0c71b9b1eaa92ab0596457f553", "score": "0.54056257", "text": "func cityContains(cities [] *model.City, city *model.City) bool {\n\tfor _, c := range cities {\n\t\tif c == city {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a4b3435ada0c470af01ecc870b2ed322", "score": "0.5386105", "text": "func NewCity(name string) *City {\n\treturn &City{\n\t\tname: name,\n\t\tneighbours: make(map[Direction]*City),\n\t\tresidents: make(map[string]*Alien),\n\t}\n}", "title": "" }, { "docid": "44b7ec1c8c7732e96c628f20043b689a", "score": "0.53451914", "text": "func CityEQ(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "edb69b1b6274ea4b30739180d5466ebd", "score": "0.53305984", "text": "func (o *User) SetCity(v string) {\n\to.City = &v\n}", "title": "" }, { "docid": "82e515e6d62a4689242c589a8c184c12", "score": "0.532311", "text": "func (c *Client) Search(keyword string) ([]Movie, error) {\n\treturn []Movie{}, fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "b95cf259bc44d8ac25a639a8e5d28a34", "score": "0.5298882", "text": "func CityContainsFold(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "98c7f54064f17b18daea2cbf3efeb870", "score": "0.52952355", "text": "func WeatherAction(c *cli.Context) error {\n\n\tvar city string\n\tvar state string\n\n\tlocation, found := c.StringList(\"location\")\n\n\tif !found {\n\t\tcity = settings.Get(\"weather-city\")\n\t\tstate = settings.Get(\"weather-state\")\n\t} else {\n\t\tif len(location) < 1 || len(location) > 2 {\n\t\t\treturn cli.NewExitError(\"incomplete location name\", cli.ExitUsageError)\n\t\t}\n\n\t\tcity = strings.ToLower(location[0])\n\t\tif len(location) >= 2 {\n\t\t\tstate = strings.ToLower(location[1])\n\t\t}\n\n\t\tif longName, found := stateNames[state]; found {\n\t\t\tstate = longName\n\t\t}\n\n\t\tsettings.Set(\"weather-city\", city)\n\t\tsettings.Set(\"weather-state\", state)\n\t}\n\n\tif city == \"\" {\n\t\treturn cli.NewExitError(\"incomplete location name\", cli.ExitUsageError)\n\t}\n\n\tkeyValue := settings.Get(\"weather-api-key\")\n\tif keyValue == \"\" {\n\t\t// Get your own darn key\n\t\tkeyValue = \"fbd457b51b56eddf1644edefd591f89c\"\n\t\tsettings.Set(\"weather-api-key\", keyValue)\n\t}\n\n\tparms := url.QueryEscape(city+\",\"+state) + \"&appid=\" + keyValue + \"&units=imperial\"\n\turl := \"https://api.openweathermap.org/data/2.5/weather?q=\" + parms\n\n\tui.Log(ui.DebugLogger, \"URL: %s\", url)\n\n\tresponse, err := http.Get(url)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.StatusCode != 200 {\n\t\treturn errors.New(\"invalid request, \" + response.Status)\n\t}\n\n\tweather := Weather{}\n\tdata, _ := ioutil.ReadAll(response.Body)\n\tui.Log(ui.DebugLogger, \"Reply: %s, %s\", response.Status, string(data))\n\n\terr = json.Unmarshal(data, &weather)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt, _ := tables.New([]string{\"Item\", \"Value\"})\n\tif weather.Name != \"\" {\n\t\tt.AddRowItems(\"Name\", weather.Name)\n\t}\n\tif len(weather.Text) > 0 {\n\t\tt.AddRowItems(\"Summary\", weather.Text[0].Description)\n\t}\n\tt.AddRowItems(\"Temperature\", weather.Main.Temp)\n\tt.AddRowItems(\" Feels Like\", weather.Main.FeelsLike)\n\tt.AddRowItems(\" Minimum\", weather.Main.Minimum)\n\tt.AddRowItems(\" Maximum\", weather.Main.Maximum)\n\tt.AddRowItems(\"Wind Speed\", weather.Wind.Speed)\n\n\tif weather.Wind.Direction > 0.0 {\n\t\td := int((math.Round(weather.Wind.Direction / 22.5)))\n\t\twindDirections := []string{\"N\", \"NNE\", \"NE\", \"ENE\", \"E\", \"ESE\", \"SE\", \"SSE\", \"S\", \"SSW\", \"SW\", \"WSW\", \"W\", \"WNW\", \"NW\", \"NNW\", \"N\"}\n\t\tt.AddRowItems(\"Wind Direction\", windDirections[d])\n\t}\n\n\tt.AddRowItems(\"Pressure\", weather.Main.Pressure)\n\tt.AddRowItems(\"Humidity\", weather.Main.Humidity)\n\n\tt.Print(settings.Get(\"output-format\"))\n\n\treturn nil\n}", "title": "" }, { "docid": "8539c26f6e98c8374369261a509aef91", "score": "0.52923465", "text": "func (c *Client) Search(ctx context.Context, search string, opts *SearchOptions) ([]*Torrent, error) {\n\tif opts == nil {\n\t\topts = &SearchOptions{\n\t\t\tCategory: All,\n\t\t}\n\t}\n\tv := opts.Category.URLValue()\n\tv.Add(\"q\", search)\n\tpath := \"/q.php?\" + v.Encode()\n\treturn c.fetchTorrents(ctx, path)\n}", "title": "" }, { "docid": "af5b1e5b64f3d12ad2eec1ba9e5ec173", "score": "0.52779776", "text": "func CityIn(vs ...string) predicate.Delivery {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Delivery(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(FieldCity), v...))\n\t})\n}", "title": "" }, { "docid": "867e0910463b5efb12d5b213e347f109", "score": "0.525469", "text": "func (m *Manager) FindAllByCityID(id int64) CityInfo {\n\tc := CityInfo{}\n\te := m.GetRDbMap().SelectOne(&c,\n\t\tfmt.Sprintf(\n\t\t\t`SELECT \n\t\t\tc.name \t\t\tAS city_name,\n\t\t\tc.id \t\t\tAS city_id,\n\t\t\tp.name \t\t\tAS province_name,\n\t\t\tp.code \t\t\tAS province,\n\t\t\tcu.id \t\t\tAS country_id,\n\t\t\tcu.name \t\tAS country_name\n\n\t\t\tFROM %s AS c\n\t\t\tJOIN %s AS p ON c.province = p.name\n\t\t\tJOIN %s AS cu ON p.country_id = cu.id\n\t\t\twhere c.id=?`,\n\t\t\tCityTableFull,\n\t\t\tProvinceTableFull,\n\t\t\tCountryTableFull,\n\t\t),\n\t\tid,\n\t)\n\tassert.Nil(e)\n\treturn c\n}", "title": "" }, { "docid": "9957ee68779789609a383821c7baa51c", "score": "0.5253974", "text": "func NewCity(name string, weight float64, parent *Country) *City {\n\treturn &City{name, weight, parent}\n}", "title": "" }, { "docid": "2868e155f98832bb04cbb93d3d6a0341", "score": "0.5245688", "text": "func CityIn(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(FieldCity), v...))\n\t})\n}", "title": "" }, { "docid": "678442deed8ab98ad5d63a5b31be2387", "score": "0.523965", "text": "func (b *GroupsSearchBuilder) CityID(v int) *GroupsSearchBuilder {\n\tb.Params[\"city_id\"] = v\n\treturn b\n}", "title": "" }, { "docid": "391a7dc8c750de3c1c8a59447e349c2d", "score": "0.5238278", "text": "func (c Client) Search() search.Client {\n\treturn search.NewClient(c...)\n}", "title": "" }, { "docid": "ff2bd304bd1af7ccac80923a20c2aeff", "score": "0.52306515", "text": "func (o GetGatewayLocationDataOutput) City() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetGatewayLocationData) string { return v.City }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2d1bcb83d8c27480f3c1088aedb61e4e", "score": "0.5219477", "text": "func (c *Client) Search(term string) (*Response, error) {\n\thttpResp, err := c.sendRequest(\"GET\", term, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := &Response{}\n\n\tif httpResp.StatusCode == http.StatusOK {\n\t\tdefer httpResp.Body.Close()\n\t\tbody, err := ioutil.ReadAll(httpResp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\terr = json.Unmarshal(body, &result)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\t}\n\tvar ErrNotFound = errors.New(\"Error with status code \" + strconv.Itoa(httpResp.StatusCode))\n\treturn nil, ErrNotFound\n}", "title": "" }, { "docid": "bb90c599d3b2e53d22394a1d92a9f4ae", "score": "0.52131075", "text": "func (c *CseListCall) SiteSearch(siteSearch string) *CseListCall {\n\tc.urlParams_.Set(\"siteSearch\", siteSearch)\n\treturn c\n}", "title": "" }, { "docid": "35b30016368e8bc293677ebeead21edb", "score": "0.5186144", "text": "func (a *Address) City() string {\n\treturn a.faker.MustParse(\"address.city\")\n}", "title": "" }, { "docid": "a600a3e77cb30e683cda35252f5f78b6", "score": "0.5184324", "text": "func Search(w http.ResponseWriter, r *http.Request) {\n\tviewData := BaseViewData(w, r)\n\n\ttermMap := utils.GetSearchTermsForString(r.FormValue(\"q\"), true)\n\tterms := make([]string, len(termMap))\n\ti := 0\n\tfor term := range termMap {\n\t\tterms[i] = term\n\t\ti++\n\t}\n\n\tpageNumStr := \"1\"\n\tif len(r.FormValue(\"page\")) > 0 {\n\t\tpageNumStr = r.FormValue(\"page\")\n\t}\n\n\tpage, err := strconv.Atoi(pageNumStr)\n\tif err != nil {\n\t\tviewData.NotFound(w)\n\t\treturn\n\t}\n\t// Correct for the human readable format for page numbers used\n\t// by the client here\n\tpage = page - 1\n\n\tplaceID := -1\n\tif viewData.Session != nil {\n\t\tplaceID = viewData.Session.User.PlaceID\n\t}\n\n\tlistings := []models.Listing{}\n\tif len(terms) > 0 {\n\t\tlistings, err = models.DoSearchForTerms(Base.Db, terms, page, placeID)\n\t\tif err != nil {\n\t\t\tviewData.InternalError(w)\n\t\t\treturn\n\t\t}\n\t}\n\n\tnumPages := models.GetPageCountForTerms(Base.Db, terms, placeID)\n\n\tviewData.Data = searchViewData{\n\t\tListings: listings,\n\t\tQuery: r.FormValue(\"q\"),\n\t\tPage: page + 1,\n\t\tStartOffset: page*50 + 1,\n\t\tEndOffset: page*50 + len(listings),\n\t\tMaxTotal: numPages * 50,\n\t\tOutOf: numPages,\n\t}\n\tRenderView(w, \"search#search\", viewData)\n}", "title": "" }, { "docid": "9d4ddaeec4458cdebf02d7042d02ad31", "score": "0.5177427", "text": "func GetCitiesURLs() []url.URL {\n\tnumbeoURL := \"https://www.numbeo.com/cost-of-living/rankings_current.jsp\"\n\tres, err := http.Get(numbeoURL)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer res.Body.Close()\n\n\t// Parse the HTML document\n\tdoc, err := goquery.NewDocumentFromReader(res.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Find the URL of each city\n\tvar urls []url.URL\n\tdoc.Find(\".cityOrCountryInIndicesTable a\").Each(func(i int, el *goquery.Selection) {\n\t\thref, ok := el.Attr(\"href\")\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\thref += \"?displayCurrency=USD\"\n\t\tu, err := url.Parse(href)\n\t\tif err != nil {\n\t\t\tlog.Printf(`url.Parse(\"%s\") error: %v`, href, err)\n\t\t}\n\t\turls = append(urls, *u)\n\t})\n\n\treturn urls\n}", "title": "" }, { "docid": "7ddf2114c0ded73b905b45e92ce93028", "score": "0.51556206", "text": "func getCities () map[int32]*api.City {\n\tcities := make(map[int32]*api.City, 0)\n file, err := os.Open(viper.GetString(\"CITIES_PATH\"))\n if err != nil {\n fmt.Printf(\"%v\\n\", err)\n }\n defer file.Close()\n\n scanner := bufio.NewScanner(file)\n index := int32(1)\n for scanner.Scan() {\n \tcities[index] = &api.City{\n \t\tId: index,\n \t\tName: scanner.Text(),\n \t}\n \tindex++\n }\n\n if err := scanner.Err(); err != nil {\n fmt.Printf(\"%v\\n\", err)\n }\n\n return cities\n}", "title": "" }, { "docid": "197a090750b9a0baea373303d64b6e43", "score": "0.5151485", "text": "func DeleteCity(id int32) error {\n\treturn dal.DeleteCity(id)\n}", "title": "" }, { "docid": "f1fcf01a229d2a7be03f875eed3e0ab0", "score": "0.5145059", "text": "func KeywordSearch(t *testing.T, url string) (statusCode int, respBody []byte, err error) {\n\n\trespStatusCode, respBody, _ := GetResponseByGet(t, url)\n\treturn respStatusCode, respBody, nil\n}", "title": "" }, { "docid": "7fc97b786b6e70f52adefbdf4e547812", "score": "0.5134673", "text": "func (b *BreweryService) Search(query string) ([]*Brewery, *http.Response, error) {\n\t// Use default parameters as specified by API\n\treturn b.SearchOffsetLimit(query, 0, 25)\n}", "title": "" }, { "docid": "8be6afff7ad3deccd076b413a47d1201", "score": "0.5132377", "text": "func (d *Database) GetUserCities(userid int64) (map[int64]City, error) {\n\tvar c City\n\tvar cities map[int64]City = map[int64]City{}\n\tvar err error\n\tif rows, err := d.Query(fmt.Sprintf(`\n\t\tSELECT\n\t\t\tc.id AS id, c.name AS name\n\t\tFROM\n\t\t\tworkers AS w\n\t\tJOIN\n\t\t\tcities AS c\n\t\tON\n\t\t\tw.cityid=c.id\n\t\tWHERE\n\t\t\tw.userid=%d`,\n\t\tuserid)); err == nil {\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tif err = rows.Scan(&c.ID, &c.Name); err == nil {\n\t\t\t\tcities[c.ID] = c\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn cities, err\n}", "title": "" }, { "docid": "c966bb729ef1d89a97205c8c89c6090f", "score": "0.51318854", "text": "func (c *Content) Search(q string) {\n\tresults, err := c.api.Search(q, 20)\n\tif err != nil {\n\t\tlogrus.Error(\"Search failed: \", err.Error())\n\t} else {\n\t\tif results != nil {\n\t\t\tc.searchResults = results\n\t\t}\n\t}\n\tc.chanComplete <- ActionSearch\n\tlogrus.Debug(\"Content search copmlete\")\n\n}", "title": "" }, { "docid": "e2615c296a7c39dcffd730f65c84b0e9", "score": "0.5102196", "text": "func GetCity(id int32) (*dto.CityDTO, error) {\n\tc, err := dal.GetCity(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dto.CityDALToDTO(c)\n}", "title": "" }, { "docid": "35fd5f8d283a6be7d9117d7914674821", "score": "0.51008123", "text": "func CityContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "de0b0b84805716956a1474abfff1ffda", "score": "0.5079747", "text": "func (o *Workloadv1Location) GetCity() string {\n\tif o == nil || o.City == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.City\n}", "title": "" }, { "docid": "9871826472e2eef383b8b69cdc20346d", "score": "0.5076893", "text": "func (qiu *QueueItemUpdate) SetCity(c *City) *QueueItemUpdate {\n\treturn qiu.SetCityID(c.ID)\n}", "title": "" }, { "docid": "261c131402051e242b881f4384a9dde8", "score": "0.50731444", "text": "func Search(w http.ResponseWriter, r *http.Request) {\n\tq := r.URL.Query()\n\n\tif keywords, ok := q[\"keyword\"]; ok {\n\t\tsearch := keywords[0]\n\n\t\tproducts, err := lib.Search(search)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tbytes, err := helpers.JSONMarshal(products, true)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tfmt.Fprintf(w, \"%s\", bytes)\n\t}\n}", "title": "" }, { "docid": "09010f97a9d861f2a2ca96d578132179", "score": "0.5064574", "text": "func GetCitiesByPostalCode(postalCode string) ([]Cities, error) {\n\tcities := []Cities{}\n\n\turl := \"https://geo.api.gouv.fr/communes?codePostal=\" + postalCode + \"&fields=centre\"\n\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn cities, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbodyContent, _ := ioutil.ReadAll(resp.Body)\n\tvar foundCities communes\n\tjson.Unmarshal(bodyContent, &foundCities)\n\n\tfor _, v := range foundCities {\n\t\tcities = append(cities, Cities{\n\t\t\tName: v.Nom,\n\t\t\tLon: v.Centre.Coordinates[0],\n\t\t\tLat: v.Centre.Coordinates[1],\n\t\t})\n\t}\n\n\treturn cities, nil\n}", "title": "" }, { "docid": "45b1e8b826e69632f86c3a91b4102267", "score": "0.5059766", "text": "func (c *Client) SearchMovies(req *MovieSearchRequest) ([]Movie, error) {\n\tif req.Query == \"\" {\n\t\treturn nil, errors.New(\"Movie name is required to search\")\n\t}\n\tresp := new(SearchResponse)\n\terr := c.getJSON(moviesSearchAPI, req, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.TotalResults == 0 {\n\t\treturn nil, errors.New(\"Result not found\")\n\t}\n\treturn resp.Results[0:], nil\n}", "title": "" }, { "docid": "bc3231dd1584ee75ab84030cf0490c30", "score": "0.505942", "text": "func CityContainsFold(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "91346b85b98835b85eae2f191069a2bc", "score": "0.5047518", "text": "func NewCityStore(db sqlx.ExtContext, txer dataprovider.Txer) *CityStore {\n\treturn &CityStore{\n\t\tdb: db,\n\t\ttxer: txer,\n\t\ttableName: \"city\",\n\t}\n}", "title": "" }, { "docid": "acd3990a7f817d949d16740834ed033e", "score": "0.50397915", "text": "func (uc *UserCreate) SetCity(s string) *UserCreate {\n\tuc.mutation.SetCity(s)\n\treturn uc\n}", "title": "" }, { "docid": "437b956434baeea6636d00aa46315978", "score": "0.5038223", "text": "func (me *XsdGoPkgHasElem_City) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_City; 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": "fe31cca271536945c9b0f9f50e2e3f70", "score": "0.5034916", "text": "func GetWorldwideFlightsFromCity(req *models.Request) (*CountryResponse, error) {\n\turl := fmt.Sprintf(countryBaseURL, req.HomeCity, req.LeavingDay.Format(\"2006-01-02\"), req.ReturningDay.Format(\"2006-01-02\"), req.Travelers)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tvar payload CountryResponse\n\tif err = json.NewDecoder(res.Body).Decode(&payload); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &payload, nil\n}", "title": "" }, { "docid": "54d3d31cd1965cfd42dda19c3003da47", "score": "0.50218725", "text": "func (c *Client) Search(term string) ([]RantModel, error) {\n\turl := fmt.Sprintf(SEARCH_PATH, API, term, APP_VERSION)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar data SearchResponse\n\tjson.NewDecoder(res.Body).Decode(&data)\n\tif !data.Success && data.Error != \"\" {\n\t\treturn nil, errors.New(data.Error)\n\t}\n\treturn data.Rants, nil\n}", "title": "" }, { "docid": "a8e77e22d0a110035a593d508c0ac094", "score": "0.5021545", "text": "func (s SystemGoLaget) SiteSearch(query string) (response *[]SearchModel, err error) {\n\turl := fmt.Sprintf(\"https://api-extern.systembolaget.se/site/V2/Search/Site/?q=%v\", query)\n\tsearch := new(Search)\n\ts.JsonDecode(url, search)\n\tresponse = &search.SearchModel\n\treturn\n}", "title": "" }, { "docid": "0eb19b55d21b5bfcf9a219c86d04b788", "score": "0.50180626", "text": "func testCityReport(t *testing.T, c *TestContext) {\n\tt.Run(\"CityReport\", func(t *testing.T) {\n\t\ttestGetCityReport(t, c)\n\t})\n}", "title": "" }, { "docid": "c68f2b8df96ad142f571ac0c0571918e", "score": "0.5015184", "text": "func (req fedSearchRequest) cityOnly() bool {\n\treturn req.Name == \"\" && req.RoutingNumber == \"\" && req.City != \"\" &&\n\t\treq.State == \"\" && req.PostalCode == \"\"\n}", "title": "" }, { "docid": "87f3c5516ed1fb255f3035b7bbf47bb6", "score": "0.50085986", "text": "func (s *service) GetByCity(city string) (*Status, error) {\n\treturn s.adapter.GetByCity(city)\n}", "title": "" }, { "docid": "0d17e951fee3b00703afb5c03df3fd37", "score": "0.4996282", "text": "func (me *XsdGoPkgHasElems_City) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_City; 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": "c17b7125d309e7879e9d6f2d2922ecc2", "score": "0.49899775", "text": "func (qiuo *QueueItemUpdateOne) SetCity(c *City) *QueueItemUpdateOne {\n\treturn qiuo.SetCityID(c.ID)\n}", "title": "" }, { "docid": "603041fd745cf422236130c51d329a12", "score": "0.4986371", "text": "func (s *TagsService) Search(q string) ([]Tag, *ResponsePagination, error) {\n\tu := \"tags/search?q=\" + q\n\treq, err := s.client.NewRequest(\"GET\", u, \"\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttags := new([]Tag)\n\n\t_, err = s.client.Do(req, tags)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tpage := new(ResponsePagination)\n\tif s.client.Response.Pagination != nil {\n\t\tpage = s.client.Response.Pagination\n\t}\n\n\treturn *tags, page, err\n}", "title": "" }, { "docid": "9b682bfd4d6c5cc06858ec82093793f2", "score": "0.4981224", "text": "func SearchRecipes(ctx *context.Context) {\n\tq := ctx.FormTrim(\"q\")\n\n\topts := parseQuery(ctx.Package.Owner, q)\n\n\tresults, err := conan_model.SearchRecipes(ctx, opts)\n\tif err != nil {\n\t\tapiError(ctx, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tjsonResponse(ctx, http.StatusOK, &SearchResult{\n\t\tResults: results,\n\t})\n}", "title": "" }, { "docid": "eff0676f43165ee1af98cc76c6d88649", "score": "0.49741083", "text": "func UpdateCity(c *dto.CityDTO) (*dto.CityDTO, error) {\n\tcity, err := c.CityDTOToDAL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tupdatecity, err := dal.UpdateCity(city)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dto.CityDALToDTO(updatecity)\n}", "title": "" }, { "docid": "0d5d1522ebcbd1c7b7b7e6c81825abb1", "score": "0.49714935", "text": "func Search(options *Options, text string) []*Country {\n\tcontains := make([]*Country, 0)\n\n\tfor _, c := range countries {\n\t\tif options.Full && c.ExistsFull(strings.ToLower(text)) || options.CodeTwo && c.ExistsTwo(text) || options.CodeThree && c.ExistsThree(text) || options.Number && c.ExistsNum(text) {\n\t\t\tcontains = append(contains, c)\n\t\t}\n\t}\n\n\treturn contains\n}", "title": "" }, { "docid": "b2b2869ad26646de8bf8ad467aacd2e9", "score": "0.4970863", "text": "func (p *PositionModel) GetCityCompany(language string) *conf.Response {\n\tres := &conf.Response{}\n\trow, err := db.Query(CITYCOMPANY_SQL, \"%\" + language + \"%\")\n\tif err != nil {\n\t\tres.Code = 403\n\t\tres.Msg = \"query error, \" + err.Error()\n\t\treturn res\n\t}\n\tfor row.Next() {\n\t\tdata := conf.NameTo2Num{}\n\t\trow.Scan(&data.Name, &data.Num1, &data.Num2) // name 城市, num1 这个城市招聘数, num2 这个城市正在招聘的公司数\n\t\tres.Data = append(res.Data, data)\n\t}\n\tres.Code = 200\n\tres.Msg = \"success\"\n\treturn res\n}", "title": "" }, { "docid": "45c44b04f2a84c33ed734ce05d0983f7", "score": "0.4970303", "text": "func Search(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tl := logger.New(\"default\")\n\n\tquery := r.URL.Query().Get(\"q\")\n\tresults, err := catalog.SearchMulti(url.QueryEscape(query))\n\tif err != nil {\n\t\tl.Errorf(err.Error())\n\t\thttp.Error(w, \"HTTP 500 : Internal Server Error\", 500)\n\t\treturn\n\t}\n\tcontext := struct {\n\t\tTitle string\n\t\tQuery string\n\t\tResults tmdb.SearchMultiResult\n\t}{\n\t\t\"tvt.io\",\n\t\tquery,\n\t\tresults,\n\t}\n\tt := template.Must(template.ParseFiles(\n\t\t\"templates/search.html\",\n\t\t\"templates/partials/facebook.html\",\n\t\t\"templates/partials/footer.html\",\n\t\t\"templates/partials/javascript.html\",\n\t\t\"templates/partials/css.html\",\n\t))\n\tt.Execute(w, context)\n}", "title": "" }, { "docid": "03ccc2fbf8882a4df092d8bae9e0e6ea", "score": "0.49689916", "text": "func (tmdb *TMDb) SearchCompany(name string, options map[string]string) (*CompanySearchResults, error) {\n\tvar availableOptions = map[string]struct{}{\n\t\t\"page\": {}}\n\tvar companies CompanySearchResults\n\tsafeName := url.QueryEscape(name)\n\toptionsString := getOptionsString(options, availableOptions)\n\turi := fmt.Sprintf(\"%s/search/company?query=%s&api_key=%s%s\", baseURL, safeName, tmdb.apiKey, optionsString)\n\tresult, err := getTmdb(uri, &companies)\n\treturn result.(*CompanySearchResults), err\n}", "title": "" }, { "docid": "f3d845415026e663ce5c4581e06b40bc", "score": "0.4965183", "text": "func LoadCity(ctx context.Context, key int) (*sql.City, error) {\n\tvar c sql.City\n\n\tdata, err := Load(ctx, cityLoaderKey, strconv.Itoa(key))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, ok := data.(sql.City)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"wrong type: the expected type is %T but got %T\", c, data)\n\t}\n\n\treturn &c, nil\n}", "title": "" }, { "docid": "f52d73c3bf5f908ef1fa43e345e7f74d", "score": "0.49638832", "text": "func (ua *UserAddress) City() string {\n\treturn ua.CityName\n}", "title": "" }, { "docid": "344b314d7b80220390fac396b4b7140d", "score": "0.4963333", "text": "func CityEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCity), v))\n\t})\n}", "title": "" }, { "docid": "1f814a7e588600575a20f4888e2ba05f", "score": "0.4956535", "text": "func (data *Invasion) AllCities() []string {\n cities := make([]string, len(data.Map))\n\n i := 0\n for k := range data.Map {\n cities[i] = k\n i++\n }\n\n return cities\n}", "title": "" } ]
43d572777a657dda54282316ed37dc74
NewUpdateOption return new instance of UpdateOption
[ { "docid": "38c05652b82edf09db0e6f58c56c7853", "score": "0.743418", "text": "func NewUpdateOption(fn CompileUpdateFn) UpdateOption {\n\treturn &updateOptionImpl{fn: fn}\n}", "title": "" } ]
[ { "docid": "9071ec08face0ab479ed7efa5fd9d110", "score": "0.68993104", "text": "func Update() interface {\n\tOpenOption\n} {\n\treturn openUpdateOpt{}\n}", "title": "" }, { "docid": "9071ec08face0ab479ed7efa5fd9d110", "score": "0.68993104", "text": "func Update() interface {\n\tOpenOption\n} {\n\treturn openUpdateOpt{}\n}", "title": "" }, { "docid": "0ff71444910e7c7b0d3f5d1c2685b640", "score": "0.6552913", "text": "func NewUpdateOptions(optionFuncs ...UpdateOptionsFunc) UpdateOptions {\n\toptions := UpdateOptions{\n\t\tupdateName: false,\n\t\tupdateDescription: false,\n\t\tupdateLocalPrice: false,\n\t\tupdateRequestedInfo: false,\n\t}\n\tfor _, optionFunc := range optionFuncs {\n\t\toptionFunc(&options)\n\t}\n\treturn options\n}", "title": "" }, { "docid": "08b78f6c9175a6668a21e14357554b04", "score": "0.6333523", "text": "func NewUpdateOptions() *UpdateOptions {\n\treturn &UpdateOptions{ComponentOptions: &ComponentOptions{}}\n}", "title": "" }, { "docid": "e67dc3902f8303719014dc40a746dfd1", "score": "0.6174926", "text": "func (u *optionUsecase) Update(question domain.Option) (domain.Option, error) {\n\treturn u.optionRepository.Update(question)\n}", "title": "" }, { "docid": "31a7ad1828f66edbab5996ec70f06e42", "score": "0.61115944", "text": "func NewUpdate(appName string) *commander.CommandWrapper {\n\treturn &commander.CommandWrapper{\n\t\tHandler: &Update{},\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"update\",\n\t\t\tShortDescription: \"Update a stack\",\n\t\t\tLongDescription: `Update a stack with new parameters.`,\n\t\t\tArguments: \"custom-config\",\n\t\t\tExamples: []string{\"\", \"custom-config\"},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "33c421786eff23216fbf5067d4eb25a3", "score": "0.61002654", "text": "func (o *Option) update(ctx context.Context) (err error) {\n\tcols := []string{\n\t\t\"name\", \"code\", \"value\",\n\t}\n\n\tif _, err = factory.DB(ctx).ID(o.Id).Cols(cols...).Update(o); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "330aef60f68b777b69764060764d7b83", "score": "0.6094345", "text": "func (m Option) UpdateOption() error {\n\tc := newOptionCollection()\n\tdefer c.Close()\n\n\terr := c.Session.Update(bson.M{\n\t\t\"_id\": m.ID,\n\t}, bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"name\": m.Name, \"description\": m.Description, \"updatedAt\": time.Now()},\n\t})\n\treturn err\n}", "title": "" }, { "docid": "de3d6300bf91e74cd48d591d21edfde4", "score": "0.601158", "text": "func (*IamPolicyManagementV1) NewUpdatePolicyOptions(policyID string, ifMatch string, typeVar string, subjects []PolicySubject, roles []PolicyRole, resources []PolicyResource) *UpdatePolicyOptions {\n\treturn &UpdatePolicyOptions{\n\t\tPolicyID: core.StringPtr(policyID),\n\t\tIfMatch: core.StringPtr(ifMatch),\n\t\tType: core.StringPtr(typeVar),\n\t\tSubjects: subjects,\n\t\tRoles: roles,\n\t\tResources: resources,\n\t}\n}", "title": "" }, { "docid": "18542aec1009a68d04e8fae35886bb89", "score": "0.59086424", "text": "func NewUpdateCommand(parent common.Registerer, globals *config.Data) *UpdateCommand {\n\tvar c UpdateCommand\n\tc.Globals = globals\n\tc.manifest.File.SetOutput(c.Globals.Output)\n\tc.manifest.File.Read(manifest.Filename)\n\n\tc.CmdClause = parent.Command(\"update\", \"Update an FTP logging endpoint on a Fastly service version\")\n\n\tc.CmdClause.Flag(\"version\", \"Number of service version\").Required().IntVar(&c.Version)\n\tc.CmdClause.Flag(\"name\", \"The name of the FTP logging object\").Short('n').Required().StringVar(&c.EndpointName)\n\n\tc.CmdClause.Flag(\"service-id\", \"Service ID\").Short('s').StringVar(&c.manifest.Flag.ServiceID)\n\tc.CmdClause.Flag(\"new-name\", \"New name of the FTP logging object\").Action(c.NewName.Set).StringVar(&c.NewName.Value)\n\tc.CmdClause.Flag(\"address\", \"An hostname or IPv4 address\").Action(c.Address.Set).StringVar(&c.Address.Value)\n\tc.CmdClause.Flag(\"port\", \"The port number\").Action(c.Port.Set).UintVar(&c.Port.Value)\n\tc.CmdClause.Flag(\"username\", \"The username for the server (can be anonymous)\").Action(c.Username.Set).StringVar(&c.Username.Value)\n\tc.CmdClause.Flag(\"password\", \"The password for the server (for anonymous use an email address)\").Action(c.Password.Set).StringVar(&c.Password.Value)\n\tc.CmdClause.Flag(\"public-key\", \"A PGP public key that Fastly will use to encrypt your log files before writing them to disk\").Action(c.PublicKey.Set).StringVar(&c.PublicKey.Value)\n\tc.CmdClause.Flag(\"path\", \"The path to upload log files to. If the path ends in / then it is treated as a directory\").Action(c.Path.Set).StringVar(&c.Path.Value)\n\tc.CmdClause.Flag(\"period\", \"How frequently log files are finalized so they can be available for reading (in seconds, default 3600)\").Action(c.Period.Set).UintVar(&c.Period.Value)\n\tc.CmdClause.Flag(\"gzip-level\", \"What level of GZIP encoding to have when dumping logs (default 0, no compression)\").Action(c.GzipLevel.Set).Uint8Var(&c.GzipLevel.Value)\n\tc.CmdClause.Flag(\"format\", \"Apache style log formatting\").Action(c.Format.Set).StringVar(&c.Format.Value)\n\tc.CmdClause.Flag(\"format-version\", \"The version of the custom logging format used for the configured endpoint. Can be either 2 (the default, version 2 log format) or 1 (the version 1 log format). The logging call gets placed by default in vcl_log if format_version is set to 2 and in vcl_deliver if format_version is set to 1\").Action(c.FormatVersion.Set).UintVar(&c.FormatVersion.Value)\n\tc.CmdClause.Flag(\"response-condition\", \"The name of an existing condition in the configured endpoint, or leave blank to always execute\").Action(c.ResponseCondition.Set).StringVar(&c.ResponseCondition.Value)\n\tc.CmdClause.Flag(\"timestamp-format\", `strftime specified timestamp formatting (default \"%Y-%m-%dT%H:%M:%S.000\")`).Action(c.TimestampFormat.Set).StringVar(&c.TimestampFormat.Value)\n\tc.CmdClause.Flag(\"placement\", \"Where in the generated VCL the logging call should be placed, overriding any format_version default. Can be none or waf_debug\").Action(c.Placement.Set).StringVar(&c.Placement.Value)\n\tc.CmdClause.Flag(\"compression-codec\", `The codec used for compression of your logs. Valid values are zstd, snappy, and gzip. If the specified codec is \"gzip\", gzip_level will default to 3. To specify a different level, leave compression_codec blank and explicitly set the level using gzip_level. Specifying both compression_codec and gzip_level in the same API request will result in an error.`).Action(c.CompressionCodec.Set).StringVar(&c.CompressionCodec.Value)\n\n\treturn &c\n}", "title": "" }, { "docid": "fea49f836c68dd757bd956cc5e620477", "score": "0.5906893", "text": "func NewUpdate(appName string) *commander.CommandWrapper {\n\tctx := context.Background()\n\tclient, err := google.DefaultClient(ctx, dm.NdevCloudmanScope)\n\thandle.Error(err)\n\tu := Update{client: client, ctx: ctx}\n\treturn &commander.CommandWrapper{\n\t\tHandler: &u,\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"update\",\n\t\t\tShortDescription: \"Update updates a Google Deployment\",\n\t\t\tLongDescription: `Using a pre-configured yaml file, update a collection of resources using Deployment Manager Service.`,\n\t\t\tArguments: \"custom-config [-y]\",\n\t\t\tExamples: []string{\"\", \"custom-config\"},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6ec37cd6cda6163650dfea9d56edafc8", "score": "0.5889257", "text": "func NewCmdUpdate(name, fullName string) *cobra.Command {\n\tuo := NewUpdateOptions()\n\n\tvar updateCmd = &cobra.Command{\n\t\tUse: name,\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tShort: \"Update the source code path of a component\",\n\t\tLong: \"Update the source code path of a component\",\n\t\tExample: fmt.Sprintf(updateCmdExample, fullName),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgenericclioptions.GenericRun(uo, cmd, args)\n\t\t},\n\t}\n\tgenericclioptions.AddContextFlag(updateCmd, &uo.cmpCfgContext)\n\tupdateCmd.Flags().StringVarP(&uo.git, \"git\", \"g\", \"\", \"git source\")\n\tupdateCmd.Flags().StringVarP(&uo.local, \"local\", \"l\", \"\", \"Use local directory as a source for component.\")\n\tupdateCmd.Flags().StringVarP(&uo.ref, \"ref\", \"r\", \"\", \"Use a specific ref e.g. commit, branch or tag of the git repository\")\n\t// Add a defined annotation in order to appear in the help menu\n\tupdateCmd.Annotations = map[string]string{\"command\": \"component\"}\n\tupdateCmd.SetUsageTemplate(odoutil.CmdUsageTemplate)\n\n\t//Adding `--application` flag\n\tappCmd.AddApplicationFlag(updateCmd)\n\n\t//Adding `--project` flag\n\tprojectCmd.AddProjectFlag(updateCmd)\n\n\tcompletion.RegisterCommandFlagHandler(updateCmd, \"local\", completion.FileCompletionHandler)\n\tcompletion.RegisterCommandFlagHandler(updateCmd, \"binary\", completion.FileCompletionHandler)\n\tcompletion.RegisterCommandHandler(updateCmd, completion.ComponentNameCompletionHandler)\n\n\treturn updateCmd\n}", "title": "" }, { "docid": "6577db56e8c92b56d4f91948599c4526", "score": "0.5821739", "text": "func NewOption(raw interface{}) Option {\n\treturn Option{raw}\n}", "title": "" }, { "docid": "428348134c27a052ce0f1e00c7ec88c8", "score": "0.5805728", "text": "func NewUpdateCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *UpdateCommand {\n\tc := UpdateCommand{\n\t\tBase: cmd.Base{\n\t\t\tGlobals: g,\n\t\t},\n\t\tManifest: m,\n\t}\n\tc.CmdClause = parent.Command(\"update\", \"Update an HTTPS logging endpoint on a Fastly service version\")\n\n\t// Required.\n\tc.CmdClause.Flag(\"name\", \"The name of the HTTPS logging object\").Short('n').Required().StringVar(&c.EndpointName)\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagVersionName,\n\t\tDescription: cmd.FlagVersionDesc,\n\t\tDst: &c.ServiceVersion.Value,\n\t\tRequired: true,\n\t})\n\n\t// Optional.\n\tc.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{\n\t\tAction: c.AutoClone.Set,\n\t\tDst: &c.AutoClone.Value,\n\t})\n\tc.CmdClause.Flag(\"content-type\", \"Content type of the header sent with the request\").Action(c.ContentType.Set).StringVar(&c.ContentType.Value)\n\tcommon.Format(c.CmdClause, &c.Format)\n\tcommon.FormatVersion(c.CmdClause, &c.FormatVersion)\n\tc.CmdClause.Flag(\"header-name\", \"Name of the custom header sent with the request\").Action(c.HeaderName.Set).StringVar(&c.HeaderName.Value)\n\tc.CmdClause.Flag(\"header-value\", \"Value of the custom header sent with the request\").Action(c.HeaderValue.Set).StringVar(&c.HeaderValue.Value)\n\tc.CmdClause.Flag(\"json-format\", \"Enforces valid JSON formatting for log entries. Can be disabled 0, array of json (wraps JSON log batches in an array) 1, or newline delimited json (places each JSON log entry onto a new line in a batch) 2\").Action(c.JSONFormat.Set).StringVar(&c.JSONFormat.Value)\n\tcommon.MessageType(c.CmdClause, &c.MessageType)\n\tc.CmdClause.Flag(\"method\", \"HTTP method used for request. Can be POST or PUT. Defaults to POST if not specified\").Action(c.Method.Set).StringVar(&c.Method.Value)\n\tc.CmdClause.Flag(\"new-name\", \"New name of the HTTPS logging object\").Action(c.NewName.Set).StringVar(&c.NewName.Value)\n\tcommon.Placement(c.CmdClause, &c.Placement)\n\tc.CmdClause.Flag(\"request-max-bytes\", \"Maximum size of log batch, if non-zero. Defaults to 100MB\").Action(c.RequestMaxBytes.Set).IntVar(&c.RequestMaxBytes.Value)\n\tc.CmdClause.Flag(\"request-max-entries\", \"Maximum number of logs to append to a batch, if non-zero. Defaults to 10k\").Action(c.RequestMaxEntries.Set).IntVar(&c.RequestMaxEntries.Value)\n\tcommon.ResponseCondition(c.CmdClause, &c.ResponseCondition)\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagServiceIDName,\n\t\tDescription: cmd.FlagServiceIDDesc,\n\t\tDst: &c.Manifest.Flag.ServiceID,\n\t\tShort: 's',\n\t})\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tAction: c.ServiceName.Set,\n\t\tName: cmd.FlagServiceName,\n\t\tDescription: cmd.FlagServiceDesc,\n\t\tDst: &c.ServiceName.Value,\n\t})\n\tcommon.TLSCACert(c.CmdClause, &c.TLSCACert)\n\tcommon.TLSClientCert(c.CmdClause, &c.TLSClientCert)\n\tcommon.TLSClientKey(c.CmdClause, &c.TLSClientKey)\n\tcommon.TLSHostname(c.CmdClause, &c.TLSHostname)\n\tc.CmdClause.Flag(\"url\", \"URL that log data will be sent to. Must use the https protocol\").Action(c.URL.Set).StringVar(&c.URL.Value)\n\treturn &c\n}", "title": "" }, { "docid": "450bf62af87113ef86a3b8e69d7b42a2", "score": "0.57086277", "text": "func (*CdToolchainV2) NewUpdateToolOptions(toolchainID string, toolID string) *UpdateToolOptions {\n\treturn &UpdateToolOptions{\n\t\tToolchainID: core.StringPtr(toolchainID),\n\t\tToolID: core.StringPtr(toolID),\n\t}\n}", "title": "" }, { "docid": "786c7ec65ec009e2593dfe8d59f9e273", "score": "0.5703469", "text": "func NewUpdateCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *UpdateCommand {\n\tc := UpdateCommand{\n\t\tBase: cmd.Base{\n\t\t\tGlobals: g,\n\t\t},\n\t\tmanifest: m,\n\t}\n\tc.CmdClause = parent.Command(\"update\", \"Update a Fastly service\")\n\n\t// Optional.\n\tc.CmdClause.Flag(\"comment\", \"Human-readable comment\").Action(c.comment.Set).StringVar(&c.comment.Value)\n\tc.CmdClause.Flag(\"name\", \"Service name\").Short('n').Action(c.name.Set).StringVar(&c.name.Value)\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tName: cmd.FlagServiceIDName,\n\t\tDescription: cmd.FlagServiceIDDesc,\n\t\tDst: &c.manifest.Flag.ServiceID,\n\t\tShort: 's',\n\t})\n\tc.RegisterFlag(cmd.StringFlagOpts{\n\t\tAction: c.serviceName.Set,\n\t\tName: cmd.FlagServiceName,\n\t\tDescription: cmd.FlagServiceDesc,\n\t\tDst: &c.serviceName.Value,\n\t})\n\treturn &c\n}", "title": "" }, { "docid": "a4eeb28a12cf6426c51ef9bde9487505", "score": "0.5698959", "text": "func NewCmdUpdate() (*cobra.Command, *Options) {\n\to := &Options{}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"update\",\n\t\tShort: \"Creates or Updates helm Chart CRDs from the helm Secrets\",\n\t\tLong: cmdLong,\n\t\tExample: fmt.Sprintf(cmdExample, rootcmd.BinaryName),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\terr := o.Run()\n\t\t\thelper.CheckErr(err)\n\t\t},\n\t}\n\n\tcmd.Flags().StringVarP(&o.WatchNamespace, \"namespace\", \"n\", \"\", \"The kubernetes namespace to look for helm Secrets\")\n\n\to.BaseOptions.AddBaseFlags(cmd)\n\treturn cmd, o\n}", "title": "" }, { "docid": "807a0e4253cb5fdb967a6429a34062b2", "score": "0.56947637", "text": "func NewUpdate(offset int64) UpdateConfig {\n\treturn UpdateConfig{\n\t\tOffset: offset,\n\t\tLimit: 0,\n\t\tTimeout: 0,\n\t}\n}", "title": "" }, { "docid": "b5921eeb77508a2e00fc25553f8a0a24", "score": "0.56860733", "text": "func NewUpdate(offset int) UpdateConfig {\n\treturn UpdateConfig{\n\t\tOffset: offset,\n\t\tLimit: 0,\n\t\tTimeout: 0,\n\t}\n}", "title": "" }, { "docid": "24bdfa468e1834fdf6ed3ca28c58b422", "score": "0.5568888", "text": "func (m *Message) UpdateOption(option Option) {\n\tm.Options.Update(option)\n}", "title": "" }, { "docid": "c3bd52da7b66c9afdac3ed7802ce868d", "score": "0.5562829", "text": "func NewCmdUpdate(updater Updater) *cobra.Command {\n\to := Options{}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"update\",\n\t\tShort: \"update project dependencies\",\n\t\tLong: `update project dependencies to minor versions`,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn nil\n\t\t},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\to.Execute(updater)\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "25f602c6eb3d53a8d4b2da94ad54e17f", "score": "0.55530137", "text": "func (*AssistantV1) NewUpdateExampleOptions(workspaceID string, intent string, text string) *UpdateExampleOptions {\n\treturn &UpdateExampleOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t\tIntent: core.StringPtr(intent),\n\t\tText: core.StringPtr(text),\n\t}\n}", "title": "" }, { "docid": "635415ac78297d9b7aa7418d0d661ba0", "score": "0.55176264", "text": "func (o *Option) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\toptionUpdateCacheMut.RLock()\n\tcache, cached := optionUpdateCache[key]\n\toptionUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\toptionAllColumns,\n\t\t\toptionPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update options, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"options\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, optionPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(optionType, optionMapping, append(wl, optionPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update options row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for options\")\n\t}\n\n\tif !cached {\n\t\toptionUpdateCacheMut.Lock()\n\t\toptionUpdateCache[key] = cache\n\t\toptionUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "eef792b5d3db6aa443ff2b3a6c1b0b6b", "score": "0.5512652", "text": "func NewUpdateCommand(ctx pwbook.Context) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"update [entry name]\",\n\t\tShort: \"Update password of an existing entry\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tkey := args[0]\n\n\t\t\tvalue, err := password.GenerateStrong()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tentry, err := ctx.Store.Update(key, value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tf := Formatter{\n\t\t\t\tName: \"updateTemplate\",\n\t\t\t\tTemplate: updateTemplate,\n\t\t\t\tOutput: ctx.Output,\n\t\t\t\tLocation: ctx.Location,\n\t\t\t}\n\t\t\treturn f.Write(entry)\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "50fcb9ea4091e5977e1f9722637dfe96", "score": "0.54612833", "text": "func PutUpdate() PutOptionFn {\n\treturn func(o *putOption) error {\n\t\to.isUpdate = true\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "87809ca705fd837a8cd10f37d979cd23", "score": "0.54214615", "text": "func (*AssistantV1) NewUpdateEntityOptions(workspaceID string, entity string) *UpdateEntityOptions {\n\treturn &UpdateEntityOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t\tEntity: core.StringPtr(entity),\n\t}\n}", "title": "" }, { "docid": "3399bc9dc0761629f6ea67c9c52553b6", "score": "0.5391703", "text": "func (*CdToolchainV2) NewUpdateToolchainOptions(toolchainID string) *UpdateToolchainOptions {\n\treturn &UpdateToolchainOptions{\n\t\tToolchainID: core.StringPtr(toolchainID),\n\t}\n}", "title": "" }, { "docid": "c60e096c4136233f14c4e79099dc99a7", "score": "0.5375979", "text": "func (xso *XSkuOption) Update(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !xso._exists {\n\t\treturn errors.New(\"update failed: does not exist\")\n\t}\n\n\t// if deleted, bail\n\tif xso._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `UPDATE x_showroom.x_sku_option SET ` +\n\t\t`sku_id = ?, prod_id = ?, option_id = ?, option_attr_id = ?, created_by = ?, updated_by = ?, created_at = ?, updated_at = ?` +\n\t\t` WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, xso.SkuID, xso.ProdID, xso.OptionID, xso.OptionAttrID, xso.CreatedBy, xso.UpdatedBy, xso.CreatedAt, xso.UpdatedAt, xso.ID)\n\t_, err = db.Exec(sqlstr, xso.SkuID, xso.ProdID, xso.OptionID, xso.OptionAttrID, xso.CreatedBy, xso.UpdatedBy, xso.CreatedAt, xso.UpdatedAt, xso.ID)\n\treturn err\n}", "title": "" }, { "docid": "e68f2815399cfdaaa9e87ccced38c246", "score": "0.5371667", "text": "func (*AssistantV1) NewUpdateIntentOptions(workspaceID string, intent string) *UpdateIntentOptions {\n\treturn &UpdateIntentOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t\tIntent: core.StringPtr(intent),\n\t}\n}", "title": "" }, { "docid": "17774f57f852281f956b5b7b4464b495", "score": "0.53080314", "text": "func (*IamPolicyManagementV1) NewUpdateRoleOptions(roleID string, ifMatch string) *UpdateRoleOptions {\n\treturn &UpdateRoleOptions{\n\t\tRoleID: core.StringPtr(roleID),\n\t\tIfMatch: core.StringPtr(ifMatch),\n\t}\n}", "title": "" }, { "docid": "bd27e51335a671ae88d09c253a7413b7", "score": "0.5300817", "text": "func NewUpdate(version uint64, update *pb.ServerUpdate) *Update {\n\treturn &Update{version, update}\n}", "title": "" }, { "docid": "a1f72b8137982f0bce805f8d37ebf0a9", "score": "0.5277009", "text": "func NewUpdate(n sql.Node, updateExprs []sql.Expression) *Update {\n\treturn &Update{n, updateExprs}\n}", "title": "" }, { "docid": "190ead8fb78458d39295df0c548b69ae", "score": "0.52761203", "text": "func (i User) GetUpdateOptions() (o UserUpdateOptions) {\n\to.Username = i.Username\n\to.Restricted = copyBool(&i.Restricted)\n\n\treturn\n}", "title": "" }, { "docid": "5f75d5301ad80ef6fd8d48dd1d9d082d", "score": "0.52448475", "text": "func UpdateOptions() (string, time.Duration, *http.Transport) {\n\treturn siegfried.updateURL, siegfried.updateTimeout, siegfried.updateTransport\n}", "title": "" }, { "docid": "8d0c63b96f3636217b8089b82c378332", "score": "0.5240069", "text": "func (l LKEClusterPool) GetUpdateOptions() (o LKEClusterPoolUpdateOptions) {\n\to.Count = l.Count\n\treturn\n}", "title": "" }, { "docid": "f5015d1ce6f4b934ab4e255dc7eb0644", "score": "0.5236136", "text": "func (a *Configuration) Update(cmd *cobra.Command) error {\n\treturn a.Root.Configure(cmd)\n}", "title": "" }, { "docid": "aaeadd3696c34024f20b5efe65a0b21b", "score": "0.5219845", "text": "func (c *AddonUpgradePolicyClient) Update() *AddonUpgradePolicyUpdateRequest {\n\treturn &AddonUpgradePolicyUpdateRequest{\n\t\ttransport: c.transport,\n\t\tpath: c.path,\n\t}\n}", "title": "" }, { "docid": "bb599d86f025bea5a8b94b2ccc9c26a9", "score": "0.5216695", "text": "func newUpdateInstanceUpdateRequest(ctx context.Context, f *Instance, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "16868a3dfb2900ad51f975c50f96a026", "score": "0.5183182", "text": "func UpdateRow(update UpdateRowImpl) Option {\n\treturn func(plugin *Plugin) {\n\t\tplugin.update = update\n\t}\n}", "title": "" }, { "docid": "294cbf29fc0f17e52fa3faf8b4b72a46", "score": "0.51829654", "text": "func (d *Driver) GetDriverUpdateOptions(ctx context.Context) (driverFlag *types.DriverFlags, err error) {\n\tlogrus.Infof(\"dummy driver GetDriverUpdateOptions\")\n\n\tdriverFlag = &types.DriverFlags{\n\t\tOptions: make(map[string]*types.Flag),\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7e2ad2428bf35f9ac94b8294b499d700", "score": "0.51718444", "text": "func UpdateCommand() *cobra.Command {\n\treturn updateCmd\n}", "title": "" }, { "docid": "8bdec4a4a8f561016e25b47faab5f6e5", "score": "0.51676834", "text": "func NewProposalUpdateOperation() *ProposalUpdateOperation {\n\ttx := ProposalUpdateOperation{\n\t\tExtensions: types.Extensions{},\n\t}\n\treturn &tx\n}", "title": "" }, { "docid": "c3f0cddd885af639f5fcfbe3a7fcd328", "score": "0.5145147", "text": "func (a *V1ItemsApiService) CreateModifierOption(ctx context.Context, body V1ModifierOption, locationId string, modifierListId string) (V1ModifierOption, *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 V1ModifierOption\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"location_id\"+\"}\", fmt.Sprintf(\"%v\", locationId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"modifier_list_id\"+\"}\", fmt.Sprintf(\"%v\", modifierListId), -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 == 200 {\n\t\t\tvar v V1ModifierOption\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": "ba6967a2562e6404c32c18e1ed8884d8", "score": "0.51424354", "text": "func updateFlagsToOptions(interactive, skipPreview, yes bool) (backend.UpdateOptions, error) {\n\tif !interactive && !yes {\n\t\treturn backend.UpdateOptions{},\n\t\t\terrors.New(\"--yes must be passed in non-interactive mode\")\n\t}\n\n\treturn backend.UpdateOptions{\n\t\tAutoApprove: yes,\n\t\tSkipPreview: skipPreview,\n\t}, nil\n}", "title": "" }, { "docid": "daa105c9d6859585015507c2c5766add", "score": "0.5140313", "text": "func NewUpdate(updates ...bsoncore.Document) *Update {\n\treturn &Update{\n\t\tupdates: updates,\n\t}\n}", "title": "" }, { "docid": "f986f35e077a39411a8f0713d543dbd0", "score": "0.513072", "text": "func NewUpdate(adminGroup IBXAdminGroup, returnFields []string) *api.BaseAPI {\n\treference := \"/\" + adminGroup.Reference + \"?_return_fields=\" + strings.Join(returnFields, \",\")\n\tupdateAdminGroupAPI := api.NewBaseAPI(http.MethodPut, wapiVersion+reference, adminGroup, new(IBXAdminGroup))\n\treturn updateAdminGroupAPI\n}", "title": "" }, { "docid": "0450298dc14d999b108e435405bea0e0", "score": "0.511493", "text": "func UpdateLookupOption(r *http.Request) *services.Response {\n\tlookupOptionID := chi.URLParam(r, \"lookup_option_id\")\n\tlookupOptionIDColumn := fmt.Sprintf(\"%s.id\", models.TableCoreLkpOptions)\n\tcondition := builder.Equal(lookupOptionIDColumn, lookupOptionID)\n\tlookupOption := models.LookupOption{\n\t\tID: lookupOptionID,\n\t}\n\n\treturn services.Update(r, &lookupOption, \"UpdateLookupOption\", models.TableCoreLkpOptions, condition)\n}", "title": "" }, { "docid": "91f1dd2d46bb34626fd0ce6e994cb4b3", "score": "0.51046443", "text": "func NewDelete(id string) *Update {\n\treturn &Update{\n\t\tobj: &pb.ServerUpdate{\n\t\t\tId: id,\n\t\t\tRemoved: true,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b35836c10b569d08fa576fa42ad0c22a", "score": "0.5088743", "text": "func NewUpdatePolicy()(*UpdatePolicy) {\n m := &UpdatePolicy{\n Entity: *ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "a22babfc52dd2809757b4e2c38a2b7a5", "score": "0.50848854", "text": "func Update(updateOption UpdateOption) {\n\tif instance == nil {\n\t\treturn\n\t}\n\tvar err error\n\tswitch updateOption.Type {\n\tcase Duration:\n\t\terr = instance.client.TimingDuration(formatter(updateOption), updateOption.Duration, instance.sampleRate)\n\tcase Gauge:\n\t\terr = instance.client.Gauge(formatter(updateOption), int64(updateOption.NumValue), instance.sampleRate)\n\tcase Count:\n\t\terr = instance.client.Inc(formatter(updateOption), 1, instance.sampleRate)\n\t}\n\tif err != nil {\n\t\tlogger.Errorf(\"metrics.Update got an error: %s\", err)\n\t}\n}", "title": "" }, { "docid": "599bc4ab67e65acd5effc04a150c2ebb", "score": "0.507719", "text": "func NewUpdateBuilder() *UpdateBuilder {\n\treturn &UpdateBuilder{}\n}", "title": "" }, { "docid": "95bd9bcf88faadd258c365b094f1d760", "score": "0.50767887", "text": "func (d *Driver) GetDriverUpdateOptions(ctx context.Context) (*types.DriverFlags, error) {\n\tdriverFlag := types.DriverFlags{\n\t\tOptions: make(map[string]*types.Flag),\n\t}\n\tdriverFlag.Options[\"node-count\"] = &types.Flag{\n\t\tType: types.IntType,\n\t\tUsage: \"The node number for your cluster to update. 0 means no updates\",\n\t}\n\tdriverFlag.Options[\"master-version\"] = &types.Flag{\n\t\tType: types.StringType,\n\t\tUsage: \"The kubernetes master version to update\",\n\t}\n\tdriverFlag.Options[\"node-version\"] = &types.Flag{\n\t\tType: types.StringType,\n\t\tUsage: \"The kubernetes node version to update\",\n\t}\n\tdriverFlag.Options[\"credential\"] = &types.Flag{\n\t\tType: types.StringType,\n\t\tPassword: true,\n\t\tUsage: \"The contents of the GC credential file\",\n\t}\n\treturn &driverFlag, nil\n}", "title": "" }, { "docid": "4fd8051954342776386a5d4a08d40b35", "score": "0.50748825", "text": "func New(ctx context.Context, opts *Options) (*Updater, error) {\n\tif opts.Store == nil {\n\t\treturn nil, errors.New(\"updater: no Store implementation provided\")\n\t}\n\tif opts.Client == nil {\n\t\treturn nil, errors.New(\"updater: no http.Client provided\")\n\t}\n\n\tu := &Updater{\n\t\tstore: opts.Store,\n\t\tlocker: opts.Locker,\n\t\tclient: opts.Client,\n\t\tconfigs: opts.Configs,\n\t\tfactories: opts.Factories,\n\t}\n\n\tif opts.Locker == nil {\n\t\tzlog.Warn(ctx).Msg(\"no locker passed, using process-local locking\")\n\t\tu.locker = newLocalLocker()\n\t}\n\tif opts.Configs == nil {\n\t\tzlog.Info(ctx).Msg(\"no updater configuration passed\")\n\t\tu.configs = make(driver.Configs)\n\t}\n\tif opts.Factories == nil {\n\t\tzlog.Warn(ctx).Msg(\"no updater factories provided, this may be a misconfiguration\")\n\t}\n\n\t_, file, line, _ := runtime.Caller(1)\n\truntime.SetFinalizer(u, func(u *Updater) {\n\t\tpanic(fmt.Sprintf(\"%s:%d: Updater not closed\", file, line))\n\t})\n\treturn u, nil\n}", "title": "" }, { "docid": "d3563724f35b302f68862e8647ab3c24", "score": "0.5074643", "text": "func (*SatelliteLinkV1) NewUpdateEndpointsOptions(locationID string, endpointID string) *UpdateEndpointsOptions {\n\treturn &UpdateEndpointsOptions{\n\t\tLocationID: core.StringPtr(locationID),\n\t\tEndpointID: core.StringPtr(endpointID),\n\t}\n}", "title": "" }, { "docid": "97de5e9296f330f92a772f46fdebd475", "score": "0.506935", "text": "func NewAddUpdateOpts(key string, endpoint Endpoint, opts ...clientv3.OpOption) *UpdateWithOpts {\n\treturn &UpdateWithOpts{Update: Update{Op: Add, Key: key, Endpoint: endpoint}, Opts: opts}\n}", "title": "" }, { "docid": "d8a66cccc91b367698b1a9fffcf17c04", "score": "0.5067377", "text": "func (c *FakeAwsDbOptionGroups) Update(awsDbOptionGroup *aws_v1.AwsDbOptionGroup) (result *aws_v1.AwsDbOptionGroup, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(awsdboptiongroupsResource, c.ns, awsDbOptionGroup), &aws_v1.AwsDbOptionGroup{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*aws_v1.AwsDbOptionGroup), err\n}", "title": "" }, { "docid": "ff7f9a18ae17d0c3c9f84af43646cfc3", "score": "0.5064885", "text": "func (*AssistantV1) NewUpdateDialogNodeOptions(workspaceID string, dialogNode string) *UpdateDialogNodeOptions {\n\treturn &UpdateDialogNodeOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t\tDialogNode: core.StringPtr(dialogNode),\n\t}\n}", "title": "" }, { "docid": "6a4d9cda28331d99e6ea0fabbb6a182a", "score": "0.5063693", "text": "func New(options ...OptionApplyer) *OptionItem {\n\tdefaultOpt := &OptionItem{}\n\tfor _, opt := range options {\n\t\topt.apply(defaultOpt)\n\t}\n\treturn defaultOpt\n}", "title": "" }, { "docid": "64e86ff2ebe3670127be0154c48fcc90", "score": "0.5062829", "text": "func (a *V1ItemsApiService) UpdateModifierOption(ctx context.Context, body V1ModifierOption, locationId string, modifierListId string, modifierOptionId string) (V1ModifierOption, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue V1ModifierOption\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"location_id\"+\"}\", fmt.Sprintf(\"%v\", locationId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"modifier_list_id\"+\"}\", fmt.Sprintf(\"%v\", modifierListId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"modifier_option_id\"+\"}\", fmt.Sprintf(\"%v\", modifierOptionId), -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 == 200 {\n\t\t\tvar v V1ModifierOption\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": "ec21af434c4d10c86dc8ad3f16d03a96", "score": "0.5052765", "text": "func New(l logger, c client.GitClient, cfgs *config.RepoConfiguration, opts ...updaterFunc) *Updater {\n\tu := &Updater{gitClient: c, configs: cfgs, nameGenerator: names.New(timeSeed), log: l}\n\tfor _, o := range opts {\n\t\to(u)\n\t}\n\treturn u\n}", "title": "" }, { "docid": "ef11dad117f10133c79e1cd65d929abc", "score": "0.5044966", "text": "func (f filter) Update(m map[string]interface{}) Op {\n\treturn f.UpdateWithOptions(m, Options{})\n}", "title": "" }, { "docid": "90c2de75fca776443914a580c53ff4ff", "score": "0.5034297", "text": "func (d *Driver) GetDriverUpdateOptions(ctx context.Context) (*types.DriverFlags, error) {\n\tdriverFlag := types.DriverFlags{\n\t\tOptions: make(map[string]*types.Flag),\n\t}\n\tdriverFlag.Options[\"num-of-nodes\"] = &types.Flag{\n\t\tType: types.IntType,\n\t\tUsage: \"The node number for your cluster to update. 0 means no updates\",\n\t}\n\treturn &driverFlag, nil\n}", "title": "" }, { "docid": "503252dc8ff31be9cf1e2bd03e217400", "score": "0.502225", "text": "func newUpdateInstanceUpdateInstanceRequest(ctx context.Context, f *Instance, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\tres := f\n\t_ = res\n\n\tif v := f.EnableStackdriverLogging; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"enableStackdriverLogging\"] = v\n\t}\n\tif v := f.EnableStackdriverMonitoring; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"enableStackdriverMonitoring\"] = v\n\t}\n\tif v := f.Labels; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"labels\"] = v\n\t}\n\tif v := f.Version; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"version\"] = v\n\t}\n\tif v := f.DataprocServiceAccount; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"dataprocServiceAccount\"] = v\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "fc18bd4bbb54dec488b65af7525b104d", "score": "0.50201327", "text": "func (o *RoleMenuOption) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\troleMenuOptionUpdateCacheMut.RLock()\n\tcache, cached := roleMenuOptionUpdateCache[key]\n\troleMenuOptionUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\troleMenuOptionAllColumns,\n\t\t\troleMenuOptionPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update role_menu_options, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"role_menu_options\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, roleMenuOptionPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(roleMenuOptionType, roleMenuOptionMapping, append(wl, roleMenuOptionPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update role_menu_options row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for role_menu_options\")\n\t}\n\n\tif !cached {\n\t\troleMenuOptionUpdateCacheMut.Lock()\n\t\troleMenuOptionUpdateCache[key] = cache\n\t\troleMenuOptionUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "45c0f5dd66a190b6743049a9eef14243", "score": "0.5005873", "text": "func (client *Client) UpdateVpcGatewayEndpointAttributeWithOptions(request *UpdateVpcGatewayEndpointAttributeRequest, runtime *util.RuntimeOptions) (_result *UpdateVpcGatewayEndpointAttributeResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.ClientToken)) {\n\t\tquery[\"ClientToken\"] = request.ClientToken\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DryRun)) {\n\t\tquery[\"DryRun\"] = request.DryRun\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.EndpointDescription)) {\n\t\tquery[\"EndpointDescription\"] = request.EndpointDescription\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.EndpointId)) {\n\t\tquery[\"EndpointId\"] = request.EndpointId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.EndpointName)) {\n\t\tquery[\"EndpointName\"] = request.EndpointName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PolicyDocument)) {\n\t\tquery[\"PolicyDocument\"] = request.PolicyDocument\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.RegionId)) {\n\t\tquery[\"RegionId\"] = request.RegionId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UpdateVpcGatewayEndpointAttribute\"),\n\t\tVersion: tea.String(\"2016-04-28\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &UpdateVpcGatewayEndpointAttributeResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "1a5314e83e9da9b2fc55381624ea7b9b", "score": "0.49924734", "text": "func NewRoleUpdateCmd() *cobra.Command {\n\troleUpdateCmd := &cobra.Command{\n\t\tUse: \"update\",\n\t\tShort: \"Update one or more Karavi roles\",\n\t\tLong: `Updates one or more Karavi roles`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tctx, cancel := context.WithCancel(context.Background())\n\t\t\tdefer cancel()\n\n\t\t\toutFormat := \"failed to update role: %+v\\n\"\n\n\t\t\troleFlags, err := cmd.Flags().GetStringSlice(\"role\")\n\t\t\tif err != nil {\n\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(outFormat, err))\n\t\t\t}\n\n\t\t\tvar rff roles.JSON\n\t\t\tif len(roleFlags) == 0 {\n\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(outFormat, errors.New(\"no input\")))\n\t\t\t}\n\n\t\t\tfor _, v := range roleFlags {\n\t\t\t\tt := strings.Split(v, \"=\")\n\n\t\t\t\tnewrole, err := roles.NewInstance(t[0], t[1:]...)\n\t\t\t\tif err != nil {\n\t\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(outFormat, err))\n\t\t\t\t}\n\t\t\t\terr = rff.Add(newrole)\n\t\t\t\tif err != nil {\n\t\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(outFormat, err))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\texistingRoles, err := GetRoles()\n\t\t\tif err != nil {\n\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(outFormat, err))\n\t\t\t}\n\n\t\t\tfor _, rls := range rff.Instances() {\n\t\t\t\tif existingRoles.Get(rls.RoleKey) == nil {\n\t\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(\"%s role does not exist. Try create command\", rls.Name))\n\t\t\t\t}\n\n\t\t\t\terr = validateRole(ctx, rls)\n\t\t\t\tif err != nil {\n\t\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(\"%s failed validation: %+v\", rls.Name, err))\n\t\t\t\t}\n\n\t\t\t\terr = existingRoles.Remove(rls)\n\t\t\t\tif err != nil {\n\t\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(\"%s failed to update: %+v\", rls.Name, err))\n\t\t\t\t}\n\t\t\t\terr := existingRoles.Add(rls)\n\t\t\t\tif err != nil {\n\t\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(\"adding %s failed: %+v\", rls.Name, err))\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err = modifyCommonConfigMap(existingRoles); err != nil {\n\t\t\t\treportErrorAndExit(JSONOutput, cmd.ErrOrStderr(), fmt.Errorf(outFormat, err))\n\t\t\t}\n\t\t},\n\t}\n\troleUpdateCmd.Flags().StringSlice(\"role\", []string{}, \"role in the form <name>=<type>=<id>=<pool>=<quota>\")\n\treturn roleUpdateCmd\n}", "title": "" }, { "docid": "2e061882e4797d717e09bd1f16bef882", "score": "0.49815267", "text": "func (rm *resourceManager) newUpdateRequestPayload(\n\tctx context.Context,\n\tr *resource,\n) (*svcsdk.ModifyClientVpnEndpointInput, error) {\n\tres := &svcsdk.ModifyClientVpnEndpointInput{}\n\n\tif r.ko.Spec.ClientConnectOptions != nil {\n\t\tf0 := &svcsdk.ClientConnectOptions{}\n\t\tif r.ko.Spec.ClientConnectOptions.Enabled != nil {\n\t\t\tf0.SetEnabled(*r.ko.Spec.ClientConnectOptions.Enabled)\n\t\t}\n\t\tif r.ko.Spec.ClientConnectOptions.LambdaFunctionARN != nil {\n\t\t\tf0.SetLambdaFunctionArn(*r.ko.Spec.ClientConnectOptions.LambdaFunctionARN)\n\t\t}\n\t\tres.SetClientConnectOptions(f0)\n\t}\n\tif r.ko.Status.ClientVPNEndpointID != nil {\n\t\tres.SetClientVpnEndpointId(*r.ko.Status.ClientVPNEndpointID)\n\t}\n\tif r.ko.Spec.ConnectionLogOptions != nil {\n\t\tf2 := &svcsdk.ConnectionLogOptions{}\n\t\tif r.ko.Spec.ConnectionLogOptions.CloudwatchLogGroup != nil {\n\t\t\tf2.SetCloudwatchLogGroup(*r.ko.Spec.ConnectionLogOptions.CloudwatchLogGroup)\n\t\t}\n\t\tif r.ko.Spec.ConnectionLogOptions.CloudwatchLogStream != nil {\n\t\t\tf2.SetCloudwatchLogStream(*r.ko.Spec.ConnectionLogOptions.CloudwatchLogStream)\n\t\t}\n\t\tif r.ko.Spec.ConnectionLogOptions.Enabled != nil {\n\t\t\tf2.SetEnabled(*r.ko.Spec.ConnectionLogOptions.Enabled)\n\t\t}\n\t\tres.SetConnectionLogOptions(f2)\n\t}\n\tif r.ko.Spec.Description != nil {\n\t\tres.SetDescription(*r.ko.Spec.Description)\n\t}\n\tif r.ko.Spec.DNSServers != nil {\n\t\tf4 := &svcsdk.DnsServersOptionsModifyStructure{}\n\t\tif r.ko.Spec.DNSServers.CustomDNSServers != nil {\n\t\t\tf4f0 := []*string{}\n\t\t\tfor _, f4f0iter := range r.ko.Spec.DNSServers.CustomDNSServers {\n\t\t\t\tvar f4f0elem string\n\t\t\t\tf4f0elem = *f4f0iter\n\t\t\t\tf4f0 = append(f4f0, &f4f0elem)\n\t\t\t}\n\t\t\tf4.SetCustomDnsServers(f4f0)\n\t\t}\n\t\tif r.ko.Spec.DNSServers.Enabled != nil {\n\t\t\tf4.SetEnabled(*r.ko.Spec.DNSServers.Enabled)\n\t\t}\n\t\tres.SetDnsServers(f4)\n\t}\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Spec.SecurityGroupIDs != nil {\n\t\tf6 := []*string{}\n\t\tfor _, f6iter := range r.ko.Spec.SecurityGroupIDs {\n\t\t\tvar f6elem string\n\t\t\tf6elem = *f6iter\n\t\t\tf6 = append(f6, &f6elem)\n\t\t}\n\t\tres.SetSecurityGroupIds(f6)\n\t}\n\tif r.ko.Spec.SelfServicePortal != nil {\n\t\tres.SetSelfServicePortal(*r.ko.Spec.SelfServicePortal)\n\t}\n\tif r.ko.Spec.ServerCertificateARN != nil {\n\t\tres.SetServerCertificateArn(*r.ko.Spec.ServerCertificateARN)\n\t}\n\tif r.ko.Spec.SplitTunnel != nil {\n\t\tres.SetSplitTunnel(*r.ko.Spec.SplitTunnel)\n\t}\n\tif r.ko.Spec.VPCID != nil {\n\t\tres.SetVpcId(*r.ko.Spec.VPCID)\n\t}\n\tif r.ko.Spec.VPNPort != nil {\n\t\tres.SetVpnPort(*r.ko.Spec.VPNPort)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "34c06e61729ddd2dace437729dfa4306", "score": "0.4971543", "text": "func NewUpdate(table string, updates map[string]interface{}, wheres map[string]interface{}) PreparedQuery {\n\tvar cols []string\n\tvar upds []string\n\tvar vals []interface{}\n\tfor upd, value := range updates {\n\t\tupds = append(upds, fmt.Sprintf(\"%s = ?\", upd))\n\t\tvals = append(vals, value)\n\t}\n\tfor col, where := range wheres {\n\t\tcols = append(cols, fmt.Sprintf(\"%s = ?\", col))\n\t\tvals = append(vals, where)\n\t}\n\treturn NewPreparedQuery(fmt.Sprintf(\"UPDATE %s SET %s WHERE %s\", table, strings.Join(upds, \", \"), strings.Join(cols, \" AND \")), vals...)\n}", "title": "" }, { "docid": "408b8b347573ae4e600352355a726259", "score": "0.4970962", "text": "func NewUpdateResource(ctx *middleware.Context, handler UpdateResourceHandler) *UpdateResource {\n\treturn &UpdateResource{Context: ctx, Handler: handler}\n}", "title": "" }, { "docid": "4ab0705cd846e7683389060d118b5f64", "score": "0.49623093", "text": "func (h *Handler) UpdateProductOption(ctx context.Context, req *proto.UpdateProductOptionRequest, rsp *proto.UpdateProductOptionResponse) error {\n\tshopID, err1 := shopkey.GetShopIDFrom(ctx, req.ShopId)\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\n\tif err := db.UpdateProductOption(shopID, req.Spu, req.Option); err != nil {\n\t\treturn errors.NotFound(svrName + \".UpdateProductOption\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba6250b429e42fe696c0573d68900e52", "score": "0.4942331", "text": "func createUpdateCommand(cb func(ccmd *cobra.Command, args []string), label string, desc string) *cobra.Command {\n\tccmd := &cobra.Command{\n\t\tUse: \"update [-f inputFile.yaml]\",\n\t\tShort: fmt.Sprintf(\"update a %s\", label),\n\t\tLong: desc,\n\t\tRun: cb,\n\t\tPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\terr := checkCommandHasIDInArgs(args, \"credential\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = checkInputFileDefined()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\taddInputFileFlag(ccmd)\n\treturn ccmd\n\n}", "title": "" }, { "docid": "60c6796c93765a54db51a52743b5fb72", "score": "0.49386433", "text": "func Update(client *gophercloud.ServiceClient, id string, opts os.UpdateOptsBuilder) UpdateResult {\n\treturn UpdateResult{os.Update(client, id, opts)}\n}", "title": "" }, { "docid": "e27d80b1766887d70a99cda19ed1d4fd", "score": "0.49266562", "text": "func (*MtlsV1) NewUpdateAccessPolicyOptions(zoneID string, appID string, policyID string) *UpdateAccessPolicyOptions {\n\treturn &UpdateAccessPolicyOptions{\n\t\tZoneID: core.StringPtr(zoneID),\n\t\tAppID: core.StringPtr(appID),\n\t\tPolicyID: core.StringPtr(policyID),\n\t}\n}", "title": "" }, { "docid": "62db4012dce8eb3b5ad5f35bb704a5c3", "score": "0.49239564", "text": "func (a *Client) UpdateVMAdvancedOptions(params *UpdateVMAdvancedOptionsParams, opts ...ClientOption) (*UpdateVMAdvancedOptionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateVMAdvancedOptionsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"UpdateVmAdvancedOptions\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/update-vm-advanced-options\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &UpdateVMAdvancedOptionsReader{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.(*UpdateVMAdvancedOptionsOK)\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 UpdateVmAdvancedOptions: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "e01c8840f624b878ceae7aca156298fe", "score": "0.49219066", "text": "func (s *Section) Update(option, value string) {\n\tif option == \"\" {\n\t\tpanic(ErrEmptyOption.Format(s.name))\n\t}\n\ts.opt[option] = value\n}", "title": "" }, { "docid": "dc46bd1eaa8c9d1b40b45ca97a9c2985", "score": "0.49213344", "text": "func newUpdateInfo(resp *omaha.Response, appID string) (*UpdateInfo, error) {\n\tif resp == nil {\n\t\treturn nil, errors.New(\"invalid omaha response\")\n\t}\n\tapp := resp.GetApp(appID)\n\tif app == nil {\n\t\treturn nil, errors.New(\"invalid omaha response and appID\")\n\t}\n\tif app.UpdateCheck == nil {\n\t\treturn nil, errors.New(\"omaha response is not a valid update check response\")\n\t}\n\n\tversion := \"\"\n\tif app.UpdateCheck.Manifest != nil {\n\t\tversion = app.UpdateCheck.Manifest.Version\n\t}\n\n\tvar packages []*omaha.Package\n\tif app.UpdateCheck.Manifest != nil && app.UpdateCheck.Manifest.Packages != nil {\n\t\tpackages = app.UpdateCheck.Manifest.Packages\n\t}\n\n\tvar urls []string\n\tif app.UpdateCheck.URLs != nil {\n\t\tfor _, url := range app.UpdateCheck.URLs {\n\t\t\turls = append(urls, url.CodeBase)\n\t\t}\n\t}\n\n\treturn &UpdateInfo{\n\t\tHasUpdate: app.Status == omaha.AppOK && app.UpdateCheck.Status == \"ok\",\n\t\tVersion: version,\n\t\tUpdateStatus: string(app.UpdateCheck.Status),\n\t\tAppID: appID,\n\t\tURLs: urls,\n\t\tPackages: packages,\n\t\tomahaResponse: resp,\n\t}, nil\n}", "title": "" }, { "docid": "1ef71dde6cc3d8512b056a7351e86b39", "score": "0.4910997", "text": "func (c *ToolClient) Update() *ToolUpdate {\n\tmutation := newToolMutation(c.config, OpUpdate)\n\treturn &ToolUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "181a4e32166e3f5e45c1090a099b6817", "score": "0.49072114", "text": "func (rm *resourceManager) newUpdateRequestPayload(\n\tctx context.Context,\n\tr *resource,\n) (*svcsdk.UpdateEndpointInput, error) {\n\tres := &svcsdk.UpdateEndpointInput{}\n\n\tif r.ko.Spec.EndpointConfigName != nil {\n\t\tres.SetEndpointConfigName(*r.ko.Spec.EndpointConfigName)\n\t}\n\tif r.ko.Spec.EndpointName != nil {\n\t\tres.SetEndpointName(*r.ko.Spec.EndpointName)\n\t}\n\tres.SetRetainAllVariantProperties(true)\n\n\treturn res, nil\n}", "title": "" }, { "docid": "3abb3b3d298a1ec2d0b020cb2587e6ba", "score": "0.49062723", "text": "func NewUpdate(n sql.Node, updateExprs []sql.Expression) *Update {\n\treturn &Update{\n\t\tUnaryNode: UnaryNode{NewUpdateSource(\n\t\t\tn,\n\t\t\tupdateExprs,\n\t\t)}}\n}", "title": "" }, { "docid": "d87b8324e14c5949715b0cc931d55b7a", "score": "0.4902943", "text": "func newMemberUpdateCommand() *cobra.Command {\n\tcc := &cobra.Command{\n\t\tUse: \"update <logStreamName> <memberID> [options]\",\n\t\tShort: \"Updates a member in the log stream cluster\",\n\n\t\tRun: memberUpdateCommandFunc,\n\t}\n\n\tcc.Flags().StringVar(&memberPeerURLs, \"peer-urls\", \"\", \"comma separated peer URLs for the updated member.\")\n\n\treturn cc\n}", "title": "" }, { "docid": "9f0b410f2684e31e05efc9a501553342", "score": "0.48987982", "text": "func newCmdJobUpdate(ctx api.Context) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"update <file>\",\n\t\tShort: \"Update a job\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclient, err := metronomeClient(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Handling input from file or stdin\n\t\t\treader, err := inputReader(ctx, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tjob, err := parseJSONJob(reader)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(job.Schedules) != 0 {\n\t\t\t\tjob.Schedules = nil\n\t\t\t}\n\n\t\t\t_, err = client.UpdateJob(job)\n\t\t\treturn err\n\t\t},\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "bcc1a8d46cd944d6d929b0f6e02fd7bb", "score": "0.48938727", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdiffReporter *ackcompare.Reporter,\n) (*resource, error) {\n\n\tinput, err := rm.newUpdateRequestPayload(ctx, desired)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, respErr := rm.sdkapi.ModifyClientVpnEndpointWithContext(ctx, input)\n\trm.metrics.RecordAPICall(\"UPDATE\", \"ModifyClientVpnEndpoint\", 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 := desired.ko.DeepCopy()\n\n\trm.setStatusDefaults(ko)\n\n\treturn &resource{ko}, nil\n}", "title": "" }, { "docid": "fc16d27a6767c86c49ba23c5744296ea", "score": "0.4892229", "text": "func PutNew() PutOptionFn {\n\treturn func(o *putOption) error {\n\t\to.isNew = true\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c1a96d579e7e5e4c45135d232e3a95e1", "score": "0.48856762", "text": "func New(opt Options) (*Updater, error) {\n\ttransport := http.DefaultTransport.(*http.Transport).Clone()\n\ttransport.TLSClientConfig = &tls.Config{\n\t\tInsecureSkipVerify: opt.InsecureTransport,\n\t}\n\thttpClient := &http.Client{Transport: transport}\n\n\tremoteStore, err := client.HTTPRemoteStore(opt.ServerURL, nil, httpClient)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"init remote store\")\n\t}\n\n\ttufClient := client.NewClient(opt.LocalStore, remoteStore)\n\tvar rootKeys []*data.Key\n\tif err := json.Unmarshal([]byte(opt.RootKeys), &rootKeys); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unmarshal root keys\")\n\t}\n\n\tmeta, err := opt.LocalStore.GetMeta()\n\tif err != nil || meta[\"root.json\"] == nil {\n\t\tvar rootKeys []*data.Key\n\t\tif err := json.Unmarshal([]byte(opt.RootKeys), &rootKeys); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unmarshal root keys\")\n\t\t}\n\t\tif err := tufClient.Init(rootKeys, 1); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"init tuf client\")\n\t\t}\n\t}\n\n\tupdater := &Updater{\n\t\topt: opt,\n\t\tclient: tufClient,\n\t}\n\n\tif err := updater.initializeDirectories(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn updater, nil\n}", "title": "" }, { "docid": "99348a06eeab8b74a6a9cb7db422b827", "score": "0.48813236", "text": "func (*CompareComplyV1) NewUpdateBatchOptions(batchID string, action string) *UpdateBatchOptions {\n\treturn &UpdateBatchOptions{\n\t\tBatchID: core.StringPtr(batchID),\n\t\tAction: core.StringPtr(action),\n\t}\n}", "title": "" }, { "docid": "de57c2b87e5beb5798c75d373cf8ad25", "score": "0.4876891", "text": "func NewUpdateModeParams() *UpdateModeParams {\n\tvar ()\n\treturn &UpdateModeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "e73d218aedae74c21f281f9b5fbc1ddf", "score": "0.48625848", "text": "func (*AssistantV1) NewUpdateValueOptions(workspaceID string, entity string, value string) *UpdateValueOptions {\n\treturn &UpdateValueOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t\tEntity: core.StringPtr(entity),\n\t\tValue: core.StringPtr(value),\n\t}\n}", "title": "" }, { "docid": "3cbfb3935d31890b0aee040e47c3d234", "score": "0.4849861", "text": "func (e *Exec) NewOption(name string, description string) *Option {\n\tvar opt = &Option{\n\t\tName: name,\n\t\tDescription: description,\n\t}\n\treturn opt\n}", "title": "" }, { "docid": "7e16579bc1e12328e2dfe4cca412856a", "score": "0.48486692", "text": "func newOptions(options []*Options) *Options {\n\to := Options{\n\t\tStatusCode: defaultStatusCode,\n\t\tMessage: defaultMessage,\n\t\tIdentificationFunction: defaultIdentify,\n\t\tKeyPrefix: defaultKeyPrefix,\n\t\tStore: nil,\n\t\tDisabled: defaultDisabled,\n\t}\n\n\t// when all defaults, return it\n\tif len(options) == 0 {\n\t\to.Store = NewMapStore(accessCount{})\n\t\treturn &o\n\t}\n\n\t// map the given values to the options\n\toptionsValue := reflect.ValueOf(options[0])\n\toValue := reflect.ValueOf(&o)\n\tnumFields := optionsValue.Elem().NumField()\n\n\tfor i := 0; i < numFields; i++ {\n\t\tif value := optionsValue.Elem().Field(i); value.IsValid() && value.CanSet() && isNonEmptyOption(value) {\n\t\t\toValue.Elem().Field(i).Set(value)\n\t\t}\n\t}\n\n\tif o.Store == nil {\n\t\to.Store = NewMapStore(accessCount{})\n\t}\n\n\treturn &o\n}", "title": "" }, { "docid": "6fd7acf7feb43384008d9e4cb8ac61a6", "score": "0.48443717", "text": "func (c *ExtraClient) Update() *ExtraUpdate {\n\tmutation := newExtraMutation(c.config, OpUpdate)\n\treturn &ExtraUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "58647660bf7ecaab9529792741144582", "score": "0.4838639", "text": "func NewUpdateModel() *UpdateModel {\n\tthis := UpdateModel{}\n\treturn &this\n}", "title": "" }, { "docid": "ddb4c91daf3b9c1c7033df84bf920e40", "score": "0.4835745", "text": "func (*ResourceRecordsV1) NewUpdateResourceRecordOptions(instanceID string, dnszoneID string, recordID string) *UpdateResourceRecordOptions {\n\treturn &UpdateResourceRecordOptions{\n\t\tInstanceID: core.StringPtr(instanceID),\n\t\tDnszoneID: core.StringPtr(dnszoneID),\n\t\tRecordID: core.StringPtr(recordID),\n\t}\n}", "title": "" }, { "docid": "9d423a37280601eb95d24757dba640a6", "score": "0.48325056", "text": "func UpdateCommand() []string {\n\treturn []string{`echo \"not implemented\"`}\n}", "title": "" }, { "docid": "290848c845188615673319ba8a8d5a0d", "score": "0.48316634", "text": "func NewDerivativeMarketParamUpdateProposal(\n\ttitle, description string, marketID string,\n\tinitialMarginRatio, maintenanceMarginRatio,\n\tmakerFeeRate, takerFeeRate, relayerFeeShareRate, minPriceTickSize, minQuantityTickSize *sdk.Dec,\n\tstatus MarketStatus,\n) *DerivativeMarketParamUpdateProposal {\n\treturn &DerivativeMarketParamUpdateProposal{\n\t\ttitle,\n\t\tdescription,\n\t\tmarketID,\n\t\tinitialMarginRatio,\n\t\tmaintenanceMarginRatio,\n\t\tmakerFeeRate,\n\t\ttakerFeeRate,\n\t\trelayerFeeShareRate,\n\t\tminPriceTickSize,\n\t\tminQuantityTickSize,\n\t\tstatus,\n\t}\n}", "title": "" }, { "docid": "ef9f4202946c44ad63bcdb5750be90be", "score": "0.48298776", "text": "func (client *Client) UpdateEdgeInstanceWithOptions(request *UpdateEdgeInstanceRequest, runtime *util.RuntimeOptions) (_result *UpdateEdgeInstanceResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.BizEnable)) {\n\t\tquery[\"BizEnable\"] = request.BizEnable\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.InstanceId)) {\n\t\tquery[\"InstanceId\"] = request.InstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotInstanceId)) {\n\t\tquery[\"IotInstanceId\"] = request.IotInstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Name)) {\n\t\tquery[\"Name\"] = request.Name\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Spec)) {\n\t\tquery[\"Spec\"] = request.Spec\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Tags)) {\n\t\tquery[\"Tags\"] = request.Tags\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UpdateEdgeInstance\"),\n\t\tVersion: tea.String(\"2018-01-20\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &UpdateEdgeInstanceResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "c5e831a47d7a7d9ff51c8e5145d28b10", "score": "0.48160073", "text": "func NewUpdateJob(job *Job) *UpdateJob {\n\n\treq := aurora.NewJobUpdateRequest()\n\treq.TaskConfig = job.jobConfig.TaskConfig\n\treq.Settings = aurora.NewJobUpdateSettings()\n\n\t// Mirrors defaults set by Pystachio\n\treq.Settings.UpdateOnlyTheseInstances = make(map[*aurora.Range]bool)\n\treq.Settings.UpdateGroupSize = 1\n\treq.Settings.WaitForBatchCompletion = false\n\treq.Settings.MinWaitInInstanceRunningMs = 45000 // Deprecated\n\treq.Settings.MaxPerInstanceFailures = 0\n\treq.Settings.MaxFailedInstances = 0\n\treq.Settings.RollbackOnFailure = true\n\treq.Settings.WaitForBatchCompletion = false\n\n\t//TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior\n\treturn &UpdateJob{job, req}\n}", "title": "" }, { "docid": "68116d3cc7b9d8d1225edd43ca202a1b", "score": "0.48155308", "text": "func (s *WebhooksService) Update(opt *WebhooksUpdateOption) (resp *http.Response, err error) {\n\terr = s.ValidateUpdateOpt(opt)\n\tif err != nil {\n\t\treturn\n\t}\n\treq, err := s.client.NewRequest(\"POST\", \"webhooks/update\", opt)\n\tif err != nil {\n\t\treturn\n\t}\n\tresp, err = s.client.Do(req, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "97eea28ddf0e819f15aeeed2a20084f2", "score": "0.48086235", "text": "func Update(table string) *UpdateBuilder { return &UpdateBuilder{table: table} }", "title": "" }, { "docid": "7de514f1fc24ac896a6bff41a1ec57b0", "score": "0.47995356", "text": "func (*DirectLinkV1) NewUpdateGatewayOptions(id string) *UpdateGatewayOptions {\n\treturn &UpdateGatewayOptions{\n\t\tID: core.StringPtr(id),\n\t}\n}", "title": "" }, { "docid": "fe7550e3a7b04ccbd8cb32971bc83318", "score": "0.47979742", "text": "func App010OptLibUpdater(libUpdater KSLibUpdater) App010Opt {\n\treturn func(a *App010) {\n\t\ta.libUpdater = libUpdater\n\t}\n}", "title": "" } ]
d0ccfd8818b55da7931326ab6837cd32
NewDescribeCharacterListRequest will create request of DescribeCharacterList action.
[ { "docid": "f390b256c59b27940305d547101dd394", "score": "0.84402776", "text": "func (c *UAccountClient) NewDescribeCharacterListRequest() *DescribeCharacterListRequest {\n\treq := &DescribeCharacterListRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" } ]
[ { "docid": "8649cebcdbe88f36a5ba162807aa5bd9", "score": "0.57764125", "text": "func (c *UAccountClient) NewDescribeMemberListRequest() *DescribeMemberListRequest {\n\treq := &DescribeMemberListRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "c5a9cdab7b1497faa9bc2b77cabc64d8", "score": "0.56233287", "text": "func CreateListExtensionsRequest() (request *ListExtensionsRequest) {\n\trequest = &ListExtensionsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dataworks-public\", \"2020-05-18\", \"ListExtensions\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "6ab21597f7be4d16a186ff0cdd64f552", "score": "0.5605546", "text": "func (c *UAccountClient) NewCreateCharacterRequest() *CreateCharacterRequest {\n\treq := &CreateCharacterRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(false)\n\treturn req\n}", "title": "" }, { "docid": "b54c086f0d122a592e00d02919a9f551", "score": "0.55541855", "text": "func (client *ClustersClient) listCreateRequest(ctx context.Context, options *ClustersClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters\"\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.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "91becf3566c9fca1172aa92fa4c3dca9", "score": "0.5529087", "text": "func (client *ClustersClient) listCreateRequest(ctx context.Context, options *ClustersListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters\"\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.MethodGet, 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-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "88885b87ddfc18bf9df88c062b110d45", "score": "0.5483395", "text": "func (client TagsClient) listCreateRequest(ctx context.Context, options *TagsListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/tagNames\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "167054011bc342d0d115812f80030e16", "score": "0.5337189", "text": "func NewCmdList(name, fullName string) *cobra.Command {\n\to := NewListOptions()\n\tcommand := &cobra.Command{\n\t\tUse: name,\n\t\tShort: \"List all applications in the current project\",\n\t\tLong: \"List all applications in the current project\",\n\t\tExample: fmt.Sprintf(listExample, fullName),\n\t\tArgs: cobra.NoArgs,\n\t\tAnnotations: map[string]string{\"machineoutput\": \"json\"},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgenericclioptions.GenericRun(o, cmd, args)\n\t\t},\n\t}\n\n\tproject.AddProjectFlag(command)\n\treturn command\n}", "title": "" }, { "docid": "01bf05beab7e7c38111146f930e0d5f6", "score": "0.5205553", "text": "func NewCmdDeviceList(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {\n\treturn cli.Command{\n\t\tName: \"list\",\n\t\tUsage: \"List devices\",\n\t\tAction: func(c *cli.Context) {\n\t\t\tcl.ChooseCommand(&CmdDeviceList{Contextified: libkb.NewContextified(g)}, \"list\", c)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "023776a6160188a5586b9e2251d9f937", "score": "0.51884884", "text": "func (client *ExpressRouteCircuitsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRouteCircuitsListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-07-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "6e3f6f3e150410fd61eb377c1ebf9ca3", "score": "0.51856136", "text": "func (client *AccountClient) listCreateRequest(ctx context.Context, options *AccountClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts\"\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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-22\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "97dba3c1444e640c4bbaf3a1db6a89df", "score": "0.51766646", "text": "func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, options *DeletedAccountsListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts\"\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 := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "0883ba5c3d94b4218b44addd4d16544a", "score": "0.51674956", "text": "func (iso ISO) ListRequest() (ListCommand, error) {\n\treq := &ListISOs{\n\t\tID: iso.ID,\n\t\tName: iso.Name,\n\t\tZoneID: iso.ZoneID,\n\t}\n\tif iso.Bootable {\n\t\t*req.Bootable = true\n\t}\n\tif iso.IsFeatured {\n\t\treq.IsoFilter = \"featured\"\n\t}\n\tif iso.IsPublic {\n\t\t*req.IsPublic = true\n\t}\n\tif iso.IsReady {\n\t\t*req.IsReady = true\n\t}\n\n\tfor i := range iso.Tags {\n\t\treq.Tags = append(req.Tags, iso.Tags[i])\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e690b6c9978bfe2610c4cc1a016723c7", "score": "0.51438445", "text": "func (client *Client) listCreateRequest(ctx context.Context, options *ClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resources\"\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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treqQP.Set(\"api-version\", \"2019-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "85e037ea7dc02312005ad1e9c05761ea", "score": "0.5136223", "text": "func (client *ZonesClient) listCreateRequest(ctx context.Context, options *ZonesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones\"\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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treqQP.Set(\"api-version\", \"2016-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "d096320ff7dec88eb9a5d8b9fe6c7813", "score": "0.51270026", "text": "func (client *FleetsClient) listCreateRequest(ctx context.Context, options *FleetsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets\"\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.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-02-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a1bb9f5565a23e30e70f93eae73e0255", "score": "0.5119121", "text": "func (client *EndpointsClient) listCreateRequest(ctx context.Context, resourceURI string, options *EndpointsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceUri}\", resourceURI)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "761eae69db35de16388b3f5486da38d2", "score": "0.51063627", "text": "func (cs *CharacterService) List(ids []int, opts ...FuncOption) ([]*Character, error) {\n\turl, err := cs.client.multiURL(CharacterEndpoint, ids, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ch []*Character\n\n\terr = cs.client.get(url, &ch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ch, nil\n}", "title": "" }, { "docid": "c79a3566b8e7f828939fafb00d67b564", "score": "0.5103569", "text": "func (c *UAccountClient) NewModifyCharacterRequest() *ModifyCharacterRequest {\n\treq := &ModifyCharacterRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "6da620c2804807c5a2b1fdd3e3db19a9", "score": "0.50788486", "text": "func (c *UAccountClient) NewTerminateCharacterRequest() *TerminateCharacterRequest {\n\treq := &TerminateCharacterRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "27185fac115d9ad0677a74b79f1d16c2", "score": "0.5074838", "text": "func CreateListMessagesRequest() (request *ListMessagesRequest) {\n\trequest = &ListMessagesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"MscCommonQuery\", \"2021-04-07\", \"ListMessages\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "7a1f25479922ade7eb62eabccd70daa7", "score": "0.50694007", "text": "func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *NetworkInterfacesListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-07-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "221905578e605a011a76ad83d1a9a072", "score": "0.5067134", "text": "func (client *DataPolicyManifestsClient) listCreateRequest(ctx context.Context, options *DataPolicyManifestsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Authorization/dataPolicyManifests\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tunencodedParams := []string{req.Raw().URL.RawQuery}\n\tif options != nil && options.Filter != nil {\n\t\tunencodedParams = append(unencodedParams, \"$filter=\"+*options.Filter)\n\t}\n\treq.Raw().URL.RawQuery = strings.Join(unencodedParams, \"&\")\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "c68051b238d09c1c0e5155185dfd47ce", "score": "0.50652313", "text": "func NewCmdList() *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"list [EPIC-KEY]\",\n\t\tShort: \"List lists issues in a project\",\n\t\tLong: helpText,\n\t\tExample: examples,\n\t\tAliases: []string{\"lists\", \"ls\"},\n\t\tAnnotations: map[string]string{\n\t\t\t\"help:args\": \"[EPIC-KEY]\\tKey for the issue of type epic, eg: ISSUE-1\",\n\t\t},\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\ttable, err := cmd.Flags().GetBool(\"table\")\n\t\t\tcmdutil.ExitIfError(err)\n\n\t\t\terr = cmd.Flags().Set(\"type\", \"Epic\")\n\t\t\tcmdutil.ExitIfError(err)\n\n\t\t\tif table {\n\t\t\t\tlist.List(cmd, args)\n\t\t\t} else {\n\t\t\t\tepicList(cmd, args)\n\t\t\t}\n\t\t},\n\t}\n}", "title": "" }, { "docid": "96e5a1a78a0b66d1daee104ec93cf253", "score": "0.5060315", "text": "func NewList(c *kingpin.CmdClause) shared.Command {\n\treturn &list{filename: shared.FilenameFlag(c)}\n}", "title": "" }, { "docid": "8ad9fd987df436c416be07b2b45a0916", "score": "0.5058485", "text": "func (client ResourcesClient) NewListRequest(filter string, top int) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"subscriptionId\": url.QueryEscape(client.SubscriptionId),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"$filter\": filter,\n\t\t\"$top\": top,\n\t\t\"api-version\": ApiVersion,\n\t}\n\n\treturn autorest.DecoratePreparer(\n\t\tclient.ListRequestPreparer(),\n\t\tautorest.WithPathParameters(pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters)).Prepare(&http.Request{})\n}", "title": "" }, { "docid": "3c8cdcd00f79de976a6c4ab0003b8d70", "score": "0.50552624", "text": "func (client DiskAccessesClient) listCreateRequest(ctx context.Context, options *DiskAccessesListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-06-30\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "019a3e0c41a03a0df3e842d22c590b85", "score": "0.5037387", "text": "func (client *ConnectedRegistriesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ConnectedRegistriesListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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-08-01-preview\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "adfd9beae14cb81bd5c1bd82527be310", "score": "0.5028651", "text": "func (client *VirtualWansClient) listCreateRequest(ctx context.Context, options *VirtualWansClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans\"\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.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "94b8a91520412594902f974598721ef3", "score": "0.5023935", "text": "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_customers_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "c0cd7b13a28b8bd0e2f32fb9457e7592", "score": "0.50239116", "text": "func CreateDescribeHotKeysRequest() (request *DescribeHotKeysRequest) {\n\trequest = &DescribeHotKeysRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"DAS\", \"2020-01-16\", \"DescribeHotKeys\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "585c183af6c6e4f4c8c0654e70d3fd9c", "score": "0.50231713", "text": "func (client *BastionHostsClient) listCreateRequest(ctx context.Context, options *BastionHostsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts\"\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.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "225d13504f1318a4944fcf53d54c3178", "score": "0.5019602", "text": "func CreateDescribeDedicatedHostClustersRequest() (request *DescribeDedicatedHostClustersRequest) {\n\trequest = &DescribeDedicatedHostClustersRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Ecs\", \"2014-05-26\", \"DescribeDedicatedHostClusters\", \"ecs\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "aeab2e4ac8d14e48588158fdc98dede7", "score": "0.50155836", "text": "func NewCmdList(\n\tf cmdutil.Factory,\n\treport func(io.Writer, *util.OutputFlags, []dto.Client) error,\n) *cobra.Command {\n\tof := util.OutputFlags{}\n\tvar archived, notArchived bool\n\tcmd := &cobra.Command{\n\t\tUse: \"list\",\n\t\tAliases: []string{\"ls\"},\n\t\tShort: \"List clients from a Clockify workspace\",\n\t\tExample: heredoc.Docf(`\n\t\t\t$ %[1]s\n\t\t\t+--------------------------+----------+----------+\n\t\t\t| ID | NAME | ARCHIVED |\n\t\t\t+--------------------------+----------+----------+\n\t\t\t| 6202634a28782767054eec26 | Client 1 | NO |\n\t\t\t| 62964b36bb48532a70730dbe | Client 2 | YES |\n\t\t\t+--------------------------+----------+----------+\n\n\t\t\t$ %[1]s --archived --csv\n\t\t\t62964b36bb48532a70730dbe,Client 2,true\n\n\t\t\t$ %[1]s --not-archived --format \"<{{ .Name }}>\"\n\t\t\t<Client 1>\n\n\t\t\t$ %[1]s --name \"1\" --quiet\n\t\t\t6202634a28782767054eec26\n\t\t`, \"clockify-cli client list\"),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := of.Check(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := cmdutil.XorFlag(map[string]bool{\n\t\t\t\t\"archived\": archived,\n\t\t\t\t\"not-archived\": notArchived,\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tp := api.GetClientsParam{\n\t\t\t\tPaginationParam: api.AllPages(),\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\tif p.Workspace, err = f.GetWorkspaceID(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tc, err := f.Client()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tp.Name, _ = cmd.Flags().GetString(\"name\")\n\t\t\tif archived || notArchived {\n\t\t\t\tp.Archived = &archived\n\t\t\t}\n\n\t\t\tclients, err := c.GetClients(p)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif report != nil {\n\t\t\t\treturn report(cmd.OutOrStdout(), &of, clients)\n\t\t\t}\n\n\t\t\treturn util.Report(clients, cmd.OutOrStdout(), of)\n\t\t},\n\t}\n\n\tcmd.Flags().StringP(\"name\", \"n\", \"\",\n\t\t\"will be used to filter the tag by name\")\n\tcmd.Flags().BoolVarP(\n\t\t&notArchived, \"not-archived\", \"\", false, \"list only active projects\")\n\tcmd.Flags().BoolVarP(\n\t\t&archived, \"archived\", \"\", false, \"list only archived projects\")\n\n\tutil.AddReportFlags(cmd, &of)\n\n\treturn cmd\n}", "title": "" }, { "docid": "389f5cd5751b82d8f40eb6060d1f5495", "score": "0.5013722", "text": "func CreateDescribeDeductConvertFactorRequest() (request *DescribeDeductConvertFactorRequest) {\n\trequest = &DescribeDeductConvertFactorRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Ecs\", \"2014-05-26\", \"DescribeDeductConvertFactor\", \"ecs\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "a33f0d7ba130d4b577ee6b5a2d0e94a1", "score": "0.5011896", "text": "func (client *DiskAccessesClient) listCreateRequest(ctx context.Context, options *DiskAccessesListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses\"\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.MethodGet, 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-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "8bb5047a12d78f1b40ceda2da7e1a1ab", "score": "0.5009398", "text": "func (client *SubAccountClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *SubAccountClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif monitorName == \"\" {\n\t\treturn nil, errors.New(\"parameter monitorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{monitorName}\", url.PathEscape(monitorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e371b4cb7a9670d05a672f3c9484b32f", "score": "0.49902093", "text": "func (client *MembersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *MembersClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e4774d8caa593a4bdf11770f2689d83d", "score": "0.4988673", "text": "func (client *ReservationClient) listCreateRequest(ctx context.Context, reservationOrderID string, options *ReservationClientListOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations\"\n\tif reservationOrderID == \"\" {\n\t\treturn nil, errors.New(\"parameter reservationOrderID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{reservationOrderId}\", url.PathEscape(reservationOrderID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "fe316d4b51b4a909cd76a884ae5669d3", "score": "0.49843338", "text": "func newListCmd(clientFn func() (*fic.ServiceClient, error), out io.Writer) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"list\",\n\t\tShort: \"List areas\",\n\t\tExample: \"fic areas list\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclient, err := clientFn()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"creating FIC client: %w\", err)\n\t\t\t}\n\n\t\t\tpages, err := areas.List(client, nil).AllPages()\n\t\t\tif err != nil {\n\t\t\t\tvar e *json.UnmarshalTypeError\n\t\t\t\tif errors.As(err, &e) {\n\t\t\t\t\treturn fmt.Errorf(\"extracting areas from API response: %w\", err)\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"calling List areas API: %w\", err)\n\t\t\t}\n\n\t\t\tas, _ := areas.ExtractAreas(pages)\n\n\t\t\tt := utils.NewTabby(out)\n\t\t\tt.AddHeader(\"id\", \"name\", \"number\", \"isPublic\", \"enabled\")\n\t\t\tfor _, a := range as {\n\t\t\t\tt.AddLine(a.ID, a.Name, a.Number, a.IsPublic, a.Enabled)\n\t\t\t}\n\t\t\tt.Print()\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "ad3fe8f851c9327acc9b6998fdb237d8", "score": "0.49803355", "text": "func NewListCmd() *cobra.Command {\n\tlistCmd := &cobra.Command{\n\t\tUse: \"list <server>\",\n\t\tShort: \"List servers\",\n\t\tArgs: cobra.NoArgs,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tall, err := cmd.Flags().GetBool(\"all\")\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tif err := craft.PrintServers(all); err != nil {\n\t\t\t\tlogger.Error.Fatal(err)\n\t\t\t}\n\t\t},\n\t}\n\n\tlistCmd.Flags().BoolP(\"all\", \"a\", false,\n\t\t\"Show all servers. The Default is to show only running servers.\")\n\n\treturn listCmd\n}", "title": "" }, { "docid": "bf654f56733291975fd8bd893e3c335f", "score": "0.49796316", "text": "func (client *ExpressRouteCircuitsClient) listAllCreateRequest(ctx context.Context, options *ExpressRouteCircuitsListAllOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-07-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "7d4aa27c3131ba82f84ea2310d4538da", "score": "0.49768302", "text": "func NewCmdServiceList(name, fullName string) *cobra.Command {\n\to := NewServiceListOptions()\n\tserviceListCmd := &cobra.Command{\n\t\tUse: name,\n\t\tShort: \"List all services in the current application\",\n\t\tLong: listLongDesc,\n\t\tExample: fmt.Sprintf(listExample, fullName),\n\t\tArgs: cobra.NoArgs,\n\t\tAnnotations: map[string]string{\"machineoutput\": \"json\"},\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tgenericclioptions.GenericRun(o, cmd, args)\n\t\t},\n\t}\n\tgenericclioptions.AddContextFlag(serviceListCmd, &o.componentContext)\n\treturn serviceListCmd\n}", "title": "" }, { "docid": "e8bb333c63a4a2417c117f1c5f35680e", "score": "0.49729556", "text": "func (client *DataContainersClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *DataContainersClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-10-01\")\n\tif options != nil && options.Skip != nil {\n\t\treqQP.Set(\"$skip\", *options.Skip)\n\t}\n\tif options != nil && options.ListViewType != nil {\n\t\treqQP.Set(\"listViewType\", string(*options.ListViewType))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "5f8ff535dbc4d34f4c0c26fdf3f0ebba", "score": "0.4971709", "text": "func (client *FleetsClient) listCredentialsCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientListCredentialsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif fleetName == \"\" {\n\t\treturn nil, errors.New(\"parameter fleetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{fleetName}\", url.PathEscape(fleetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-02-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "35348dd4bbb9e3ce238809ebeabf948b", "score": "0.49711847", "text": "func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *VirtualMachinesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif privateCloudName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateCloudName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateCloudName}\", url.PathEscape(privateCloudName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "53869abdc603bdda9b69c16485211810", "score": "0.49599224", "text": "func (*ListCasesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_support_v2_case_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "cc83d2b2903741c2d110ad170fe11351", "score": "0.49546087", "text": "func (client *AppServiceCertificateOrdersClient) listCreateRequest(ctx context.Context, options *AppServiceCertificateOrdersListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders\"\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.MethodGet, 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-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "07d630e1c123270ade0b143887b88421", "score": "0.4947475", "text": "func (client *AppServiceEnvironmentsClient) listCapacitiesCreateRequest(ctx context.Context, resourceGroupName string, name string, options *AppServiceEnvironmentsListCapacitiesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "7756c06a83b7b97f1b4463d659731c81", "score": "0.49473715", "text": "func (client *RegistriesClient) listCreateRequest(ctx context.Context, options *RegistriesListOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries\"\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 := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c6c6b2a6cafae778f8ed1b1a3f01190e", "score": "0.4944581", "text": "func CreateListPrivateAccessTagsRequest() (request *ListPrivateAccessTagsRequest) {\n\trequest = &ListPrivateAccessTagsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"csas\", \"2023-01-20\", \"ListPrivateAccessTags\", \"\", \"\")\n\trequest.Method = requests.GET\n\treturn\n}", "title": "" }, { "docid": "15406dee8456acfe26ba7f65624a8e9b", "score": "0.49347094", "text": "func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *RoleDefinitionsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.Authorization/roleDefinitions\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\treqQP.Set(\"api-version\", \"2022-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "7ec0b67371b08efab3798d0eee7b72e9", "score": "0.4932365", "text": "func (client *DeletedWorkspacesClient) listCreateRequest(ctx context.Context, options *DeletedWorkspacesListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces\"\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.MethodGet, 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-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e2b2f77226a887406aa586c122937434", "score": "0.49308106", "text": "func CreateListCustomPersonsRequest() (request *ListCustomPersonsRequest) {\n\trequest = &ListCustomPersonsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Mts\", \"2014-06-18\", \"ListCustomPersons\", \"mts\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "9839d8144e93a1d77b3506c5dcb8e625", "score": "0.49153423", "text": "func NewListCmd(a *app) *cobra.Command {\n\tcmd := cobra.Command{\n\t\tUse: \"list\",\n\t\tShort: \"List buckets or bucket content\",\n\t\tLong: \"Lists all the buckets.\\nIf a bucket name is specified, lists the content of the bucket instead.\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) > 1 {\n\t\t\t\treturn errors.New(\"Wrong number of arguments\")\n\t\t\t}\n\n\t\t\tif len(args) == 0 {\n\t\t\t\tlist, err := a.Cli.ListBuckets()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tdeflt, err := a.defaultBucket()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tfor i := range list {\n\t\t\t\t\ta.Out.Write([]byte(list[i]))\n\t\t\t\t\tif list[i] == deflt {\n\t\t\t\t\t\ta.Out.Write([]byte(\" *\"))\n\t\t\t\t\t}\n\t\t\t\t\ta.Out.Write([]byte(\"\\n\"))\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\titems, err := a.Cli.List(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdata, err := json.MarshalList(items)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ta.Out.Write(data)\n\t\t\ta.Out.Write([]byte(\"\\n\"))\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn &cmd\n}", "title": "" }, { "docid": "942fa09ca028f57dc55a4385e5d0eab5", "score": "0.4909315", "text": "func (client *Client) listSecretsCreateRequest(ctx context.Context, options *ListSecretsOptions) (*policy.Request, error) {\n\turlPath := \"/secrets\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.MaxResults != nil {\n\t\treqQP.Set(\"maxresults\", strconv.FormatInt(int64(*options.MaxResults), 10))\n\t}\n\treqQP.Set(\"api-version\", \"7.3\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6b93768e0ca4a5b6dbd062dc926c1c9a", "score": "0.49087086", "text": "func (client *PrivateCloudsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateCloudsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "af55655618b23016ac7aa67c2d192918", "score": "0.49070323", "text": "func CreateDeleteServiceListRequest() (request *DeleteServiceListRequest) {\n\trequest = &DeleteServiceListRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CSB\", \"2017-11-18\", \"DeleteServiceList\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "82d15ca2e021fbc02ad75f4b2e90dbdd", "score": "0.48982987", "text": "func (client *FleetMembersClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetMembersClientListByFleetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif fleetName == \"\" {\n\t\treturn nil, errors.New(\"parameter fleetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{fleetName}\", url.PathEscape(fleetName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "331a954f538fd088ce219fd1f2e28806", "score": "0.48959786", "text": "func (client *AvailabilityStatusesClient) listCreateRequest(ctx context.Context, resourceURI string, options *AvailabilityStatusesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceUri}\", resourceURI)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-10-01\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a8cae0e5f8ad1ca361012b1d63b646df", "score": "0.48926556", "text": "func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *NetworkInterfacesListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif 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.MethodGet, 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-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "a2be9e8c4c2fdc627e8e69feaf1d2dcb", "score": "0.48906934", "text": "func (client *ProvidersClient) listCreateRequest(ctx context.Context, options *ProvidersClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers\"\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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "a57ca9e1c510de139ec523c7ae3d68e9", "score": "0.4887666", "text": "func CreateListSupportResourceTypesRequest() (request *ListSupportResourceTypesRequest) {\n\trequest = &ListSupportResourceTypesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Tag\", \"2018-08-28\", \"ListSupportResourceTypes\", \"tag\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "02db01df2eaaae64bf018e0c80854296", "score": "0.48668578", "text": "func (client *AvailabilityStatusesClient) listCreateRequest(ctx context.Context, resourceURI string, options *AvailabilityStatusesListOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceUri}\", resourceURI)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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\", \"2017-07-01\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "fa4e99732abf667be75cedbe023f76e5", "score": "0.48650318", "text": "func (client *MembersClient) listAllCreateRequest(ctx context.Context, options *MembersClientListAllOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers\"\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.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "1f488bff17bea68a698e2a1f7c7386c4", "score": "0.48629388", "text": "func (client *ServersClient) listCreateRequest(ctx context.Context, options *ServersListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers\"\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.MethodGet, 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\", \"2017-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "a389e28182f5aa2fd896ae4fda1971e4", "score": "0.4862811", "text": "func (c *SSM) ListCommandsRequest(input *ListCommandsInput) (req *request.Request, output *ListCommandsOutput) {\n\top := &request.Operation{\n\t\tName: opListCommands,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t\tPaginator: &request.Paginator{\n\t\t\tInputTokens: []string{\"NextToken\"},\n\t\t\tOutputTokens: []string{\"NextToken\"},\n\t\t\tLimitToken: \"MaxResults\",\n\t\t\tTruncationToken: \"\",\n\t\t},\n\t}\n\n\tif input == nil {\n\t\tinput = &ListCommandsInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &ListCommandsOutput{}\n\treq.Data = output\n\treturn\n}", "title": "" }, { "docid": "e639608e7a8f9f4c688d1dc1d60c3477", "score": "0.4859983", "text": "func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, options *NetworkInterfacesListAllOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2020-07-01\")\n\treq.URL.RawQuery = query.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "0273187bc4d54681e172b78e7c5ee6be", "score": "0.4856121", "text": "func (*GetCharacterItemsRequest) Descriptor() ([]byte, []int) {\n\treturn file_cauldron_v1alpha_item_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "c10a86dfcdd01003f7d9f09beae7304c", "score": "0.48467305", "text": "func (client *ConnectedClusterClient) listBySubscriptionCreateRequest(ctx context.Context, options *ConnectedClusterClientListBySubscriptionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters\"\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.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "89842094e8fe6107b7955a03bb73d248", "score": "0.48431626", "text": "func (opts *Options) SetCharacterList(chars string) error {\n\tif len(chars) == 0 {\n\t\treturn errors.New(\"empty character list\")\n\t}\n\n\topts.characterList = chars\n\n\treturn nil\n}", "title": "" }, { "docid": "54fc713333c2b02911bbbc86a2ec28ac", "score": "0.48276317", "text": "func (client *AccountsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "988d53f1a5b93f215e2c61f3b8645f81", "score": "0.48267424", "text": "func (client *ServiceClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *ServiceListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e08caa943e9c09820ebb38ff3ee1e360", "score": "0.48233414", "text": "func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, options *NetworkInterfacesListAllOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces\"\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.MethodGet, 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-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "840402e81ab7702eb7502692e0471b9d", "score": "0.48105627", "text": "func CreateListListenersRequest() (request *ListListenersRequest) {\n\trequest = &ListListenersRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Nlb\", \"2022-04-30\", \"ListListeners\", \"nlb\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "8c095c7067942d2b69e668af879aa2cd", "score": "0.48097402", "text": "func (client *EndpointsClient) listCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceUri}\", resourceURI)\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", endpointName)\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-05-01-preview\")\n\tif options != nil && options.Expiresin != nil {\n\t\treqQP.Set(\"expiresin\", strconv.FormatInt(*options.Expiresin, 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "40101e14d324283fe8775ce3a7c58399", "score": "0.4806619", "text": "func (*ListItemsRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_v1beta1_todo_list_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4866de0f2bcc730b623c4114dd9710e7", "score": "0.4805185", "text": "func (client *AppServiceEnvironmentsClient) listCreateRequest(ctx context.Context, options *AppServiceEnvironmentsListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments\"\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.MethodGet, 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-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "2a18dbaf29f0b8c60d2fe0c3e9c738d7", "score": "0.48020136", "text": "func (*ListClustersRequest) Descriptor() ([]byte, []int) {\n\treturn file_teleport_lib_teleterm_v1_service_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "0bdfe86c4a837f7bb0140e16e2ea4fa0", "score": "0.47986877", "text": "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_language_proto_word_word_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "33c1dcacb5dd3bbab99c1cde0f6ed9ff", "score": "0.47840592", "text": "func CreateListCompanyRegOrdersRequest() (request *ListCompanyRegOrdersRequest) {\n\trequest = &ListCompanyRegOrdersRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2019-05-08\", \"ListCompanyRegOrders\", \"companyreg\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "20505864b78c742505c9bb3a5c992af8", "score": "0.4777708", "text": "func (client *ExpressRouteCircuitAuthorizationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitAuthorizationsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif circuitName == \"\" {\n\t\treturn nil, errors.New(\"parameter circuitName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{circuitName}\", url.PathEscape(circuitName))\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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6a90b646c6fd0a64a277a990514442e2", "score": "0.4772169", "text": "func (*ListTestCasesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_cx_v3beta1_test_case_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "1cbfd3bdea4d3bfee696d339ff83bfa6", "score": "0.4768485", "text": "func CreateListBookkeepingStatisticsesRequest() (request *ListBookkeepingStatisticsesRequest) {\n\trequest = &ListBookkeepingStatisticsesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2019-05-08\", \"ListBookkeepingStatisticses\", \"companyreg\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "2969191e8ab33fac647fe5fb1f5a6f7e", "score": "0.47668356", "text": "func CreateDescribeMountedClientsRequest() (request *DescribeMountedClientsRequest) {\n\trequest = &DescribeMountedClientsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"NAS\", \"2017-06-26\", \"DescribeMountedClients\", \"nas\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "80847550786043bfbf50ae6f496dac8e", "score": "0.4750542", "text": "func CreateUserDataShowListRequest() (request *UserDataShowListRequest) {\n\trequest = &UserDataShowListRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cloudwf\", \"2017-03-28\", \"UserDataShowList\", \"cloudwf\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "1af3383dd01cb3bef6e0ca481ed7f64f", "score": "0.47452942", "text": "func (client *AppServiceEnvironmentsClient) listDiagnosticsCreateRequest(ctx context.Context, resourceGroupName string, name string, options *AppServiceEnvironmentsListDiagnosticsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "86f9aa57fdb1afc3203a1d3e31db373c", "score": "0.47442326", "text": "func CreateListDashboardsByNameRequest() (request *ListDashboardsByNameRequest) {\n\trequest = &ListDashboardsByNameRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"ListDashboardsByName\", \"arms\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "d6518c3775c2dc8159453d8b6cf3088e", "score": "0.47434548", "text": "func (client *ReservationClient) listAllCreateRequest(ctx context.Context, options *ReservationClientListAllOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Capacity/reservations\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Orderby != nil {\n\t\treqQP.Set(\"$orderby\", *options.Orderby)\n\t}\n\tif options != nil && options.RefreshSummary != nil {\n\t\treqQP.Set(\"refreshSummary\", *options.RefreshSummary)\n\t}\n\tif options != nil && options.Skiptoken != nil {\n\t\treqQP.Set(\"$skiptoken\", strconv.FormatFloat(float64(*options.Skiptoken), 'f', -1, 32))\n\t}\n\tif options != nil && options.SelectedState != nil {\n\t\treqQP.Set(\"selectedState\", *options.SelectedState)\n\t}\n\tif options != nil && options.Take != nil {\n\t\treqQP.Set(\"take\", strconv.FormatFloat(float64(*options.Take), 'f', -1, 32))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "dbd49abbd1e5e3112a200859bb212766", "score": "0.47417304", "text": "func NewListDeviceContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListDeviceContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ListDeviceContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamExpedition := req.Params[\"expedition\"]\n\tif len(paramExpedition) > 0 {\n\t\trawExpedition := paramExpedition[0]\n\t\trctx.Expedition = rawExpedition\n\t\tif ok := goa.ValidatePattern(`^[\\da-z]+(?:-[\\da-z]+)*$`, rctx.Expedition); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`expedition`, rctx.Expedition, `^[\\da-z]+(?:-[\\da-z]+)*$`))\n\t\t}\n\t\tif utf8.RuneCountInString(rctx.Expedition) > 40 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`expedition`, rctx.Expedition, utf8.RuneCountInString(rctx.Expedition), 40, false))\n\t\t}\n\t}\n\tparamProject := req.Params[\"project\"]\n\tif len(paramProject) > 0 {\n\t\trawProject := paramProject[0]\n\t\trctx.Project = rawProject\n\t\tif ok := goa.ValidatePattern(`^[\\da-z]+(?:-[\\da-z]+)*$`, rctx.Project); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`project`, rctx.Project, `^[\\da-z]+(?:-[\\da-z]+)*$`))\n\t\t}\n\t\tif utf8.RuneCountInString(rctx.Project) > 40 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`project`, rctx.Project, utf8.RuneCountInString(rctx.Project), 40, false))\n\t\t}\n\t}\n\treturn &rctx, err\n}", "title": "" }, { "docid": "f62d988d606f3e728ecc3658d5579f67", "score": "0.47337797", "text": "func (client *RoleAssignmentsClient) listCreateRequest(ctx context.Context, options *RoleAssignmentsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments\"\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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\treqQP.Set(\"api-version\", \"2015-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "2d96f203d49d8fc2dc91263167540f24", "score": "0.47280076", "text": "func CreateDescribeDirectoriesRequest() (request *DescribeDirectoriesRequest) {\n\trequest = &DescribeDirectoriesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ecd\", \"2020-09-30\", \"DescribeDirectories\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "c7b7c1e1cee7fc9a357f5572494c2845", "score": "0.47223878", "text": "func (*ListTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_token_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "06895de74ed6f8cb0702cff7a43ec84b", "score": "0.47204843", "text": "func (o *Drives) NewList() *Args {\n\to.Args.Verb = \"GET\"\n\to.Args.RequiresAuth = true\n\treturn o.Args\n}", "title": "" }, { "docid": "7e200b73c7302e4a3e4a0563a48246a9", "score": "0.47201276", "text": "func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesListCredentialsOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\treq, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "eda1b258338d8e456fc50e9a8d172365", "score": "0.47177586", "text": "func (c *Client) NewListUserRequest(ctx context.Context, path string, maxAge int, dummyKey *string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\tvalues := u.Query()\n\ttmp6 := strconv.Itoa(maxAge)\n\tvalues.Set(\"max_age\", tmp6)\n\tif dummyKey != nil {\n\t\tvalues.Set(\"dummy_key\", *dummyKey)\n\t}\n\tu.RawQuery = values.Encode()\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "c889e38eb20d3c0f0e784d284a58eafe", "score": "0.4717047", "text": "func (client *DiagnosticSettingsClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceUri}\", resourceURI)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6abeddc040f873f2056ef734e69eded9", "score": "0.47010505", "text": "func (client *ManagementGroupsClient) listCreateRequest(ctx context.Context, options *ManagementGroupsListOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Management/managementGroups\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, 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-04-01\")\n\tif options != nil && options.Skiptoken != nil {\n\t\treqQP.Set(\"$skiptoken\", *options.Skiptoken)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif options != nil && options.CacheControl != nil {\n\t\treq.Raw().Header.Set(\"Cache-Control\", *options.CacheControl)\n\t}\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "1835ef629a6e0c042e814feeb46dbcd4", "score": "0.470058", "text": "func (*ListVMsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_machine_db_api_crimson_v1_vms_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "138aa465832a0175278acc9042a0e0ce", "score": "0.46985483", "text": "func CreateListInventoryEntriesRequest() (request *ListInventoryEntriesRequest) {\n\trequest = &ListInventoryEntriesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"oos\", \"2019-06-01\", \"ListInventoryEntries\", \"oos\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "575d774b1896aefbbc2e5a76a0935016", "score": "0.469811", "text": "func (*GetExerciseListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_tiku_tiku_proto_rawDescGZIP(), []int{24}\n}", "title": "" } ]
23cb1963fefb768fc2289880b55c786e
Deprecated: Use ClientIdResponse.ProtoReflect.Descriptor instead.
[ { "docid": "40d5996792e7a244f598bd84a9806722", "score": "0.68710154", "text": "func (*ClientIdResponse) Descriptor() ([]byte, []int) {\n\treturn file_policy_policy_proto_rawDescGZIP(), []int{18}\n}", "title": "" } ]
[ { "docid": "8be77b7229cd627fdac784141174e3e2", "score": "0.68394715", "text": "func (*StreamClientIdsResponse) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "3db4ed91b28c3187db8a1d555151effa", "score": "0.67484784", "text": "func (*ClientDataDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_proto_ClientData_ClientData_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "704db2c398566ea5a287c394c961ff02", "score": "0.67400855", "text": "func (*GetByIdResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_proto_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "93149cea66f4a51b8aaa52679bf9d9a6", "score": "0.66532284", "text": "func (*GetLabelIdsRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_metadata_MetadataService_proto_rawDescGZIP(), []int{3, 0}\n}", "title": "" }, { "docid": "79a279673b2b72439270931f05d9c5a8", "score": "0.65599656", "text": "func (*DescribeClientResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "c6e226181642ec773f1f3a708a074b35", "score": "0.65164936", "text": "func (*DiscoveryResponse) Descriptor() ([]byte, []int) {\n\treturn file_autopeering_discover_proto_message_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "fbde697fbb5600d34f88a4dd329d6555", "score": "0.6507785", "text": "func (*ClientId) Descriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "42d39fe2b6a209a18db12a1187e5c688", "score": "0.65070444", "text": "func (*FetchClientResourceUsageRecordsResponse) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "14125b0ac6099fa0f3ef4c096e7adc0d", "score": "0.6427138", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_customers_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f2551003f2378b1e22477b84aa3142e0", "score": "0.64218825", "text": "func (*DeleteGreetByIdResponse) Descriptor() ([]byte, []int) {\n\treturn file_greet_greet_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "800f678a8fcd45f520225603169dddc3", "score": "0.64212537", "text": "func (*ClientDataDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_ClientData_ClientData_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "0eabf0d2e9d02092e5d011496ce9d3dd", "score": "0.64065367", "text": "func (*ClientManytimeResponse) Descriptor() ([]byte, []int) {\n\treturn file_clientstream_clientpb_client_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6fdec8126165f7ff821a5964b22e0a44", "score": "0.6383952", "text": "func (*DeleteConnectMyComputerTokenResponse) Descriptor() ([]byte, []int) {\n\treturn file_teleport_lib_teleterm_v1_service_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "f059d9dcd12af4e94e2bef6e149f3dc4", "score": "0.6380506", "text": "func (*CMsgClientToGCInviteToGuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "7e8051d1afc89c219a6131c0a8c0b7b5", "score": "0.63797444", "text": "func (*DeleteLabelsRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_metadata_MetadataService_proto_rawDescGZIP(), []int{5, 0}\n}", "title": "" }, { "docid": "e9ca1b7b68a2a83e0b2c43a60c69d892", "score": "0.63746965", "text": "func (*CodeByIDRequest) Descriptor() ([]byte, []int) {\n\treturn file_playground_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "ab49b2d3e9dbce2403ec08287adfc571", "score": "0.6360832", "text": "func (*BlacklistClientRequest) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "44a0ebdd6fae9dd1881e18cb60308cb5", "score": "0.6356571", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_v2_object_grpc_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6b082fdc74f9ca30a7a9d5614027a0c6", "score": "0.6346695", "text": "func (x *fastReflection_MsgCancelResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancelResponse\n}", "title": "" }, { "docid": "b908613880cb18fb23ff654193deda56", "score": "0.63456243", "text": "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_third_party_k8s_io_cri_api_pkg_apis_runtime_v1alpha2_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6eb0ab038fca6e71c7a447bd19da807f", "score": "0.6344893", "text": "func (*ListClientsResponse) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "3761ce9977b458917ca8b9198d8d226a", "score": "0.63442564", "text": "func (*StreamClientIdsRequest) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "16bf7262206e269342e067de7378f5cd", "score": "0.6338437", "text": "func (*GetPendingMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "fa006596f09c6f791b74faa01a532542", "score": "0.633117", "text": "func (*ListClientContactsResponse) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "b24f8e98b6b8fa3263f224ff318fab8e", "score": "0.63243175", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_aluno_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "36cf984555ba23d49925497e815f3683", "score": "0.63234377", "text": "func (*MarkVerifiedResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_customers_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "effd380e5574fcb4b99a85a311a060fe", "score": "0.6320223", "text": "func (x *fastReflection_MsgCreateBatchResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCreateBatchResponse\n}", "title": "" }, { "docid": "543dc559402afdc57ceefdc3264609c3", "score": "0.63185436", "text": "func (*CMsgClientToGCCancelInviteToGuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "9caeb0ed7b4a907464dac0fae07d08ec", "score": "0.63177264", "text": "func (*ClinicResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_hosxpv4_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "7e99d5ac70562db1090d34d2e0f4e445", "score": "0.6313824", "text": "func (*Response_Version) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_response_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "15d7cca3ebac496c949f70fca9b69dfc", "score": "0.63124144", "text": "func (*CMsgClientToGCSetGuildInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "b5552d8b0625ef5d309dc56772309e11", "score": "0.62976396", "text": "func (*CreateClientResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_directoryapp_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "0bb9e1d54a428fc8483d7c6b966143a0", "score": "0.62970966", "text": "func (*IDRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protos_customer_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "65c5a40e6346ed81d58993ccf64dd07b", "score": "0.6295918", "text": "func (*SubscribeToX509SVIDsResponse) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_agent_delegatedidentity_v1_delegatedidentity_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "de5c66273b039563ccf38d9cb59e57f9", "score": "0.6295413", "text": "func (*RemoteCallResponse) Descriptor() ([]byte, []int) {\n\treturn file_chameleon_smelter_v1_crawl_service_message_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "23a5c9525a5ea80bd2df310cf821353d", "score": "0.6290931", "text": "func (*SiteServerUI_ClientStatus_Response_ClientInfo) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_siteserverui_proto_rawDescGZIP(), []int{17, 0}\n}", "title": "" }, { "docid": "cc8074b91eefc9c6ef1c0790f9f643ba", "score": "0.6288984", "text": "func (*DeleteInviteResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_guilds_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "dfaaca5697abf6bf4a615d35feffff89", "score": "0.62888485", "text": "func (*CGameServers_IPsWithSteamIDs_Response) Descriptor() ([]byte, []int) {\n\treturn file_steam_client_steammessages_gameservers_steamclient_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "3eb429684dae25a72627dc7bc1baa1f6", "score": "0.6286909", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_language_proto_word_word_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "949574728dbecfbfff9b10b21d742039", "score": "0.6278259", "text": "func (*DeleteRefreshTokenResponse) Descriptor() ([]byte, []int) {\n\treturn file_dto_auth_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "660014c665683b2e9b944ddda01042be", "score": "0.6277137", "text": "func (*RemoveResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_squzy_monitoring_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "7ca5d4c8fce9199849e41f35971e948d", "score": "0.6275822", "text": "func (*StreamClientContactsResponse) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "3b2e21c7b77b88c0e612b8293d27e2df", "score": "0.62743014", "text": "func (*CMsgClientToGCKickGuildMemberResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "c4a81aa0b40b53989a9ce38e357b543b", "score": "0.62655133", "text": "func (*ClientDataReadResp) Descriptor() ([]byte, []int) {\n\treturn file_proto_ClientData_ClientData_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "26e604c4975715314e4f58ff4702d522", "score": "0.6264586", "text": "func (*CMsgClientToGCRequestGuildDataResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "056f7e1179907de59ab6c21b029ef328", "score": "0.626401", "text": "func (*RevokeResponse) Descriptor() ([]byte, []int) {\n\treturn file_auth_auth_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "cd233d80b1ee6d9c623e1265c81fb0a2", "score": "0.6261752", "text": "func (*DeleteMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "5afcd9dac4ca60e262d08ad781ec0660", "score": "0.6257255", "text": "func (*APIResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_message_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "bdc315339d6e0fe2e62a17466e336f44", "score": "0.62554544", "text": "func (*GreetClientResponse) Descriptor() ([]byte, []int) {\n\treturn file_greet_greetpb_streamclient_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5220d8ce3ae8fa7f2996c2ad171ecaf8", "score": "0.6253835", "text": "func (*ListPatientDiagnosesResponse) Descriptor() ([]byte, []int) {\n\treturn file_heyrenee_v1_diagnosis_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "9f915e5d565a321e9159d31c38af10fa", "score": "0.6252164", "text": "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_interservice_es_sidecar_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "060324979b70a2029e0d396e83bf64b5", "score": "0.6244718", "text": "func (*ById) Descriptor() ([]byte, []int) {\n\treturn file_api_common_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "02e880ad27d9e74aae55d4f4c8097e59", "score": "0.6237803", "text": "func (CMsgClientToGCCreateGuildResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{12, 0}\n}", "title": "" }, { "docid": "8e222dfe64c5ae6ae2600c7fd8bc8fa9", "score": "0.62376475", "text": "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_chameleon_smelter_v1_crawl_service_message_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2fe6c54d0d8b092fec5705fb0953314e", "score": "0.6236654", "text": "func (*CMsgClientToGCDeclineInviteToGuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "c8eb11804208b767f3f4c3c911be94a5", "score": "0.6234758", "text": "func (*VersionResponse) Descriptor() ([]byte, []int) {\n\treturn file_odpf_optimus_runtime_service_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "8c38172c811b38387481c765676dd8da", "score": "0.62316793", "text": "func (*Client) Descriptor() ([]byte, []int) {\n\treturn file_api_token_token_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d44feb7bb18b12ce4ac89915ed270f09", "score": "0.62269074", "text": "func (*AddLabelsRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_metadata_MetadataService_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "ddd34227662506a23362352f2664d42c", "score": "0.6225818", "text": "func (*BatchGetServiceAccountsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_service_account_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b217fc01ffc64daf09291cffa51553cd", "score": "0.62252253", "text": "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "b8b5b0ad36a4c8a15f77edabee5af39d", "score": "0.6225105", "text": "func (*CPlayer_IgnoreFriend_Response) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_player_steamclient_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "67f723a1e4609dd9c6bb214436989fd7", "score": "0.62243927", "text": "func (*DescriptionResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_access_access_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "aa66ae4c83015cceb1ec1709ba888930", "score": "0.622409", "text": "func (*GetGreetByIdResponse) Descriptor() ([]byte, []int) {\n\treturn file_greet_greet_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "0133f927fbabefc206a7db450e3d212d", "score": "0.6223552", "text": "func (*WatchPermissionResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_permission_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "93eed3a1c5d1243c40a8d4af0cf8de83", "score": "0.62166834", "text": "func (CMsgClientToGCRequestGuildDataResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{16, 0}\n}", "title": "" }, { "docid": "679b8d1094af463453a6bf3a5492d68f", "score": "0.62130046", "text": "func (*RemoveQueryResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_dekart_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "ccd25dcc478b83a9bfd26350ba749257", "score": "0.6206024", "text": "func (CMsgClientToGCSetGuildInfoResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{14, 0}\n}", "title": "" }, { "docid": "f176ad1c95b4e2f95c7a389218eb0f42", "score": "0.6204747", "text": "func (*WatchServiceAccountResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_service_account_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "3a36790b9663e22cf90171b96226384e", "score": "0.6200957", "text": "func (*CMsgClientToGCCreateGuildResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "cf994a78912e1fbecf59ff584200d557", "score": "0.6199895", "text": "func (x *fastReflection_MsgAttestResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgAttestResponse\n}", "title": "" }, { "docid": "be0166cfa4af8b0419d11c8f886b283b", "score": "0.6198341", "text": "func (*UpdateTelemetryReportedResponse) Descriptor() ([]byte, []int) {\n\treturn file_interservice_compliance_stats_stats_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "98ee6338ebec2ad8eba37fea905b5182", "score": "0.6189444", "text": "func (*DeleteCandidateProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_project_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "37891597255159fb6046584ea3711cb2", "score": "0.6188438", "text": "func (*VerifyCodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_user_auth_v1_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "a9167524ee1306b5bd0f218899339473", "score": "0.6188147", "text": "func (*ListenerResponse) Descriptor() ([]byte, []int) {\n\treturn file_goadesign_goagen_chatter_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "235de7b28206459718b7f5b37780190c", "score": "0.61836827", "text": "func (*CancelQueryResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_dekart_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "3e843477e68cc5bdc29b117950e0d416", "score": "0.61826074", "text": "func (*CMsgClientToGCRequestAccountGuildPersonaInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{56}\n}", "title": "" }, { "docid": "7e7bf25175a2c831897014f6927f4945", "score": "0.6181896", "text": "func (*ClientStateListResponse_Entry) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_state_pb2_client_state_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "cbcdacf7fed8efbb60eb7b0a998aab65", "score": "0.6179527", "text": "func (CMsgClientToGCDeclineInviteToGuildResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{33, 0}\n}", "title": "" }, { "docid": "bc30fac2b4583b8a8a3984efef89ea64", "score": "0.6179014", "text": "func (*DeleteKeysResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1alpha1_ess_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "224ecf4f9ede59488c748088de870fe7", "score": "0.61774516", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_protos_todo_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "e5b0153218f6c18c48b6f702e9bf2545", "score": "0.6176644", "text": "func (*DeleteProfilePoliticalPartyResponse) Descriptor() ([]byte, []int) {\n\treturn file_profiles_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "04369456c1cdd0f406f311154081bfef", "score": "0.6175969", "text": "func (*CMsgClientToGCRequestGuildFeedResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "083ff8c1288072787f9e62a711c45c29", "score": "0.61758167", "text": "func (*CallResponse) Descriptor() ([]byte, []int) {\n\treturn file_chameleon_smelter_v1_crawl_service_message_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "a5e1cc3e75ecc8d20a11b937f920e63e", "score": "0.61754686", "text": "func (*GetLabelIdsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_metadata_MetadataService_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f2a64b5c35a23f6c5dc55158f341d1c4", "score": "0.61745864", "text": "func (*DiagnosisResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_hosxpv4_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "11dcaff4f4f5c1d4b197b893e909e5c9", "score": "0.61735946", "text": "func (*ClientDataPutResp) Descriptor() ([]byte, []int) {\n\treturn file_proto_ClientData_ClientData_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6858d18167ccb8eec0f21de61d981a8c", "score": "0.6172924", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_secrets_secrets_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "de19748f91dac7f13e9cb412c6b4b40b", "score": "0.6170716", "text": "func (*SiteServerUI_ClientStatus_Response) Descriptor() ([]byte, []int) {\n\treturn file_steam_steammessages_siteserverui_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "ff334e66b531d8cd25ca6063a592b09f", "score": "0.616761", "text": "func (CMsgClientToGCInviteToGuildResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{31, 0}\n}", "title": "" }, { "docid": "255a29ec7f84c52ae9f637a35312bd1f", "score": "0.61675507", "text": "func (*AddResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_squzy_monitoring_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "f7477257e13385116f9079f37e7a387d", "score": "0.61659974", "text": "func (*WatchServicesResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_service_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "4d950d4172146387b2043a0e0fbac179", "score": "0.61656415", "text": "func (*CPlayer_RemoveFriend_Response) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_player_steamclient_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "322910780cb3caa521fe0e4389ec4475", "score": "0.616438", "text": "func (*GetPropertyRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_metadata_MetadataService_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "0461641da609ab9927d336e220ba66d8", "score": "0.61643434", "text": "func (*DeleteResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_file_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "77f6c5c99d03734169a5f97ffb6607f2", "score": "0.61629224", "text": "func (*CallResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_grpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e5d5848c936d528ccecd387a6dd81845", "score": "0.61592156", "text": "func (*CancelResponse) Descriptor() ([]byte, []int) {\n\treturn file_fluence_fluxcli_grpc_fluxcli_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "c8ddeafbfa58dc2fd547b33bb66b5727", "score": "0.61579823", "text": "func (CMsgClientToGCCancelInviteToGuildResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{37, 0}\n}", "title": "" }, { "docid": "821ee4d004598b8c73536b49ad82b532", "score": "0.61572295", "text": "func (CMsgClientToGCAddPlayerToGuildChatResponse_EResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_guild_proto_rawDescGZIP(), []int{50, 0}\n}", "title": "" }, { "docid": "8a8d414278f2e66fcac99d4c140a523f", "score": "0.615562", "text": "func (*DelMemberResponse) Descriptor() ([]byte, []int) {\n\treturn file_cluster_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "57d5b29c09de49ea92e482da3e3f4d0d", "score": "0.61518764", "text": "func (*CokeyResponse) Descriptor() ([]byte, []int) {\n\treturn file_drand_control_proto_rawDescGZIP(), []int{14}\n}", "title": "" } ]
b537b4dd5baae0f5f2522f172ce42ffd
NewUpdateCompanyNotFoundResponseBody builds the HTTP response body from the result of the "updateCompany" endpoint of the "hy_company" service.
[ { "docid": "79c0ca9857a5656850e3a1d7dbc19a5a", "score": "0.8222033", "text": "func NewUpdateCompanyNotFoundResponseBody(res *goa.ServiceError) *UpdateCompanyNotFoundResponseBody {\n\tbody := &UpdateCompanyNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" } ]
[ { "docid": "7fbf52c37fbc60daf8a104765b019773", "score": "0.73707736", "text": "func NewCompanyListNotFoundResponseBody(res *goa.ServiceError) *CompanyListNotFoundResponseBody {\n\tbody := &CompanyListNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "90364154e994d837d80620ad05316747", "score": "0.72895265", "text": "func NewGetCompanyNotFoundResponseBody(res *goa.ServiceError) *GetCompanyNotFoundResponseBody {\n\tbody := &GetCompanyNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "1bc6b5fa386d81431dc054b2cb48d30a", "score": "0.71019566", "text": "func NewDeleteCompanyNotFoundResponseBody(res *goa.ServiceError) *DeleteCompanyNotFoundResponseBody {\n\tbody := &DeleteCompanyNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "521015e16fd90fd6ba3bff3ab21747d2", "score": "0.65173197", "text": "func NewUpdateCompanyBadRequestResponseBody(res *goa.ServiceError) *UpdateCompanyBadRequestResponseBody {\n\tbody := &UpdateCompanyBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "2385497b64a0a260f6b68a2fb9e7dafe", "score": "0.61037576", "text": "func NewByVersionIDNotFoundResponseBody(res *goa.ServiceError) *ByVersionIDNotFoundResponseBody {\n\tbody := &ByVersionIDNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "35ad297bc60c39507184a2ba9061da9f", "score": "0.60794336", "text": "func NewByCatalogKindNameNotFoundResponseBody(res *goa.ServiceError) *ByCatalogKindNameNotFoundResponseBody {\n\tbody := &ByCatalogKindNameNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "4736ebc3f5f62608d09de5cab65d2196", "score": "0.60189456", "text": "func NewUpdateCompanyUnauthorizedResponseBody(res *goa.ServiceError) *UpdateCompanyUnauthorizedResponseBody {\n\tbody := &UpdateCompanyUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "c64bb160d120dde406b5cae0f9ddacd7", "score": "0.59851265", "text": "func NewByCatalogKindNameVersionNotFoundResponseBody(res *goa.ServiceError) *ByCatalogKindNameVersionNotFoundResponseBody {\n\tbody := &ByCatalogKindNameVersionNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "c1083e42727e827c5800d0366c8da019", "score": "0.5901009", "text": "func NewShowNotFoundResponseBody(res *goa.ServiceError) *ShowNotFoundResponseBody {\n\tbody := &ShowNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "3db33fcda2dbc16e670180b489793a9a", "score": "0.58401656", "text": "func NewShowNotFoundResponseBody(res *pipeline.PipelineNotFound) *ShowNotFoundResponseBody {\n\tbody := &ShowNotFoundResponseBody{\n\t\tMessage: res.Message,\n\t\tID: res.ID,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "a5c97f481208c23b44ec8c97141ba09f", "score": "0.5794596", "text": "func NewByCatalogKindNameVersionReadmeNotFoundResponseBody(res *goa.ServiceError) *ByCatalogKindNameVersionReadmeNotFoundResponseBody {\n\tbody := &ByCatalogKindNameVersionReadmeNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "f77d47aee999222efc0cb9f76dd3005d", "score": "0.57881355", "text": "func NewDeactivateNotFoundResponseBody(res *goa.ServiceError) *DeactivateNotFoundResponseBody {\n\tbody := &DeactivateNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "1315fbdb1e1b122746cdc5e22aa5c481", "score": "0.57873654", "text": "func NewCreateCompanyBadRequestResponseBody(res *goa.ServiceError) *CreateCompanyBadRequestResponseBody {\n\tbody := &CreateCompanyBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "0d10b220de70bb673cb1219c040ebac8", "score": "0.57854366", "text": "func NewByIDNotFoundResponseBody(res *goa.ServiceError) *ByIDNotFoundResponseBody {\n\tbody := &ByIDNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "3e9db062624fc6a76d4aa2494e22156a", "score": "0.57579285", "text": "func NewListNotFoundResponseBody(res *goa.ServiceError) *ListNotFoundResponseBody {\n\tbody := &ListNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "dc5fbdb56346c5e329e8a45e4df80080", "score": "0.5691219", "text": "func NewShowNotFoundResponseBody(res *users.NotFound) *ShowNotFoundResponseBody {\n\tbody := &ShowNotFoundResponseBody{\n\t\tMessage: res.Message,\n\t\tID: res.ID,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "dc5fbdb56346c5e329e8a45e4df80080", "score": "0.5691219", "text": "func NewShowNotFoundResponseBody(res *users.NotFound) *ShowNotFoundResponseBody {\n\tbody := &ShowNotFoundResponseBody{\n\t\tMessage: res.Message,\n\t\tID: res.ID,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "8fb602d68bb355a7cf2da85e7935c59d", "score": "0.5651444", "text": "func NewByCatalogKindNameVersionYamlNotFoundResponseBody(res *goa.ServiceError) *ByCatalogKindNameVersionYamlNotFoundResponseBody {\n\tbody := &ByCatalogKindNameVersionYamlNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "31a0b1784f808413c45510bd357f0ccf", "score": "0.56268317", "text": "func NewListByReferenceNotFoundResponseBody(res *goa.ServiceError) *ListByReferenceNotFoundResponseBody {\n\tbody := &ListByReferenceNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "e48495e1a91c2dcb27699b79a7e545aa", "score": "0.55961895", "text": "func NewVersionsByIDNotFoundResponseBody(res *goa.ServiceError) *VersionsByIDNotFoundResponseBody {\n\tbody := &VersionsByIDNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "d20dcda019066c45b86a2d018140cfaa", "score": "0.5509587", "text": "func NewQueryNotFoundResponseBody(res *goa.ServiceError) *QueryNotFoundResponseBody {\n\tbody := &QueryNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "7d54a60384260411d232dfa61b8e597d", "score": "0.54764944", "text": "func NewDeleteNotFoundResponseBody(res *goa.ServiceError) *DeleteNotFoundResponseBody {\n\tbody := &DeleteNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "c113a506d3d51c114d04a4c10e6f22d2", "score": "0.54516965", "text": "func NewCreateCompanyUnauthorizedResponseBody(res *goa.ServiceError) *CreateCompanyUnauthorizedResponseBody {\n\tbody := &CreateCompanyUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "66eee0e008a629bf811a5e834e234526", "score": "0.5449327", "text": "func (o Ocs) NotFound(w http.ResponseWriter, r *http.Request) {\n\trender.Render(w, r, response.ErrRender(data.MetaNotFound.StatusCode, \"not found\"))\n}", "title": "" }, { "docid": "4a0837d6525dc6f97b6d1ca63cc1ec8e", "score": "0.5442577", "text": "func NewGetCompanyUnauthorizedResponseBody(res *goa.ServiceError) *GetCompanyUnauthorizedResponseBody {\n\tbody := &GetCompanyUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "783fcfb98a68349649e7960aee00f690", "score": "0.54292595", "text": "func (ctx *UpdateBottleContext) NotFound() error {\n\treturn ctx.Respond(404, nil)\n}", "title": "" }, { "docid": "18d8a47818fd38cd7f6641f8c9d301fd", "score": "0.54199886", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\t// set header status code to 404\n\tw.WriteHeader(http.StatusNotFound)\n\t// add response data\n\ttkn := json.NewEncoder(w).Encode(utils.NotFoundResponse())\n\tif tkn != nil {\n\t\tfmt.Println(\"Error \")\n\t}\n}", "title": "" }, { "docid": "546d8f03ae49508d162104d49296dc54", "score": "0.54183847", "text": "func NewCheckOrderFulfillabilityNotFoundResponseBody(res *goa.ServiceError) *CheckOrderFulfillabilityNotFoundResponseBody {\n\tbody := &CheckOrderFulfillabilityNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "3b98e44d45cd5e84af7b30555225244f", "score": "0.5414863", "text": "func NewProcessingNotFoundResponseBody(res *pipeline.PipelineNotFound) *ProcessingNotFoundResponseBody {\n\tbody := &ProcessingNotFoundResponseBody{\n\t\tMessage: res.Message,\n\t\tID: res.ID,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "6c2cc4ab4452dc6599b47a9a436477eb", "score": "0.54114115", "text": "func NewUpdateNotFound(body *UpdateNotFoundResponseBody) *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": "7d9d203c865bc41ec68dd5e1b8e68bd1", "score": "0.53960305", "text": "func NewCreateOrderNotFoundResponseBody(res *goa.ServiceError) *CreateOrderNotFoundResponseBody {\n\tbody := &CreateOrderNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "dbce6def9db6a183fd928ef7a47864f9", "score": "0.5381344", "text": "func (api *API) NotFound(w http.ResponseWriter, r *http.Request) {\n\tres := CodeToResult[CodeNotFound]\n\tres.Message = \"This API endpoint does not exist.\"\n\tw.WriteHeader(res.HTTPCode)\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "1ca8d580aa5ef3478f69eeafdbd0af9e", "score": "0.53807557", "text": "func (o *UpdateRepository30NotFound) Code() int {\n\treturn 404\n}", "title": "" }, { "docid": "b64af53027e0a30bc64820b244c78c8f", "score": "0.5360807", "text": "func NewGetLatestRawYamlByCatalogKindNameNotFoundResponseBody(res *goa.ServiceError) *GetLatestRawYamlByCatalogKindNameNotFoundResponseBody {\n\tbody := &GetLatestRawYamlByCatalogKindNameNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "15d5e4c0eaa37f9bc926b07338d5eeb1", "score": "0.5333049", "text": "func (ctx *UpdateWebContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "5372daf7a0bb4cae169e0b78f87ecfd2", "score": "0.5316144", "text": "func (ctx *ShowRepositoriesContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "20e63e9ce9e99c0b6caf4538568b935e", "score": "0.5315319", "text": "func NewListByPathNotFoundResponseBody(res *goa.ServiceError) *ListByPathNotFoundResponseBody {\n\tbody := &ListByPathNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "994b82a5674f13343c9f69268ba3945c", "score": "0.5310928", "text": "func NewCompanyListUnauthorizedResponseBody(res *goa.ServiceError) *CompanyListUnauthorizedResponseBody {\n\tbody := &CompanyListUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "cd0488785872054d54377b28de747cbc", "score": "0.5301059", "text": "func (s *NotarizationAPP) NotFound(rw web.ResponseWriter, r *web.Request) {\n\trw.WriteHeader(http.StatusNotFound)\n\tjson.NewEncoder(rw).Encode(restResult{Error: \"Notarization endpoint not found.\"})\n}", "title": "" }, { "docid": "379eb9d73e572c0095ddd97859d79ac3", "score": "0.52939284", "text": "func NewReadNotFoundResponseBody(res *goa.ServiceError) *ReadNotFoundResponseBody {\n\tbody := &ReadNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "426868eefa732c62ad258e42215d689f", "score": "0.52667785", "text": "func NotFound(w http.ResponseWriter, err error) {\n\tresponse := newResponse(http.StatusNotFound, nil, nil, err)\n\tsendJSON(w, &response)\n}", "title": "" }, { "docid": "05f975ca9b6e1f8079289c796bd1073c", "score": "0.52558535", "text": "func (ctx *UpdateAccountContext) NotFound() error {\n\treturn ctx.Respond(404, nil)\n}", "title": "" }, { "docid": "69462e2b87981a5e9489af28a1809154", "score": "0.5241345", "text": "func (r *Replier) NotFound(w http.ResponseWriter, data interface{}) error {\n\treturn r.Custom(w, http.StatusNotFound, data)\n}", "title": "" }, { "docid": "2d0115e67eab408ed3b7b97fc0aafedd", "score": "0.52403224", "text": "func (ctx *UpdateSubscriberNewsletterContext) NotFound(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "188ce4ffe1ac7e12f7594797da79865a", "score": "0.52380043", "text": "func (o *UpdateRepository17NotFound) Code() int {\n\treturn 404\n}", "title": "" }, { "docid": "ca47ce368f133add569ab3d26ff635fa", "score": "0.52254635", "text": "func (ctx *UpdateWorkflowContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "ec633c74d36e054c8bba7b44f4f869b5", "score": "0.5219602", "text": "func (ctx *UpdateCommunitiesStackoverflowharvestContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "b136628ef02ef69516bc92d9c2d8ece0", "score": "0.52113545", "text": "func (ctx *UpdateStackoverflowContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "5e1d511941a83789ceb32799f524a06d", "score": "0.52080494", "text": "func NotFound(w http.ResponseWriter, data interface{}) error {\n\treturn DefaultReplier.Custom(w, http.StatusNotFound, data)\n}", "title": "" }, { "docid": "e6576122c048679706484120c4f16bc1", "score": "0.51948273", "text": "func ValidateUpdateNotFoundResponseBody(body *UpdateNotFoundResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "7adbc576e6905cdc4d6e3555e984e13c", "score": "0.5193698", "text": "func notFoundError(err error, logger *log.Logger, w http.ResponseWriter, encoder *json.Encoder) {\n\tlogger.Print(err)\n\tw.WriteHeader(http.StatusNotFound)\n\tencoder.Encode(\"404: specified id does not exist\")\n}", "title": "" }, { "docid": "a7dc46c8d19b4c20ff2869cb5f85195c", "score": "0.5177277", "text": "func NewListOrdersNotFoundResponseBody(res *goa.ServiceError) *ListOrdersNotFoundResponseBody {\n\tbody := &ListOrdersNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "f712cfc4e8f62a88fad3a53e3f4cebcd", "score": "0.51631963", "text": "func NotFound(w http.ResponseWriter, message string) {\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(ErrorResponse{\n\t\tMessage: message,\n\t})\n}", "title": "" }, { "docid": "a241252df97551adfc3bde411f402777", "score": "0.51592314", "text": "func (ctx *UpdateFeedContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "e457ceb1379e468562d3dd7edc59f426", "score": "0.5157447", "text": "func (o *PutDeploymentResourceProxyRequestsNotFound) Code() int {\n\treturn 404\n}", "title": "" }, { "docid": "abd8d617b7d95fef3eec6bb7aa9ef8cb", "score": "0.5153632", "text": "func NotFound(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(`{}` + \"\\n\"))\n}", "title": "" }, { "docid": "835002149332575ef14f356ff3881721", "score": "0.5143041", "text": "func NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusNotFound)\n\n\tmodel.SendError(w)\n\treturn\n}", "title": "" }, { "docid": "f3ec7f33ecb61f995e35b3d3d00bda2c", "score": "0.51314145", "text": "func NewGetRawYamlByCatalogKindNameVersionNotFoundResponseBody(res *goa.ServiceError) *GetRawYamlByCatalogKindNameVersionNotFoundResponseBody {\n\tbody := &GetRawYamlByCatalogKindNameVersionNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "46f2043c9a52c6adc1c3c215a0340fb5", "score": "0.51284266", "text": "func NewGetCompanyResponseBodyID(res *hycompanyviews.CompanyView) *GetCompanyResponseBodyID {\n\tbody := &GetCompanyResponseBodyID{\n\t\tCompanyID: res.CompanyID,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "604b3015d380018ec9e800d592309f90", "score": "0.5120574", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tlogger.Error(\"[HTTP:Not Found] %s\", r.URL)\n\n\tbuilder := response.New(w, r)\n\tbuilder.WithStatus(http.StatusNotFound)\n\tbuilder.WithHeader(\"Content-Type\", contentTypeHeader)\n\tbuilder.WithBody(toJSONError(errors.New(\"resource not found\")))\n\tbuilder.Write()\n}", "title": "" }, { "docid": "8b6322d2d5e44256a0b22c4e2967ee01", "score": "0.51160794", "text": "func NewGetCompanyResponseBody(res *hycompanyviews.CompanyView) *GetCompanyResponseBody {\n\tbody := &GetCompanyResponseBody{\n\t\tCompanyID: res.CompanyID,\n\t\tCompanyName: res.CompanyName,\n\t\tCountryName: res.CountryName,\n\t\tAddress: res.Address,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "e4abd581f82d920370e0cb01128e1984", "score": "0.5108085", "text": "func (o *PatchOrganizationNotFound) Code() int {\n\treturn 404\n}", "title": "" }, { "docid": "93b65b50f1b7ada381a972fcb9a636a2", "score": "0.51030064", "text": "func (o *UpdateRepositoryNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "2148c14ae9200d779673d45fdb1caef0", "score": "0.5087653", "text": "func NewDeleteCompanyUnauthorizedResponseBody(res *goa.ServiceError) *DeleteCompanyUnauthorizedResponseBody {\n\tbody := &DeleteCompanyUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "451286c3fc2ccf724f92b136b81c5ffd", "score": "0.5085477", "text": "func (ctx *RegisterLinkedinContext) NotFound(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "00d6cd7774529df839d184fbf0e69e35", "score": "0.5080924", "text": "func ServeNotFound(w http.ResponseWriter, text interface{}) {\n\tw.WriteHeader(http.StatusNotFound)\n\tresponseJSON := map[string]interface{}{\n\t\t\"error\": text,\n\t}\n\tServeJSON(w, responseJSON)\n}", "title": "" }, { "docid": "8049909a97ceb9a358f603e4964bc06a", "score": "0.5054607", "text": "func (r *Response) NotFound(message ...string) {\n\tr.json(iris.StatusNotFound, message...)\n}", "title": "" }, { "docid": "4be15dcae11f70fa6604202cb247a578", "score": "0.50486356", "text": "func SendNotFound(w http.ResponseWriter, r *http.Request) {\n\t// Set the content type:\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// Prepare the body:\n\tid := \"404\"\n\treason := fmt.Sprintf(\n\t\t\"The requested resource '%s' doesn't exist\",\n\t\tr.URL.Path,\n\t)\n\tbody := Error{\n\t\tType: ErrorType,\n\t\tID: id,\n\t\tHREF: \"/api/ocm-oh-hi-aiden-service/v1/errors/\" + id,\n\t\tCode: \"OCM-EX-\" + id,\n\t\tReason: reason,\n\t}\n\tdata, err := json.Marshal(body)\n\tif err != nil {\n\t\tSendPanic(w, r)\n\t\treturn\n\t}\n\n\t// Send the response:\n\tw.WriteHeader(http.StatusNotFound)\n\t_, err = w.Write(data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Can't send response body for request '%s'\", r.URL.Path)\n\t\tglog.Error(err)\n\t\tsentry.CaptureException(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "3bbff72182b5dbf748d9d431d0c66a40", "score": "0.50480455", "text": "func NotFound(w http.ResponseWriter, r *http.Request, err error) {\n\trender.Render(w, r, NewErrorResponse(http.StatusNotFound, err))\n}", "title": "" }, { "docid": "3bbff72182b5dbf748d9d431d0c66a40", "score": "0.50480455", "text": "func NotFound(w http.ResponseWriter, r *http.Request, err error) {\n\trender.Render(w, r, NewErrorResponse(http.StatusNotFound, err))\n}", "title": "" }, { "docid": "52d576bc8bb20d74ab0e0c1418637530", "score": "0.50436044", "text": "func (resp *Response) NotFound(v interface{}) {\n\tresp.writeResponse(http.StatusNotFound, v)\n}", "title": "" }, { "docid": "63a0ee7d3e376600e143296057f1ccd1", "score": "0.50341904", "text": "func (o *UpdateTCPLbNotFound) Code() int {\n\treturn 404\n}", "title": "" }, { "docid": "330f03af0ae6bff20eb4759bc9cec078", "score": "0.5032295", "text": "func UpdateCompany(c *fiber.Ctx) error {\n\tvar body *models.Company\n\tid := c.Locals(\"userID\").(string)\n\terr := json.Unmarshal(c.Body(), &body)\n\tif err != nil {\n\t\terror := models.ErrorResponse{\n\t\t\tStatus: http.StatusBadRequest,\n\t\t\tMessage: \"body cant be empty\",\n\t\t}\n\t\treturn c.Status(error.Status).JSON(error)\n\t}\n\tcompany, err := companyService.FindCompanyByID(id)\n\tif err != nil {\n\t\terror := models.ErrorResponse{\n\t\t\tStatus: http.StatusNotFound,\n\t\t\tMessage: fmt.Sprintf(\"cant find student with id %s\", id),\n\t\t}\n\t\treturn c.Status(error.Status).JSON(error)\n\t}\n\tif name := body.Name; name != \"\" {\n\t\tcompany.Name = name\n\t}\n\tif email := body.Email; email != \"\" {\n\t\tcompany.Email = email\n\t}\n\tif registrationNumber := body.RegistrationNumber; registrationNumber != \"\" {\n\t\tcompany.RegistrationNumber = registrationNumber\n\t}\n\tif gstNumber := body.GSTNumber; gstNumber != \"\" {\n\t\tcompany.GSTNumber = gstNumber\n\t}\n\tif webSiteURL := body.WebSiteURL; webSiteURL != \"\" {\n\t\tcompany.WebSiteURL = webSiteURL\n\t}\n\tif phoneNumber := body.PhoneNumber; phoneNumber != \"\" {\n\t\tcompany.PhoneNumber = phoneNumber\n\t}\n\tif address := body.Address; address != \"\" {\n\t\tcompany.Address = address\n\t}\n\terr = companyService.UpdateCompany(company)\n\tif err != nil {\n\t\terror := models.ErrorResponse{\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMessage: \"someting went wrong\",\n\t\t}\n\t\treturn c.Status(error.Status).JSON(error)\n\t}\n\treturn c.JSON(company)\n}", "title": "" }, { "docid": "416fe46ff2cf97e713d6c3039fcfffbe", "score": "0.50321", "text": "func NOTFOUND(ctx *gin.Context) {\n\tresponse := response{\n\t\tCode: constant.CODE_404,\n\t\tMessage: constant.GetCodeText(constant.CODE_404),\n\t\tData: gin.H{},\n\t}\n\tctx.Set(\"response\", response)\n\tctx.JSON(http.StatusNotFound, response)\n}", "title": "" }, { "docid": "06d65eeb5d6b5371599fb5f834cc0520", "score": "0.5026076", "text": "func notFound(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(`{\"message\": \"not found\"}`))\n}", "title": "" }, { "docid": "3f21f450cab294a99c5cf783868f6f81", "score": "0.501276", "text": "func (o *PetUpdateNotFound) Code() int {\n\treturn 404\n}", "title": "" }, { "docid": "e549364d10219d7421276f8c2e8c275c", "score": "0.50115883", "text": "func (o *UpdateRepository30NoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "5ae4b5f42187504ac76e46a8c844f542", "score": "0.5011549", "text": "func (ctx *UpdateAboutRedditharvestContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "2f67f70545408e34102b48b36b7a21ed", "score": "0.5010104", "text": "func ValidateByCatalogKindNameNotFoundResponseBody(body *ByCatalogKindNameNotFoundResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3c739ce61e62c608d150d54230f41b99", "score": "0.50077385", "text": "func NewUpdateBadRequestResponseBody(res *goa.ServiceError) *UpdateBadRequestResponseBody {\n\tbody := &UpdateBadRequestResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "c799b4a7d4f07a77f8c9c82a568b078e", "score": "0.49866587", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(`{ \"code\": \"endpoint_not_found\", \"message\": \"Endpoint not found\" }`))\n}", "title": "" }, { "docid": "5f0e386c881dc1a3c8733d1383771717", "score": "0.49836078", "text": "func (ctx *UpdateTasksContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "0c076155535d9b1c54f6cbb9397bb8ad", "score": "0.49773973", "text": "func (o *InvoiceIndexResponseInvoices) GetCompanyIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.CompanyId, true\n}", "title": "" }, { "docid": "f8551d566de3c409c203866b72362e32", "score": "0.4976642", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Content-Type\", \"application/json\")\n w.WriteHeader(http.StatusNotFound)\n w.Write([]byte(`{\"message\": \"not found\"}`))\n}", "title": "" }, { "docid": "61d1b3d76cfacce0aca42540fd43b413", "score": "0.49642995", "text": "func (ctx *UpdateSubmittedInfoRedditharvestContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "e7eeb16ebcbac9fa2abc21abba3320c0", "score": "0.4960302", "text": "func WriteRespAlertNotFound(w http.ResponseWriter, r *http.Request) {\n\tif respWritten(r) {\n\t\tlog.Errorf(\"WriteRespAlert called after a write already occurred! Not double-writing! Path %s\", r.URL.Path)\n\t\treturn\n\t}\n\tsetRespWritten(r)\n\n\tresp := struct{ tc.Alerts }{tc.CreateAlerts(tc.ErrorLevel, \"Resource not found.\")}\n\trespBts, err := json.Marshal(resp)\n\tif err != nil {\n\t\thandleSimpleErr(w, r, http.StatusInternalServerError, nil, errors.New(\"marshalling JSON: \"+err.Error()))\n\t\treturn\n\t}\n\tw.Header().Set(rfc.ContentType, rfc.ApplicationJSON)\n\tw.WriteHeader(http.StatusNotFound)\n\tWriteAndLogErr(w, r, append(respBts, '\\n'))\n}", "title": "" }, { "docid": "f44e976788a24cf4d9421d2ea6bd7f1d", "score": "0.4957709", "text": "func (o *GetCorporationsCorporationIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(404)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1d43403089619eb3bbcca13d3baae87a", "score": "0.49476293", "text": "func (ctx *UpdateProfileStackoverflowharvestContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "ebaf25ee0fe8075df3378d4f8bdce9f2", "score": "0.49447918", "text": "func (ctx *UpdateProfilesContext) NotFound(r *StandardError) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/standard_error+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "dd443055bf126b08d7bc98e29f06f7b6", "score": "0.49410185", "text": "func (o *UpdateRepository6NoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "2d959d1b2b6f69171048d89d789327bc", "score": "0.49333596", "text": "func notFound(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(`{\"bruh\": \"lol\"}`))\n}", "title": "" }, { "docid": "2d959d1b2b6f69171048d89d789327bc", "score": "0.49333596", "text": "func notFound(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(`{\"bruh\": \"lol\"}`))\n}", "title": "" }, { "docid": "744ac403ac0ecb01b82b37a7173b6cf3", "score": "0.4928609", "text": "func (o *PatchOrganizationNoContent) Code() int {\n\treturn 204\n}", "title": "" }, { "docid": "484863ed2e6d10485c621f1538569d28", "score": "0.4927568", "text": "func NewUpdateBadReqResponseBody(res *goa.ServiceError) *UpdateBadReqResponseBody {\n\tbody := &UpdateBadReqResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "eef479dbe73b38067cfcf10c42d53b69", "score": "0.4926817", "text": "func (ctx *GetSubscriberByEmailNewsletterContext) NotFound(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "c0b8447bd7d8f156aafb3e298400c219", "score": "0.49232116", "text": "func (ctx *ShowCommitsContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "d7089a043be9444fa5ec2d67d2af6f48", "score": "0.491889", "text": "func (ws *WebService) NotFoundHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusNotFound)\n\tio.WriteString(w, `404 page not found`)\n}", "title": "" }, { "docid": "8a1cb2097a6b3d61b6a4074fbb2e7412", "score": "0.49174532", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tlogger.Error(\"[HTTP:Not Found] %s\", r.URL)\n\n\tbuilder := response.New(w, r)\n\tbuilder.WithStatus(http.StatusNotFound)\n\tbuilder.WithHeader(\"Content-Type\", \"text/html; charset=utf-8\")\n\tbuilder.WithHeader(\"Cache-Control\", \"no-cache, max-age=0, must-revalidate, no-store\")\n\tbuilder.WithBody(\"Page Not Found\")\n\tbuilder.Write()\n}", "title": "" }, { "docid": "7c09a58b50162fda1cff58381ad545ae", "score": "0.491367", "text": "func (ctx *AddSubscriberNewsletterContext) NotFound(r error) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.goa.error\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 404, r)\n}", "title": "" }, { "docid": "a3c3e1f56a56001fafe0df327239d3af", "score": "0.49063155", "text": "func NewGetCompanyResponseBodyIdname(res *hycompanyviews.CompanyView) *GetCompanyResponseBodyIdname {\n\tbody := &GetCompanyResponseBodyIdname{\n\t\tCompanyID: res.CompanyID,\n\t\tCompanyName: res.CompanyName,\n\t}\n\treturn body\n}", "title": "" } ]
cb455fcda350e2dadb40cb993cbd9590
Database returns an instance of database ORM object with specified configuration group name.
[ { "docid": "0e6f1e4b7c0743e3866ae0733da5cd3a", "score": "0.5585387", "text": "func Database(name ...string) gdb.DB {\n\treturn qn_ins.Database(name...)\n}", "title": "" } ]
[ { "docid": "7ce8b49fe9c635bc25d3cb06f2f6ce05", "score": "0.654925", "text": "func Database() *gorm.DB {\n\treturn instance\n}", "title": "" }, { "docid": "e0e65a151c2f47e922fce4ea28671531", "score": "0.6461648", "text": "func DB(name ...string) *sqlx.DB {\n\tif len(name) == 0 {\n\t\tif defaultDB == nil {\n\t\t\tlogger.Panic(fmt.Sprintf(\"yiigo: unknown db.%s (forgotten configure?)\", AsDefault))\n\t\t}\n\n\t\treturn defaultDB\n\t}\n\n\tv, ok := dbmap.Load(name[0])\n\n\tif !ok {\n\t\tlogger.Panic(fmt.Sprintf(\"yiigo: unknown db.%s (forgotten configure?)\", name[0]))\n\t}\n\n\treturn v.(*sqlx.DB)\n}", "title": "" }, { "docid": "8f92c746bdc625fa0f47cbc46789a3e0", "score": "0.64231175", "text": "func Orm(name ...string) *gorm.DB {\n\tif len(name) == 0 || name[0] == AsDefault {\n\t\tif defaultOrm == nil {\n\t\t\tlogger.Panic(fmt.Sprintf(\"yiigo: unknown db.%s (forgotten configure?)\", AsDefault))\n\t\t}\n\n\t\treturn defaultOrm\n\t}\n\n\tv, ok := ormap.Load(name[0])\n\n\tif !ok {\n\t\tlogger.Panic(fmt.Sprintf(\"yiigo: unknown db.%s (forgotten configure?)\", name[0]))\n\t}\n\n\treturn v.(*gorm.DB)\n}", "title": "" }, { "docid": "9c681b96e0b84954f742e32684ada655", "score": "0.6306167", "text": "func (c Config) Database() Database {\n\treturn c.database\n}", "title": "" }, { "docid": "aa6d792b420555e9e65fcb4b0c9c4b1d", "score": "0.6236353", "text": "func Database(name string) *Builder {\n\treturn &Builder{\n\t\tname: name,\n\t\tentityType: DatabaseType,\n\t}\n}", "title": "" }, { "docid": "b32185e5ca1a25b9f1405febf501f548", "score": "0.6183638", "text": "func DBInstance(connectionType string) *gorm.DB {\n\tvar conf DatabaseConfig\n\n\tswitch connectionType {\n\tcase \"\":\n\t\tconf = loadDBConfiguration()\n\t}\n\n\tdsn := fmt.Sprintf(\n\t\t\"%s:%s@tcp(%s:%d)/%s?charset=utf8&parseTime=True&loc=Local\",\n\t\tconf.User,\n\t\tconf.Password,\n\t\tconf.Host,\n\t\tconf.Port,\n\t\tconf.Schema,\n\t)\n\n\tgormConf := &gorm.Config{}\n\n\tif conf.DebugMode {\n\t\tgormConf.Logger = loadDBLoggerConfiguration()\n\t}\n\n\tinstance, err := gorm.Open(mysql.Open(dsn), gormConf)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdb, _ := instance.DB()\n\n\tswitch connectionType {\n\tcase \"\":\n\t\tdb.SetMaxIdleConns(Cfg.DB.PoolMaxIdle)\n\t\tdb.SetMaxOpenConns(Cfg.DB.PoolMaxOpen)\n\t}\n\n\tif conf.DebugMode {\n\t\treturn instance.Debug()\n\t}\n\n\treturn instance\n}", "title": "" }, { "docid": "74af1040d46f6c2b526adf5f2a0eac8c", "score": "0.60981524", "text": "func (env *Environment) Database() goext.IDatabase {\n\treturn env.databaseImpl\n}", "title": "" }, { "docid": "0ed8db963ca4af688cbc35ea7875e4fc", "score": "0.60691524", "text": "func Database() *sql.DB {\n\tif container.Database == nil {\n\t\tcontainer.Database = database.Must(database.Default())\n\t}\n\n\treturn container.Database\n}", "title": "" }, { "docid": "0ed8db963ca4af688cbc35ea7875e4fc", "score": "0.60691524", "text": "func Database() *sql.DB {\n\tif container.Database == nil {\n\t\tcontainer.Database = database.Must(database.Default())\n\t}\n\n\treturn container.Database\n}", "title": "" }, { "docid": "ff50ff0b9072736d8a5d457ae526728e", "score": "0.60274875", "text": "func (c *Config) Db() *gorm.DB {\n\tif c.db == nil {\n\t\tc.connectToDatabase()\n\t}\n\n\treturn c.db\n}", "title": "" }, { "docid": "201d828cea8a530315ace841f8da372a", "score": "0.602135", "text": "func GetDB() *gorm.DB {\n\tvar err error\n\n\tif db != nil {\n\t\treturn db\n\t}\n\n\tdbType := viper.GetString(dbTypeKey)\n\tdbName := viper.GetString(dbNameKey)\n\n\tdb, err = gorm.Open(dbType, dbName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "6683d2bc0d8e2b18635fcfa58332ed62", "score": "0.6006242", "text": "func (d *Database) GetDatabase() *Database { return d }", "title": "" }, { "docid": "47ff6e593c293d8fa9b08dada5f4958d", "score": "0.5996449", "text": "func (couch CouchDB) GetDatabase(name string) Database {\n return Database { name, couch }\n}", "title": "" }, { "docid": "6419933879cb1966b95cccf2dc3d4f7f", "score": "0.59908247", "text": "func GetDatabase(c *p.Provider) (p.ClowderProvider, error) {\n\tdbMode := c.Env.Spec.Providers.Database.Mode\n\tswitch dbMode {\n\tcase \"local\":\n\t\treturn NewLocalDBProvider(c)\n\tcase \"app-interface\":\n\t\treturn NewAppInterfaceDBProvider(c)\n\tcase \"none\", \"\":\n\t\treturn NewNoneDBProvider(c)\n\tdefault:\n\t\terrStr := fmt.Sprintf(\"No matching db mode for %s\", dbMode)\n\t\treturn nil, errors.New(errStr)\n\t}\n}", "title": "" }, { "docid": "294b815580ab9afab389848c9f0e8dc2", "score": "0.597582", "text": "func GetDatabase(ctx foundation.Context) (ret *gorm.DB) {\n\tif v := Value(ctx, \"database\"); v != nil {\n\t\tif t, ok := v.(*gorm.DB); ok {\n\t\t\tret = t\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "412b87f8a3cd1aa1da44921b4f8b4061", "score": "0.597012", "text": "func GetDB(name string) *gorm.DB {\n\tif _, ok := gx[name]; ok {\n\t\treturn gx[name]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f62eecaf787fe538377154553bc3d42b", "score": "0.5960097", "text": "func Database(r *http.Request) *sql.DB {\n\treturn r.Context().Value(key(\"database\")).(*sql.DB)\n}", "title": "" }, { "docid": "471212fb89e56cb93681e4a4ed140f85", "score": "0.5945114", "text": "func GetDB() *gorm.DB {\n\tif config != nil && config.IsOps {\n\t\treturn db\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5df2afa991655e46f6afa2604e90617d", "score": "0.5940924", "text": "func newDB(cfg config) (Datab, error) {\n\tswitch cfg.dbType {\n\tcase \"sqlite\":\n\t\treturn newSQLite(cfg)\n\tcase \"postgres\":\n\t\treturn newPostgres(cfg)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown backend: %q\", cfg.dbType)\n\t}\n}", "title": "" }, { "docid": "78354cc5d15d720357f874b859a0aee0", "score": "0.591741", "text": "func NewDatabase(config interface{}) *Database {\n\tcfg := config.(string)\n\n\tdc := DatabaseConfig{\n\t\tMaster: cfg,\n\t}\n\n\treturn &Database{\n\t\tName: dc,\n\t}\n}", "title": "" }, { "docid": "6e85389f74806c87ab4e537eed7c36cf", "score": "0.59017736", "text": "func GetDBInstance(databaseConfig model.Database) (db abstraction.Database, err error) {\n\tswitch strings.ToLower(databaseConfig.Dialect) {\n\tcase \"sqlite3\":\n\t\tdb, err = sqlite.CreateDatabase(databaseConfig)\n\t\treturn db, err\n\tcase \"postgres\":\n\t\tdb, err = postgres.CreateDatabase(databaseConfig)\n\t\treturn db, err\n\tcase \"mysql\":\n\t\tdb, err = mysql.CreateDatabase(databaseConfig)\n\t\treturn db, err\n\tcase \"dynamodb\":\n\t\tdb, err = dynamodb.CreateDatabase(databaseConfig)\n\t\treturn db, err\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported dialect %v\", databaseConfig.Dialect)\n\t\treturn db, err\n\t}\n}", "title": "" }, { "docid": "5e2d60bacbb16b61c31cbe175d7f0a61", "score": "0.5867912", "text": "func getDb(dbConfig config.AppConfig) *gorm.DB {\n\tdb, err := gorm.Open(\n\t\t\"postgres\",\n\t\tfmt.Sprintf(\n\t\t\t\"host=%s port=%d user=%s dbname=%s password=%s sslmode=%s\",\n\t\t\tdbConfig.Database.Host,\n\t\t\tdbConfig.Database.Port,\n\t\t\tdbConfig.Database.User,\n\t\t\tdbConfig.Database.Name,\n\t\t\tdbConfig.Database.Password,\n\t\t\tdbConfig.Database.SSLMode,\n\t\t),\n\t)\n\tif err != nil {\n\t\tlog.Panicf(\"test environment: database connection failed - %s\", err)\n\t}\n\n\tdb.AutoMigrate(&user{}, &expense{}, &setting{})\n\treturn db\n}", "title": "" }, { "docid": "93286b6893a34facc0242d0d6fd3f788", "score": "0.58671796", "text": "func DB() DatabaseConfig {\n\treturn dbCfg\n}", "title": "" }, { "docid": "97e8d2b340ae31c3061257b4a20bba7a", "score": "0.5861887", "text": "func GetDatabase() *gorm.DB {\n\treturn DB\n}", "title": "" }, { "docid": "ff72d6e2278105ec8f2caf25293a7ba2", "score": "0.5832827", "text": "func GetDatabase() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "9716964718ed9c61f7fd7cb83704c94c", "score": "0.58215857", "text": "func (r *Registry) NewDatabase(ctx context.Context, name string,\n\tconfig interface{}) (database.DB, error) {\n\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\n\tmaker, ok := r.databases[name]\n\tif !ok {\n\t\treturn nil, errs.New(\"no registration for: %q\", name)\n\t}\n\n\treturn maker.New(ctx, config)\n}", "title": "" }, { "docid": "14ef475b81b469a28298f74cd2613c0e", "score": "0.5808287", "text": "func ProvideDatabase(config configs.Config) *Database {\n\tdb := &Database{}\n\tdb.Init(config)\n\n\treturn db\n}", "title": "" }, { "docid": "29c664dcbd40259c56cf9637dea31252", "score": "0.5805636", "text": "func Factory() (*ORM, error) {\n\tdsn := fmt.Sprintf(\"host=%s user=%s port=%s dbname=%s sslmode=%s password=%s\", hostDB, userDB, portDB, nameDB, sslDB, passwordDB) //Build connection string\n\n\tdb, err := gorm.Open(dialect, dsn)\n\tif err != nil {\n\t\tlog.Panic(\"[ORM] err: \", err)\n\t}\n\torm := &ORM{\n\t\tDB: db,\n\t}\n\t// Log every SQL command on dev, @prod: this should be disabled?\n\tdb.LogMode(logMode)\n\t// Automigrate tables\n\tif autoMigrate {\n\t\terr = migration.ServiceAutoMigration(orm.DB)\n\t}\n\tlog.Info(\"[ORM] Database connection initialized.\")\n\treturn orm, err\n}", "title": "" }, { "docid": "78e591f2360d68b499a32c3057818dc0", "score": "0.5805", "text": "func GetDB() *gorm.DB {\n return db\n}", "title": "" }, { "docid": "84755e100c491bb3284620c39ba346ec", "score": "0.5801435", "text": "func Database() (*mongo.Database, error) {\n\tif !initialized {\n\t\treturn nil, errors.New(\"Calling database without initializing\")\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "a375f4f17ec31fd95e084c822037e864", "score": "0.578114", "text": "func (s *mongoSession) DB(name string) DataLayer {\n\treturn &mongoDatabase{s.Session.DB(name)}\n}", "title": "" }, { "docid": "072067e4dce48b998285776db6df8788", "score": "0.57587177", "text": "func GetDatabase() *mgo.Database {\n\treturn db\n}", "title": "" }, { "docid": "1addb0bbb00140f9084102766aa6cf80", "score": "0.5755337", "text": "func Instance() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "9b6a2d5afec8cd8126de716714527c12", "score": "0.57485515", "text": "func RegisterDatabase(dbcfg *DatabaseConfig, tc gorp.TypeConverter) (zesty.DB, error) {\n\tdbConn, err := sql.Open(dbcfg.System.DriverName(), dbcfg.DSN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Make sure we have proper values for the database\n\t// settings, and replace them with default if necessary\n\t// before applying to the new connection.\n\tif dbcfg.MaxOpenConns == 0 {\n\t\tdbcfg.MaxOpenConns = maxOpenConns\n\t}\n\tdbConn.SetMaxOpenConns(dbcfg.MaxOpenConns)\n\tif dbcfg.MaxIdleConns == 0 {\n\t\tdbcfg.MaxIdleConns = maxIdleConns\n\t}\n\tdbConn.SetMaxIdleConns(dbcfg.MaxIdleConns)\n\tdbConn.SetConnMaxLifetime(dbcfg.ConnMaxLifetime)\n\n\t// Select the proper dialect used by gorp.\n\tvar dialect gorp.Dialect\n\tswitch dbcfg.System {\n\tcase DatabaseMySQL:\n\t\tdialect = gorp.MySQLDialect{}\n\tcase DatabasePostgreSQL:\n\t\tdialect = gorp.PostgresDialect{}\n\tcase DatabaseSqlite3:\n\t\tdialect = gorp.SqliteDialect{}\n\tdefault:\n\t\treturn nil, errors.New(\"unknown database system\")\n\t}\n\tdbmap := &gorp.DbMap{\n\t\tDb: dbConn,\n\t\tDialect: dialect,\n\t\tTypeConverter: tc,\n\t}\n\tmodelsMu.Lock()\n\ttableModels := models[dbcfg.Name]\n\tfor _, t := range tableModels {\n\t\tdbmap.AddTableWithName(t.Model, t.Name).SetKeys(t.AutoIncrement, t.Keys...)\n\t}\n\tmodelsMu.Unlock()\n\n\tif dbcfg.AutoCreateTables {\n\t\terr = dbmap.CreateTablesIfNotExists()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb := zesty.NewDB(dbmap)\n\tif err := zesty.RegisterDB(db, dbcfg.Name); err != nil {\n\t\treturn nil, err\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "5cd732f9fdfa2aa8d70dd6a1651bf1ad", "score": "0.572738", "text": "func New(config *Config) *Database {\n\n\treturn &Database{config: config}\n\n}", "title": "" }, { "docid": "6c8c68062bac7e22a0f837e1c311123d", "score": "0.5724005", "text": "func New(logger log.Logger, c database.Config) (*gorm.DB, error) {\n\tg, err := gorm.Open(\"mysql\", c.DSN()+\"?charset=utf8&parseTime=True&loc=Local\")\n\n\tg.SetLogger(gogorm.NewLogger(logger))\n\n\treturn g, err\n}", "title": "" }, { "docid": "a537689b1625cd58c8fadeb53fad8252", "score": "0.57065076", "text": "func NewORM(chainID *big.Int, db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) *ORM {\n\tnamedLogger := lggr.Named(\"Configs\")\n\tq := pg.NewQ(db, namedLogger, cfg)\n\treturn &ORM{\n\t\tchainID: chainID,\n\t\tq: q,\n\t}\n}", "title": "" }, { "docid": "2e292fe542a8efdc31d7122a1ea6cec3", "score": "0.56950945", "text": "func New(opts ...EngineOpt) (Interface, error) {\n\t// create new database engine\n\te := new(engine)\n\n\t// create new fields\n\te.client = new(gorm.DB)\n\te.config = new(config)\n\te.logger = new(logrus.Entry)\n\te.ctx = context.TODO()\n\n\t// apply all provided configuration options\n\tfor _, opt := range opts {\n\t\terr := opt(e)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// validate the configuration being provided\n\terr := e.config.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// update the logger with additional metadata\n\te.logger = logrus.NewEntry(logrus.StandardLogger()).WithField(\"database\", e.Driver())\n\n\te.logger.Trace(\"creating database engine from configuration\")\n\t// process the database driver being provided\n\tswitch e.config.Driver {\n\tcase constants.DriverPostgres:\n\t\t// create the new Postgres database client\n\t\te.client, err = gorm.Open(postgres.Open(e.config.Address), &gorm.Config{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase constants.DriverSqlite:\n\t\t// create the new Sqlite database client\n\t\te.client, err = gorm.Open(sqlite.Open(e.config.Address), &gorm.Config{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\t// handle an invalid database driver being provided\n\t\treturn nil, fmt.Errorf(\"invalid database driver provided: %s\", e.Driver())\n\t}\n\n\t// capture database/sql database from gorm.io/gorm database\n\tdb, err := e.client.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// set the maximum amount of time a connection may be reused\n\tdb.SetConnMaxLifetime(e.config.ConnectionLife)\n\t// set the maximum number of connections in the idle connection pool\n\tdb.SetMaxIdleConns(e.config.ConnectionIdle)\n\t// set the maximum number of open connections to the database\n\tdb.SetMaxOpenConns(e.config.ConnectionOpen)\n\n\t// verify connection to the database\n\terr = e.Ping()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create database agnostic engines for resources\n\terr = e.NewResources(e.ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn e, nil\n}", "title": "" }, { "docid": "5cb02060fd1d724c3d7cf582e2e63c5a", "score": "0.56895983", "text": "func (o *ORM) GetDB() *gorm.DB {\n\t// return o.DB.New()\n\t// CONTINUE: Implement connection pools\n\treturn o.DB\n}", "title": "" }, { "docid": "70b0151d709a22dac2021ca5d2435084", "score": "0.5686409", "text": "func (o *ORM) GetDB() *gorm.DB {\r\n\t// return o.DB.New()\r\n\t// CONTINUE: Implement connection pools\r\n\treturn o.DB\r\n}", "title": "" }, { "docid": "b376f2edaf054ed3c99894ed011d4b18", "score": "0.5686336", "text": "func Instance() (Database, error) {\n\tif database != nil {\n\t\treturn database, nil\n\t}\n\n\tclientOptions := options.Client().ApplyURI(utils.GetVariable(consts.DB_URI)).SetAuth(options.Credential{\n\t\tUsername: utils.GetVariable(consts.DB_USER),\n\t\tPassword: utils.GetVariable(consts.DB_PASS),\n\t})\n\n\tclient, err := mongo.Connect(context.Background(), clientOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdatabase = &mongoDB{\n\t\tclient: client,\n\t}\n\treturn database, nil\n}", "title": "" }, { "docid": "af5d3cfc9f67e5f6edb36f9d92f20f80", "score": "0.5679192", "text": "func (m *Manager) Get(name string) (Database, error) {\n\tm.mutex.RLock()\n\tdefer m.mutex.RUnlock()\n\tif d, ok := m.databases[name]; ok {\n\t\treturn d, nil\n\t}\n\treturn nil, fmt.Errorf(\"invalid database driver \\\"%s\\\" specifed\", name)\n}", "title": "" }, { "docid": "d52d03e2ca3edbd735ecd5e5555245e4", "score": "0.5678328", "text": "func Get() *mgo.Database {\n\treturn Database\n}", "title": "" }, { "docid": "962a9d3734353d4d60d39f31ad98be05", "score": "0.5671729", "text": "func (d Databases) Database(name string) (Database, error) {\n\tfor _, db := range d {\n\t\tif db.Name() == name {\n\t\t\treturn db, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"database not found: %s\", name)\n}", "title": "" }, { "docid": "137ac3a74d62b3fb473b2bed70de3450", "score": "0.56708854", "text": "func (f factory) Get() (Database, error) {\n\t//setup db\n\tdbLoc, err := f.lb.FindService(fmt.Sprintf(\"%s-db\", f.serviceName))\n\tif err != nil {\n\t\tf.log.Printf(\"Error finding to db: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdb, err := NewDb(\"postgres\", fmt.Sprintf(\"postgres://%s:%s@%s:%d/%s?sslmode=disable\", f.dbUser, url.QueryEscape(f.dbPass), dbLoc.URL, dbLoc.Port, f.serviceName))\n\tif err != nil {\n\t\tf.log.Printf(\"Error connecting to db: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "41c721dc02d949adebdfabfddb9c965b", "score": "0.5658304", "text": "func (config *Config) DbUse() (db *sql.DB, err error) {\n return config.Open()\n}", "title": "" }, { "docid": "edfd8c1dfb00f4859a363e446ae0c17f", "score": "0.5653485", "text": "func Init() *gorm.DB {\n\tdb, err := gorm.Open(config.DatabaseSetting.Type, config.DatabaseSetting.Host)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdatabase = db\n\treturn database\n}", "title": "" }, { "docid": "d175f24811465293eb673e50c758d181", "score": "0.5642877", "text": "func GetDb() *gorm.DB {\n\tDbDriver := \"mysql\"\n\n\t// Retrieve values from .env file\n\tDbHost := os.Getenv(\"MYSQL_HOSTNAME\")\n\tDbPort := os.Getenv(\"MYSQL_PORT\")\n\tDbUser := os.Getenv(\"MYSQL_USER\")\n\tDbPassword := os.Getenv(\"MYSQL_PASSWORD\")\n\tDbName := os.Getenv(\"MYSQL_DBNAME\")\n\n\t// Build Database source string\n\tDbSource := DbUser + \":\" + DbPassword + \"@tcp(\" + DbHost + \":\" + DbPort + \")/\" + DbName +\n\t\t\"?charset=utf8&parseTime=True&loc=Local\"\n\tfmt.Println(DbSource)\n\tDb, err := gorm.Open(DbDriver, DbSource)\n\tif err != nil {\n\t\tfmt.Printf(\"Cannot connect to %s database\\n\", DbDriver)\n\t\tlog.Fatal(\"Error:\", err)\n\t} else {\n\t\tfmt.Printf(\"Successfully connected to the %s database\\n\", DbDriver)\n\t}\n\treturn Db\n}", "title": "" }, { "docid": "7c19d3446243222e685051571b89622f", "score": "0.5636715", "text": "func (s *Services) DB(name string) (*sql.DB, error) {\n\tsvc, err := s.service(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !svc.HasRole(s.ctx.Role) {\n\t\treturn nil, nil\n\t}\n\n\tif svc.Type != TypeDatabase {\n\t\treturn nil, fmt.Errorf(\"service %s is of type %s, not Database\", name, svc.Type)\n\t}\n\n\tif mapContains(svc.SvcParams, \"database\", \"username\", \"password\", \"host\") {\n\t\tqs := url.Values{}\n\t\tqs.Add(\"collation\", \"utf8mb4_general_ci\")\n\t\tqs.Add(\"parseTime\", \"true\")\n\t\tqs.Add(\"timeout\", \"1.5s\")\n\t\tqs.Add(\"readTimeout\", \"1s\")\n\t\tqs.Add(\"writeTimeout\", \"1s\")\n\n\t\tconnectionString := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?%s\", svc.SvcParams[\"username\"], svc.SvcParams[\"password\"], svc.SvcParams[\"host\"], svc.SvcParams[\"database\"], qs.Encode())\n\t\tdb, err := sql.Open(\"mysql\", connectionString)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn db, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"missing params for initializing Database service\")\n}", "title": "" }, { "docid": "aec81e1ace76881f781dd5ac0a2312c5", "score": "0.56301", "text": "func Open(config *config.DBConfigFields) (interface{}, error) {\n\thost := strings.ToLower(config.Host)\n\tswitch host {\n\tcase \"postgres\":\n\t\tconnectionString := fmt.Sprintf(\"host=%s user=%s password=%s dbname=%s sslmode=disable\", config.Server, config.UserName, config.Password, config.DBName)\n\t\tdatabase, err := sql.Open(\"postgres\", connectionString)\n\t\treturn database, err\n\n\tcase \"mongodb\":\n\t\tsession, err := mgo.Dial(config.Server)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Optional. Switch the session to a monotonic behavior.\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\treturn session.DB(config.DBName), nil\n\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupportted host\")\n\t}\n}", "title": "" }, { "docid": "a06a807a49f25950c74298d9eaeff7f2", "score": "0.5622077", "text": "func NewDB(dir, name string, autovacuum bool) *Database {\n\tif name == \"\" {\n\t\tname = \"awsman.db\"\n\t}\n\tdbase := &Database{\n\t\tError: nil,\n\t}\n\tparent := filepath.Join(dir, \"awsman\")\n\terr := utils.MakeDirectory(parent)\n\tif err != nil {\n\t\tparent = dir\n\t}\n\tname = filepath.Join(parent, name)\n\tlogger.Infof(\"cache db %v\", name)\n\n\tdnsfmt := \"%v\"\n\tif autovacuum {\n\t\tdnsfmt = \"file:%v?_auto_vacuum=1\"\n\t}\n\n\tdns := fmt.Sprintf(dnsfmt, name)\n\tdb, err := gorm.Open(sqlite.Open(dns), &gorm.Config{})\n\tif err != nil {\n\t\tdbase.Error = err\n\t\tdbase.Name = name\n\n\t\treturn dbase\n\t}\n\t//set\n\tdbase._db = db\n\tdbase.Name = name\n\tdbase.Error = nil\n\n\treturn dbase\n}", "title": "" }, { "docid": "d4d7aea9822be717d8ca8d3870d59931", "score": "0.5621745", "text": "func GetDatabase() *gorm.DB {\n\tif database == nil {\n\t\tlock.Lock()\n\t\tdefer lock.Unlock()\n\t\tif database == nil {\n\t\t\tdatabase = newDatabase()\n\t\t}\n\t}\n\n\treturn database\n}", "title": "" }, { "docid": "d9e3745099dff941fd5db9bb4dd4cbd3", "score": "0.56196076", "text": "func New(config *Config) (*Database, error) {\n\tdb, err := gorm.Open(\"postgres\", config.DatabaseURI)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to connect to database\")\n\t}\n\n\tif err = db.DB().Ping(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"database ping error\")\n\t}\n\tlog.Println(\"Connected to database\")\n\n\treturn &Database{db}, nil\n}", "title": "" }, { "docid": "b3f1a17deb6d60a26720eae3ce3f9cc9", "score": "0.5606561", "text": "func (loader *Loader) DB(db ...string) *gorm.DB {\n\tloader.rw.RLock()\n\tdefer loader.rw.RUnlock()\n\tif len(db) == 1 {\n\t\tloader.choice = db[0]\n\t} else {\n\t\tloader.choice = \"master\"\n\t}\n\treturn loader.conns[loader.choice]\n}", "title": "" }, { "docid": "2c5e15007875be07311d90358ada396d", "score": "0.55932575", "text": "func (c *ConnectionsService) Make() (*gorm.DB, error) {\n\t// Check if we already have a reference to a connection\n\tif c.CurrentConnection != nil {\n\t\treturn c.CurrentConnection, nil\n\t}\n\n\tvar db gorm.DB\n\tvar err error\n\n\t// Setup Gorm with the specified driver\n\tswitch c.Config.GetString(\"database.driver\") {\n\tcase \"sqlite\":\n\t\tdb, err = gorm.Open(\"sqlite3\", c.Config.GetString(\"database.file\"))\n\t\tbreak\n\tcase \"mysql\":\n\t\tpretty.Println(c.Config.GetString(\"database.host\"))\n\t\turi := fmt.Sprintf(\n\t\t\t\"%s:%s@tcp(%s:%d)/%s?charset=utf8&parseTime=True&loc=Local\",\n\t\t\tc.Config.GetString(\"database.username\"),\n\t\t\tc.Config.GetString(\"database.password\"),\n\t\t\tc.Config.GetString(\"database.host\"),\n\t\t\tc.Config.GetInt(\"database.port\"),\n\t\t\tc.Config.GetString(\"database.name\"),\n\t\t)\n\n\t\tdb, err = gorm.Open(\"mysql\", uri)\n\tdefault:\n\t\terr = errors.New(\"Invalid or no driver provided\")\n\t}\n\n\t// Check if we got nay errors while setting up the connection\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Keep a reference to the connection so that we can access it later\n\tc.CurrentConnection = &db\n\n\treturn &db, nil\n}", "title": "" }, { "docid": "ba7828fdea59c65f025616aa3f95c9c1", "score": "0.55838364", "text": "func Use(db string) *DB {\n\treturn &DB{database: Sqlx(db)}\n}", "title": "" }, { "docid": "79b8d45fab619f2473fa69eb629fd4aa", "score": "0.55741644", "text": "func New(conf *config.DBConf) (*gorm.DB, error) {\n\tif conf.SQLLite {\n\t\t// we add DisableForeignKeyConstraintWhenMigrating since our sqlite does\n\t\t// not support foreign key constraints\n\t\treturn gorm.Open(sqlite.Open(conf.SQLLitePath), &gorm.Config{\n\t\t\tDisableForeignKeyConstraintWhenMigrating: true,\n\t\t\tFullSaveAssociations: true,\n\t\t})\n\t}\n\n\t// connect to default postgres instance first\n\tbaseDSN := fmt.Sprintf(\n\t\t\"user=%s password=%s port=%d host=%s\",\n\t\tconf.Username,\n\t\tconf.Password,\n\t\tconf.Port,\n\t\tconf.Host,\n\t)\n\n\tif conf.ForceSSL {\n\t\tbaseDSN = baseDSN + \" sslmode=require\"\n\t} else {\n\t\tbaseDSN = baseDSN + \" sslmode=disable\"\n\t}\n\n\tpostgresDSN := baseDSN + \" database=postgres\"\n\ttargetDSN := baseDSN + \" database=\" + conf.DbName\n\n\tdefaultDB, err := gorm.Open(postgres.Open(postgresDSN), &gorm.Config{\n\t\tFullSaveAssociations: true,\n\t})\n\n\t// attempt to create the database\n\tif conf.DbName != \"\" {\n\t\tdefaultDB.Exec(fmt.Sprintf(\"CREATE DATABASE %s;\", conf.DbName))\n\t}\n\n\t// open the database connection\n\tres, err := gorm.Open(postgres.Open(targetDSN), &gorm.Config{\n\t\tFullSaveAssociations: true,\n\t})\n\n\t// retry the connection 3 times\n\tretryCount := 0\n\ttimeout, _ := time.ParseDuration(\"5s\")\n\n\tif err != nil {\n\t\tfor {\n\t\t\ttime.Sleep(timeout)\n\t\t\tres, err = gorm.Open(postgres.Open(targetDSN), &gorm.Config{\n\t\t\t\tFullSaveAssociations: true,\n\t\t\t})\n\n\t\t\tif retryCount > 3 {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif err == nil {\n\t\t\t\treturn res, nil\n\t\t\t}\n\n\t\t\tretryCount++\n\t\t}\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "30ee46ede385f979c5577767be554f08", "score": "0.55739284", "text": "func GetDatabase(ctx context.Context) DB {\n\treturn ctx.Value(dbKey{}).(DB)\n}", "title": "" }, { "docid": "4ceab05a5510750ea5ffbf7d669beca2", "score": "0.557386", "text": "func DB() *gorm.DB {\n\tdbOnce.Do(initDatabase)\n\n\treturn db\n}", "title": "" }, { "docid": "1ee0e5c710aa04b3151315ff153dd1a4", "score": "0.5573436", "text": "func (config *MongoConfig) GetDatabase() string {\n\treturn config.db\n}", "title": "" }, { "docid": "427f0936f7b6c3d3df17fa5923b8dec4", "score": "0.55640525", "text": "func (e *Engine) DB(domain string) {\n\n}", "title": "" }, { "docid": "aaf5c58f238a62d567d2e64ab43af637", "score": "0.55612326", "text": "func (factory PostgresSQLDaosFactory) SQLDb() *sql.DB {\n\treturn factory.db\n}", "title": "" }, { "docid": "fdfbbf8fe4c31c10c4def839221820ec", "score": "0.55611765", "text": "func (coll *Collection) Database() *Database {\n\treturn coll.db\n}", "title": "" }, { "docid": "e46d3a9c078616e7778302b0d98b2136", "score": "0.555706", "text": "func New(c *conf.Config) (d *Dao) {\n\tdb, _, err := orm.NewMySQL(c.ORM)\n\tif err != nil {\n\t\tlog.Error(\"orm.NewMySQL(%v) error(%v)\",c.ORM, err)\n\t\treturn\n\t}\n\td = &Dao{\n\t\tdb: db,\n\t\tredis: redis.NewPool(c.Redis),\n\t\thttpClient: bm.NewClient(c.HTTPClient),\n\t\tdsbClient: bm.NewClient(c.DsbClient),\n\t}\n\td.initORM()\n\treturn\n}", "title": "" }, { "docid": "b7dd93f8e5a79fad54ab563103437980", "score": "0.5556828", "text": "func DB() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "b7dd93f8e5a79fad54ab563103437980", "score": "0.5556828", "text": "func DB() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "b7dd93f8e5a79fad54ab563103437980", "score": "0.5556828", "text": "func DB() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "b7dd93f8e5a79fad54ab563103437980", "score": "0.5556828", "text": "func DB() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "b61956e07e72e146d86d71a3bbfa3efc", "score": "0.5554923", "text": "func New(conf Conf) (DB, error) {\n\tif f, ok := Factories[conf.Driver]; ok {\n\t\treturn f(conf)\n\t}\n\treturn nil, errors.New(\"database driver not found\")\n}", "title": "" }, { "docid": "2515ee90bacdb47d8b12a04a981b9d98", "score": "0.55458194", "text": "func (p *Porm) GetDb() DS {\n\treturn p.db.New()\n}", "title": "" }, { "docid": "6f50fbe2ef318ac62f1b415b96fb0f6f", "score": "0.5536703", "text": "func Database(dbc database.Connection, l logger.ILog) *database.DBW {\n\t// Set the database password from an environment variable.\n\tpwd := os.Getenv(\"DB_PASSWORD\")\n\tif len(pwd) > 0 {\n\t\tdbc.Password = pwd\n\t}\n\n\tvar db *database.DBW\n\n\t// Migrate the database automatically for docker.\n\tif os.Getenv(\"DB_MIGRATE\") == \"true\" {\n\t\t// Wait for the database to connect.\n\t\tfor {\n\t\t\tconnection, err := dbc.Connect(false)\n\t\t\tif err != nil {\n\t\t\t\tl.Printf(\"DB waiting: %v\", err)\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Create the database.\n\t\t\t_, err = connection.Exec(`CREATE DATABASE IF NOT EXISTS webapi DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci`)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"DB creating:\", err)\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Apply the database migrations.\n\t\t\terr = basemigrate.Migrate(\"migration/mysql-v0.sql\", \"\", 0, true)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"DB migrating:\", err)\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Reconnect to the database.\n\t\t\tconnection, err = dbc.Connect(true)\n\t\t\tif err != nil {\n\t\t\t\tl.Printf(\"DB waiting: %v\", err)\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Wrap the DB connection.\n\t\t\tdb = database.New(connection)\n\t\t\tbreak\n\t\t}\n\t} else {\n\t\tconnection, err := dbc.Connect(true)\n\t\tif err != nil {\n\t\t\tl.Printf(\"DB error: %v\", err)\n\t\t}\n\t\t// Wrap the DB connection.\n\t\tdb = database.New(connection)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "a57f803cd198b20d4cd0c961c6da6319", "score": "0.55251104", "text": "func New(c *conf.Config) (d *Dao) {\n\td = &Dao{\n\t\tdb: orm.NewMySQL(c.ORM.Show),\n\t}\n\td.initORM()\n\treturn\n}", "title": "" }, { "docid": "1b97ed43776effcd613d2b64571926de", "score": "0.55190134", "text": "func Configure(conn string) (DB, error) {\n\tu, err := url.ParseRequestURI(conn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid connection URL: %s\", conn)\n\t}\n\tdatastore := u.Scheme\n\tvar db DB\n\n\tswitch datastore {\n\tcase \"postgres\":\n\t\tdb, err = postgres.NewPostgreSQL(u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Info().Str(\"component\", \"store\").Str(\"uri\", u.String()).Msg(\"using PostgreSQL database\")\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsuported database: %s\", datastore)\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "9adc873a18649e2d7f158875b1c2aaf3", "score": "0.5518974", "text": "func New(cfg config.DB) (*gorm.DB, error) {\n\tdsn := fmt.Sprintf(postgresDSN, cfg.Host, cfg.User, cfg.Password, cfg.DBName, cfg.Port, cfg.TimeZone)\n\n\tclient, err := gorm.Open(postgres.Open(dsn))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "title": "" }, { "docid": "d34b37526bc147ff687a7aedb17f84e6", "score": "0.55065155", "text": "func (dialector Dialector) CurrentDatabase(db *database.DB) (name string) {\n db.Row(\"SELECT DATABASE()\").Scan(&name)\n return\n}", "title": "" }, { "docid": "483fa6f43cc1392b3344920020073c6d", "score": "0.5496548", "text": "func NewDatabase() interfaces.IDatabase {\n\tdbConf := config.Config.Database\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tconnectionStr := fmt.Sprintf(\"mongodb://%s:%s@%s:%d/%s?authMechanism=SCRAM-SHA-1%s\",\n\t\tdbConf.User, dbConf.Password, dbConf.Host, dbConf.Port, dbConf.Name, dbConf.Options)\n\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(connectionStr))\n\tif err != nil {\n\t\tlog.Fatal(errors.New(errors.ECMongoConnection, err.Error(), \"mongodb.Init\"))\n\t\treturn nil\n\t}\n\n\terr = client.Ping(ctx, readpref.Primary())\n\tif err != nil {\n\t\tlog.Fatal(errors.New(errors.ECMongoConnection, err.Error(), \"mongodb.Init\"))\n\t\treturn nil\n\t}\n\n\tdatabase := Database{dbInstance: client.Database(dbConf.Name)}\n\treturn &database\n}", "title": "" }, { "docid": "ef34ae2d3dc478c8b844c806863800fa", "score": "0.5489256", "text": "func (c Map) Database(k string) (string, string) {\n\tval := c.Get(k)\n\n\tswitch v := val.(type) {\n\tcase string:\n\t\treturn GetDatabase(v)\n\tdefault:\n\t\tm := c.StringMap(k)\n\n\t\tdriver, ok := m[\"driver\"]\n\t\tif !ok {\n\t\t\treturn GetDefaultDatabase()\n\t\t}\n\n\t\tdsn, ok := m[\"dsn\"]\n\t\tif !ok {\n\t\t\treturn GetDefaultDatabase()\n\t\t}\n\n\t\treturn driver, dsn\n\t}\n}", "title": "" }, { "docid": "09c10cd63cd8925976eab7bc612bc479", "score": "0.5468895", "text": "func GetDb() *gorm.DB {\n\t// Initiate value if there is no instance\n\tonce.Do(func() {\n\t\tInitPostgre()\n\t})\n\treturn db\n}", "title": "" }, { "docid": "22a1a281fa90148ffa55d4fb7cbcbd3b", "score": "0.5468569", "text": "func newDB(s sqlSpec) (db.DB, error) {\n\tdrv := s.driver()\n\tif !knownDrivers[drv] {\n\t\treturn nil, fmt.Errorf(\"unknown sql driver %q\", drv)\n\t}\n\n\tsqlDb, err := sql.Open(string(drv), s.ConnectionString())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn wrapDB(sqlDb, s)\n}", "title": "" }, { "docid": "20bd10ae74bd8593f16ab2d894f60711", "score": "0.54652166", "text": "func GetDB() *gorm.DB {\n\treturn database\n}", "title": "" }, { "docid": "129fc83640b88cd3fba244309fc17d2d", "score": "0.5461916", "text": "func (d *db) GormDB() interface{} {\n\treturn d.gormDB.Interface()\n}", "title": "" }, { "docid": "0f0b38144c4460ab6e4fe963a7d1e8ff", "score": "0.5457226", "text": "func DB() martini.Handler {\n\n\t/*\n\t * If you plan to use sqllite then make the following changes in config.ini\n\t * DbDriver\t= \"sqlite3\"\n\t * DbSource\t= \"test.db\"\n\t *\n\t * and import the sqllite driver\n\t * _ \"github.com/mattn/go-sqlite3\"\n\t *\n\t */\n\n\tengine, err := xorm.NewEngine(conf.Setting.DbDriver, conf.Setting.DbSource)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//engine.ShowSQL = true\n\tengine.Sync(\n\t\t&test.TestTable{},\n\t)\n\n\treturn func(c martini.Context) {\n\t\tc.Map(engine)\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "8284ec21bb4ffe6d385cf54c5fc57a65", "score": "0.545433", "text": "func NewDatabase(log logging.Logger, cfg *DatabaseConfig) (*Database, error) {\n\tif cfg == nil {\n\t\tcfg = &DatabaseConfig{}\n\t}\n\n\tif cfg.SystemName == \"\" {\n\t\tcfg.SystemName = build.DefaultSystemName\n\t}\n\n\trepAddr, _ := cfg.LocalReplicaAddr()\n\n\tdb := &Database{\n\t\tlog: log,\n\t\tcfg: cfg,\n\t\treplicaAddr: repAddr,\n\t\tshutdownErrCh: make(chan error),\n\t\traftLeaderNotifyCh: make(chan bool),\n\n\t\tdata: &dbData{\n\t\t\tlog: log,\n\n\t\t\tMembers: &MemberDatabase{\n\t\t\t\tRanks: make(MemberRankMap),\n\t\t\t\tUuids: make(MemberUuidMap),\n\t\t\t\tAddrs: make(MemberAddrMap),\n\t\t\t\tFaultDomains: system.NewFaultDomainTree(),\n\t\t\t},\n\t\t\tPools: &PoolDatabase{\n\t\t\t\tRanks: make(PoolRankMap),\n\t\t\t\tUuids: make(PoolUuidMap),\n\t\t\t\tLabels: make(PoolLabelMap),\n\t\t\t},\n\t\t\tSystem: &SystemDatabase{\n\t\t\t\tAttributes: make(map[string]string),\n\t\t\t},\n\t\t\tSchemaVersion: CurrentSchemaVersion,\n\t\t},\n\t}\n\t// NB: We may remove this once the locking stuff is solid.\n\tdb.poolLocks.log = log\n\n\treturn db, nil\n}", "title": "" }, { "docid": "c250fc0b51664966aa8f8fc57e348959", "score": "0.54510534", "text": "func InitDatabase(config Config) *gorm.DB {\n\t// 初始化数据库日志\n\tlogWriter, err := rlogs.New(\n\t\tconfig.LogPath+\".%Y%m%d%H\",\n\t\trlogs.WithRotationTime(time.Duration(config.LogRotationHours)*time.Hour),\n\t\trlogs.WithMaxAge(time.Duration(config.LogMaxDays)*24*time.Hour),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"create db log failed! Error: %s\\n\", err)\n\t}\n\tormLoggerConfig := logger.Config{\n\t\tSlowThreshold: time.Microsecond,\n\t\tLogLevel: func(level string) logger.LogLevel {\n\t\t\tswitch strings.ToLower(level) {\n\t\t\tcase \"silent\":\n\t\t\t\treturn logger.Silent\n\t\t\tcase \"error\":\n\t\t\t\treturn logger.Error\n\t\t\tcase \"warn\":\n\t\t\t\treturn logger.Warn\n\t\t\tcase \"info\":\n\t\t\t\treturn logger.Info\n\t\t\tcase \"debug\":\n\t\t\t\treturn logger.Info\n\t\t\t}\n\t\t\treturn logger.Error\n\t\t}(config.LogLevel),\n\t}\n\tormlogger := logger.New(\n\t\tlog.New(logWriter, \"[gorm]\", log.LstdFlags),\n\t\tormLoggerConfig,\n\t)\n\n\t// 创建数据库链接\n\tvar conn gorm.Dialector\n\tswitch config.Type {\n\tcase \"mysql\":\n\t\tconn = mysql.Open(config.WriterDSN)\n\tcase \"sqlite\":\n\t\tconn = sqlite.Open(config.WriterDSN)\n\t\tconfig.ReaderDSN = \"\"\n\tdefault:\n\t\tlog.Fatalf(\"storage type not supported! Type: %s\\n\", config.Type)\n\t}\n\n\t// 启动数据库链接\n\tdb, err := gorm.Open(conn, &gorm.Config{\n\t\tLogger: ormlogger,\n\t\tNamingStrategy: schema.NamingStrategy{\n\t\t\tTablePrefix: config.TablePrefix,\n\t\t\tSingularTable: config.SingularTable,\n\t\t},\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"open db connection failed! Error: %s\\n\", err)\n\t}\n\n\t// 设置读写分离\n\tif len(config.ReaderDSN) > 0 {\n\t\tdb.Use(dbresolver.Register(\n\t\t\tdbresolver.Config{\n\t\t\t\tReplicas: []gorm.Dialector{mysql.Open((config.ReaderDSN))},\n\t\t\t},\n\t\t))\n\t}\n\n\t// 设置链接池\n\tsqldb, err := db.DB()\n\tif err != nil {\n\t\tlog.Fatalf(\"get db sql connection failed! Error: %s\\n\", err)\n\t}\n\tsqldb.SetMaxIdleConns(config.MaxIdleConns)\n\tsqldb.SetMaxOpenConns(config.MaxOpenConns)\n\tsqldb.SetConnMaxLifetime(time.Duration(config.ConnMaxLifeSeconds) * time.Second)\n\n\t// 测试链接\n\tif err := sqldb.Ping(); err != nil {\n\t\tlog.Fatalf(\"connect to database failed when ping the server! Error: %s\\n\", err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "0eca542738bd3bcd94e62b1e87edcfd1", "score": "0.5448875", "text": "func DB() *mgo.Database {\n\treturn Session.DB(\"festinare_api\")\n}", "title": "" }, { "docid": "15602e06d1f3288520e01167cf6b473b", "score": "0.54465413", "text": "func DB() *gorm.DB {\n\tif db == nil {\n\t\tlog.Panic(\"Please new db first\")\n\t}\n\treturn db\n}", "title": "" }, { "docid": "25a085dcb243d0863c8d1dd0007d215a", "score": "0.5443464", "text": "func GetDatabase(mongoSession *mgo.Session, useDatabase string) *mgo.Database {\n\treturn mongoSession.DB(useDatabase)\n}", "title": "" }, { "docid": "53533abb9b184f0a1848fb0ac4bb2976", "score": "0.5437017", "text": "func DB() *sqlx.DB {\n\treturn Database\n}", "title": "" }, { "docid": "b095d12fbd0e4961c2d37bf7463943b9", "score": "0.5436291", "text": "func (l *Local) Database() *DB {\n\treturn l.db\n}", "title": "" }, { "docid": "03c128dadd402fa686e0c1efcc42755a", "score": "0.5435649", "text": "func DB() string {\n\treturn db\n}", "title": "" }, { "docid": "7a185b5ee1d2369e6193ab7e16d22d32", "score": "0.5435523", "text": "func GetGormDBFromURL(url string, opt *EngineOption) (*gorm.DB, error) {\n\tif opt == nil {\n\t\topt = &EngineOption{ParseTime: true}\n\t}\n\tdialect, dsn, err := ParseDatabaseURL(url, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif dialect == \"sqlite3\" {\n\t\treturn gorm.Open(sqlite.Open(dsn), &gorm.Config{})\n\t} else if dialect == \"mysql\" {\n\t\treturn gorm.Open(mysql.Open(dsn), &gorm.Config{})\n\t} else if dialect == \"postgres\" {\n\t\treturn gorm.Open(postgres.Open(dsn), &gorm.Config{})\n\t} else {\n\t\treturn nil, errors.New(\"unsupported dialect\")\n\t}\n}", "title": "" }, { "docid": "0e6bd17d658054b5b23475603a35b9b5", "score": "0.5433083", "text": "func NewDatabase() *DatabaseImpl {\n\treturn &DatabaseImpl{}\n}", "title": "" }, { "docid": "7bb62349e7245b55f99d13672c54aeeb", "score": "0.5431724", "text": "func Database() *firego.Firebase {\n\treturn database\n}", "title": "" }, { "docid": "eddeb1997ce58fd1ab433d48577c3e3d", "score": "0.54286325", "text": "func New(AdminEmail string, schemaSQL string) *Database {\n\tvar d = &Database{\n\t\t// read environment variables and sets up database configuration values\n\t\tconfig: &Config{\n\t\t\thost: viper.GetString(\"db.host\"),\n\t\t\tport: viper.GetInt(\"db.port\"),\n\t\t\tuser: viper.GetString(\"db.user\"),\n\t\t\tpassword: viper.GetString(\"db.pass\"),\n\t\t\tdbname: viper.GetString(\"db.name\"),\n\t\t\tsslmode: viper.GetString(\"db.sslmode\"),\n\t\t},\n\t}\n\n\tpsqlInfo := fmt.Sprintf(\n\t\t\"host=%s port=%d user=%s password=%s dbname=%s sslmode=%s\",\n\t\td.config.host,\n\t\td.config.port,\n\t\td.config.user,\n\t\td.config.password,\n\t\td.config.dbname,\n\t\td.config.sslmode,\n\t)\n\n\tpdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tlog.Fatal(\"error connecting to the database: \", err)\n\t}\n\td.db = pdb\n\n\tif _, err := d.db.Exec(schemaSQL); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// on server start reset all warriors to active false for battles\n\tif _, err := d.db.Exec(\n\t\t`call deactivate_all_warriors();`); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t// on server start if admin email is specified set that warrior to GENERAL rank\n\tif AdminEmail != \"\" {\n\t\tif _, err := d.db.Exec(\n\t\t\t`call promote_warrior_by_email($1);`,\n\t\t\tAdminEmail,\n\t\t); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "dedec4b9c56e27c92456e43022d37bb9", "score": "0.5422518", "text": "func (mgr *ShardingManager) newDB(service *DBService, dbname string) (*gorm.DB, error) {\n\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s:%d)/%s?parseTime=true&loc=Local&timeout=%s&readTimeout=%s&writeTimeout=%s&charset=%s\",\n\t\tservice.User,\n\t\tservice.Password,\n\t\tservice.Host,\n\t\tservice.Port,\n\t\tdbname,\n\t\tmgr.configTemplate.ConnTimeout,\n\t\tmgr.configTemplate.ReadTimeout,\n\t\tmgr.configTemplate.WriteTimeout,\n\t\tdatabase.BSCPCHARSET,\n\t)\n\n\tdb, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsqlDB, err := db.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsqlDB.SetMaxOpenConns(mgr.configTemplate.MaxOpenConns)\n\tsqlDB.SetMaxIdleConns(mgr.configTemplate.MaxIdleConns)\n\tsqlDB.SetConnMaxLifetime(mgr.configTemplate.KeepAlive)\n\n\treturn db, nil\n}", "title": "" }, { "docid": "50df39e35b423803d934da9bf10bfa60", "score": "0.5421827", "text": "func New(config *MySQL.Config) (*DB, error) {\r\n\t// Check database schema exists. If not, create it.\r\n\tif err := ensureDatabaseSchema(config); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tconn, err := sql.Open(\"mysql\", config.FormatDSN())\r\n\tif err != nil {\r\n\t\treturn nil, fmt.Errorf(\"mysql: could not get a connection: %v\", err)\r\n\t}\r\n\tif err := conn.Ping(); err != nil {\r\n\t\tconn.Close()\r\n\t\treturn nil, fmt.Errorf(\"mysql: could not establish a good connection: %v\", err)\r\n\t}\r\n\tconn.SetConnMaxLifetime(time.Hour)\r\n\tmaxConnectionCount := runtime.NumCPU() * 2\r\n\tconn.SetMaxIdleConns(maxConnectionCount)\r\n\tconn.SetMaxOpenConns(maxConnectionCount)\r\n\treturn &DB{\r\n\t\tConn: conn,\r\n\t}, nil\r\n}", "title": "" }, { "docid": "9797409efb096de627d9fb7af554a877", "score": "0.5415981", "text": "func (s Postgres) DB() *gorm.DB {\n\tif s.db != nil {\n\t\treturn s.db\n\t}\n\n\tfmt.Println(\"connecting to DB:\", viper.GetString(config.DSN))\n\tnewDB, err := gorm.Open(viper.GetString(config.DBDriver), viper.GetString(config.DSN))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.db = newDB\n\n\t//s.db.LogMode(true)\n\ts.db.SingularTable(true)\n\treturn s.db\n}", "title": "" }, { "docid": "b00fcf5d9d186ff9c49d159ba0f194bd", "score": "0.54129064", "text": "func (e *engine) GetDatabase(databaseName string) (Database, bool) {\n\treturn e.dbSet.GetDatabase(databaseName)\n}", "title": "" }, { "docid": "b3650c5781baa9e8f88b3f76bfe30c24", "score": "0.54124695", "text": "func configDB() (*sql.DB, error) {\n\n\tdb, err := sql.Open(\"mysql\", \"keid:swamprat@tcp(tinfoilwizard.net:15001)/keid\")\n\tif err != nil {\n\t\tlog.Fatalf(\"\\n\\nmysql: could not get a connection: %v\\n\\n\", err)\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "160a71c00115140da300d6405f2152f4", "score": "0.54105806", "text": "func GetDatabase() r.Repository {\n\tvar err error\n\n\tdatabase, err = gorm.Open(\"sqlite3\", \"exchange.db\")\n\tif err != nil {\n\t\tpanic(\"Unable to open DB\")\n\t}\n\n\tgenerateModels(database)\n\n\trepo := r.Repository{\n\t\tMoney: MoneyRepository{},\n\t}\n\n\treturn repo\n}", "title": "" } ]
6e9c64233f4d395efa46c17b309376fa
Convert_v1beta1_DigitalOceanSpec_To_kubeone_DigitalOceanSpec is an autogenerated conversion function.
[ { "docid": "8d02981a7e309fdae8fc36682baac954", "score": "0.8934016", "text": "func Convert_v1beta1_DigitalOceanSpec_To_kubeone_DigitalOceanSpec(in *DigitalOceanSpec, out *kubeone.DigitalOceanSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_DigitalOceanSpec_To_kubeone_DigitalOceanSpec(in, out, s)\n}", "title": "" } ]
[ { "docid": "2ffcf859f5033b2551fac3810f966eb5", "score": "0.6908449", "text": "func Convert_kubeone_DigitalOceanSpec_To_v1beta1_DigitalOceanSpec(in *kubeone.DigitalOceanSpec, out *DigitalOceanSpec, s conversion.Scope) error {\n\treturn autoConvert_kubeone_DigitalOceanSpec_To_v1beta1_DigitalOceanSpec(in, out, s)\n}", "title": "" }, { "docid": "7a49a9318bcd32722d3e9e67e53827ef", "score": "0.61465955", "text": "func Convert_v1beta1_GCESpec_To_kubeone_GCESpec(in *GCESpec, out *kubeone.GCESpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_GCESpec_To_kubeone_GCESpec(in, out, s)\n}", "title": "" }, { "docid": "2f7db7d1a7e5112e7c4e24a1f78ef7aa", "score": "0.60450697", "text": "func Convert_v1beta1_AWSSpec_To_kubeone_AWSSpec(in *AWSSpec, out *kubeone.AWSSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_AWSSpec_To_kubeone_AWSSpec(in, out, s)\n}", "title": "" }, { "docid": "a3bb3abe298414a9d547f9ad25ce2ad2", "score": "0.60208416", "text": "func (in *DatacenterSpecDigitalocean) DeepCopy() *DatacenterSpecDigitalocean {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatacenterSpecDigitalocean)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c64bcd35e0bb95bd77857429ff9ed1c6", "score": "0.5990766", "text": "func Convert_v1beta1_OpenstackSpec_To_kubeone_OpenstackSpec(in *OpenstackSpec, out *kubeone.OpenstackSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_OpenstackSpec_To_kubeone_OpenstackSpec(in, out, s)\n}", "title": "" }, { "docid": "695a85284f100017d23ee4ca465ee14e", "score": "0.57383394", "text": "func Convert_v1beta1_NoneSpec_To_kubeone_NoneSpec(in *NoneSpec, out *kubeone.NoneSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_NoneSpec_To_kubeone_NoneSpec(in, out, s)\n}", "title": "" }, { "docid": "721890dbcddae84117d77e868b0a2416", "score": "0.5681791", "text": "func Convert_v1beta1_HetznerSpec_To_kubeone_HetznerSpec(in *HetznerSpec, out *kubeone.HetznerSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_HetznerSpec_To_kubeone_HetznerSpec(in, out, s)\n}", "title": "" }, { "docid": "1d662d0975ba74ff7068050f3238375c", "score": "0.5570669", "text": "func Convert_v1beta1_ProviderSpec_To_kubeone_ProviderSpec(in *ProviderSpec, out *kubeone.ProviderSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_ProviderSpec_To_kubeone_ProviderSpec(in, out, s)\n}", "title": "" }, { "docid": "1126158997349c16873879e20bc8b6a9", "score": "0.5389607", "text": "func Convert_v1beta1_WeaveNetSpec_To_kubeone_WeaveNetSpec(in *WeaveNetSpec, out *kubeone.WeaveNetSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_WeaveNetSpec_To_kubeone_WeaveNetSpec(in, out, s)\n}", "title": "" }, { "docid": "4a39d28de018093f5096ffe6862320dc", "score": "0.5385386", "text": "func (in *DigitaloceanCloudSpec) DeepCopy() *DigitaloceanCloudSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DigitaloceanCloudSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bfcc6ea3857f0379fc8b9766a3cc6997", "score": "0.537525", "text": "func Convert_v1beta1_CanalSpec_To_kubeone_CanalSpec(in *CanalSpec, out *kubeone.CanalSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_CanalSpec_To_kubeone_CanalSpec(in, out, s)\n}", "title": "" }, { "docid": "8ff024ad0c5bd73f05e1f0c772742269", "score": "0.5254664", "text": "func Convert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1beta1_ACMEIssuerDNS01ProviderDigitalOcean(in *acme.ACMEIssuerDNS01ProviderDigitalOcean, out *ACMEIssuerDNS01ProviderDigitalOcean, s conversion.Scope) error {\n\treturn autoConvert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1beta1_ACMEIssuerDNS01ProviderDigitalOcean(in, out, s)\n}", "title": "" }, { "docid": "0cb8d016410caf48cb83f620c6ffa387", "score": "0.5145088", "text": "func Convert_v1beta1_VsphereSpec_To_kubeone_VsphereSpec(in *VsphereSpec, out *kubeone.VsphereSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_VsphereSpec_To_kubeone_VsphereSpec(in, out, s)\n}", "title": "" }, { "docid": "b46b0e3fbe47dc1c09e44bd6712547fb", "score": "0.49323392", "text": "func Convert_v1beta1_AzureSpec_To_kubeone_AzureSpec(in *AzureSpec, out *kubeone.AzureSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_AzureSpec_To_kubeone_AzureSpec(in, out, s)\n}", "title": "" }, { "docid": "cee0ea742723bf6c1efe37cf4a9f1754", "score": "0.48894304", "text": "func NewDigitalOceanDiscoverer() Discoverer {\n\treturn NewDiscoverer(\n\t\tPublicHostnameDiscovererOption(doHostname),\n\t\tPrivateIPv4DiscovererOption(doPrivateIPv4),\n\t\tPublicIPv4DiscovererOption(doPublicIPv4),\n\t\tPublicIPv6DiscovererOption(doPublicIPv6),\n\t)\n}", "title": "" }, { "docid": "58b0c77e99b842a6cd3349a504d394fa", "score": "0.48368967", "text": "func (in *Digitalocean) DeepCopy() *Digitalocean {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Digitalocean)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "504ceaaa7e578fbeb52cb48139517892", "score": "0.48292604", "text": "func Convert_v1beta1_MachineControllerConfig_To_kubeone_MachineControllerConfig(in *MachineControllerConfig, out *kubeone.MachineControllerConfig, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_MachineControllerConfig_To_kubeone_MachineControllerConfig(in, out, s)\n}", "title": "" }, { "docid": "84ec301407e99ded4e3b37ac67116122", "score": "0.47918928", "text": "func Convert_v1beta1_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean(in *ACMEIssuerDNS01ProviderDigitalOcean, out *acme.ACMEIssuerDNS01ProviderDigitalOcean, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean(in, out, s)\n}", "title": "" }, { "docid": "1c8edbd3aff4359e39ab3ecda50724d0", "score": "0.47728714", "text": "func NewKubeone(kubeoneDir, configurationFilePath string) Kubeone {\n\treturn Kubeone{\n\t\tKubeoneDir: kubeoneDir,\n\t\tConfigurationFilePath: configurationFilePath,\n\t}\n}", "title": "" }, { "docid": "2290e78e2e85372d4ff555b4cc952ce6", "score": "0.47704017", "text": "func (in *ACMEIssuerDNS01ProviderDigitalOcean) DeepCopy() *ACMEIssuerDNS01ProviderDigitalOcean {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ACMEIssuerDNS01ProviderDigitalOcean)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e924b7023938c218cec3a8b8a9be1833", "score": "0.47603062", "text": "func Convert_core_PodSpec_To_v1_PodSpec(in *core.PodSpec, out *v1.PodSpec, s conversion.Scope) error {\n\tif err := autoConvert_core_PodSpec_To_v1_PodSpec(in, out, s); err != nil {\n\t\treturn err\n\t}\n\n\t// DeprecatedServiceAccount is an alias for ServiceAccountName.\n\tout.DeprecatedServiceAccount = in.ServiceAccountName\n\n\tif in.SecurityContext != nil {\n\t\t// the host namespace fields have to be handled here for backward compatibility\n\t\t// with v1.0.0\n\t\tout.HostPID = in.SecurityContext.HostPID\n\t\tout.HostNetwork = in.SecurityContext.HostNetwork\n\t\tout.HostIPC = in.SecurityContext.HostIPC\n\t\tout.ShareProcessNamespace = in.SecurityContext.ShareProcessNamespace\n\t\tout.HostUsers = in.SecurityContext.HostUsers\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "448b51ab2ab46dfd0541511854518b63", "score": "0.4757269", "text": "func (c *K8sPodClient) DeleteOne(kp *K8sPod) *K8sPodDeleteOne {\n\treturn c.DeleteOneID(kp.ID)\n}", "title": "" }, { "docid": "e0a892a39acdf801ea637a72c7e9a94b", "score": "0.4714304", "text": "func Convert_example_PodSpec_To_v1_PodSpec(in *example.PodSpec, out *PodSpec, s conversion.Scope) error {\n\treturn autoConvert_example_PodSpec_To_v1_PodSpec(in, out, s)\n}", "title": "" }, { "docid": "a1c42cf88a02df7eb871f4067395bfd7", "score": "0.46876353", "text": "func (c *SpecClient) DeleteOne(s *Spec) *SpecDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "title": "" }, { "docid": "e35a5c20baf3bcc39514595b4d838507", "score": "0.46521428", "text": "func Convert_kubeone_AWSSpec_To_v1beta1_AWSSpec(in *kubeone.AWSSpec, out *AWSSpec, s conversion.Scope) error {\n\treturn autoConvert_kubeone_AWSSpec_To_v1beta1_AWSSpec(in, out, s)\n}", "title": "" }, { "docid": "4514333d4e0554ad012cca0c943c266d", "score": "0.46452516", "text": "func (in *ExternalClusterKubeOneCloudSpec) DeepCopy() *ExternalClusterKubeOneCloudSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalClusterKubeOneCloudSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0e0281b2af8aac801d4635fcd37fbe71", "score": "0.45734754", "text": "func Convert_kubeone_GCESpec_To_v1beta1_GCESpec(in *kubeone.GCESpec, out *GCESpec, s conversion.Scope) error {\n\treturn autoConvert_kubeone_GCESpec_To_v1beta1_GCESpec(in, out, s)\n}", "title": "" }, { "docid": "af0cdbcc4a98a1b43d05929d2c0da739", "score": "0.4531248", "text": "func Convert_v1beta1_APIEndpoint_To_kubeone_APIEndpoint(in *APIEndpoint, out *kubeone.APIEndpoint, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_APIEndpoint_To_kubeone_APIEndpoint(in, out, s)\n}", "title": "" }, { "docid": "30508517adc1f22cdc5406a799773666", "score": "0.45173636", "text": "func (in *DatacenterSpecDigitalocean) DeepCopyInto(out *DatacenterSpecDigitalocean) {\n\t*out = *in\n}", "title": "" }, { "docid": "ef690884c9afa857c7fd088b3b83939e", "score": "0.44674727", "text": "func Convert_v1alpha4_DockerMachineSpec_To_v1beta1_DockerMachineSpec(in *DockerMachineSpec, out *v1beta1.DockerMachineSpec, s conversion.Scope) error {\n\treturn autoConvert_v1alpha4_DockerMachineSpec_To_v1beta1_DockerMachineSpec(in, out, s)\n}", "title": "" }, { "docid": "ea784d72e16e98bc07d1361e1de7f21b", "score": "0.44650948", "text": "func Convert_v1beta1_CNI_To_kubeone_CNI(in *CNI, out *kubeone.CNI, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_CNI_To_kubeone_CNI(in, out, s)\n}", "title": "" }, { "docid": "96c793b67d359baef820f4ee567606a4", "score": "0.44573793", "text": "func Convert_v1_PodSpec_To_example_PodSpec(in *PodSpec, out *example.PodSpec, s conversion.Scope) error {\n\treturn autoConvert_v1_PodSpec_To_example_PodSpec(in, out, s)\n}", "title": "" }, { "docid": "89f5d53bc8250b8b3e06cbbe1cfe4bf7", "score": "0.445684", "text": "func Convert_kubeone_HetznerSpec_To_v1beta1_HetznerSpec(in *kubeone.HetznerSpec, out *HetznerSpec, s conversion.Scope) error {\n\treturn autoConvert_kubeone_HetznerSpec_To_v1beta1_HetznerSpec(in, out, s)\n}", "title": "" }, { "docid": "583c72158ac2c7f77b2cc73ab8552440", "score": "0.44293013", "text": "func Convert_kubeone_OpenstackSpec_To_v1beta1_OpenstackSpec(in *kubeone.OpenstackSpec, out *OpenstackSpec, s conversion.Scope) error {\n\treturn autoConvert_kubeone_OpenstackSpec_To_v1beta1_OpenstackSpec(in, out, s)\n}", "title": "" }, { "docid": "4db7e7ec3a98d090c82a346ba4aae880", "score": "0.44200212", "text": "func newEchoServerPodSpec(podName string) *v1.Pod {\n\tport := 8080\n\tpod := &v1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: podName,\n\t\t},\n\t\tSpec: v1.PodSpec{\n\t\t\tContainers: []v1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"echoserver\",\n\t\t\t\t\tImage: \"gcr.io/google_containers/echoserver:1.6\",\n\t\t\t\t\tPorts: []v1.ContainerPort{{ContainerPort: int32(port)}},\n\t\t\t\t},\n\t\t\t},\n\t\t\tRestartPolicy: v1.RestartPolicyNever,\n\t\t},\n\t}\n\treturn pod\n}", "title": "" }, { "docid": "feff9e74f1489f1836c87f78ec4df4b2", "score": "0.44185835", "text": "func GetPodSpec(obj interface{}) *core.PodSpec {\n\t_, ktype := GetObjectMeta(obj)\n\tswitch ktype {\n\tcase \"pod\":\n\t\treturn &obj.(*core.Pod).Spec\n\tcase \"deployment\":\n\t\treturn &obj.(*apps.Deployment).Spec.Template.Spec\n\tcase \"daemonset\":\n\t\treturn &obj.(*apps.DaemonSet).Spec.Template.Spec\n\tcase \"statefulset\":\n\t\treturn &obj.(*apps.StatefulSet).Spec.Template.Spec\n\tcase \"job\":\n\t\treturn &obj.(*batch.Job).Spec.Template.Spec\n\t}\n\n\treturn &core.PodSpec{}\n}", "title": "" }, { "docid": "16ad8c5064d3da87d76ce2af9a863962", "score": "0.44167835", "text": "func NewDigitalOceanClient(pat string) *godo.Client {\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: pat},\n\t)\n\ttc := oauth2.NewClient(oauth2.NoContext, ts)\n\treturn godo.NewClient(tc)\n}", "title": "" }, { "docid": "5e4f03cf7eef52a65f1adf0390404960", "score": "0.43750215", "text": "func (in *PodSpec) DeepCopy() *PodSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PodSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5e4f03cf7eef52a65f1adf0390404960", "score": "0.43750215", "text": "func (in *PodSpec) DeepCopy() *PodSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PodSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5e4f03cf7eef52a65f1adf0390404960", "score": "0.43750215", "text": "func (in *PodSpec) DeepCopy() *PodSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PodSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fa07180a92ef96f1922dd58d6a99ea52", "score": "0.43671185", "text": "func Convert_v1beta1_PodNodeSelector_To_kubeone_PodNodeSelector(in *PodNodeSelector, out *kubeone.PodNodeSelector, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_PodNodeSelector_To_kubeone_PodNodeSelector(in, out, s)\n}", "title": "" }, { "docid": "c54a803df97610601a8ddae1ab70c43c", "score": "0.43563733", "text": "func Convert_kubeone_NoneSpec_To_v1beta1_NoneSpec(in *kubeone.NoneSpec, out *NoneSpec, s conversion.Scope) error {\n\treturn autoConvert_kubeone_NoneSpec_To_v1beta1_NoneSpec(in, out, s)\n}", "title": "" }, { "docid": "2a87796e4097b416b055002e09948081", "score": "0.4336148", "text": "func (c *K8sObjectClient) DeleteOne(ko *K8sObject) *K8sObjectDeleteOne {\n\treturn c.DeleteOneID(ko.ID)\n}", "title": "" }, { "docid": "5fd550e449feba868813286d454442c5", "score": "0.43231973", "text": "func (c *PetClient) DeleteOne(pe *Pet) *PetDeleteOne {\n\treturn c.DeleteOneID(pe.ID)\n}", "title": "" }, { "docid": "08645e34d75360e45b8803029ac65bee", "score": "0.4234861", "text": "func (c *K8sPodClient) UpdateOne(kp *K8sPod) *K8sPodUpdateOne {\n\tmutation := newK8sPodMutation(c.config, OpUpdateOne, withK8sPod(kp))\n\treturn &K8sPodUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "eab4e9fab9bc2c27e0a5c5270d169771", "score": "0.4230757", "text": "func Convert_v1beta1_PodNodeSelectorConfig_To_kubeone_PodNodeSelectorConfig(in *PodNodeSelectorConfig, out *kubeone.PodNodeSelectorConfig, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_PodNodeSelectorConfig_To_kubeone_PodNodeSelectorConfig(in, out, s)\n}", "title": "" }, { "docid": "a59aef3099d973f2a0b346d174e64b22", "score": "0.42180714", "text": "func NewDefaultSpec(ctx context.Context, id string) (*specs.Spec, error) {\n\tctx = namespaces.WithNamespace(ctx, namespaces.Default)\n\treturn oci.GenerateSpec(ctx, nil, &containers.Container{ID: id})\n}", "title": "" }, { "docid": "23082f24f0b10cbf84a2e57ed637ccbb", "score": "0.42167753", "text": "func (c *K8sObjectTagClient) DeleteOne(kot *K8sObjectTag) *K8sObjectTagDeleteOne {\n\treturn c.DeleteOneID(kot.ID)\n}", "title": "" }, { "docid": "ad72ecfdf376322722a611582f77b7c1", "score": "0.4216325", "text": "func generatePodSpec(info *prowgenInfo, secret *cioperatorapi.Secret) *kubeapi.PodSpec {\n\tconfigMapKeyRef := kubeapi.EnvVarSource{\n\t\tConfigMapKeyRef: &kubeapi.ConfigMapKeySelector{\n\t\t\tLocalObjectReference: kubeapi.LocalObjectReference{\n\t\t\t\tName: info.ConfigMapName(),\n\t\t\t},\n\t\t\tKey: info.Basename(),\n\t\t},\n\t}\n\tvolumeMounts := []kubeapi.VolumeMount{{\n\t\tName: sentryDsnMountName,\n\t\tMountPath: sentryDsnMountPath,\n\t\tReadOnly: true,\n\t}}\n\n\tvolumes := []kubeapi.Volume{{\n\t\tName: sentryDsnMountName,\n\t\tVolumeSource: kubeapi.VolumeSource{\n\t\t\tSecret: &kubeapi.SecretVolumeSource{SecretName: sentryDsnSecretName},\n\t\t},\n\t}}\n\n\tif secret != nil {\n\t\tvolumeMounts = append(volumeMounts, kubeapi.VolumeMount{\n\t\t\tName: secret.Name,\n\t\t\tMountPath: secret.MountPath,\n\t\t\tReadOnly: true,\n\t\t})\n\n\t\tvolumes = append(volumes, kubeapi.Volume{\n\t\t\tName: secret.Name,\n\t\t\tVolumeSource: kubeapi.VolumeSource{\n\t\t\t\tSecret: &kubeapi.SecretVolumeSource{SecretName: secret.Name},\n\t\t\t},\n\t\t})\n\t}\n\n\tif info.config.Private {\n\t\tvolumes = append(volumes, kubeapi.Volume{\n\t\t\tName: sshSecretName,\n\t\t\tVolumeSource: kubeapi.VolumeSource{\n\t\t\t\tSecret: &kubeapi.SecretVolumeSource{SecretName: sshSecretName},\n\t\t\t},\n\t\t})\n\n\t\tvolumeMounts = append(volumeMounts, kubeapi.VolumeMount{\n\t\t\tName: sshSecretName,\n\t\t\tMountPath: sshKeyPath,\n\t\t\tReadOnly: true,\n\t\t})\n\n\t}\n\n\treturn &kubeapi.PodSpec{\n\t\tServiceAccountName: \"ci-operator\",\n\t\tContainers: []kubeapi.Container{\n\t\t\t{\n\t\t\t\tImage: \"ci-operator:latest\",\n\t\t\t\tImagePullPolicy: kubeapi.PullAlways,\n\t\t\t\tEnv: []kubeapi.EnvVar{{Name: \"CONFIG_SPEC\", ValueFrom: &configMapKeyRef}},\n\t\t\t\tResources: kubeapi.ResourceRequirements{\n\t\t\t\t\tRequests: kubeapi.ResourceList{\"cpu\": *resource.NewMilliQuantity(10, resource.DecimalSI)},\n\t\t\t\t},\n\t\t\t\tVolumeMounts: volumeMounts,\n\t\t\t},\n\t\t},\n\t\tVolumes: volumes,\n\t}\n}", "title": "" }, { "docid": "648d757c04f9a03357a1b05e056f4ac5", "score": "0.4215804", "text": "func Convert_v1beta1_OpenIDConnect_To_kubeone_OpenIDConnect(in *OpenIDConnect, out *kubeone.OpenIDConnect, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_OpenIDConnect_To_kubeone_OpenIDConnect(in, out, s)\n}", "title": "" }, { "docid": "f98bb7c07e4d315a464e7b9d12c7d811", "score": "0.42144006", "text": "func (in *ZookeeperSpec) DeepCopy() *ZookeeperSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ZookeeperSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7203c4b12ad18980d92764bd33784171", "score": "0.42004123", "text": "func Convert_example_Pod_To_v1_Pod(in *example.Pod, out *Pod, s conversion.Scope) error {\n\treturn autoConvert_example_Pod_To_v1_Pod(in, out, s)\n}", "title": "" }, { "docid": "c1cafffc7b4bdb942a764e155d96876f", "score": "0.41837403", "text": "func Convert_build_SecretSpec_To_v1_SecretSpec(in *build.SecretSpec, out *v1.SecretSpec, s conversion.Scope) error {\n\treturn autoConvert_build_SecretSpec_To_v1_SecretSpec(in, out, s)\n}", "title": "" }, { "docid": "a973bc88600f42e1c9bebe07394196f5", "score": "0.4181072", "text": "func goodPod() *kapi.Pod {\n\treturn &kapi.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: map[string]string{},\n\t\t},\n\t\tSpec: kapi.PodSpec{\n\t\t\tServiceAccountName: \"default\",\n\t\t\tSecurityContext: &kapi.PodSecurityContext{},\n\t\t\tContainers: []kapi.Container{\n\t\t\t\t{\n\t\t\t\t\tName: defaultContainerName,\n\t\t\t\t\tSecurityContext: &kapi.SecurityContext{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2617de475858e4e3fac0122b0b9a0bc1", "score": "0.4178662", "text": "func (c *K8sContainerClient) DeleteOne(kc *K8sContainer) *K8sContainerDeleteOne {\n\treturn c.DeleteOneID(kc.ID)\n}", "title": "" }, { "docid": "d7de69fdd80cc36a0641e8872ad44beb", "score": "0.4174824", "text": "func GetPodFromCertificate(cn certificate.CommonName, kubecontroller k8s.Controller) (*v1.Pod, error) {\n\tcnMeta, err := getCertificateCommonNameMeta(cn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Trace().Msgf(\"Looking for pod with label %q=%q\", constants.EnvoyUniqueIDLabelName, cnMeta.ProxyUUID)\n\tpodList := kubecontroller.ListPods()\n\tvar pods []v1.Pod\n\tfor _, pod := range podList {\n\t\tif pod.Namespace != cnMeta.Namespace {\n\t\t\tcontinue\n\t\t}\n\t\tif uuid, labelFound := pod.Labels[constants.EnvoyUniqueIDLabelName]; labelFound && uuid == cnMeta.ProxyUUID.String() {\n\t\t\tpods = append(pods, *pod)\n\t\t}\n\t}\n\n\tif len(pods) == 0 {\n\t\tlog.Error().Msgf(\"Did not find Pod with label %s = %s in namespace %s\",\n\t\t\tconstants.EnvoyUniqueIDLabelName, cnMeta.ProxyUUID, cnMeta.Namespace)\n\t\treturn nil, ErrDidNotFindPodForCertificate\n\t}\n\n\t// --- CONVENTION ---\n\t// By Open Service Mesh convention the number of services a pod can belong to is 1\n\t// This is a limitation we set in place in order to make the mesh easy to understand and reason about.\n\t// When a pod belongs to more than one service XDS will not program the Envoy proxy, leaving it out of the mesh.\n\tif len(pods) > 1 {\n\t\tlog.Error().Msgf(\"Found more than one pod with label %s = %s in namespace %s. There can be only one!\",\n\t\t\tconstants.EnvoyUniqueIDLabelName, cnMeta.ProxyUUID, cnMeta.Namespace)\n\t\treturn nil, ErrMoreThanOnePodForCertificate\n\t}\n\n\tpod := pods[0]\n\tlog.Trace().Msgf(\"Found Pod with UID=%s for proxyID %s\", pod.ObjectMeta.UID, cnMeta.ProxyUUID)\n\n\t// Ensure the Namespace encoded in the certificate matches that of the Pod\n\tif pod.Namespace != cnMeta.Namespace {\n\t\tlog.Warn().Msgf(\"Pod with UID=%s belongs to Namespace %s. The pod's xDS certificate was issued for Namespace %s\",\n\t\t\tpod.ObjectMeta.UID, pod.Namespace, cnMeta.Namespace)\n\t\treturn nil, ErrNamespaceDoesNotMatchCertificate\n\t}\n\n\t// Ensure the Name encoded in the certificate matches that of the Pod\n\tif pod.Spec.ServiceAccountName != cnMeta.ServiceAccount {\n\t\t// Since we search for the pod in the namespace we obtain from the certificate -- these namespaces will always match.\n\t\tlog.Warn().Msgf(\"Pod with UID=%s belongs to ServiceAccount=%s. The pod's xDS certificate was issued for ServiceAccount=%s\",\n\t\t\tpod.ObjectMeta.UID, pod.Spec.ServiceAccountName, cnMeta.ServiceAccount)\n\t\treturn nil, ErrServiceAccountDoesNotMatchCertificate\n\t}\n\n\treturn &pod, nil\n}", "title": "" }, { "docid": "9c1734504b3f3c7c9cb2caf10f0693c8", "score": "0.41736948", "text": "func Convert_build_CommonSpec_To_v1_CommonSpec(in *build.CommonSpec, out *v1.CommonSpec, s conversion.Scope) error {\n\treturn autoConvert_build_CommonSpec_To_v1_CommonSpec(in, out, s)\n}", "title": "" }, { "docid": "edd081b831dcaf8fc8fb8d337945ae2f", "score": "0.41735175", "text": "func (in *UnmanagedEtcdSpec) DeepCopy() *UnmanagedEtcdSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UnmanagedEtcdSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "db3f2a4df7cc606ba1b26fb2a477d8c1", "score": "0.4132161", "text": "func Convert_v1beta1_KubeOneCluster_To_kubeone_KubeOneCluster(in *KubeOneCluster, out *kubeone.KubeOneCluster, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_KubeOneCluster_To_kubeone_KubeOneCluster(in, out, s)\n}", "title": "" }, { "docid": "3416bd44a1b7eef1b59e7721d8942572", "score": "0.4130901", "text": "func (d DeploymentController) GetPodSpec() *kubeAPICoreV1.PodSpec {\n\treturn &d.K8SResource.Spec.Template.Spec\n}", "title": "" }, { "docid": "cbf770d5f73dd36ff1db1fcd0f08cd99", "score": "0.4118334", "text": "func (c *EquipmentPortDefinitionClient) DeleteOne(epd *EquipmentPortDefinition) *EquipmentPortDefinitionDeleteOne {\n\treturn c.DeleteOneID(epd.ID)\n}", "title": "" }, { "docid": "44b6c06a65bac2e026eb442ecddc59cf", "score": "0.4083945", "text": "func NewDigitaloceanInfoer(config Config, logger cloudinfo.Logger) (*DigitaloceanInfoer, error) {\n\ttokenSource := oauth2.StaticTokenSource(&oauth2.Token{\n\t\tAccessToken: config.AccessToken,\n\t})\n\toauthClient := oauth2.NewClient(context.Background(), tokenSource)\n\tclient := godo.NewClient(oauthClient)\n\n\treturn &DigitaloceanInfoer{\n\t\tclient: client,\n\t\tlogger: logger,\n\t}, nil\n}", "title": "" }, { "docid": "ed5366029669cd60cbaafc156556ad16", "score": "0.4071312", "text": "func (in *PodChaosSpec) DeepCopy() *PodChaosSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PodChaosSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "54008351a87a0a60472a88385b57b922", "score": "0.4059843", "text": "func Convert_v1beta1_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(in *ACMEChallengeSolverHTTP01IngressPodSpec, out *acme.ACMEChallengeSolverHTTP01IngressPodSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(in, out, s)\n}", "title": "" }, { "docid": "7295115919857afd5f7c3544ee283462", "score": "0.40558934", "text": "func NewListDigitaloceanSizesOK() *ListDigitaloceanSizesOK {\n\treturn &ListDigitaloceanSizesOK{}\n}", "title": "" }, { "docid": "4ce20c94b4fdaea1f32e08097b13e27a", "score": "0.40528926", "text": "func New(token string, region string) *DigitalOcean {\n\ttokenSource := &TokenSource{\n\t\tAccessToken: token,\n\t}\n\toauthClient := oauth2.NewClient(context.Background(), tokenSource)\n\tclient := godo.NewClient(oauthClient)\n\n\treturn &DigitalOcean{client: client, token: token, region: region}\n\n}", "title": "" }, { "docid": "b26168dbef1a15c2df842fdc84018d15", "score": "0.4050694", "text": "func Convert_v1beta1_OpenIDConnectConfig_To_kubeone_OpenIDConnectConfig(in *OpenIDConnectConfig, out *kubeone.OpenIDConnectConfig, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_OpenIDConnectConfig_To_kubeone_OpenIDConnectConfig(in, out, s)\n}", "title": "" }, { "docid": "e287f144f6f1951db23a234119e8417e", "score": "0.40463856", "text": "func (c *K8sObjectTagClient) UpdateOne(kot *K8sObjectTag) *K8sObjectTagUpdateOne {\n\tmutation := newK8sObjectTagMutation(c.config, OpUpdateOne, withK8sObjectTag(kot))\n\treturn &K8sObjectTagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ab93c4d8b2f04bf86361e4ce302e027f", "score": "0.40429494", "text": "func MakeUploadPodSpec(image, verbose, pullPolicy, name string, pvc *v1.PersistentVolumeClaim, secretName string) *v1.Pod {\n\tpod := &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tannCreatedByUpload: \"yes\",\n\t\t\t},\n\t\t\tLabels: map[string]string{\n\t\t\t\tcommon.CDILabelKey: common.CDILabelValue,\n\t\t\t\tcommon.CDIComponentLabel: common.UploadServerCDILabel,\n\t\t\t\tcommon.UploadServerServiceLabel: name,\n\t\t\t},\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\tMakePVCOwnerReference(pvc),\n\t\t\t},\n\t\t},\n\t\tSpec: v1.PodSpec{\n\t\t\tContainers: []v1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: common.UploadServerPodname,\n\t\t\t\t\tImage: image,\n\t\t\t\t\tImagePullPolicy: v1.PullPolicy(pullPolicy),\n\t\t\t\t\tVolumeMounts: []v1.VolumeMount{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: DataVolName,\n\t\t\t\t\t\t\tMountPath: common.UploadServerDataDir,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tEnv: []v1.EnvVar{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"TLS_KEY\",\n\t\t\t\t\t\t\tValueFrom: &v1.EnvVarSource{\n\t\t\t\t\t\t\t\tSecretKeyRef: &v1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\tLocalObjectReference: v1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\tName: secretName,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tKey: keys.KeyStoreTLSKeyFile,\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\t{\n\t\t\t\t\t\t\tName: \"TLS_CERT\",\n\t\t\t\t\t\t\tValueFrom: &v1.EnvVarSource{\n\t\t\t\t\t\t\t\tSecretKeyRef: &v1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\tLocalObjectReference: v1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\tName: secretName,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tKey: keys.KeyStoreTLSCertFile,\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\t{\n\t\t\t\t\t\t\tName: \"CLIENT_CERT\",\n\t\t\t\t\t\t\tValueFrom: &v1.EnvVarSource{\n\t\t\t\t\t\t\t\tSecretKeyRef: &v1.SecretKeySelector{\n\t\t\t\t\t\t\t\t\tLocalObjectReference: v1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\t\tName: secretName,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tKey: keys.KeyStoreTLSCAFile,\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\tArgs: []string{\"-v=\" + verbose},\n\t\t\t\t},\n\t\t\t},\n\t\t\tRestartPolicy: v1.RestartPolicyOnFailure,\n\t\t\tVolumes: []v1.Volume{\n\t\t\t\t{\n\t\t\t\t\tName: DataVolName,\n\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\tPersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\t\t\tClaimName: pvc.Name,\n\t\t\t\t\t\t\tReadOnly: false,\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 pod\n}", "title": "" }, { "docid": "7707aeb835dbbd8ffe3f48483a33717a", "score": "0.40393704", "text": "func (in *ControllerControlDaemonSetSpec) DeepCopy() *ControllerControlDaemonSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerControlDaemonSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d068d12083b73d3fcfd26c3e6f391878", "score": "0.40370885", "text": "func Convert_v1beta1_HostConfig_To_kubeone_HostConfig(in *HostConfig, out *kubeone.HostConfig, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_HostConfig_To_kubeone_HostConfig(in, out, s)\n}", "title": "" }, { "docid": "107658bb2ad8ca653a47f60f6c455ba0", "score": "0.40351516", "text": "func (c *K8sObjectClient) UpdateOne(ko *K8sObject) *K8sObjectUpdateOne {\n\tmutation := newK8sObjectMutation(c.config, OpUpdateOne, withK8sObject(ko))\n\treturn &K8sObjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "10df741a62c6880e9a0cfd6da6fc73d1", "score": "0.4032152", "text": "func Convert_v1beta1_ControlPlaneConfig_To_kubeone_ControlPlaneConfig(in *ControlPlaneConfig, out *kubeone.ControlPlaneConfig, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_ControlPlaneConfig_To_kubeone_ControlPlaneConfig(in, out, s)\n}", "title": "" }, { "docid": "8f1aed60c5904a1876106b1d1a43cf03", "score": "0.40299034", "text": "func NewOcean(size int) (Ocean, error) {\n\tif size <= 0 {\n\t\treturn nil, fmt.Errorf(\"size %q must be greater than 0\", size)\n\t}\n\n\tc := make([][]bool, size)\n\n\tfor y := range c {\n\t\tc[y] = make([]bool, size)\n\t}\n\n\treturn &defaultOcean{\n\t\tcoordinates: c,\n\t\tsize: size,\n\t}, nil\n}", "title": "" }, { "docid": "0d22539413086603264b14e8f18cfb48", "score": "0.40068406", "text": "func (c *K8sDaemonSetClient) DeleteOne(kds *K8sDaemonSet) *K8sDaemonSetDeleteOne {\n\treturn c.DeleteOneID(kds.ID)\n}", "title": "" }, { "docid": "15bd59f43f6121ada3cbec690db89fc5", "score": "0.40000227", "text": "func (c *FakePodSpecs) Create(podSpec *v1alpha.PodSpec) (result *v1alpha.PodSpec, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(podspecsResource, c.ns, podSpec), &v1alpha.PodSpec{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha.PodSpec), err\n}", "title": "" }, { "docid": "2764ae84974da52f52b8e5d24a2d880b", "score": "0.399202", "text": "func Convert_seratos_MicroserviceSpec_To_v1beta1_MicroserviceSpec(in *seratos.MicroserviceSpec, out *MicroserviceSpec, s conversion.Scope) error {\n\treturn autoConvert_seratos_MicroserviceSpec_To_v1beta1_MicroserviceSpec(in, out, s)\n}", "title": "" }, { "docid": "ea6cbdb635c54d41e109552a387ea0d9", "score": "0.39888164", "text": "func (c *K8sEventClient) DeleteOne(ke *K8sEvent) *K8sEventDeleteOne {\n\treturn c.DeleteOneID(ke.ID)\n}", "title": "" }, { "docid": "ee717013acfa6f9ed163e4b9560582b0", "score": "0.3984381", "text": "func Convert_core_PdSpec_To_v1alpha1_PdSpec(in *core.PdSpec, out *PdSpec, s conversion.Scope) error {\n\treturn autoConvert_core_PdSpec_To_v1alpha1_PdSpec(in, out, s)\n}", "title": "" }, { "docid": "cccf56f26d62e823a4c6710436048578", "score": "0.39842755", "text": "func (c *FakePodSpecs) Get(name string, options v1.GetOptions) (result *v1alpha.PodSpec, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(podspecsResource, c.ns, name), &v1alpha.PodSpec{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha.PodSpec), err\n}", "title": "" }, { "docid": "2ea6aee323dd6c43904b7b3582887f84", "score": "0.39824095", "text": "func Convert_v1beta1_ExternalCNISpec_To_kubeone_ExternalCNISpec(in *ExternalCNISpec, out *kubeone.ExternalCNISpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_ExternalCNISpec_To_kubeone_ExternalCNISpec(in, out, s)\n}", "title": "" }, { "docid": "7b0812d548e9a65f5a2efa1d47c989a6", "score": "0.39815497", "text": "func NewPod(ds *ketiv1.DaemonSet, nodeName string) *ketiv1.Pod {\n\tnewPod := &ketiv1.Pod{Spec: ds.Spec.Template.Spec, ObjectMeta: ds.Spec.Template.ObjectMeta}\n\tnewPod.Namespace = ds.Namespace\n\tnewPod.Spec.NodeName = nodeName\n\tnewPod.Labels[\"keti.checkpoint.type\"] = \"Daemonset\"\n\tnewPod.Labels[\"keti.checkpoint.name\"] = newPod.Name\n\n\t// Added default tolerations for DaemonSet pods.\n\tdaemonutil.AddOrUpdateDaemonPodTolerations(&newPod.Spec)\n\n\treturn newPod\n}", "title": "" }, { "docid": "65a1af44804f43a239e91481d1e4fbad", "score": "0.39685264", "text": "func (in *DockerSpec) DeepCopy() *DockerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "260de0478a5f69adb3b10cf466f5676e", "score": "0.39663076", "text": "func (in *SDPAzadfv1Spec) DeepCopy() *SDPAzadfv1Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SDPAzadfv1Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e80da0c64695268e4e3498ec908e675f", "score": "0.39645597", "text": "func MakePodSpec(podConfig *Config) *v1.PodSpec {\n\timage := imageutils.BusyBox\n\tif podConfig.ImageID != imageutils.None {\n\t\timage = podConfig.ImageID\n\t}\n\tsecurityLevel := podConfig.SecurityLevel\n\tif securityLevel == \"\" {\n\t\tsecurityLevel = admissionapi.LevelBaseline\n\t}\n\tpodSpec := &v1.PodSpec{\n\t\tHostIPC: podConfig.HostIPC,\n\t\tHostPID: podConfig.HostPID,\n\t\tSecurityContext: GeneratePodSecurityContext(podConfig.FsGroup, podConfig.SeLinuxLabel),\n\t\tContainers: []v1.Container{\n\t\t\t{\n\t\t\t\tName: \"write-pod\",\n\t\t\t\tImage: GetTestImage(image),\n\t\t\t\tCommand: GenerateScriptCmd(podConfig.Command),\n\t\t\t\tSecurityContext: GenerateContainerSecurityContext(securityLevel),\n\t\t\t},\n\t\t},\n\t\tRestartPolicy: v1.RestartPolicyOnFailure,\n\t}\n\n\tif podConfig.PodFSGroupChangePolicy != nil {\n\t\tpodSpec.SecurityContext.FSGroupChangePolicy = podConfig.PodFSGroupChangePolicy\n\t}\n\n\tsetVolumes(podSpec, podConfig.PVCs, podConfig.InlineVolumeSources, podConfig.PVCsReadOnly)\n\tSetNodeSelection(podSpec, podConfig.NodeSelection)\n\treturn podSpec\n}", "title": "" }, { "docid": "10a2889396814b9ae858bd549224f5cd", "score": "0.39643404", "text": "func (o *CreateCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *CreateCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "33a14c9134372c4741f9d91d607cdea3", "score": "0.39594233", "text": "func Convert_v1beta1_CiliumSpec_To_kubeone_CiliumSpec(in *CiliumSpec, out *kubeone.CiliumSpec, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_CiliumSpec_To_kubeone_CiliumSpec(in, out, s)\n}", "title": "" }, { "docid": "b31c1d5f39ca7adfd53e45227ff7dc29", "score": "0.3958531", "text": "func (c *K8sContainerClient) UpdateOne(kc *K8sContainer) *K8sContainerUpdateOne {\n\tmutation := newK8sContainerMutation(c.config, OpUpdateOne, withK8sContainer(kc))\n\treturn &K8sContainerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "ed1fd4a150d42f7a5318a521597d532b", "score": "0.3957953", "text": "func Convert_seratos_SidecarSpec_To_v1beta1_SidecarSpec(in *seratos.SidecarSpec, out *SidecarSpec, s conversion.Scope) error {\n\treturn autoConvert_seratos_SidecarSpec_To_v1beta1_SidecarSpec(in, out, s)\n}", "title": "" }, { "docid": "1e9d0bad9551e4d86af80cca23c42cd9", "score": "0.39576632", "text": "func (c *SpecClient) UpdateOne(s *Spec) *SpecUpdateOne {\n\tmutation := newSpecMutation(c.config, OpUpdateOne, withSpec(s))\n\treturn &SpecUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "d5b35fa672b7e283d5c5dd5740f81794", "score": "0.39527643", "text": "func ValidateOcean(ocean string) error {\n\tif strings.TrimSpace(ocean) == \"\" {\n\t\treturn consts.ErrInvalidDocumentOcean\n\t}\n\n\tw := strings.Fields(ocean)\n\tswitch len(w) {\n\tcase 1:\n\t\t{\n\t\t\tif !oceanMap[strings.ToLower(w[0])] {\n\t\t\t\treturn consts.ErrInvalidDocumentOcean\n\t\t\t}\n\t\t}\n\tcase 2:\n\t\t{\n\t\t\tif !strings.EqualFold(strings.ToLower(w[1]), \"ocean\") || !oceanMap[strings.ToLower(w[0])] {\n\t\t\t\treturn consts.ErrInvalidDocumentOcean\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t{\n\t\t\treturn consts.ErrInvalidDocumentOcean\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6bb8d48ae4984b079af8925fb24ce51c", "score": "0.39525604", "text": "func (c *ContainerClient) DeleteOne(co *Container) *ContainerDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "title": "" }, { "docid": "54427c6825ef21c6c02da144f74494a6", "score": "0.39502457", "text": "func (in *EtcdSpec) DeepCopy() *EtcdSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EtcdSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "139280d7930286dd2f4ab93e717e0fb4", "score": "0.39457017", "text": "func Test_AddPodToVolume_Positive_NamesForDifferentPodsAndDifferentVolumes(t *testing.T) {\n\t// Arrange\n\tfakeVolumeHost := volumetesting.NewFakeVolumeHost(t,\n\t\t\"\", /* rootDir */\n\t\tnil, /* kubeClient */\n\t\tnil, /* plugins */\n\t)\n\tplugins := []volume.VolumePlugin{\n\t\t&volumetesting.FakeBasicVolumePlugin{\n\t\t\tPlugin: volumetesting.FakeVolumePlugin{\n\t\t\t\tPluginName: \"basic\",\n\t\t\t},\n\t\t},\n\t\t&volumetesting.FakeDeviceMountableVolumePlugin{\n\t\t\tFakeBasicVolumePlugin: volumetesting.FakeBasicVolumePlugin{\n\t\t\t\tPlugin: volumetesting.FakeVolumePlugin{\n\t\t\t\t\tPluginName: \"device-mountable\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t&volumetesting.FakeAttachableVolumePlugin{\n\t\t\tFakeDeviceMountableVolumePlugin: volumetesting.FakeDeviceMountableVolumePlugin{\n\t\t\t\tFakeBasicVolumePlugin: volumetesting.FakeBasicVolumePlugin{\n\t\t\t\t\tPlugin: volumetesting.FakeVolumePlugin{\n\t\t\t\t\t\tPluginName: \"attachable\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tvolumePluginMgr := volume.VolumePluginMgr{}\n\tvolumePluginMgr.InitPlugins(plugins, nil /* prober */, fakeVolumeHost)\n\tseLinuxTranslator := util.NewFakeSELinuxLabelTranslator()\n\tdsw := NewDesiredStateOfWorld(&volumePluginMgr, seLinuxTranslator)\n\n\ttestcases := map[string]struct {\n\t\tpod1 *v1.Pod\n\t\tpod2 *v1.Pod\n\t\tsame bool\n\t}{\n\t\t\"basic\": {\n\t\t\t&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"pod1\",\n\t\t\t\t\tUID: \"pod1uid\",\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"basic\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{},\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&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"pod2\",\n\t\t\t\t\tUID: \"pod2uid\",\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"basic\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{},\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\tfalse,\n\t\t},\n\t\t\"device-mountable\": {\n\t\t\t&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"pod1\",\n\t\t\t\t\tUID: \"pod1uid\",\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"device-mountable\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{},\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&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"pod2\",\n\t\t\t\t\tUID: \"pod2uid\",\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"device-mountable\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{},\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\ttrue,\n\t\t},\n\t\t\"attachable\": {\n\t\t\t&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"pod1\",\n\t\t\t\t\tUID: \"pod1uid\",\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"attachable\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{},\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&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"pod2\",\n\t\t\t\t\tUID: \"pod2uid\",\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"attachable\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{},\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\ttrue,\n\t\t},\n\t}\n\n\t// Act & Assert\n\tfor name, v := range testcases {\n\t\tvolumeSpec1 := &volume.Spec{Volume: &v.pod1.Spec.Volumes[0]}\n\t\tvolumeSpec2 := &volume.Spec{Volume: &v.pod2.Spec.Volumes[0]}\n\t\tgeneratedVolumeName1, err1 := dsw.AddPodToVolume(util.GetUniquePodName(v.pod1), v.pod1, volumeSpec1, volumeSpec1.Name(), \"\", nil)\n\t\tgeneratedVolumeName2, err2 := dsw.AddPodToVolume(util.GetUniquePodName(v.pod2), v.pod2, volumeSpec2, volumeSpec2.Name(), \"\", nil)\n\t\tif err1 != nil {\n\t\t\tt.Fatalf(\"test %q: AddPodToVolume failed. Expected: <no error> Actual: <%v>\", name, err1)\n\t\t}\n\t\tif err2 != nil {\n\t\t\tt.Fatalf(\"test %q: AddPodToVolume failed. Expected: <no error> Actual: <%v>\", name, err2)\n\t\t}\n\t\tif v.same {\n\t\t\tif generatedVolumeName1 != generatedVolumeName2 {\n\t\t\t\tt.Fatalf(\"test %q: AddPodToVolume should generate same names, but got %q != %q\", name, generatedVolumeName1, generatedVolumeName2)\n\t\t\t}\n\t\t} else {\n\t\t\tif generatedVolumeName1 == generatedVolumeName2 {\n\t\t\t\tt.Fatalf(\"test %q: AddPodToVolume should generate different names, but got %q == %q\", name, generatedVolumeName1, generatedVolumeName2)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "b786b88e7504c3d5396a7ce43d5af26c", "score": "0.3945479", "text": "func (c *K8sDeploymentClient) DeleteOne(kd *K8sDeployment) *K8sDeploymentDeleteOne {\n\treturn c.DeleteOneID(kd.ID)\n}", "title": "" }, { "docid": "48e6f6d4db12239c194272fe546e9269", "score": "0.39426324", "text": "func (c *Client) GetOnePodFromSelector(selector string) (*corev1.Pod, error) {\n\n\tpods, err := c.kubeClient.CoreV1().Pods(c.namespace).List(metav1.ListOptions{\n\t\tLabelSelector: selector,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to get Pod for the selector: %v\", selector)\n\t}\n\tnumDC := len(pods.Items)\n\tif numDC == 0 {\n\t\treturn nil, fmt.Errorf(\"no Pod was found for the selector: %v\", selector)\n\t} else if numDC > 1 {\n\t\treturn nil, fmt.Errorf(\"multiple Pods exist for the selector: %v. Only one must be present\", selector)\n\t}\n\n\treturn &pods.Items[0], nil\n}", "title": "" }, { "docid": "be6732c5b8906cbea8affbaa6bb7cce7", "score": "0.3936606", "text": "func (c *K8sDaemonSetClient) UpdateOne(kds *K8sDaemonSet) *K8sDaemonSetUpdateOne {\n\tmutation := newK8sDaemonSetMutation(c.config, OpUpdateOne, withK8sDaemonSet(kds))\n\treturn &K8sDaemonSetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "bfd4608833a9a46aec9edc616b1022de", "score": "0.39347962", "text": "func AddShowDefaultPodSpecFlag(flag *bool, flags *pflag.FlagSet) {\n\tflags.BoolVar(\n\t\tflag, \"show-default-podspec\", false,\n\t\t\"If true, include the default pod spec used for plugins in the output\",\n\t)\n}", "title": "" }, { "docid": "1e496adfd440acd8596d8a38af0f23b9", "score": "0.39281365", "text": "func stubDeletePod(r *http.Request) (interface{}, error) {\n\n\tresp := cniapi.RspAddPod{}\n\n\tcontent, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlogger.Errorf(\"Failed to read request: %v\", err)\n\t\treturn resp, err\n\t}\n\n\tpInfo := cniapi.CNIPodAttr{}\n\tif err := json.Unmarshal(content, &pInfo); err != nil {\n\t\treturn resp, err\n\t}\n\n\t// verify pod attributes are as expected.\n\tif pInfo.Name == \"utPod\" && pInfo.K8sNameSpace == \"utK8sNS\" &&\n\t\tpInfo.InfraContainerID != \"\" && pInfo.IntfName != \"\" {\n\t\tresp.EndpointID = pInfo.InfraContainerID\n\t\treturn resp, nil\n\t}\n\tlogger.Errorf(\"Failed pod %v\", pInfo)\n\treturn resp, fmt.Errorf(\"failed to delete pod\")\n}", "title": "" }, { "docid": "ee56a921c41d7b29cf55452c9311f424", "score": "0.39275208", "text": "func Convert_v1alpha3_AWSManagedControlPlaneSpec_To_v1beta1_AWSManagedControlPlaneSpec(in *AWSManagedControlPlaneSpec, out *v1beta1.AWSManagedControlPlaneSpec, s conversion.Scope) error {\n\treturn autoConvert_v1alpha3_AWSManagedControlPlaneSpec_To_v1beta1_AWSManagedControlPlaneSpec(in, out, s)\n}", "title": "" } ]